feat: add flow checkpoint for mid-session progress notes#73
Open
sanmesh-kakade wants to merge 2 commits into
Open
feat: add flow checkpoint for mid-session progress notes#73sanmesh-kakade wants to merge 2 commits into
flow checkpoint for mid-session progress notes#73sanmesh-kakade wants to merge 2 commits into
Conversation
flow injects context at SessionStart but has no write-back: the dated notes under tasks/<slug>/updates/ are what `flow do` reads on resume, yet nothing prompts for them, so on heavy days they go unwritten and the next resume reads a stale brief. `flow checkpoint [<ref>]` is the non-terminal sibling of `flow done`. It reuses the headless `claude -p` sweep engine to read the task's live transcript and draft ONE updates/ note for review — no status change, no KB writes. Resolution mirrors `flow show task`: explicit ref by slug, no-ref reverse-lookup of the session-bound task; the task must carry a session_id. Sweep failure surfaces as rc=1 (no status flip to protect). Closes Facets-cloud#72. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…standards
Per CONTRIBUTING, the embedded skill (internal/app/skill/SKILL.md) is
part of the contract — document the new command there so Claude
sessions actually offer it:
- add `flow checkpoint` to the Sessions command reference
- §4.5 (Save a progress note): describe checkpoint as the assisted,
transcript-drafted alternative to a hand-written note, and its
relationship to the §4.7 `flow done` close-out sweep
Also bring the change up to repo norms:
- add Sanmesh Kakade to CONTRIBUTORS.md
- CHANGELOG: cite the PR (Facets-cloud#73) and author, keep Facets-cloud#72 as the
originating issue, matching the existing entry style
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 #72.
What
Adds
flow checkpoint [<ref>]— a non-terminal command that drafts a mid-session progress note intotasks/<slug>/updates/from the live transcript, reusing the existing headlessclaude -psweep engine.Why
flow injects context in at
SessionStartbut has no write-back. The dated notes undertasks/<slug>/updates/are the durable per-session record a futureflow doreads on resume — yet nothing prompts for them. On heavy days they go unwritten, and the next resume reads a stale brief. The only transcript→record path today is theflow donesweep, which is terminal (flips status) and aimed at KB + project-update, not a task note.flow checkpointis the non-terminal sibling offlow done:flow show task: explicit ref by slug; no ref reverse-looks-up the task bound to the current session ($CLAUDE_CODE_SESSION_ID). Either way the task must carry asession_id.SkipPermissionsRundiscards the headless session's stdout, so the command snapshotsupdates/before/after and prints any new file. An empty checkpoint (nothing warranted) is a success, mirroringdone.done(which swallows sweep failures because the status flip is the durability boundary), checkpoint has no status flip to protect.Skill / contract change (called out per CONTRIBUTING):
internal/app/skill/SKILL.mdis updated so Claude sessions actually offer the command — added to the Sessions command reference, and §4.5 (Save a progress note) now describes checkpoint as the assisted, transcript-drafted alternative to a hand-written note and its relationship to the §4.7flow donesweep.Test plan
make testpassesgo vet,go test ./..., build) — verified locally; vet clean, full suite green, gofmt-clean on changed filesFLOW_ROOTat a real 931KB session transcript, ranflow checkpointno-arg → liveclaude -pproduced one correctly-shapedupdates/note, rc=0, before/after diff reported the path, and the KB was untouched (verifying the no-KB contract)go build(go:embed) and documented aboveFiles
internal/app/checkpoint.go—cmdCheckpoint,buildCheckpointSweepPrompt,updates/before/after diff helpers.internal/app/checkpoint_test.go— happy path, no-KB-write contract, sessionless refusal, unknown ref, unbound-no-ref, sweep-failure→rc1, prompt shape.internal/app/app.go— dispatch case + usage line.internal/app/skill/SKILL.md— command reference + §4.5 mention.CHANGELOG.md,CONTRIBUTORS.md,README.md.Notes
updates/first and only capture what isn't already logged, which keeps repeated checkpoints from duplicating. A future refinement could scope to "since the last note" if that proves noisy.Stop-hook variant (auto-prompt at session end) was discussed in [feature] Session-end write-back: draft a progress note from the transcript #72 as the other half of the fix; this PR is the manual command only — self-contained, reuses existing machinery. Happy to follow up with the hook separately.🤖 Generated with Claude Code