Skip to content

session-flow: let continue-in-background take a leading slash command so a background session starts armed #17386

Description

@kyle-sexton

Problem

/session-flow:continue-in-background always sends /goal ... as the background session's first prompt. A fresh session requested at /session-flow:step-away launch therefore starts unarmed: step-away never runs in it, so none of its absence behavior (refusals, parked decisions, report) applies until someone arms it.

This is design-bearing: it changes the payload contract of the continue-in-background skill.

Done looks like

  • continue-in-background accepts a leading slash command, and the background session runs that command first (for step-away, so the session starts armed) before the /goal prompt.
  • The payload contract is documented in the skill and its callers (step-away's fresh-session request) use it.
  • A test or eval case covers the new payload shape.

Refs: #17337

Activity

  1. added
    needs-triage
    on Nov 19, 2026
  2. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the session-flow continue-in-background skill, step-away's fresh-session request, and the tests or evals for them; read by anyone launching background sessions.
    Reversible: yes; revert the skill and caller edits.
    Open questions: none
    The decision recorded on this issue settles the design:

    Decision recorded.

    Question (Q228, hub morning report 2026-11-19): how should a background session started from step-away get armed? Options: (a) launch first with --bg, then arm attended with away.py start --session <printed id>; (b) an allowlisted leading step-away command as the first prompt; (c) make step-away model-invocable; (d) won't fix. Recommendation: (a).

    Owner answer (2026-11-19, 9:5x AM EST, in the hub session): "go w/ recomendations"

    Decision: (a). continue-in-background reads the id claude --bg prints (or claude agents --json), and the attended session runs away.py start --session <that id> and writes the task file while the person is present. Includes a probe of when the hooks first see the state, to settle the first-turn race.

    #17386 (comment)

    That settles the open questions. Option (a) replaces the leading-slash-command payload this issue asked for, so the done-when items should be reworded to match: read the printed session id, arm attended, and add a hooks first-turn probe. Related: #17337, #8742, #8222 (earlier merged work on step-away and the launch contract).

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 19, 2026
  4. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  5. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: continue-in-background accepts an optional leading slash command so a step-away fresh-session request launches a background session that runs /session-flow:step-away and then arms its /goal, with the payload documented, step-away using it, and an eval case added.

    Related work

    Open questions

    1. How are the leading command and the /goal prompt sequenced in one claude --bg launch? A background session takes one first prompt, and the probe only showed a multi-line payload arms as /goal. It is unknown whether a slash command on the first line runs and a /goal on a later line still arms.
      RECOMMENDED: Probe it first and record the result in reference/goal-probe.md. If a two-line first prompt does not run both, have the leading command's own instructions arm the goal, and do not claim the shape works until the probe shows it. Basis: .base/plugins/session-flow/skills/continue-in-background/SKILL.md:107-122
    2. What does step-away do when run first in a fresh unattended session? Its launch turn ends by asking the person to submit a /goal line, and the absence state is keyed to the session id that ran start. A background session has no person and a new session id.
      RECOMMENDED: Run /session-flow:step-away with the original scope words, and have step-away skip the propose-the-goal message when launched this way, since the /goal payload follows. Document that the away state binds to the background session's own id. Basis: .base/plugins/session-flow/skills/step-away/SKILL.md:72-95
    3. How is the leading command validated before it is put in the launch payload? Prompt content is untrusted and the skill already sanitizes the topic slug to keep injection out of the launch command.
      RECOMMENDED: Accept only a single allow-listed slash command, /session-flow:step-away plus sanitized scope words, written to the prompt file with the Write tool and never inlined in the shell command. Reject any other leading command. Basis: .base/plugins/session-flow/skills/continue-in-background/SKILL.md:55-59
    4. Should the leading command be an argument to continue-in-background, and in what syntax, given the existing positional grammar of [--unattended] [--cloud] [file|prompt] [topic] [purpose...]?
      RECOMMENDED: Add an explicit flag such as --first <command> consumed before positional parsing, so existing invocations parse unchanged. Step-away's fresh-session step passes it through the Skill tool. The --cloud variant should refuse it, since goal arming there is unprobed. Basis: .base/plugins/session-flow/skills/continue-in-background/SKILL.md:44-50

    Sources read

    • .base/plugins/session-flow/skills/continue-in-background/SKILL.md:107-122: the launch payload is /goal, a space, then the goal region text, and a multi-line payload arming as a goal was observed in a probe.
    • .base/plugins/session-flow/skills/continue-in-background/SKILL.md:44-59: the argument grammar and the topic sanitization that keeps untrusted text out of the launch command.
    • .base/plugins/session-flow/skills/continue-in-background/SKILL.md:201-210: the launch command passes the prompt file contents as one argument to claude --bg.
    • .base/plugins/session-flow/skills/step-away/SKILL.md:72-95: the launch turn ends asking the person to submit a /goal line, and step 6 says a fresh background session starts on its /goal line so step-away cannot arm it and hands off unarmed.
    • .base/plugins/session-flow/skills/continue-in-background/evals/evals.json:1-256: 19 eval cases, none covering a leading slash command payload; cases 10 and 11 assert the payload is exactly /goal plus the goal region text.

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  6. kyle-sexton commented on Nov 19, 2026

    @kyle-sexton
    MemberAuthor

    Recommended approach (draft for the owner's decision)

    The constraint: step-away is disable-model-invocation: true (SKILL.md:5), and a --bg launch has one first prompt, which today is /goal … (continue-in-background SKILL.md:107-116). The hooks key on the session id.

    A. Pre-assigned session id (recommended). step-away generates a UUID, runs away.py start --session <uuid> and writes the task file while the person is present, then calls continue-in-background with that id, which launches claude --bg --session-id <uuid> … "/goal …".

    • Changes: one optional id argument on continue-in-background; the payload contract and completion gate stay as they are; the hooks need no change.
    • Security surface: none new. start runs attended, which also avoids the sandbox problem in session-flow: keep away.py state in a location the Bash sandbox can write #17388.
    • Cost: a probe recorded beside reference/goal-probe.md, because claude --help lists --session-id without saying it works with --bg. UNVERIFIED until that probe runs.

    B. Allowlisted leading command. A flag such as --arm step-away makes the payload /session-flow:step-away <kind> <scope> plus the Read @ line, with no /goal. The Stop hook holds the same condition (step-away SKILL.md:87).

    C. Make step-away model-invocable. The handoff's first action arms the session. This changes what agents may do unattended, so it is the owner's decision.

    D. Won't fix. Keep step 6's "stay armed here" recommendation.

    Rejected: --bg --resume for a second prompt, which starts a copy of a running session (claude --help).

    Trust boundary: any leading slash command taken from free text, rather than a fixed allowlist, would be one. Option A has none.

  7. kyle-sexton commented on Nov 19, 2026

    @kyle-sexton
    MemberAuthor

    Probe p6 (does --bg --session-id <uuid> give the background session that id?): no.

    • Version: 2.1.328 (Claude Code)
    • claude --help:
      • --session-id <uuid> Use a specific session ID for the conversation (must be a valid UUID)
      • --bg, --background Start the session in the background and return immediately. Prints the id that claude attach, logs, stop and rm take; ... With --resume <session-id>, continues that session in the background under the same ID ...
    • Command shape (run from a plain, non-git folder, with env -i HOME PATH TERM=xterm-256color LANG=C.UTF-8):
      claude --bg --name p6-sid --permission-mode auto --setting-sources project,local --session-id e2cd39b8-dacd-4fc9-b31f-71ea0e086b11 "Reply with exactly: ok"
    • Output: warning: --bg manages the session id; ignoring --session-id (use --resume <id> to continue an existing session), then backgrounded · f233b61a · p6-sid.
    • claude agents --json --all entry for the new session: "id": "f233b61a", "sessionId": "f233b61a-c581-4760-a9ee-3c77d1583f28", "name": "p6-sid". The requested uuid e2cd39b8-... appears nowhere in the list.
    • Result: the sessionId does not equal the supplied uuid. --bg ignores --session-id with a warning and generates its own id; the short id is the first 8 characters of that sessionId. A caller that needs to know the id must read it from the --bg output or claude agents --json, not pre-assign it.
    • Cleanup: claude stop f233b61a and claude rm f233b61a done.
  8. kyle-sexton commented on Nov 19, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded.

    Question (Q228, hub morning report 2026-11-19): how should a background session started from step-away get armed? Options: (a) launch first with --bg, then arm attended with away.py start --session <printed id>; (b) an allowlisted leading step-away command as the first prompt; (c) make step-away model-invocable; (d) won't fix. Recommendation: (a).

    Owner answer (2026-11-19, 9:5x AM EST, in the hub session): "go w/ recomendations"

    Decision: (a). continue-in-background reads the id claude --bg prints (or claude agents --json), and the attended session runs away.py start --session <that id> and writes the task file while the person is present. Includes a probe of when the hooks first see the state, to settle the first-turn race.

  9. kyle-sexton commented on Nov 19, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Q228 (a) stands: launch with claude --bg, read the id it prints (or claude agents --json), then the attended session runs away.py start --session <that id> and writes the task file while the person is present, with a probe of when the hooks first see the state.

    Owner answer (2026-11-19, in the session that built #17435), when asked to choose between this and the leading /session-flow:step-away first prompt that #17435 built: "go w/ recomemndations" (recommendation: (a)). #17435 is being reworked to (a).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Work status

    confirmed

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions