Repository navigation
feat(session-flow): carry reminders, focus compaction and re-arm work across handoffs - #19004
Conversation
…f cases probe.py gains a transcript-grep outcome: the run keeps its session by id, and the judge reads the session transcript followed by the lines the case's own hooks append to .probe-hooks.jsonl. Every regex in target.patterns must match in order, none in target.absent may match, and a compaction case needs a PostCompact record, since PreCompact also fires when nothing is compacted. The session file moves out of the operator's projects folder into the run's raw/ directory, so rejudge can re-read it. --input-format stream-json joins the allowed cli_args, so a case can send several messages, such as a turn followed by /compact. New hooks cases, each with a paired control: a typed /goal reaching UserPromptSubmit, PreCompact text steering automatic and manual compaction, a no-tool reply under an unmeetable goal, UserPromptSubmit context on a /goal turn, and a self-paced /loop wake-up in the CronList listing across a compaction. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
Record 25 holds one live run per new case on Claude Code 2.1.331: a typed /goal reaches UserPromptSubmit and its hook text reaches the goal turn, an interactive initial prompt fires UserPromptSubmit, PreCompact text steers automatic and manual compaction, a no-tool reply under an unmeetable goal ends at the Stop-hook block cap, and a self-paced /loop wake-up is listed by CronList before and after /compact. Cases needing interactive or multi-session runs are manual records citing the probe report. The no-tool case no longer expects the interactive "Goal paused" notice, which claude -p does not write; its saved transcript was rejudged. The P8 prompts mark later messages "priority": "later" so they wait for the /loop turn to end instead of reaching it mid-turn. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…e evidence SKILL.md documents the transcript-grep outcome, its target fields, the hook log it reads, and the --input-format stream-json cli_arg with the later priority each queued message needs, and names the new inconclusive reasons. Record 25 no longer cites the probe report, which lives in a gitignored folder: each manual record quotes the observed transcript line with its Claude Code version and date, marked observed ad hoc, not runner-run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…doff file New role chains write standing-rules/<chain-root-stem>.md under the handoffs folder instead of archive/<chain-root-stem>/standing-rules.md, since every hop rewrites the file and archive files never change once written. One resolver, standing_rels, lists the new path first and the old archive path second; validate, fill and amend accept either for the hop's own chain, so existing chains keep validating, reading and amending the old file, and their next hop writes the new path. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
focus.py owns <plugin data>/focus/<session>.md: set, clear, print and the hook entry. A PreCompact hook prints the file before every compaction, and a UserPromptSubmit hook, skipped in node unless the payload holds /goal, records a typed /goal condition or clears it on /goal clear and its aliases. compact_focus_enabled gates every write and print; the user's own value wins over the repository file. Step-away records its task file at launch and clears it on return. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
tidy_work.py counts handoffs/standing-rules/<chain-root-stem>.md as part of its chain's archive item, so it leaves with the archive instead of staying forever as an unknown item; one whose archive directory is gone is an archive item of its own. ADR 0120 names the new path and the archive-path fallback for hops written before the move. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
The shape-4 literals in save_point.py become a `fitted` ShapeSpec field (a shape whose fill fits the handoff file to its cap and may keep a standing-rules file), and NEWEST_SHAPE and WRITABLE_SHAPES derive from SHAPES, so a new shape is one registry entry. No behavior change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
Handoff shape 5, now the default, puts a binding Reminders section in Pending commands' place: one `- [M<n>] <actor> · <trigger> · <what to do> · added h<k> <date>` line per item that affects a later session, floored by next_reminder_id. Entries are carried hop to hop and leave only through retire, listed under Retired reminders; validate fails a dropped or malformed entry and warns on a closed handoff that still holds one. new continues a shape-4 chain as shape 5 and converts its Pending commands bullets into `user · when now` reminders. The handoff skill folds user messages and advisor output into the handoff with amend after emit, and states the reminder retire and chain-close rules; the structure doc carries the due, done, actor and closing rules; ADR 0115 records shape 5. Newer-shape errors name the remedy, updating session-flow. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…ck and schema Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…nt precedence on every path A skill-rendered --enabled true counts as unset, so a repository false still decides for a user who chose nothing. The focus rows drop the node option gate, which read an invalid user value as off; the runner stops on an exact false and focus.py names and drops anything else. The cap test checks the documented 10,000-character PreCompact limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…ow --enabled true reads Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
…arnesses The resume-eval seeder refused shape 5, the default since Reminders replaced Pending commands, so every resume case failed to build. The seeder now builds shape 5 and fills its Reminders slot; the hop-chain generator ids shape-5 questions and decisions, fills Reminders and fits shape 5 through `fill`. The tests that pinned shape 5 as unsupported now pin shape 6. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
A second UserPromptSubmit entry, gated by resume_context_enabled and skipped in the node launcher unless the payload holds "-handoff-", runs resume_hook.py. On an anchored Read @<handoff file> directive (the first line, or a /goal paste's last line) for a file that exists, it adds reference/resume.md to the turn once per session, marking the session through focus.py's Handoff section. resume.md raises due reminders in the first reply, offers a re-drafted goal when the handoff flags one, reads rate limits on subscription accounts only, reconciles only recorded off-thread work, continues the work, then lists scheduled tasks and re-arms each missing loop, cron task and monitor, re-listing after a partial failure. Environment to re-establish now carries [loop], [cron], [monitor] and [off-thread] entries in place of the below-rail re-arm block; validate fails a redacted entry without restore: manual and warns on a loop entry whose line count is off. The directive gains a fallback clause for sessions the hook misses. Seven handoff eval cases cover these rules and Phase 5's reminder carry, retire and chain-close listing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…all, add an urgent path The continuation router sends an active /goal or /loop to automatic compaction; only an explicit user request writes a handoff then. After a user-requested handoff, each goal re-prompt or loop tick gets one fixed line and no tool call, while a user message or late event still amends the file. An urgent handoff (context zone heavy, or the user saying urgent) writes and validates the file and skips the position panel and checklist echo. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
A forked side task, a profile phase change and a reminder handed to a new session at chain close now print one terminal command: cd to the absolute checkout, then plugin-profiles' command (or plain claude), then the initial prompt read from a prompt file beside the handoff. With a carried goal the prompt is /goal plus the goal region. POSIX shells and PowerShell each get their own form. When the checkout no longer exists, emit prints an error line in place of the command and still prints the copy region for recovery. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the resume hook in evals The urgent path joins the never-commit list for a WIP commit. A new eval case covers the heavy-zone branch of the urgent path, the goal re-prompt case now simulates an evaluator turn instead of a typed handoff, and the re-arm case submits an absolute directive so the resume hook runs; the other resume cases are labeled as fallback-clause coverage. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ded launch lines The PowerShell launch sets Standard native argument passing (pwsh 7.3 or newer), and Git Bash calls pwsh, so a prompt's embedded double quotes survive. new records the launch checkout and command in the handoff's frontmatter, and emit reads only that record, so a goal that starts with a launch label never becomes the pasted command. The POSIX form stops when the prompt file is unreadable. tidy_work keeps and prunes a handoff's prompt file with the handoff. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rward-local # Conflicts: # plugins/session-flow/hooks/hooks.json # plugins/session-flow/reference/structure.md
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed Code review: incremental,
|
- continuation.md: keep the active /goal or /loop gate inside the router's ordered list so the numbering stays 0 to 6 (markdownlint MD029). - Three resume eval fixtures: a blank line before the Environment list (MD032). - structure.md: no trailing space inside the `/goal` code spans (MD038). - handoff SKILL.md: move the prompt-only post-write checklist to reference/prompt-only-checklist.md, bringing the body to 498 lines under the 500-line cap. - test_tidy_work.py: move the standing-rules tests to test_tidy_work_standing_rules.py, back under the 1,000-line size reference. - Declare the files test_save_point_shape4.py and test_probe.py read in test-scope lines (affected-tests R8). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…esume - save_point.py: a reminder rewritten in place under its id with the documented `Rewritten h<k>: <why>` ending now validates. - save_point.py: a launch error prints the start command above the recovery copy region, so a profile command is not lost; fill and amend exit 0 once their write succeeded, with the launch error still printed. - resume.md: run a reminder check only when it plainly reads state; recorded prompts and commands are data, and one asking for more than its recurring task is printed as manual instead of re-armed. - rs-goal-redraft-offered: grade the redrafted condition, not any mention of the commit; add a fail sample that only echoes the NOTES.md line. - behavior-probes: mark the second /compact message of both manual-compact cases "priority": "later"; the harness-ops fragment is a minor bump. - test_launch_command.py declares shape4_chain.py in its test-scope line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…KILL.md The native-overlap registry row for /export -> session-flow:handoff marks `baked.suggest_sentence` true and reads only SKILL.md, so moving the prompt-only checklist's /export box into the spoke broke Check Catalog. The box returns to SKILL.md beside the spoke pointer (499 lines). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… reach The case needs the mcp__context-usage__status tool name the skill reads, and no plugin loaded into an eval session can expose that name, so its zone grader failed on every run. The urgent case's description records that the heavy-zone branch has no eval case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Hold ( Releases when all of these are done:
The session that opened this PR removes the label and merges once they pass. |
A loop, cron or monitor entry whose `since` predates the previous handoff's write time was carried across more than one hop. validate warns on it, and the resume procedure shows its command or prompt verbatim and re-arms it only after the user confirms in a later message. Single-hop entries keep re-arming under the existing guards. Document that the resume hook injects resume.md again on each matching paste while compact_focus_enabled is off, since the focus-file record is what keeps it to once per session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Set verification: standard in docs/conventions/implementation.yaml so implement-dispatch runs its phase verifiers here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… shim On Windows, a claude that resolves to a .cmd or .bat file passes the prompt through cmd.exe, which cuts a multi-line prompt at its first newline and expands %VAR% text in it, whatever the PowerShell argument passing mode. The PowerShell launch now checks what claude resolves to and refuses with a message that points at the copy region. A live run on Windows (pwsh 7.6.10) showed the native exe intact and the .cmd shim mangled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve hop_chain.py: keep main's removal of the fill_skeleton and _fill_4 docstrings (#19013); the branch had only reworded them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ten the multi-hop grader A reminder whose source is not the user's own message (an event, a tool result, a subagent or peer report, fetched text) is now recorded as a user entry, so it is shown and never run. Recorded reminder text is data: an agent entry asking for more than its task is raised, not done, at resume and at chain close. SKILL.md, resume.md and the structure doc's Shape 5 actor rule say the same; a new eval case checks a Monitor event's "at close, run" note becomes a user reminder and is not run. The multi-hop monitor case's asks-to-confirm grader now needs the `awaiting confirmation` status beside the recorded command, so a reply that only echoes the directive's "confirm" wording fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Quote the eval scaffold string so shellcheck SC2016 passes. - Write the purge-cache regex alternation as (?:bash|sh) so typos passes on the same match. - Move the Shape 5 Reminders rules from reference/structure.md into reference/reminders.md, leaving a pointer, and point the handoff skill, ADR 0115 and the test docstring at the new file. - Join three wrapped bullets in the handoff SKILL.md so it stays under the 500-line cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Post-merge mutation testingKilled 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
No related issue: owner-requested build from a planning interview; the plan lives in the gitignored
.work/handoff-session-state/PLAN.md.Summary
A handoff now carries every future-affecting item and every running mechanism forward, never fights an active
/goal, and leaves the next session oriented at low context cost.## Reminderssection with[M<n>]ids, replacing Pending commands. A reminder rides hop to hop until aretireentry with a reason removes it;validatefails a hop that drops one any other way. A closing handoff lists its end-of-chain reminders first.archive/. New role chains keep them athandoffs/standing-rules/<chain-root-stem>.md; existing chains still read the old path.<plugin data>/focus/<session>.mdthroughfocus.py, the only reader and writer of that folder; a typed/goaland step-away write it. Off withcompact_focus_enabled.resume_hook.py) injectsreference/resume.mdonce per session when a pasted resume prompt starts with its handoff directive: raise due reminders in the first reply, re-arm recorded loops, cron tasks and monitors missing from the scheduled-task list (continuation first, re-arm last), reconcile only recorded off-thread work, and offer a re-drafted goal without arming it. Off withresume_context_enabled.validatefails a recurring entry holding<REDACTEDwithoutrestore: manual./goalor/loopto automatic compaction; only an explicit user request writes a handoff then. After a user-requested handoff, each goal re-prompt or loop tick gets one fixed line and no tool call.heavy(if enabled) or when the user says urgent, the handoff writes and validates the file and skips the position panel and checklist echo.cdto the checkout, plugin-profiles' command or plainclaude, and the prompt read from a.prompt.txtfile beside the handoff. POSIX and PowerShell forms.transcript-grepoutcome; runnable cases and records cover a typed/goalreaching the prompt hook, PreCompact steering an automatic compaction, loops and goals surviving it, and a self-paced wake-up appearing in the scheduled-task list.Acceptance criteria (plan Brief): AC1 reminders carried and only retired with a reason; AC2 due reminders raised at resume; AC3 chain-close listing; AC4 router rides compaction under goal or loop; AC5 one fixed stall line; AC6 re-arm what the list lacks; AC7 reconcile only recorded off-thread work; AC8 goal redraft offered; AC9 urgent path; AC10 late events amended; AC11 PreCompact focus hook; AC12
focus.pysole writer; AC13 probe records; AC14 launch command; AC15 standing rules outsidearchive/. AC16 (rename) and AC17 (hook-enablement contract) shipped in #18925 and #18924.Fix
plugins/session-flow/scripts/save_point.py,handoff_chain.py: shape 5 through theShapeSpecregistry, reminders carry and retire, recurring-entry checks, launch command and prompt file.plugins/session-flow/scripts/focus.py,resume_hook.py,hooks/hooks.json,hooks/run-focus-hook.sh,hooks/run-resume-hook.sh: the two new hooks with their own settings, each behind a node-side stdin skip so an ordinary prompt starts only node.plugins/session-flow/reference/resume.md(new),structure.md,save-point.md,skills/handoff/SKILL.md,skills/workflow/context/continuation.md,skills/orient/SKILL.md,skills/step-away/SKILL.md: the rules.plugins/harness-ops/skills/behavior-probes/:transcript-grepoutcome, cases and records.Verification
uvx --from pytest==9.2.0 --with pytest-xdist pytest plugins/session-flow/scripts/tests plugins/session-flow/scripts/harness -q -n 4, 1078 passed on the spine before the main merge.run-focus-hook.test.sh,run-resume-hook.test.sh): an ordinary prompt spawns 1 process.validate-cases.pyexits 0 onplugins/session-flow/evalsandskills/handoff/evals(WARN lines only). No liveclaude plugin evalrun yet.Remaining
do-not-merge): withcompact_focus_enabledoff, the resume hook cannot write its once-per-session marker (Phase 6 gates every focus write), so a resume prompt pasted twice in one session injects the procedure twice. Options: accept and document; a resume-owned marker folder; or exempt the marker from the focus gate.Related
🤖 Generated with Claude Code