[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6N0J0XPA8Y4S9BEF6JR5YYJ":3,"skill-same:01M6N0J0XPA8Y4S9BEF6JR5YYJ":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":6,"ownerHtmlUrl":62,"ownerBlogUrl":63,"ownerDescription":64,"updatedAt":65,"install":66,"resources":78},"01M6N0J0XPA8Y4S9BEF6JR5YYJ","citation-fixer",null,"Audit and fix citation formatting across brain pages. Ensures every fact has\nan inline [Source: ...] citation matching the standard format. Extended in\nv0.25.1: scans for broken tweet\u002Fpost references that lack actual URLs and\nresolves them via the host's X \u002F Twitter API integration.","garrytan\u002Fgbrain","garrytan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F19957?v=4","01M6DJCCDDG53MTYYRTXAXFG17","Garry Tan","01M6MZQZCEN3RRMD33E1X9ZZR9",32977,"MIT","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Fskills\u002Fcitation-fixer\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"citation fixer","fixer","Citation","across","audit and fix","inline","source","for","host","formatting","brain","get","search","references","v0","fix","list","broken","api","Citations","audit","2026-11-10 10:12:30",false,"---\nname: citation-fixer\nversion: 1.1.0\ndescription: |\n  Audit and fix citation formatting across brain pages. Ensures every fact has\n  an inline [Source: ...] citation matching the standard format. Extended in\n  v0.25.1: scans for broken tweet\u002Fpost references that lack actual URLs and\n  resolves them via the host's X \u002F Twitter API integration.\ntriggers:\n  - \"fix citations\"\n  - \"fix broken citations\"\n  - \"citation audit\"\n  - \"check citations\"\n  - \"citation fixer\"\ntools:\n  - search\n  - get_page\n  - put_page\n  - list_pages\nmutating: true\n---\n\n# Citation Fixer Skill\n\n> **Convention:** see [conventions\u002Fquality.md](..\u002Fconventions\u002Fquality.md) for\n> the canonical citation format every fix should match.\n>\n> **Output rule:** all links MUST be deterministic (built from API data,\n> not composed by LLM). See [_output-rules.md](..\u002F_output-rules.md).\n\n## Contract\n\nThis skill guarantees:\n\n- Every brain page is scanned for citation compliance.\n- Missing citations are flagged with specific location.\n- Malformed citations are fixed to match the standard format.\n- **(v0.25.1)** Tweet \u002F post references without URLs are resolved via\n  X API and patched with deterministic `https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Cid>`\n  links.\n- Results reported with counts (scanned, fixed, remaining).\n\n## Phases\n\n1. **Scan pages.** List pages and read each one, checking for inline\n   `[Source: ...]` citations.\n2. **Identify issues:**\n   - Facts without any citation\n   - Citations missing date\n   - Citations missing source type\n   - Citations with wrong format\n   - **(v0.25.1)** Tweet references without `x.com` URLs\n3. **Fix format issues.** Rewrite malformed citations to match\n   `conventions\u002Fquality.md`.\n4. **(v0.25.1) Resolve tweet references** via the X API integration.\n5. **Report results.** Count: pages scanned, citations found, issues\n   fixed, tweets resolved, remaining gaps.\n\n## Tweet resolution pipeline (v0.25.1 extension)\n\nFor each broken tweet reference, follow this chain. The actual API call\ngoes through whatever X integration the host has configured (typical\nshape: a recipe under `recipes\u002Fx-api\u002F` with handle \u002F search-all\nendpoints).\n\n### Step 1: Identify broken references\n\nScan the page for patterns that indicate tweet references without URLs:\n\n- Contains words like `tweeted`, `posted`, `said on X`, `RT`, `retweet`,\n  `X post`\n- Contains quoted text that looks like a tweet (short, punchy, often\n  starts with a quote)\n- Has `[Source: ... X\u002FTwitter ...]` without an `x.com` URL\n- References engagement metrics (likes, impressions) without a link\n\n### Step 2: Extract searchable content\n\nFrom each broken reference, extract:\n\n- The **handle** (if mentioned: `@\u003Cusername>`)\n- The **quoted text** (if available)\n- The **approximate date** (often present in surrounding timeline entries)\n\n### Step 3: Search for the actual tweet\n\nUse the host's X API integration. Query patterns:\n\n```\n# Handle + quoted text:\nfrom:\u003Chandle> \"\u003Cexact quote fragment>\"\n\n# Quoted text only:\n\"\u003Cexact quote fragment>\"\n\n# Original of a retweet:\n\"\u003Cexact quote>\" -is:retweet\n```\n\n### Step 4: Verify and extract metadata\n\nOnce a candidate is found:\n\n- Confirm the text matches the quoted fragment.\n- Pull the tweet id, author handle, engagement metrics (likes \u002F RTs \u002F\n  impressions).\n- Construct the URL: `https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Ctweet_id>`.\n\n### Step 5: Patch the brain page\n\nReplace the broken citation with a proper one:\n\n**Before:**\n\n```\n\"\u003Cquote fragment>\" [Source: \u003Csome hand-wavy attribution>]\n```\n\n**After:**\n\n```\n\"\u003Cfull verified quote>\" — \u003CN> likes, \u003CN> RTs, \u003CN> impressions\n[Source: [X\u002F\u003Chandle>, YYYY-MM-DD](https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Ctweet_id>)]\n```\n\n## Batch mode\n\nWhen sweeping many pages:\n\n### Find candidate pages\n\n```bash\n# Pages mentioning tweets but with no x.com links\nfor f in $(find . -name \"*.md\" -not -path \".\u002Fnode_modules\u002F*\"); do\n  refs=$(grep -ci \"tweet\\|posted\\|x post\\|RT\\|retweet\\|said on X\" \"$f\")\n  links=$(grep -c \"x.com\u002F.*\u002Fstatus\u002F\" \"$f\")\n  if [ \"$refs\" -gt 2 ] && [ \"$links\" -eq 0 ]; then\n    echo \"$f\"\n  fi\ndone\n```\n\n### Priority order\n\n1. Recently created \u002F updated pages — fresh broken refs are easiest to\n   resolve while context is fresh.\n2. High-traffic pages (frequent reads \u002F writes from other skills).\n3. Everything else — bulk cleanup over time.\n\n### Rate limiting\n\n- X API: respect the host's tier limits; don't hammer.\n- Target ~50 pages per batch run.\n- 1-3 API calls per page (search + verify).\n- Batch-commit every 10-20 pages so a partial failure doesn't lose\n  progress.\n\n## Output format\n\n```\nCitation Audit Report\n=====================\nPages scanned:        N\nCitations found:      N\nIssues fixed:         N\nTweet links resolved: N\nRemaining gaps:       N (pages with uncitable facts)\n```\n\n## When it fails\n\nFollow the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:\n\n- `put_page` returns `revision_conflict` mid-batch: re-read that page, re-apply only the citation fix, and continue; never overwrite with the copy you read earlier.\n- `get_page` returns `page_not_found` for a cited source: mark the citation unresolvable in the report instead of rewriting it to a guessed slug.\n- A batch commit is interrupted: already-committed pages stay fixed; resume from the last committed page rather than starting over.\n\n## Anti-Patterns\n\n- ❌ Inventing citations for facts that have no source. Flag them.\n- ❌ Removing facts that lack citations (flag them; don't delete).\n- ❌ Fixing citations without reading the full page context.\n- ❌ Batch-fixing without checking quality on a sample first\n  (see `conventions\u002Ftest-before-bulk.md`).\n- ❌ Composing tweet URLs by guessing the tweet id. Always go through\n  the X API; deterministic links only.\n\n## Integration\n\nThis skill can be called:\n\n- **Manually** — \"fix citations on this page\"\n- **As a batch cron** — weekly sweep of pages with broken refs\n- **By other skills** — `enrich` or `media-ingest` can call citation-fixer\n  before commit to validate output\n\n## Metrics\n\nIf running as a recurring batch, track state in a small JSON file under\n`~\u002F.gbrain\u002Fcitation-fixer-state.json`:\n\n```json\n{\n  \"last_run\": \"2026-04-15T...\",\n  \"pages_scanned\": 0,\n  \"citations_fixed\": 0,\n  \"tweet_links_resolved\": 0,\n  \"citations_unresolvable\": 0,\n  \"pages_remaining\": 1424\n}\n```\n\n\n## Output Format\n\nThe 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\u002Fskills-conformance.test.ts`).\n","# Citation Fixer Skill\n\n> **Convention:** see [conventions\u002Fquality.md](..\u002Fconventions\u002Fquality.md) for\n> the canonical citation format every fix should match.\n>\n> **Output rule:** all links MUST be deterministic (built from API data,\n> not composed by LLM). See [_output-rules.md](..\u002F_output-rules.md).\n\n## Contract\n\nThis skill guarantees:\n\n- Every brain page is scanned for citation compliance.\n- Missing citations are flagged with specific location.\n- Malformed citations are fixed to match the standard format.\n- **(v0.25.1)** Tweet \u002F post references without URLs are resolved via\n  X API and patched with deterministic `https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Cid>`\n  links.\n- Results reported with counts (scanned, fixed, remaining).\n\n## Phases\n\n1. **Scan pages.** List pages and read each one, checking for inline\n   `[Source: ...]` citations.\n2. **Identify issues:**\n   - Facts without any citation\n   - Citations missing date\n   - Citations missing source type\n   - Citations with wrong format\n   - **(v0.25.1)** Tweet references without `x.com` URLs\n3. **Fix format issues.** Rewrite malformed citations to match\n   `conventions\u002Fquality.md`.\n4. **(v0.25.1) Resolve tweet references** via the X API integration.\n5. **Report results.** Count: pages scanned, citations found, issues\n   fixed, tweets resolved, remaining gaps.\n\n## Tweet resolution pipeline (v0.25.1 extension)\n\nFor each broken tweet reference, follow this chain. The actual API call\ngoes through whatever X integration the host has configured (typical\nshape: a recipe under `recipes\u002Fx-api\u002F` with handle \u002F search-all\nendpoints).\n\n### Step 1: Identify broken references\n\nScan the page for patterns that indicate tweet references without URLs:\n\n- Contains words like `tweeted`, `posted`, `said on X`, `RT`, `retweet`,\n  `X post`\n- Contains quoted text that looks like a tweet (short, punchy, often\n  starts with a quote)\n- Has `[Source: ... X\u002FTwitter ...]` without an `x.com` URL\n- References engagement metrics (likes, impressions) without a link\n\n### Step 2: Extract searchable content\n\nFrom each broken reference, extract:\n\n- The **handle** (if mentioned: `@\u003Cusername>`)\n- The **quoted text** (if available)\n- The **approximate date** (often present in surrounding timeline entries)\n\n### Step 3: Search for the actual tweet\n\nUse the host's X API integration. Query patterns:\n\n```\n# Handle + quoted text:\nfrom:\u003Chandle> \"\u003Cexact quote fragment>\"\n\n# Quoted text only:\n\"\u003Cexact quote fragment>\"\n\n# Original of a retweet:\n\"\u003Cexact quote>\" -is:retweet\n```\n\n### Step 4: Verify and extract metadata\n\nOnce a candidate is found:\n\n- Confirm the text matches the quoted fragment.\n- Pull the tweet id, author handle, engagement metrics (likes \u002F RTs \u002F\n  impressions).\n- Construct the URL: `https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Ctweet_id>`.\n\n### Step 5: Patch the brain page\n\nReplace the broken citation with a proper one:\n\n**Before:**\n\n```\n\"\u003Cquote fragment>\" [Source: \u003Csome hand-wavy attribution>]\n```\n\n**After:**\n\n```\n\"\u003Cfull verified quote>\" — \u003CN> likes, \u003CN> RTs, \u003CN> impressions\n[Source: [X\u002F\u003Chandle>, YYYY-MM-DD](https:\u002F\u002Fx.com\u002F\u003Chandle>\u002Fstatus\u002F\u003Ctweet_id>)]\n```\n\n## Batch mode\n\nWhen sweeping many pages:\n\n### Find candidate pages\n\n```bash\n# Pages mentioning tweets but with no x.com links\nfor f in $(find . -name \"*.md\" -not -path \".\u002Fnode_modules\u002F*\"); do\n  refs=$(grep -ci \"tweet\\|posted\\|x post\\|RT\\|retweet\\|said on X\" \"$f\")\n  links=$(grep -c \"x.com\u002F.*\u002Fstatus\u002F\" \"$f\")\n  if [ \"$refs\" -gt 2 ] && [ \"$links\" -eq 0 ]; then\n    echo \"$f\"\n  fi\ndone\n```\n\n### Priority order\n\n1. Recently created \u002F updated pages — fresh broken refs are easiest to\n   resolve while context is fresh.\n2. High-traffic pages (frequent reads \u002F writes from other skills).\n3. Everything else — bulk cleanup over time.\n\n### Rate limiting\n\n- X API: respect the host's tier limits; don't hammer.\n- Target ~50 pages per batch run.\n- 1-3 API calls per page (search + verify).\n- Batch-commit every 10-20 pages so a partial failure doesn't lose\n  progress.\n\n## Output format\n\n```\nCitation Audit Report\n=====================\nPages scanned:        N\nCitations found:      N\nIssues fixed:         N\nTweet links resolved: N\nRemaining gaps:       N (pages with uncitable facts)\n```\n\n## When it fails\n\nFollow the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:\n\n- `put_page` returns `revision_conflict` mid-batch: re-read that page, re-apply only the citation fix, and continue; never overwrite with the copy you read earlier.\n- `get_page` returns `page_not_found` for a cited source: mark the citation unresolvable in the report instead of rewriting it to a guessed slug.\n- A batch commit is interrupted: already-committed pages stay fixed; resume from the last committed page rather than starting over.\n\n## Anti-Patterns\n\n- ❌ Inventing citations for facts that have no source. Flag them.\n- ❌ Removing facts that lack citations (flag them; don't delete).\n- ❌ Fixing citations without reading the full page context.\n- ❌ Batch-fixing without checking quality on a sample first\n  (see `conventions\u002Ftest-before-bulk.md`).\n- ❌ Composing tweet URLs by guessing the tweet id. Always go through\n  the X API; deterministic links only.\n\n## Integration\n\nThis skill can be called:\n\n- **Manually** — \"fix citations on this page\"\n- **As a batch cron** — weekly sweep of pages with broken refs\n- **By other skills** — `enrich` or `media-ingest` can call citation-fixer\n  before commit to validate output\n\n## Metrics\n\nIf running as a recurring batch, track state in a small JSON file under\n`~\u002F.gbrain\u002Fcitation-fixer-state.json`:\n\n```json\n{\n  \"last_run\": \"2026-04-15T...\",\n  \"pages_scanned\": 0,\n  \"citations_fixed\": 0,\n  \"tweet_links_resolved\": 0,\n  \"citations_unresolvable\": 0,\n  \"pages_remaining\": 1424\n}\n```\n\n\n## Output Format\n\nThe 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\u002Fskills-conformance.test.ts`).\n",{"name":5,"tools":45,"version":49,"mutating":50,"triggers":51,"description":56},[31,46,47,48],"get_page","put_page","list_pages","1.1.0",true,[52,53,54,55,19],"fix citations","fix broken citations","citation audit","check citations","Audit and fix citation formatting across brain pages. Ensures every fact has\nan inline [Source: ...] citation matching the standard format. Extended in\nv0.25.1: scans for broken tweet\u002Fpost references that lack actual URLs and\nresolves them via the host's X \u002F Twitter API integration.\n","master","074ec301549ded4930f04d2c3b22d709a6c095cc","skills\u002Fcitation-fixer",4929,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain","https:\u002F\u002Fgithub.com\u002Fgarrytan","https:\u002F\u002Fblog.garrytan.com","Writes software, dreams. ","2026-11-15 03:57:03",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":50},[68,71,74],{"tool":69,"command":70},"npx","npx skills add garrytan\u002Fgbrain --skill citation-fixer",{"tool":72,"command":73},"bunx","bunx skills add garrytan\u002Fgbrain --skill citation-fixer",{"tool":75,"command":76},"pnpm","pnpm dlx skills add garrytan\u002Fgbrain --skill citation-fixer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Fskills\u002Fcitation-fixer\u002FSKILL.md",[79],{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"routing-eval.jsonl","OTHER","其他",585,"https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Fskills\u002Fcitation-fixer\u002Frouting-eval.jsonl",[86,94,100,105,110,115],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":93},"01M7DVD1SVD1CK2S6M5MR0NKVH","beta","Synthetic fixture skill.","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fgood\u002Fskills\u002Fbeta\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":95,"name":96,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":93},"01M7DVD0T1465DP7CGPVNGK5XH","alpha","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fgood\u002Fskills\u002Falpha\u002FSKILL.md",[],[],{"skillNo":101,"name":96,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":93},"01M7DVCZWYBFRTE76082QMZCK8","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fbad\u002Fskills\u002Falpha\u002FSKILL.md",[],[],{"skillNo":106,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":93},"01M7DVCYYGRM05Z2MWH37CYGHH","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fbad-undeclared\u002Fskills\u002Fbeta\u002FSKILL.md",[],[],{"skillNo":111,"name":96,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":93},"01M7DVCXRT85704NBBZ73F59KP","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fbad-undeclared\u002Fskills\u002Falpha\u002FSKILL.md",[],[],{"skillNo":116,"name":96,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":93},"01M7DVCWR4M8HWJVM1CXB7K1VN","https:\u002F\u002Fgithub.com\u002Fgarrytan\u002Fgbrain\u002Fblob\u002Fmaster\u002Ftest\u002Ffixtures\u002Fguards\u002Fcheck-skill-health.ts\u002Fbad-tool\u002Fskills\u002Falpha\u002FSKILL.md",[],[]]