interlock
Quickstart

Two commands to a gated agent

Install, run interlock init, and keep coding. Interlock starts in shadow mode; flip to enforce when the report looks right.

Prerequisites

  • ▸macOS, Linux or Windows, Python 3.12+, and pipx, uv, or Homebrew
  • ▸A supported agent — Claude Code, Codex, Kiro, Cursor, Copilot CLI, Gemini CLI, Windsurf verified; Antigravity, OpenCode built; or your own agent (Claude Agent SDK, Strands, LangChain, OpenAI Agents SDK, Google ADK, CrewAI, Semantic Kernel; Vercel AI SDK, Mastra, Claude Agent SDK for TypeScript)
  • ▸Nothing else: no account, no cloud, no model download. AWS (DynamoDB audit, Bedrock Guardrails) is optional.

Install

install
sh
pipx install interlockd     # or: uv tool install interlockd, or: brew install interlockd/tap/interlock
interlock init              # finds your agents, installs hooks, starts the daemon

init prints every change before making it, starts in shadow mode (decide and record, never block), and shows what it would block. Everything it changes is reversed by interlock uninstall.

after a few days
sh
interlock report            # what enforce would have blocked
interlock doctor            # is protection actually on?
interlock enforce           # start blocking

The package is interlockd on PyPI; the command is interlock. Python 3.12+. For JavaScript and TypeScript agents: npm install @interlockd/sdk. Releases carry signed build provenance (gh attestation verify).

Windows: the same two commands in PowerShell or cmd. interlock init installs the agent hooks natively (a Python hook shim, about 60 ms per call) and starts the daemon at sign-in. Only the OS sandbox and the local judge need macOS or Linux; on Windows, use them inside WSL2.

Upgrading from 0.1.x: run interlock restart, then interlock init, before your next agent session. The new hooks only trust a daemon that proves it belongs to your install, which a 0.1.x daemon can't do, so they refuse every call (daemon_identity) until it restarts.

CLI Reference

interlock init [--yes] [--enforce]Detect agents, install hooks, start the daemon (shadow mode).
interlock uninstall [--purge]Remove everything init did.
interlock status | start | stop | restartManage the background daemon. status starts with the protection state (protected, observing, stopped, compromised) and exits 1 when compromised.
interlock log [-n N] [-f]Tail decisions.
interlock report [--days N]What was stopped, or would have been in shadow mode.
interlock doctorCheck protection is on: each unresolved tamper finding with its repair, tamper events since the last ack, baseline coverage, the daemon identity, hooks, the audit log.
interlock ack [-y]Accept the changes behind a tamper finding: lists them, asks, then re-baselines and clears them.
interlock selftest [--shim]Send attack shapes through the live daemon in each agent's hook format, plus a wrong-token check; --shim also proves each installed hook refuses a daemon that isn't yours.
interlock explain [event]Why a call was stopped, in plain language, with the override snippet.
interlock scan [--sarif F]Audit MCP servers and agent settings (CI-friendly).
interlock gateway wrap | unwrap | statusRoute MCP servers through the MCP gateway.
interlock mcp-pins [--accept SERVER]List pinned MCP tool definitions, or accept a server's changed ones.
interlock mcpAn MCP server your agent can ask: would this be blocked? why was that stopped?
interlock aibom -o bom.jsonCycloneDX AI bill of materials.
interlock audit verify | headVerify the hash-chained audit log.
interlock sandbox [--egress URL] -- <agent>Run an agent in an OS sandbox derived from the policy.
interlock egress-proxy [--strict]HTTP(S) proxy that decides every outbound host.
interlock replay [--days N]Re-decide recorded calls with your current policy; see what would change.
interlock policy lintCatch silent policy mistakes (a typo in an override does nothing).
interlock policy diff | accept | revertAfter an edit to policy.yaml outside interlock commands: see what changed, keep it, or restore the pinned copy.
interlock judge install | status | removeRun the optional judge model locally.
interlock captureRecord real hook payloads from an agent; export redacted fixtures.
interlock pluginsList installed plugins (INTERLOCK_PLUGINS=0 turns them off).
interlock token --rotateReplace the daemon token, re-pin it, and restart.
interlock bench [--budget-ms MS]Measure decision latency on this machine, with and without the per-request integrity check.
interlock enforce | shadowSwitch mode.
interlock testRun your policy against the rule corpus (CI gate).
interlock install --kiro|--claude-code|--codexInstall one agent's hooks by hand.

Configuration

Optional. ~/.interlock/config.json is only needed for extras such as the DynamoDB audit table.

~/.interlock/config.json
json
{
  "workspace_roots": ["/path/to/project"],
  "dynamodb_table": "interlock-audit",
  "aws_region": "us-east-1",
  "aws_profile": "your-profile"
}

Policy

Policy is layered YAML (defaults → user → workspace), validated and hashed onto every verdict. Start in shadow mode.

policy.yaml
yaml
version: 1
mode: shadow
trust:
  workspace_roots: ["/path/to/project"]
  allowed_git_remotes: ["github.com/my-org/*"]
  protected_branches: ["main", "master", "release/*"]
packs:
  enabled: [shell, git, egress, persistence, secrets, packages]
mandate:
  mode: log_only
  cedar: mandate.cedar
fail_mode:
  default: open      # daemon stopped with interlock stop: calls run
  tamper: closed     # hook tampered with, or daemon gone without interlock stop: calls refused
notify:
  desktop: false     # true: an OS notification when protection becomes compromised

Mandate (Cedar)

The mandate is an authorization envelope in Cedar — the same language as Amazon Bedrock AgentCore Policy. Permit what's in scope, forbid what never is.

mandate.cedar
cedar
permit (principal, action == Interlock::Action::"git.push", resource)
when { context.input.remote like "github.com/my-org/*" };

forbid (principal, action == Interlock::Action::"git.push", resource)
when { context.input.force == true && context.input.branch == "main" };

forbid (principal, action == Interlock::Action::"sys.privilege", resource);

Looking for the deeper model — the 13-step decision pipeline, the latency budget, and the threat model? Read How It Works →