IW-581: iw start --no-agent creates the worktree and session without launching an agent #600

Merged
mph merged 17 commits from IW-581 into main 2026-09-21 19:27:52 +00:00
Member

Summary

iw start --no-agent <key> does everything iw start does except run the session-action hook, so no agent is launched. It creates the worktree and branch, registers with the dashboard, creates the workspace, and runs the setup hooks (direnv allow, zg index). It then prints the backend's attach or focus hint and exits 0 without attaching or switching. The unattended path (start → autonomous-bootstrap → batch-implement) no longer needs a person to find and kill a claude PID.

--no-agent together with --prompt is refused before any side effect.

Changes

  • SessionHooks: public setup-only entry runSetups / runSetupsFrom; runFrom reuses it.
  • HookOps port: second method runSessionSetupHooks (live and fake).
  • WorkspaceSession.readyWithoutAgent: reports the setup-only outcome and the attach/focus hint.
  • Start: --no-agent flag, refusal with --prompt, help and exit-code text.
  • Docs: README.md, docs/api/SessionHooks.md, docs/api/CommandArgs.md.

Phase PR: #597 (merged).

Testing

  • Unit: SessionHooksTest, WorkspaceSessionTest, StartHarnessTest (both refusal orders, happy path, inside-workspace hint, setup error keeps the worktree, SetupOnly does not join).
  • E2E: test/start.bats — --no-agent runs setup hooks but skips the session-action hook, with a positive control without the flag; refusal with --prompt.
  • CI ran the full suite on #597.

Review packet: project-management/issues/IW-581/review-packet.md.

Follow-ups filed

  • #598 — declare mutually exclusive switches in CommandArgParser.
  • #599 — start/open attach without a TTY and fail.

Release notes

Příkaz iw start nově přijímá volbu --no-agent. S ní připraví pro úkol vše jako dosud, ale nespustí AI agenta. Díky tomu lze celou automatickou cestu od zadání úkolu až k finálnímu pull requestu spustit jediným skriptem, bez zásahu člověka uprostřed. Volbu nelze kombinovat s --prompt. Bez nové volby se iw start chová stejně jako dosud. (Plné znění: project-management/issues/IW-581/release-notes.md.)

🤖 Generated with Claude Code

Closes #581

## Summary `iw start --no-agent <key>` does everything `iw start` does except run the session-action hook, so no agent is launched. It creates the worktree and branch, registers with the dashboard, creates the workspace, and runs the setup hooks (`direnv allow`, zg index). It then prints the backend's attach or focus hint and exits 0 without attaching or switching. The unattended path (`start` → `autonomous-bootstrap` → `batch-implement`) no longer needs a person to find and kill a claude PID. `--no-agent` together with `--prompt` is refused before any side effect. ## Changes - `SessionHooks`: public setup-only entry `runSetups` / `runSetupsFrom`; `runFrom` reuses it. - `HookOps` port: second method `runSessionSetupHooks` (live and fake). - `WorkspaceSession.readyWithoutAgent`: reports the setup-only outcome and the attach/focus hint. - `Start`: `--no-agent` flag, refusal with `--prompt`, help and exit-code text. - Docs: `README.md`, `docs/api/SessionHooks.md`, `docs/api/CommandArgs.md`. Phase PR: #597 (merged). ## Testing - Unit: `SessionHooksTest`, `WorkspaceSessionTest`, `StartHarnessTest` (both refusal orders, happy path, inside-workspace hint, setup error keeps the worktree, `SetupOnly` does not join). - E2E: `test/start.bats` — `--no-agent` runs setup hooks but skips the session-action hook, with a positive control without the flag; refusal with `--prompt`. - CI ran the full suite on #597. Review packet: `project-management/issues/IW-581/review-packet.md`. ## Follow-ups filed - #598 — declare mutually exclusive switches in `CommandArgParser`. - #599 — `start`/`open` attach without a TTY and fail. ## Release notes Příkaz `iw start` nově přijímá volbu `--no-agent`. S ní připraví pro úkol vše jako dosud, ale nespustí AI agenta. Díky tomu lze celou automatickou cestu od zadání úkolu až k finálnímu pull requestu spustit jediným skriptem, bez zásahu člověka uprostřed. Volbu nelze kombinovat s `--prompt`. Bez nové volby se `iw start` chová stejně jako dosud. (Plné znění: `project-management/issues/IW-581/release-notes.md`.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes #581
iw start cannot make a worktree without a session, which the unattended path does not want

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The first analysis (53ea0b52) designed for the issue's old wording, which
asked to skip the workspace and the SessionAction hook together. That is
wider than the goal: the workspace is where the direnv and zg index setup
hooks run, and dropping it would silently change how an unattended agent
searches code.

The issue now states the goal instead of a mechanism — skip the agent launch,
keep the worktree, the workspace and the setup — so both CLARIFY markers the
first analysis raised no longer have anything to decide.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
iw start always launches an agent, so the unattended path must find a PID and kill it

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
--no-agent returns without entering the session, and prints the backend's
attach or focus hint instead.

This preserves today's behaviour rather than widening the flag.
enterAfterHooks joins only on NoHooks and SetupOnly; an agent hook returns
ActionHandled and returns before the join. So iw start on an issue worktree
does not join today, and skipping the agent would move the caller into the
SetupOnly branch and introduce a join that has never happened on this path.

A second --detached flag is rejected: it would make the unattended recipe pass
two flags for what one already implies, and would have no other caller.
Joining only on a TTY is rejected here as out of scope, and recorded as a
follow-up on its own evidence — test/start.bats:52-55 cannot assert an exit
status because tmux attach fails without a TTY.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
iw start always launches an agent, so the unattended path must find a PID and kill it

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-581
Phase: 1 - `start --no-agent` (hook split + command + docs)

This commit marks the checkpoint for phase 1 context generation.
Use wf-implement IW-581 to return to this point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`start --no-agent` (hook split + command + docs)

Artifacts:
- phase-01-tasks.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs(IW-581): add review packet
Some checks failed
CI / changes (pull_request) Successful in 4s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 10s
CI / lint (pull_request) Successful in 12s
CI / test (pull_request) Has been cancelled
CI / dashboard-build (pull_request) Has been cancelled
CI / compile (pull_request) Has been cancelled
b1520c86e9
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chore(IW-581): update review-state to all_complete
All checks were successful
CI / lint (pull_request) Successful in 14s
CI / compile (pull_request) Successful in 1m36s
CI / dashboard-build (pull_request) Successful in 1m12s
CI / changes (pull_request) Successful in 4s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 10s
CI / test (pull_request) Successful in 15m32s
6fef17e301
mph merged commit 85eabf1c30 into main 2026-09-21 19:27:52 +00:00
Sign in to join this conversation.
No description provided.