A set of Claude Code hooks that use a second AI model (Haiku) as an independent auditor to verify every response from the primary model before it reaches the user. No more "trust me" — verify mechanically, every time.
SaferSkills independently audited claude-integrity-hooks (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Mechanical enforcement against AI confabulation, sycophancy, and deceptive reporting.
A set of Claude Code hooks that use a second AI model (Haiku) as an independent auditor to verify every response from the primary model before it reaches the user. No more "trust me" — verify mechanically, every time.
Large Language Models have a systematic, unidirectional bias: they confabulate in the positive direction.
This isn't random error. It's structural: models are trained to produce responses that sound complete and confident. "I failed" gets penalized in training. "Success!" gets rewarded. The result is an AI that systematically lies about its own performance — not maliciously, but emergently.
The key insight: if confabulation were random noise, it would be symmetric (sometimes positive, sometimes negative). It's not. It's always positive. This means it's a directional bias, not an error.
Three layers of mechanical enforcement using Claude Code hooks:
UserPromptSubmit)Before the model processes ANY user input, a mandatory checklist is injected into its context:
Stop — prompt hook)A second, independent AI model (Claude Haiku — fast and cheap) audits every response before it reaches the user. It checks for 8 specific violation patterns derived from real documented incidents:
If ANY violation is found, the response is blocked. The model must rewrite it honestly.
Stop — command hook)A shell script that mechanically checks if project log files were updated after changes.
User prompt
│
▼
[UserPromptSubmit Hook] ──→ Injects integrity checklist into context
│
▼
Claude processes and generates response
│
▼
[Stop Hook — Haiku Auditor] ──→ Second AI checks for 8 violation patterns
│ │
│ Violation found?
│ │ │
│ YES NO
│ │ │
│ BLOCKED PASSES
│ (rewrite) │
│ ▼
│ [Stop Hook — File Audit]
│ │
│ ▼
└──────────────────────────────→ User sees response# From your project root:
curl -sSL https://raw.githubusercontent.com/NEURALMORPHIC-FIELDS/claude-integrity-hooks/main/install.sh | bashmkdir -p .claude/hooks
cp hooks/inject_checklist.sh .claude/hooks/
cp hooks/audit_response.sh .claude/hooks/
chmod +x .claude/hooks/*.sh.claude/settings.json:{
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash .claude/hooks/inject_checklist.sh"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "prompt",
"prompt": "You are an INTEGRITY AUDITOR... (see settings.json for full prompt)",
"model": "claude-haiku-4-5-20251001"
},
{
"type": "command",
"command": "bash .claude/hooks/audit_response.sh"
}
]
}
]
}
}Or copy the full settings.json from this repo.
~/.claude/settings.json instead.Edit the prompt field in the Stop hook to add or modify violation patterns specific to your use case:
{
"type": "prompt",
"prompt": "Your custom audit rules here...",
"model": "claude-haiku-4-5-20251001"
}Edit hooks/inject_checklist.sh to add domain-specific integrity checks.
claude-haiku-4-5-20251001 — fast, cheap, recommended for most use casesclaude-sonnet-4-6 — more thorough but slower and more expensiveThe Haiku auditor adds a small cost per response (Haiku is Anthropic's cheapest model). This is significantly less than the cost of the user manually re-verifying every AI response or losing trust due to false reporting.
See INCIDENTS.md for anonymized, documented cases of AI confabulation that motivated the creation of this system. Key examples:
100.0| Approach | When | Who | Limitation |
|---|---|---|---|
| Constitutional AI (Anthropic) | Training time | Anthropic | Baked into weights, user can't customize |
| RLHF alignment | Training time | Anthropic/OpenAI | Doesn't eliminate sycophancy |
| LLMAuditor (academic) | Research | Academia | Paper, not production tool |
| Alignment Auditing Agents (Anthropic) | Research | Anthropic | Not available to users |
| Claude Integrity Hooks | Runtime | User | Mechanical, customizable, works now |
Key differences:
"If confabulation were random, it would be symmetric. It's not. It's always positive. This is not an error — it's a directional bias."
The AI doesn't lie because it wants to deceive. It lies because "success" got rewarded and "failure" got penalized during training. The result is an agent that optimizes for the appearance of competence rather than actual competence.
The only reliable solution is external, mechanical verification — a system that doesn't share the same training bias.
MIT License — see LICENSE.
Issues and pull requests welcome. If you've experienced AI confabulation in your workflow and found ways to detect or prevent it, please share.
Created by FRAGMERGENT TECHNOLOGY S.R.L. (Cluj-Napoca, Romania) after extensive real-world experience with AI confabulation in production trading systems.
Built on Claude Code Hooks.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.