haasonsaas

Claude Recursive Spawn — Development skill for Claude Code

Development community

Bash script for recursive Claude Code execution with depth control, JSON output parsing, and automatic session management.

How to install Claude Recursive Spawn

This entry records only its repository, not the path inside it, so there is no exact command to give. Open haasonsaas/claude-recursive-spawn and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Recursive Spawn does

Bash script for recursive Claude Code execution with depth control, JSON output parsing, and automatic session management.

Alternatives in Development

  • Happy Coder — by GrocerPublishAgent - Spawn and control multiple Claude Codes in parallel from your phone or desktop 15.7k ★
  • Ralphy — My Ralph Wiggum setup, an autonomous bash script that runs Claude Code, Codex, OpenCode, Cursor agent, Qwen & 2.8k ★
  • Claude Supermemory — Persistent memory across sessions and projects using Supermemory 2.3k ★

README

Claude Recursive Spawn

A flexible bash script for recursive Claude Code execution with depth control, multiple output modes, and extensive configuration options.

Features

  • 🔄 Recursive execution with configurable depth limits
  • 📊 Multiple output modes: JSON, extracted results, or status messages
  • 🎨 Colored output with verbose mode for debugging
  • 🔧 Flexible configuration via CLI options or environment variables
  • 📁 Automatic output management with timestamped files
  • 🚀 Smart Claude detection across different installation methods

Installation

git clone https://github.com/haasonsaas/claude-recursive-spawn.git
cd claude-recursive-spawn
chmod +x claude_spawn

Usage

./claude_spawn [options] [depth] [prompt]

Options

  • -h, --help - Show help message
  • -m, --max-depth NUM - Set max recursion depth (default: 4)
  • -o, --output-dir DIR - Set output directory (default: /tmp/claude_spawn)
  • -v, --verbose - Enable verbose output
  • -j, --json-only - Only output JSON (no status messages)
  • -c, --claude-path PATH - Set path to Claude executable
  • -e, --extract-result - Extract and display the result field from JSON

Examples

# Basic usage
./claude_spawn 0 "What is 2+2?"

# With custom max depth
./claude_spawn -m 6 0 "Analyze this codebase"

# JSON output only (for piping)
./claude_spawn -j 0 "List files" | jq .result

# Extract result directly
./claude_spawn -e 0 "What is the capital of France?"

# Verbose mode for debugging
./claude_spawn -v 0 "Debug this issue"

# Custom Claude path
./claude_spawn -c /opt/claude/bin/claude 0 "Hello"

Environment Variables

  • CLAUDE_MAX_DEPTH - Override default max depth
  • CLAUDE_TMP_DIR - Override default output directory
  • CLAUDE_CMD - Override default Claude command
  • CC_PROMPT - Default prompt if none provided

Output Structure

Output files are saved as: `depth-{depth}-{timestamp}.json`

Example JSON output:

{
  "t