System architecture

Host, orchestrator, specialist agents, MCP control plane, on-disk session state, safety rails. Every layer typed, every layer inspectable.

Mantis system architecture

Host layer

The host is whatever agent runner you're using: Claude Code, OpenCode, Aider, Cline, Cursor, or a custom MCP client. The host is responsible for one thing: forwarding the user's intent (typically /mantis target.com) to the orchestrator and shuttling tool calls to the MCP server.

Orchestrator

A slash command (Claude Code) or named agent (OpenCode). It drives the 7-phase FSM, spawns specialist agents per phase, and reconciles wave handoffs. Crucially:

FSM state

State lives in ~/mantis-sessions/<domain>/state.json. The 7 phases:

RECON → AUTH → HUNT → CHAIN → VERIFY → GRADE → REPORT
                                          ↓ (HOLD)
                                        HUNT (targeted)

                                            ↓ (user)
                                         EXPLORE → CHAIN → VERIFY → GRADE → REPORT

Only two legal back-edges: GRADE → HUNT (when a finding is graded HOLD), and REPORT → EXPLORE (when the user requests more hunting after reading the initial report).

Specialist agents

Twelve agents, each with a narrow role prompt and tool whitelist. See the agents page for the full catalog. The hunter agent self-specialises by reading tech_stack from its brief: webapp, api, identity, or network.

MCP control plane

A local stdio MCP server, pure Node, zero dependencies, that exposes 27 typed tools. All inter-agent state flows through these tools, not through prose. See the MCP tools reference.

Why MCP instead of direct file writes? Three reasons:

Session directory

Per-target runtime state at ~/mantis-sessions/<domain>/:

FileFormatPurpose
state.jsonJSONFSM phase, wave count, exclusions, lead routing
attack_surface.jsonJSONRecon output grouped by priority
wave-N-assignments.jsonJSONPer-wave agent → surface map
handoff-wN-aN.jsonJSONAuthoritative hunter handoff
findings.jsonlJSONLAppend-only canonical findings
brutalist.json · balanced.json · verified-final.jsonJSONMulti-Step Evidence rounds
grade.jsonJSON5-axis score + verdict
report.mdMarkdownSubmission-ready report

Safety rails

Three guardrails, all enforced before the model can do harm:

See Safety rails for the full enforcement matrix.