spawn-session

Spawns detached tmux Claude Code sessions pre-configured with claude-hive and Discord channels.

Updated May 12, 2026
One-click install
npx skills add https://github.com/fryanpan/ai-team-lead --skill spawn-session-fryanpan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: spawn-session
Source: https://github.com/fryanpan/ai-team-lead/tree/main/.claude/skills/spawn-session
Command: npx skills add https://github.com/fryanpan/ai-team-lead --skill spawn-session-fryanpan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When orchestrating multiple Claude Code agents across projects, you need a reliable way to start a new worker session for a project that has none running — with the correct working directory, channel flags, and environment variables so it can receive delegated work and post under its own identity. ## Core Features & Use Cases - Detached tmux session spawning: Launches Claude Code via zsh -ic in a named tmux session rooted at the target project's directory. - Environment isolation: Sets DISCORD_STATE_DIR, CW_AGENT_NAME, and FEEDBACK_AGENT_NAME per session to prevent Discord fan-out and anonymous workspace posts. - Registration verification: Confirms the new peer appears in claude-hive list_peers and that both channel flags are present in the process arguments. - Use Case: A team-lead agent needs to delegate work to a new side project; it checks no peer exists, spawns a named session, verifies broker registration, and sends an onboarding message via send_message. ## Quick Start Ask the agent to spawn a new Claude Code session for a specific project directory and delegate an initial task to it via claude-hive.

Frequently Asked Questions about spawn-session

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I spawn a new Claude Code session in tmux?▼

Run tmux new-session with the -d flag for detachment, -c for the project directory, and launch via zsh -ic so the claude shell function loads with its channel flags. Pass a display name with the -n flag so the session is identifiable.

How do I check if a Claude Code peer session already exists?▼

Call the claude-hive MCP list_peers tool with machine scope and match peers by their cwd, repo, or stable_id. If a peer already exists for the project, delegate to it with send_message instead of spawning a duplicate.

Why does my spawned session post to Discord as a generic Agent?▼

The CW_AGENT_NAME environment variable was not set at launch, so the workspace attributes comments generically. It must be passed via tmux -e at spawn time because the MCP child inherits the parent process environment and cannot be fixed afterward.

Why do Discord messages fan out to all my agent sessions?▼

The spawned session inherited the team-lead's DISCORD_STATE_DIR, so every peer shares the same bot token and channel subscriptions. Pass a per-peer DISCORD_STATE_DIR via tmux -e, or use a shared no-discord state directory for peers without their own setup.

Why doesn't my new tmux session register with the claude-hive broker?▼

Claude Code may have failed to boot, often because zsh -c was used instead of zsh -ic so the claude function never loaded. Inspect the pane with tmux capture-pane and check for startup dialogs or missing channel flags in the process arguments.

When should I not spawn a new Claude Code session?▼

Do not spawn when a peer for that project already exists in list_peers, or when the user has not explicitly requested a new session. Spawning is a visible side effect, so confirm with the user when in doubt.