Skip to content

Build an AI Second Brain with Claude Code

Category Claude Code
Status 🟡 Partially completed
Repo nextwork-build-an-ai-second-brain-with-claude-code
Original NextWork guide nextwork.ai
Proof Official NextWork write-up: web · PDF

Learning project

Practice work following a NextWork guide, separate from my production projects.

📚 NextWork learning project. This is a practice project I built while working through NextWork's Build an AI Second Brain with Claude Code guide. It is part of my Learning portfolio and is fully separate from my production projects.

Category: Learning › Claude Code
Status: 🟡 Partially completed

Proof: Official NextWork write-up: web · PDF

Overview

A second brain only works if it stays trustworthy, so the raw notes are never edited, every wiki claim cites one, and linting checks the whole thing. I let Claude Code do the filing and kept the rules in a schema file it has to follow.

Summary

Claude Code built and ran a compiled-wiki knowledge vault from five sourdough notes I wrote. I set it up as a vault with raw/ (originals, read-only) and wiki/ (pages Claude maintains), a CLAUDE.md schema, and four slash commands (/ingest, /query, /lint, /log) that Claude authored. Running /ingest on the notes produced 12 cross-linked, cited concept pages with 38 links, an index and an append-only log; /query answered 'why did my loaf spread flat' from the wiki with page citations and said so when asked something the wiki couldn't answer; /lint reported 0 problems; /log added an entry. A check confirms raw/ is byte-for-byte unchanged and every page is sourced and every link resolves. Partial: no Obsidian (I drew the link graph with my own script), the notes are sample notes rather than my real ones, and I copied the command files into .claude/commands myself because headless Claude Code can't write there.

The checks behind this are in docs/verification.txt.

Skills & tools

Claude Code, Slash commands, Knowledge management, Markdown wikilinks, Python

What I built

  • raw/: five sample notes about learning sourdough, written by me and never edited. wiki/: 12 concept pages plus index.md and log.md, all written by Claude Code.
  • CLAUDE.md: the schema (folder rules, page format, citation rule). command-src/ and .claude/commands/: the four slash commands Claude wrote.
  • prompts/ and docs/session-log.md: my prompts and the readable log of every session, including the query that the wiki couldn't answer.
  • graph.py and docs/wiki-graph.png: my own drawing of the wikilink graph (a stand-in for a note app's graph view).
  • tests/verify.py: raw files unchanged (hashes), every page has sources and related links, no broken links, index and log complete, commands present.

How to run

python3 tests/verify.py
python3 graph.py wiki docs/wiki-graph.png
# with Claude Code: claude, then /ingest raw/<file>, /query <question>, /lint, /log <note>

Verification

I ran the verification command on 2026-12-03. The full output is in docs/verification.txt.

/workspace/nextwork-portfolio/.venv/bin/python tests/verify.py | grep -q 'SECOND BRAIN OK' && echo BRAIN OK

Notes

My first attempt failed in an instructive way: headless Claude Code couldn't write under .claude/commands/, yet it logged that it had created the commands. I caught that, restarted from scratch and had it write the command files to command-src/ for me to copy. The wiki also ended up with near-duplicate pages (whole-wheat-flour and whole-wheat-flour-starter), which a lint pass doesn't flag.

What isn't done, and why

No Obsidian: the vault is plain markdown and the graph is drawn by my script. The sample notes are written for this exercise, not my real notes or exports. Command files were copied into .claude/commands by me.


Original project: https://nextwork.ai/projects/3c934ac2-caa3-544c-bccb-a3aa89b1a1cc · Part of my NextWork Learning portfolio (hub).

Verification output

From docs/verification.txt:

$ /workspace/nextwork-portfolio/.venv/bin/python tests/verify.py | grep -q 'SECOND BRAIN OK' && echo BRAIN OK

BRAIN OK

[exit code 0]