Skip to content

Drift Guard

Lintsure Drift Guard keeps your AI coding agent to your rules and the code that exists, while it writes. It runs on your machine and needs no account.

Coding agents lose track in long sessions. They forget rules you gave them an hour ago, import packages that don’t exist, edit files they shouldn’t touch and undo fixes that were already verified. Drift Guard watches each edit your agent makes and stays quiet until something drifts. Then it shows the agent the file, the line and the rule, and asks it to go back.

Drift Guard runs on your machine through the Lintsure plugin for Claude Code, and needs no account. It reads your rules from .lintsure/rules.yml in the repo. If you connect a hosted workspace (beta), it also uses the rules your team set there and records each catch. For a shorter overview, see what Drift Guard is for; the plugin’s other guards have their own page.

What it checks, after every edit

Check What it catches
Your rules: avoid in code Code matching a pattern you don’t want, for example personal data in logs or skipped tests. Can be limited to some files.
Your rules: protect files Edits to files or folders agents shouldn’t touch, like migrations that already ran.
Your rules: no new dependencies Packages added to package.json that weren’t in the last commit.
Code that doesn’t exist Imports of files that aren’t there, and packages that aren’t installed or listed.

At the end of each task, the plugin also runs Lintsure’s standard security and privacy checks on the files that changed.

Memory when context is lost

When Claude Code compacts a long conversation, and when a session starts, the plugin puts the project’s memory back in front of the agent. With no account, that is your rules and reminders, what the project already has, and where its functions are. With a workspace it also includes decisions with their reasons, verified fixes and open high findings, and you can see the same memory on the Memory page.

Writing rules

Rules live in .lintsure/rules.yml. Ask your agent to add one in plain words (“Lintsure: never touch the payment code”), or add them on the Rules page if you use a workspace. Write each one as a sentence the agent will read, so it knows why. For example:

  • Don’t add new dependencies without asking me first.
  • Don’t edit database migrations that already ran. (migrations/**)
  • Payments only go through lib/pay.ts. (a reminder, not checked)

A rule that only matters for some files can say so with when: in .lintsure/rules.yml, for example when: "src/payments/**". It stays out of the memory the agent gets at the start, and the agent sees it once, the first time it edits one of those files. That keeps the memory short.

Activity log and private files

Every catch and decision is also written to .lintsure/activity.jsonl in your project, with or without a workspace: the kind of catch, the rule, the file, the line and what happened. Never code, prompts or secrets. npx lintsure export --otlp-json turns it into an OpenTelemetry file. Turn the log off with LINTSURE_ACTIVITY=off.

A file with lintsure:private in its first lines is never named in the log and never shown in the memory.

Other agents

Rules live in .lintsure/rules.yml, so every agent can use the same ones. Ask Claude Code to “share the Lintsure rules with other agents”, or run the rules helper’s sync command. It writes them to AGENTS.md (read by Codex and many other agents), .cursor/rules/lintsure.mdc for Cursor, and to .github/copilot-instructions.md and CLAUDE.md when you have them. Lintsure only writes its own marked part of those files, and keeps them in step when a rule changes.

Other agents read the rules as instructions. Lintsure checks them automatically after each edit in Claude Code with the plugin, and in Cursor, Gemini CLI and Codex through the adapters that ship with it.

Package checks

When your agent adds a package, Lintsure checks it: is the name one letter off a well-known package, does it exist on npm, is it brand new, does it run a script when installed, and does that version have known security holes. For the last four, the package’s name and version are looked up on the public npm registry and in the OSV vulnerability database. Nothing else is sent. Lintsure checks the package your agent picked; it never suggests one. Turn the online part off with LINTSURE_PACKAGES=offline.

What reaches the workspace

The check runs on your machine. With no account, nothing goes to lintsure.com. With a workspace, when it catches something, only the rule, the file, the line and a one-line description go there, never your code. See Open source and the hosted workspace.

What it can’t do

Drift Guard checks what the agent writes, not what it intends. It can’t stop a bad plan before any code exists, and it only holds the agent to rules that are written down. It’s a check, not a guarantee, and not an audit or legal advice.

Turn it off for a session with LINTSURE_DRIFT=off.

Lintsure is a readiness tool, not an audit or legal advice. Results cover code only; a qualified person should review them. Disclaimer