[AIR #1220] arch-init: architect auto-state-saving lifecycle - #1221
Merged
Conversation
Add a save-then-suggest-/clear lifecycle to the /arch-init skill so the architect deliberately curates codev/state/<name>.md at resumable checkpoints, then advises the human it is a good time to /clear. Save-then-suggest ordering is the core safety property: the agent cannot clear its own context, so the irreversible action stays behind a human keystroke and the save always precedes the suggestion. Skill text (both trees, byte-identical) now instructs: - when to save (resumable boundary; never mid-task) - write format = read format (rewrite current-state + append dated entry) - compaction discipline (one screen; prune stale sections) - advisory-not-nagging /clear suggestion, only right after a save - content guardrails (no secrets, no transcript dumps) Extends spec-1134 skill tests with #1220 required-content assertions; all existing byte-equality and content assertions preserved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
/arch-initinstruct a complete context-lifecycle loop, not just recovery. Today the skill readscodev/state/<name>.mdat session start and never writes — so the recovery flow assumes a file nothing tells anyone to write (the durability gap named in #1212). This change adds an architect auto-save section: the architect curates its state file at a resumable checkpoint, then suggests the human/clear.The state file stops being crash insurance and becomes deliberate memory management: a summary written at a moment the architect chooses, at a resumable boundary — better than auto-compaction because both timing and content are intentional. Self-reinforcing: every recovery re-reads the skill and re-primes the save habit, so the gap closes after each architect's first
/arch-init.Supersedes #1212 (closed wontfix — approach switched from "separate save command / standing instruction" to "auto-saving built into
/arch-inititself").Key decisions
/clear. The irreversible action stays behind a human keystroke, and accepting the suggestion can never lose anything because the save already happened./arch-init, not a new/arch-saveskill — per the issue's self-reinforcement rationale.codev-skeleton/.claude/skills/arch-init/SKILL.mdand.claude/skills/arch-init/SKILL.mdare byte-identical (drift guard test enforces it).What the skill now instructs (all five issue requirements)
/clearsuggestion appears only right after a save, phrased softly, and is not repeated.Existing recovery behavior (identity resolution via
afx whoami, name validation / path-traversal guard, missing-file flow with_thread.mdexclusion, four architect guardrails) is unchanged.Test plan
packages/codev/src/agent-farm/__tests__/spec-1134-arch-init-skill.test.ts— all existing assertions preserved (two-tree byte-equality, required/forbidden content), plus new #1220 required-content assertions:codev/state/<name>.mdat checkpoints/clearorderingVerification:
vitest run spec-1134-arch-init-skill.test.ts→ 19 passedtsc --noEmit→ cleanporch check 1220→ build ✓, tests ✓Acceptance criteria
/clear; save = rewrite current-state + append dated; prune stale; never mid-task; no secrets.Closes #1220.
🤖 Generated with Claude Code