archival-integrity
Preserve content when moving entries between tracked Squad state files
- License 许可
- MIT
- 所属仓库
- github/squad
- 最近更新
- 2026-11-15
- Stars
- ★ 3.4k
- Forks
- 520
01 前言 Front Matter
- name
- archival-integrity
- domain
- state-management, documentation
- source
- implemented archival helpers and regression tests
- confidence
- high
- description
- Preserve content when moving entries between tracked Squad state files
03 SKILL.md 正文
Context
Use this skill for decision archival, history summarization, or any operation that moves entries between repository state files. A move has two halves: append to the destination, then trim the source. Treat it as data loss prevention, not text cleanup.
Scope
- Activate when moving entries between tracked Squad state files such as decision logs, histories, or inbox merges.
- Allowed targets: tracked repository state files and their designated tracked archives.
- Exclusions: untracked destinations, byte-delta-only validation, and trimming source content before the destination is verified.
- This procedure is scoped to the local state backend unless the active backend exposes governed append, read-back, and trim operations. Runtime-owned orphan or two-layer state is not a valid archival destination; use the backend's state operation instead of editing a checkout copy.
Patterns
- Resolve a destination that is already tracked before writing. If the requested destination is untracked, redirect to a tracked archive or stop.
- Append first, re-read the destination, and prove every moved heading is present.
- Compare entry counts before and after the append. Trim only when the count increased by exactly the selected number of entries.
- Report measured
removed from source / added to destinationcounts. Do not use byte deltas as an integrity signal. - When inserting an inbox body beneath a
###entry, demote its shallowest heading to####while preserving relative levels and fenced-code content. - Prefer
archiveEntries(),prepareInboxBodyForMerge(), andformatArchivalReport()frompackages/squad-sdk/src/state/io/archival.tsover hand-rolled archival logic.
Stop conditions
- Stop if the destination is not already tracked.
- Stop if the appended headings cannot be re-read from the destination.
- Stop if the entry-count increase does not exactly match the selected move set.
- Stop if the active backend is non-local and does not provide governed archival operations.
- Stop if state appears orphaned, split across runtime and checkout layers, or owned by another process without an explicit handoff.
Examples
The archival tests in test/state/archival.test.ts cover append failures, swallowed writes,
untracked destinations, CRLF inputs, count verification, and fence-aware heading demotion.
Anti-Patterns
- Creating a timestamped archive under a git-excluded directory and assuming it will persist
- Deleting source content before the destination has been verified
- Reporting “no archival required” without measuring eligible entries
- Treating a matching file-size delta as proof that the content survived
04 同仓库更多 Skills
windows-compatibility
Cross-platform path handling and command patterns
versioning-policy
SemVer rules for Squad's stable, preview, insider, and local package versions
tiered-memory
Three-tier agent memory model (hot/cold/wiki) for context reduction per spawn
test-discipline
Design assertions that prove the actual contract and fail on realistic regressions
squad
Squad's command catalog and interactive menu. Invoke via /squad (slash command) or natural language ("squad commands", "what can squad do", "show me squad options"). Presents categorized operations (Install & Upgrade, Team Management, Issues & PRs, Plugins & Skills, Model & Cost, Sessions & State) as an interactive picker. Routes to the right squad CLI command or the Squad coordinator agent.
squad-version-check
Internals of how @bradygaster/squad-cli stamps its version, how `squad upgrade` works (what it preserves vs overwrites), and how to probe the npm registry for the latest version from a coordinator prompt.