driftlock
v3.3.4
Published
AI agent scope enforcement for production codebases.
Maintainers
Readme
npm install -g driftlockdriftlock solves a specific, well-documented problem: AI coding agents frequently exhibit scope creep — modifying files outside the intended change — and lack persistent project memory across sessions.
driftlock acts as a physical guardrail (via a pre-commit hook) and an architectural memory bank (via the context block) to keep agents strictly confined to their authorized scope.
🛡️ Core Protection Features (The Guardrails)
- File & Function Locks: Surgical locking of specific files or even individual AST functions. If an AI agent tries to modify a locked function, the pre-commit hook hard-blocks it.
- Production Path Seals: Permanent locks for critical paths (like billing or auth). These cannot be unlocked normally and require explicit human sign-off via a PR or Jira ticket (
driftlock unseal --human-approved=<ticket>). - Secret Sentinel: A hard-blocking scanner that physically prevents agents from hallucinating and accidentally committing AWS keys, Stripe tokens, or
.envleaks. - Test Coverage Gate: Strict enforcement that blocks any source code changes made by AI agents that aren't accompanied by corresponding tests.
- Dependency Lockdown: Zero-trust dependency management. Automatically locks
package.jsonon init to prevent silent dependency drift and hallucinated packages.
🛠️ Agent Tools (The Tooling)
- Blast Radius Map: Prevent scope creep before it happens. Agents can run
driftlock impact <file>to see every file in the codebase that imports a target file before they touch it. - Rollback Snapshots: Run
driftlock savebefore an agent starts working. If the agent hallucinates or breaks the project,driftlock restoreacts as an instant escape hatch to obliterate rogue changes and restore the clean snapshot. - Context Generation: Agents run
driftlock contextto generate a token-efficient map of locked vs. active boundaries to feed into their own system prompts.
🤖 The 7 Native AI Skills (Drop-in for Claude/Antigravity/Cline)
Driftlock ships with 7 markdown-based Agent Skills. If your team uses an agent framework, you just point it to these folders and the AI automatically learns how to use Driftlock safely:
scope-enforcementdependency-lockdownsecret-sentineltest-coverage-gaterollback-snapshotblast-radiusproduction-path-lock
Commands & Tiers
Driftlock commands are gated by license tier (Free, Pro, Team).
🟢 Free Tier (No license required)
driftlock init— Scan repo, generate.driftlock.jsondriftlock lock <file>[:<func>] [reason]— Lock a file or functiondriftlock unlock <file>[:<func>] <reason>— Unlock a targetdriftlock status— Print manifest summary
🟡 Pro Tier (Requires Pro License)
driftlock save— Auto-snapshot repo state before an agent sessiondriftlock restore— Rollback to the last snapshotdriftlock impact <file>— Show all files that import this filedriftlock context [task]— Generate AI context block for a taskdriftlock guard [--tests]— Check git diff for violations and secret leaksdriftlock seal <file> <reason>— Permanent lock for production paths
🔵 Team Tier (Requires Team License)
driftlock unseal <file> --human-approved=<ticket> <reason>— Release a sealed pathdriftlock trust <file> <reason>— Bypass Secret Sentinel for a specific file (Security Override)driftlock godmode <file>— Advanced cross-file refactoring with automated boundary expansiondriftlock scout— Autonomous repository scanning for architectural driftdriftlock audit <branch>— AI-driven security and scope-violation auditing for team PRs
License Activation
Get your license here: Driftlock Gumroad
# Activate your license
driftlock login <license-key>
# Check your tier and status
driftlock whoami
# Clear local license cache
driftlock logoutData Model
All state is stored in .driftlock.json at the root of your repo.
The manifest is project state, not a personal config. Commit it so your whole team — and all their AI agents — share the same scope boundaries.
