diff --git a/MEMORY.md b/MEMORY.md index 66cfa60..cd034f3 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -30,6 +30,7 @@ - [/orchestrate](memory/skill-orchestrate.md) — Check task state, launch container agents in git worktrees. Use `/loop 2m /orchestrate` for auto-polling - [/review-plan](memory/skill-review-plan.md) — Review plan against best practices (API, security, specs, TDD) before implementation - [/review-spec](memory/skill-review-spec.md) — Review spec for structure, requirement quality, security coverage, and testability +- [/spawn-session](memory/skill-spawn-session.md) — Spawn a new detached tmux Claude Code session with Remote Control, named after a project (wraps claude-tmux) ## References diff --git a/memory/skill-spawn-session.md b/memory/skill-spawn-session.md new file mode 100644 index 0000000..af68087 --- /dev/null +++ b/memory/skill-spawn-session.md @@ -0,0 +1,36 @@ +# /spawn-session + +## Purpose + +Spawn a new, separate Claude Code session inside a detached `tmux` session with Remote +Control enabled, in a project's directory, named after the project (e.g. "Agent Runtimes", +auto-incrementing to "Agent Runtimes #2"). Lets the user start a session for another project +that persists on the host and is reachable later via `tmux attach` (over VPN) or driveable +from the Claude app. + +## Usage + +- `/spawn-session ` — spawn for a named project folder +- `/spawn-session --mode ` — override engagement mode +- `/spawn-session --attach` — attach after spawning +- `/spawn-session` — lists projects and asks which one + +## How it works + +Thin wrapper over the `claude-tmux` script (in `small-scripts`, symlinked to `~/sbin`). +The skill only resolves the project name from `$ARGUMENTS` (or asks) and shells out to +`claude-tmux [flags]`. All real logic — folder resolution, mode selection +(profile `last-mode` unless `--mode`), Title-Casing, ` #N` auto-increment, tmux creation, +and launching `claude --remote-control` via `claude-profile` — lives in the script. + +## Gotchas + +- **Separate process, not a sub-agent.** The spawned session does not share the current + conversation's context. It's a full interactive Claude Code session the user drives. +- **Remote Control only registers once `claude` is running.** The script guarantees this by + passing the engagement mode explicitly so `claude-profile` never stalls at its interactive + picker. Don't "fix" the skill to omit the mode. +- **Default profile is `oreillyit-anthropic`.** Only override with `--profile` on request. +- **Concurrent same-profile sessions** race on the shared `active-mode.env`, but each + session's cwd takes precedence for project auto-selection, so the right project is picked. +- Spec + tests: `small-scripts/specs/claude-tmux.spec.md`, `tests/test-claude-tmux.sh`.