brain-doctor

brain-doctor is a skill for Claude Code from jame581/LogseqBrain. It costs 114 tokens per session (1,891 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

Good fit Use it to check graph health, find broken or phantom pages, clean formatting, repair malformed entries, or rebuild missing digests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jame581/logseqbrain/brain-doctor
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for brain-doctor

Your own site · 80×15
<a href="https://agentmods.dev/skills/jame581/logseqbrain/brain-doctor"><img src="https://agentmods.dev/badge/skills/jame581/logseqbrain/brain-doctor.svg" alt="Reviewed on agentmods" width="80" 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 1,891 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.01891
Opus 5.5 $0.00046 $0.00756
Sonnet 5.5 $0.00023 $0.00378
Haiku 4.5 $0.00011 $0.00189

Measured 26d ago against content hash 9248810338d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 26d 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.

plugin/skills/brain-doctor/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 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. 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.

Running the helper

  • Bash: sh "<this skill's base directory>/../_shared/bin/brain" <command> …
  • PowerShell-only Windows: & "$(Split-Path (Split-Path (Get-Command git).Source))\bin\bash.exe" "<base>/../_shared/bin/brain" <command> …
  • Neither works: stop and say "logseq-brain needs Git for Windows (Git Bash) — https://git-scm.com/download/win".
  • In Cowork, always pass --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.
  • Put text arguments in single quotes; a ' inside becomes '\''. In double quotes the shell runs backticks and expands $.
  • Exit 0 clean, 1 findings (act on them), 2 error (act on its reason; don't retry blindly). Quote every coverage: line. Never recompute a figure it printed. Its graph: line is the folder for your own Read, Edit and Write calls.

Prerequisites

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.

Modes

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

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

Process

  1. 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.

Read the full file on GitHub · 90 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. 26d ago Changed · +9 lines 9248810338d2
  2. 1mo ago Changed · -7 lines 8eae9dffba59
  3. 1mo 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 (18 stars, last pushed today), licensed MIT. It adds 114 tokens to every session and 1,891 once invoked, about $0.0005 per session on Opus 5.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

honcho-cli

Inspect and debug Honcho workspaces via the honcho CLI. Use when investigating peer representations, memory state, session context, or dialectic quality — any task that requires introspection of a Honcho deployment, including verifying that a recall/record memory loop is actually working.

plastic-labs/honcho · 61 tokens

upload-debug-memory

Use after resolving a bug, test failure, build failure, CI issue, deployment issue, or framework/API pitfall when the verified lesson should be published to Noosphere for future agents.

JinNing6/Noosphere · 41 tokens

diagnose

Use when an AI Brain vault needs a health check or something feels off: Claude ignores CLAUDE.md, journal entries missing from /weekly, hooks not firing, something broke after a git pull, a friend's install misbehaves, Obsidian crashes or pegs the CPU, a .claude/worktrees folder appeared, Granola/WhatsApp/Slack/Gmail…

mycelium-hq/ai-brain-starter · 110 tokens

agent-debug-memory

Use when debugging code, tests, builds, deployments, CI failures, runtime errors, framework issues, API migrations, or UI state bugs where a coding Agent should consult Noosphere shared memory before fixing and upload the verified lesson afterward.

JinNing6/Noosphere · 50 tokens

troubleshooting

Diagnoses and repairs core-memory-kit itself when the memory system is broken — the per-failure-code repair book. Fire whenever a "⚠ [core-memory-kit]" whisper appears on the prompt (it names the failure and points here), or when the user reports a kit symptom however they phrase it: memory is not being saved, nothing…

LH8PPL/core-memory-kit · 159 tokens

status

Check Nowledge Mem connection status, server version, CLI version, and configuration. Use when diagnosing issues or verifying setup.

nowledge-co/community · 26 tokens