---
feature_pitch:
  headline: "Brain consistency measurement instrument + self-healing loop."
  one_liner: "gbrain eval suspected-contradictions samples retrieval pairs and flags conflicts, with doctor + MCP + dream-cycle integration."
---

# v0.32.6 Migration: Contradiction Probe

The agent ran this version migration when the user upgraded gbrain. After
upgrade, this file is read by the auto-update agent which performs the
following steps automatically.

## Mechanical (handled by `gbrain apply-migrations`)

Two new tables get added on first connect after upgrade:

- `eval_contradictions_cache` — persistent judge verdict cache, keyed on
  (chunk_a_hash, chunk_b_hash, model_id, prompt_version, truncation_policy).
  TTL-driven (default 30 days). Bounded by `sweepContradictionCache`.
- `eval_contradictions_runs` — one row per `gbrain eval
  suspected-contradictions` run. Source for the `trend` sub-subcommand
  and the doctor `contradictions` check.

Both are RLS-enabled on Postgres (matches existing eval table posture).
On PGLite they're plain tables.

## Operator action (optional)

The probe is opt-in — it doesn't run automatically. To use it:

```bash
# Run against one query:
gbrain eval suspected-contradictions --query "what is acme's MRR" --top-k 5 --json

# Run against a queries file:
gbrain eval suspected-contradictions --queries-file ~/.gbrain/queries.jsonl --top-k 5

# Inspect findings without re-running:
gbrain eval suspected-contradictions review --severity high

# Trend over time:
gbrain eval suspected-contradictions trend --days 30
```

## Doctor integration

After the first probe run, `gbrain doctor` shows a `contradictions` check
with severity breakdown + paste-ready resolution commands per HIGH-severity
finding.

## MCP integration

The agent can call `find_contradictions(slug?, severity?, limit?)` during
conversations to surface findings proactively. Reads from the latest probe
run; does NOT trigger a new probe.

## Dream cycle integration

The synthesize phase reads the latest probe's top-5 highest-severity
findings and injects them as an informational block into the synthesis
prompt. The subagent sees what to reconcile when writing compiled_truth to
flagged slugs. Empty trend = empty block; fresh-install behavior unchanged.

## Verification

```bash
gbrain doctor --json | jq '.checks[] | select(.name == "contradictions")'
```

Should print an entry with status "ok" (no probe runs yet) or "warn"
(high-severity findings present). If the entry is missing, the migration
didn't apply — run `gbrain apply-migrations --yes` and re-check.

## See also

- `docs/contradictions.md` — architecture, severity rubric, action criteria
- `docs/eval-bench.md` — recommended nightly cadence + trend workflow
- CHANGELOG `## [0.32.6]` — full release notes
