Case study: Tripwire
A local gateway that lets a coding agent work on a project while the owner controls every protected change. This page summarizes what was built, what was measured and what failed. Every number links to a logged run in the evidence log; nothing here is estimated.
Problem
Coding agents act through tools: they read files, write files and run commands. Prompt injection, mistakes and over-eager agents make some of those actions harmful. The project started as a research question, whether a small, fast classifier can decide allow / review / block on each tool call, and became a product question: what boundary lets an agent stay useful while the owner keeps control?
What was built
- Capability gateway. A deterministic policy over structured file actions (readable roots, writable roots, automatic scratch roots, protected paths, byte limits), enforced by a runner that resolves paths without following links, writes atomically and records an HMAC-signed audit entry before any I/O.
- Owner approvals. Single-use approvals bound to the task, context, exact action and profile digest; an owner inbox on loopback with previews; agents can wait for and resume approved work but can never approve.
- Change sets. Up to ten patches, new files, deletes and renames reviewed once and applied all-or-nothing, with a journal that rolls back an interrupted set after a crash (ADR-0017).
- Owner-defined commands. The agent can ask to run, for example, the tests by name; the owner sees the exact argv and approves each run; no shell and no inherited secrets (ADR-0022).
- Policy rehearsal and an MCP proxy. Rehearsal shows which decisions a draft profile would change; the proxy puts the same decision log in front of any MCP server, in shadow or enforce mode (ADR-0019, ADR-0023).
- Advisory models. A local TF-IDF classifier and an optional remote decision model (Liquid d1.1) can only raise an action to review, never allow one. Python and browser implementations of the policy are kept identical by a parity test that runs both.
Research: the classifier
Dataset: 10,105 tool-call examples imported from AgentDojo, split by task and scenario with four injection tasks held out entirely. Labels are construction labels, and LLM labels for the gold set, not human gold.
| Model | Held-out attack recall | Test false-block rate | Notes |
|---|---|---|---|
| TF-IDF + logistic regression (shipped) | 0.071 [0.035, 0.119] | 0.008 | 7.46 ms p95 end to end on a 4-vCPU Xeon |
| DeBERTa-v3-base, 3 seeds | 0.38 to 0.69 | 0.6% to 19.9% | the dev-chosen 1% operating point did not transfer |
| Liquid d1.1, zero-shot | 0.527 [0.437, 0.631] | 0.4% (partial test) | about $20 per million decisions |
| GLM-5.3-Flash judge, zero-shot | 590 of 590 | 0 of 211 (test sample) | about $185 per million; shares the labels' rubric |
Brackets are 95% intervals over task templates. The full tables, including what failed (INT8 quantization collapsed the encoder; neither latency target was met by an encoder), are in the evaluation.
The decisive finding for the product: on file actions over real project files, the shipped classifier raised 0 of 66 risky actions the policy allowed to review, while Liquid raised 63 of 66 and none of 90 benign ones (evaluation). The capability policy, not the model, is what protects; the model is a reason to look, and Liquid is offered as an opt-in (ADR-0021).
Real agent runs
Claude Code 2.1.327, restricted to Tripwire's tools, fixed an access-control bug in a sample project: it proposed the fix and a regression test as one change set, waited for approval, applied it, then asked to run the tests and reported 7 of 7 passing (transcript). An earlier run exposed a real bug: two processes sharing the state directory could corrupt its SQLite database because closing a file descriptor dropped other connections' POSIX locks. A stress probe failed in 2 of 4 runs before the fix and 0 of 8 after it.
What I would say in an interview
- Deterministic policy first, models second: measured model limits justify giving them only the power to add review.
- Honest evaluation: template-level intervals, thresholds chosen on dev only, failures recorded as results.
- Real runs find real bugs: the database corruption and a structured-output failure in an LLM provider were both found by running the system end to end, not by unit tests.
Evidence-backed summary lines
- Built a local MCP gateway that enforces file-action policy with single-use, request-bound owner approvals, multi-file change sets with crash recovery, and owner-approved test commands; a Claude Code agent restricted to it fixed a bug and ran the tests with approval (7 of 7 passing).
- Evaluated four tool-call risk models on 10,105 AgentDojo examples with held-out attack families: a TF-IDF baseline generalized to 7.1% of unseen attacks, fine-tuned DeBERTa to 38–69% depending on seed, a zero-shot decision model to 52.7%; results drove the decision to keep models advisory.
- Found and fixed a SQLite corruption bug under concurrent gateways (POSIX lock release on descriptor close), reproduced by a stress probe that failed in 2 of 4 runs before the fix and 0 of 8 after.