Agent skill

dehallucination

Use when verifying that AI-generated claims, references, or assertions are grounded in reality. Triggers: 'does this actually exist', 'is this real', 'did you hallucinate', 'verify these references', 'check if this is fabricated', 'reality check', 'ground truth'. Invoked as quality gate by develop and deep-research. NOT for: verifying technical claims in code (use fact-checking).

Stars 5
Forks 2

Install this agent skill to your Project

npx add-skill https://github.com/axiomantic/spellbook/tree/main/skills/dehallucination

SKILL.md

Dehallucination

<ROLE>Factual Verification Specialist. Adhere to AGENTS.spellbook.md.</ROLE>

Before verification: artifact under review, context sources, specific concerns, verification scope.

After verification: claims assessed, confidence levels assigned, hallucinations flagged.

Invariant Principles

  1. Verify first: Always check Tier 1-5 sources before accepting a claim.
  2. Citation required: Every verdict must cite specific evidence.
  3. Trace spread: When a hallucination is found, check all dependent artifacts.

Inputs / Outputs

Input Required Description
artifact_path Yes Path to artifact to verify
context_sources No Paths to context files for verification
feedback No Roundtable feedback indicating hallucination concerns
Output Type Description
verification_report Inline Claims and their status
corrected_artifact File Artifact with hallucinations corrected
confidence_map Inline Map of claims to confidence levels

Hallucination Categories

Category Pattern Detection
Fabricated References Citing non-existent files, functions, APIs Check if path/function/endpoint exists
Invented Capabilities Asserting features that don't exist Verify against actual library/framework API
False Constraints Stating non-existent limitations Check if constraint is documented
Phantom Dependencies Assuming unavailable dependencies Check requirements, config
Temporal Confusion Mixing planned vs implemented Check current codebase state

Confidence Levels (Guidelines)

Level Evidence Required
VERIFIED Direct evidence (file, code, docs)
HIGH Multiple supporting signals
LOW Limited or conflicting evidence
HALLUCINATION Evidence contradicts claim

Assessment Process

  1. Extract claims: existence, capability, constraint, relationship statements
  2. Categorize by risk: Critical (security, deps, APIs) > High (implementation) > Medium (config) > Low (docs)
  3. CoVe on categorization: Run self-interrogation on risk assignments (per skills/shared-references/cove-protocol.md). Verify category and risk level accuracy before proceeding.
  4. Verify critical first: Check, document, assign confidence, flag HALLUCINATION if contradicted
  5. Report: Summary stats, critical hallucinations (blocking), warnings, coverage

Recovery Protocol

  1. Isolate: Exact text, location, dependents
  2. Trace propagation: Other artifacts referencing this claim
  3. Correct at source: Mark as corrected with reason and evidence
  4. Update dependents: Flag for re-validation
  5. Document lesson: Record in accumulated_knowledge

Example

  1. Extract claim: existence (UserValidator in src/validators.py)
  2. Check: grep -n "class UserValidator" src/validators.py
  3. Result: class not found
  4. Assessment: CLAIM: "UserValidator exists" | TYPE: existence | EVIDENCE: grep found no match | CONFIDENCE: HALLUCINATION
  5. Recovery: Correct to "Create new UserValidator class" or find actual validator location

Integration with Develop Workflow

Invoke after: gathering-requirements (verify codebase claims), brainstorming (verify technical capabilities), writing-plans (verify implementation assumptions), roundtable flags hallucination concerns.

Self-Check

  • Critical claims extracted and categorized
  • Verification attempted for critical/high-risk claims
  • Confidence levels assigned with evidence
  • HALLUCINATION findings have corrections
  • Propagation checked
  • Report generated

<FINAL_EMPHASIS> Hallucinations are confident lies. Every claim needs evidence or explicit uncertainty. When you find one, trace its spread and correct at source. The development workflow depends on factual grounding. </FINAL_EMPHASIS>

Expand your agent's capabilities with these related and highly-rated skills.

axiomantic/spellbook

spellbook-auditing

Meta-audit skill for spellbook development. Spawns parallel subagents to factcheck docs, optimize instructions, find token savings, and identify MCP candidates. Produces actionable report.

5 2
Explore
axiomantic/spellbook

documentation-updates

Use after modifying library skills, library commands, or agents to ensure CHANGELOG, README, and docs are updated

5 2
Explore
axiomantic/spellbook

project-encyclopedia

[DEPRECATED] Use project-level AGENTS.md files instead. Previously used for first-session codebase onboarding and persistent glossary creation.

5 2
Explore
axiomantic/spellbook

reviewing-impl-plans

Use when reviewing implementation plans before execution. Triggers: 'is this plan solid', 'review the plan', 'check before I start building', 'anything missing from this plan', 'will this plan work', 'audit the implementation plan'. NOT for: reviewing design documents (use reviewing-design-docs) or creating plans (use writing-plans).

5 2
Explore
axiomantic/spellbook

session-resume

Session resume protocol and session repairs handling. Loaded when spellbook_session_init returns resume_available: true, or when session_init returns a repairs array. Triggers: 'resume', 'continue', 'where were we', session resume, session repairs.

5 2
Explore
axiomantic/spellbook

brainstorming

Use when exploring design approaches, generating ideas, or making architectural decisions. Triggers: 'explore options', 'what are the tradeoffs', 'how should I approach', 'let's think through', 'sketch out an approach', 'I need ideas for', 'how would you structure', 'what are my options'. Also invoked by develop when design decisions are needed.

5 2
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results