claude_agent
Launch Claude Code agent in a persistent terminal, send initial prompts, and monitor completion asynchronously without blocking.
Instructions
【Claude Code (Anthropic)】の対話エージェントTUIを永続端末に起動する。claude -pではなく、同じ利用者可視sessionへpty_sendで継続入力する。通常CLIと同じHOME・cwd・project/user/local設定・MCP・plugin・skill・permission/trustを共有する。aitermは完了相関stateだけをlaunch単位で所有する。起動されたagentにはsub-agent自己認識、親session、delegation depth/lineage、delegation_allowed=trueを注入し、必要な追加委譲は許可する。通常settingsへlaunch固有Stop hook settingsを加算する。起動前に共有認証を構造化確認し、未認証ならsessionを作らない。aiterm相関付きsession内の/login・/logoutは拒否する。起動して投げたら投げっぱなしでよい=親はここで待たない。完了通知は起動応答の wait_command(初回prompt時)または pty_send dispatch 後の aiterm-wait --session --cursor を親のターンを塞がない別プロセスとして起動して受ける(exit 0=done / 3=timeout(既定600秒・未完了) / 4=closed。receiptのoutcomeが正で、done以外は未完了。ポーリング不要・foreground実行はしない)。結果回収は pty_read(agent_transcript:true)。Claude の durable turn は claude_turn でも回収できる。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | 作業ディレクトリ(対象リポのルート等・任意) | |
| model | No | 起動モデル(例: claude-sonnet-4-6)。省略時はClaude CLI既定 | |
| prompt | No | 起動時に渡す初手プロンプト(任意)。送信後は待たずに即返る | |
| session_name | No | セッション名(省略で自動採番) | |
| reasoning_effort | No | Claude Code reasoning effort。low/medium/high/xhigh/max。省略時はCLI既定 | |
| launch_operation_id | No | promptなしClaude launchのexact replay相関ID。session_name必須 | |
| throughline_source_session | No | 同一端末のThroughline sessionから所有権を変えずに記憶を読み、promptのmissionより前へ注入する |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | ||
| provider | Yes | ||
| session_id | Yes | ||
| event_cursor | Yes | ||
| wait_command | Yes | ||
| submit_residue | Yes | ||
| managed_completion | Yes | 後方互換field。trueはaiterm完了相関が有効という意味で、project/user環境の隔離を意味しない |