Skip to content

feat(checkpoint-iterate): add last-mile iteration session with attempt ledger - #30

Merged
desek merged 9 commits into
mainfrom
feat/cr-reconciliation-guidance
Jul 28, 2026
Merged

desek merged 9 commits into
mainfrom
feat/cr-reconciliation-guidance

Conversation

@desek

@desek desek commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Adds checkpoint-iterate, a skill for the last mile: the iteration that happens after an implementation lands and before it is actually right. Net diff against main is 14 files, +1506/-10.

The problem

A Change Request describes an implementation before it exists, so in a complex codebase what gets delivered is approximately right rather than exactly right. Closing that gap is an interactive loop — the user names what to try, the agent changes the code and reports evidence, the user decides whether it survives.

That loop currently leaves almost no trace, and it loses the wrong half. A checkpoint commit records what was kept; the approaches tried and abandoned before it leave nothing behind, anywhere. Those discards are the higher-value observations — knowing an approach does not work here saves the next implementer an afternoon. The existing distillation workflow reads commit history, so it can only ever learn from successes.

What this adds

A session, opened by explicit user invocation against an already-implemented CR, that maintains a ledger at docs/cr/CR-XXXX-iterate.md.

Roles are fixed. The user names what to try and renders the verdict. The agent makes the change, runs the checks, reports the evidence, writes the ledger entry, and commits — it is the party present at every attempt and already writing to the repository, so the recording is a side effect of work it was doing anyway. The user is never asked to keep a notebook alongside the work. The agent records the verdict verbatim and never infers one, and must report evidence before asking for it.

Dispositions are a closed setkept, discarded, partially-kept — with the partial case required to state which portion survived and which was reverted. Discarded entries are never deleted; retaining them is the entire point.

Entries are written when an attempt starts, not when it finishes. An entry is open until judged, then settled. This is what makes an interrupted session recoverable: a fresh agent can distinguish an attempt that was abandoned from one that was never judged, rather than folding unjudged work into the next attempt.

Commit convention

Session commits reuse the checkpoint type with a scoped identifier, rather than introducing a parallel one:

Subject Produced by
checkpoint(CR-XXXX): Core agentic implementation workflow
checkpoint(CR-XXXX-iterate): An iteration session

Reusing the type keeps session work visible to context recovery — correct, since iteration work is exactly what a later session needs. The -iterate suffix does the separating, so either view is one query away.

Surviving context loss and running in parallel

Re-hydration is one user action — the same invocation that opened the session. The ledger is on disk and is the sole durable state, so the agent reconstructs everything itself: reads the CR and every settled entry, reads the checkpoint commits, reconciles uncommitted changes against any open entry, and settles it before starting new work. It must not re-propose an approach a discarded entry already eliminated without saying so.

Concurrent sessions require separate Git worktrees. The hazard is not the ledgers, which are distinct files — it is that the existing checkpoint workflow stages with git add -A, so two sessions sharing a working tree would each sweep the other's in-flight changes into their own commits, misattributing work and corrupting both ledgers. Worktree isolation is the primary defence; scoped staging bounds the damage if it is ignored; and the ledger records the tree it was opened in, so a cross-tree resume is detected rather than proceeding silently.

Also

WORKFLOW.md gains an optional iteration stage between finalize and push, with both Mermaid diagrams updated. The skill is registered as a releasable component and listed in the README.

Testing

bats -r tests/59/59 passing, up from 25. Thirty-four new tests: 22 covering the skill's structure, registration, and its load-bearing workflow behaviours, 12 covering the ledger template.

Validation traced all 42 functional requirements, 7 non-functional requirements, and 26 acceptance criteria to the implementation with file:line evidence: FAIL=0, PARTIAL=0, GAP=0. Report included at docs/cr/CR-0015-validation-report.md.

Review notes

Two things worth surfacing rather than leaving to be discovered:

The closing step depends on a workflow this repo does not ship. Distillation hands the ledger to /checkpoint-distill, which exists as an installed skill but is not part of this repository. The skill documents it as an external prerequisite. A consumer installing checkpoint-iterate on its own gets a skill whose final step needs something they may not have — worth deciding whether to ship it from here.

A presentational tension the validator recorded rather than smoothed over. The happy-path loop in SKILL.md lists the ledger write as step 5, after the verdict, while the open-at-start rule lives verbatim in the bundled template. The requirement is genuinely satisfied, but the two read against each other. Noted in the report's Gaps section as optional cleanup.

Refs #24

desek added 9 commits July 28, 2026 19:32
…tions resolved, ambiguity fixed

- Reconciled drift: repository ships two checkpoint skills, not three; /checkpoint-distill is a consumed installed workflow
- Corrected docs/llms.txt characterization (Change Requests index, not a per-skill listing) in FR-30, AC-12, Affected Components, Phase 4
- Closed FR-to-AC gaps: folded FR-14 (no copyright/version metadata) and FR-15 (three ledger sections) into AC-1
- Closed AC-to-Test gaps: added documentation-content test rows for AC-2, AC-3, AC-5, AC-14, AC-20, AC-21, AC-23, AC-24 and reflected them in Phase 5
- Tightened superseded-convention residue in Scope (path-based, not two-subject, separation)
- Appended review-summary block; flagged external /checkpoint-distill dependency for human awareness
…l and session workflow

- Add skills/checkpoint-iterate/ with SKILL.md, version.txt (0.1.0), CHANGELOG.md
- SKILL.md documents the three invocation forms (open/resume, close, status)
- Documents refusal when the governing Change Request cannot be resolved
- States the role split: user initiates, names attempts, renders verdicts;
  agent changes code, runs checks, reports evidence, writes ledger, commits
- Requires reporting evidence before requesting a disposition, and recording
  the user's verdict verbatim rather than inferring it
- Structure matches existing checkpoint-commit and checkpoint-read skills
- Non-digit placeholders only (CR-XXXX, {CR_ID}) per the governance boundary
…late

- Add skills/checkpoint-iterate/templates/ITERATE.md, the bundled session ledger
- Frontmatter records governing CR, status, opened and closed dates, source
  branch and commit, and the working tree the session was opened in; carries no
  copyright or version metadata, per the docs/cr convention
- Three sections: Session Context, Attempt Ledger, and Distillation
- Attempt entry shape carries hypothesis, surface touched, verification
  evidence, and disposition, with open and settled entry states documented
- All three dispositions documented in full; partially-kept requires an explicit
  portion-kept and portion-reverted split
- Distillation left empty until close, with separate recommended-patterns and
  anti-patterns headings
- Commented instruction states discarded entries are never deleted and later
  entries record reversals rather than editing earlier ones
…sing distillation

- Add Commit Protocol section: scoped checkpoint(CR-XXXX-iterate) subject
  form, why the scope is suffixed rather than the type replaced, atomic
  code-plus-ledger checkpoints, and path-identified ledger-only commits for
  discarded attempts
- Add Re-hydration and Concurrency section: one-action recovery reading CR,
  full ledger, and checkpoint commits then settling any open entry; guard
  against re-proposing discarded approaches; worktree isolation, scoped
  staging, explicit identification, and foreign-worktree detection
- Add Closing section: set status and closing date, populate distillation
  into recommended patterns and anti-patterns, hand to the existing
  distillation workflow (noted as a prerequisite, not shipped here), and
  keep distilled guidance free of governance identifiers per the boundary
…skill

- Add skills/checkpoint-iterate package entry to release-please-config.json, matching the three existing simple-release entries
- Add skills/checkpoint-iterate: 0.1.0 to .release-please-manifest.json
- List checkpoint-iterate in the README Available Skills table
- Add a CR-0015 Change Requests entry to docs/llms.txt, following the per-CR convention (no per-skill entry, per the reviewer correction)

Registers the new skill for release and makes it discoverable. Satisfies FR-29, FR-30, and AC-12.
…iterate skill and template

- Add tests/checkpoint-iterate/test_helpers/setup.bash resolving repo root, skill, and template paths
- Add test_skill_structure.bats: 22 tests asserting skill files, semver, frontmatter, no destructive Git, release registration, README listing, and every load-bearing workflow behaviour (three invocation forms, missing-CR refusal, resume-not-restart, user-only initiation, close-blocked-on-open-entry, ambiguous-invocation refusal, foreign-worktree detection, eliminated-approach guard, agent-records, evidence-before-verdict, re-hydration, worktree isolation, scoped staging, scoped subject form, reserved unsuffixed form)
- Add test_iterate_template.bats: 12 tests asserting worktree/cr/status/source fields, absence of copyright and version metadata, open/settled entry states, three sections, all three dispositions, partial-keep split, patterns vs anti-patterns, and discarded-entry retention
- Full suite green at 59/59 (25 prior + 34 new); governance boundary test reports no violation; new test files carry no digit-form governance identifiers
- No defect found: every assertion matches content produced by phases 1-4
- Updated CR frontmatter: status=completed, completed-date=2026-07-28
- Verified all 59 tests pass (governance boundary test confirmed)
- Verified branch diff conforms to CR Affected Components
- Confirmed skill registration in release config and manifest
- Version match verified: 0.1.0
- All Quality Standards Compliance boxes checked
- Add docs/cr/CR-0015-validation-report.md tracing all 42 FRs, 7 NFRs,
  and 26 ACs to the implementation with file:line and test evidence
- All 49 requirements PASS, all 26 acceptance criteria PASS
- Full suite bats -r tests/ verified at 59/59 (TAP plan 1..59, 0 not ok),
  governance boundary test included and passing
- 34/34 Test Strategy rows implemented (22 structure + 12 template)
- No stray changed files; all 12 diffed files within Affected Components
- One non-blocking observation on the SKILL.md Step 3 loop ordering vs
  FR-31; FR-31 satisfied via the bundled template ENTRY STATES block
Documents the last-mile iteration session as a workflow stage.

- WORKFLOW.md gains an optional iteration step between finalize and push,
  covering the ledger, the three dispositions, the scoped commit subject,
  re-hydration after context loss, and the status invocation. Tail steps
  renumbered and both Mermaid diagrams updated to include the new node.
- README.md prose extended to describe iteration sessions and their
  recording of discarded attempts, beyond the bare skill listing.

AGENTS.md and CONTRIBUTING.md inspected and left unchanged: no documented
invariant changed, and the reference boundary already covers the new skill.

All identifiers written use non-digit placeholder forms, so prohibited
territory stays clean. Suite passes 59/59.
@desek desek linked an issue Jul 28, 2026 that may be closed by this pull request
@desek
desek merged commit d6f2e1e into main Jul 28, 2026
2 checks passed
@desek
desek deleted the feat/cr-reconciliation-guidance branch July 28, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guidance for REPL => reconcile CR

1 participant