Repository navigation
feat(session-flow): add step-away and go-with-recommendations skills - #17337
Conversation
away.py keeps a session-keyed away state under the plugin data root, writes the return report skeleton, checks it, scans transcripts for auto mode denials and external actions, lists files written in the watched folders, and answers four hook events. PermissionRequest records an R<n> refusal and denies; Elicitation records and declines; Stop holds the run on open task-file items; UserPromptSubmit reminds the run of the absence or shows the report once on return. No hook grants a permission, and every hook exits 0 silently unless the session is away. hooks.json adds the PermissionRequest and Elicitation rows in exec form through run-away-hook.sh <event> [--plugin-root <root>], which also serves the step-away skill's Stop and UserPromptSubmit hooks. It fails open: with no Python 3.10+, a missing script or any failure it exits 0 with no output, so Claude Code shows its normal prompt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_save_point.py pins the file list under scripts/tests/fixtures, so fixture files there broke test_fixture_manifest_is_complete. The hook inputs and the hand-written transcript records now live in test_away.py, which writes the transcript into each test's temp dir. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…scan The watched-folder walk can run for minutes on a large home folder. refresh now writes the refused and external-action blocks before the walk and the files block after it, so a cut-short refresh still lists every refusal and the Stop check can pass. end marks the absence ended before the walk, so a slow or interrupted end still shows the report on return. The parallel-refusal test now runs sixteen hooks and holds the lock from the test process to show a hook waits for it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The skills land in later commits; the reference check rejects slash names that do not resolve yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- plugin_paths.py holds the data root rule save_point.py uses (CLAUDE_PLUGIN_DATA only when its last segment names session-flow, else the cache layout), an atomic 0600 write with the Windows replace retry, and the git call. away.py uses all three; a test pins that its rule matches save_point's. - refused.jsonl and the report copy beside the state are written 0600. - A file tool's refusal records only its name and path; other tool input is redacted leaf by leaf. Server names, agent ids, tool names and classifier reasons are redacted and capped at 200 characters. - Rendered block lines escape <!-- so listed text cannot end a block. - Managed settings come from the platform's base file, Program Files resolved through PROGRAMFILES, plus managed-settings.d drop-ins. - The watched-folder walk skips every git repository or worktree, stops after 120 s with a line saying the list is incomplete, and notes that other sessions may have written listed files. Only end, the first refresh past report_by and refresh --files rescan; a plain refresh keeps the files block. - The plugin root is the directory above away.py; hooks.json and run-away-hook.sh no longer pass --plugin-root. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Five userConfig keys set the night window, the report-by times, the days off and the watched folders; setup reports each one and whether each watched folder exists. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Accepts the recommendations in the agent's latest message, with plain-word exceptions, after running the full evidence check; returns any that changed or could not be confirmed with old, new and why. During an absence it never approves a refused action. The evidence-check line uses the explicit Skill-tool wording: both wordings loaded the check in 5 of 5 runs each, and the tie goes to the explicit form. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add /session-flow:step-away: it infers the absence, starts the away state, relays launch warnings and proposes the /goal line; rules.md says what is decided versus parked, merge holds and stall traps. away.py takes --data-root, since Bash commands get no CLAUDE_PLUGIN_DATA, and the launch treats a state that did not persist as unarmed. Three eval cases cover the bare launch, a parked fork and a merge held on a parked decision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Regenerate docs/catalog.md and docs/skill-cheat-sheet.md from the manifests and skill frontmatter, and name step-away's fresh-session choice in the README. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The merged description ran to 643 characters, over claude.ai's 500. Drop parentheticals that repeat skill names, regenerate the catalog and cheat sheet, and put go-with-recommendations' argument-hint in the house grammar. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- rules.md: every Needs-you bullet carries Options and Recommendation, as away.py check requires; secrets are named, never quoted; any open security finding or unfinished security review holds a merge. - SKILL.md: settings passed in single quotes so an unset option does not abort bash; status checked after every start, any non-active status meaning unarmed; the unarmed hand-off is named as auto mode; --kind break documented. - away.py: a reconciling start rewrites the report header; Paths carries its data root. - Eval graders anchor on file paths, the stamped report name, the assistant's own text and --data-root, with samples for each. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The live run showed the skill-frontmatter Stop and UserPromptSubmit hooks silent: they get no CLAUDE_PLUGIN_DATA, so a --plugin-dir load found no state, and they are dropped when the process restarts. Move both into hooks/hooks.json, where they survive a resume and get the data root; run-away-hook.sh exits before Python when no away state exists. away.py hooks also look under every session-flow data dir when the variable is absent. step-away now ends the launch turn with the message that holds the report path and the filled-in /goal line, since live runs skipped it when work followed in the same turn; the Stop hook brings the run back to work. A gotcha covers the Bash sandbox, where the plugin data dir is read-only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0625deea3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Lane run report
Failed GitHub API calls
|
A start after end/deliver reused the session-local report.md and only rewrote its header, so the last absence's sections carried over. Only a start that reconciles an active absence keeps the report now. step-away's gotchas now state our decisions with section-anchored pointers instead of restating hook, plugin-variable and sandbox behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From a local security review standing in for the rate-limited CI lane (no allow path found): - Escape control characters in file names and transcript labels the report lists, so a crafted name cannot forge a report heading or a Needs-you item. - The hook fallback tries only session-flow data directories and skips a root it cannot read, instead of going silent. - run-away-hook.sh applies its early exit only when CLAUDE_PLUGIN_DATA names a session-flow directory. - The first Stop warning in bypassPermissions mode says that almost nothing prompts there, so the hooks refuse almost nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
claude-security-review reviewed Security review: PR #17337, incremental (
|
|
claude-review reviewed Code review: step-away and go-with-recommendations (session-flow), head
|
- step-away refuses a plugin option value holding a single quote before building the start command, so a value cannot break out of its quoting. - The file-scan budget drops to 60 s, under the Bash tool's default timeout with the transcript and git reads, and a provisional line says the list is incomplete if the scan is cut short. - go-with-recommendations ends the absence, shows the report and delivers it unless a report-by time is set and still ahead. - Three more lines state our decision with a pointer instead of restating host behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A bare /session-flow:go-with-recommendations now leaves out actions that could cost money, as the away rules park them; naming one as an exception approves it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… after the mode warning go-with-recommendations decides whether the absence ends, and ends it, before carrying out accepted items, so hooks do not refuse what the person just accepted. The Stop hook's one-time non-auto warning no longer records a block digest, so the continuation after it still checks the open task items. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
claude-review on 8cfb033: both findings fixed in 7cfeb85
1: the step now decides whether the absence ends and ends it (end, show once, deliver) before any accepted item runs; the refresh/ |
No related issue: planned work for two new opt-in session-flow skills (owner-requested plan, approved in session).
Summary
Problem: accepting recommendations and stepping away are typed by hand each time, the evidence reminder is usually missing, and unattended runs stall on prompts, stop early or leave no clear report. Intent: "I often have to type out 'go with recommendations' or 'approve' but with the caveat/reminder that everything should be driven by the most recent consensus based research"
/session-flow:step-awayarms a session to run while the person is away: every prompt is refused and listed in a return report, MCP elicitations are declined, forks and permission or cost decisions are parked with options and a recommendation, and the report is shown once on return./session-flow:go-with-recommendationsaccepts the agent's latest recommendations after a full evidence check, returning any that changed with old, new and why.disable-model-invocation: true) and do nothing until invoked.Fix
scripts/away.py: session-keyed away state under the plugin data dir, the report (sections, refused-action and external-action blocks, files written in watched folders),start/status/refresh/check/end/deliver, and the hook entry points. No hook ever allows, asks or interrupts; every hook is silent unless the session is away.hooks/hooks.json: PermissionRequest (refuse and record), Elicitation (decline), Stop (holds the turn's end while the away work is unfinished) and UserPromptSubmit (absence and return notes). They are plugin hooks rather than skill-frontmatter hooks because frontmatter hooks get no plugin data dir and are dropped when the process restarts; with no away state each exits before Python starts./goalline; the Stop hook brings the run back to work.away_*userConfig keys, setup check rows, README sections, regenerated catalog and cheat sheet; plugin description cut to 494 characters.Verification
uvx --with pytest pytest plugins/session-flow/scripts/tests: 525 passed; ruff clean;grep -c '"allow"' away.py: 0;validate-cases.py,check-skill.sh(20/20), the listing budget andvalidate-plugins.sh --only session-flowall exit 0.claude --bg --permission-mode autosessions with the plugin loaded by--plugin-dir(Claude Code 2.1.328): a prompting command in the main session and one in a subagent were refused and listed as R1 and R2; a blocked write was parked with options and a recommendation; the state stayed active through a subagent's report and the/goalline (Goal set:), then a typed "I'm back" ended the absence and the report was delivered once;away.py checkexits 0. After a stop and wake, the Stop and UserPromptSubmit hooks still fired. With the Bash sandbox on,startfailed loudly at launch (the data dir is read-only there) and ran outside the sandbox.eval: runlabel.--plugin-dir); one live absence on an installed copy after merge.Acceptance criteria
/session-flow:step-awaywith no words, started inside the night window, sets the report due at the next report-by time; started outside it, the absence lasts until a message reads as the person being back./session-flow:go-with-recommendationsaccepts the recommendations in the agent's latest message plus plain-word exceptions, after the full evidence check; changed or unconfirmable recommendations come back with old, new and why./session-flow:setupchecks the new settings, including that each watched folder exists.Later work
save_point.pyandcensus.pyswitch to the sharedplugin_paths.py(their tests copy a fixed script list, so the switch edits those tests).One shared transcript
tool_usereader for away.py and the audit scripts.A Python twin of
lib/managed-scope.sh.continue-in-backgroundtaking a leading slash command, so a background session can run step-away first and start armed.With the Bash sandbox on, every away.py write runs outside the sandbox; in a permission mode where that asks,
refreshduring an absence is refused and the report goes stale (the hooks keep working). A state location the sandbox can write would remove that.The always-registered hooks cost about 0.02 s per prompt and turn end in a session-flow session that has never used step-away (no away directory, Python never starts) and about 0.09 s once one exists; clearing a delivered absence's state would return later sessions to the first figure.
Related
N/A
🤖 Generated with Claude Code