Setup
Requires Python 3.11 on a POSIX system. Tripwire governs file actions sent through its MCP tools; it does not intercept an agent's native shell or editor, so you also need to restrict those (see the last section).
Install
From a checkout:
python3.11 -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/tripwire demo
Or from the downloadable wheel (checksums in SHA256SUMS):
python3.11 -m venv .venv
.venv/bin/python -m pip install tripwire-0.7.0-py3-none-any.whl
.venv/bin/tripwire demo
tripwire demo uses a temporary directory to show a source read, an automatic scratch write, a protected patch, owner approval, execution, replay rejection and a blocked protected path.
Connect a project
tripwire connect sets up a project for one MCP client. Preview first; --dry-run creates nothing:
tripwire connect --workspace /abs/project --client codex --dry-run
tripwire connect --workspace /abs/project --client codex --task 'Fix the login bug'
tripwire connect --workspace /abs/project --client claude-code --template docs --auto-folder notes/drafts
Clients: codex, claude-code, claude-desktop, cursor, opencode (V1 config), opencode-v2, generic. The output says how that client's format was checked: OpenCode V1 has been run end to end, Claude Code registered the server and reported it Connected, and the rest match the client's documentation but have not been run here. The command:
- creates a private state directory (mode 700) outside the project, by default
~/.local/state/tripwire/<project>-<hash>(or under$XDG_STATE_HOME); pass--state-dirto choose; - writes the owner profile there, or keeps the existing one if you run it again;
- creates the template's folders (for the default,
notes/andscratch/) in the project if they are missing; - prints the exact MCP server entry for the client and where it goes, the client's own
mcp addcommand for Codex and Claude Code, and the command that starts the console.
--write PATH also saves the config to a new file. Tripwire never edits or overwrites an existing client config; you paste or merge the entry yourself. --format json prints the same plan as JSON.
Templates for a new profile (--template):
| Template | Reads | Writes (approval) | Automatic writes |
|---|---|---|---|
coding-review (default) | docs/, src/, tests/, notes/, scratch/, README.md | notes/, src/, tests/ | scratch/ |
docs | docs/, src/, scratch/, README.md | docs/ | scratch/ |
tests | src/, tests/, scratch/, README.md | tests/ | scratch/ |
read-only | docs/, src/, tests/, scratch/, README.md | none | scratch/ |
--test-command 'python3 -m pytest -q' lets the agent ask to run your tests as the command tests; every run waits for your approval and you see the exact command first. --auto-folder DIR (repeatable) replaces the automatic folders; --auto-folder "" means none. Before changing an existing profile, rehearse the draft: tripwire rehearse --draft draft.json ... or the console's Rehearse button shows which saved decisions would change. Change it in the console's Policies view or in the workbench.
Start the console in its own terminal with the command connect printed, then restart your client. The console prints the path of a private login file; open it to get into the inbox.
Manual setup
connect is a convenience over these steps:
tripwire init --workspace /abs/project --state-dir /private/state --task 'Review the project'
mkdir -p /abs/project/notes /abs/project/scratch
tripwire console --workspace /abs/project --state-dir /private/state --profile /private/state/profile.json
and an MCP entry that launches /absolute/venv/bin/tripwire mcp --workspace /abs/project --state-dir /private/state --profile /private/state/profile.json over stdio. The dashboard-review example ships a working OpenCode config.
First task
Ask the agent to read a small source file with tripwire_read_file, write findings to scratch/, then propose a tripwire_patch_file using the digest from the read. The patch appears in the inbox. Preview it, approve it, then ask the agent to retry the same call. Open Activity to see what ran. A request for .env is denied.
Watch this exact sequence with OpenCode.
Make it enforceable
The gateway is only a boundary for actions that go through it. For real enforcement:
- Deny the client's native file read/write and shell tools for the project, or run the agent in a container or as a separate OS user that cannot see the profile or state directory.
- Keep
--profileand--state-diroutside the workspace, readable only by you. "liquid": "off"is the default. Turning it on (tripwire connect --liquid, or"liquid": "required"in the profile) sends task, action and context of each allowed action to OpenRouter; putOPENROUTER_API_KEYin the environment of the gateway process only. It is the only signal measured to catch risky reads and automatic writes the policy allows (Evaluation); the bundled local model does not at its threshold.
See Security for what is and is not covered.