Skip to content
All projects
Developer ToolsJul 2026Live

Second Brain: A Personal Knowledge OS for AI Sessions

A Personal Knowledge OS for AI Sessions

One markdown vault, wired into Claude Code through a router pattern, so every AI session starts with my context and writes back what it learned. A router reads an index of about 90 lines and loads only the two or three files a task needs, and a checkpoint loop keeps the vault current.

Second Brain
Year
Jul 2026
Scope
solo build
Type
Developer Tools
Status
Live

~90-line index

The agent reads one index that maps tasks to files, then loads only the two or three files a task needs, never the whole vault.

01

Overview

AI models forget everything between sessions, so every session used to open with the same monologue: who I am, what I'm building, what I decided last week. The obvious fix, one giant CONTEXT.md pasted everywhere, made the agent slower and vaguer. The real problem was context delivery, so Second Brain uses a router that maps tasks to files and a write-back loop that keeps the vault current.

02

The hard parts

  1. 01

    A single huge context file makes the agent slower and vaguer.

  2. 02

    Keeping evergreen facts and time-stamped events from bleeding into each other and going stale.

  3. 03

    Making sure the agent writes back what it learned instead of losing it next session.

  4. 04

    Detecting when the knowledge base is wrong: stale, over-budget, or full of broken links.

03

The approach

The agent reads one index of about 90 lines that maps tasks to files, then loads only the two or three files a task needs. Two kinds of information are kept apart: evergreen facts live in line-capped _context.md files that are patched in place, and events live in append-only dated logs. That keeps retrieval cheap and answers current. Every meaningful session ends with /checkpoint: decisions appended, evergreen facts patched, the focus file rewritten. A PowerShell health check of about 120 lines enforces frontmatter, line budgets, 30-day staleness and broken-link detection, and exits non-zero when something is out of date.

04

Outcome

Every AI session now starts from context instead of a cold introduction and loads only what a task needs. I also built a showcase site for it with a zero-dependency front end (three static pages, one stylesheet, one small JS file), including a hero terminal that replays a real Claude Code session (route, read 3 files, work, /checkpoint) character by character, responsive down to 360px. The vault itself stays private.

05

What I'd do differently

The bottleneck was delivery, not storage, and a memory system without an update loop stops being used. The health check that exits non-zero comes from the same DRDO habit as my other projects: make failures loud.

06

Stack

system
Markdown vaultClaude Code router patternGit
integrity
PowerShell health-check (~120 lines)frontmatter + line-budget rules
showcase
Hand-written HTML5CSS custom propertiesVanilla JS
hosting
Vercel (static, cleanUrls)

Like what you see?

Let's build the next one.

Hiring, or have a problem that needs this kind of engineering? I read every message myself.