# RuleDrift: Agent Rule Retention Tests

> Test whether your AI agent still follows its critical rules after long or distracting conversations.

RuleDrift: Agent Rule Retention Tests is a free AI agent skill on Agensi by Rivin, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Rivin](https://www.agensi.io/creators/rivin)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Uses: 1
- Version: 1.0
- Last updated: 2026-10-17
- Security: scan passed (2026-10-17); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ruledrift-agent-rule-retention-tests
- Tags: testing, prompt-engineering, llm-ops, node-js, automation

## About this skill

Agents often follow a rule at the start of a session and quietly drop it later. This skill turns your most important instructions into a repeatable test, so you find out before your users do.

**What it does**
- Reads your rules (system prompt, CLAUDE.md, AGENTS.md, policy docs) and turns the checkable ones into a RuleDrift suite.
- Builds background conversations that pull attention away from the rules, then probes each rule in isolation at the turns you choose.
- Validates and runs the suite through the open-source rule-drift MCP server or CLI.
- Reports the pass rate per rule and the first turn where a rule failed, suggests fixes, and re-runs.

**Good for**
- Changing a system prompt, model, memory or compaction strategy.
- Regression tests for agent instructions in CI (JUnit and JSON reports, stable exit codes).
- Answering "why does my agent forget this rule an hour into a session?"

**How it runs**
- Free local mode with Ollama: no API key, account or bill.
- Test your real agent through a small command adapter (JSON in, JSON out).
- No telemetry. Reports leave out model responses unless you ask for them.

**Requirements:** Node.js 22 or newer. Ollama for the free local mode, or your own agent behind the command adapter.

Built on RuleDrift, MIT licensed: https://github.com/ri7in/rule-drift

## Requires

- Node.js 22+
- rule-drift (npm, MIT)
- Optional: Ollama

## Known limitations

Requires Node.js 22+. Checks rules with deterministic assertions (contains, equals, regex), so it cannot grade rules that need human judgment. Needs Ollama or a small command adapter that connects your agent. A passing suite only covers the scenarios and assertions you write.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the RuleDrift: Agent Rule Retention Tests skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What is rule drift?

An agent can follow a rule early in a session and stop following it as the conversation grows. This skill builds a test that probes each rule at the turns you choose and reports the first point where it failed.

### What is included?

A SKILL.md with the full workflow (collect rules, design scenarios, validate, run, report) and one starter suite template. RuleDrift itself, the CLI and the MCP server, is a free MIT-licensed npm package that the skill runs with npx.

### Which agents and models can I test?

Any agent or model you can call from a small script. The command adapter sends the conversation as JSON on stdin and reads the reply as JSON on stdout. Ollama works out of the box for free local runs. The MCP server works with clients that support local stdio MCP servers, such as Claude Code.

### How hard is the setup?

You need Node.js 22 or newer. Add the MCP server with one command, or run npx rule-drift init in your project. The skill then writes the suite with you: your rules, the background turns, and where to probe.

### Can it grade tone or helpfulness?

No. Checks are deterministic: contains, does not contain, equals, and regular expressions. Use it for hard rules such as formats, names, secrets and refusals, not for tone.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
