brain-rebuild

brain-rebuild is a skill for Claude Code from jessepinkman9900/claude-second-brain. It costs 74 tokens per session (1,278 once invoked), scanned A, original, MIT.

A procedure for redesigning the qmd search index for a personal wiki. qmd is the tool that organizes searchable collections and contexts, while embeddings are data used for meaning-based search.

In plain words
What is it for?
Reviewing the wiki structure, recommending new collections and search contexts, updating the setup script, and rebuilding the index. It is meant for major reorganizations, not a routine refresh.
Why use it?
It helps when the wiki's current search structure no longer matches its folders or the way the user searches. The rebuild is destructive: it removes the existing collections, contexts, and embeddings before creating a new index.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md.

Good fit Reviewing the wiki structure, recommending new collections and search contexts, updating the setup script, and rebuilding the index. It is meant for major reorganizations, not a routine refresh.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jessepinkman9900/claude-second-brain/brain-rebuild
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 jessepinkman9900/claude-second-brain --skill brain-rebuild
Clone the repo
git clone --depth 1 https://github.com/jessepinkman9900/claude-second-brain

Made for: Claude Code.

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-rebuild

README.md
[![agentmods](https://agentmods.dev/badge/skills/jessepinkman9900/claude-second-brain/brain-rebuild/github.svg)](https://agentmods.dev/skills/jessepinkman9900/claude-second-brain/brain-rebuild)
Your own site
<a href="https://agentmods.dev/skills/jessepinkman9900/claude-second-brain/brain-rebuild"><img src="https://agentmods.dev/badge/skills/jessepinkman9900/claude-second-brain/brain-rebuild/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-rebuild

Your own site · 80×15
<a href="https://agentmods.dev/skills/jessepinkman9900/claude-second-brain/brain-rebuild"><img src="https://agentmods.dev/badge/skills/jessepinkman9900/claude-second-brain/brain-rebuild.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,278 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.00074 $0.01278
Opus 5 $0.00037 $0.00639
Sonnet 5 $0.00015 $0.00256
Haiku 4.5 $0.00007 $0.00128

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

Security

Grade A, and why

brain-rebuild 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 11d 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.

template/.claude/skills/brain-rebuild/SKILL.md · 120 lines

How it starts

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

Brain Rebuild

Redesigns the qmd schema based on what the wiki actually contains today, then rebuilds the index from scratch. Destructive — wipes existing collections/contexts and their embeddings. Always get explicit user approval before applying changes.

When to Use

  • The wiki has grown and the current single wiki collection no longer matches how the user searches
  • The user wants finer-grained contexts (e.g. distinct context descriptions per sub-folder)
  • After significant reorganization of wiki/ or raw-sources/ folder structure
  • Never as a routine refresh — for that, use /brain-refresh

Procedure

All commands run from the vault root.

Step 1 — Survey the current state

  • Read scripts/qmd/setup.ts to see the current collections and contexts
  • Read CLAUDE.md to understand the documented schema and any references to collection names
  • List current state from qmd:
    INDEX_PATH=.qmd/index.sqlite pnpm dlx @tobilu/qmd collection list
    INDEX_PATH=.qmd/index.sqlite pnpm dlx @tobilu/qmd context list
    INDEX_PATH=.qmd/index.sqlite pnpm dlx @tobilu/qmd status
    

Step 2 — Analyze the wiki

  • Glob wiki/**/*.md and raw-sources/**/*.md
  • Read enough pages (especially wiki/index.md and wiki/overview.md) to understand actual topic clusters, page-type distribution, and folder structure
  • Identify natural groupings: by domain (e.g. ml, distributed-systems, finance), by page type (topics vs entities vs qa), by source provenance, etc.

Step 3 — Propose a new schema

Produce a recommendation that includes:

  • Collections — name, root path (relative to vault), file glob pattern. Justify each split.
  • Contexts — global context, plus per-collection and per-subpath context descriptions. Each context should be a one-sentence description that helps a future search disambiguate between similar pages.
  • Migration impact — what changes for /brain-ingest, /brain-search, /lint, and CLAUDE.md (e.g. if collection name wiki becomes wiki-topics, all -c wiki invocations break)

Read the full file on GitHub · 120 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. 11d ago First seen · 120 lines · 74 tokens per session scan A e0214740257f

Subscribe to this mod's changes

brain-rebuild is a skill published in the GitHub repository jessepinkman9900/claude-second-brain (47 stars, last pushed 4mo ago), licensed MIT. It adds 74 tokens to every session and 1,278 once invoked, about $0.0004 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

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

kmd-ingest

The write protocol for a markdown knowledge base (Obsidian-compatible, the LLM-wiki pattern) — personal or shared. Use for EVERY write into the KB — distilling a new or scraped source, promoting a finished artifact/report/lesson into the KB, filing a durable learning, insight, or query answer, or correcting/updating…

yasik/kmd · 135 tokens

loredex-curate

Write a Start-Here brief for a project or a recent session's findings, and flag stale/duplicate/orphaned notes. Use when the user says "curate my dex/research", "where do I start", "make sense of this project", or just finished a session that produced several markdown files and wants a handoff.

ahmedtawfeeq1/loredex · 74 tokens

loredex-mcp

Set up or explain the loredex MCP server — live dex access (search, read, handoffs, product state, safe writes) for any MCP-compatible agent. Use when the user wants agents to query the dex mid-task, asks to "connect the dex to Cursor/Codex/an agent", or asks what the loredex MCP tools do.

ahmedtawfeeq1/loredex · 78 tokens

loredex-init

Set up loredex for the current project — creates/registers the dex and writes AGENTS.md/CLAUDE.md/.cursor rule conventions. Use when the user says "set up loredex", "init loredex", or wants to start tracking this project's research in a dex.

ahmedtawfeeq1/loredex · 65 tokens

loredex-route

Process the dex's inbox/ plus any new frontmattered files in the current project right now. Use when the user says "route my findings", "file what's pending", or wants a routing pass forced immediately instead of waiting for the automatic Stop hook.

ahmedtawfeeq1/loredex · 58 tokens