ADR: Squad memory and state model (API boundary, history.md, archive policy, Scribe)

未關閉
#2,392 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
20/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
github, typescript

研究方向

Start with the proposed order and the listed validation tests; the issue names templates/after-agent-reference.md, packages/squad-sdk/src/client/adapters/coordinator.ts, templates/spawn-reference.md, and squad.agent.md as surfaces for D5. Read the charter and the existing tests first. Done means the five decisions are implemented in sequence, each validation passes, and bug-fix tests are shown failing against the pre-fix state.

由索引模型根據 Issue 內容生成。

描述

wave:3-later

Purpose

One decision record for Squad's memory and state model, replacing five overlapping issues (#1243, #1268, #1269, #1270, #2321) and absorbing the hot/cold requirement from closed #600. Prior consolidation notes on #1268 and #1243 already named #1270 as canonical; this issue makes that explicit and puts the open decisions in one place. Nothing here is committed work.

The decisions that need an owner

D1: API boundary (from #1270). Today squad_state_* (raw file ops) and memory.* (classified, audited, indexed) are parallel, not layered, over the same StorageProvider. Options: (a) layer squad_state_* under memory.* so governance runs by default, with an explicit opt-out; (b) keep both, document when to use which; (c) retire memory.* governance. Proposed: (a), because every downstream gap below follows from governance running only at first write.

D2: history.md authority (from #1243). Options: (a) direct authored state, size-capped; (b) derived from governed memory; (c) class-aware bounded context with a hot (always loaded, recent plus active-issue entries) and cold (archive, on demand) split. Proposed: (c), which also carries #600's measured problem (history files of 34-74KB, 82-96% stale). The GitHub Wiki layer from #600 is cut.

D3: Archive policy (from #1269). Archival today is time-only (decisions.md at 20KB/50KB, history at 15KB) and ignores class and loadGuidance, so a POLICY entry can age out like a throwaway note. Proposed: archival must read class and loadGuidance; entries with loadGuidance: ALWAYS are never archived by age alone.

D4: Scribe lifecycle (from #1268). Scribe runs inbox merge, archival, summarization and cross-agent propagation through squad_state_*, so classification and audit never re-run. Proposed: decided after D1; Scribe operations emit audit records (promote, delete, write) once the boundary is layered.

D5: One Scribe definition (from #2321). Since #2030 the charter says Scribe only merges accepted decisions, but templates/after-agent-reference.md, the host digest in packages/squad-sdk/src/client/adapters/coordinator.ts, the decision-hygiene watch capability, templates/spawn-reference.md, squad.agent.md and five docs pages still describe the older broad job, and the original issue also reports an install problem. Proposed: the charter is the single source; every other surface either links to it or is corrected. This is independent of D1-D4 and can ship first.

Proposed order

  1. D5 (pure consistency, no design risk).
  2. D1 (unblocks the rest).
  3. D3 and D2 (can proceed in parallel once D1 lands).
  4. D4 last.

Validation (every phase testable)

Decision Test that proves it
D5 A test that scans shipped templates, host digest and docs for the retired Scribe duties and fails on any match; it must fail on the pre-fix tree.
D1 Contract test: a squad_state_write to a governed path produces a classification and an audit row; the opt-out path produces neither and is explicit.
D3 Fixture with a 60-day-old POLICY entry and a 60-day-old LOCAL note over the size threshold: only the LOCAL note is archived. Fails on current behavior.
D2 Spawn-context test: hot layer only is loaded by default; token count at spawn compared against the baseline in #600 for the same agents.
D4 Each Scribe lifecycle step yields an audit record with provenance.

Each bug-fix style test must be shown red against the pre-fix state before merge.

Out of scope

Backend-specific failures (orphan or two-layer backends, #2229, #2231, #2320, #2378) are tracked separately and are bug work, not part of this decision.

Closed in favor of this issue

#1243, #1268, #1269, #1270, #2321, and earlier #600.

主要語言
TypeScript
星號
3.4k
分支
516
平均合併
1 天 15 小時
30 天內合併 PR
116

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/squad 的其他 Issue

查看 github/squad 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。