brain-ingest-gate
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
Audit and fix citation formatting across brain pages. Ensures every fact has an inline [Source: ...] citation matching the standard format. Extended in v0.25.1: scans for broken tweet/post references that lack actual URLs and resolves them via the host's X / Twitter API
$ npx -y skills add garrytan/gbrain --skill citation-fixer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/citation-fixerContext preview
The summary Claude sees to decide when to auto-load this skill.
Audit and fix citation formatting across brain pages. Ensures every fact has an inline [Source: ...] citation matching the standard format. Extended in v0.25.1: scans for broken tweet/post references that lack actual URLs and resolves them via the host's X / Twitter API
name: citation-fixer version: 1.1.0 description: | Audit and fix citation formatting across brain pages. Ensures every fact has an inline [Source: ...] citation matching the standard format. Extended in v0.25.1: scans for broken tweet/post references that lack actual URLs and resolves them via the host's X / Twitter API integration. triggers: - "fix citations" - "fix broken citations" - "citation audit" - "check citations" - "citation fixer" tools: - search - get_page - put_page - list_pages mutating: true
> **Convention:** see [conventions/quality.md](../conventions/quality.md) for > the canonical citation format every fix should match. > > **Output rule:** all links MUST be deterministic (built from API data, > not composed by LLM). See [_output-rules.md](../_output-rules.md).
This skill guarantees:
X API and patched with deterministic `https://x.com/<handle>/status/<id>` links.
1. **Scan pages.** List pages and read each one, checking for inline `[Source: ...]` citations. 2. **Identify issues:**
3. **Fix format issues.** Rewrite malformed citations to match `conventions/quality.md`. 4. **(v0.25.1) Resolve tweet references** via the X API integration. 5. **Report results.** Count: pages scanned, citations found, issues fixed, tweets resolved, remaining gaps.
For each broken tweet reference, follow this chain. The actual API call goes through whatever X integration the host has configured (typical shape: a recipe under `recipes/x-api/` with handle / search-all endpoints).
Scan the page for patterns that indicate tweet references without URLs:
`X post`
starts with a quote)
From each broken reference, extract:
Use the host's X API integration. Query patterns:
# Handle + quoted text: from:<handle> "<exact quote fragment>" # Quoted text only: "<exact quote fragment>" # Original of a retweet: "<exact quote>" -is:retweet
Once a candidate is found:
impressions).
Replace the broken citation with a proper one:
**Before:**
"<quote fragment>" [Source: <some hand-wavy attribution>]
**After:**
"<full verified quote>" — <N> likes, <N> RTs, <N> impressions [Source: [X/<handle>, YYYY-MM-DD](https://x.com/<handle>/status/<tweet_id>)]
When sweeping many pages:
# Pages mentioning tweets but with no x.com links
for f in $(find . -name "*.md" -not -path "./node_modules/*"); do
refs=$(grep -ci "tweet\|posted\|x post\|RT\|retweet\|said on X" "$f")
links=$(grep -c "x.com/.*/status/" "$f")
if [ "$refs" -gt 2 ] && [ "$links" -eq 0 ]; then
echo "$f"
fi
done1. Recently created / updated pages — fresh broken refs are easiest to resolve while context is fresh. 2. High-traffic pages (frequent reads / writes from other skills). 3. Everything else — bulk cleanup over time.
progress.
Citation Audit Report ===================== Pages scanned: N Citations found: N Issues fixed: N Tweet links resolved: N Remaining gaps: N (pages with uncitable facts)
(see `conventions/test-before-bulk.md`).
the X API; deterministic links only.
This skill can be called:
before commit to validate output
If running as a recurring batch, track state in a small JSON file under `~/.gbrain/citation-fixer-state.json`:
{
"last_run": "2026-04-15T...",
"pages_scanned": 0,
"citations_fixed": 0,
"tweet_links_resolved": 0,
"citations_unresolvable": 0,
"pages_remaining": 1424
}The skill's output shape is documented inline in the body sections above (see "Output", "Brain page format", or equivalent). The literal section header here exists for the conformance test (`test/skills-conformance.test.ts`).
Give the agent you already use a memory you control. GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents.
Repo: garrytan/gbrain
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
When you report a brain page to the user — created, edited, committed, or relayed from a subagent — a working link is part of the deliverable, in the SAME…
Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking.…
Deduplicate and synthesize raw concept stubs into a tiered intellectual map (T1 Canon to T4 Riff), tracing idea evolution across sources over time. Transforms…
Token-hygiene audit of the always-loaded context stack — CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md,…
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…