Skip to content

flow run playbook doesn't support --here for in-session bind (no parallel to flow do --here) #47

@vishnukv-facets

Description

@vishnukv-facets

Current behavior

flow run playbook <slug> always spawns a new terminal tab via cmdDo. There is no flag to bind the current Claude session to the new playbook-run task instead.

$ flow run playbook new-vm --here
flag provided but not defined: -here
Usage of run playbook:
  -dangerously-skip-permissions

Exit code 2.

Why this is a gap

Regular tasks have a clear in-session bind path:

  • flow do <slug> → spawns a new tab.
  • flow do --here <slug> → binds the current session, no tab spawn.

Playbook runs only have the first form. When the user is in a dispatch session and wants to execute a playbook run in the active conversation (preserving the transcript, avoiding a tab switch), there's no way to do it.

Source

  • internal/app/run.go:31-116cmdRunPlaybook defines only --dangerously-skip-permissions and always delegates to cmdDo(doArgs) with no --here forwarded.
  • internal/app/do.go:59,75-77cmdDo natively supports --here (routes to cmdDoHere), but cmdRunPlaybook never uses that path.
  • internal/app/run_test.go — no tests cover an in-session bind variant.

Proposed UX

flow run playbook <slug> --here:

  1. Create the playbook-run task row + snapshot brief as today.
  2. Instead of cmdDo(doArgs), call cmdDoHere(runSlug, force).
  3. Net effect: a kind=playbook_run task is created, its brief is snapshotted, and the current Claude session is bound to it. Status flips to in-progress. No tab spawns.

Inherits all --here safety invariants

  • Refuses if \$CLAUDE_CODE_SESSION_ID is unset.
  • Refuses if this session is already bound to another task (session_id uniqueness; --force does not override).
  • (Done-task refusal is irrelevant — the run is brand-new in backlog.)

Open questions

  • Should --here accept --force? Probably yes for symmetry, though the only case it can rescue is a rare collision with an existing pre-bound run-task (which can't happen with a freshly-inserted row).
  • Should the skill's §4.13 (run a playbook) gain a session-mode question similar to §4.4 (regular flow do)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions