second-brain CLAUDE.md

second-brain CLAUDE.md is an instructions file for coding agents from henrydaum/second-brain. It costs 43,863 tokens per session, scanned C, original, MIT.

Architecture instructions for Second Brain, a local-first application that stores data in SQLite, provides a command-line conversation interface, and loads add-on packages. It describes the small core that runs conversations and manages those packages.

In plain words
What is it for?
Use it when modifying the kernel, conversation loop, SQLite persistence, package installation or removal, plugin loading, permissions, or command-line interface.
Why use it?
It helps developers understand which changes belong in the core and which belong in packages. It also points them to the project’s documentation and permission rules before changing code or extensions.

Instructions file

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

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 CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/henrydaum/second-brain/claude-md.svg)](https://agentmods.dev/instructions/henrydaum/second-brain/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/henrydaum/second-brain/claude-md"><img src="https://agentmods.dev/badge/instructions/henrydaum/second-brain/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 43,863 This file is loaded in full into every session.
When invoked 43,863 The same file — it is already loaded in full.
Security scan C 3 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 $0.43863 $0.43863
Opus 5 $0.21931 $0.21931
Sonnet 5 $0.08773 $0.08773
Haiku 4.5 $0.04386 $0.04386

Measured 3d ago against content hash f8e719e1781e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

second-brain CLAUDE.md scanned grade C with 3 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 3d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

prefixes `git push && rm -rf /`; the line is decomposed with a real lexer

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

`subprocess.TimeoutExpired`, `urllib.error.*`); `kernel.py` has been brought to

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

`subprocess.TimeoutExpired`, `urllib.error.*`); `kernel.py` has been brought to
CLAUDE.md · 2,906 lines

How it starts

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

Second Brain — Architecture Notes

Local-first AI kernel with SQLite persistence, a REPL frontend, package install/uninstall, and live plugin loading. Python / SQLite. Solo dev (Henry). The Flet GUI was removed; do not reintroduce.

This file is the deep architecture map for changing the kernel. It is not the authoring contract for sandbox code. Before writing a script or extension, read docs/SDK.md and the matching executable template in templates/; use the code pointers there for the specific subsystem. For permission questions, start with docs/PERMISSIONS_MAP.md. Current code wins over historical notes in this file when they disagree.


⚡ THE KERNEL (READ FIRST)

Second Brain is a microkernel: a minimal, reliable core that boots, runs the conversation loop + agent turn, persists conversations, and loads/unloads plugins. Product capabilities arrive through a package store: a registry you browse, install, and uninstall from. Do not bake heavy features into the kernel; they belong in packages.

Goal in priority order: (1) the kernel works flawlessly and reliably, then (2) build install/uninstall against a cloud store, then (3) versioning and possibly containerization. We are at the end of step (1).

The layout (trees.py)

Two facts decide where any piece of extension code lives, and both are declared in one table at the repo root, beside paths.py.

Who finds it. A root whose files carry a prefix is scanned — something globs f"{prefix}*.py" and indexes what it finds. A root with no prefix is only ever reached by something naming the file. Eight roots:

Root Prefix Found by
tools/ tasks/ services/ commands/ frontends/ tool_ plugin_discovery
parsers/ parse_ parsing.discover()
llm/ llm_ llm.discover()
scripts/ script.run / isolation.is_script

Who put it here. Four trees holding the same eight roots: bundled/ (ships with the app), DATA_DIR/installed (the store's), DATA_DIR/workspace (the agent's), and origin/store itself, which is the same shape reached over git. Discovery precedence is bundled → installed → workspace and first match wins; resolution by filename (isolation.resolve_script) deliberately runs the other way, because there the agent means the file it wrote.

Read the full file on GitHub · 2,906 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. 3d ago First seen · 2,906 lines · 43,863 tokens per session scan C f8e719e1781e

Subscribe to this mod's changes

second-brain CLAUDE.md is an instructions file published in the GitHub repository henrydaum/second-brain (619 stars, last pushed 4d ago), licensed MIT. It adds 43,863 tokens to every session, about $0.2193 per session on Opus 5. A static security scan graded it C with 3 findings (recursive force delete, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.