spawn-claude

spawn-claude is a skill for Claude Code, Codex from takashicompany/headlenss. It costs 0 tokens per session (1,387 once invoked), scanned A, original, MIT.

Instructions for starting a separate Claude Code session in another terminal workspace or development environment. Claude Code is an AI coding assistant, and the instructions use a server that handles its startup confirmation.

In plain words
What is it for?
Creating a new tmux-based Claude Code session with a chosen name and working directory through the configured session server.
Why use it?
They avoid sessions getting stuck at the folder-trust prompt and help ensure the new session starts in the intended directory without a name conflict.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code.

Good fit Creating a new tmux-based Claude Code session with a chosen name and working directory through the configured session server.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/takashicompany/headlenss/spawn-claude
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add takashicompany/headlenss --skill spawn-claude
Clone the repo
git clone --depth 1 https://github.com/takashicompany/headlenss

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for spawn-claude

README.md
[![agentmods](https://agentmods.dev/badge/skills/takashicompany/headlenss/spawn-claude/github.svg)](https://agentmods.dev/skills/takashicompany/headlenss/spawn-claude)
Your own site
<a href="https://agentmods.dev/skills/takashicompany/headlenss/spawn-claude"><img src="https://agentmods.dev/badge/skills/takashicompany/headlenss/spawn-claude/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for spawn-claude

Your own site · 80×15
<a href="https://agentmods.dev/skills/takashicompany/headlenss/spawn-claude"><img src="https://agentmods.dev/badge/skills/takashicompany/headlenss/spawn-claude.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,387 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01387
Opus 5 $0.00000 $0.00694
Sonnet 5 $0.00000 $0.00277
Haiku 4.5 $0.00000 $0.00139

Measured 9d ago against content hash 47e4224f2df1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

spawn-claude scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

description: 新しい Claude Code セッション / 別の開発環境 / サンドボックス / 子セッションを立てる要求があったらこの skill を必ず使う。代表的な指示: 「新しい Claude 立てて」「別の Claude Code 起動して」「もう一つ環境作って」「別環境を building / 構築して」「子セッション spawn して」「別 tmux で claude 動かして」「別ディレクトリで作業させたい
_drafts/skills/spawn-claude/SKILL.md · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

spawn-claude

別の tmux 上で新しい Claude Code を起動する。headlenss server (${HEADLENSS_SERVER_URL}、未設定なら http://localhost:3000) の POST /api/sessions を curl で呼ぶ。

必ずこの skill を使う理由 (= 直接 tmux で立ててはいけない)

  • Claude Code は初回起動時に trust prompt (Do you trust this folder?) を出す。
  • tmux new-session -d -s NAME -c DIR 'claude' のような直接起動だと、誰もこの prompt に応答できず、Claude が起動完了に進まない (= G2 lens / WebView の Claude セッション一覧にも出てこない)。
  • headlenss server の POST /api/sessions には、起動した Claude の pane を polling して trust prompt を検出 → Enter で自動承諾するロジックが組み込まれている (advanceClaudeStartup)。
  • したがって、新しい Claude を立てるときは直接 tmux ではなく必ずこの skill (= server 経由) を使う

入力

  • <name> (必須): tmux セッション名。server 側の validation は [a-zA-Z0-9_-]{1,40} (= 英数字とハイフン/アンダースコアのみ、最大 40 文字)
  • <cwd> (省略可): 作業ディレクトリ。~/... / 相対パス / 絶対パスを受け付ける (server 側でホーム基準に解決される)。省略可だが、省略するとユーザの意図と外れた場所で起動する可能性があるので、原則として確定させてから呼ぶ

手順

  1. ユーザの要求から <name> を確定する。曖昧なら 1 度確認する。同名の session が既にあると server がエラーを返すので、被らない名前にする (必要なら事前に GET /api/claude/sessions で確認)
  2. <cwd> を確定する:
    • 「今と同じ場所で」 → 親 tmux の cwd を流用
    • 「新しい場所」 → ~/temp/spawn-<name>-<timestamp> のような捨て場を提案、もしくはユーザに確定させる
  3. server URL を解決:
    URL="${HEADLENSS_SERVER_URL:-http://localhost:3000}"
    
  4. POST で起動要求:
    curl -sS -X POST "$URL/api/sessions" \
      -H 'content-type: application/json' \
      -d '{"name":"<name>","cwd":"<cwd>","startClaude":true}'
    
  5. 応答 JSON を確認:
    • {"ok":true} → 起動要求は受理。実際の Claude Code 起動には数秒かかる
    • {"error":"..."} → 内容をユーザに伝える (invalid session name / session already exists 等)

立てた直後に初期 prompt を送りたい場合

ユーザが「立てて、これをやらせて」のような複合要求をしたら、立てた直後に input API で初期 prompt を流す:

curl -sS -X POST "$URL/api/sessions/<name>/input" \
  -H 'content-type: application/json' \
  -d '{"text":"<prompt>","submit":true}'

ただし Claude Code の起動完了前に流すと取りこぼす可能性がある。次のいずれかで起動完了を待ってから流す:

  • GET /api/claude/sessions を polling して tmuxSessionName がリストに出るまで待つ
  • 数秒 (3-5 秒程度) sleep する

注意

  • 同名衝突: 既に同じ name の tmux session があると server がエラーを返す。事前に GET /api/claude/sessions で確認するか、ユーザに別名を提案する
  • 乱発防止: ユーザの明示的な要求 1 回につき 1 回だけ実行する。確認なしに連続 spawn しない
  • 登録の自動性: 立てた Claude Code は plugin hooks 経由で headlenss server の registry に自動登録される。G2 lens / WebView の Claude セッション一覧に出てきたら起動完了と判断できる
  • 権限境界: spawn された Claude Code は親と独立した tmux pane で動く。secrets や conversation context は引き継がれない

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 62 lines · 0 tokens per session scan A 47e4224f2df1

Subscribe to this mod's changes

spawn-claude is a skill published in the GitHub repository takashicompany/headlenss (5 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,387 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens