Part 2 of the Huntress CTF 2026 retrospective: every moving part of the harness that cleared the AI Arena, drawn as flowcharts and explained step by step, from the daily loop down to a single tool call, with links to the code.

This post was written by AI. Claude (Opus 5.5, in Claude Code) drafted it from the harness’s own repository, run logs and the orchestrator’s notes; I directed it, chose what to disclose, and reviewed it. Every constant below was read from the code, not recalled.

The code is public: blackbeard666/huntress-ctf-2026-ai-harness. File names link to it.

This retrospective comes in three parts:

  • Part 1: the story: the event, how we placed, the bet on a harness, the models, every decision and the war stories. Start here if you want to know what happened and why.
  • Part 2: inside the harness: if you want to know how the harness actually works. Every moving part drawn as a flowchart and walked step by step, from the daily loop down to a single tool call, with links to the code. (You are here.)
  • The numbers: if you just want the data. Placement replayed hour by hour, daily clear times, per-lane speed, spend and tokens, as interactive charts with table views.

This part opens the machine. Most sections start with a flowchart and then walk through it box by box, in the chart’s order: what runs, what decides, the thresholds, the file that implements it, and usually the incident that made it that way. Every flowchart also has a table view under it that lists each step with a link to its code.

A reading map, from the outside in:

  1. The whole orchestration: one day of the loop, and the two “orchestrators”
  2. Launch and release and the chain
  3. Six lanes and the solver contract: what is being solved, and the one interface everything shares
  4. A single solve, triage, a worker’s life and the prompts
  5. The reuse race
  6. A timed attempt, when a variant fails and learning the GM’s spelling
  7. The web lane
  8. Overnight, the operator’s toolkit and testing

The words this post leans on:

termmeaning
dropthe daily release of new challenges, 09:00 ET (21:00 in Manila, where this ran)
lanea challenge category: warmups, metadata forensics, script analysis, binary RE, mobile, web; one challenge per lane per day (web: two or three)
modeone of a challenge’s three stages: Single Solve, Time Trial, Mastery
field / answer idone question inside a mode; a mode can ask one field or ten thousand
contractthe GM’s JSON list of fields for one attempt, with each field’s expected format
varianta freshly generated copy of a challenge: new bytes, new answers, same concept
seta Mastery attempt is a bundle of independent sets, each with its own artifacts and fields
GMthe Game Master: the organizers’ API that hands out attempts and judges answers
Homebasea small VM (2 vCPU) the organizers gave each team inside the CTF network, on 60 credits a day shared between VM time and its built-in AI
arenathe organizers’ web console endpoints that start, stop or reset a live web target
chainthe harness’s pipeline for one challenge: its three modes, in order
workerone headless Claude Code process (claude -p) doing one job
generalizea worker editing a solver so a failed variant passes; kept only if nothing that passed before breaks
duelextra workers racing the main one on the same job; the first verified result wins
ratchet / prebuildthe overnight merge of the day’s proven facts into the shared library / speculative library-building for variants not seen yet

From around day 15 the GM served Time Trial and Mastery without a countdown unless asked. Several repair paths below work on a still-open attempt for that reason.

The whole orchestration

The whole orchestration, one day

The whole orchestration, one dayWarm-up and preflight, arming the launch, polling for the release, one chain per challenge, the operator's monitoring loop, the GM-solved gate, then the post-run, post-mortem, fixes and rehearsal.noyesyesnoyesnoyeswarm-up: the operator session (Claude Code) starts the daywarm-upthe operator session(Claude Code) starts the daypreflight green?: ~78 checks in 11 sections, incl. the fault-replay suitepreflight green?~78 checks in 11 sections, incl.the fault-replay suitefix the cause: e.g. --fix kills a duplicate VPN client; then preflight againfix the causee.g. --fix kills a duplicate VPNclient; then preflight againarm the launch: bin/day.sh N --wait: hctf run as a systemd unit with a memory caparm the launchbin/day.sh N --wait: hctf run as asystemd unit with a memory capis today listed?: ask the GM every 0.3 s; no → ask againis today listed?ask the GM every 0.3 s;no → ask againone chain per challenge: threads; LLM workers share five slots (--local 5)one chain per challengethreads; LLM workers share fiveslots (--local 5)chains run in parallel: single → Time Trial → Mastery, each as soon as it canchains run in parallelsingle → Time Trial → Mastery,each as soon as it canoperator reads the feed: one line per milestone + a heartbeat (hctf feed)operator reads the feedone line per milestone + aheartbeat (hctf feed)every mode GM-CORRECT?: checked against the GM, not local state (reconcile)every mode GM-CORRECT?checked against the GM, notlocal state (reconcile)a chain in trouble?: blocked, HELP.md, !!! alert, no progressa chain in trouble?blocked, HELP.md, !!! alert,no progressoperator steps in: arena reset, relaunch, a fix, or answer a HELPoperator steps inarena reset, relaunch, a fix,or answer a HELPpost-run: ratchet, speed-harden, train, prebuild, coveragepost-runratchet, speed-harden, train,prebuild, coveragepost-mortem: hctf timeline + KPI row + the slowest chains' logspost-mortemhctf timeline + KPI row +the slowest chains' logsfixes, each with a test: parallel agents on disjoint files; new fault scenariosfixes, each with a testparallel agents on disjointfiles; new fault scenariosrehearsal → next warm-up: replay a solved day on the fake GM, compare per moderehearsal → next warm-upreplay a solved day on thefake GM, compare per mode
One loop per day. Red: where reasoning happens (the operator session, its agents, the workers). Green: the platform.
steps and code
stepwhat happenscode
warm-upA long-running Claude Code session that I talk to; it never solves a challenge.bin/preflight.sh
preflight green?A red check or a red fault suite is a FAIL.bin/preflight.sh, tests/test_fault_replay.py
fix the causeThe operator fixes what failed and re-runs the checks.bin/preflight.sh
arm the launchArmed before the drop; after this nothing is re-checked.bin/day.sh
is today listed?wait_for_release; release lag ended up 1-3 s.hctf/orchestrate.py
one chain per challengeA process governor caps background solvers so a fan-out can't starve the machine.hctf/orchestrate.py
chains run in parallelEach chain is the single-solve, timed and failure flowcharts below.hctf/orchestrate.py
operator reads the feedSolved k/N, blocked, generalize, duel, hint, !!! alerts.hctf/feed.py
every mode GM-CORRECT?The post-run is held until the GM confirms the whole board.hctf/driftwatch.py
a chain in trouble?hctf why says WORKING, BLOCKED or DONE for each chain.hctf/cli.py
post-runResumable phases, each behind a test gate (post-run flowchart below).hctf/postrun.py
operator steps inOnly on a hard stop.hctf/cli.py
post-mortemThe operator writes a numbered fix plan; I approve, reject or reorder.hctf/timeline.py, hctf/kpi.py
fixes, each with a testEvery new failure mode becomes a scenario the next preflight runs.tests/test_fault_replay.py
rehearsal → next warm-upCritical-path changes are replayed before the next drop.hctf/replay_gm.py

There are two things that could be called “the orchestrator”, and they do very different jobs:

  • The operator is a long-running Claude Code session that I talk to. It never solves a challenge. It runs the warm-up checks, arms the launch, watches the run, steps in when a chain needs help, reads the logs afterwards, writes the post-mortem, implements the fixes (often by spawning parallel agents), and keeps notes that the next session reads first. It is the only part of the system that changes the system.
  • The harness (hctf run) is plain Python with no model inside it. It detects the drop, starts one chain per challenge, launches workers into a fixed number of slots, runs the races, routes every GM call, records every attempt and decides every retry. All the reasoning that happens during a run happens inside a worker it launched.

Walking the chart from the top:

  1. Warm-up. Before each drop the operator runs bin/preflight.sh: about 78 checks in 11 sections. They cover a duplicate VPN client (--fix kills it), clock skew over 3 s, free memory, the Claude login and token expiry, every lane tool working inside the worker sandbox, Homebase’s toolchain and credits, no other harness busy on the host, solver directories missing solve.py, warmups codec coverage for every earlier day, and the fault-replay test suite.
  2. Preflight green? A red check or a red suite is a FAIL. Fix the cause, then run it again.
  3. Arm the launch with bin/day.sh N --wait (launch and release has the details). From here on nothing is re-checked: the drop is for launching only. On day 24 a preflight re-run after the drop cost a 16-minute late start.
  4. Is today listed? The harness asks the GM every 0.3 s and keeps asking until it is.
  5. One chain per challenge, each a thread.
  6. Chains run in parallel: single → Time Trial → Mastery, each mode starting the moment the previous one is CORRECT. Most of this post is the inside of this box.
  7. The operator reads the feed: one line per milestone and a heartbeat (the operator’s toolkit lists every event).
  8. Every mode GM-CORRECT? Asked of the GM, not of local state, because the local view can under-report; hctf reconcile rewrites local state from the GM’s answers. If yes, go to the post-run.
  9. A chain in trouble? A worker’s HELP.md, a !!! alert, or no progress. If not, keep watching.
  10. Operator steps in: an arena reset for a stuck web target, a relaunch, a code fix, or an answer to a HELP. The chains carry on.
  11. Post-run, once the whole board is GM-solved: freed capacity goes to stragglers before any learning starts (overnight).
  12. Post-mortem. The operator reads hctf timeline (per chain: when each mode finished, attempts, generalize cycles, model time vs harness overhead), the KPI row and the slowest chains’ logs, and writes a numbered fix plan; reference/D28_POSTMORTEM.md is a typical one. I approve, reject or reorder.
  13. Fixes, each with a test. Big plans go to several agents in parallel, one track each on files that don’t overlap. Every new failure mode becomes a scenario in the fault-replay suite, so the next preflight runs it.
  14. Rehearsal → next warm-up. Critical-path changes are replayed against an already-solved day on the fake GM and compared mode by mode before the next drop.

Where the state lives

There is no database and no service besides hctf run itself. Everything is files, which is what made it possible to replay, diff and audit any day after the fact:

  • Per challenge, challenges/dayNN/<lane>-<slug>/: chain.json (the chain’s state), and per mode the GM’s contract.json, log.jsonl, submissions.jsonl, the worker’s inbox.jsonl, triage.md and the worker logs. Next to them, solver/ holds solve.py, NOTES.md and cases/.
  • Shared knowledge: lib/ (lane code, playbook.py, knowledge.py, vocab.json) and one technique log per lane in reference/techniques/.
  • Per run: the day log the feed follows, the cost ledger (.run/metrics.tsv) and the post-run’s phase record.
  • The operator’s notes, outside the repository.

So knowledge flows one way each day: a worker’s NOTES.md and regression cases → the ratchet → lib/ and the technique logs → the next day’s prompts (label grammar, helper index, technique log) and the next day’s race.

Launch and release

The first second of a drop decides a lot, so the launch path is small and boring on purpose.

  • One harness per host. hctf/hostguard.py refuses to run a second busy copy of the harness on the same machine. A shared host once invalidated a rehearsal: an overnight build in one copy changed timings in another.
  • The launcher. bin/day.sh skips preflight if a pass from the last 6 hours is stamped, warms the Homebase SSH connection in the background, and starts hctf run --day N --local 5 --wait-release as a systemd user unit with a memory cap. Day 16’s out-of-memory crash, which took the whole WSL VM down, is why there is a cap. It always takes the day number explicitly: a stale default once pointed it two days back.
  • Release detection. wait_for_release polls the GM’s status every 0.3 s and starts each lane’s chain the moment that lane is listed, rather than waiting for the whole day. By the end, chains started 1-3 s after the release.
  • Slots. LLM workers share five slots (--local 5), a bounded semaphore across all chains, so twenty-one chains don’t mean twenty-one simultaneous claude processes. Background solver runs go through a process governor (hctf/procgov.py) that caps them at four, nices them, and raises their out-of-memory score so the kernel kills them before anything important.

The chain

The chain state machine

The chain state machineTop row: queued, single, time_trial, mastery, done. Below: crash-retry under queued, help or blocked under single, and a shared generalizing state that both timed modes drop into when a variant fails and return from once the edit is accepted or restored.crashretry oncevariant failsaccepted / restoredstuckqueuedcreated when it listssinglefetch · race · solvetime_trialrunning · retryingmasteryre-pass TT if neededdoneGM CORRECT on all 3crash-retrysolved modes kepthelp / blockedHELP.md for a humangeneralizingtransactional edit · duel · live answer
Every chain writes its stage to chain.json atomically; the feed, dashboard and hctf why all read it.
all stages
stagemeaning
queuedchain created the moment its lane lists
single:fetch / reuse-won / solvingdownload ∥ warm worker; the reuse race can finish it alone
single:help / blockedworker wrote HELP.md, or launches ran out
<mode>:running / retrying / continuingtimed runner: start → download → solve.py → submit
<mode>:generalizing / fixingvariant captured as a case; worker edits the solver; kept only if nothing regresses
<mode>:untimed / rate-limited / start-refusedpool exhausted or GM pushback: fall back, wait, resume the same attempt
doneall three modes GM-CORRECT
crash-retry / crashedexception: one retry that skips solved modes

A chain’s state is one JSON file, chain.json, written atomically (a temporary file plus os.replace) every time the stage changes. The feed, the dashboard and hctf why all read it. The chart’s boxes, in order:

  1. queued: the chain exists the moment its lane is listed.
  2. single: single:fetch while the attempt starts and the bytes download, then single:reuse-won if the reuse race answered everything, or single:solving while a worker works (a single solve).
  3. help / blocked: single:help when a worker wrote HELP.md, single:blocked when its launches ran out.
  4. time_trial: time_trial:running and the retry states below (a timed attempt).
  5. generalizing: shared by both timed modes, entered when a variant fails and left when the edit is accepted or restored (when a variant fails).
  6. mastery: like the Time Trial. The GM checks a prerequisite: the latest Time Trial attempt must be a pass. If a later Time Trial attempt was opened (for example to learn label spellings), the chain re-passes the Time Trial before Mastery.
  7. done: all three modes are GM-CORRECT.
  8. crash-retry: an exception gets one retry after 10 s, skipping modes already solved; a second one is crashed.

The timed retry states, for completeness: retrying (a new attempt), continuing (resuming the same attempt), rate-limited and start-refused (the GM pushed back; wait and retry without spending an attempt), untimed (the fallback described later), exhausted (no attempts left at all), and blocked. Web adds web-slot while it waits for a target slot. fixing is a legacy state from the early days, when a worker patched the solver inside a live clock (fix.md); by the end it was no longer used.

Six lanes, six solver shapes

lanewhat arriveswhat’s askedtoolsa typical solve.py
warmupsa one-line encoded blob; Mastery day N has 5N−2 sets of N lines, line k in day k’s codecone word-word-word-NN sluglib.decode (layered BFS decoder), lib.ciphers, a codec registry per day382 lines: a few private decoders feeding answer() → fallback(); 38 cases
metadata forensicsevidence.zip members of every file format“<format>.<field> for X”; timed modes add earlier days’ fieldsexiftool, lib.meta registry (25k format-field keys)257 lines: a cached zip index, then one dispatch into the registry
script analysiszips of PowerShell, JS, VBS, batch, Python and bash droppersup to 399 fields: decoded values, scenario enums, ATT&CK ids, style labelsnode vm sandbox, lib.codec, sink replacement454 lines: per-language planners that decode into a step graph, then read fields off it
binary REAES-zipped ELF, PE, .NET, JAR and Mach-O setshundreds of fields: hashes, symbols, config keys, format labelsreadelf, rizin, Ghidra headless, pyelftools, capstone, lib.binary985 lines: fast AES-zip → per-format facts → answer(), one forked process per set
mobilean APK, sometimes with a live backendone ANS- + 16 hex answerjadx, apktool, androguard, lib.android152 lines early; 361 by day 29, with native JNI evaluation
webno artifact: a live target the GM provisions“recover the proof from target N”lib.web dispatcher and pluginsa 19-line stub that calls lib.web.main()

Web is the odd one out: no artifact, a live target, and a library of exploit plugins keyed on what the target exposes. It has its own section.

The solver contract

Everything after the single solve rests on one interface. Every challenge’s solve.py takes --contract <json> --artifacts <dir> and prints {answer_id: value} as JSON on its last line. It is seeded from a 107-line skeleton (hctf/templates/solve_skeleton.py) with three rules baked in: one bad field never sinks the others, a cheap generic fallback() gets a second try at fields the direct parse misses, and a run that hits its deadline prints what it has instead of being killed with nothing:

def _solve_pairs(job):
    root, contract, pairs = job
    out = {}
    for aid, q in pairs:
        data = artifact_bytes(root, contract, q.get("artifact") or "")
        try:
            v = answer(aid, q, data, contract)
        except Exception as e:  # one bad field must not sink the other answers
            print(f"{aid}: {e!r}", file=sys.stderr)
            v = None
        if v is None and not _past_deadline():  # never let a fallback eat the kill margin
            v = fallback(aid, q, data, contract)
        if v is not None:
            out[aid] = normalize(v, q)
    return out

main() arms a deadline watchdog (lib/solverrt.py), runs each Mastery set in its own forked process, and prints once. Solvers may use only the standard library, lib, and a short list of pure-Python parsers (pyzipper, pyelftools, pefile, capstone, pycryptodome, androguard): no subprocess to 7z or jadx, and every Mastery set well under a second.

Next to the solver live its regression cases: solver/cases/<case>/{contract.json, expected.json, artifacts/}. The expected answers only ever come from the GM. By the end there were 3,293 cases, two-thirds of them captured automatically from timed attempts and most of the rest from failed variants.

Where the 3,293 regression cases came from
case kindcountwhere it comes from
auto2,113every timed attempt, holding only the answers the GM verified on it
variant486every failed timed variant, with the GM’s per-field verdicts
compound233Mastery questions that mix earlier days’ concepts
single184the single solve itself
mastery / time trial110 / 74a passed timed mode, recorded at the chain level (also when a live answer, not the solver, passed it)
older day-prefixed67early variant captures, before the naming settled
synthetic / mutation23 / 3probes that mutated a known case before the GM did

A single solve

A single solve, from release to handoff

A single solve, from release to handoffDownload, warm worker and reuse race start together; a full race win skips the worker; otherwise triage, GO, solve and submit, with a watcher that stops the worker at CORRECT.∥∥noyes∥yesnoretrychallenge listed: the chain enters single:fetchchallenge listedthe chain enters single:fetchstart + download: GM attempt, contract, artifacts; tools named in the text installstart + downloadGM attempt, contract, artifacts;tools named in the text installwarm worker: claude -p reads the static prompt and replies READYwarm workerclaude -p reads the staticprompt and replies READYreuse race: yesterday's solvers on today's bytes (flowchart below)reuse raceyesterday's solvers on today'sbytes (flowchart below)triage, no LLM: toolchain, contract shape, similar past solvestriage, no LLMtoolchain, contract shape,similar past solvesrace answered every field?: and its seed solver reproduces them allrace answered every field?and its seed solver reproducesthem allGO: triage + contracts: the second message to the warm workerGOtriage + contracts: the secondmessage to the warm workersnapshot, stop the worker: verified copy pushed to Homebasesnapshot, stop the workerverified copy pushed to Homebaseworker solves: CLI tools; writes solver/solve.pyworker solvesCLI tools; writes solver/solve.pyanswer-first worker: medium effort, only the fields still open; ≤3 shardsanswer-first workermedium effort, only the fieldsstill open; ≤3 shardsTime Trial: timed flowchart belowTime Trialtimed flowchart belowhctf submit --from-solver: runs solve.py, submits, bisects a bulk 'wrong'hctf submit --from-solverruns solve.py, submits, bisectsa bulk 'wrong'GM CORRECT?: + solver passes its cases (watcher, every 0.25 s)GM CORRECT?+ solver passes its cases(watcher, every 0.25 s)relaunch, or HELP.md: ≤3 launches; the stop hook refuses ≤10 timesrelaunch, or HELP.md≤3 launches; the stop hookrefuses ≤10 times
Red: model work. Green: the GM. The answer-first worker races the main worker; whichever gets CORRECT first wins.
steps and code
stepwhat happenscode
challenge listedthe chain enters single:fetchhctf/orchestrate.py
start + downloadGM attempt, contract, artifacts; tools named in the text installhctf/timed.py, hctf/toolchain.py
warm workerLaunched before the bytes land.hctf/workers.py
reuse raceyesterday's solvers on today's bytes (flowchart below)hctf/solvers.py
triage, no LLMWrites triage.md (flowchart below).hctf/triage.py
race answered every field?A full win hands off without ever sending the worker its task.hctf/orchestrate.py
GOSent at the download mark.hctf/orchestrate.py
snapshot, stop the worker60% of worker time used to be spent after CORRECT.hctf/orchestrate.py
worker solvesInside the sandbox, steered by hooks (worker flowchart below).hctf/prompts/single.md
answer-first workerPosts every value it confirms to the main worker's inbox.hctf/prompts/answer_first.md
Time Trialtimed flowchart belowhctf/timed.py
hctf submit --from-solverIn the same shell call that writes the solver.hctf/cli.py
GM CORRECT?+ solver passes its cases (watcher, every 0.25 s)hctf/orchestrate.py
relaunch, or HELP.mdStopping without CORRECT needs HELP.md; the chain becomes single:help..claude/hooks/stop_gate.py

The single solve is where the model does most of its work, so the harness spends its effort making sure the model starts early, starts informed, and stops the instant it is done.

  1. Challenge listed. The chain enters single:fetch.
  2. Start + download, warm worker and reuse race start together. The GM attempt starts and the artifacts download, and toolchains named in the challenge’s text begin installing. A warm worker launches and reads the static part of its prompt (the prompts explains the two-message handshake). The reuse race begins on whatever bytes are already here.
  3. Triage runs as soon as the bytes land, with no model (triage).
  4. Did the race answer every field? In parallel with triage: if the merged answers of yesterday’s solvers are all confirmed by the GM, and the race’s seed solver (the one that reproduces the most of them) reproduces every one, the worker is never sent its task: go straight to the snapshot. This is how most mobile and warmups singles finished in 15-45 s from day 12 on. If not, the worker gets its task.
  5. GO. At the download mark, the warm worker gets its second message: the triage, the timed contracts, the race’s notes. If triage is still running, its result follows through the inbox.
  6. Worker solves. Inside its sandbox, using command-line tools, it writes solver/solve.py (a worker’s life).
  7. Answer-first, in parallel. If the race left only a few fields open (up to 80), a second, medium-effort worker answers just those straight from the bytes, split into up to three shards when there are more than 12. Every value it gets confirmed is posted to the main worker’s inbox so it never recomputes them. It also needs free memory (2 GB plus 0.3 GB per running worker beyond two) and a free slot. Whichever worker gets the single to CORRECT first wins.
  8. Submit from the solver. hctf submit --from-solver runs solve.py, submits every value, and if the bulk is judged wrong, bisects down to the fields that are actually wrong. The prompt insists this happens in the same shell call that writes the solver: a separate “run it first” turn costs about 5 s.
  9. GM CORRECT, and the solver passes its regression cases? A watcher checks every 0.25 s.
  10. Snapshot, stop the worker. On yes, the watcher copies a verified solver, pushes it to Homebase, and stops the worker. A day-6 review found that 60% of worker time had been spent after the answer was already CORRECT.
  11. Relaunch, or HELP.md. On no, a worker that tries to stop is refused by the stop hook; a single gets up to three launches, and a relaunch reads the previous launch’s notes. The way out is HELP.md, which turns the chain to single:help for the operator.
  12. Time Trial starts from the verified snapshot.

Two background jobs also run during a single. A dry run of the newest prior solver on today’s contract spots answer ids it has never seen (up to six background runs, at most 12 s each). Those new id shapes are the ones most likely to fail a Time Trial, so the watcher holds the handoff up to 45 s to check them. A prefetch of the timed contracts gets the Time Trial’s question list early, so the worker writes solve.py for the Time Trial’s shape and not only the single’s.

Triage

Triage: from bytes to triage.md, with no LLM

Triage: from bytes to triage.md, with no LLMTool prefetch, contract-shape check, header and artifact description, then reconnaissance and the toolchain check in parallel, written within seconds with placeholders if needed.∥yesnoprefetch tools: from the challenge's name and descriptionprefetch toolsfrom the challenge's nameand descriptioncontract-shape guard: a template contract is flagged loudlycontract-shape guarda template contract isflagged loudlyheader + formats: STATUS n/N; >60 fields → a family tableheader + formatsSTATUS n/N; >60 fields →a family tabledescribe each artifact: type, size, membersdescribe each artifacttype, size, membersreconnaissance: extract and decode (in background when a prior solver covers most)reconnaissanceextract and decode (in backgroundwhen a prior solver covers most)toolchain check: detect from the bytes; install a missing tool in backgroundtoolchain checkdetect from the bytes; install amissing tool in backgroundready within 1 s / 5 s?: toolchain / reconnaissanceready within 1 s / 5 s?toolchain / reconnaissancewrite with placeholders: rewritten when done (dropped if already solved)write with placeholdersrewritten when done (droppedif already solved)triage.md written: + top 3 similar past solves (TF-IDF ≥ 0.12)triage.md written+ top 3 similar past solves(TF-IDF ≥ 0.12)
The worker can start before triage finishes; `hctf tool-wait` blocks on a tool still installing (≤600 s).
steps and code
stepwhat happenscode
prefetch toolsfrom the challenge's name and descriptionhctf/toolchain.py
contract-shape guardanswer_ids are the authority.hctf/contract.py
header + formatsSTATUS n/N; >60 fields → a family tablehctf/triage.py
describe each artifacttype, size, membershctf/triage.py
reconnaissanceextract and decode (in background when a prior solver covers most)hctf/triage.py
toolchain checkPer tool: present, installing (≤900 s), or a logged gap.hctf/toolchain.py
ready within 1 s / 5 s?toolchain / reconnaissancehctf/triage.py
write with placeholdersrewritten when done (dropped if already solved)hctf/triage.py
triage.md written+ top 3 similar past solves (TF-IDF ≥ 0.12)hctf/triage.py, hctf/retrieval.py

Triage is the harness’s own reconnaissance, done in code before the model spends a single turn. Its output, triage.md, is inlined into the worker’s prompt.

  1. Prefetch tools. The challenge’s name and description are scanned for toolchain hints (Swift, Go, .NET, Flutter, AutoIt and so on), and installs start before the download finishes.
  2. Contract-shape guard. The contract’s answer_ids are the authority. A “template” contract, a cross-product of names and properties the GM didn’t actually ask, is flagged loudly (hctf/contract.py).
  3. Header and formats. The prompt, the GM’s guidance, a status line (how many fields are already confirmed and which remain) and each field’s expected format; over 60 fields, a table by field family instead.
  4. Describe each artifact: type, size, members.
  5. Reconnaissance extracts and decodes. It moves to the background when a prior solver already covers most fields, because then the worker mostly needs the leftovers.
  6. Toolchain check, in parallel: detect what built each artifact from the bytes (cached by content hash). For each tool it is present, installing in the background (up to 900 s, file-locked so two chains don’t install it twice), or missing with no recipe, which is logged as a gap for the post-run report.
  7. Ready within 1 s / 5 s? Triage waits at most a second for the toolchain section and five for reconnaissance.
  8. Write with placeholders if not: “still running” markers, rewritten in the background when the slow parts finish (and dropped if the single is already CORRECT).
  9. triage.md written, plus retrieval: the top three similar past solves, by TF-IDF cosine similarity of at least 0.12 (same-lane solves weigh 1.2×), are added to the prompt.

A worker that needs a tool still installing runs hctf tool-wait <tool>, which blocks for up to 600 s.

A worker’s life

A worker's life

A worker's lifeSlot, usage-limit gate, sandboxed launch, READY and GO, the hook-wrapped tool loop, the stop gate, and how each kind of exit is handled.yesnoyesnodonenextnoyesauthtransienttake a worker slot: 5 local slots; urgent and warm workers skip the queuetake a worker slot5 local slots; urgent and warmworkers skip the queueusage limit hit?: one gate for the whole accountusage limit hit?one gate for the whole accountwait for the reset: ≤6 h + 60 s; the stage deadline is extended by the waitwait for the reset≤6 h + 60 s; the stage deadlineis extended by the waitlaunch in bwrap: claude -p, Opus 5.5 high, turn cap by rolelaunch in bwrapclaude -p, Opus 5.5 high,turn cap by rolemessage 1 → READY → GO: static prompt first; GO with triage at the download markmessage 1 → READY → GOstatic prompt first; GO withtriage at the download markblocking command?: PreToolUse hook: pager, REPL, tail -f, listenerblocking command?PreToolUse hook: pager, REPL,tail -f, listenerrefused with a reason: the model rewrites it with a timeoutrefused with a reasonthe model rewrites it witha timeoutrun the tool call: Bash (25 s default timeout), Read, Write, Edit, Skill, Taskrun the tool callBash (25 s default timeout),Read, Write, Edit, Skill, Taskinbox → HARNESS UPDATE: PostToolUse hook; nudges at 10 and 30 minutesinbox → HARNESS UPDATEPostToolUse hook; nudges at10 and 30 minutesstopped at CORRECT: the watcher kills the worker (the usual ending)stopped at CORRECTthe watcher kills the worker(the usual ending)may it stop?: Stop hook: CORRECT + cases pass, or HELP.md writtenmay it stop?Stop hook: CORRECT + casespass, or HELP.md writtenblocked (≤10 times): told what is missing; keeps workingblocked (≤10 times)told what is missing;keeps workinghow did it exit?: ok · max_turns · auth · limit · transient · errorhow did it exit?ok · max_turns · auth · limit ·transient · errorauth → !!! alert: chain help: claude auth loginauth → !!! alertchain help: claude auth logintransient → relaunch: ≤3×: 20 / 60 / 180 s, fresh session, back to the gatetransient → relaunch≤3×: 20 / 60 / 180 s, freshsession, back to the gate
Three Claude Code hooks wrap every tool call and the stop. Red: model work. Green: the GM's verdict ends it.
steps and code
stepwhat happenscode
take a worker slot5 local slots; urgent and warm workers skip the queuehctf/orchestrate.py
usage limit hit?one gate for the whole accounthctf/workers.py
wait for the resetOne !!! alert, then a quiet wait.hctf/workers.py
launch in bwrapOther projects, transcripts, secrets and the Windows drive are masked.hctf/workers.py
message 1 → READY → GOstatic prompt first; GO with triage at the download markhctf/workers.py
blocking command?PreToolUse hook: pager, REPL, tail -f, listener.claude/hooks/no_block.py
refused with a reasonthe model rewrites it with a timeout.claude/hooks/no_block.py
run the tool callBash (25 s default timeout), Read, Write, Edit, Skill, Taskhctf/workers.py
inbox → HARNESS UPDATEThe only way to reach a worker mid-run..claude/hooks/nudge.py, hctf/inbox.py
stopped at CORRECTthe watcher kills the worker (the usual ending)hctf/orchestrate.py
may it stop?Stop hook: CORRECT + cases pass, or HELP.md written.claude/hooks/stop_gate.py
blocked (≤10 times)told what is missing; keeps working.claude/hooks/stop_gate.py
how did it exit?ok · max_turns · auth · limit · transient · errorhctf/workers.py
auth → !!! alertchain help: claude auth loginhctf/workers.py
transient → relaunchNeeds ≥90 s of stage time left.hctf/workers.py
  1. Take a worker slot. Five local slots shared by every chain; urgent and warm workers skip the queue.

  2. Usage limit hit? The subscription’s limits are account-wide, so the harness keeps one gate for every worker.

  3. Wait for the reset. When a worker exits on a limit with a parseable reset time within six hours, the gate closes until the reset plus 60 s, a single !!! alert goes out, and every waiting stage’s deadline is extended by the time waited. (Before day 30 a dated reset message didn’t parse, the alert never fired, and day 30’s drop was missed.)

  4. Launch in bwrap with the role’s turn cap (the command and the sandbox are below).

  5. Message 1 → READY → GO: the static prompt first, the challenge-specific parts once the worker has answered READY (the prompts).

  6. Blocking command? Before every shell command, a PreToolUse hook (no_block.py) refuses pagers, REPLs, tail -f and listeners unless they are wrapped in timeout. One hung shell call can eat a whole timed window.

  7. Refused with a reason: the model rewrites the command with a timeout.

  8. Run the tool call. Bash calls default to a 25 s timeout.

  9. Inbox → HARNESS UPDATE. After every tool call, a PostToolUse hook (nudge.py) delivers any unread messages: the race’s confirmed fields, values the GM rejected, the coordinator’s hint. At 10 and 30 minutes without a solve, it also tells the worker to split into two or three subagents on genuinely different directions. Then the next tool call goes through the same loop. The whole hook is short enough to show:

    for m in inbox.unread(os.environ["HCTF_CHAL_DIR"], os.environ.get("HCTF_WORKER_START", "0")):
        msgs.append("HARNESS UPDATE (GM facts, authoritative): " + m.get("text", ""))
    ...
    if msgs:
        print(json.dumps({"hookSpecificOutput": {"hookEventName": "PostToolUse",
                                                 "additionalContext": "\n\n".join(msgs)}}))
    
  10. Stopped at CORRECT. If the GM has meanwhile said CORRECT, the watcher stops the worker. This is the usual ending.

  11. May it stop? When the worker itself tries to end its run, a Stop hook (stop_gate.py) allows it only when the single is CORRECT and the solver passes its regression cases (and has no unsafe cache, see testing), or HELP.md exists.

  12. Blocked (≤10 times). Otherwise it is told what is missing and keeps working. After ten refusals the hook lets go, so a stuck worker escalates instead of grinding.

  13. How did it exit? ok, max_turns, auth, limit, transient, error or no_result.

  14. Auth → !!! alert. A login failure stops the chain loudly, with the instruction to log in again; nothing retries silently.

  15. Transient → relaunch. A transient API error relaunches with a fresh session up to three times, after 20, 60 and 180 s, as long as at least 90 s of the stage’s time remains. Everything else is returned to the chain, which decides.

The launch and the sandbox

Every worker is one headless Claude Code process. The launch looks like this (trimmed):

bwrap --dev-bind / / --tmpfs <other projects> --tmpfs ~/.claude/projects --tmpfs /mnt/c \
      --ro-bind /dev/null <each masked file> --die-with-parent -- \
  claude -p --model claude-opus-5-5 --effort high --max-turns 80 \
     --output-format stream-json --input-format stream-json --verbose \
     --strict-mcp-config --tools Bash,Read,Write,Edit,Skill,Task \
     --settings '{"autoMemoryEnabled":false,"bashEditDiffEnabled":false}' \
     --dangerously-skip-permissions

A few things in that line were decisions. No MCP servers (--strict-mcp-config): every tool is a command-line program the worker calls from Bash, so several steps compose into one shell call. A turn cap per role (single 80, generalize 50, live answer 60, prebuild 40, the overnight library merge 110), so a stuck agent can’t grind on forever. Skipping permission prompts is only safe because the sandbox is the boundary: bwrap hides every other project, every other transcript and the Windows drive. Directories are masked with an empty tmpfs, single files with /dev/null bound over them:

def sandboxed(cmd, stage=None, extra_binds=()):
    hidden = sandbox_hidden_paths(stage)
    # directories -> empty tmpfs; FILES -> /dev/null bound over them
    masks = [a for p in hidden for a in (("--tmpfs", str(p)) if Path(p).is_dir()
                                         else ("--ro-bind", "/dev/null", str(p)))]
    ...
    return ["bwrap", "--dev-bind", "/", "/", *masks, *binds, "--die-with-parent", "--", *cmd]

A rehearsal early on showed why: a worker ran find / -name solve.py and copied a solver it was never meant to see. Prompt rules didn’t stop that. Only the sandbox did. Workers that write library code overnight get a narrower box still: no GM token, no secrets, and only their listed paths writable.

The prompts

How a prompt is assembled and delivered

How a prompt is assembled and deliveredA template per role, filled with lane-specific slots, rendered into a static first message and a second GO message; during the run the inbox hook is the only channel.READYtemplate for the role: single, generalize, live, answer- first, codify, ratchet…template for the rolesingle, generalize, live, answer-first, codify, ratchet…persona + lane skill: the skill inlined so no turn is spent loading itpersona + lane skillthe skill inlined so no turnis spent loading ithelper index + label grammar: helpers from lib/ via Python's ast; lib/playbook.pyhelper index + label grammarhelpers from lib/ via Python'sast; lib/playbook.pytechnique log + rules: capped excerpts; rules with their incidents; a budgettechnique log + rulescapped excerpts; rules withtheir incidents; a budgetrender: str.replace of {slot}; over 100 KB → stdinrenderstr.replace of {slot};over 100 KB → stdinmessage 1: the static prompt + 'reply with exactly READY'message 1the static prompt +'reply with exactly READY'triage + contracts: triage ≤6,000 chars; prior solver; timed contractstriage + contractstriage ≤6,000 chars; priorsolver; timed contractsmessage 2: GO: sent after READY, at the download markmessage 2: GOsent after READY, at thedownload markcoordinator (stalled only): Sonnet 5.5, one turn, no tools: NONE or one hintcoordinator (stalled only)Sonnet 5.5, one turn, no tools:NONE or one hintinbox during the run: race results, rejected values, hints: after every tool callinbox during the runrace results, rejected values,hints: after every tool call
Static parts first and per-challenge parts last is also what makes prompt caching work.
steps and code
stepwhat happenscode
template for the role15 Markdown templates with {slot} placeholders.hctf/prompts/single.md
persona + lane skillthe skill inlined so no turn is spent loading ithctf/workers.py, skills/huntress-ctf/SKILL.md
helper index + label grammarhelpers from lib/ via Python's ast; lib/playbook.pyhctf/workers.py, lib/playbook.py
technique log + rulesThe 60 s / 3 min budget and the subagent policy.hctf/orchestrate.py
renderstr.replace of {slot}; over 100 KB → stdinhctf/workers.py
message 1Sent at launch, before the bytes have landed.hctf/workers.py
message 2: GOsent after READY, at the download markhctf/orchestrate.py
triage + contractstriage ≤6,000 chars; prior solver; timed contractshctf/orchestrate.py
inbox during the runrace results, rejected values, hints: after every tool callhctf/inbox.py, .claude/hooks/nudge.py
coordinator (stalled only)9 reviews and 3 hints all month.hctf/coordinator.py

A worker’s prompt is assembled from a template and slots the harness fills at launch. Following the chart:

  1. Template for the role. Fifteen plain Markdown templates with {slot} placeholders, one per job:
templatelinesthe worker’s job
single.md158solve the Single Solve and leave a reusable solve.py
generalize.md90a timed variant failed: fix the solver offline without breaking any earlier case
answer_first.md32beside the single worker: answer the still-open fields straight from the bytes, nothing else
live.md26answer the unresolved fields of a still-open timed attempt by hand while the solver is being fixed
fix.md14“URGENT”: patch the solver inside a live clock (unchanged since day 1)
codify.md42web: turn a winning exploit into a reusable plugin
ratchet.md, ratchet_log.md48, 39overnight: merge the day’s proven facts into the library; write the lane’s technique log
prebuild.md + six lane briefs45 + 12-47overnight: speculatively build decoders for variants we haven’t seen yet

fix.md was the early in-window patcher; once the timed modes lost their clock it stopped being called. 2. Persona + lane skill. A one-line persona per lane (“an expert-level CTF player who specializes in…”) and the lane’s skill, inlined. On day 7 every worker spent its first turn loading its skill, so the skill text is pasted in and the prompt says not to load it again. 3. Helper index + label grammar. Every public function in the lane’s library, generated from the code with Python’s ast at launch so it never drifts from what’s actually there; then the lane’s label grammar from lib/playbook.py (learning the GM’s spelling). 4. Technique log + rules. Excerpts of the lane’s technique log, each capped: a 2,500-character summary, the “recognition cues” and codec table at 4,500 characters each, the coverage-atlas cues at 4,500, and the “variant axes” seen so far at 2,500. Then the rules, each with the incident that justified it, and a budget: “aim for CORRECT within 60 s on a familiar family and 3 min on a new one.” 5. Render. A plain str.replace of each {slot}; no templating engine, so unknown braces (like JSON examples in the text) pass through. A prompt over 100 KB goes in on stdin, after a day-18 overnight worker’s prompt hit Linux’s 128 KiB per-argument limit. 6. Message 1: the whole rendered prompt with the challenge-specific parts marked “arriving in your next message”, plus “reply with exactly READY”. It is sent at launch, before the bytes have landed. 7. Triage + contracts: triage.md (capped at 6,000 characters), the timed contracts, and a note about the newest prior solver and how far its dry run got. 8. Message 2: GO, sent after READY, at the download mark. On day 10 three of five lanes lost this message because it was sent before the worker had finished its first turn; the harness now waits for the READY result line. 9. Inbox during the run: the only channel after GO, delivered by the PostToolUse hook after every tool call. 10. Coordinator, for stalled workers only: a tool-less Sonnet 5.5 call, one turn. A single-solve worker counts as stalled when it is at least 7 minutes old and the GM hasn’t accepted a new answer from it for 4 minutes; a generalize worker, at 3 minutes old with no solver edit for 3 minutes. The coordinator sees the worker’s trace and replies with exactly NONE or one concrete hint of at most 90 words, never an answer value, treating everything quoted from artifacts as untrusted. At most two hints per worker, 7 minutes apart; the hint goes through the inbox. It ran 9 reviews and sent 3 hints all month, for about $0.35.

What single.md tells the worker, section by section:

  1. One line of identity and economics. A one-line persona per lane (“an expert-level CTF player who specializes in…”), that it is one of several parallel workers, and the cost model: “Every model turn costs ~5 s and the clock is the score.”
  2. Tooling discipline. Use the CLI for analysis (7z, xxd, strings, readelf, jq) and the specific tool triage named; Python only for the solver. Batch independent commands into one message.
  3. The lane skill, inlined. On day 7 every worker spent its first turn loading its skill, so the skill text is pasted in and the prompt says not to load it again.
  4. The lane’s helper index: every public function in the lane’s library, generated from the code with Python’s ast at launch, so it never drifts from what’s actually there.
  5. The challenge: paths, the timed contracts, and triage.md (inlined, capped at 6,000 characters).
  6. Goals, in order. This section opens with “this is a RACE” and explains that the harness ends the session the moment the single is CORRECT. Then four numbered goals: understand the challenge (with the lane’s technique log as “a REFERENCE, not a recipe”); write solve.py to be general, fast (every Mastery set under a second) and safe to patch; submit from it; stop.
  7. Rules learned the hard way, each with the anecdote that produced it (examples below), and a budget: “aim for CORRECT within 60 s on a familiar family and 3 min on a new one.”
  8. Scope: write only inside your challenge folder; propose library changes in NOTES.md instead of making them.
  9. The lane’s label grammar (more on that below).
  10. How to resolve a label you’re unsure of, and when HELP.md is allowed: only after the resolver and the explore-alternatives skill have both come up empty.

The style is consistent: every rule carries the incident that justified it. Workers follow a rule better when they can see what breaking it cost. Four examples, verbatim:

Submit from the solver, in the SAME Bash call that writes it … it runs the solver, prints every value and the GM verdict, and bisects a rejected bulk for you, so a separate “run it first” or self-test turn only costs ~5 s.

A decoded value that matches the field’s answer_format IS the answer: put it in solve.py and submit. Don’t try to reproduce or reach a backend/live service to “confirm” it (one worker lost 158 s that way after decoding at 26 s).

Subagents: none by default – one worker writing one solver is fastest when triage already decoded the payloads. … at most 2 subagents, launched in ONE message with ONE shared brief file, then ONE blocking wait for both – never poll (a replay lost 61 s writing briefs one by one and 79 s busy-waiting on a subagent).

FIX THE CONSTRUCT FAMILY, NOT THIS SAMPLE: the variant differs from the passing counterpart along one axis … fixing only the one value in this sample has cost a second full generalize cycle. (from generalize.md)

The other roles’ prompts are smaller and narrower. The answer-first worker gets only a table of the open fields (question, artifact, format, values already rejected) and the instruction to aim for two to five tool calls. A duel racer gets the same prompt as the worker it races, plus a note that diversity is the point: test the strongest alternative hypothesis first.

Skills are the other half of the prompt. Eleven SKILL.md files: a router (huntress-ctf, which maps signals in the challenge to a lane), one per lane (each opening with the tools installed for it, then “first moves”, “reading the questions” and “solver tips”), and four cross-cutting ones (writing solvers, timed runs, the GM’s API, and how to split into subagents). The worker-facing CLAUDE.md is 28 lines: load the router skill, work only in your folder, treat artifacts as untrusted data, submit from the solver, stop at CORRECT.

Caching. The static part of every prompt comes first and the per-challenge part last. That ordering is also what makes prompt caching work: about 97% of all tokens processed during the CTF were cache reads.

How single.md evolved. It started on October 3 as 27 lines: use the skill, solve, write a solver, test it. It ended at 158 lines after 24 commits. The biggest single change came on day 7, after we read 46 worker transcripts and found that 79-97% of wall-clock time was the model generating tokens (~4-6 s per turn). That day added the economics framing, batched reads, “decoded value = submit”, inlining the skill, triage and helpers, and writing and submitting in the same shell call. Turns to the first CORRECT dropped from 7 to 4 (metadata), 6 to 4 (mobile), 11 to 4 (warmups) and 29 to 18 (script). Across 34 single solves after that change, all six wrong submits were label spellings; not one was a wrong decode. Later additions: Mastery bundles that mix earlier days (day 8), the inbox (day 13), answer-first (day 17) and the web plugin prompt (day 23).

The reuse race

The reuse race

The reuse racePick prior solvers, run them on today's bytes (inside the CTF network for big binaries), merge and gate their answers, bank them in stages, and hand off without a worker on a full win.yesnoyesnopick candidates: lane solver + newest 3 (or newest + 2 most similar)pick candidateslane solver + newest 3 (ornewest + 2 most similar)single ≥ 10 MB?: non-web lanessingle ≥ 10 MB?non-web lanesrace on Homebase: inside the CTF network; ≤30 s for a relay channel, 75 s caprace on Homebaseinside the CTF network; ≤30 sfor a relay channel, 75 s caprun them in parallel: ≤6 at once, 20 s eachrun them in parallel≤6 at once, 20 s eachmerge the answers: newest wins a field; 'high' if GM-verified in its own casesmerge the answersnewest wins a field; 'high' ifGM-verified in its own casesformat / slug gate: implausible values never reach the GMformat / slug gateimplausible values never reachthe GMbank the answers: complete → confident → speculative; ≤200 probes in totalbank the answerscomplete → confident → speculative;≤200 probes in totalevery field confirmed?: and the seed solver reproduces every confirmed answerevery field confirmed?and the seed solver reproducesevery confirmed answerrace-first handoff: no worker launched; the timed modes start (≤12 s)race-first handoffno worker launched; the timedmodes start (≤12 s)resolve stray labels: in parallel, with the other solvers' values as alternatesresolve stray labelsin parallel, with the othersolvers' values as alternatestell the worker: HARNESS UPDATE: n/N fields confirmedtell the workerHARNESS UPDATE: n/N fieldsconfirmedresidual → answer-first: a medium worker takes the fields still openresidual → answer-firsta medium worker takes thefields still open
Every single solve from day 12 started with this. Red: what saves model time. Green: the platform.
steps and code
stepwhat happenscode
pick candidatesWeb races only its lane solver (14 s).hctf/solvers.py
single ≥ 10 MB?non-web laneshctf/orchestrate.py
race on HomebaseStands down if the local bytes land first.hctf/orchestrate.py
run them in parallel≤6 at once, 20 s eachhctf/solvers.py
merge the answersnewest wins a field; 'high' if GM-verified in its own caseshctf/solvers.py
format / slug gateimplausible values never reach the GMhctf/orchestrate.py
bank the answersThe race is the attempt's only bisector; the worker's submit waits on it.hctf/orchestrate.py
every field confirmed?and the seed solver reproduces every confirmed answerhctf/orchestrate.py
race-first handoffno worker launched; the timed modes start (≤12 s)hctf/orchestrate.py
resolve stray labelsin parallel, with the other solvers' values as alternateshctf/labels.py
tell the workerHARNESS UPDATE: n/N fields confirmedhctf/inbox.py
residual → answer-firsta medium worker takes the fields still openhctf/prompts/answer_first.md

From day 12 every single solve opens with a race against the bytes. It is never a gate: the worker keeps going beside it, and whatever the race proves reaches the worker through its inbox. In a backtest over days 2-11, every answer the race agreed on was right. Before the race existed, plain reuse of prior solvers won 0 of 5 singles a day; afterwards it usually won 3-5 of 5, and on day 22 all five. Following the chart:

  1. Pick candidates. The lane’s cumulative solver (merged from every earlier day) plus the newest three same-lane solvers; when retrieval has a ranking, the newest always runs and the two most similar fill the other slots. Web races only its lane solver, with a 14 s deadline.
  2. Single of 10 MB or more? (non-web lanes)
  3. Race on Homebase. Then the race also runs on Homebase, inside the CTF network, so the bytes never cross the home VPN. It waits up to 30 s for a relay channel, has a 75 s cap, and stands down if the local bytes arrive first.
  4. Run them in parallel, at most six at once and 20 s each.
  5. Merge the answers. Newest solver first; the first one to produce a field wins it. A value is “high” confidence if that field is GM-verified in the producing solver’s own regression cases, “speculative” otherwise. The seed solver is the one that reproduces the most merged values.
  6. Format / slug gate. Values that don’t match a field’s format, or warmups slugs that aren’t real words, never reach the GM.
  7. Bank the answers, within 200 probes in total: the complete set first if there is one, then the confident subset (bisected, up to 120 probes), then the speculative rest (up to 80). The race is the attempt’s only bisector; a worker’s own submit waits for it rather than competing.
  8. Every field confirmed, and the seed solver reproduces every confirmed answer?
  9. Race-first handoff. The timed modes start with the race’s seed solver, after the watcher gets up to 12 s to verify it. No worker is launched.
  10. Resolve stray labels otherwise: fields isolated as wrong get the label resolver, in parallel, with the other solvers’ values as alternatives.
  11. Tell the worker: HARNESS UPDATE lines saying how many fields are confirmed, so it stops working on them.
  12. Residual → answer-first: a medium-effort worker takes the fields still open.

A timed attempt

One timed attempt

One timed attemptReuse a pre-started attempt or start one, download, solve with a forked warm solver under a budget, submit once, then localize wrong fields or bank partial answers.noyesyesnowrongincompletestill wrongattempt already started?: at the previous mode's CORRECTattempt already started?at the previous mode's CORRECTstart, hedged: status/start on both paths; first judged reply winsstart, hedgedstatus/start on both paths; firstjudged reply winsdownload: in parallel; per set when ≥20 MB; big replies avoid the SSH channeldownloadin parallel; per set when ≥20 MB;big replies avoid the SSH channelset the solve budget: time left − 1.5 s (untimed: 60-300 s by size)set the solve budgettime left − 1.5 s (untimed:60-300 s by size)fork the warm solver: zygote: 15-51 ms vs 150-230 ms cold; one fork per setfork the warm solverzygote: 15-51 ms vs 150-230 mscold; one fork per setsubmit once: all answers in one callsubmit onceall answers in one callcorrect?:correct?record a regression case: auto-<mode>-<attempt>, with the GM-verified answersrecord a regression caseauto-<mode>-<attempt>, with theGM-verified answerswhat went wrong?:what went wrong?localize: bisect per set; fix labels from the cache, no modellocalizebisect per set; fix labels fromthe cache, no modelpartial submit: bank what the solver producedpartial submitbank what the solver producedfailure path: next flowchartfailure pathnext flowchart
No model in the loop. It runs on Homebase first and falls back to the same code locally.
steps and code
stepwhat happenscode
attempt already started?at the previous mode's CORRECThctf/orchestrate.py
start, hedgedA submit is never sent twice.hctf/gmroute.py
downloadin parallel; per set when ≥20 MB; big replies avoid the SSH channelhctf/hb_timed.py
set the solve budgettime left − 1.5 s (untimed: 60-300 s by size)hctf/hb_timed.py
fork the warm solverzygote: 15-51 ms vs 150-230 ms cold; one fork per sethctf/hb_zygote.py, hctf/hb_daemon.py
submit onceall answers in one callhctf/hb_timed.py
correct?hctf/timed.py
record a regression caseauto-<mode>-<attempt>, with the GM-verified answershctf/timed.py
what went wrong?hctf/hb_timed.py
localizebisect per set; fix labels from the cache, no modelhctf/hb_timed.py
partial submitbank what the solver producedhctf/hb_timed.py
failure pathnext flowcharthctf/orchestrate.py

Time Trials started with a few seconds on the clock, so the timed path is a script, not an agent. No model runs anywhere in this chart.

  1. Attempt already started? The next mode’s attempt is often started at the previous mode’s CORRECT, so the start round trip is already paid.
  2. Start, hedged. Every GM call is routed by measurement. Calls that are safe to repeat (status, and start, which resumes an open attempt) go down both paths at once, direct and through a relay on Homebase inside the CTF network, and the first judged reply wins. The relay is used for other calls only when its running average is at least 20% and 0.1 s faster than going direct; on day 5, submits through it went from 2.76 s to 0.55 s. A submit is never sent twice: if the relay fails mid-submit, the harness says so and makes a human check before anything is resent. Under all of it, one account-wide governor halves every fan-out in the harness while the GM is answering “slow down” (HTTP 429), so a clean run is never slowed.
  3. Download, in parallel; Mastery bundles of 20 MB or more download set by set so solving can start on the first set. Large replies never ride the single SSH channel to Homebase: a 9.5 MB reply once took 59.6 s that way.
  4. Set the solve budget: the time left minus 1.5 s, passed to the solver as a deadline. For untimed attempts it scales with size, from 60 to 300 s.
  5. Fork the warm solver, one forked process per Mastery set (below).
  6. Submit once, all answers in one call.
  7. Correct?
  8. Record a regression case: on yes, the attempt becomes a case named auto-<mode>-<attempt> holding only the answers the GM verified.
  9. What went wrong? Rejected fields, or an incomplete solve.
  10. Localize rejected fields: bisect set by set and fix labels from the confirmed-label cache, all without a model.
  11. Partial submit for an incomplete solve: bank what the solver did produce.
  12. Failure path for anything still wrong (when a variant fails).

The warm solver. The attempt runs on Homebase first, where a long-lived daemon (hb_daemon.py) holds one SSH stdio channel open and keeps, per solver, a zygote: a Python process that has already imported the solver and its libraries. Each solve forks it, so it starts in 15-51 ms instead of the 150-230 ms of a fresh interpreter:

pid = os.fork()
if pid == 0:                                   # child
    os.setpgid(0, 0)
    os.dup2(fd_o, 1); os.dup2(fd_e, 2)         # stdout/stderr -> temp files
    code = 0
    sys.argv = [SOLVE, *[str(a) for a in req.get("args") or []]]
    try:
        runpy.run_path(SOLVE, run_name="__main__")
    except SystemExit as e:
        code = e.code if isinstance(e.code, int) else (0 if e.code is None else 1)
    finally:
        os._exit(code)

The zygote is warmed by running the solver under a different run_name, which loads the imports and nothing else, and is rebuilt whenever the solver directory’s signature changes. When Homebase isn’t ready, the same attempt code runs locally against the public GM, with solve.py in a fresh interpreter instead of a fork.

When a variant fails

When a timed variant fails

When a timed variant failsThe variant becomes a regression case, then repairs race: a library racer, a live answer and a transactional generalize; up to five retries, then an untimed fallback, then a human.∥yesnoyesnostill failingcapture the variant: a regression case with the GM's per-field verdictscapture the varianta regression case with the GM'sper-field verdictsprobe the fields: which are wrong, which missingprobe the fieldswhich are wrong, which missingsnapshot (the 'before'): solver, the cases that pass, every expected.jsonsnapshot (the 'before')solver, the cases that pass,every expected.jsonlive answer: a worker answers the open attempt by hand (≤80 fields)live answera worker answers the open attemptby hand (≤80 fields)library racer: warmups: lane decoder, no model, ≤60 probeslibrary racerwarmups: lane decoder, nomodel, ≤60 probesgeneralize (+ duel): fix the construct family, not this samplegeneralize (+ duel)fix the construct family, notthis samplefirst repair to pass wins: the others are stoppedfirst repair to pass winsthe others are stoppedrestore every expected.json: workers never author expected answersrestore every expected.jsonworkers never authorexpected answersanything broken?: run every case that passed beforeanything broken?run every case that passedbeforerestore the snapshot: the edit goes to .generalize-rejected/restore the snapshotthe edit goes to.generalize-rejected/keep the edit:keep the editretries left (≤5)?: rate limits and refused starts don't countretries left (≤5)?rate limits and refused startsdon't countnext timed attempt: usually passes: the solver now knows this variantnext timed attemptusually passes: the solvernow knows this variantuntimed fallback: 3 rounds on a fresh untimed attemptuntimed fallback3 rounds on a fresh untimedattemptblocked → a human: !!! in the feedblocked → a human!!! in the feed
The three repairs run at once; whichever passes the attempt first wins. Red: model work.
steps and code
stepwhat happenscode
capture the variantExpected answers only ever come from the GM.hctf/orchestrate.py
probe the fieldswhich are wrong, which missinghctf/timed.py
snapshot (the 'before')solver, the cases that pass, every expected.jsonhctf/orchestrate.py
live answerUntimed attempts only; medium effort at ≤5 fields; 900 s.hctf/prompts/live.md
library racerwarmups: lane decoder, no model, ≤60 probeshctf/libracer.py
generalize (+ duel)Opus at medium plus a Sonnet racer; first verified fix wins.hctf/prompts/generalize.md, hctf/duel.py
first repair to pass winsthe others are stoppedhctf/orchestrate.py
restore every expected.jsonworkers never author expected answershctf/orchestrate.py
anything broken?run every case that passed beforehctf/orchestrate.py
keep the edithctf/orchestrate.py
restore the snapshotthe edit goes to .generalize-rejected/hctf/orchestrate.py
retries left (≤5)?rate limits and refused starts don't counthctf/orchestrate.py
untimed fallback3 rounds on a fresh untimed attempthctf/orchestrate.py
next timed attemptusually passes: the solver now knows this varianthctf/timed.py
blocked → a human!!! in the feedhctf/feed.py

A failed timed variant is the expensive case. Before day 15 it also meant a ticking clock; afterwards it usually meant an open, untimed attempt that could still be answered. So the harness starts several repairs at once and lets the first one that passes win. Following the chart:

  1. Capture the variant as a regression case, with the GM’s per-field verdicts. Expected answers only ever come from the GM.
  2. Probe the fields: which are wrong, which are missing.
  3. Snapshot (the “before”). Before any repair touches the solver, the harness copies it, records which cases pass, and copies every expected.json.
  4. Live answer, in parallel: a worker answers the still-open attempt’s unresolved fields by hand. Untimed attempts only; up to 80 fields (600 if they all share one shape); medium effort at five fields or fewer; a 900 s budget. When the timed runner comes back, the list is narrowed through the inbox to what is still unresolved.
  5. Library racer, in parallel (warmups only, no clock): the lane’s decoder runs in a subprocess for up to 45 s; values the GM already rejected are excluded; it submits in up to two rounds with at most 60 bisection probes.
  6. Generalize (+ duel). A worker edits the solver to fix the construct family, not this one sample. From a mode’s second generalize on, duel racers join: Opus at medium effort plus a Sonnet 5.5 racer, each on its own copy of the solver and its cases. A racer whose copy passes every case has its code copied over the live solver, where the same transaction (steps 8-10) judges it. The racers end the moment the chain’s own worker wins.
  7. First repair to pass wins. If the live answer or the library racer gets the attempt CORRECT first, the others are stopped; the generalize continues in the background on a copy so the solver still learns the variant.
  8. Restore every expected.json, so a worker can never author the answers it is judged against (below).
  9. Anything broken? Run every case that passed before.
  10. Restore the snapshot if so (the edit goes to .generalize-rejected/ for a human), keep the edit if not.
  11. Retries left (≤5)? Some failures don’t use one up: rate limits (up to six, backing off), a refused start (up to 30), a clock-only expiry (up to 12), a localization cut short (up to two resumes).
  12. Next timed attempt, which usually passes, because the solver now knows this variant.
  13. Untimed fallback when the pool of attempts is exhausted or retries run out: three rounds on a fresh untimed attempt.
  14. Blocked → a human if that fails too: the chain is blocked and the feed shows !!!.

The transaction in step 9-10 is a few lines:

passed = {r.get("case") for r in (res or []) if r.get("ok")}
broken = sorted(getattr(self, "_baseline", set()) - passed)
if res and not broken:
    ...                                   # keep the edit
    return
self._restore_snapshot(f"broke previously-passing cases {broken[:6]}" if res else
                       f"solver no longer runs ...")

Expected answers are restored before the test runs because once an overnight worker, tuning a solver for speed, wrote its own solver output into an unverified case’s empty expected.json. That froze 3,075 unjudged values as “GM truth”. Since then workers can’t author expected answers at all.

Learning the GM’s spelling

Learning the GM's spelling

Learning the GM's spellingFor a rejected exact-text field: use the enum if there is one; otherwise rank candidates, filter known-bad spellings, check locally, probe within a budget, and cache what the GM accepts.yesnoyesnoretrynois the field an enum?: answer_format.kindis the field an enum?answer_format.kindpick from accepted_values: never probe a listed fieldpick from accepted_valuesnever probe a listed fieldrank candidates: solver value → playbook seeds → alternates → sibling labelsrank candidatessolver value → playbook seeds →alternates → sibling labelsfilter: drop playbook-rejected and already-wrong spellingsfilterdrop playbook-rejected andalready-wrong spellingslocal guards: format, enum, slug, a real ATT&CK id, wrong-answer capslocal guardsformat, enum, slug, a real ATT&CKid, wrong-answer capsprobe one at a time: budget 25 per field; rate- limited for the whole accountprobe one at a timebudget 25 per field; rate-limited for the whole accountaccepted?:accepted?cache in vocab.json: read inside the timed window next timecache in vocab.jsonread inside the timed windownext timebudget left?:budget left?depth-3 search, then HELP: three-token labels before inventing new wordsdepth-3 search, then HELPthree-token labels beforeinventing new words
The actual labels stay out of this post; the grammar that generates them is described in the text.
steps and code
stepwhat happenscode
is the field an enum?answer_format.kindhctf/labels.py
pick from accepted_valuesnever probe a listed fieldhctf/labels.py
rank candidatesThen terms composed from the artifact.hctf/labels.py
filterdrop playbook-rejected and already-wrong spellingslib/playbook.py
local guardsformat, enum, slug, a real ATT&CK id, wrong-answer capshctf/cli.py, lib/refs/attack.py
probe one at a timebudget 25 per field; rate- limited for the whole accounthctf/ratebucket.py
accepted?hctf/labels.py
cache in vocab.jsonread inside the timed window next timelib/vocab.json
budget left?hctf/labels.py
depth-3 search, then HELPthree-token labels before inventing new wordshctf/labels.py

The hardest fields were never the analysis. They were spelling. Many script and binary questions are exact_text classifications, like “how is this payload’s loop guarded” or “what format is this”. The GM wants its own synthetic label, gives no list, and only says right or wrong. Following the chart, for a rejected field:

  1. Is the field an enum? If answer_format.kind is enum, the GM lists the accepted_values:
  2. Pick from accepted_values, and never probe.
  3. Rank candidates otherwise, in a fixed order: the solver’s own value, the playbook’s seed values, alternate renderings (hex width, GUID braces and so on), labels already confirmed for sibling fields, and finally compositions of terms found in the artifact.
  4. Filter: drop everything the playbook or the GM already rejected; never resubmit a known-bad spelling.
  5. Local guards, which every submit passes anyway: enum membership, regex patterns, flag shape, slug words, caps on wrong answers per attempt, and an ATT&CK guard backed by all 858 MITRE technique ids. That guard checks that a technique id is real, not that it is right; the judgment stays with the worker.
  6. Probe one at a time: each probe is a real single-field submit, with a budget of 25 per field, through the account-wide rate governor.
  7. Accepted?
  8. Cache in vocab.json: every confirmed closed-vocabulary label goes into lib/vocab.json (152 by the end), which the timed runner reads inside the window to fix a rejected field without a model.
  9. Budget left? Then rank again with the next candidates.
  10. Depth-3 search, then HELP. When one- and two-token compounds are exhausted, the resolver composes three-token labels before anything new is invented; if nothing fits, the worker writes HELP.md.

The playbook. lib/playbook.py holds what was learned about the grammar, one entry per field family. A family is the last token of the answer id, so all *-control fields share a rule:

@dataclass
class PlaybookEntry:
    lanes: tuple           # lanes this applies to
    families: tuple        # field-family endings it covers
    rule: str              # the derivation rule, one or two sentences
    confirmed: tuple = ()  # GM-accepted values seen so far (closed vocab = the whole set)
    rejected: tuple = ()   # GM-rejected spellings: never reprobe these
    examples: tuple = ()   # worked (artifact-feature -> label) notes
    closed: bool = False   # True: confirmed is the COMPLETE allowed set
    derive: object = None  # optional fn(terms, solver_value) -> [candidate, ...]

There were 27 entries by the end. On top of them sat a block of naming laws, the generator’s grammar rather than a list of answers. I’m keeping the actual labels out of this post, but the shapes were what mattered:

  • A label is a short <keyword>_<suffix> compound built from a real token in the bytes, never an analyst’s synonym. The spelled-out form of a statement was always wrong; the short keyword that opens it was right.
  • A format is the container alone for native code, and container plus the runtime’s own spec token for managed code.
  • A classification of where something is stored is a two- or three-token compound. When the one- and two-token pieces are all rejected, search depth three before inventing new words.
  • “The answer appears in the bytes” holds for identifiers (symbols, paths, hashes) only. Concept labels are the GM’s own words and never occur in the file.

The web lane

The web lane

The web laneTake a target slot, wait for the target (reviving or kicking it), dispatch on its clue keys to racing exploit handlers, submit the proof, then codify the winner as a plugin.noyesyesnonoyestake a target slot: 5 per team (a file lock), held for the whole chaintake a target slot5 per team (a file lock), heldfor the whole chaintarget up?: poll every 2 s, wait ≤480 starget up?poll every 2 s, wait ≤480 srevive or kick it: arena start every 30 s (≤6); kick every 15 s (≤4)revive or kick itarena start every 30 s (≤6);kick every 15 s (≤4)read the clue keys: GET /api/clues → which handlers applyread the clue keysGET /api/clues → whichhandlers applyone-shot credit kit?: a side-effect-free audit request firstone-shot credit kit?a side-effect-free auditrequest firstRUN_ALONE handlers only: nothing else touches the target; ≥25 s budgetRUN_ALONE handlers onlynothing else touches thetarget; ≥25 s budgetrace the candidates: LFI probe, key handlers, ladder, earlier days (kit: RUN_ALONE only)race the candidatesLFI probe, key handlers, ladder,earlier days (kit: RUN_ALONE only)proof found?: ≤4 retries, 2.5 s apartproof found?≤4 retries, 2.5 s apartself-heal, or a worker: credit kit: arena reset (≤2); else the LLM workerself-heal, or a workercredit kit: arena reset (≤2);else the LLM workercodify the winner: a worker turns it into a plugin; verified live (≤300 s)codify the winnera worker turns it into a plugin;verified live (≤300 s)promote atomically: os.replace; the old copy is backed uppromote atomicallyos.replace; the old copyis backed up
Time Trial and Mastery each get a fresh target; arena stop frees the slot when a mode is done.
steps and code
stepwhat happenscode
take a target slotThe next mode's target is pre-provisioned.hctf/webtarget.py
target up?poll every 2 s, wait ≤480 shctf/webtarget.py
revive or kick itArena reset is the organizers' sanctioned recovery.hctf/webtarget.py
read the clue keysGET /api/clues → which handlers applylib/web/__init__.py
one-shot credit kit?A one-shot target must not be spent by a helper request.lib/web/__init__.py
RUN_ALONE handlers onlynothing else touches the target; ≥25 s budgetlib/web/handlers/__init__.py
race the candidatesKnown class 20 s, unknown 12 s; the first proof wins.lib/websolve.py
proof found?≤4 retries, 2.5 s apartlib/web/__init__.py
self-heal, or a workercredit kit: arena reset (≤2); else the LLM workerhctf/orchestrate.py
codify the winnera worker turns it into a plugin; verified live (≤300 s)hctf/prompts/codify.md, lib/web/plugin.py
promote atomicallyThe next target of this class is solved in seconds.lib/web/plugin.py

Web was the odd lane out: no artifact, just a live target the GM provisions on demand, and from day 19 two or three web challenges a day.

  1. Take a target slot. Up to five live targets per team (the organizers lifted an earlier one-target limit on day 20), enforced with file locks and held for the whole chain. The next mode’s target is pre-provisioned.
  2. Target up? The harness polls every 2 s for up to 480 s.
  3. Revive or kick it. A target that was cleaned or stopped is revived from the arena (every 30 s, up to six times); one stuck in preparing is kicked (every 15 s, up to four times). Mastery targets sometimes took over five minutes to come up, which is why web owned the slow second half of the month.
  4. Read the clue keys. Each target exposes a clue endpoint, and the keys of its response decide which handlers apply.
  5. One-shot credit kit? Some targets let you spend a credit only once. A side-effect-free audit request checks first.
  6. RUN_ALONE handlers only if it is: nothing else may touch the target, with a budget of at least 25 s. Day 27’s target was spent by a helper request before the real exploit ran; this is the fix.
  7. Race the candidates otherwise: the LFI probe, every handler keyed on the target’s clues, a generic ladder, and every earlier web day’s solver, each in its own thread; the first proof_… wins. Budgets: 20 s for a known class, 12 s for an unknown one.
  8. Proof found? Up to four retries, 2.5 s apart, then it is submitted like any other answer.
  9. Self-heal, or a worker: a credit kit gets an arena reset (at most twice per chain); otherwise the LLM worker takes over and solves it by hand.
  10. Codify the winner. After CORRECT, a worker turns the winning exploit into a plugin keyed on the clue, within 300 s. A verifier runs it against a live target: exit 0 means it produced the proof, 1 no proof within 30 s, 2 an invalid plugin, 3 a key map that matches no clue.
  11. Promote atomically with os.replace, keeping a backup of the previous version. The Time Trial waits up to 10 s for a fresh plugin, and the next target of that class is solved by the plugin in seconds.

Time Trial and Mastery each get a fresh target. When a mode is done, arena stop frees its slot.

Overnight: the post-run and the prebuild

Overnight: the post-run

Overnight: the post-runHeld until the GM confirms the whole board, then resumable phases, each with its own keep-or-rollback gate.noyesnoyesyesnoboard GM-solved?: holdouts are listed in the feedboard GM-solved?holdouts are listed in thefeedheld: finish the stragglers, then hctf postrun --day Nheldfinish the stragglers, thenhctf postrun --day Nratchet: workers' proposals → lib/; a technique log per laneratchetworkers' proposals → lib/; atechnique log per lanesuites still pass?: baseline-aware; edited assertions restored firstsuites still pass?baseline-aware; editedassertions restored firstrevert lib/ + tests/:revert lib/ + tests/speed-harden: slowest case >2.5 s → a speed generalizespeed-hardenslowest case >2.5 s → a speedgeneralize≥5% faster?: or a new case passes≥5% faster?or a new case passeskeep the faster solver:keep the faster solverrestore the snapshot:restore the snapshottrain: replay every earlier day; adopt misses (≤2 rounds)trainreplay every earlier day; adoptmisses (≤2 rounds)prebuild until the warm-up: speculative modules behind fixtures; $60 per laneprebuild until the warm-upspeculative modules behindfixtures; $60 per lanecoverage + KPI row: toolchain report; hctf kpi --recordcoverage + KPI rowtoolchain report;hctf kpi --record
Each phase is recorded in .run/dayNN.postrun.json and can be resumed after a crash.
steps and code
stepwhat happenscode
board GM-solved?Solve everything before learning anything.hctf/driftwatch.py
heldfinish the stragglers, then hctf postrun --day Nhctf/postrun.py
ratchetThe only writer to the shared library.hctf/prompts/ratchet.md, hctf/prompts/ratchet_log.md
suites still pass?baseline-aware; edited assertions restored firsthctf/orchestrate.py
revert lib/ + tests/hctf/orchestrate.py
speed-hardenFailing verified cases get a correctness fix first.hctf/orchestrate.py
≥5% faster?or a new case passeshctf/orchestrate.py
keep the faster solverhctf/orchestrate.py
restore the snapshothctf/orchestrate.py
trainNothing learned on day 20 may break day 8.hctf/train.py
prebuild until the warm-upStops 30 minutes before the next drop (gate flowchart below).hctf/prebuild.py
coverage + KPI rowtoolchain report; hctf kpi --recordhctf/kpi.py
  1. Board GM-solved?
  2. Held if any mode is still open: the holdouts are listed in the feed, the operator finishes them, then runs hctf postrun --day N.
  3. Ratchet. The only writer to the shared lib/. Its inputs are the “proposed library additions” every worker writes in its NOTES.md (deduplicated against earlier days) plus a digest of the day. Per-lane technique-log workers run alongside it (8 minutes each; the logs reached 1,448 lines by the end), and the ratchet worker itself gets 15 minutes.
  4. Suites still pass? The gate runs the lane suites and the ATT&CK coverage check in parallel. It is baseline-aware: a suite that already failed before the ratchet doesn’t count against it. Assertions a worker edited are restored first; if the merge only passes with the edited ones, it is kept with a !!! review alert.
  5. Revert lib/ + tests/ if the gate fails, so nothing half-merged survives.
  6. Speed-harden. For every solver: failing verified cases get a correctness fix first; a slowest case over 2.5 s, or Mastery sets solved one after another instead of in parallel, gets a speed generalize.
  7. ≥5% faster? Re-time the slowest case (the minimum of two interleaved runs), or check whether a new case now passes.
  8. Keep the faster solver, or restore the snapshot.
  9. Train. Every earlier day’s verified cases are replayed against today’s library, plus a mutation probe that alters known cases along the axes variants usually vary (encoding, order, wrapper). Hard misses are adopted as cases and fixed by a transactional generalize, up to two rounds. Nothing learned on day 20 may break day 8.
  10. Prebuild until the warm-up: the next chart. It stops 30 minutes before the next drop, which is when the warm-up begins.
  11. Coverage + KPI row. Coverage re-checks that every ATT&CK id in the knowledge layer is a real one and writes a toolchain report: tools workers needed that weren’t installed. hctf kpi --record appends the day’s row to the KPI table: time to 14/15 and 15/15 modes, release lag, race wins, generalizes on the critical path, and cost.

Each phase is recorded in .run/dayNN.postrun.json and can be resumed after a crash; the day-16 out-of-memory crash in the middle of the post-run is why.

The prebuild gate

The prebuild gateOff-peak workers build speculative decoders on a private copy of the library; a module merges only through a layered gate, one at a time.yesyesyesnonononext targetpick a target: coverage gaps → ranked TARGETS.json → the restpick a targetcoverage gaps → rankedTARGETS.json → the resta worker builds one module: private lib/ copy; no GM token, no secretsa worker builds one moduleprivate lib/ copy; no GM token,no secretsallowed paths and calls?: AST import/call allowlist; no subprocess, eval, file I/Oallowed paths and calls?AST import/call allowlist; nosubprocess, eval, file I/Ofixtures pass?: ≥2 per format incl. a decoy; ≤1 s; independent oraclefixtures pass?≥2 per format incl. a decoy;≤1 s; independent oraclesuites + replay green?: lane tests; verified cases still passsuites + replay green?lane tests; verified casesstill passmerge into lib/: a race entry only, never the critical pathmerge into lib/a race entry only, never thecritical paththrow it away: tree changed outside the gate → !!! and stopthrow it awaytree changed outside thegate → !!! and stop
Most of lib/'s 195k lines came through this gate: 189 metadata modules covering 25,099 format-field keys.
steps and code
stepwhat happenscode
pick a targetSkips done targets and ones that failed twice.hctf/prebuild.py
a worker builds one moduleprivate lib/ copy; no GM token, no secretshctf/prompts/prebuild.md
allowed paths and calls?AST import/call allowlist; no subprocess, eval, file I/Ohctf/prebuild.py
fixtures pass?≥2 per format incl. a decoy; ≤1 s; independent oraclehctf/prebuild.py
suites + replay green?Merged one at a time under a lock.hctf/prebuild.py
throw it awaytree changed outside the gate → !!! and stophctf/prebuild.py
merge into lib/a race entry only, never the critical pathhctf/prebuild.py

The prebuild is where most of lib/ came from.

  1. Pick a target from a queue: coverage gaps first, then a hand-ranked list, then the rest, skipping targets that are done or failed twice.
  2. A worker builds one module on a private copy of the library, with no GM token and no secrets.
  3. Allowed paths and calls? An AST allowlist of imports and calls: no subprocess, eval or file I/O.
  4. Fixtures pass? At least two per format including a decoy, each under a second, checked by an oracle that is independent of the module.
  5. Suites + replay green? The lane suites and a replay of every verified case, one module at a time under a lock.
  6. Merge into lib/ if all three pass. Prebuilt modules are race entries only: they can win a field in tomorrow’s reuse race, but nothing on the critical path waits for them. The metadata registry alone grew 189 such modules covering 25,099 format-field keys.
  7. Throw it away otherwise; a change to the tree outside the gate stops the batch with a !!!. Then the next target. Each lane is capped at $60 a night.

The operator’s toolkit

What the operator actually has to work with during a run:

  • hctf feed: one line per milestone. A mode solved (and how: in-attempt fix, live answer, reuse race, answer-first), blocked, errored or expired; a live answer started; a reconnect; a generalize started, accepted or rejected; a duel started or won; a coordinator hint; a request for help; a contract the GM rewrote; any !!! line; post-run phases; and a heartbeat that warns when a generalize runs past 90 s.
  • hctf why <chain>: per mode, done or pending, how often the stop hook has blocked, the last attempt’s window and wrong or missing fields, the probe diagnosis, and the last worker result. The verdict is DONE, NOT DONE (run reconcile), WORKING (cycling on the same wrong field means converging on a label) or BLOCKED.
  • hctf reconcile: asks the GM which modes are solved and rewrites local state to match.
  • !!! alerts, each one a condition that needs a human: a failed login, a usage limit, a web attempt left open and unsolved, a GM attempt context gone invalid, a generalize lock held too long, a lost solve.py, a failed rehearsal of the Mastery fork pool or of the day’s warmups encodings, a pre-start that came back with a clock running, a ratchet gate that only passed with edited assertions, a prebuild that touched files outside its gate, and a slow network path.
  • HELP.md: written by a worker only when it truly doesn’t know the concept (after the label resolver and the explore-alternatives skill both failed). A contract-drift check (re-fetching the question and diffing it) may then re-run the single, in case the GM rewrote the question.

How we tested it

A CTF that drops once a day gives you one live test a day. Most of the harness’s reliability came from making failure reproducible at night instead.

  • A fake Game Master. hctf/replay_gm.py (448 lines) serves a solved day’s saved contracts and bytes and judges single solves locally. Timed modes are proxied to the real GM, which still hands out fresh variants. With the library pinned to the commit from before that day, a replay is an honest re-run of the day from scratch. Two catches: each replay spends real timed variants, so we ran at most two or three a day, and web can’t be replayed at all.
  • Fault injection. The same fake GM can cut replies short, add latency, return 429s or a 503 on start, flap Mastery’s prerequisite and stall downloads. tests/test_fault_replay.py runs 26 checks across 11 scenarios, and every scenario is a failure that really happened in a live run. It is green in about two minutes, and a red run fails the warm-up preflight.
  • Suites named after post-mortems. The test suites grew from 10 on day 8 to 78 at the end, about 2,700 assertions. The largest ones are literally named after the day that asked for them (test_d22_postmortem alone has 74 checks). A static lint refuses id()-keyed caches in solvers. On day 25 a binary Mastery got 46 fields wrong because a cache was keyed on id(member_bytes): on the 2-vCPU VM one process solved several sets in turn, a freed object’s address came back as the next set’s member, and that set read the previous set’s facts. It never showed on 12 local cores, where every set had its own process.
  • Preflight (the whole orchestration, step 1) runs the fault suite at every warm-up; a red suite is a FAIL.

The “sub-2-minute” plan written on day 17 found that every day over 2:00 had one of two causes: a generalize on the critical path, or a harness bug new that day. The fixes always landed a day late. Replays and the fault suite turned “tomorrow’s bug” into last night’s red test.

Appendix: the codebase

The harness is two very different kinds of code. The orchestrator is ordinary software, built in Claude Code sessions one post-mortem at a time. The library is the part that learned: most of it was written by workers overnight, behind tests, and none of it existed on day 1.

partsizewritten by
hctf/: orchestrator, CLI, timed runner52 modules, 32k linesorchestrator sessions, reviewed every night
lib/: shared solving library262 files, 195k linesmostly the nightly ratchet and the off-peak prebuild. Four files (binary, codec, android, warmups codecs) are 116k of it
lib/meta/prebuilt/: speculative metadata extractors189 modules, 72k linesprebuild workers, each kept only behind its own fixtures
tests/78 suites, 24k linesmost are named after the post-mortem that asked for them
skills/ and hctf/prompts/11 skills (547 lines), 15 prompt templateshand-curated
challenges/187 solver directories, 3,293 regression casessingle-solve workers and the harness

Harness code size

Harness code sizePython bytes in hctf and lib at the end of each commit day.0.0 MB2.0 MB4.0 MB6.0 MB8.0 MB10.0 MB12.0 MB3: 0.1 MB34: 0.2 MB5: 0.3 MB6: 0.3 MB7: 0.4 MB78: 0.6 MB9: 0.7 MB12: 0.8 MB13: 1.0 MB1314: 1.1 MB15: 1.3 MB16: 2.0 MB17: 2.4 MB1718: 3.3 MB19: 4.0 MB20: 4.6 MB21: 5.2 MB2122: 5.2 MB23: 6.6 MB24: 7.0 MB25: 7.4 MB2526: 8.9 MB27: 8.9 MB28: 9.8 MB29: 10.0 MB2931: 10.5 MB3110.5 MB
Size of the Python in hctf/ and lib/ at the last commit of each day (MB). Much of lib/ is generated codec tables and decoders the overnight ratchet added.
table view
date (Oct)MB
30.1 MB
40.2 MB
50.3 MB
60.3 MB
70.4 MB
80.6 MB
90.7 MB
120.8 MB
131.0 MB
141.1 MB
151.3 MB
162.0 MB
172.4 MB
183.3 MB
194.0 MB
204.6 MB
215.2 MB
225.2 MB
236.6 MB
247.0 MB
257.4 MB
268.9 MB
278.9 MB
289.8 MB
2910.0 MB
3110.5 MB

A map of every module is folded below.

Module map: every subsystem of the orchestrator
subsystemmodulesjob
Launch and chain stateorchestrate.py (10k lines), cli.py, paths.py, hostguard.py, driftwatch.pyrun(), one Chain per challenge, atomic chain.json state, every hctf subcommand, one busy harness per host, re-fetch a contract the GM rewrote in place
Triage (no LLM)triage.py, toolchain.py, contract.py, retrieval.pybytes and description → toolchain → install what’s missing → triage.md; contract-shape guard; past solves by fingerprint
Workersworkers.py, inbox.py, coordinator.py, duel.py, prompts/*.mdclaude -p in a sandbox, warm READY/GO, relaunch on limits; mid-run messages; a tool-less reviewer that sends one hint to a stalled worker; best-of-N racers
Timed runnertimed.py, hb_timed.py, hb_daemon.py, hb_zygote.py, procgov.pystart → download → solve → submit in one process; a daemon on Homebase over one SSH channel; fork-per-solve; process groups, nice and OOM priorities
GM transportgm.py, gmroute.py, ratebucket.py, mssproxy.py, remote.pystdlib client with keep-alive; measured, hedged routing; an account-wide 429 governor; an MSS-clamping relay
Race and labelssolvers.py, libracer.py, labels.py, grouptest.py, fmtalt.py, scout.pyreuse race and solver tests; label resolution; parallel bisection of rejected fields; alternate renderings of a value
Robustness probesmutate.py, compound.py, family.py, today_probe.pymutate yesterday’s cases before the GM does
Webwebtarget.py, webharden.py, lib/web/live target lifecycle; clue-keyed exploit handlers
Learningpostrun.py, prebuild.py, train.pyresumable post-run phases, off-peak breadth, replaying every earlier day
Observabilityfeed.py, watch.py, kpi.py, timeline.py, ressample.pyone line per milestone, KPI rows, timing marks, a resource sampler
Rehearsalreplay_gm.pya fake GM for replays and fault injection

Keep reading: Part 1 tells the story this machine was built for, and the numbers show what it did over the month.