Agent contract lockfile
Lock the observed agent-contract surface.
Fetch the observed agent-contract lockfile (coderifts.lock v1), or check MCP drift of a locked manifest against a live one.
If you’ve used package-lock.json, the idea is familiar: coderifts.lock pins the agent-contract surface your agents actually touched, so you can tell when it drifts.
What coderifts lock creates
The CLI fetches the observed agent-contract lockfile from GET /api/v1/lock. Lock v1 records agents/ops, not MCP tool bodies.
README boundary: write mode requires a cloud API key.
Drift detection with --check
--check compares a locked MCP manifest against a live one and scores the difference against a catalogue of known risk signals. It is monitor only — it does not block. ⚠ Note what --check is not: the lockfile itself records agents and ops, not MCP tool bodies. --check is the separate drift comparison, and it reads the manifests you hand it.
Unreachable live → status unreachable (not drift).
--check exit codes: 0 unchanged; 3 drift; 2 unreachable / missing locked or live (not clean); 1 usage/error.
In the coderifts@8.9.1 release (lock --help: --scope-label <text> “With --live-url: a label for the authorization scope, written to source.scope.label (pin) or compared with it (--check); one line, at most 64 characters”). Which authorization scope a pin was taken under (source.scope). A server can answer different clients or keys with different tool lists, so a pin records the scope it saw, when it is known: the auth-bearing request header names that were sent (authorization, x-api-key, cookie, and any name containing token, key, auth or secret), lower-cased and sorted; the server’s own serverInfo {name, version} from initialize; and the --scope-label you gave. It records names, never a header value, a hash of one or its length. --check against a live server compares that scope with the call it just made and prints one line: scope: matches, scope differs: <key> pin … check …, or scope: not recorded in this lock for a pin written before this field (or one where nothing was known). A difference is a warning, not drift: the status, the drift verdict and the exit code are computed exactly as without it (--json adds scope_check).
How to use it
The CLI README gives these commands for creating the lockfile and checking a locked manifest against a live manifest:
coderifts lock owner/repo
coderifts lock --check --locked-manifest mcp.json --live-manifest live.json
Run on 2026-11-13 against coderifts@8.9.1, the published version that day (npx -y coderifts@8.9.1), with two one-tool manifests that differ only in the tool's description. The --check form needs no key and exited 3; coderifts lock owner/repo does need one and exited 1 (Error: no API key. Run `coderifts login` or set CODERIFTS_API_KEY.).
$ coderifts lock --check --locked-manifest locked.json --live-manifest live.json
CodeRifts lock --check (MCP drift monitor)
Monitor only — does not block. Drift is a scored finding, not an accusation.
status: drift
drift: true
max_risk: 0
summary: MCP manifest DIFFERS from the locked baseline (content hashes disagree), but no catalogued risk signal explains the difference. Treated as drift: an unrecognised change is still a change. Compare the manifests directly — the signal catalog is not exhaustive.
[default] drift
risk_score: 0 level: NO_CHANGE
locked: sha256:a67bb3b66e23b21…
live: sha256:5ea0b3328743f08…
Read the last sentence of the tool’s own output: the signal catalog is not exhaustive. A max_risk: 0 drift is still a drift.