|
| 1 | +--- |
| 2 | +'@bradygaster/squad-sdk': minor |
| 3 | +'@bradygaster/squad-cli': minor |
| 4 | +--- |
| 5 | + |
| 6 | +Make archival incapable of destroying state (#1774, #1783, #1760) |
| 7 | + |
| 8 | +Archival is a two-half operation — append to a destination, trim from a source. |
| 9 | +Three production defects came from those halves coming apart, each one silently |
| 10 | +deleting team history while reporting success. |
| 11 | + |
| 12 | +New `state/io/archival` module in the SDK enforces the five rules in code rather |
| 13 | +than only in prompt text: |
| 14 | + |
| 15 | +- `resolveTrackedDestination()` / `isTrackedInGit()` — refuse to archive into a |
| 16 | + destination that is not git-tracked, or redirect to a tracked fallback. Under a |
| 17 | + git-excluded `.squad/`, already-tracked files still commit while brand-new files |
| 18 | + silently never do, which turns archival into deletion (#1783). |
| 19 | +- `archiveEntries()` — append, verify by literal heading containment **and** entry |
| 20 | + count, and only then trim. A failed append leaves the source completely intact |
| 21 | + (#1774). |
| 22 | +- `formatArchivalReport()` — reports entry counts and refuses to render an |
| 23 | + unbalanced result. File size is not a valid integrity signal, since a merge and |
| 24 | + an archive in the same pass move size in opposite directions. |
| 25 | +- `prepareInboxBodyForMerge()` / `demoteHeadings()` — fence-aware heading demotion |
| 26 | + so inbox `##` sections land at `####` beneath an `###` entry instead of breaking |
| 27 | + document hierarchy (#1760). `#` lines inside fenced code blocks are never |
| 28 | + rewritten. |
| 29 | + |
| 30 | +Scribe's charter, spawn template, and the `decision-hygiene` watch capability |
| 31 | +prompt now carry the same rules. |
| 32 | + |
| 33 | +**`squad nap` no longer destroys decision history.** `archiveDecisions()` in the |
| 34 | +CLI is a second, *shipped and user-invocable* archival path (`squad nap`, REPL |
| 35 | +`/nap`) that had all three defects independently of the agent path, and it is now |
| 36 | +wired to the SDK module: |
| 37 | + |
| 38 | +- It appended to `.squad/decisions-archive.md` with no tracked-destination check. |
| 39 | + With `.squad/` git-excluded and no archive file yet, every archived record was |
| 40 | + written somewhere that could never be committed while the trim of the tracked |
| 41 | + `decisions.md` committed normally — a total loss of the archived records. |
| 42 | +- It trimmed the source unconditionally, even on the branch where the append was |
| 43 | + skipped, and never verified that the append landed. |
| 44 | +- It split records on `/^###\s/` with no fence tracking, so a `###` line inside a |
| 45 | + fenced code sample was treated as a record boundary and severed the record. |
| 46 | + |
| 47 | +Archival now refuses to run when the destination is untracked *and* git-ignored, |
| 48 | +verifies the appended entry count before removing anything from the source, and |
| 49 | +reuses the SDK's fence-aware scanner for record boundaries. Because this changes |
| 50 | +the behavior of a user-invocable command rather than only prompt text, the CLI |
| 51 | +takes a minor bump. |
0 commit comments