1 · What DCRH Is
DCRH is Anthropic's open-source reference implementation for autonomous vulnerability discovery and remediation with Claude — packaged learnings from partnering with security teams at several organizations (the "Glasswing" work), not a polished product. The managed equivalent is Claude Security.
Explain-it-simply
A crash-testing crew for source code. A recon agent maps the codebase into attack-surface areas. Isolated "find" agents each try to break a different area by feeding malformed input to a memory-safety-instrumented build until it crashes reproducibly. A "grade" agent — in a clean container that never saw the finder's reasoning, only the crash bytes — re-confirms the crash is real. A "judge" checks it isn't a duplicate. A "report" agent writes up what an attacker could do with it. A "patch" agent then drafts a fix, hammered by a grading loop before it's trusted. A parallel crew does the same verification-first thinking over logs instead of source: hunt for a campaign that's already happened.
Two halves ship in one repo: interactive Claude Code skills
(.claude/skills/, read/write-file only) and two autonomous multi-agent
pipelines (harness/ = vuln-pipeline, dnr_harness/ = dnr-pipeline)
that execute target code inside a gVisor sandbox. This repo is not maintained and not
accepting contributions — it's a reference to fork, not a service to depend on.
2 · Who Should Read What
A short table routing different readers to the right sections and depth.
| Reader | Start with | Then |
|---|---|---|
| Non-technical / analyst | §1 What DCRH Is | Explain-it-simply boxes throughout; §3 Interactive Skills; §4 Pipeline Explorer |
| Junior developer | §4 Pipeline Explorer | §7 Module Flow (click each box — all four questions answered), §6 Data Flow |
| Security engineer / AppSec | §5 Sandboxing & Trust Boundaries | §7 Module Flow, §8 Graph Intelligence |
| Anyone customizing the pipeline | §7 Module Flow | the repo's own docs/customizing.md |
3 · Interactive Skills (.claude/skills/)
Run inside a live Claude Code session. Only /customize edits pipeline
source; everything else here reads and writes repo files (the two D&R skills
additionally run a local demo app on 127.0.0.1).
| Skill | Job | Scope |
|---|---|---|
/quickstart | Orientation + guided first run; front door for "how do I…" questions | read/write only |
/threat-model | Assets, entry points, trust boundaries, ranked threat classes — bootstrap (research swarm), interview (4-question framework), or bootstrap-then-interview | read-only, no build/exec |
/vuln-scan | Static source review, scoped by THREAT_MODEL.md if present — nothing built or run | read/write only |
/triage | Verify + dedupe + rank findings across one or many results/ runs and/or static findings, against the threat model | read/write only |
/patch | Candidate fixes for verified findings (pipeline crashes or static TRIAGE.json) | read/write only |
/dnr-hunt | No-alert log hunt over the demo corpus (or your own logs) → alerts | read/write + local demo app |
/dnr-respond | Lead-in-hand: verdict, blast radius, response plan | read/write + local demo app |
/customize | Ports the pipeline to a new stack — edits harness source, may run validation commands | ⚠️ review its plan before approving |
/verify
Contributor tooling for validating harness changes on docker-less hosts — not part of the user flow.
4 · Interactive Pipeline Explorer (vuln-pipeline)
Click any stage to see its input/output and role. Use the Simple/Technical switch above to change the depth of every description on this page. This is the static/memory-safety track — see §5 note on the detection & response mirror.
Detection & response mirror (dnr-pipeline)
generate_logs.py (local-only, gitignored) → hunt container
(app source + log corpus, read-only — the answer key, grader, and log generator never
enter this container, by image construction, not convention) →
INCIDENTS.json → fresh grade container (answer key + scorer,
read-only) independently re-fires every confirmed incident's PoC against a freshly
seeded app. Same verification-over-vibes shape as vuln-pipeline, applied to logs.
6 · Data Flow
What crosses the trust boundary at each hop. Diagrams render client-side (Mermaid); click any diagram to zoom.
Level 0 — context: operator/session, the trusted orchestrator, the sandboxed agent containers, and the model API.
Level 1 — the vuln-pipeline loop: build → recon → find → grade → judge → report → dedup → patch.
Level 1 — the dnr-pipeline mirror over logs.
What never crosses a boundary
Isolation invariants
The find agent's reasoning never reaches the grader — only the PoC bytes. The D&R hunt container never contains the answer key, grader, or log generator. Agent containers cannot reach the internet except the model API.
5 · Sandboxing & Trust Boundaries
Models good enough to find creative vulnerabilities are also capable of taking creative, unexpected actions against their own execution environment. DCRH's rule: constraints must be enforced in code, not in prompts — telling the model what it can't do isn't a security boundary; taking away the capability is.
| Surface | Without sandbox | With sandbox (gVisor) |
|---|---|---|
| Agent Read/Write | host filesystem | container filesystem only |
| Agent Bash | host shell | container shell only, gVisor kernel |
| Network egress | whatever the host has | allowlist only (default api.anthropic.com:443) |
| Host coupling | full | docker exec extracts PoCs only |
bin/vp-sandboxed verifies gVisor + the egress proxy
before launching agents and refuses to start otherwise —
--dangerously-no-sandbox overrides this, throwaway-VM development only. The
vp-internal Docker network has no internet route; the only way out is a proxy
container that forwards traffic only to the model API.
Prompt injection — the patch agent is the highest-stakes case
Its output is a diff a human may apply to a real codebase. Target-derived text in the
patch prompt is wrapped in <untrusted_data> blocks with a per-call
random id, and the agent is told to treat it as data, not instructions. A mitigation, not
a guarantee — review every generated diff.
8b · Technology Stack
| Layer | Tech |
|---|---|
| Agent runtime | claude -p (Claude Code CLI), Anthropic API / Bedrock / Vertex |
| Isolation | gVisor (runsc), Docker, vp-internal network + allowlist proxy |
| Target instrumentation | ASAN (AddressSanitizer) via each target's Dockerfile |
| Orchestration | Python (harness/, dnr_harness/), no external DB — JSON/JSONL on disk |
| Interactive layer | Claude Code skills (.claude/skills/), Markdown SKILL.md definitions |
7 · Module Flow
Click any box below to expand what actually happens inside it, how its model (if any) is selected, and which parts are deterministic.
CLI (hub) ▸in argv (recon | run | dedup | report | patch subcommands, + all flags)out dispatch into every other module
package: harness/cli.py (1,424 LOC) · dnr_harness/cli.py (518 LOC)
The hub. Every vuln-pipeline and dnr-pipeline invocation starts and is routed here.
What actually happens here
harness/cli.py is by far the largest file in the repo and is the dispatch point for every subcommand: recon, run (find+grade, with --runs/--parallel/--auto-focus/--stream/--resume), dedup, report, and patch. CodeGraph's impact analysis on run_agent shows cli.py holding 7 of the 43 affected call sites (_run_once, _stream_dispatch, _stream_report, _one, _run_all, _cmd_recon, _report_one) — concretely, this file is where nearly every stage's entry point lives. dnr_harness/cli.py mirrors the same dispatch shape for the detection-and-response track (hunt/grade subcommands).
How the LLM / model version is chosen
No model calls directly — cli.py parses --model / falls back to the VULN_PIPELINE_MODEL env var, then passes that model id down into whichever module actually spawns an agent (agent.py::run_agent). dedup takes no --model at all, since it spawns no agents.
Deterministic (non-LLM) work in this module
Argument parsing and validation, subcommand dispatch, --resume batch-layout checks (rejects a bare --runs 1 against a multi-run layout), and the Bedrock model-id preflight warning (catches a bare foundation-model id before the first API call fails).
Depends on: agent, auth, docker_ops, recon, find, grade, judge, report, dedup, patch
Agent Runner ▸in a stage's prompt + target model id + container handleout agent transcript (streamed to disk) + final result
package: harness/agent.py (436 LOC)
Spawns one claude -p session per agent, streams its transcript live, and owns the retry/resume-on-error loop.
What actually happens here
run_agent() is the single highest-connectivity function in the whole repo (31 edges per Graphify's god-node ranking, and the seed of CodeGraph's 43-symbol impact set) — every stage that spawns an agent (recon, find, grade, report, patch) calls through here. It launches claude -p as one long-lived session, streams the transcript to disk as it's produced (so a run can be watched or killed without losing work), and on a 429/5xx retries with backoff using the CLI's own --resume <session_id> to restore the full conversation.
How the LLM / model version is chosen
Receives the model id chosen upstream (cli.py's --model / VULN_PIPELINE_MODEL) and the resolved auth environment from auth.py; does not itself choose a model or vendor — it is the transport, not the router.
Deterministic (non-LLM) work in this module
The retry/backoff state machine (up to 20 retries) and the one exception: error_max_turns is terminal by design — resuming would multiply the turn cap, so only a raised --max-turns and a fresh run recovers from it. A crash submitted before the cap is still salvaged and graded.
Depends on: auth, docker_ops
Auth Resolution ▸in environment (ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN / AWS_* / CLAUDE_CODE_USE_BEDROCK)out a resolved credential + endpoint environment for the agent container
package: harness/auth.py (470 LOC)
Decides which of API key, OAuth token, or Bedrock/Vertex credentials the agent process actually authenticates with.
What actually happens here
resolve_auth_env() is the single most-connected function in the repo (51 edges — Graphify's top god node): nearly every agent-spawning path routes through it before a container ever starts. _bedrock_env() (28 edges) handles the Bedrock case specifically — materializing AWS_BEARER_TOKEN_BEDROCK or access keys into the environment, since instance-profile/IMDS credentials are deliberately unsupported (the agent container has no route to 169.254.169.254). AWS_PROFILE and ~/.aws are never forwarded.
How the LLM / model version is chosen
Does not choose the model itself, but chooses the vendor/transport the model call goes through: Anthropic API, OAuth-authenticated Claude Code, or Bedrock (cross-region inference-profile prefixed ids like us./eu./apac./global.) — this is the module that turns a --model flag into an actually-callable endpoint.
Deterministic (non-LLM) work in this module
Credential precedence resolution and validation (e.g. rejecting a bare foundation-model id on Bedrock before the API call is made) is pure rule evaluation — no model in this loop.
Depends on: none (leaf module)
Target Config ▸in targets/<name>/config.yamlout TargetConfig (focus_areas, known_bugs, github_url, etc.)
package: harness/config.py (73 LOC)
Resolves and validates a target's config.yaml into the structure every other module reads.
What actually happens here
TargetConfig (26 edges — a Graphify god node) is the shared data class nearly every stage reads target-specific settings from: hand-written focus_areas (if --auto-focus wasn't used), known_bugs for steering future runs away from prior findings, and github_url (only read on the host, by novelty.py, never inside an agent container).
How the LLM / model version is chosen
No model calls — pure YAML parsing and dataclass construction.
Deterministic (non-LLM) work in this module
Entire module. Schema validation and default-filling for a target's config.
Depends on: none (leaf module)
Sandbox / Container Ops ▸in target Dockerfile + agent image specout running gVisor container, agent_container() handle
package: harness/docker_ops.py (156 LOC) · sandbox.py (138 LOC) · agent_image.py (90 LOC)
Builds target/agent Docker images and launches every agent inside a gVisor container on the egress-restricted vp-internal network.
What actually happens here
agent_container() (22 edges) is the function every stage's agent actually runs inside of. This module builds the target's ASAN image once (cached), builds a copy with the Claude Code CLI installed for the agent, invokes runsc (gVisor) as the container runtime instead of runc, and attaches the container to vp-internal — a Docker network with no default internet route. PoC extraction crosses back via docker exec cat, since host-side docker cp can't reach gVisor's tmpfs.
How the LLM / model version is chosen
No model calls — this module never talks to the model API itself, it only prepares the sandbox the agent process will make its own calls from.
Deterministic (non-LLM) work in this module
Entire module — image build, gVisor registration checks, network attachment, and the four verification commands in docs/agent-sandbox.md are all deterministic checks with no model involvement.
Depends on: none (leaf module)
Recon ▸in target source treeout focus_areas (YAML, printed to stdout or consumed by --auto-focus)
package: harness/recon.py (60 LOC)
Proposes an attack-surface partition so parallel find agents don't converge on the same bug.
What actually happens here
Thin driver: builds the recon agent's prompt, calls agent.run_agent(), and parses the returned YAML into focus_areas. Optional — a target's config.yaml can hand-write focus_areas instead.
How the LLM / model version is chosen
Model id comes from --model / VULN_PIPELINE_MODEL, same as every other agent-spawning subcommand; recon.py itself makes no vendor decision.
Deterministic (non-LLM) work in this module
YAML parsing of the agent's proposed partition.
Depends on: agent, config
Find ▸in focus_areas + ASAN imageout crashing input file + found_bugs.jsonl entry
package: harness/find.py (109 LOC) · harness/asan.py (107 LOC)
Drives an isolated agent to a 3-out-of-3 reproducing crash and parses the ASAN signature out of the result.
What actually happens here
run_find() drives one find agent per parallel run, sharing found_bugs.jsonl across concurrent runs so agents can check for duplicates before submitting. asan.py's crash-signature parsing (built on parse_xml_tag(), a 31-edge god node used to pull structured submission blocks out of an agent's tagged response text) turns raw ASAN process output into a comparable signature.
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL, routed through agent.run_agent().
Deterministic (non-LLM) work in this module
ASAN signature parsing and the 3-out-of-3 reproduction check are pure process-output parsing — no model judgment on whether a crash 'counts'.
Depends on: agent, sandbox, config
Grade ▸in crashing input file (PoC bytes only — not the finder's reasoning)out run_NNN/result.json
package: harness/grade.py (109 LOC)
Re-verifies a crash from a fresh, uninfluenced container.
What actually happens here
Spawns a grade agent in a fresh container that receives only the PoC bytes, never the find agent's transcript or reasoning — the design point that makes the verdict meaningful rather than a rubber stamp. AgentResult (30 edges) is the shared result dataclass this module and report.py both populate; CrashArtifact (33 edges, the single most-connected data class in the repo) carries the crash bytes + signature between find, grade, and dedup.
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL.
Deterministic (non-LLM) work in this module
The result.json write is deterministic bookkeeping; the fresh-container isolation itself (not this module, but sandbox.py) is what makes the verdict trustworthy, not any logic inside grade.py.
Depends on: agent, sandbox, artifacts
Judge ▸in a graded crash + reports/manifest.jsonlout accept / replace / skip
package: harness/judge.py (128 LOC)
Serial, no-tools agent deciding whether a passed crash is a new bug, a cleaner duplicate, or a skip.
What actually happens here
Runs only with --stream. Deliberately serial (not parallel like find) so two near-simultaneous duplicate crashes aren't both independently accepted as new. Compares against reports/manifest.jsonl, the running ledger of already-reported unique bugs.
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL; the agent here is explicitly no-tools — it reasons over text only, doesn't read files or run commands.
Deterministic (non-LLM) work in this module
manifest.jsonl read/append is deterministic; the new/replace/skip decision itself is the one genuinely model-driven judgment in this stage.
Depends on: agent, artifacts
Report ▸in PoC + source (report agent) → draft report (grader agent)out reports/bug_NN/report.json
package: harness/report.py (181 LOC)
Writes and scores the exploitability analysis for each unique bug.
What actually happens here
Two-agent pattern within one module: a report agent writes primitive class, reachability, escalation path, and severity from PoC + source only; a separate grader agent then scores the draft, checking claims are backed by evidence (line numbers, observed re-runs) rather than plausible prose. The optional --novelty flag (via novelty.py) adds an upstream fix-status check.
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL for both the report and grader agents.
Deterministic (non-LLM) work in this module
report.json assembly and the grader's score are recorded as structured data, not free text, so downstream tooling (e.g. /triage) can sort by it.
Depends on: agent, artifacts, novelty
Novelty (upstream fix-status) ▸in crashing file's path + target's github_urlout FIXED / UNFIXED annotation on a report
package: harness/novelty.py (95 LOC)
Optional --novelty check: is this bug already fixed upstream?
What actually happens here
Only the orchestrator host clones the target's github_url and injects the upstream git log for the crashing file into the report prompt — the report container's own egress stays restricted to the model API. Off by default so air-gapped or outbound-restricted environments are never affected.
How the LLM / model version is chosen
No model call of its own — it augments the report agent's prompt with git history; the report agent (in report.py) is what actually reasons over it.
Deterministic (non-LLM) work in this module
The git clone + log extraction on the host is fully deterministic.
Depends on: config
Dedup ▸in results/<target>/<ts>/out signature clusters (console summary)
package: harness/dedup.py (87 LOC)
Post-hoc command clustering crashes by ASAN signature — a quick 'N crashes, M signatures' summary.
What actually happens here
dedup() (22 edges) walks a results directory and groups CrashArtifact entries by their ASAN signature. Spawns no agents and takes no --model flag.
How the LLM / model version is chosen
No model calls — the only fully agent-free subcommand in vuln-pipeline besides the sandbox verification checks.
Deterministic (non-LLM) work in this module
Entire module.
Depends on: artifacts
Patch ▸in a unique bug's report.jsonout PATCHES/ diff, verified
package: harness/patch.py (209 LOC) · harness/patch_grade.py (315 LOC)
Drafts a fix per unique bug, then runs a grading loop that tries to disprove the fix before trusting it.
What actually happens here
grade_patch() (30 edges) and run_patch() (21 edges) implement a fix↔grade loop (default cap: 5 iterations, --max-iterations): rebuild, re-run the original PoC (must no longer crash), run the target's test suite, and — unless --no-reattack — launch a fresh find agent against the patched code as a re-attack tier. PatchVerdict (21 edges) is the structured pass/fail record. The optional --style flag runs an advisory T3 style judge on top.
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL for both the fix-drafting agent and the grading agents in the loop.
Deterministic (non-LLM) work in this module
Build success/failure, the PoC-no-longer-crashes check, and test-suite pass/fail are all deterministic gates the loop must clear before a patch is written to PATCHES/ — only the fix itself and the style judge are model output.
Depends on: agent, sandbox, artifacts
Artifacts / Result Layout ▸in every stage's outputout the on-disk results/<target>/<ts>/ tree
package: harness/artifacts.py (192 LOC) · harness/prompts/ (9 files)
Reads/writes the standard result layout every stage and every downstream skill (/triage, /patch) depends on.
What actually happens here
Defines and persists run_NNN/result.json, found_bugs.jsonl, and reports/manifest.jsonl. harness/prompts/ (9 files, incl. untrusted.py — the <untrusted_data> wrapper used to fence target-derived text in the patch prompt) holds every agent's system + task prompt text; build_find_prompt() (24 edges) is the most-referenced prompt builder.
How the LLM / model version is chosen
No model calls in artifacts.py itself; prompts/ contains the text sent to the model but doesn't choose which model receives it.
Deterministic (non-LLM) work in this module
All file I/O and the JSON/JSONL schema enforcement.
Depends on: none (leaf module)
dnr-pipeline (CLI + images + prompts) ▸in generated log corpus + demo app sourceout INCIDENTS.json, scored result.json
package: dnr_harness/cli.py (518 LOC) · agent_image.py (49 LOC) · prompts.py / system_prompt.py (168 + 45 LOC)
The autonomous mirror of /dnr-hunt and /dnr-respond — same verification-over-vibes shape, applied to logs.
What actually happens here
dnr_harness/cli.py mirrors harness/cli.py's dispatch pattern (only cross-package import edge in the whole repo: dnr_harness → harness, 6 references — confirming this is a thin mirror of vuln-pipeline's orchestration, not an independent fork). agent_image.py builds two distinct images: the hunt container (app source + log corpus, read-only, with the answer key/grader/generator excluded at image-build time) and the grade container (answer key + deterministic scorer, fresh, only the hunt's submission crosses in).
How the LLM / model version is chosen
Model id from --model / VULN_PIPELINE_MODEL, same convention as vuln-pipeline; prompts.py holds the hunt and grade agents' system + task prompts.
Deterministic (non-LLM) work in this module
The grade container's re-fire of every confirmed incident's PoC against a freshly seeded app is deterministic execution, not a model judgment — substring checks can be gamed, execution can't.
Depends on: agent, auth, sandbox
9 · Graph Intelligence
Both Graphify and CodeGraph were installed and run locally against this repo (not
simulated). Full exports: tool-outputs/graphify/,
tool-outputs/codegraph/.
Graphify's god-nodes ranking and CodeGraph's
impact run_agent query agree on the same architectural signal:
harness/agent.py::run_agent() and harness/auth.py::resolve_auth_env()
are the most load-bearing symbols in the repo — every pipeline stage spawns its agent
through the former, authenticated through the latter. See
Defending Code Harness Vault/DCRH/DCRH — Graph Intelligence Findings.md for
the full write-up.