Skip to content
Data
Skill

/maintain

Brain health checks: back-link enforcement, citation audit, filing validation, stale info detection, orphan pages, and benchmarks. Use when asked to check brain health, run maintenance, or audit quality.

From plugin
gbrain
28k57 skills
Install
$ npx -y skills add garrytan/gbrain --skill maintain --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/maintain

Context preview

The summary Claude sees to decide when to auto-load this skill.

Brain health checks: back-link enforcement, citation audit, filing validation, stale info detection, orphan pages, and benchmarks. Use when asked to check brain health, run maintenance, or audit quality.

SKILL.md

maintain.SKILL.md
name: maintain
version: 1.0.0
description: |
  Brain health checks: back-link enforcement, citation audit, filing validation,
  stale info detection, orphan pages, and benchmarks. Use when asked to check
  brain health, run maintenance, or audit quality.
triggers:
  - "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"
tools:
  - get_health
  - get_page
  - put_page
  - list_pages
  - get_backlinks
  - add_link
  - search
mutating: true

Maintain Skill

Periodic brain health checks and cleanup.

Contract

This skill guarantees:

  • All health dimensions are checked (stale, orphan, dead links, cross-refs, backlinks, citations, filing, tags)
  • Each issue found has a specific fix action
  • Back-link iron law is enforced
  • Citation format is validated against the standard
  • Results are reported with counts per dimension

Phases

Autonomous path (v0.36.4.0) — when you want to reach a target score

If the user asks "get my brain to 90/100" or "fix what's broken", prefer the one-command loop over walking each dimension by hand:

gbrain doctor --remediation-plan --json              # preview what would run
gbrain doctor --remediate --yes --target-score 90 --max-usd 5

`--remediation-plan` prints a dependency-ordered list (sync before extract, embed after consolidate, etc.) with per-step `est_seconds` and `est_usd_cost`. `--remediate` walks the plan, submitting each step as a Minion job, re-checking score between every step. `--max-usd N` is a hard cost cap — submission refuses when the plan would exceed the cap (prevents synthesize loops from burning Anthropic credits unattended).

When the target score is unreachable for the brain (empty brain with no entity pages → `graph_coverage` caps at 70; unconfigured embedding key → caps at 60), the command bails with a list of what's missing rather than looping.

Use the per-dimension walk below (Phase 2 onward) when:

  • The user explicitly asks for a dimension-by-dimension audit
  • You're investigating why score is stuck below `--remediate`'s ceiling
  • A specific dimension needs manual judgment that the auto path skips

Manual path

1. **Run health check.** Check gbrain health to get the dashboard. 2. **Check each dimension:**

Stale pages

Pages where compiled_truth is older than the latest timeline entry. The assessment hasn't been updated to reflect recent evidence.

  • Check the health output for stale page count
  • For each stale page: read the page from gbrain, review timeline, determine if compiled_truth needs rewriting

Orphan pages

Pages with zero inbound links. Nobody references them.

  • Review orphans: are they genuinely isolated or just missing links?
  • Add links in gbrain from related pages or flag for deletion

Dead links

Links pointing to pages that don't exist.

  • Remove dead links in gbrain

Missing cross-references

Pages that mention entity names but don't have formal links.

  • Read compiled_truth from gbrain, extract entity mentions, create links in gbrain

Link graph extraction

If link_count is 0 or low relative to page_count, run batch extraction:

gbrain extract links --dir ~/brain

This scans all markdown files for entity references, See Also sections, and frontmatter fields, then creates typed links in the database.

Timeline extraction

If timeline_entry_count is 0, extract structured timeline from markdown:

gbrain extract timeline --dir ~/brain

Dream cycle (v0.23): synthesize + patterns

`gbrain dream` runs the full 8-phase maintenance cycle:

lint -> backlinks -> sync -> synthesize -> extract -> patterns -> embed -> orphans

The two new phases consolidate yesterday's conversations into long-term memory:

**Synthesize phase:** reads transcripts from `dream.synthesize.session_corpus_dir`, runs a cheap Haiku verdict (cached in `dream_verdicts`) to filter routine ops sessions, then fans out one Sonnet subagent per worth-processing transcript. Each subagent writes reflections (`wiki/personal/reflections/...`), originals (`wiki/originals/ideas/...`), and people timeline entries. The orchestrator collects the slugs from `subagent_tool_executions` (NOT `pages.updated_at` — that would pick up unrelated writes) and reverse-renders each new page from DB → markdown on disk.

**Patterns phase:** runs after `extract` (so the graph state is fresh). Reads recent reflections within `dream.patterns.lookback_days` (default 30), runs a single Sonnet pass to surface recurring themes, and writes pattern pages to `wiki/personal/patterns/<theme>` when ≥`dream.patterns.min_evidence` (default 3) reflections support a pattern.

**Quality bar (Iron Law for synthesis):** 1. Quote the user verbatim. Do not paraphrase memorable phrasings. 2. Cross-reference compulsively: every new page MUST have at least one wikilink. 3. Slug discipline: lowercase alphanumeric and hyphens only. NO underscores, NO file extensions. 4. Edited transcripts produce NEW slugs (content-hash suffix changes) — never silently overwrite.

**Trust boundary (`allowed_slug_prefixes`):** the synthesis subagent runs with an explicit allow-list of write paths sourced from `_brain-filing-rules.json`'s `dream_synthesize_paths.globs`. Even on prompt-injection success, the subagent cannot write outside that list. Trust comes from PROTECTED_JOB_NAMES — MCP cannot submit subagent jobs at all. Editing the JSON is the only way to add a new directory the synthesizer can write to.

**Idempotency + privacy:** transcripts are keyed by `(file_path, content_hash)`, so re-running on the same content is a no-op. `dream.synthesize

Read more
Ships withgbrain

Search gives you raw pages. GBrain gives you the answer. It's the brain layer your AI agent has been missing — the only one that does synthesis, graph traversal, and gap analysis in one box.

Get the whole plugin

Other skills on gbrain.