brain-doctor

brain-doctor is a skill for Claude Code from jame581/LogseqBrain. It costs 114 tokens per session (2,449 once invoked), scanned A, original, MIT.

A maintenance tool for checking and repairing a Logseq knowledge graph. Logseq is a note-taking app that organizes information as linked pages and blocks.

In plain words
What is it for?
Use it to check graph health, find broken or phantom pages, clean formatting, repair malformed entries, or rebuild missing digests.
Why use it?
It finds formatting and data problems that can create empty pages, broken macros, invalid links, or missing entries, then can repair them after confirmation.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the logseq-brain plugin — 5 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jame581/logseqbrain/brain-doctor
Any agent
npx skills add jame581/LogseqBrain --skill brain-doctor
Clone the repo
git clone --depth 1 https://github.com/jame581/LogseqBrain

Made for: Claude Code.

Or install logseq-brain, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for brain-doctor

README.md
[![agentmods](https://agentmods.dev/badge/skills/jame581/logseqbrain/brain-doctor.svg)](https://agentmods.dev/skills/jame581/logseqbrain/brain-doctor)
Your own site
<a href="https://agentmods.dev/skills/jame581/logseqbrain/brain-doctor"><img src="https://agentmods.dev/badge/skills/jame581/logseqbrain/brain-doctor.svg" alt="Measured on agentmods" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,449 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00114 $0.02449
Opus 5 $0.00057 $0.01224
Sonnet 5 $0.00023 $0.00490
Haiku 4.5 $0.00011 $0.00245

Measured 5d ago against content hash e80115224979, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

brain-doctor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/brain-doctor/SKILL.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Brain Doctor

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, junk/description links, and un-fenced Jira markup residue — 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.

Modes

  • Report (default, "lint brain" / "check brain health" / "why are there empty pages"): detect and summarize, change nothing.
  • Fix ("fix brain" / "clean up brain" / explicit "yes, fix them" after a report): repair after a backup, with the user's confirmation.

If the trigger is ambiguous, run Report first and offer to fix.

Prerequisites

Resolve the graph path per skills/_shared/path-resolution.md.

Process

  1. Scan. For each rule in skills/_shared/hygiene-rules.md with enforced-at: scan (all 14), run its detection across pages/ and journals/. Collect counts and 1–2 example locations per rule. Stay read-only in this phase.

  2. Report. Present a compact health summary grouped by the rule's auto-fixable field:

    • Auto-fixable (yes / safe-only): code-in-braces, bare-hash-tag, unnamespaced-link, file-link, malformed-property (safe tiers only).
    • Needs your call (report): description-link, broken-link (with suggested matches), duplicate-entry (the duplicate groups), structural-integrity (missing props / stub sections), jira-markup (unfenced Jira residue — suggests the fence wrap), missing-digest (pages with no digest, largest first), stale-digest (digest older than the page), stale-map (Map claims figures that no longer match the page's measured bytes), oversized-digest (digest over the 800 B cap — report only; never trim on-disk content automatically). Example:
    Brain health: 16 issues across 8 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::
    Digests (4):       4 pages with no digest (Fat 109 KB, …) — say "backfill digests"
    

    The headline total counts every bucket — 5 + 7 + 4 = 16. Digests are broken out for readability, never excluded from the count; a total that quietly omits a bucket is the same under-reporting this release exists to eliminate. If the graph is clean, say so and stop — no backup, journey-log just ran brain-doctor (clean).

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 88 lines · 114 tokens per session scan A e80115224979

Subscribe to this mod's changes

brain-doctor is a skill published in the GitHub repository jame581/LogseqBrain (17 stars, last pushed 1mo ago), licensed MIT. It adds 114 tokens to every session and 2,449 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

curator-continuity

Apply at the start of a build or coding session on a Curator-tracked project, and again as your own context fills, without waiting to be asked. Activates on "continue", "resume", "where did we leave off", "pick up where we left off", "what were we working on", "catch me up on this project", and on the save side "save…

talirezun/the-curator · 228 tokens

my-curator

Use when interacting with the user's My Curator second brain via the my-curator MCP. Activates for READ ("what does my wiki say about X", "what do I know about X", "search my notes", "deep research my second brain", "find every source that mentions Y", "what does our cohort wiki say"), WRITE ("save to my wiki"…

talirezun/the-curator · 206 tokens

Context Doctor

Identify and repair degradation in system prompt, external memory, and skills preventing you from following instructions or remembering information as well as you should.

letta-ai/letta-code · 30 tokens

memanto-companion

Inspect and manage the cross-session engineering memory that Memanto maintains for your Claude Code skills. Use when the user asks what Memanto remembers, wants to see their engineering profile, manually recall context for a skill, or store a decision. The automatic lifecycle hooks handle capture/injection on their…

moorcheh-ai/memanto · 72 tokens

memory-recall

Search and recall relevant memories from past sessions via memsearch. Use when the user's question could benefit from historical context, past decisions, debugging notes, previous conversations, or project knowledge -- especially questions like 'what did I decide about X', 'why did we do Y', or 'have I seen this…

zilliztech/memsearch · 149 tokens

system-monitor

Monitor system health: CPU, memory, disk, processes, and network. Alert on thresholds via any channel.

fuyuxiang/echo-agent · 25 tokens