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

Open
#2,392 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
github, typescript

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
3.4k
Forks
516
Avg merge
1d 15h
Merged PRs (30d)
116

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/squad

All issues in github/squad

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.