spawn-session: use claude-sessions spawn --headless
Claude-Session: https://claude.ai/code/session_01JXneLTuvb5Gxim3DTN2tQa
This commit is contained in:
@@ -4,15 +4,18 @@ description: >
|
|||||||
Spawn a new detached tmux session running Claude Code with Remote Control enabled,
|
Spawn a new detached tmux session running Claude Code with Remote Control enabled,
|
||||||
in a project's directory, named after the project (e.g. "Agent Runtimes #2"). Use when
|
in a project's directory, named after the project (e.g. "Agent Runtimes #2"). Use when
|
||||||
the user wants to start a separate Claude Code session for another project that they can
|
the user wants to start a separate Claude Code session for another project that they can
|
||||||
attach to over VPN/tmux later or drive from the Claude app. Wraps the claude-tmux script.
|
attach to over VPN/tmux later or drive from the Claude app. Uses the claude-sessions
|
||||||
allowed-tools: Bash(claude-tmux *), Bash(ls *), Bash(tmux ls), Bash(tmux list-sessions *)
|
script's headless mode so the session is tracked like every other session.
|
||||||
|
allowed-tools: Bash(claude-sessions spawn *), Bash(claude-tmux *), Bash(ls *), Bash(tmux ls), Bash(tmux list-sessions *)
|
||||||
---
|
---
|
||||||
|
|
||||||
# Spawn Session Skill
|
# Spawn Session Skill
|
||||||
|
|
||||||
Spawn a new, independent Claude Code session inside a detached `tmux` session with
|
Spawn a new, independent Claude Code session inside a detached `tmux` session with
|
||||||
Remote Control enabled, so the user can attach to it later (`tmux attach`) or control it
|
Remote Control enabled, so the user can attach to it later (`tmux attach`) or control it
|
||||||
from the Claude app. This wraps the `claude-tmux` script — you do not reimplement its logic.
|
from the Claude app. This calls `claude-sessions spawn --headless` (which wraps `claude-tmux`) — you do not reimplement its logic.
|
||||||
|
Sessions started this way appear in the `claude-sessions` menu with the same name and
|
||||||
|
location as ones started from it.
|
||||||
|
|
||||||
## Pre-gathered context
|
## Pre-gathered context
|
||||||
|
|
||||||
@@ -24,32 +27,35 @@ from the Claude app. This wraps the `claude-tmux` script — you do not reimplem
|
|||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
|
|
||||||
1. **Determine the project.** The user's argument is: `$ARGUMENTS`.
|
1. **Determine the folder and topic.** The user's argument is: `$ARGUMENTS`.
|
||||||
- If it names a project (a folder basename from the list above, e.g. `agent-runtimes`
|
- If it names a project (a folder basename from the list above, e.g. `agent-runtimes`)
|
||||||
or `cluster-bootstrap`), use it.
|
or gives a folder path, use it.
|
||||||
- If it is empty, ask the user which project to spawn a session for, offering the list
|
- If it is empty, ask the user which folder to spawn a session for, offering the list
|
||||||
above. Do not guess.
|
above. Do not guess.
|
||||||
- Flags the user may include and you should pass straight through: `--mode <name>`,
|
- The **topic** is the session name. It defaults to the Title-Cased folder name. Pass
|
||||||
`--profile <name>`, `--name "<display>"`, `--attach`, `--dryrun`.
|
`--name "<topic>"` only if the user gave one.
|
||||||
|
- Other flags to pass straight through: `--mode <name>`, `--profile <name>`.
|
||||||
|
- If the user names a folder that does not exist and wants it made, use an absolute path
|
||||||
|
and add `--create`. Otherwise do not create folders.
|
||||||
|
|
||||||
2. **Spawn it.** Run:
|
2. **Spawn it.** Run:
|
||||||
```
|
```
|
||||||
claude-tmux <project> [flags]
|
claude-sessions spawn <folder> --headless [--name "<topic>"] [--create] [flags]
|
||||||
```
|
```
|
||||||
The script resolves the folder, picks the engagement mode (the profile's `last-mode`
|
Headless mode never prompts and never attaches. It resolves the folder, creates the
|
||||||
unless `--mode` is given), Title-Cases the project into a session name, auto-increments
|
detached tmux session there, and launches Claude Code with `--remote-control` under it.
|
||||||
with a ` #N` suffix if that name is already taken, creates the detached tmux session in
|
The engagement mode is the profile's `last-mode` unless `--mode` is given.
|
||||||
the project's directory, and launches Claude Code with `--remote-control` under it.
|
|
||||||
|
|
||||||
Do **not** pass `--attach` unless the user explicitly asked to attach — the point is
|
**If it exits with code 2**, the topic is already in use. Ask the user for a different
|
||||||
usually to leave it running detached for later. The default profile is
|
topic and re-run with `--name`. Do not invent a suffix such as `#2`.
|
||||||
`oreillyit-anthropic`; only override with `--profile` if the user asks.
|
|
||||||
|
|
||||||
3. **Report back** exactly what the script prints: the session name, how to attach
|
Do **not** pass `--attach`. The default profile is `oreillyit-anthropic`; only override
|
||||||
(`tmux attach -t "<name>"`), and the Remote-Control name to look for in the Claude app.
|
with `--profile` if the user asks.
|
||||||
If the user is on a machine without power (the common reason for this), remind them the
|
|
||||||
session persists on the host and is reachable over the VPN via `tmux attach` whenever
|
3. **Report back** exactly what the script prints: the session name, the folder, how to
|
||||||
they reconnect.
|
attach (`tmux attach -t "<name>"`), and the Remote-Control name to look for in the
|
||||||
|
Claude app. The session persists on the host and is reachable over the VPN via
|
||||||
|
`tmux attach` whenever the user reconnects.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
@@ -58,4 +64,4 @@ from the Claude app. This wraps the `claude-tmux` script — you do not reimplem
|
|||||||
- Remote Control registers in the Claude app only once `claude` is actually running inside
|
- Remote Control registers in the Claude app only once `claude` is actually running inside
|
||||||
the tmux session; `claude-tmux` guarantees this by passing the mode explicitly (never
|
the tmux session; `claude-tmux` guarantees this by passing the mode explicitly (never
|
||||||
leaving the launcher stalled at an interactive picker).
|
leaving the launcher stalled at an interactive picker).
|
||||||
- To preview without creating anything, pass `--dryrun`.
|
- To preview without creating anything, run `claude-tmux <folder> --dryrun` instead.
|
||||||
|
|||||||
Reference in New Issue
Block a user