# Citation Fixer > Audita y corrige el formato de citas en las páginas del brain, asegurando que cada hecho tenga [Source: ...]; resuelve referencias a tweets sin URL vía la API de X.” Fuente: https://skillsagentes.com/skills/garrytan/gbrain/citation-fixer Markdown: https://skillsagentes.com/skills/garrytan/gbrain/citation-fixer.md Repositorio: https://github.com/garrytan/gbrain Autor: garrytan Licencia: MIT Actualizado: hace 3 meses Coste de contexto: 71 tok instalada, 1.5k tok al activarse, 1.6k tok con todos los archivos del bundle Bundle: 2 archivos, 6 KB Permisos que pide: search, get_page, put_page, list_pages ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add garrytan/gbrain --skill citation-fixer --agent claude-code # Cursor npx -y skills add garrytan/gbrain --skill citation-fixer --agent cursor # Codex npx -y skills add garrytan/gbrain --skill citation-fixer --agent codex # Gemini CLI npx -y skills add garrytan/gbrain --skill citation-fixer --agent gemini # Windsurf npx -y skills add garrytan/gbrain --skill citation-fixer --agent windsurf # Cline npx -y skills add garrytan/gbrain --skill citation-fixer --agent cline ``` ## Qué hace - Escanea páginas del brain buscando citas [Source: ...] faltantes o mal formateadas - Reescribe citas malformadas para que coincidan con conventions/quality.md - Detecta referencias a tweets/posts sin URL y las resuelve vía la API de X - Construye enlaces deterministas https://x.com//status/ verificados - Reporta conteo de páginas escaneadas, citas encontradas, corregidas y huecos restantes ## Cuándo usarla - Se pide auditar o corregir citas en páginas del brain - Hay referencias a tweets/posts sin URL que necesitan resolverse - Se ejecuta un barrido semanal por cron de páginas con referencias rotas - Otras skills como enrich o media-ingest necesitan validar citas antes de hacer commit ## Qué la activa - "Corrige las citas de esta página" - "Haz una auditoría de citas en el brain" - "Revisa las referencias a tweets rotas y resuélvelas" - "Ejecuta un barrido de citation-fixer en las páginas recientes" ## Antes de instalar - Requiere la integración con la API de X/Twitter del host para resolver referencias a tweets. - makes network requests ## Archivos - SKILL.md — 6 KB - routing-eval.jsonl — 585 B ## SKILL.md Reproducido tal cual desde garrytan/gbrain bajo MIT. Esta sección es el documento original y está en inglés. # Citation Fixer Skill > **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). ## Contract This skill guarantees: - Every brain page is scanned for citation compliance. - Missing citations are flagged with specific location. - Malformed citations are fixed to match the standard format. - **(v0.25.1)** Tweet / post references without URLs are resolved via X API and patched with deterministic `https://x.com//status/` links. - Results reported with counts (scanned, fixed, remaining). ## Phases 1. **Scan pages.** List pages and read each one, checking for inline `[Source: ...]` citations. 2. **Identify issues:** - Facts without any citation - Citations missing date - Citations missing source type - Citations with wrong format - **(v0.25.1)** Tweet references without `x.com` URLs 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. ## Tweet resolution pipeline (v0.25.1 extension) 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). ### Step 1: Identify broken references Scan the page for patterns that indicate tweet references without URLs: - Contains words like `tweeted`, `posted`, `said on X`, `RT`, `retweet`, `X post` - Contains quoted text that looks like a tweet (short, punchy, often starts with a quote) - Has `[Source: ... X/Twitter ...]` without an `x.com` URL - References engagement metrics (likes, impressions) without a link ### Step 2: Extract searchable content From each broken reference, extract: - The **handle** (if mentioned: `@`) - The **quoted text** (if available) - The **approximate date** (often present in surrounding timeline entries) ### Step 3: Search for the actual tweet Use the host's X API integration. Query patterns: ``` # Handle + quoted text: from: "" # Quoted text only: "" # Original of a retweet: "" -is:retweet ``` ### Step 4: Verify and extract metadata Once a candidate is found: - Confirm the text matches the quoted fragment. - Pull the tweet id, author handle, engagement metrics (likes / RTs / impressions). - Construct the URL: `https://x.com//status/`. ### Step 5: Patch the brain page Replace the broken citation with a proper one: **Before:** ``` "" [Source: ] ``` **After:** ``` "" — likes, RTs, impressions [Source: [X/, YYYY-MM-DD](https://x.com//status/)] ``` ## Batch mode When sweeping many pages: ### Find candidate pages ```bash # 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 done ``` ### Priority order 1. 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. ### Rate limiting - X API: respect the host's tier limits; don't hammer. - Target ~50 pages per batch run. - 1-3 API calls per page (search + verify). - Batch-commit every 10-20 pages so a partial failure doesn't lose progress. ## Output format ``` Citation Audit Report ===================== Pages scanned: N Citations found: N Issues fixed: N Tweet links resolved: N Remaining gaps: N (pages with uncitable facts) ``` ## Anti-Patterns - ❌ Inventing citations for facts that have no source. Flag them. - ❌ Removing facts that lack citations (flag them; don't delete). - ❌ Fixing citations without reading the full page context. - ❌ Batch-fixing without checking quality on a sample first (see `conventions/test-before-bulk.md`). - ❌ Composing tweet URLs by guessing the tweet id. Always go through the X API; deterministic links only. ## Integration This skill can be called: - **Manually** — "fix citations on this page" - **As a batch cron** — weekly sweep of pages with broken refs - **By other skills** — `enrich` or `media-ingest` can call citation-fixer before commit to validate output ## Metrics If running as a recurring batch, track state in a small JSON file under `~/.gbrain/citation-fixer-state.json`: ```json { "last_run": "2026-04-15T...", "pages_scanned": 0, "citations_fixed": 0, "tweet_links_resolved": 0, "citations_unresolvable": 0, "pages_remaining": 1424 } ``` ## Output Format 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`). ## Dónde encaja - Categoría: [Documentos](https://skillsagentes.com/categorias/documentos.md) — Lee, escribe y transforma archivos PDF, DOCX, XLSX y PPTX. - Creador: [garrytan](https://skillsagentes.com/creators/garrytan.md) — 134 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Setup](https://skillsagentes.com/skills/garrytan/gbrain/setup.md): Configura GBrain con auto-aprovisionamiento de Supabase o PGLite, inyección en AGENTS.md y primera importación. - [Maintain](https://skillsagentes.com/skills/garrytan/gbrain/maintain.md): Chequeos de salud del brain: aplicación de back-links, auditoría de citas, validación de filing, detección de info obsoleta, páginas huérfanas y benchmarks. - [Schema Unify](https://skillsagentes.com/skills/garrytan/gbrain/schema-unify.md): Migra un brain de gbrain-base a la taxonomía de 14 tipos canónicos de gbrain-base-v2 usando gbrain onboard --check y el handler Minion unify-types. - [Retrieval Reflex](https://skillsagentes.com/skills/garrytan/gbrain/retrieval-reflex.md): Cuándo y qué recuperar: abre la página del brain de una entidad relevante antes de responder desde memoria. - [Minion Orchestrator](https://skillsagentes.com/skills/garrytan/gbrain/minion-orchestrator.md): Skill unificado de Minions para jobs deterministas de shell y orquestación de subagentes LLM: cola durable, observable y controlable, más la doctrina de ejecución durable para operaciones largas. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)