Skip to content

Let the agent start with a specific task already in mind #14

@ukanga

Description

@ukanga

Use case

I create a worktree session to work on issue #123. Today I have to attach to the
session, wait for the agent to start, then type or paste "fix the auth bug
described in #123, here's the context..."
. I want to give the agent the task at
the moment I create the session, so it can start working immediately.

Outcome

wt session add accepts a per-session task prompt at creation time. The agent
launched in that session starts up with that prompt as its first user message
(or however the configured agent ingests work items). When no task prompt is
supplied, the session behaves exactly as it does today.

The mechanism is agent-agnostic — it must work for claude, opencode, aider,
and any other CLI a user has set as agent_cmd. The user, not wt, decides how
the prompt is handed to their specific agent (since each agent has its own flag
for this, e.g. claude accepts a positional prompt, opencode --prompt, etc.).

Why now

Today the workflow is wt session add → attach → context-switch → paste prompt.
Each step adds friction and makes the flow unscriptable. With per-session task
prompts, scripts and slash-commands like /do <issue> can spin up a worktree
session that's already working on the right thing.

Acceptance criteria

  • A user can run wt session add foo --prompt "..." (or equivalent) and the
    agent in that session receives the prompt at launch.
  • Both single-line and multi-kilobyte prompts work, including content with
    quotes, $, backticks, and newlines (e.g.
    --prompt "$(cat implement-fib-task.md)").
  • Works identically in both panes and windows session modes.
  • Omitting the prompt leaves session creation fully backwards-compatible —
    no new files, no behavior change.
  • The user gets a clear warning if they ask for a prompt on a
    session/window that already exists (no silent re-launch).
  • Documentation shows worked examples for at least Claude Code, with a note
    that the same mechanism extends to other agents.

Out of scope

  • A separate prompt for the agent's persona/system behavior (separate issue).
  • Auto-opening the prompt in the editor pane (separate issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions