[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72SWSWKQD6VGYRZ9989X372":3,"skill-same:01M72SWSWKQD6VGYRZ9989X372":75},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":60,"updatedAt":61,"install":62,"resources":74},"01M72SWSWKQD6VGYRZ9989X372","maintain",null,"Brain health checks: back-link enforcement, citation audit, filing validation,\nstale info detection, orphan pages, and benchmarks. Use when asked to check\nbrain health, run maintenance, or audit quality.","ltdrew\u002FAgent-brain-2","ltdrew","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F173687628?v=4","01M72SVABERGYY99JQPNV3FTTN","Logan Drew","01M72SVABZHAN29CHRV66Y48B8",1,"MIT","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Fskills\u002Fmaintain\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: maintain\nversion: 1.0.0\ndescription: |\n  Brain health checks: back-link enforcement, citation audit, filing validation,\n  stale info detection, orphan pages, and benchmarks. Use when asked to check\n  brain health, run maintenance, or audit quality.\ntriggers:\n  - \"brain health\"\n  - \"check backlinks\"\n  - \"maintenance\"\n  - \"orphan pages\"\n  - \"stale pages\"\n  - \"extract links\"\n  - \"build link graph\"\n  - \"populate timeline\"\n  - \"populate links\"\n  - \"backfill graph\"\n  - \"extract timeline entries\"\n  - \"run dream\"\n  - \"process today's session\"\n  - \"process yesterday's transcripts\"\n  - \"synthesize my conversations\"\n  - \"what patterns did you see\"\n  - \"did the dream cycle run\"\n  - \"consolidate yesterday's conversations\"\ntools:\n  - get_health\n  - get_page\n  - put_page\n  - list_pages\n  - get_backlinks\n  - add_link\n  - search\nmutating: true\n---\n\n# Maintain Skill\n\nPeriodic brain health checks and cleanup.\n\n## Contract\n\nThis skill guarantees:\n- All health dimensions are checked (stale, orphan, dead links, cross-refs, backlinks, citations, filing, tags)\n- Each issue found has a specific fix action\n- Back-link iron law is enforced\n- Citation format is validated against the standard\n- Results are reported with counts per dimension\n\n## Phases\n\n1. **Run health check.** Check gbrain health to get the dashboard.\n2. **Check each dimension:**\n\n### Stale pages\nPages where compiled_truth is older than the latest timeline entry. The assessment hasn't been updated to reflect recent evidence.\n- Check the health output for stale page count\n- For each stale page: read the page from gbrain, review timeline, determine if compiled_truth needs rewriting\n\n### Orphan pages\nPages with zero inbound links. Nobody references them.\n- Review orphans: are they genuinely isolated or just missing links?\n- Add links in gbrain from related pages or flag for deletion\n\n### Dead links\nLinks pointing to pages that don't exist.\n- Remove dead links in gbrain\n\n### Missing cross-references\nPages that mention entity names but don't have formal links.\n- Read compiled_truth from gbrain, extract entity mentions, create links in gbrain\n\n### Link graph extraction\nIf link_count is 0 or low relative to page_count, run batch extraction:\n```bash\ngbrain extract links --dir ~\u002Fbrain\n```\nThis scans all markdown files for entity references, See Also sections, and\nfrontmatter fields, then creates typed links in the database.\n\n### Timeline extraction\nIf timeline_entry_count is 0, extract structured timeline from markdown:\n```bash\ngbrain extract timeline --dir ~\u002Fbrain\n```\n\n### Dream cycle (v0.23): synthesize + patterns\n\n`gbrain dream` runs the full 8-phase maintenance cycle:\n\n```\nlint -> backlinks -> sync -> synthesize -> extract -> patterns -> embed -> orphans\n```\n\nThe two new phases consolidate yesterday's conversations into long-term memory:\n\n**Synthesize phase:** reads transcripts from `dream.synthesize.session_corpus_dir`,\nruns a cheap Haiku verdict (cached in `dream_verdicts`) to filter routine\nops sessions, then fans out one Sonnet subagent per worth-processing\ntranscript. Each subagent writes reflections (`wiki\u002Fpersonal\u002Freflections\u002F...`),\noriginals (`wiki\u002Foriginals\u002Fideas\u002F...`), and people timeline entries. The\norchestrator collects the slugs from `subagent_tool_executions` (NOT\n`pages.updated_at` — that would pick up unrelated writes) and reverse-renders\neach new page from DB → markdown on disk.\n\n**Patterns phase:** runs after `extract` (so the graph state is fresh).\nReads recent reflections within `dream.patterns.lookback_days` (default 30),\nruns a single Sonnet pass to surface recurring themes, and writes pattern\npages to `wiki\u002Fpersonal\u002Fpatterns\u002F\u003Ctheme>` when ≥`dream.patterns.min_evidence`\n(default 3) reflections support a pattern.\n\n**Quality bar (Iron Law for synthesis):**\n1. Quote the user verbatim. Do not paraphrase memorable phrasings.\n2. Cross-reference compulsively: every new page MUST have at least one wikilink.\n3. Slug discipline: lowercase alphanumeric and hyphens only. NO underscores, NO file extensions.\n4. Edited transcripts produce NEW slugs (content-hash suffix changes) — never silently overwrite.\n\n**Trust boundary (`allowed_slug_prefixes`):** the synthesis subagent runs with an\nexplicit allow-list of write paths sourced from `_brain-filing-rules.json`'s\n`dream_synthesize_paths.globs`. Even on prompt-injection success, the subagent\ncannot write outside that list. Trust comes from PROTECTED_JOB_NAMES — MCP\ncannot submit subagent jobs at all. Editing the JSON is the only way to add\na new directory the synthesizer can write to.\n\n**Idempotency + privacy:** transcripts are keyed by `(file_path, content_hash)`,\nso re-running on the same content is a no-op. `dream.synthesize.exclude_patterns`\n(default `[\"medical\", \"therapy\"]`) filters out transcripts before any LLM call.\nEach entry is auto-wrapped as a word-boundary regex (e.g. `medical` matches\n\"medical advice\" but NOT \"comedical\"). Power users may pass full regex.\n\n**Cooldown:** the cycle's spend cap. `dream.synthesize.cooldown_hours` (default\n12) means at most ~2 synthesize runs per day under autopilot. The completion\ntimestamp is stored in `dream.synthesize.last_completion_ts` and is written\nONLY on successful runs (not on skipped\u002Ffailed). Explicit `--input` \u002F\n`--date` \u002F `--from` \u002F `--to` invocations bypass cooldown.\n\n**`--dry-run` semantics:** runs the cheap Haiku significance filter (caches\nverdicts) but skips the Sonnet synthesis pass. NOT zero LLM calls.\n\n**Configure synthesize on a fresh brain:**\n```bash\ngbrain config set dream.synthesize.session_corpus_dir \u002Fpath\u002Fto\u002Ftranscripts\ngbrain config set dream.synthesize.enabled true\ngbrain dream --phase synthesize --dry-run --json   # preview\ngbrain dream                                       # full 8-phase cycle\n```\n\n**Invocation patterns:**\n```bash\ngbrain dream                                          # full cycle\ngbrain dream --phase synthesize                       # just synthesize\ngbrain dream --phase patterns                         # just patterns\ngbrain dream --input ~\u002Ftranscripts\u002F2026-04-25.txt     # ad-hoc one transcript\ngbrain dream --from 2026-04-01 --to 2026-04-25        # backfill range\ngbrain dream --json                                   # CycleReport JSON\n```\n\n**Auto-commit deferred to v1.1:** v1 writes files to `brain_dir` but does NOT\n`git add` \u002F `commit` \u002F `push`. Either commit yourself or let `gbrain autopilot`\nhandle it.\nParses `- **YYYY-MM-DD** | Source — Summary` and `### YYYY-MM-DD — Title` formats.\nNote: extracted entries improve structured queries (`gbrain timeline`), not vector search.\n\n### Autopilot check\nVerify autopilot is running:\n```bash\ngbrain autopilot --status\n```\nIf not running, install it:\n```bash\ngbrain autopilot --install --repo ~\u002Fbrain\n```\nAutopilot runs sync, extract, and embed in a continuous loop with adaptive scheduling.\nIn v0.11.1+, autopilot dispatches each cycle as a single `autopilot-cycle`\nMinion job and supervises the worker child — one install step gives you\nsync + extract + embed + backlinks + durable job processing.\n\n### Fix a half-migrated install\nA v0.11.0 install where the migration skill never fired leaves Minions\npartially set up: schema is applied, but `~\u002F.gbrain\u002Fpreferences.json`\ndoesn't exist, autopilot runs inline, host manifests still reference\n`agentTurn`. Repair:\n\n```bash\n# Check migration status\ngbrain apply-migrations --list\n\n# Apply pending migrations (idempotent; safe on healthy installs)\ngbrain apply-migrations --yes\n\n# If host-specific handlers are flagged in ~\u002F.gbrain\u002Fmigrations\u002Fpending-host-work.jsonl:\n# walk them per skills\u002Fmigrations\u002Fv0.11.0.md + docs\u002Fguides\u002Fplugin-handlers.md,\n# ship handler registrations in the host repo, then re-run apply-migrations.\n```\n\nFull troubleshooting guide: `docs\u002Fguides\u002Fminions-fix.md`.\n\n### Back-link enforcement\nCheck that the back-linking iron law is being followed:\n- For each recently updated page, check if entities mentioned in it have\n  corresponding back-links FROM those entity pages\n- A mention without a back-link is a broken brain\n- Fix: add the missing back-link to the entity's Timeline or See Also section\n- Format: `- **YYYY-MM-DD** | Referenced in [page title](path) -- brief context`\n\n### Filing rule violations\nCheck for common misfiling patterns (see `skills\u002F_brain-filing-rules.md`):\n- Content with clear primary subjects filed in `sources\u002F` instead of the\n  appropriate directory (people\u002F, companies\u002F, concepts\u002F, etc.)\n- Use gbrain search to find pages in `sources\u002F` that reference specific\n  people, companies, or concepts -- these may be misfiled\n- Flag misfiled pages for review or re-filing\n\n### Citation audit\nSpot-check pages for missing `[Source: ...]` citations:\n- Read 5-10 recently updated pages\n- Check that compiled truth (above the line) has inline citations\n- Check that timeline entries have source attribution\n- Flag pages where facts appear without provenance\n\n### Tag consistency\nInconsistent tagging (e.g., \"vc\" vs \"venture-capital\", \"ai\" vs \"artificial-intelligence\").\n- Standardize to the most common variant using gbrain tag operations\n\n### Graph population (v0.10.3+)\n\nThe `links` and `timeline_entries` tables are the structured graph layer.\nPopulate them periodically or after major imports:\n\n- `gbrain extract links --source db` — backfill structured links by walking pages\n  from the engine. Reads `[Name](people\u002Fslug)` \u002F `[Name](companies\u002Fslug)` references\n  and infers relationship types (`attended`, `works_at`, `invested_in`, `founded`,\n  `advises`, `mentions`, `source`). Idempotent. Use `--source fs --dir \u003Cbrain>`\n  if you have a markdown checkout to walk instead.\n- `gbrain extract timeline --source db` — backfill structured timeline entries.\n  Parses `- **YYYY-MM-DD** | summary` lines from page content. Idempotent (DB\n  UNIQUE constraint).\n- `gbrain extract all --source db` — both in one run.\n- `gbrain graph-query \u003Cslug> --depth 2` — verify connectivity (use any well-known\n  entity slug as a probe).\n- `gbrain stats` — verify `link_count > 0` and `timeline_entry_count > 0` after extraction.\n- `gbrain health` — review `link_coverage` and `timeline_coverage` percentages\n  on entity pages (person\u002Fcompany). Below 50% means more extraction is needed.\n\nAvailable link types (use with `gbrain graph-query --type`):\n`attended`, `works_at`, `invested_in`, `founded`, `advises`, `mentions`, `source`.\n\nGoing forward, every `gbrain put` call auto-creates and reconciles links via the\nauto-link post-hook (default on; disable: `gbrain config set auto_link false`).\nSo link-extract is mostly a one-time backfill. timeline-extract should be re-run\nafter bulk imports or content edits that add new dated entries.\n\n### Embedding freshness\nChunks without embeddings, or chunks embedded with an old model.\n- For large embedding refreshes (>1000 chunks), use nohup:\n  `nohup gbrain embed refresh > \u002Ftmp\u002Fgbrain-embed.log 2>&1 &`\n- Then check progress: `tail -1 \u002Ftmp\u002Fgbrain-embed.log`\n\n### Security (RLS verification)\nRun `gbrain doctor --json` and check the RLS status.\nAll tables should show RLS enabled. If not, run `gbrain init` again.\n\n### Schema health\nCheck that the schema version is up to date. `gbrain doctor --json` reports\nthe current version vs expected. If behind, `gbrain init` runs migrations\nautomatically.\n\n### File storage health\nCheck the integrity of stored files and redirect pointers:\n- Run `gbrain files verify` to check all DB records have valid data\n- Run `gbrain files status` to see migration state (local, mirrored, redirected)\n- Check for orphan `.redirect.yaml` pointers that reference missing storage files\n- Check for large binary files (>= 100 MB) still in git that should be in cloud storage\n- If storage backend is configured: verify redirect pointers resolve (download test)\n\n### Open threads\nTimeline items older than 30 days with unresolved action items.\n- Flag for review\n\n## Benchmark Testing\n\nPeriodically verify search quality hasn't regressed. Run a battery of test\nqueries across difficulty tiers:\n\n- **Tier 1 (entity lookup):** known names -- should always resolve\n- **Tier 2 (topic recall):** concepts, topics -- keyword search should handle\n- **Tier 3 (semantic):** queries with no exact keyword match -- needs embeddings\n- **Tier 4 (cross-domain):** relational\u002Fconnection queries -- only semantic handles\n\nCompare results from `gbrain search` (keyword) vs `gbrain query` (hybrid).\nQuality matters more than speed (2.5s right > 200ms wrong).\n\nWhen to run benchmarks:\n- After major brain imports or re-imports\n- After gbrain version upgrades\n- After embedding regeneration\n- Monthly to track quality drift\n\n## Heartbeat Integration\n\nFor production agents running on a schedule, integrate gbrain health checks into\nyour operational heartbeat.\n\n### On every heartbeat (hourly or per-session)\n\nRun `gbrain doctor --json` and check for degradation. Report any failing checks\nto the user. Key signals: connection health, schema version, RLS status, embedding\nstaleness.\n\n### Weekly maintenance\n\nRun `gbrain embed --stale` to refresh embeddings for pages that have changed since\ntheir last embedding. For large brains (>5000 pages), run this with nohup:\n```bash\nnohup gbrain embed --stale > \u002Ftmp\u002Fgbrain-embed.log 2>&1 &\n```\n\n### Daily verification\n\nVerify sync is running: check `gbrain stats` and confirm `last_sync` is within\nthe last 24 hours. If sync has stopped, the brain is drifting from the repo.\n\n### Stale compiled truth detection\n\nFlag pages where compiled truth is >30 days old but the timeline has recent entries.\nThis means new evidence exists that hasn't been synthesized. These pages need a\ncompiled truth rewrite (see the maintain workflow above).\n\n## Report Storage\n\nAfter maintenance runs, save a report:\n- Health check results (before\u002Fafter scores for each dimension)\n- Back-link violations found and fixed\n- Filing rule violations found\n- Citation gaps flagged\n- Benchmark results (if run)\n- Outstanding issues requiring user attention\n\nThis creates an audit trail for brain health over time.\n\n## Quality Rules\n\n- Never delete pages without confirmation\n- Log all changes via timeline entries\n- Check gbrain health before and after to show improvement\n\n## Anti-Patterns\n\n- Fixing pages without reading them first -- you must understand context before editing\n- Silently skipping dimensions -- every dimension must be checked and reported, even if clean\n- Deleting orphan pages without checking if they should be linked instead\n- Running embedding refresh during peak usage hours\n- Batch-fixing back-links without verifying the relationship is real\n- Marking a dimension \"clean\" without actually querying it\n- Rewriting compiled truth without reading the full timeline first\n- Removing tags without checking if other pages use the same tag consistently\n\n## Output Format\n\nThe maintenance report follows this structure:\n\n```\n## Brain Health Report — YYYY-MM-DD\n\n| Dimension           | Issues Found | Fixed | Remaining |\n|----------------------|-------------|-------|-----------|\n| Stale pages          | N           | N     | N         |\n| Orphan pages         | N           | N     | N         |\n| Dead links           | N           | N     | N         |\n| Missing cross-refs   | N           | N     | N         |\n| Back-link violations | N           | N     | N         |\n| Citation gaps        | N           | N     | N         |\n| Filing violations    | N           | N     | N         |\n| Tag inconsistencies  | N           | N     | N         |\n| Embedding staleness  | N           | N     | N         |\n| Security (RLS)       | N           | N     | N         |\n| Schema health        | N           | N     | N         |\n| File storage         | N           | N     | N         |\n| Open threads         | N           | N     | N         |\n\n### Details\n[Per-dimension breakdown with specific pages and actions taken]\n\n### Benchmark Results (if run)\n[Tier 1-4 query results with pass\u002Ffail]\n\n### Outstanding Issues\n[Items requiring user attention or confirmation]\n```\n\n## Tools Used\n\n- Check gbrain health (get_health)\n- List pages in gbrain with filters (list_pages)\n- Read a page from gbrain (get_page)\n- Check backlinks in gbrain (get_backlinks)\n- Link entities in gbrain (add_link)\n- Remove links in gbrain (remove_link)\n- Tag a page in gbrain (add_tag)\n- Remove a tag in gbrain (remove_tag)\n- View timeline in gbrain (get_timeline)\n","# Maintain Skill\n\nPeriodic brain health checks and cleanup.\n\n## Contract\n\nThis skill guarantees:\n- All health dimensions are checked (stale, orphan, dead links, cross-refs, backlinks, citations, filing, tags)\n- Each issue found has a specific fix action\n- Back-link iron law is enforced\n- Citation format is validated against the standard\n- Results are reported with counts per dimension\n\n## Phases\n\n1. **Run health check.** Check gbrain health to get the dashboard.\n2. **Check each dimension:**\n\n### Stale pages\nPages where compiled_truth is older than the latest timeline entry. The assessment hasn't been updated to reflect recent evidence.\n- Check the health output for stale page count\n- For each stale page: read the page from gbrain, review timeline, determine if compiled_truth needs rewriting\n\n### Orphan pages\nPages with zero inbound links. Nobody references them.\n- Review orphans: are they genuinely isolated or just missing links?\n- Add links in gbrain from related pages or flag for deletion\n\n### Dead links\nLinks pointing to pages that don't exist.\n- Remove dead links in gbrain\n\n### Missing cross-references\nPages that mention entity names but don't have formal links.\n- Read compiled_truth from gbrain, extract entity mentions, create links in gbrain\n\n### Link graph extraction\nIf link_count is 0 or low relative to page_count, run batch extraction:\n```bash\ngbrain extract links --dir ~\u002Fbrain\n```\nThis scans all markdown files for entity references, See Also sections, and\nfrontmatter fields, then creates typed links in the database.\n\n### Timeline extraction\nIf timeline_entry_count is 0, extract structured timeline from markdown:\n```bash\ngbrain extract timeline --dir ~\u002Fbrain\n```\n\n### Dream cycle (v0.23): synthesize + patterns\n\n`gbrain dream` runs the full 8-phase maintenance cycle:\n\n```\nlint -> backlinks -> sync -> synthesize -> extract -> patterns -> embed -> orphans\n```\n\nThe two new phases consolidate yesterday's conversations into long-term memory:\n\n**Synthesize phase:** reads transcripts from `dream.synthesize.session_corpus_dir`,\nruns a cheap Haiku verdict (cached in `dream_verdicts`) to filter routine\nops sessions, then fans out one Sonnet subagent per worth-processing\ntranscript. Each subagent writes reflections (`wiki\u002Fpersonal\u002Freflections\u002F...`),\noriginals (`wiki\u002Foriginals\u002Fideas\u002F...`), and people timeline entries. The\norchestrator collects the slugs from `subagent_tool_executions` (NOT\n`pages.updated_at` — that would pick up unrelated writes) and reverse-renders\neach new page from DB → markdown on disk.\n\n**Patterns phase:** runs after `extract` (so the graph state is fresh).\nReads recent reflections within `dream.patterns.lookback_days` (default 30),\nruns a single Sonnet pass to surface recurring themes, and writes pattern\npages to `wiki\u002Fpersonal\u002Fpatterns\u002F\u003Ctheme>` when ≥`dream.patterns.min_evidence`\n(default 3) reflections support a pattern.\n\n**Quality bar (Iron Law for synthesis):**\n1. Quote the user verbatim. Do not paraphrase memorable phrasings.\n2. Cross-reference compulsively: every new page MUST have at least one wikilink.\n3. Slug discipline: lowercase alphanumeric and hyphens only. NO underscores, NO file extensions.\n4. Edited transcripts produce NEW slugs (content-hash suffix changes) — never silently overwrite.\n\n**Trust boundary (`allowed_slug_prefixes`):** the synthesis subagent runs with an\nexplicit allow-list of write paths sourced from `_brain-filing-rules.json`'s\n`dream_synthesize_paths.globs`. Even on prompt-injection success, the subagent\ncannot write outside that list. Trust comes from PROTECTED_JOB_NAMES — MCP\ncannot submit subagent jobs at all. Editing the JSON is the only way to add\na new directory the synthesizer can write to.\n\n**Idempotency + privacy:** transcripts are keyed by `(file_path, content_hash)`,\nso re-running on the same content is a no-op. `dream.synthesize.exclude_patterns`\n(default `[\"medical\", \"therapy\"]`) filters out transcripts before any LLM call.\nEach entry is auto-wrapped as a word-boundary regex (e.g. `medical` matches\n\"medical advice\" but NOT \"comedical\"). Power users may pass full regex.\n\n**Cooldown:** the cycle's spend cap. `dream.synthesize.cooldown_hours` (default\n12) means at most ~2 synthesize runs per day under autopilot. The completion\ntimestamp is stored in `dream.synthesize.last_completion_ts` and is written\nONLY on successful runs (not on skipped\u002Ffailed). Explicit `--input` \u002F\n`--date` \u002F `--from` \u002F `--to` invocations bypass cooldown.\n\n**`--dry-run` semantics:** runs the cheap Haiku significance filter (caches\nverdicts) but skips the Sonnet synthesis pass. NOT zero LLM calls.\n\n**Configure synthesize on a fresh brain:**\n```bash\ngbrain config set dream.synthesize.session_corpus_dir \u002Fpath\u002Fto\u002Ftranscripts\ngbrain config set dream.synthesize.enabled true\ngbrain dream --phase synthesize --dry-run --json   # preview\ngbrain dream                                       # full 8-phase cycle\n```\n\n**Invocation patterns:**\n```bash\ngbrain dream                                          # full cycle\ngbrain dream --phase synthesize                       # just synthesize\ngbrain dream --phase patterns                         # just patterns\ngbrain dream --input ~\u002Ftranscripts\u002F2026-04-25.txt     # ad-hoc one transcript\ngbrain dream --from 2026-04-01 --to 2026-04-25        # backfill range\ngbrain dream --json                                   # CycleReport JSON\n```\n\n**Auto-commit deferred to v1.1:** v1 writes files to `brain_dir` but does NOT\n`git add` \u002F `commit` \u002F `push`. Either commit yourself or let `gbrain autopilot`\nhandle it.\nParses `- **YYYY-MM-DD** | Source — Summary` and `### YYYY-MM-DD — Title` formats.\nNote: extracted entries improve structured queries (`gbrain timeline`), not vector search.\n\n### Autopilot check\nVerify autopilot is running:\n```bash\ngbrain autopilot --status\n```\nIf not running, install it:\n```bash\ngbrain autopilot --install --repo ~\u002Fbrain\n```\nAutopilot runs sync, extract, and embed in a continuous loop with adaptive scheduling.\nIn v0.11.1+, autopilot dispatches each cycle as a single `autopilot-cycle`\nMinion job and supervises the worker child — one install step gives you\nsync + extract + embed + backlinks + durable job processing.\n\n### Fix a half-migrated install\nA v0.11.0 install where the migration skill never fired leaves Minions\npartially set up: schema is applied, but `~\u002F.gbrain\u002Fpreferences.json`\ndoesn't exist, autopilot runs inline, host manifests still reference\n`agentTurn`. Repair:\n\n```bash\n# Check migration status\ngbrain apply-migrations --list\n\n# Apply pending migrations (idempotent; safe on healthy installs)\ngbrain apply-migrations --yes\n\n# If host-specific handlers are flagged in ~\u002F.gbrain\u002Fmigrations\u002Fpending-host-work.jsonl:\n# walk them per skills\u002Fmigrations\u002Fv0.11.0.md + docs\u002Fguides\u002Fplugin-handlers.md,\n# ship handler registrations in the host repo, then re-run apply-migrations.\n```\n\nFull troubleshooting guide: `docs\u002Fguides\u002Fminions-fix.md`.\n\n### Back-link enforcement\nCheck that the back-linking iron law is being followed:\n- For each recently updated page, check if entities mentioned in it have\n  corresponding back-links FROM those entity pages\n- A mention without a back-link is a broken brain\n- Fix: add the missing back-link to the entity's Timeline or See Also section\n- Format: `- **YYYY-MM-DD** | Referenced in [page title](path) -- brief context`\n\n### Filing rule violations\nCheck for common misfiling patterns (see `skills\u002F_brain-filing-rules.md`):\n- Content with clear primary subjects filed in `sources\u002F` instead of the\n  appropriate directory (people\u002F, companies\u002F, concepts\u002F, etc.)\n- Use gbrain search to find pages in `sources\u002F` that reference specific\n  people, companies, or concepts -- these may be misfiled\n- Flag misfiled pages for review or re-filing\n\n### Citation audit\nSpot-check pages for missing `[Source: ...]` citations:\n- Read 5-10 recently updated pages\n- Check that compiled truth (above the line) has inline citations\n- Check that timeline entries have source attribution\n- Flag pages where facts appear without provenance\n\n### Tag consistency\nInconsistent tagging (e.g., \"vc\" vs \"venture-capital\", \"ai\" vs \"artificial-intelligence\").\n- Standardize to the most common variant using gbrain tag operations\n\n### Graph population (v0.10.3+)\n\nThe `links` and `timeline_entries` tables are the structured graph layer.\nPopulate them periodically or after major imports:\n\n- `gbrain extract links --source db` — backfill structured links by walking pages\n  from the engine. Reads `[Name](people\u002Fslug)` \u002F `[Name](companies\u002Fslug)` references\n  and infers relationship types (`attended`, `works_at`, `invested_in`, `founded`,\n  `advises`, `mentions`, `source`). Idempotent. Use `--source fs --dir \u003Cbrain>`\n  if you have a markdown checkout to walk instead.\n- `gbrain extract timeline --source db` — backfill structured timeline entries.\n  Parses `- **YYYY-MM-DD** | summary` lines from page content. Idempotent (DB\n  UNIQUE constraint).\n- `gbrain extract all --source db` — both in one run.\n- `gbrain graph-query \u003Cslug> --depth 2` — verify connectivity (use any well-known\n  entity slug as a probe).\n- `gbrain stats` — verify `link_count > 0` and `timeline_entry_count > 0` after extraction.\n- `gbrain health` — review `link_coverage` and `timeline_coverage` percentages\n  on entity pages (person\u002Fcompany). Below 50% means more extraction is needed.\n\nAvailable link types (use with `gbrain graph-query --type`):\n`attended`, `works_at`, `invested_in`, `founded`, `advises`, `mentions`, `source`.\n\nGoing forward, every `gbrain put` call auto-creates and reconciles links via the\nauto-link post-hook (default on; disable: `gbrain config set auto_link false`).\nSo link-extract is mostly a one-time backfill. timeline-extract should be re-run\nafter bulk imports or content edits that add new dated entries.\n\n### Embedding freshness\nChunks without embeddings, or chunks embedded with an old model.\n- For large embedding refreshes (>1000 chunks), use nohup:\n  `nohup gbrain embed refresh > \u002Ftmp\u002Fgbrain-embed.log 2>&1 &`\n- Then check progress: `tail -1 \u002Ftmp\u002Fgbrain-embed.log`\n\n### Security (RLS verification)\nRun `gbrain doctor --json` and check the RLS status.\nAll tables should show RLS enabled. If not, run `gbrain init` again.\n\n### Schema health\nCheck that the schema version is up to date. `gbrain doctor --json` reports\nthe current version vs expected. If behind, `gbrain init` runs migrations\nautomatically.\n\n### File storage health\nCheck the integrity of stored files and redirect pointers:\n- Run `gbrain files verify` to check all DB records have valid data\n- Run `gbrain files status` to see migration state (local, mirrored, redirected)\n- Check for orphan `.redirect.yaml` pointers that reference missing storage files\n- Check for large binary files (>= 100 MB) still in git that should be in cloud storage\n- If storage backend is configured: verify redirect pointers resolve (download test)\n\n### Open threads\nTimeline items older than 30 days with unresolved action items.\n- Flag for review\n\n## Benchmark Testing\n\nPeriodically verify search quality hasn't regressed. Run a battery of test\nqueries across difficulty tiers:\n\n- **Tier 1 (entity lookup):** known names -- should always resolve\n- **Tier 2 (topic recall):** concepts, topics -- keyword search should handle\n- **Tier 3 (semantic):** queries with no exact keyword match -- needs embeddings\n- **Tier 4 (cross-domain):** relational\u002Fconnection queries -- only semantic handles\n\nCompare results from `gbrain search` (keyword) vs `gbrain query` (hybrid).\nQuality matters more than speed (2.5s right > 200ms wrong).\n\nWhen to run benchmarks:\n- After major brain imports or re-imports\n- After gbrain version upgrades\n- After embedding regeneration\n- Monthly to track quality drift\n\n## Heartbeat Integration\n\nFor production agents running on a schedule, integrate gbrain health checks into\nyour operational heartbeat.\n\n### On every heartbeat (hourly or per-session)\n\nRun `gbrain doctor --json` and check for degradation. Report any failing checks\nto the user. Key signals: connection health, schema version, RLS status, embedding\nstaleness.\n\n### Weekly maintenance\n\nRun `gbrain embed --stale` to refresh embeddings for pages that have changed since\ntheir last embedding. For large brains (>5000 pages), run this with nohup:\n```bash\nnohup gbrain embed --stale > \u002Ftmp\u002Fgbrain-embed.log 2>&1 &\n```\n\n### Daily verification\n\nVerify sync is running: check `gbrain stats` and confirm `last_sync` is within\nthe last 24 hours. If sync has stopped, the brain is drifting from the repo.\n\n### Stale compiled truth detection\n\nFlag pages where compiled truth is >30 days old but the timeline has recent entries.\nThis means new evidence exists that hasn't been synthesized. These pages need a\ncompiled truth rewrite (see the maintain workflow above).\n\n## Report Storage\n\nAfter maintenance runs, save a report:\n- Health check results (before\u002Fafter scores for each dimension)\n- Back-link violations found and fixed\n- Filing rule violations found\n- Citation gaps flagged\n- Benchmark results (if run)\n- Outstanding issues requiring user attention\n\nThis creates an audit trail for brain health over time.\n\n## Quality Rules\n\n- Never delete pages without confirmation\n- Log all changes via timeline entries\n- Check gbrain health before and after to show improvement\n\n## Anti-Patterns\n\n- Fixing pages without reading them first -- you must understand context before editing\n- Silently skipping dimensions -- every dimension must be checked and reported, even if clean\n- Deleting orphan pages without checking if they should be linked instead\n- Running embedding refresh during peak usage hours\n- Batch-fixing back-links without verifying the relationship is real\n- Marking a dimension \"clean\" without actually querying it\n- Rewriting compiled truth without reading the full timeline first\n- Removing tags without checking if other pages use the same tag consistently\n\n## Output Format\n\nThe maintenance report follows this structure:\n\n```\n## Brain Health Report — YYYY-MM-DD\n\n| Dimension           | Issues Found | Fixed | Remaining |\n|----------------------|-------------|-------|-----------|\n| Stale pages          | N           | N     | N         |\n| Orphan pages         | N           | N     | N         |\n| Dead links           | N           | N     | N         |\n| Missing cross-refs   | N           | N     | N         |\n| Back-link violations | N           | N     | N         |\n| Citation gaps        | N           | N     | N         |\n| Filing violations    | N           | N     | N         |\n| Tag inconsistencies  | N           | N     | N         |\n| Embedding staleness  | N           | N     | N         |\n| Security (RLS)       | N           | N     | N         |\n| Schema health        | N           | N     | N         |\n| File storage         | N           | N     | N         |\n| Open threads         | N           | N     | N         |\n\n### Details\n[Per-dimension breakdown with specific pages and actions taken]\n\n### Benchmark Results (if run)\n[Tier 1-4 query results with pass\u002Ffail]\n\n### Outstanding Issues\n[Items requiring user attention or confirmation]\n```\n\n## Tools Used\n\n- Check gbrain health (get_health)\n- List pages in gbrain with filters (list_pages)\n- Read a page from gbrain (get_page)\n- Check backlinks in gbrain (get_backlinks)\n- Link entities in gbrain (add_link)\n- Remove links in gbrain (remove_link)\n- Tag a page in gbrain (add_tag)\n- Remove a tag in gbrain (remove_tag)\n- View timeline in gbrain (get_timeline)\n",{"name":5,"tools":24,"version":32,"mutating":33,"triggers":34,"description":53},[25,26,27,28,29,30,31],"get_health","get_page","put_page","list_pages","get_backlinks","add_link","search","1.0.0",true,[35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],"brain health","check backlinks","maintenance","orphan pages","stale pages","extract links","build link graph","populate timeline","populate links","backfill graph","extract timeline entries","run dream","process today's session","process yesterday's transcripts","synthesize my conversations","what patterns did you see","did the dream cycle run","consolidate yesterday's conversations","Brain health checks: back-link enforcement, citation audit, filing validation,\nstale info detection, orphan pages, and benchmarks. Use when asked to check\nbrain health, run maintenance, or audit quality.\n","feat\u002Fbrain-first-convention","f3dace916c3845569f26904591b95baf00237bf8","skills\u002Fmaintain",0,"https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2","https:\u002F\u002Fgithub.com\u002Fltdrew","Account 2","2026-05-13 07:52:42",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":33},[64,67,70],{"tool":65,"command":66},"npx","npx skills add ltdrew\u002FAgent-brain-2 --skill maintain",{"tool":68,"command":69},"bunx","bunx skills add ltdrew\u002FAgent-brain-2 --skill maintain",{"tool":71,"command":72},"pnpm","pnpm dlx skills add ltdrew\u002FAgent-brain-2 --skill maintain","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Fskills\u002Fmaintain\u002FSKILL.md",[],[76,83,90,97,104,111],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M72SYQK7HQ98AEY8Z8DBT3C0","signal-detector","Always-on ambient signal capture for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fsignal-detector\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M72SYPHM4TDK6ZRV4NWAGC3D","query","Look up brain pages in the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fquery\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M72SYN2J4BGSFS613D80AJQX","context-now","ALWAYS-ON time-sensitivity discipline for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fcontext-now\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M72SYKY67RCNH8VH9R2N0ZZV","brain-ops","Core read\u002Fwrite cycle for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fbrain-ops\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M72SYHEMGTDRWSERJWZR0XE2","webhook-transforms","Generic framework for converting external events (SMS, meetings, social mentions)\ninto brain-ingestible signals. Define a transform function, register a webhook URL,\nand incoming events get processed through the brain pipeline.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Fskills\u002Fwebhook-transforms\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M72SYEE2B8F47TN01CAGQ4JG","testing","Skill validation framework. Validates every skill has SKILL.md with frontmatter,\nevery reference exists, every env var is declared. The testing contract for the\nskill system itself.","https:\u002F\u002Fgithub.com\u002Fltdrew\u002FAgent-brain-2\u002Fblob\u002Ffeat\u002Fbrain-first-convention\u002Fskills\u002Ftesting\u002FSKILL.md",[],[]]