← Back to projects
agent skill

Context Drift Detector

Flags when your agent goes against a decision you already made.

What it does

It checks an agent's current plan, answer or diff against decisions you've already made, like which database to use or an approach you already turned down. If something contradicts an earlier decision, it points to where and explains what it would affect.

Why it's useful

On long tasks the agent's context gets summarized, or a new session picks up the work, and earlier decisions get lost along the way. The code can run fine and still not match what you agreed on.

If you explicitly changed your mind later, the newer decision wins, so your own changes of direction don't get flagged.

When the earlier conversation isn't available, it says so and marks the finding as unknown rather than guessing. For longer projects you can ask it to keep a context ledger, a short file of confirmed decisions that each audit checks against.

How it labels what it finds

Aligned
Consistent with what was agreed.
Authorized change
Different, but you explicitly approved it later.
Potential drift
Looks like a contradiction, but the earlier intent is fuzzy.
Confirmed drift
Contradicts a clear decision that still applies.
Unknown
There isn't enough history to tell, and the report says so.

Audit mode (default)

It only reads and reports. It doesn't edit or revert anything, so what happens next is up to you.

Strict mode (ask for it)

The agent stops and asks you before doing anything the skill would flag. This is an instruction to the agent rather than something enforced, so it depends on the agent following it.

What a report looks like

illustrative example

Context Drift Audit
Baseline: context-ledger.md (12 decisions), current diff
Mode: Audit

Findings
  Confirmed drift · high
    Earlier: PostgreSQL is the primary datastore (ledger D-03)
    Now: adds mongoose and a MongoDB client in src/db/
    Why it matters: two databases to run, back up and migrate
    Fix: keep Postgres, or confirm the switch and update D-03

Verdict: Drift detected
Next action: ask whether the MongoDB move was intended.

Install

The skill is a folder with a SKILL.md in it, following the Agent Skills format. There's nothing to build or run, and it doesn't need an API key.

  1. 01Claude Code

    Clone it into your personal skills folder to use it in every project.

    $ git clone https://github.com/ritenv/context-drift-detector ~/.claude/skills/context-drift-detector

    To use it in a single repo, clone it into .claude/skills/context-drift-detector at the project root instead. If you commit that folder, everyone working on the repo gets the skill.

  2. 02Claude apps

    Zip the folder and upload it as a custom skill from Settings in claude.ai or the desktop app.

    $ git clone https://github.com/ritenv/context-drift-detector && zip -r context-drift-detector.zip context-drift-detector -x "*.git*"
  3. 03Codex, Cursor and other agents

    If your agent supports Agent Skills, drop the folder into its skills directory. If it doesn't, paste the contents of SKILL.md into your project instructions (AGENTS.md, a rules file, or a system prompt) and the agent can follow it from there.

What's in the folder

  • context-drift-detector/
  • SKILL.md
  • README.md
  • references/classification-guide.md
  • templates/context-ledger.md

Example prompts

Agents can pick the skill up on their own when a task matches its description, but naming it in your prompt is more reliable.

  • Use context-drift-detector to audit this implementation plan against our prior decisions.
  • Run a context drift audit on the current Git diff.
  • Enable strict mode for this task and flag any deviation from our agreed architecture before coding.
  • Create a proposed context ledger from the project docs and ask me to confirm it.

Other skills