bengous/agents-skills/second-brain
Claude Code and agent skill by bengous/agents-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
USER-INVOKED ONLY. Invoke only when the user runs $second-brain or explicitly names this skill. Stand up and maintain an agent-maintained markdown wiki that loads progressively and stays bounded: a thin always-loaded index plus a recent-window journal, with the source catalog, sealed period archives, and synthesis pages pulled only on demand. Triggers: the user invokes $second-brain; wants to set up a second brain, knowledge base, agent memory, or LLM wiki; or a memory/log/notes file has grown large and is reloaded in full every session and they want it windowed and bounded. Not for a handful of notes, and not for a million-document corpus (that is a search/RAG problem). Never invoke implicitly.
Install
npx vskill@latest install bengous/agents-skills/second-brainSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as bengous/agents-skills/second-brain.
Second Brain
Stand up and maintain a markdown wiki an agent keeps for itself — one that loads progressively and stays bounded no matter how large it grows.
The model in one paragraph
A finite attention budget means you cannot load the whole knowledge base every session, so split it with a single loading boundary. Eager (loaded every session): a thin index.md that maps the wiki, plus the recent window of journal.md. On demand (pulled only when a link is followed): the source catalog.md, everything under raw/ and pages/, and the sealed archives under log/. The eager set is small and fixed; it does not grow as the wiki grows, because the index links to content instead of inlining it. That boundary is the whole idea — everything below serves it.
When to use this
- The user invokes
$second-brain, or asks to set up a second brain / knowledge
base / agent memory / LLM wiki.
- A memory, log, or notes file has grown large and is reloaded in full every
session — the symptom this fixes is "one giant file is eating my context".
When not to:
- A handful of notes (two or three files). Plain files are lighter; say so and stop.
- A corpus of millions of documents nobody curated. That is a search / RAG
problem; this pattern is for a hand-curated base (see references/limits.md).
Structure
Workflow A — Setup (new wiki)
- Load
references/setup-guide.md. - Scaffold:
scripts/init-wiki.sh <target-dir>. It refuses a non-empty target
without --force, so it never writes over existing content.
- Personalize
SCHEMA.md— keep the generic mechanics, add domain rules under
the line at the bottom.
- Wire
scripts/check-wiki.shinto a hook (portable pre-commit by default; a
Claude Code Stop hook in addition when relevant). See the setup guide.
- Run
scripts/check-wiki.sh— it should printwiki check OK.
Workflow B — Maintenance (existing wiki, or one that has bloated)
- Diagnose the bloat: which file is loaded eagerly and large? Usually a fat
index that inlines a catalogue, or a journal that never gets windowed.
- Thin the index: move any inlined catalogue or content out of
index.mdinto
catalog.md or a page, leaving one-line links behind.
- Window the journal:
scripts/archive-journal.shseals the oldest whole months
into log/YYYY-MM.md and leaves a pointer. Re-run is a no-op once bounded.
- Load
references/maintenance-protocol.mdfor the ingest / query / lint cycle
and the anti-orphan invariant.
- Run
scripts/check-wiki.shand fix any orphan it reports.
Scripts: run them, do not reimplement them
The scripts are deterministic and bundled so every invocation does not re-derive them. Execute them; read their output, not their source.
init-wiki.sh <dir> [--force]— scaffold from templates.check-wiki.sh— anti-orphan + index-integrity lint, plus frontmatter checks
(updated: format as an error, index freshness as a warning) that no-op on files without frontmatter. Run from the wiki root (or via its hook). A non-zero exit means an orphan, a missing required file, or a malformed date.
archive-journal.sh [threshold_bytes]— seal old months out of the journal.
Gates
- Never scaffold over existing content.
init-wiki.shrefuses a non-empty
directory without --force; do not reach for --force to overwrite a real wiki without the user confirming.
- Never rewrite a sealed archive.
log/YYYY-MM.mdfiles are immutable;
archive-journal.sh refuses to touch one that exists. Growth goes into new files, never edits of old ones.
- The index links, never inlines. If you are about to paste content into
index.md, put it in a page and link instead.
References — load on demand, not all at once
references/loading-model.md— the tiers and the loading boundary in depth;
why imports don't bound context and on-demand reads do. Load when deciding what goes eager vs on-demand.
references/maintenance-protocol.md— ingest / query / lint, rollover, the
anti-orphan invariant, freshness. Load when maintaining an existing wiki.
references/setup-guide.md— scaffolding steps and how to wire the check
(portable vs Claude Code). Load during setup.
references/limits.md— where the model stops scaling (when to shard the index,
add a search CLI, or — only at very large scale — reach for RAG) and when not to use this pattern at all. Load when hitting scale limits.
references/scaling-up.md— the graduated architecture as a case study: full
typed page contract, registry-driven lint CLI, federated wikis, three-tier memory, multi-agent projection. Load when a wiki outgrows the baseline.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsecond-brain/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bengous/agents-skills/second-brain)