Webhook-driven agent spawner service for the Claude agent team
  • Python 98.4%
  • Shell 1.6%
Find a file
Justin Belec 26164184f4 Add HAL conversational flow, Sibyl System, orphan watchdog, and bugfixes
Major features:
- HAL conversational plan: approval gate, INITIAL/CONVERSATION/MENTION/FOLLOWUP
  spawn modes, pending comment queue, progress checklists
- Sibyl System (claude-chat): fire-and-forget analyst agent with self-unassign
- Orphan process watchdog: kills stale claude processes not tracked by spawner
- Chat pool support in config (max_concurrent_chat)

Bugfixes:
- Pending comments queued when agent busy, processed on IDLE transition
- Stale workspace sync (git fetch/checkout/reset/clean) on every spawn
- Sub-issue safety: check existing before creating, never re-open closed
- Self-close detection to prevent SIGTERM race

BOOTSTRAP.md updated for memory-db Tower migration (Docker + Traefik).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:42:40 -06:00
docs Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00
src Add HAL conversational flow, Sibyl System, orphan watchdog, and bugfixes 2026-02-04 09:42:40 -06:00
systemd Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00
tests Add complete agent-spawner implementation 2026-02-03 16:56:02 -06:00
.gitignore Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00
agent-ctl Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00
BOOTSTRAP.md Add HAL conversational flow, Sibyl System, orphan watchdog, and bugfixes 2026-02-04 09:42:40 -06:00
config.example.yaml Add complete agent-spawner implementation 2026-02-03 16:56:02 -06:00
pyproject.toml Add complete agent-spawner implementation 2026-02-03 16:56:02 -06:00
README.md Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00
requirements.txt Initialize agent spawner project with full documentation 2026-02-02 20:09:23 -06:00

Agent Spawner

Webhook-driven service that spawns Claude agents in response to Forgejo issue assignments.

Overview

The Agent Spawner is the orchestration layer for the Claude agent team. It:

  • Listens for Forgejo webhooks (issue assigned, PR review requested, etc.)
  • Spawns the appropriate Claude agent with full context
  • Monitors agent health via heartbeats
  • Provides status API for HAL (architect) to query
  • Handles recovery when agents die or get stuck

Agent Team

Agent Persona Role
claude-architect HAL 9000 Lead architect, assigns work, reviews PRs
claude-coder-1 Skippy Implementation
claude-coder-2 TARS Implementation
claude-docs-qa GLaDOS Documentation and testing

Quick Start

# Install dependencies
cd /opt/agent-spawner
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Configure
cp config.example.yaml config.yaml
# Edit config.yaml with your settings

# Run
python -m src.main

# Or via systemd
systemctl start agent-spawner

Architecture

[Forgejo] --webhook--> [Spawner] --spawns--> [Claude Agent]
                           |
                           +--> Status API
                           +--> Heartbeat Monitor
                           +--> Orphan Scanner

See docs/ARCHITECTURE.md for details.

Configuration

See docs/CONFIGURATION.md for all options.

Key settings:

spawning_enabled: true
max_concurrent_coders: 2
max_concurrent_docs: 1
heartbeat_timeout_default: 600  # 10 min
orphan_scan_interval: 300       # 5 min

API Endpoints

Endpoint Description
GET /health Service health check
GET /agents/status All agent statuses
GET /agents/{name}/status Specific agent status
POST /agents/{name}/stop Stop an agent
POST /webhook Forgejo webhook receiver

See docs/API.md for full documentation.

CLI

# Check status
agent-ctl status

# Stop an agent gracefully
agent-ctl stop coder-1

# Force stop
agent-ctl stop coder-1 --force

# Emergency halt all
agent-ctl stop --all

# Enable/disable spawning
agent-ctl enable
agent-ctl disable

Documentation

Project Structure

agent-spawner/
+-- src/
|   +-- main.py           # Application entry point
|   +-- config.py         # Configuration management
|   +-- webhook.py        # Webhook handlers
|   +-- spawner.py        # Agent spawning logic
|   +-- monitor.py        # Heartbeat monitoring
|   +-- scanner.py        # Orphan issue scanner
|   +-- status.py         # Status API
|   +-- notifications.py  # Pushover alerts
+-- tests/
|   +-- test_webhook.py
|   +-- test_spawner.py
|   +-- mock_agent.sh     # Mock agent for testing
+-- docs/
|   +-- DESIGN.md
|   +-- ARCHITECTURE.md
|   +-- API.md
|   +-- CONFIGURATION.md
|   +-- DEPLOYMENT.md
+-- config.example.yaml
+-- requirements.txt
+-- agent-ctl             # CLI tool
+-- README.md

License

Internal infrastructure tool.