# Correction Pipeline

When the user corrects a factual error, root-cause it immediately.

- Repository: https://github.com/garrytan/gbrain (31427 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add garrytan/gbrain --skill correction-pipeline -g -a claude-code -y`
Codex: `npx skills add garrytan/gbrain --skill correction-pipeline -g -a codex -y`
Cursor: `npx skills add garrytan/gbrain --skill correction-pipeline -g -a cursor -y`
Gemini CLI: `npx skills add garrytan/gbrain --skill correction-pipeline -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add garrytan/gbrain`

## Description

When the user corrects a factual error, root-cause it immediately. Don't just note the correction, trace the error to its source, fix the source, and prevent recurrence. Every factual error is either a data error (bad brain page, bad memory file, bad rendered SOUL/USER identity, bad facts row) or a hallucination (LLM confabulated from partial signals).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Correction Pipeline

> **Convention:** see [conventions/brain-first.md](../conventions/brain-first.md)
>, Step 1 of the root-cause chain IS the brain-first lookup chain (`search`
> for exact tokens, `query` for concept-shaped questions) before anything else.
>
> **Convention:** see [_brain-filing-rules.md](../_brain-filing-rules.md), > corrections edit pages in place; the page stays filed by primary subject.

## Trigger

ANY factual error the user identifies. No exceptions. No "I'll note that."

(Routing here is a harness convention, not a mechanical guarantee, but once
this skill is in play, the no-exceptions contract above is the discipline.)

## Immediate Response

1. **Acknowledge the error.** Don't defend. Don't explain. Just: "You're right. I got that wrong."
2. **Quote the specific wrong claim** so the user can see you know exactly what was wrong.
3. **State the correct fact** as the user gave it.

## Root Cause Analysis (do THIS, not just a memory note)

Run these steps IN ORDER. Report findings to the user.

### Step 1: Search the brain

```bash
gbrain search "<relevant terms>" --limit 10
```

For concept-shaped or synonym-phrased claims, escalate to `gbrain query
"<question>"` (LLM expansion recovers phrasings `search` misses). To list
every indexed page carrying the claim, use a keyword search (it pages every
match); grep the checkout only for edits not yet synced:

```bash
gbrain search '"<wrong claim terms>"' --match keyword
BRAIN_DIR=$(gbrain config get sync.repo_path)
grep -ri "<wrong claim terms>" "$BRAIN_DIR/people/" "$BRAIN_DIR/companies/" "$BRAIN_DIR/concepts/" 2>/dev/null
```

**Question:** Is the wrong fact IN the brain? If yes → the brain is the
contamination source. Fix the brain page (Step 6).

### Step 2: Search memory files

Grep the harness's always-loaded memory files (e.g. the workspace `MEMORY.md`
and any `memory/*.md` companions, the exact location depends on your
harness):

The rest: https://github.com/garrytan/gbrain/blob/HEAD/plugin-variants/gbrain-coding/skills/correction-pipeline/SKILL.md
