By wrxck
A persistent knowledge brain for Claude Code, backed by Trilium Notes. Standards, decisions, lessons learned, and per-app context that survive across sessions and grow over time. Includes a setup wizard, an MCP server with brain_recall / brain_remember / brain_scan_transcripts tools, and a discipline skill that makes Claude actually use it.
The behavioural rules Claude follows when matts-second-brain is installed. Loaded automatically — defines how to consult and write back to the brain. Always invoked at session start. Skip only if the user has explicitly disabled second-brain.
Periodic brain hygiene: dedupe near-duplicate notes, flag stale file citations and contradictions, archive long-unused notes, and reindex. Use when the user says 'brain hygiene', 'consolidate the brain', 'clean up duplicate notes', 'find stale notes', or after a long burst of writing. Opt-in and dry-run by default.
Set up matts-second-brain end-to-end on this Claude instance: detect or install Trilium, prompt for an ETAPI token, register the MCP server, seed the brain taxonomy, optionally scan existing transcripts for inferable standards. Use when the user says things like 'set up second brain', 'install matts-second-brain', 'wire up Trilium memory', 'connect Claude to my notes'.
Manage the unattended nightly brain maintenance job (scan recent transcripts, persist durable knowledge, dedupe, reindex). Use when the user says 'set up brain maintenance', 'schedule brain consolidation', 'run brain maintenance now', or wants to check/disable it. Subcommands: install, status, run, dry-run, uninstall, test.
Manually query the second-brain (Trilium) for notes relevant to the current task. Use when you want Claude to consciously consult the brain before acting — e.g. 'recall git workflow', 'what do we know about macpool deployment', 'recall lessons from the Stripe incident'.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
This plugin requires configuration values that are prompted when the plugin is enabled. Sensitive values are stored in your system keychain.
scanSinceDaysHow many days of recent transcripts the maintenance scan considers.
${user_config.scanSinceDays}sessionReminderInject the brain discipline at session start (knowledge-only, recall-before, capture-after). Set false to rely on the auto-loaded skill alone.
${user_config.sessionReminder}maintenanceModelModel the unattended maintenance run uses.
${user_config.maintenanceModel}maintenanceScheduleCron expression (UTC) for scheduled maintenance.
${user_config.maintenanceSchedule}scheduledMaintenanceRun unattended nightly brain maintenance (scan transcripts, persist durable knowledge, reindex). Enable, then run /matts-second-brain:maintenance install.
${user_config.scheduledMaintenance}maintenanceTimeoutMinHard timeout (minutes) for the unattended maintenance agent run.
${user_config.maintenanceTimeoutMin}A persistent knowledge brain for Claude Code, backed by Trilium Notes. Standards, decisions, lessons learned, and per-app context survive across sessions and grow over time — Claude reads before it acts and writes back when something noteworthy happens.
This is not a memory file. It's a structured, searchable, editable knowledge base that you and Claude both contribute to. Over months it becomes the thing that turns Claude from "knows the current task" into "knows your standards, your history, and your past mistakes."
The brain is backend-agnostic. Pick what fits your workflow:
| Backend | Best for | Setup |
|---|---|---|
| Trilium (default) | Self-hosted, queryable, structured attributes, ETAPI | BRAIN_BACKEND=trilium + Trilium URL + ETAPI token |
| Obsidian | Local markdown vault, syncs via Obsidian's own sync / iCloud / Syncthing | BRAIN_BACKEND=obsidian + BRAIN_OBSIDIAN_VAULT=/path/to/vault |
| Notion | Cloud-hosted, team-shareable, rich blocks | BRAIN_BACKEND=notion + BRAIN_NOTION_TOKEN + BRAIN_NOTION_ROOT_PAGE |
All three implement the same BrainAdapter interface (mcp-server/src/adapters/index.ts). Adding a backend is one file: implement the interface, register it in the factory, ship.
Built after a real incident: a leaked secret revealed that the only memory Claude had across sessions was the inline MEMORY.md file. Useful, but it doesn't scale to dozens of apps and hundreds of standards. Trilium does — and it's already self-hostable, syncable, and structured.
| Component | What it does |
|---|---|
MCP server (@matthesketh/second-brain-mcp) | Tools: brain_recall, brain_search_semantic, brain_remember (dedup-on-write), brain_update, brain_scan_transcripts, brain_check_citations, brain_stats, brain_sync_srag, brain_setup_check, brain_seed_taxonomy, brain_onboard. Every write is audited (secret-redacted). |
Skills (:install, :recall, :remember, :maintenance, :hygiene) | Setup, manual write-back, scheduled self-consolidation, and periodic cleanup |
| Discipline skill (loaded via plugin) | The rules Claude follows: cite when consulting, verify before recommending, write decisions not opinions, surface contradictions |
| Setup wizard | Detects whether Trilium is reachable; offers to install if not. Generates the root taxonomy. Optionally seeds from existing transcripts. |
The plugin exposes opt-in userConfig (set via /config or the plugin settings):
| Option | Default | Effect |
|---|---|---|
sessionReminder | true | a SessionStart hook injects the brain discipline (knowledge-only, recall-before, capture-after) every session |
scheduledMaintenance | false | enable the nightly self-consolidation job |
maintenanceSchedule | 0 4 * * * | cron (UTC) for the job |
maintenanceModel / scanSinceDays / maintenanceTimeoutMin | sonnet / 2 / 10 | tuning for the unattended run |
Self-consolidation. With scheduledMaintenance enabled, /matts-second-brain:maintenance install
adds a local cron that runs a tested, dependency-free harness (maintenance/). It launches a
headless claude -p constrained to the brain tools to scan recent transcripts, persist durable
knowledge (deduped), and reindex — so the brain updates itself even when you don't think to.
It is local (not a cloud /schedule routine) because the brain backend is local. Manage it
with /matts-second-brain:maintenance (install / status / run / dry-run / uninstall / test).
Hygiene. /matts-second-brain:hygiene (dry-run by default) dedupes near-duplicates, flags
stale citations and contradictions via brain_check_citations, and proposes archiving long-unused
notes.
The plugin's MCP server needs a Trilium instance. The setup wizard will help you stand one up if you don't have one (Docker, a few lines of compose).
/plugin install matts-second-brain
Then in any Claude session:
/matts-second-brain:install
The wizard checks Trilium reachability, prompts for an ETAPI token (hidden input), seeds the taxonomy, and registers the MCP. Optionally offers to scan your existing ~/.claude/projects/* transcripts and infer standards from patterns it sees.
Claude session
│
├── on session start: brain_recall(cwd_context)
│ → Trilium ETAPI search → relevant Standards/, Apps/<this>, Lessons Learned/
│ → injected into context with citation tags
│
├── during session: any tool can call brain_remember(category, title, body)
│ → new note in Trilium with #claude-brain tag + dated
│
└── on session end (or manual): summary → Decisions/ or Lessons Learned/
When the plugin is installed, Claude is required to:
npx claudepluginhub wrxck/claude-plugins --plugin matts-second-brainAutonomous security auditor. Scans a GitHub repo for vulnerabilities, triages false positives, writes a PoC, fixes each confirmed bug in its own PR, independently reviews the fix, and merges when the review is clean.
Learns from your corrections and writes hooks so Claude never repeats the same mistake
Create detailed Mermaid diagrams for architecture, flows, ERDs, and more — and improve READMEs with visual documentation
Mines your Claude Code history, config, and session transcripts, spots the workflows you keep repeating, and forges them into the right artifact — a skill, subagent, hook, slash command, workflow, or a full publishable plugin. Local-only analysis; hands off to mcp-forge, behavior-hooks, and matts-second-brain where they fit.
Git workflow - commit validation, conventional commits, PR creation, releases, code review
Harness-native ECC plugin for engineering teams - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, MCP conventions, and operator workflows for Claude Code plus adjacent agent harnesses
Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques
A growing collection of Claude-compatible academic workflow bundles. Covers scientific figures, manuscript writing and polishing, reviewer assessment, citation retrieval, data availability, paper reading, literature search, response letters, paper-to-PPTX conversion, and evidence-grounded Chinese invention patent drafting. Rules are organized as reusable skill folders with explicit workflows and quality checks.
Plugin-safe Claude Code distribution of Antigravity Awesome Skills with 1,640 supported skills.
Comprehensive skill pack with 66 specialized skills for full-stack developers: 12 language experts (Python, TypeScript, Go, Rust, C++, Swift, Kotlin, C#, PHP, Java, SQL, JavaScript), 10 backend frameworks, 6 frontend/mobile, plus infrastructure, DevOps, security, and testing. Features progressive disclosure architecture for 50% faster loading.