From logseq-brain
Lints and repairs Logseq graph format violations that create phantom pages or broken macros. Scans pages/journals for issues like broken macros, bare tags, unnamespaced links, and malformed properties, then reports or fixes them on demand.
How this skill is triggered — by the user, by Claude, or both
Slash command
/logseq-brain:brain-doctorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scan the whole graph for the format mistakes that silently corrupt a Logseq graph — inline code wrapped in `{{ }}` (broken macros), bare `#number`/hex tags and un-namespaced `[[links]]` (phantom empty pages), `[[file://]]` links, and junk/description links — plus data-quality checks — malformed properties, broken/duplicate entries, and missing-structure gaps (see the full catalog in `skills/_sh...
Scan the whole graph for the format mistakes that silently corrupt a Logseq graph — inline code wrapped in {{ }} (broken macros), bare #number/hex tags and un-namespaced [[links]] (phantom empty pages), [[file://]] links, and junk/description links — plus data-quality checks — malformed properties, broken/duplicate entries, and missing-structure gaps (see the full catalog in skills/_shared/hygiene-rules.md) — then report them and, on confirmation, repair them. This is a maintenance tool: run it on demand, not as part of the save/load cycle.
See skills/_shared/hygiene-rules.md for the full catalog: each rule with its detection pattern, auto-fixable tier, and remediation. The compose-time rules these checks enforce live in skills/_shared/logseq-format.md.
If the trigger is ambiguous, run Report first and offer to fix.
Resolve the graph path per skills/_shared/path-resolution.md.
Scan. For each rule in skills/_shared/hygiene-rules.md with enforced-at: scan (all 9), run its detection across pages/ and journals/. Collect counts and 1–2 example locations per rule. Stay read-only in this phase.
Report. Present a compact health summary grouped by the rule's auto-fixable field:
yes / safe-only): code-in-braces, bare-hash-tag, unnamespaced-link, file-link, malformed-property (safe tiers only).report): description-link, broken-link (with suggested matches), duplicate-entry (the duplicate groups), structural-integrity (missing props / stub sections).
Example:Brain health: 12 issues across 6 pages
Auto-fixable (5): 3 {{code}}, 1 bare #tag, 1 malformed property
Needs your call (7): 2 broken links (1 likely typo → suggests [[Tasks/CRMGM-1982]]),
3 duplicate Session Log entries, 2 pages missing last-updated::
If the graph is clean, say so and stop — no backup, journey-log just ran brain-doctor (clean).
Confirm before any write. Never repair without explicit user confirmation — consistent with the plugin's "never persist without confirmation" rule. 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. Before the first edit, copy pages/, journals/, and logseq/ to a timestamped backup folder (e.g. <graph>/.brain-doctor-backup-<yyyy-MM-dd-HHmm>/ or the host scratchpad). Tell the user where it is. If the backup fails, stop — do not edit.
Repair. Apply per auto-fixable:
skills/_shared/hygiene-rules.md. For high-volume mechanical classes (code-in-braces, bare-hash-tag) a single scripted pass over the affected files is appropriate — this is one-time maintenance, not the per-session surgical save path, and a backup was taken. For malformed-property, auto-fix only the page-top property block; report inline key: value hits for user approval (an inline line may be prose). Hand-fix the brace/backtick edge cases noted in the catalog.broken-link, duplicate-entry, or structural-integrity changes.Verify. Re-run the detections. Confirm zero remaining (excluding intentional forward-references the user chose to keep) and that backtick counts per file are even (no broken inline-code spans).
Report results and write a journey-log entry per skills/_shared/journey-log.md with activity line: ran brain-doctor · fixed <N> issues (or ran brain-doctor (clean)).
brain-save now follows the compose-time invariants (skills/_shared/logseq-format.md), so a freshly maintained graph should stay clean.Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
npx claudepluginhub jame581/skillsmith --plugin logseq-brain