cases/multi-agent-harness

My own systems · 2026 · TypeScript, Python, SQLite, Claude Code

A multi-agent harness with rules in code

retrieval MRR
before 0.57 → after 0.78
judge run
before $0.19 → after $0.06 with prompt caching

context

My work runs through a multi-agent system I built. Client work, job search, interview prep, my notes. I decide. Agents execute, in parallel, in the background.

The core is agent-agnostic. Hooks only call it, so the same rules work with any coding agent.

Watch the 5-minute walkthrough ↗

problem

A rule written in a prompt is a suggestion. An agent once created a ticket in a team tracker without asking. The rule was written down. Nothing enforced it.

An agent's report is a summary with a bias. Two agents in one checkout made a test count lie: 204 tests on the dirty tree, 197 on a clean checkout.

And a gate that cannot run looks exactly like a gate that found nothing. A judge that ran out of output budget returned empty content. The code read that as zero findings.

decisions

Chose: rules that matter are code. A hook denies the edit at write time. A written rule with no mechanical check goes on the gap list.

Rejected: longer instructions. More prose is more context to skip.

Chose: human gates only where the action is public or hard to undo. A write to a team tracker. An email to another person, which only ever goes out as a draft. Promoting a note into durable memory. A merge. Everything else runs on its own.

Chose: fail-open or fail-closed by the cost of the error. A broken probe warns and continues. A probe that worked and proved a violation blocks.

mechanism

Harness flow: I decide, an orchestrator briefs agents routed by risk, hooks deny at write time, a review gate before merge, human gates on public actions me decide and approve orchestrator session brief with a done condition small model mechanical mid tier build top tier review, design hooks deny at write time, own worktree review gate the diff, clean checkout, mutation merge only on a reviewed head human gates tracker, email, memory
Agents execute. Code enforces the rules. I approve what leaves.

orchestration

hooks

retrieval over my notes

Local embeddings on CPU, no API call. About 10 thousand chunks, re-indexed by content hash when a session starts. BM25 and vector search, fused by best rank: a variant of reciprocal rank fusion, because my two retrievers hit different questions. A capped weight for source authority breaks ties.

Measured against a gold set of 22 questions, hit@k and MRR per leg. Declared bias: I wrote the questions knowing the answers.

judges

LLM-as-judge (a model scoring another model's output) for CV claims against my evidence files, memory coherence and prose. Strict schema. A truncated or empty answer fails loud. Calibrated with a planted fixture and a clean one. The stable prefix is prompt-cached.

the rest

what changed

beforeafter
retrieval MRR, ranking change0.570.78
MRR by legvector 0.48, keyword 0.66fusion 0.78
hit@1, fusion and weight together0.410.73
judge run cost$0.19$0.06 with prompt caching

Cortex: an experiment, now paused

In 2026 I built Cortex, an assistant that brought the day's plan to a person at the moment they needed to act. TypeScript on Cloudflare Workers, Postgres, models through OpenRouter. I paused it in October 2026. The code and the measurements stay.