# AI Agent Anti-Drift & Anti-Sycophancy Guardrail

> Ensure your AI agent prioritizes facts and security over being "nice" by blocking sycophancy and logging its confidence.

AI Agent Anti-Drift & Anti-Sycophancy Guardrail is a free AI agent skill on Agensi by Ismael Coulibaly, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Ismael Coulibaly](https://www.agensi.io/creators/cism-ch)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 2.2.1
- Last updated: 2026-12-04
- Security: scan passed (2026-12-04); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ai-agent-anti-drift-anti-sycophancy-guardrail
- Tags: ai-agents, prompt-engineering, llm-ops, agents-orchestration, prompt-skill-engineering, code-quality-review

## What it does

- Forces the agent to prioritize technical truth over being polite or agreeable
- Strips away jokes and personality during critical tasks like coding or math
- Assigns a confidence score to every answer so you know when the AI is guessing
- Flags false assumptions in your requests before they become bugs in your code
- Writes a hidden log of all corrections and technical decisions to your project folder
- Pauses and asks for more info if it has less than 40% certainty about a task

## Who it's for

- **Founders building a first version of their app:** Keep your AI agent from agreeing with bad ideas or writing broken code just to be nice. Try: "Check if my database setup is safe for user passwords."
- **Freelance developers and engineers:** Stop your AI from guessing library versions or making up code when it does not know the answer. Try: "Update the payment logic and flag anything you are not 100% sure about."
- **Technical project managers:** Get a clear log of when your AI agent had to correct a mistake or struggled with a task. Try: "Show me the debug log for the last three coding tasks."

## About this skill

**Cognitive Persona Arbiter (v2.1)** is a lightweight, offline cognitive regulation middleware for AI coding agents. It prevents persona drift, blocks sycophancy, enforces epistemic confidence calibration, and records lock-safe project telemetry without polluting the model's context window.

### What It Does
- **Deterministic Mode Routing:** Classifies every turn (`deterministic`, `analytical`, `conversational`) and automatically flips `persona_override: true` on code, SQL, regex, JSON/YAML, CLI, math, schema validation, critical debugging, and architecture trade-offs—stripping humor, backstory, and stylistic noise.
- **Anti-Sycophancy Arbitration Hierarchy:** Enforces a strict 4-tier priority order where factual integrity, security, and direct premise correction always outrank persona warmth or agreeableness.
- **Epistemic Confidence Calibration:** Applies a 4-band confidence scale (`0.90–1.00`, `0.65–0.89`, `0.40–0.64`, `< 0.40`) so the agent never fabricates unverified APIs or library versions to sound authoritative, logging explicit gaps in `assumptions`.
- **Anti-Context Rot Architecture:** The LLM only ever reads a compact 10-line `.agent/telemetry/arbiter_state.json` snapshot (strictly enforced `<= 15` lines). Long-term events go to append-only `.agent/telemetry/arbiter_history.jsonl`, analyzed offline via CLI.
- **Lock-Safe Atomic Recorder & Audit CLI:** Ships with `scripts/arbiter_audit.py` (Python 3.9+ stdlib only) supporting `--record` (OS-level file locking across Windows/macOS/Linux + atomic `os.replace()`), `--strict` CI validation, and `--json` output.
- **Controlled Visibility:** Completely silent on clean conversational turns; appends a single compact `> [Arbiter] ...` footer when an arbitration triggers, and runs a full diagnostic on `/arbiter-debug`.

## Requires

- Python 3.9+

Uses Python standard library only (zero third-party packages, 100% offline). Manual telemetry fallback works even without terminal access.

## Known limitations

Like all Agent Skills using progressive disclosure, this protocol governs the active session once loaded rather than persisting automatically into future sessions without a project-level rule. If an environment blocks terminal execution, the agent falls back to manual telemetry updates without automated CLI locking or schema validation.

## Technical details

Built with a Python-based audit script (scripts/arbiter_audit.py) that uses atomic file locking for telemetry. It maintains state in .agent/telemetry/arbiter_state.json and appends history to a .jsonl file. It uses a 4-tier arbitration hierarchy to resolve conflicts between persona instructions and factual integrity. Compatible with any environment that can execute Python and manage local file systems.

## 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 AI Agent Anti-Drift & Anti-Sycophancy Guardrail 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

### Does this add noisy boilerplate to every reply?

No. Normal turns with no persona override and no detected bottlenecks stay 100% silent and write nothing to disk. A single compact footer line is appended only when an arbitration triggers.

### Will the telemetry logs bloat my agent's context window over time?

No. The protocol forbids reading arbiter_history.jsonl into context. Only the 10-line arbiter_state.json snapshot may be read, and the bundled audit script enforces the <= 15-line limit.

### Does it require API keys, internet access, or third-party Python packages?

Yes. It runs 100% offline using Python 3.9+ standard library only, with cross-platform OS file locking (msvcrt on Windows, fcntl on Linux/macOS) for safe multi-agent writes. If terminal access is unavailable, it falls back cleanly to manual template updates.

### Will .agent/telemetry/ clutter my Git commits?

Add .agent/telemetry/ to your project's .gitignore to keep telemetry local-only while still auditing it anytime with /arbiter-debug or scripts/arbiter_audit.py --strict.

---

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.
