second-brain-mcp CLAUDE.md

second-brain-mcp CLAUDE.md is an instructions file for Claude Code from ddmanyes/second-brain-mcp. It costs 1,164 tokens per session, scanned A, original, MIT.

Project instructions for a second-brain MCP server, a service that lets an AI work with a personal knowledge vault. The vault uses Markdown files as its source of truth and can index them in PostgreSQL or DuckDB.

In plain words
What is it for?
Use them when running, connecting to, testing, syncing, backing up, or securing this second-brain service.
Why use it?
They define how clients connect, where data is stored, how indexing and backups work, and how to prevent conflicting writes or unsafe test database use.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

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 instructions/ddmanyes/second-brain-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/ddmanyes/second-brain-mcp

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 second-brain-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/ddmanyes/second-brain-mcp/claude-md.svg)](https://agentmods.dev/instructions/ddmanyes/second-brain-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/ddmanyes/second-brain-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/ddmanyes/second-brain-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,164 This file is loaded in full into every session.
When invoked 1,164 The same file — it is already loaded in full.
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.01164 $0.01164
Opus 5 $0.00582 $0.00582
Sonnet 5 $0.00233 $0.00233
Haiku 4.5 $0.00116 $0.00116

Measured yesterday against content hash 94d22d3ded61, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

second-brain-mcp CLAUDE.md 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 yesterday.

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.

CLAUDE.md · 50 lines

How it starts

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

Second Brain MCP Server

本地 Claude Code:操作 SOP 見 AGENTS.md,vault 目錄結構與工具清單在同一文件。 遠端 MCP 連入:呼叫 get_agent_instructions() 工具可取得 AGENTS.md 完整內容。 CLAUDE.md 位置second-brain/CLAUDE.md(由 Claude Code 在此目錄啟動時自動載入)。

執行(開發)

uv run --with "mcp[cli]" --with "markitdown[all]" python -m mcp_second_brain

部署(改完碼要做的事)

⚠️ 線上服務跑的是「安裝好的 wheel」,不是這個 checkoutlcdda-start-remote.sh 明寫 "The live service imports the installed wheel")。只改 repo + 重啟服務不會生效

~/.venvs/second-brain/bin/pip install --force-reinstall --no-deps ~/git-repos/second-brain
launchctl kickstart -k gui/501/com.user.second-brain-remote
launchctl kickstart -k gui/501/com.user.lcdda-remote
  • 三個 server(sb :9100 / lcdda :9104 / lcdda-harvest :9106共用同一個 venv, 一次 pip install 全部改到——要嘛全部重啟,要嘛新舊碼並存。
  • AGENTS.md 也是 wheel 的一部分pyproject.tomlforce-include),所以改手冊 同樣要重新打包才會送到遠端 agent。tests/test_wheel_packaging.py 會驗產物內容。
  • 這個落差曾讓 get_agent_instructions() 靜默回傳 placeholder 數個月都沒被發現, 見 CHANGELOG「wheel never packaged AGENTS.md」。

架構(中央活腦)

  • Index backend 可插拔store/,由 SB_DB_BACKENDpostgres(中央,pgvector+pg_trgm,多機並發)或 duckdb(預設/離線 fallback)。markdown 是正本,index 可由 sync_all 重建。
  • 正式拓樸:單一中央 HTTP server(launchd com.user.second-brain-remotestreamable-http 綁 Tailscale IP :9100SB_DB_BACKEND=postgres)+ Docker Postgres(sb-pg,僅 127.0.0.1:5432)。
  • 連線:client 走 http://<tailscale-ip>:9100/mcp,帶 header X-API-Key(server 設 SB_API_KEY/SB_API_KEYS 時強制)。Postgres 永不對外,只 server 同機 localhost 連。
  • 排程second-brain-pg-syncStartCalendarInterval 每逢 :00:30 incremental,防脫節)、second-brain-pg-backup(每日 pg_dump)。
  • 寫入紀律:所有寫入經中央 server(單一寫者);client 端 Obsidian 唯讀,避免 Drive 衝突副本。
  • 測試:Postgres 測試對 sb_test(fixture 會 DELETE 全表,絕不可指向 sb_personal/sb_labtest_postgres_store.py 有硬 guard)。
  • 詳見 MIGRATION_PLAN_POSTGRES.mdAGENTS.md 的 Connection Topology 段。

Read the full file on GitHub · 50 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. yesterday Changed · +18 lines · +326 tokens per session 94d22d3ded61
  2. 5d ago First seen · 32 lines · 838 tokens per session scan A b7f11ca3695c

Subscribe to this mod's changes

second-brain-mcp CLAUDE.md is an instructions file published in the GitHub repository ddmanyes/second-brain-mcp (3 stars, last pushed yesterday), licensed MIT. It adds 1,164 tokens to every session, about $0.0058 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-31.