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

Ouverte
#2,392 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
20/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
github, typescript

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

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.

Langage dominant
TypeScript
Étoiles
3.4k
Forks
516
Merge moyen
1 j 15 h
PR mergées (30 j)
116

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/squad

Toutes les issues de github/squad

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.