airlock

xdlc-labs/airlock Checked 2 days ago

CI release gate for AI agents.

Your coding agent widened its own MCP write access in a pull request.Nothing in CI noticed. Your test suite checks that the code still works. It does not check that the agent still behaves. A prompt gets reworded, a skill lands, an MCP server picks up a write permission, a provider swaps the model behind a stable string, and every check stays green because no test asserts on any of it. Airlock is a release gate for that surface.

Summary extracted from the README.


Your test suite checks that the code still works. It does not check that the agent still behaves. A prompt gets reworded, a skill lands, an MCP server picks up a write permission, a provider swaps the model behind a stable string, and every check stays green because no test asserts on any of it.

Airlock is a release gate for that surface. It treats prompts, skills, tools, MCP servers, models, judges, and eval sets as one releasable unit, diffs what changed, evaluates behavior against policy with confidence intervals, and then passes, fails, or holds the pull request for a human.

That is the whole point in twelve seconds. The evals pass. The gate still blocks, because the blast radius includes a new write permission on an MCP server, and that needs a person. Walk through it below on the toy agent.

  • Local-first. State lives in .airlock/ in your own repo. Nothing uploads.
  • No API keys to try it. The toy agent uses a mock provider.
  • Beside your eval platform, not instead of it. Keep LangSmith or Promptfoo.

Install

Linux, macOS, and Windows, amd64 and arm64.

curl -sSL https://raw.githubusercontent.com/xdlc-labs/airlock/main/install.sh | bash
# a specific version: AIRLOCK_VERSION=v1.0.2 bash
# or: go install github.com/xdlc-labs/airlock/cmd/airlock@v1.0.2

The script installs the newest stable release. On Windows run it from Git Bash, or download the windows zip from Releases and put airlock.exe on your PATH.

Break a prompt, watch Airlock catch it

Clone this repository. The toy agent in testdata/toy-agent ships prompts, a skill, one MCP server, and eval cases.

cd testdata/toy-agent
airlock init && airlock snapshot
╭─ airlock init ─────────────────────────────────────────────────────────╮
│ agents  1     models  1     prompts  2                                 │
│ tools   0     skills  1     mcp      2                                 │
│ evals   2                                                              │
│                                                                        │
│ wrote  .airlock/manifest.json                                          │
│ commit .airlock/policy.yml  (.airlock/.gitignore keeps the rest local) │
╰────────────────────────────────────────────────────────────────────────╯
╭─ snapshot ───────────────────────────────────╮
│ dca3ae3e3db0bd58                             │
│ artifacts  10    manifest  1ed9ab1f53b8      │
╰──────────────────────────────────────────────╯

Now reword the system prompt and ask what it touches:

echo "You are a DIFFERENT support agent." >> prompts/system.md
airlock diff
╭─ airlock ───────────────────────────────────────────────────╮
│ base  dca3ae3e3db0bd58                                      │
│ head  working-f78985673552                                  │
│                                                             │
│ changed                                                     │
│   ~  env          toy-env              04c19f51 -> 9fca1701 │
│   ~  prompt       system-prompt        a68e98e0 -> 31125b19 │
│                                                             │
│ blast radius                                                │
│   agents  support-bot                                       │
╰─────────────────────────────────────────────────────────────╯

diff compares the working tree against the last snapshot, so take the snapshot before you make the change. The toy agent's env.json bundles that prompt into an environment artifact, which is why two artifacts move for one edit.

Then run the evals against the mock provider:

airlock test --mode replay
╭─ eval ────────────────────────────────────────────────────────────╮
│ metric               rate             95% CI  gate                │
│ json_valid        100.0%  [ 89.3%, 100.0%]  PASS                  │
│     CI low 0.8928 >= min 0.8000                                   │
│ task_success            -                  -  SKIPPED             │
│     no baseline result to compare against — run `airlock baseline │
│     create` (or pass --base) to enable this gate                  │
│ tool_success      100.0%  [ 80.6%, 100.0%]  PASS                  │
│     CI low 0.8064 >= min 0.8000                                   │
╰───────────────────────────────────────────────────────────────────╯
╭─ verdict ─────────────────────────────────────────────────────╮
│ PASS                                                          │
│ samples=48  cost=$0.0048  wrote  .airlock/results/latest.json │
╰───────────────────────────────────────────────────────────────╯

Gates fire on confidence intervals, never on a point estimate. A comparative gate with no baseline yet reports SKIPPED rather than inventing a verdict. Local airlock test still PASSes. In CI, fail_on.inconclusive (what airlock init writes) treats SKIPPED like INCONCLUSIVE and blocks the merge. The GitHub Action evals the merge-base tree so that gate has a real baseline.

Now the interesting one. Widen an MCP server's permissions instead:

# add "write" under mcp.local-fs.permissions in apm.lock.yaml
airlock ci --fail-on-approval
╭─ airlock ───────────────────────────────────────────────────╮
│ base  dca3ae3e3db0bd58                                      │
│ head  working-71cd85c12f4e                                  │
│                                                             │
│ changed                                                     │
│   ~  mcp          local-fs             e1156c01 -> 05e044b6 │
│                                                             │
│ blast radius                                                │
│   agents  support-bot                                       │
│                                                             │
│   MCP new permission write on local-fs                      │
│   MCP permissions expanded: local-fs                        │
╰─────────────────────────────────────────────────────────────╯
╭─ verdict ───────────────────────────────────────────────────────────╮
│ NEEDS_APPROVAL                                                      │
│ airlock approve --base dca3ae3e3db0bd58 --head working-71cd85c12f4e │
│ wrote  .airlock/ci-comment.md                                       │
╰─────────────────────────────────────────────────────────────────────╯
error: airlock ci: NEEDS_APPROVAL without ledger entry
exit 1

Adding a skill, widening a write tool, or a live MCP server growing a new tool in its tools/list all take the same path. Locally, airlock approve records the decision in a ledger so the next run knows a human said yes. On GitHub the sign-off is an ordinary pull request review, and nothing has to be committed: see Use it on your repo.

Reading tool lists from stdio MCP servers

Servers with an http(s) url are asked for their tools/list on every scan. A server configured with a command has to be started to answer, so init, snapshot, diff, and ci only do that when you pass --mcp-stdio:

airlock snapshot --mcp-stdio

This runs the commands in your MCP config, with this process's environment, from the repository root. Do not enable it on a workflow that builds pull requests from forks: the command comes from the branch under test. Probing on a machine you trust and committing the resulting .airlock/manifest.json gives CI the tool list without CI ever starting a server: a scan that does not probe reuses the committed list for as long as that server's config entry is unchanged. airlock init ignores the manifest by default, so uncomment the !manifest.json line in .airlock/.gitignore to commit it. Without the flag and without a committed list, a stdio server is tracked by its config hash, so a changed command or args is still caught.

The full walkthrough, including --mode live, judges, drift, and the production loop, is in the developer guide.

Use it on your repo

# .github/workflows/airlock.yml
name: Airlock
on:
  pull_request:
  pull_request_review:
    types: [submitted, dismissed]
permissions:
  contents: read
  pull-requests: write
jobs:
  airlock:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: xdlc-labs/airlock@v1

That is the whole install. @v1 tracks the newest release, or pin an exact tag if you would rather move deliberately. The Action diffs merge-base against HEAD, writes .airlock/ci-comment.md, and comments on the pull request. It fails closed on permission expansion by default.

Unblocking a NEEDS_APPROVAL on GitHub

Approve the pull request. That is the whole procedure. The Action reads the reviews on the pull request and takes an approving review from someone with write access as the human sign-off, as long as the review is on the current head commit. A new push asks again, a Request changes withdraws, and the author cannot approve their own change. The pull_request_review trigger above is what re-runs the gate when the review lands.

This is why nothing under .airlock/ has to be committed to unblock a merge, and why the pull request that widens a tool cannot also carry the file that turns its own check green. Layer branch protection on top as usual: a required review, and CODEOWNERS on .airlock/policy.yml, **/SKILL.md, and your MCP config, so the people who own the agent surface are the ones who approve it.

Prefer a committed ledger anyway, for a CI system without reviews or an audit trail that lives in the repository? Set github-approvals: "false" on the Action, delete the approvals/ line from .airlock/.gitignore, and commit what airlock approve writes.

airlock init writes a .airlock/.gitignore that keeps generated state (manifest, snapshots, the latest result, the comment file) out of your repository, and a .airlock/policy.yml stub you commit and tune. The policy starts fail-closed:

fail_on:
  approval: true      # a change needing human sign-off blocks the merge
  eval: true          # a failing eval gate blocks the merge
  inconclusive: true  # an undecided gate blocks instead of passing quietly
  sentinel: true      # silent provider drift blocks the merge
  ai_change: false    # strictest: block every AI-artifact change

Gates live in the file so a workflow cannot forget them; the --fail-on-* flags still work and still win, since a flag can only turn a gate on. A repo whose policy predates this block keeps its old behavior and says so once per run.

The default mins are strict on purpose: a 0.99 gate needs at least 381 clean samples before a 95% interval can clear it, so if you leave the sample budget low that gate will report INCONCLUSIVE forever. Airlock now tells you the number it needs. Raise max_samples_per_case, lower the min, or leave fail_on.inconclusive on so an undecided gate blocks instead of passing quietly.

What it gates, and what it does not

Airlock gates AI release risk on the pull request. It is not a general application security scanner.

Airlock blocks Keep using
MCP, write-tool, and skill permission expansion (--fail-on-approval) CodeQL and other SAST
Eval regressions and undecided gates (--fail-on-eval, --fail-on-inconclusive) Dependabot, Socket, cargo-vet
PII or secrets appearing in model input and output (data_boundary.fail_on_pii) Repository secret scanning
A new dependency riding along with a prompt, skill, or MCP change SCA on dependency-only pull requests

That last row is the narrow claim worth being precise about: a dependency bump on its own is Dependabot's job and Airlock stays quiet. It speaks up when an AI-artifact change and a new dependency arrive in the same pull request, which is what an agent proposing its own tools looks like. Airlock does not check whether a package is malware. Keep the scanners.

If you already use LangSmith, Braintrust, Langfuse, or Phoenix

Keep them. They trace runs, hold datasets, and let you iterate on prompts in a UI. Airlock is the ship-or-block decision on the pull request, which none of them make for you. Point Airlock at eval cases you already trust with airlock import promptfoo|langsmith|braintrust, feed production signal through airlock ingest otel, and leave your traces where they are.

A LangSmith dataset can be pulled straight from the API instead of exporting it by hand:

export LANGSMITH_API_KEY=...            # or LANGCHAIN_API_KEY
airlock import langsmith --dataset support-golden        # or a dataset id
airlock import langsmith --dataset support-golden --limit 200

Cases land in .airlock/evals/langsmith.jsonl, the same place the file import writes them, so test and ci pick them up unchanged. Self-hosted LangSmith: point --api-url (or LANGSMITH_ENDPOINT) at your host, including any /api/v1 prefix it serves. The pull reads datasets only — traces, online eval scores, and annotation queues stay where they are, and there is no hosted dashboard here at all.

What is in the box

init and snapshot build a content-addressed record of the AI system. Snapshot ids stay stable across CI runs: generated_at and the absolute root path are not hashed. diff reports what moved and which agents it reaches. test and ci run statistical evals and decide. approve and rollback handle human gates and re-pinning a known-good release. sentinel fingerprints upstream models so you notice when a provider changes one under a stable name. ingest otel, baseline, and drift close the loop from production. history --serve gives you a read-only local UI.

--mcp-stdio on init, snapshot, diff, and ci starts stdio MCP servers to read their live tool list. It is off by default because that runs the commands your MCP config names.

Discovery covers APM lockfiles, Agent Skills, Cursor rules, agent instruction files (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules, .windsurfrules, Copilot instructions, .claude/agents/*.md), MCP configs, prompt files, Promptfoo suites, go.sum, package-lock.json, pnpm-lock.yaml, yarn.lock, Cargo.lock, poetry.lock, Pipfile.lock, uv.lock, and heuristics for the OpenAI SDK, the Anthropic SDK, LangGraph, LlamaIndex, CrewAI, AutoGen, and the Vercel AI SDK. It is not every framework. The guide lists exactly what is and is not detected today. Discovery is heuristic where no lockfile exists: a Go SDK that names its model through an exported constant stays invisible, and an undiscovered artifact is one the gate cannot diff. Declare it in apm.lock.yaml and it is gated like the rest.

Status

Stable. The CLI, the .airlock/ layout, and the Action inputs follow SemVer from 1.0: a breaking change means a new major. No telemetry, no hosted control plane, nothing uploads by default.

Guide · Changelog · Contributing · Security · Apache-2.0