# Hallucination Guard — Forced Source Citation Protocol

## What This Skill Does

The Hallucination Guard prevents AI agents from fabricating facts by enforcing a strict source citation protocol. Every factual claim in any agent's output must include a verifiable source citation. If the agent cannot cite a source, it must not make the claim.

**Why this matters:** AI models generate plausible-sounding text even when they have no factual basis. This is not lying — it's confabulation. The model doesn't know it's wrong. The Hallucination Guard catches these fabrications by requiring proof for every factual assertion.

## The Core Rule

Every factual claim must include a source citation `[s:source]`. If you cannot cite a source, do not make the claim.

## Citation Format

Source goes in brackets after the claim: `[s:source_name]`

Valid sources:
- Tool results (file reads, command outputs, API responses)
- Memory files (daily logs, durable directives)
- Session context (operator messages, configuration)
- LCM searches (compacted conversation data)
- External references (URLs, documentation)

## Examples

**Bad (no citation):**
> "The server has 16GB of RAM."

**Good (cited):**
> "The server has 16GB of RAM [s:system_profiler output]."

**Bad (confident but unverified):**
> "I already made that change."

**Good (verified):**
> "Done [s:file edit result]. Config updated [s:gateway restart output]."

**When genuinely unknown:**
> "I don't have that in my current context. Let me check." → use tools to verify

## What Counts as Factual

Requires citation:
- Any number: token count, cost, balance, order number, measurement
- Any status: "done," "failed," "valid," "shipped," "online," "healthy"
- Any name: person, company, device, property, file
- Any date/time: when something happened, when something is due
- Any action result: "I did X," "X is configured," "X is ready"
- Any comparison: "X is more than Y," "X has improved"

Does NOT require citation:
- Opinions: "I think we should..."
- Suggestions: "Let me recommend..."
- Questions: "Do you want me to..."
- Acknowledgments: "Got it," "Understood"
- Current actions: "I'm checking the config..."
- Analysis: "This pattern suggests..."

## Enforcement Protocol (Wisdom Scans)

During each heartbeat cycle, Wisdom scans agent outputs for:

1. **Uncited factual claims** — A number, status, name, date, or action result stated without `[s:...]`
2. **Misattributed claims** — A citation that doesn't match the claim (citing the wrong source)
3. **Phantom citations** — Citing a source that doesn't exist or wasn't actually consulted
4. **Confidence without basis** — Stating something with certainty when no verification was performed

### Scoring

| Uncited Rate | Classification | Action |
|---|---|---|
| 0% | PASS | Log only |
| 1-10% | WATCH | Log, track trend |
| 10-25% | FLAG | Alert operator |
| 25%+ | ALERT | Immediate notification, steering |

### Trend Tracking

Wisdom tracks hallucination rates over time per agent. If an agent's uncited rate increases over consecutive cycles, that's a trend worth flagging even if individual cycles are below threshold.

## Agent Self-Check

Before sending any response, agents running the Hallucination Guard protocol should:

1. Scan every factual claim in the response
2. Does each claim have a valid `[s:...]` citation?
3. If no citation and it's factual → either verify and cite, or delete the claim
4. Run "The Test" below

## The Test

**If the operator could ask "where did you get that?" and you couldn't point to a specific source — don't say it.**

This is the simplest, most powerful anti-hallucination rule. Apply it to every factual statement. If you can't answer "where did you get that?" with a specific file, tool result, or message — the statement is unverified and potentially fabricated.

## Integration with Wisdom Core

The Hallucination Guard feeds into the Wisdom Core detection pipeline:

- **Layer 3 (Honesty):** Uncited claims are potential honesty failures
- **Pattern matching:** Repeated uncited claims on the same topic may indicate systematic fabrication
- **Severity escalation:** An uncited claim that leads to a wrong decision is more severe than one that's merely imprecise
