/logseq-brain:brain-doctorfrom logseq-brain
Lints and repairs a Logseq graph used as a Claude Brain, detecting format violations that cause phantom pages or broken macros. Runs on-demand scans and offers automated fixes after backup.
Ships in logseq-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scan the whole graph for the format mistakes that silently corrupt a Logseq graph. Report them and, on confirmation and after a backup, repair them. This is a maintenance tool: run it on demand, not in the save/load cycle. Detection runs through the helper (below). The catalog of meaning, tiers and remediation is skills/_shared/hygiene-rules.md.
sh "<this skill's base directory>/../_shared/bin/brain" <command> …& "$(Split-Path (Split-Path (Get-Command git).Source))\bin\bash.exe" "<base>/../_shared/bin/brain" <command> …--graph <connected folder>. Elsewhere pass --graph only when the graph is not configured. It may go anywhere on the line. On exit 2 with graph not resolved, follow skills/_shared/path-resolution.md, then pass --graph.' inside becomes '\''. In double quotes the shell runs backticks and expands $.coverage: line. Never recompute a figure it printed. Its graph: line is the folder for your own Read, Edit and Write calls.Run brain info once, and use its graph: path for the backup and for every Edit this skill makes. If it exits 2, follow skills/_shared/path-resolution.md, then pass --graph to every call.
If the trigger is ambiguous, run Report first and offer to fix.
Scan in one call: brain lint --all. It prints every mechanical rule, plus the digest rules for every digest-bearing page, as file:line rule tier detail, followed by a summary: line. Then run the three judgment rules the helper does not: description-link (from the phantom-target procedure under broken-link), duplicate-entry and structural-integrity, per the catalog.
Report, grouped by the catalog's auto-fixable field:
code-in-braces, bare-hash-tag, unnamespaced-link, file-link, relative-link, malformed-property (page-top only), and stale-map / map-label. The digest ones are fixed with brain digest <page> --apply.description-link, broken-link, unknown-property-key, duplicate-entry, structural-integrity, jira-markup, missing-digest, stale-digest, oversized-digest, nonconvergent-map, duplicate-map — the helper refuses to write on either (see the catalog), so the fix is a human edit, not a bulk pass.The headline total counts every bucket. Example:
Brain health: 16 issues across 8 pages
Auto-fixable (5): 3 bare #tags (incl. C#-parity), 1 {{code}}, 1 stale Map
Needs your call (7): 4 links to missing task pages, 2 unknown property keys, 1 unfenced Jira draft
Digests (4): 4 pages with no digest — say "backfill digests"
Empty pages that lint no longer explains: Logseq never deletes a page once it has parsed one. Pages created by text that has since been fixed survive until the graph is re-indexed in Logseq (All graphs → Re-index). A clean brain lint plus leftover empty pages means "re-index", not "fix more". If the graph is clean, say so, run brain activity 'ran brain-doctor (clean)', and stop.
Confirm before any write. Ask which classes to fix if the user hasn't said.
Back up first. The graph is usually not git-tracked, so there is no undo. Copy pages/, journals/ and logseq/ to a timestamped folder (e.g. <graph>/.brain-doctor-backup-<yyyy-MM-dd-HHmm>/, or the host scratchpad) and say where. If the backup fails, stop.
Repair.
stale-map / map-label: brain digest <page> --apply per page.broken-link, duplicate-entry or structural-integrity changes.unknown-property-key: when the finding names a synonym (→ use rationale::), offer to rename the key to it; otherwise suggest a key from skills/_shared/properties.md or plain prose.Tasks/<ID> targets of broken-link findings by brain links Tasks/<ID> count (at most 10 links calls), and offer stubs for those, each created only on a yes per skills/_shared/task-pages.md.unknown-property-key findings, offer :property-pages/enabled? false in logseq/config.edn (this stops every key becoming a page). Only with the user's consent, as a model Edit after the backup; the helper never writes config.edn. Logseq must be closed, and a re-index removes the pages already made.Verify.
brain lint <every file you changed>: expect zero for the fixed classes.brain digest <page> --apply on every digest-bearing page whose bytes changed. This is a Remap: digest-updated:: and the prose stay untouched. Skip a page with no ## Digest section — that's a missing-digest finding, not a Remap, and --apply exits 2 on it; leave it to the guided digest backfill below.brain activity 'ran brain-doctor · fixed <N> issues' and report the result.
Triggered by "backfill digests" or accepted from a missing-digest report. The shape is: report, cost, one confirmation, then work.
missing-digest rows from brain lint --all. These are pages with no ## Digest, and pages whose Digest has no Map line (e.g. Tasks/CRMGM-2037). List each with its size from brain sections, largest first; the biggest pages pay back a digest soonest.brain sections <page> gives the sections its Rebuild branch will read (skills/_shared/digest.md). Project-shaped pages read Overview, Current Plan, the Decisions headlines and the Session Log tail. Task-shaped pages read their largest one or two sections. Cap each at 8 KB and sum. Quote the sum: "14 pages, ~340 KB on disk — the bounded reads come to roughly 90 KB. Proceed?"skills/_shared/digest.md: bounded reads, then prose Edits, then brain digest <page> --apply. Work one page at a time, so an interruption leaves a consistent graph.brain activity 'backfilled N digests'.Never build a digest without confirmation. It is a write, and it costs tokens.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/brain-initSet up the Claude Brain Logseq graph (first-time) or add a new project page. Triggers: "init brain", "setup brain", "init brain project <name>", "add project to brain". Don't fire for loads, saves, or status checks — those are handled by brain-load, brain-save, and brain-status.
/brain-loadLoad project context from the Claude Brain Logseq graph into the current session. Triggers: "load brain", "load <project>", "resume <project>", "continue work on <project>", "load <task ID>", "what do we know about <topic>", "search brain for X", "find X in brain". Don't fire for write operations (use brain-save), generic questions about Logseq itself, or "open <file>" / "switch to <branch>" requests that mean opening files or switching git branches rather than loading project memory.
/brain-saveSave session context, decisions, progress, and plans to the Claude Brain Logseq graph. Triggers: "save to brain", "save this", "remember this", "store this decision", "log this", "save progress", "rotate session log", "mark <project> paused". On wrap-up cues ("before I quit", "wrap up") after real project work, offer a save; never save unasked. Don't fire for read operations (use brain-load) or status checks (use brain-status).
/brain-statusShow a dashboard of all projects in the Claude Brain graph, or graph analytics. Dashboard triggers: "brain status", "show projects", "show brain", "what's in my brain", "project dashboard", "brain overview", "list projects", "summary". Analytics triggers: "brain stats", "graph analytics", "graph activity over time". Don't fire for loads (use brain-load) or saves (use brain-save).
logseq-brain@skillsmith is listed by jame581/skillsmith — review the source before installing
npx claudepluginhub jame581/skillsmith --plugin logseq-brainOther plugins' skills for the same job