Defending Code Reference Harness (DCRH) — Interactive Module Graph

Click any box to expand its input, output, model routing, and deterministic details.

A lightweight, readable view of the modules — use this instead of the raw Graphify/CodeGraph exports in tool-outputs/, which are accurate but too dense for a human to read directly (91 / 1,352+ nodes).

1 · Entry
CLI (hub) ▸in argv (recon | run | dedup | report | patch subcommands, + all flags)out dispatch into every other moduleclick to expand

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.

Inputargv (recon | run | dedup | report | patch subcommands, + all flags)
Outputdispatch into every other module
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

▼
2 · Orchestration
Agent Runner ▸in a stage's prompt + target model id + container handleout agent transcript (streamed to disk) + final resultclick to expand

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.

Inputa stage's prompt + target model id + container handle
Outputagent transcript (streamed to disk) + final result
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 containerclick to expand

package: harness/auth.py (470 LOC)

Decides which of API key, OAuth token, or Bedrock/Vertex credentials the agent process actually authenticates with.

Inputenvironment (ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN / AWS_* / CLAUDE_CODE_USE_BEDROCK)
Outputa resolved credential + endpoint environment for the agent container
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.)click to expand

package: harness/config.py (73 LOC)

Resolves and validates a target's config.yaml into the structure every other module reads.

Inputtargets/<name>/config.yaml
OutputTargetConfig (focus_areas, known_bugs, github_url, etc.)
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)

▼
3 · Isolation
Sandbox / Container Ops ▸in target Dockerfile + agent image specout running gVisor container, agent_container() handleclick to expand

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.

Inputtarget Dockerfile + agent image spec
Outputrunning gVisor container, agent_container() handle
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)

▼
4 · Detect (S0 loop)
Recon ▸in target source treeout focus_areas (YAML, printed to stdout or consumed by --auto-focus)click to expand

package: harness/recon.py (60 LOC)

Proposes an attack-surface partition so parallel find agents don't converge on the same bug.

Inputtarget source tree
Outputfocus_areas (YAML, printed to stdout or consumed by --auto-focus)
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 entryclick to expand

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.

Inputfocus_areas + ASAN image
Outputcrashing input file + found_bugs.jsonl entry
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.jsonclick to expand

package: harness/grade.py (109 LOC)

Re-verifies a crash from a fresh, uninfluenced container.

Inputcrashing input file (PoC bytes only — not the finder's reasoning)
Outputrun_NNN/result.json
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 / skipclick to expand

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.

Inputa graded crash + reports/manifest.jsonl
Outputaccept / replace / 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.jsonclick to expand

package: harness/report.py (181 LOC)

Writes and scores the exploitability analysis for each unique bug.

InputPoC + source (report agent) → draft report (grader agent)
Outputreports/bug_NN/report.json
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 reportclick to expand

package: harness/novelty.py (95 LOC)

Optional --novelty check: is this bug already fixed upstream?

Inputcrashing file's path + target's github_url
OutputFIXED / UNFIXED annotation on a report
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)click to expand

package: harness/dedup.py (87 LOC)

Post-hoc command clustering crashes by ASAN signature — a quick 'N crashes, M signatures' summary.

Inputresults/<target>/<ts>/
Outputsignature clusters (console 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

▼
5 · Remediate
Patch ▸in a unique bug's report.jsonout PATCHES/ diff, verifiedclick to expand

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.

Inputa unique bug's report.json
OutputPATCHES/ diff, verified
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

▼
6 · Support
Artifacts / Result Layout ▸in every stage's outputout the on-disk results/<target>/<ts>/ treeclick to expand

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.

Inputevery stage's output
Outputthe on-disk results/<target>/<ts>/ tree
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 &lt;untrusted_data&gt; 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)

▼
7 · Detection & Response
dnr-pipeline (CLI + images + prompts) ▸in generated log corpus + demo app sourceout INCIDENTS.json, scored result.jsonclick to expand

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.

Inputgenerated log corpus + demo app source
OutputINCIDENTS.json, scored result.json
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