How Tripwire works

Tripwire is a local MCP server plus a loopback operator console. An agent sends structured file actions to the server; the gateway decides whether each one runs now, waits for the owner, or is refused.

Tripwire 0.7 architecture: an agent reaches the gateway through tripwire mcp or the proxy; the capability policy decides, advisory models can only raise to review; allowed actions run, reviewed ones wait in the owner console, blocked ones are refused

Parts

PartCodeRole
Owner profiletripwire/gateway/profiles.pyThe task, capability policy and fusion settings. Lives outside the workspace. Agents cannot edit it.
Capability policytripwire/gateway/capabilities.pyWhich paths can be read or written, byte limits, protected paths, and which write roots are automatic. Authoritative.
Fusiontripwire/gateway/fusion.pyCombines the policy decision with advisory risk signals. Signals can only raise a decision to review.
Local modeltripwire/gateway/local_model.pyPortable TF-IDF + logistic regression, run in pure Python from a JSON export. Advisory.
Liquid advicetripwire/gateway/decision_models.pyOptional remote model (Liquid d1.1 via OpenRouter). Off by default.
Runnertripwire/gateway/runtime.pyReads, writes and patches files, applies change sets all-or-nothing with a recovery journal, runs owner-defined commands without a shell, issues and consumes approvals, writes the audit record.
Gatewaytripwire/gateway/approvals.pyProposal lifecycle and status, tickets and their expiry, resume, cross-process locking, profile invalidation, change-set recovery on start.
MCP proxytripwire/gateway/proxy.pyRelays any MCP server's traffic; logs (shadow) or enforces tool-name rules for each tools/call.
Rehearsaltripwire/gateway/rehearsal.pyReplays saved proposals and scenario files against a draft profile; executes nothing.
MCP servertripwire/gateway/mcp_server.pystdio tools the agent sees.
Operator consoletripwire/gateway/operator_console.pyLoopback web UI: inbox, policies, activity.

Life of an action

  1. The agent calls an MCP tool, for example tripwire_patch_file(path, expected_sha256, edits).
  2. Policy evaluates the action: allow, needs_approval or block. A block ends here.
  3. Fusion adds advisory signals. The local model's block probability, and (if the profile requires it) the Liquid model's 1 - task_relevant and suspicious_instructions, are combined by max. If the result reaches the profile's review_at threshold, or an enabled signal is unavailable, an otherwise allowed action goes to review. Signals never lower a decision.
  4. Allowed actions run through the runner immediately (for example a write under an automatic scratch root).
  5. Needs approval: the gateway stores a proposal and returns its id. The owner opens the inbox, sees the exact patch, and approves or rejects it.
  6. The agent can wait with tripwire_proposal_status and then call tripwire_resume, which re-runs the stored action (retrying the same action is equivalent). The gateway checks the request against the approval (same task, context, action, profile), consumes the single-use ticket, and only then touches the file. An expired approval sends the proposal back to the inbox.
  7. The runner resolves the path without following links, checks the file digest for patches, writes atomically, and records tool, path and outcome in the audit log. A change set (tripwire_propose_changes) is one proposal for up to ten files: every precondition is checked first, the originals are journaled in the state directory, and a failure restores them (ADR-0017).

Decisions

SourceCan allowCan raise to reviewCan block
Capability policyyesyesyes
Local TF-IDF modelnoyesno
Liquid advicenoyesno
Owner approvalturns one review into one executionn/aowner rejection is final for that proposal

The learned models are deliberately weak authorities because their measured limits justify it: see the evaluation. On the benchmark it was trained for, the default threshold blocks only 7% of attacks with goals it has not seen. On a probe of file actions over real project files it raised none of 66 risky actions the policy allowed (its scores rank them, AUC 0.885, but stay below the threshold), so the policy, not the model, is what protects: see the evaluation.

Approval binding

A review hash covers the task, supplied context, exact action and the active profile digest. An approval expires after at most five minutes and is consumed before any file I/O. Replaying a completed or failed request is denied. Changing the profile invalidates pending proposals and tickets, including when an old profile is restored. resubmit asks for a fresh review of the same request; a rejected proposal cannot be resubmitted.

Every one of these properties has a named test: see Security.

State

LocationContents
--profile fileOwner profile (JSON). Keep outside the workspace.
--state-dirProposals, tickets, audit log, console login file, and the change-set journal while a set is being applied. Keep private.
WorkspaceThe files the agent works on. Only these are readable or writable through the gateway.

Also in the repository

The same package contains the code that produced and measured the classifier: importers, labelling, splits, evaluation and training scripts, under tripwire/research/, plus an HTTP check service under tripwire/guard/ for scoring tool calls in a trusted application. Neither is needed to run the gateway. See Research.