Skip to content

feat(session-flow): add step-away and go-with-recommendations skills - #17337

Merged
kyle-sexton merged 22 commits into
mainfrom
feat/session-flow-step-away
Nov 19, 2026
Merged

kyle-sexton merged 22 commits into
mainfrom
feat/session-flow-step-away

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

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-away arms 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-recommendations accepts the agent's latest recommendations after a full evidence check, returning any that changed with old, new and why.
  • Both are user-invoked only (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.
  • The launch turn ends with the message holding the report path and the filled-in /goal line; the Stop hook brings the run back to work.
  • Five 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 and validate-plugins.sh --only session-flow all exit 0.
  • Live runs in claude --bg --permission-mode auto sessions 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 /goal line (Goal set:), then a typed "I'm back" ended the absence and the report was delivered once; away.py check exits 0. After a stop and wake, the Stop and UserPromptSubmit hooks still fired. With the Bash sandbox on, start failed loudly at launch (the data dir is read-only there) and ran outside the sandbox.
  • Wording eval for the evidence check: explicit Skill-tool wording 5/5, plain wording 5/5; shipped the explicit wording. The three step-away eval cases are statically validated (offline grader samples pass) but have not been run against the launch shape that ends the first turn; they run only under the eval: run label.
  • Not yet checked: a marketplace install (every live run used --plugin-dir); one live absence on an installed copy after merge.

Acceptance criteria

  • AC1: /session-flow:step-away with 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.
  • AC2: A time, trip or fresh-session request stated at launch overrides the settings; when the absence cannot be inferred, the skill asks at launch.
  • AC3: While away, an action that would prompt is refused, recorded in the report, and not retried another way; no action is approved during an absence, and refused actions wait in the report for the person's return.
  • AC4: Auto mode denials and blocking questions are recorded in the report and the run continues on other work.
  • AC5: A choice that would change behavior, design, scope or the agreed plan is parked with options and a recommendation; work that does not depend on it continues.
  • AC6: Permission or trust-boundary changes, actions that could cost money, and settings changes no plan names are parked.
  • AC7: A critical security issue or exposed secret stops the affected work, leads the report, and sends a phone push when one is available.
  • AC8: A pull request with a known high-severity finding, or one depending on a parked decision, is not merged.
  • AC9: The report file exists from launch, is updated after each finished piece of work, passes its script check, and orders sections Needs you, Decided while you were away, Waiting on me, Done, Found, Additional notes.
  • AC10: The report lists every external action and every file written in the watched folders outside dot folders and the run's own repositories and worktrees.
  • AC11: The run never hands off because of its context level; it hands off only when asked at launch, and warns at launch when the context zone is heavy or auto mode is off.
  • AC12: A goal condition is proposed at launch; without the keypress, a Stop-hook check holds the same condition.
  • AC13: On return the report is shown once and recorded as delivered; later turns do not treat it as due.
  • AC14: /session-flow:go-with-recommendations accepts 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.
  • AC15: A bare accept never approves refused actions or permission or trust-boundary changes.
  • AC16: An eval compares explicit Skill tool wording with plain wording for loading the evidence check, and the shipped wording follows its result.
  • AC17: /session-flow:setup checks the new settings, including that each watched folder exists.

Later work

  • save_point.py and census.py switch to the shared plugin_paths.py (their tests copy a fixed script list, so the switch edits those tests).

  • One shared transcript tool_use reader for away.py and the audit scripts.

  • A Python twin of lib/managed-scope.sh.

  • continue-in-background taking 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, refresh during 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

kyle-sexton and others added 17 commits November 18, 2026 18:22
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]>
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]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 02:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T02:23:58.492275Z e0625de Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread plugins/session-flow/scripts/away.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44443660847

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

kyle-sexton and others added 2 commits November 18, 2026 21:28
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]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 5 inline finding(s) on aaf8d80f09fdf3e4aa6d191c07646693425832a2; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 7cfeb85cf728b0c5e0742f2d5ac0d4338330d9f8: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17337, incremental (8cfb0338 → 7cfeb85c)

I found no CRITICAL or IMPORTANT findings, and nothing holds the merge. This lane already reviewed earlier heads, so this review reported blocking findings only. It covered the four files in the incremental scope, and I read every hunk of each.

What changed and what I checked

plugins/session-flow/scripts/away.py

  • The change: first_look no longer sets last_block_digest when it issues the mode warning (away.py#L1048-L1054).
  • Effect: the Stop continuation after the warning now checks the task file instead of passing through.
  • Loop guard still in place: stop_hook_active combined with an unchanged digest still releases the stop. The digest is now recorded only when the hook blocks on unfinished work (away.py#L1071-L1076).
  • Security surface: none. The hook still returns only block or nothing, and grants no permission.

plugins/session-flow/scripts/tests/test_away.py

  • Adds one test for the behaviour above. Tests only, with no security surface.

plugins/session-flow/skills/go-with-recommendations/SKILL.md

  • Reordering: the absence now ends, and the report is delivered, before the accepted items run. Items are marked Accepted: only while the absence stays active.
  • Narrowed accept: a bare accept now also never approves an action that could cost money.
  • Unchanged guard: refused actions still cannot be approved during an absence.
  • This tightens the instruction surface. Nothing is deleted or softened, so the instruction-surface lens raises nothing.

plugins/session-flow/README.md

  • Documentation that matches the skill's narrower bare-accept rule.

Trust controls and holds. None of the four files matches a trusted-path glob. None touches a trust control, a merge hold, the token scope or a plugin manifest.

Prior findings. The five away_* manifest flags posted at aaf8d80f sit on plugin.json lines that this push does not touch. The previous review recorded them as settled by the owner. This push raises nothing new on them.

Spend (not a finding). After the mode warning, the Stop hook can now hold an armed session for one more continuation turn while task items are open. That draws on subscription or prepaid usage only.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 3 inline finding(s) on aaf8d80f09fdf3e4aa6d191c07646693425832a2; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread plugins/session-flow/scripts/away.py Resolved
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 7cfeb85cf728b0c5e0742f2d5ac0d4338330d9f8: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Code review: step-away and go-with-recommendations (session-flow), head 7cfeb85c. Incremental, blocking findings only.

This lane already reviewed an earlier head (blocking only: yes), so this review reports only blocking findings and manifest flag lines. It covers the change since 8cfb0338: 4 files, and I read every hunk of each in the incremental diff.

Both of this lane's findings on 8cfb0338 are fixed:

  1. The two orders in step 4 of go-with-recommendations/SKILL.md: step 4 now has one order.
    • It first decides whether the absence ends. The absence stays active only while report_by is set and has not passed.
    • Otherwise it runs away.py end, shows the report once and delivers it.
    • Only then does it carry out the accepted items. The Accepted: marking and refresh apply only while the absence stays active.
    • Read top to bottom, the hooks can no longer refuse prompts for items a returning person just accepted.
  2. The mode warning stopping the work: on_stop in away.py no longer sets last_block_digest when it warns about the permission mode (away.py#L1048-L1054).
    • On the continuation after the warning (stop_hook_active: true), last_digest keeps its earlier value, which on a first Stop is None and never the current report digest. So check_report runs and open tasks block the stop again.
    • After a real block, that check still sets the digest, so the loop guard in test_stop_hook_active_unchanged is unaffected.
    • The new test test_stop_after_mode_warning_still_holds_open_items covers this path, and it would fail if the line came back.

Other changes in this push: the README and SKILL.md now list "an action that could cost money" as something a bare accept never approves. That only adds restrictions, and the README text matches the skill.

Closing issue: none. The PR says "No related issue", so no closing-issue criteria were checked.

Verification: I ran nothing, because this lane has no shell. Test outcomes are author-claimed and unverified.

Loosened-check verdict: fail (the default, because the prompt has no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt also has no loosened_check_decision_record: line, so I did not check the citation requirement. Nothing in this push loosens a check: it adds a test and removes no assertion.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 3 commits November 18, 2026 22:15
- 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]>
@kyle-sexton

Copy link
Copy Markdown
Member Author

claude-review on 8cfb033: both findings fixed in 7cfeb85

# Finding Label Evidence
1 go-with-recommendations step 4 gave two orders (act on items, then end; and end before acting) VALID (fix now) go-with-recommendations/SKILL.md:63-70 at 8cfb033
2 Non-auto mode warning set last_block_digest, so the continuation stopped with open items VALID (fix now) away.py first_look set the digest on the warning path; reproduced by test_stop_after_mode_warning_still_holds_open_items (red before the fix)

1: the step now decides whether the absence ends and ends it (end, show once, deliver) before any accepted item runs; the refresh/Accepted: marking applies only while the absence stays active.
2: the warning no longer records a block digest, so the next Stop reaches the task-file check. 537 session-flow script tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant