01Overview
Most autonomous red-team agents put one LLM in a tool-use loop and hope it stays on task across a multi-day engagement. RedChain takes the opposite stance: it runs an offensive security engagement as a deterministic state machine of Kill Chain phases, where each phase is driven by a purpose-built specialist agent, produces a schema-validated artifact, and cannot advance until a hard-coded gate confirms that artifact is complete. The orchestrator — not the model — owns every phase transition.
Built on the Anthropic SDK, RedChain trades the freewheeling autonomy of loop-based agents for reproducibility, auditability, and structured deliverables. Every engagement lives in a self-contained directory: a manifest, a SQLite state store recording phase status and gate decisions, one markdown artifact per phase, and a full JSONL prompt/response transcript for every agent run. Engagements checkpoint to disk and resume exactly where a gate paused them, which is what makes multi-day, multi-analyst campaigns tractable.
The comparison the README draws is precise — autonomous loops track phases but never enforce them, decide their own next step, and leave you a conversation log; RedChain enforces phases in code, keeps transitions deterministic, and leaves you an artifact-per-phase plus a per-gate transcript audit trail. It is the right tool when a red team needs signed-off scope, defensible evidence, and a report they can hand to a SOC — not when they want a model to freelance against a live target.
This is an honest Alpha (v0.1.0): three of the nine Kill Chain phases — scope, recon, and report — are wired end-to-end behind the webapp preset, with the remaining six (weaponize, delivery, exploit, installation, C2, objectives) documented as planned but not yet implemented (no phase modules or PHASE_REGISTRY entries yet). Critically, the MVP plans and validates rather than weaponizes: agents synthesize scope briefs and recon dossiers and explicitly refuse to actively scan or exploit, making it safe to demonstrate while the offensive phases mature.
02Key Capabilities
Gated phase state machine
Each phase must pass a code-enforced gate before the orchestrator advances, so a scope brief with no objectives or a recon dossier with no entrypoints hard-stops the pipeline instead of silently proceeding.
Specialist agent per phase
Distinct system-prompted agents (Planner for scope/report, Network Analyst for recon) each own a narrow deliverable, rather than one general agent improvising every step.
Validated artifact per phase
Every phase emits a Pydantic-modeled, Jinja2-rendered markdown artifact where the structured model is the source of truth and the markdown is the human-readable view.
Checkpoint and resume
Engagement state persists to SQLite between phases so `redchain resume` picks up at the next unsatisfied phase — built for multi-day campaigns that span sessions.
Full transcript audit trail
Every agent invocation writes a JSONL prompt/response transcript with token-usage metadata, giving a defensible, replayable record of exactly what each agent saw and produced.
Dry-run mode with fixtures
`--dry-run` swaps live API calls for canned fixture responses, letting the entire orchestrator run end-to-end in CI or offline without an API key.
Prompt caching built in
System prompts are sent with ephemeral cache_control so repeated agent calls across a long engagement reuse cached context and cut token cost.
Preset-driven engagements
YAML presets declare the phase order and default model for an engagement class (e.g. webapp), making engagement types reproducible and versionable.
Plan-not-weaponize safety posture
Recon and scope agents are instructed to synthesize passive findings and never actively scan or exploit, keeping the MVP safe to demonstrate against real targets.
Queryable vulnerability reference
A CWE-tagged pattern library (SQLi, XSS, IDOR, SSRF, open redirect) is loadable by tag to seed findings with validation and remediation guidance.
Tool integration wrappers
A subprocess integration layer (nmap -sV with XML parsing) degrades gracefully to an explanatory stub when the binary is absent, rather than crashing the phase.
Rich CLI with status inspection
`engage`, `resume`, `status`, and `list-presets` commands render phase state, gate reasons, and artifacts as color tables or machine-readable JSON.
03Architecture
RedChain is a Python package (src/redchain) layered as a runtime that owns control flow, a set of Kill Chain phases each paired with a gate, specialist agents that wrap the Anthropic SDK, and supporting skills, integrations, templates, presets, and a vulnerability reference. The CLI loads a YAML preset, provisions an engagement directory with a SQLite state store and manifest, then the Orchestrator iterates the preset's phases: for each it runs the phase's agent(s), renders a Pydantic-validated artifact from a Jinja2 template, and calls the gate; a failed gate marks the phase failed_gate and pauses the run for resume, while a pass records completion and advances.
04Project Structure
src/redchain/runtime/Orchestrator, SQLite state store, artifact store, and the Anthropic AgentSession wrapper with dry-run support.src/redchain/phases/One module per Kill Chain phase (scope, recon, report implemented) plus base Phase class and PHASE_REGISTRY.src/redchain/gates/Artifact-completeness validators (scope_gate, recon_gate, report_gate) that block phase advancement.src/redchain/agents/Specialist agent classes (Planner, NetworkAnalyst) with system prompts and the AGENT_REGISTRY.src/redchain/templates/Jinja2 templates for the three artifacts: scope_brief, recon_dossier, executive_report.src/redchain/presets/YAML engagement templates; webapp.yaml defines the MVP scope->recon->report flow and default model.src/redchain/vulnref/CWE-tagged vulnerability pattern library (patterns.json) with load/find-by-tag helpers.src/redchain/integrations/Subprocess tool wrappers; nmap.py runs nmap -sV and parses XML, stubbing out when nmap is absent.src/redchain/skills/Reusable Python helpers invokable from any phase; recon_osint is a stub for future passive OSINT providers.src/redchain/cli.pyTyper CLI exposing engage, resume, status, list-presets, and version commands.src/redchain/_fixtures/Bundled canned agent responses (planner, network_analyst, report_writer) powering --dry-run runs.tests/Pytest suite (test_gates, test_orchestrator_dryrun, test_state) exercising gates, the dry-run pipeline, and state store.05Security Controls
06Technology Stack
- Language
- Python 3.10+ (src layout, hatchling build)
- LLM SDK
- anthropic >=0.40 (default model claude-sonnet-4-6, ephemeral prompt caching)
- CLI
- typer >=0.12 + rich >=13.7 for tables/console output
- Data modeling
- pydantic >=2.5 artifact models; jinja2 >=3.1 templating; pyyaml presets/manifest
- State
- SQLite (stdlib sqlite3), one state.sqlite per engagement
- Testing
- pytest >=8 with pytest-cov; live tests gated behind a 'live' marker
- Lint/Types
- ruff >=0.5 (E/F/W/I/UP/B/C4/SIM) and mypy >=1.10
- Packaging
- hatchling wheel/sdist; console script entrypoint redchain = redchain.cli:app
07Quick Start
$ pip install -e ".[dev]" # editable install with dev tooling $ export ANTHROPIC_API_KEY=sk-ant-... # required for live agent calls $ redchain engage --preset webapp --target https://app.example.com --out ./engagements/eng-001 $ redchain resume ./engagements/eng-001 # pick up at the phase where a gate paused $ redchain status ./engagements/eng-001 # inspect phase status and gate reasons $ redchain engage --preset webapp --target https://app.example.com --out ./engagements/dryrun --dry-run # no API calls, CI-friendly
08Compliance & Frameworks
09Integrations & Outputs
Explore RedChain
Full source, documentation, and deployment guides live on GitHub.