Repository navigation
feat: /checkpoint file-level snapshot + restore; hooks gate recipes - #366
Merged
Merged
Conversation
Two gaps blocking the biz-delivery pipeline design (insight/ biz-team-pipeline-design-2026-11.md): 1. /checkpoint was log-only (name -> git ref). create now also writes a file snapshot to .claude/checkpoints/<name>.tar (tar --exclude .git node_modules .claude/checkpoints), so rollback works outside git repos and for uncommitted work; new restore action extracts the snapshot over the working tree after taking an automatic pre-restore backup (undo: /checkpoint restore <name>-pre-restore); list shows snapshot availability; verify points at the snapshot. Overlay semantics documented: extract does not delete post-checkpoint files. 2. docs/hooks-recipes.md: deterministic gate recipes on the verified hook contract (stdin tool_name/tool_input JSON; Stop returns decision:block+reason; PreToolUse deny via hookSpecificOutput). Recipes: stage-gate verdict lock (blocked-until-verdict for review-<stage>.md), document-contract presence check, reviewer no-self-edit separation of duties. Tests: tests/commands/checkpoint.test.ts (5 cases: restorable snapshot outside git, rollback roundtrip, post-checkpoint files kept + pre- restore backup undo, missing-snapshot guidance, list availability). tsc clean on touched file; doc validator ERROR 0. Co-Authored-By: Claude Code <[email protected]>
Merged
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.
Closes #360 (checkpoint half). Unblocks the biz-delivery pipeline design (insight/biz-team-pipeline-design-2026-11.md): stage gates need deterministic enforcement, and rnd's long S3 stage needs mid-state protection that survives non-git temp projects.
1. /checkpoint: log-only → restorable snapshots
createwrites.claude/checkpoints/<name>.tar(excludes.git,node_modules, the checkpoints store) in addition to the existing git-ref log entry — rollback now works outside git repos and for uncommitted work. Snapshot failure degrades to log-only with a visible note, never throws.restore <name>: extracts the snapshot over the working tree after taking an automatic pre-restore backup (<name>-pre-restore.tar) — the operation is self-reversible (/checkpoint restore <name>-pre-restore). Overlay semantics are documented in the output: extract does not delete files created after the checkpoint.listshows per-checkpoint snapshot availability;verifypoints at the snapshot;argumentHintupdated.2. docs/hooks-recipes.md — deterministic gate recipes
Contract verified against
src/types/hooks.ts+hooksConfigManager.ts(stdintool_name/tool_inputJSON; Stop →{"decision":"block","reason"}; PreToolUse deny →hookSpecificOutput.permissionDecision:"deny"):docs/review-<stage>.mdcontainsverdict: pass— the pipeline's blocked-until-verdict gate, fail-closed.Edit|Writetargetingprd.md/archi-plan.md/work-plan.md— reviewer sessions (running a differentFUSION_MODEL) can write verdicts but never the artifact under review.Verification
tests/commands/checkpoint.test.ts: 5/5 pass (restorable snapshot outside git, rollback roundtrip, post-checkpoint files kept + pre-restore undo, missing-snapshot guidance, list availability).tsc --noEmitclean on the touched file; doc validator ERROR 0 (43 docs).bun test+ binary rebuild intentionally deferred until the in-flight benchmark finishes (thermal interference) — will confirm before merge or immediately after.🤖 Generated with Claude Code