Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agent guide

Onboarding for AI agents operating Castellan panes — Claude Code, Codex, Cursor, and Pi. Paste this page (or llms.txt) into your agent context before driving Castellan.

What you are operating

Castellan is a coordination runtime, not a chat router. Agents coordinate through:

  • Blackboard — typed JSON slots
  • Pheromone field — decaying zone signals that wake the scheduler
  • Multiplexer panes — PTY sessions with NDJSON socket control

Do not coordinate via agent-to-agent natural language. Use substrate tools and pane deposits.

Install (operator machine)

curl -fsSL https://raw.githubusercontent.com/Alphabetsoup16/Castellan/main/install.sh | bash
export PATH="$HOME/.cargo/bin:$PATH"   # if install.sh used cargo install

Verify:

castellan run --goal "reach target" --plugin gridworld
ls .castellan/episodes/

Daily-driver loop

castellan multiplexer ensure          # start socket server
castellan dashboard                   # ratatui control tower (optional)
castellan herd status                 # agent states across panes
castellan run --goal "..." --plugin shell --mcp

Episode flywheel: castellan run.castellan/episodes/*.jsoncastellan evolvecastellan drift-check.

Agent-specific pane setup

AgentStart in paneHook install
Claude Codeclaude in panecastellan integration install claude
Codexcodex in panecastellan integration install codex
CursorCursor terminal or cursor CLIMCP via castellan mcp (see below)
Pipi in paneUse Pi programmatic/RPC mode in pane

Spawn via socket API:

{"id": 1, "method": "agent.start", "params": {"name": "claude", "focus": true}}

Or CLI: castellan herd attach --pane <id> after castellan herd status.

MCP workflow (Cursor and headless agents)

  1. Operator wires castellan mcp in MCP settings (Cursor setup).
  2. Agent calls castellan_search_toolscastellan_describe_tool → invoke.
  3. For live substrate during episodes, operator runs castellan run --mcp.

Key tools: castellan_deposit_signal, castellan_read_blackboard, castellan_topology_snapshot, castellan_multiplexer_status.

Full catalog: MCP tools.

Socket automation (HerdR-shaped)

Connect to ~/.config/castellan/castellan.sock. One JSON request per line.

{"id": 1, "method": "ping", "params": {}}
{"id": 2, "method": "agent.list", "params": {}}
{"id": 3, "method": "pane.read", "params": {"pane_id": "w1:p1", "lines": 40}}
{"id": 4, "method": "events.wait", "params": {"match_event": {"agent_status": "idle"}, "timeout_ms": 60000}}

Full method table: Socket API.

Diagnosis recipes

SymptomCheckFix
No socketcastellan herd status failscastellan multiplexer ensure
Agent stuck “working”castellan herd agent explain --pane <id>Wait or pane.report_agent hook
MCP tools missingCursor MCP panelRestart Cursor; verify castellan mcp path
Episode not writtencastellan run exit codeRun with --json; check plugin goal
Drift rejectedcastellan drift-check outputReview castellan.toml governance section

Flags agents should know

CommandWhen
castellan run --jsonHeadless NDJSON contract (episode_start … episode_end)
castellan run --mcpLive MCP tools on running engine
castellan run --rlmRLM verify/act loop
castellan remote --ssh user@hostRemote pane farm
castellan evolve --episodes NTopology mutation from corpus

Do not invent flags — verify with castellan --help or CLI reference.

Skills

Castellan scans .castellan/skills/ and ~/.cursor/skills/ on castellan run. Author skills as SKILL.md with frontmatter; install via Cursor skills UI or copy into project.

Honest limits

  • Castellan is not OpenCode/Claude Code — no built-in 75-provider coding agent on the hot path.
  • Default castellan run uses deterministic plugins; wire your LLM via MCP or panes.
  • Agent-to-agent chat coordination is forbidden by design.

See What Castellan is / is not.