Glyph Blog
Claude Code Second Brain: AI Agents on Plain Markdown
Build a Claude Code second brain on plain Markdown. Point Claude Code, Codex, or Cursor at a notes folder, then review, link, and roll back edits in Glyph.
- Claude Code second brain
- AI second brain
- Claude Code notes
- Claude Code Obsidian vault alternative
- LLM wiki
- Codex notes folder
- AI agent Markdown notes
A year ago, coding agents lived in code repositories. Now a lot of people point them at their notes.
The pattern is simple. Keep your notes as Markdown files in a folder. Open Claude Code, Codex, Cursor, or OpenCode in that folder. Ask it to file the inbox, summarize a week, or turn a pile of articles into linked wiki pages. That setup is what most people mean by a Claude Code second brain, and it works because the agent already knows how to read, search, and edit text files.
The missing piece is usually the human side. You still need a calm place to read what the agent wrote, check its links, and undo a bad edit. This guide covers the trend, why plain Markdown is the right foundation, and a practical setup in Glyph.
What is a Claude Code second brain?
A Claude Code second brain is a folder of plain Markdown notes that a coding agent can read and edit on your behalf. You write a short instructions file, such as CLAUDE.md or AGENTS.md, that explains the folder’s conventions. The agent then ingests sources, maintains wiki pages, and answers questions from your own notes.
The same idea goes by other names: AI second brain, LLM wiki, or AI agent Markdown notes. The agent can be Claude Code, Codex, Cursor, or another CLI tool. The substrate stays the same: files you own.
Why people are pointing coding agents at notes
The idea got a clear shape in April 2026, when Andrej Karpathy published his LLM wiki gist. Instead of retrieving chunks from raw documents every time you ask a question, the model builds and maintains a persistent, interlinked Markdown wiki. New sources get folded into existing pages, so knowledge compounds.
His layout has three layers:
- Raw sources: articles, papers, and data the model reads but never edits.
- The wiki: Markdown pages the model writes and maintains, plus an
index.mdcatalog and an append-onlylog.md. - The schema: a
CLAUDE.mdorAGENTS.mdfile that describes conventions and workflows.
Kenneth Reitz wrote about pairing a large Markdown vault with Claude Code, with a CLAUDE.md that explains the vault and a rule that he verifies every connection it proposes. The common thread is not a specific app. It is a folder of text files and a short file of rules.
Why plain Markdown is the ideal substrate for agents
Coding agents are built to work on files. They list directories, search with grep, read files, and write diffs. A notes folder made of .md files gives them exactly that surface.
Plain Markdown helps in four ways:
- No API to learn. The agent reads
Projects/Launch.mdthe same way it readssrc/main.rs. There is no export step and no plugin bridge. - Conventions are cheap. Frontmatter,
[[wikilinks]],#tags, and- [ ]checkboxes are plain text patterns the agent can follow and search. - Changes are reviewable. Every edit is a text diff. Put the folder in Git and you can see, line by line, what the agent changed.
- You can leave. If a tool disappears, the notes stay readable in any editor.
A notes app that stores writing in a private database breaks all four.
How CLAUDE.md and AGENTS.md give the agent its rules
Both major agents read a Markdown instructions file before they start work.
Claude Code loads CLAUDE.md files from the working directory and the folders above it, and reads them at the start of every session. Anthropic recommends keeping each file under 200 lines. Claude Code can also read AGENTS.md when no CLAUDE.md is present, and a CLAUDE.md can import another file with @path syntax.
Codex builds an instruction chain from AGENTS.md files, from a global file in ~/.codex down through the project folders, capped at 32 KiB by default. AGENTS.md is an open format supported by Codex, Cursor, opencode, and others, so one rules file can serve several agents.
How to build a Claude Code second brain in Glyph
Glyph is a native Mac notes app that stores every note as a plain .md file in a folder you choose, called a Space. The agent works on the files. You read and organize them in a real notes app instead of a terminal.
1. Create a Space and a folder structure
Run Create Space (Cmd+Shift+N) or Open Folder on an existing notes folder. See Making a new Space. Then add a small structure:
Second Brain/
AGENTS.md
CLAUDE.md
Inbox/
Daily/
Projects/
Sources/
Wiki/
index.md
log.mdIn Settings → Space, point the Inbox at Inbox/ and Daily Notes at Daily/. New notes then land in one place until you, or the agent, file them. See Inbox and Archive and daily notes in Markdown.
2. Write the rules file
Put the conventions in AGENTS.md so Codex, Cursor, and OpenCode can read them. It shows up in Glyph like any other note, so you can edit it there.
# Vault rules
- Notes are plain Markdown. Never rename or delete a file without asking.
- Sources/ is read-only. Summarize sources into Wiki/, never edit them.
- Wiki pages use [[wikilinks]] to existing page titles. Check Wiki/index.md first.
- Add every new wiki page to Wiki/index.md under the right heading.
- Append one line per run to Wiki/log.md: date, action, files touched.
- Tasks are "- [ ]" checklists inside the note they belong to.
- Daily/ holds daily notes. Do not rewrite past days.
- Ask before touching anything outside Inbox/, Wiki/, and Projects/.Then make CLAUDE.md a single line, @AGENTS.md, so Claude Code loads the same rules through its import syntax.
3. Connect the agent you already pay for
In Glyph, go to Settings → AI, turn on AI features, set Connection type to Agents, and choose a Provider. Glyph supports Claude Code, Codex, Cursor, Grok, OpenCode, and Pi. It calls the CLI already installed on your Mac and uses that CLI’s own sign-in. You do not enter a Glyph API key, and Glyph does not resell any of those subscriptions. See AI agents and existing subscriptions.
Confirm the CLI works in Terminal first. Agent choice is per Space, so you can run Claude Code here and Codex in a work Space.
4. Start in chat-only mode, then turn tools on
Glyph’s AI chat has access to tools switch decides how much the agent can do. With tools off, it is chat-only. With tools on, it is create mode and can change files in the Space. The Glyph AI overview recommends starting with tools off until you trust the flow.
Open the chat with Toggle AI Panel (Cmd+Shift+A) or click Agent in the sidebar for a full workspace tab. Type @ to attach files or folders as context. Attach AGENTS.md along with the notes for the task, so the rules are in front of the model whatever the CLI loads by default.
5. Add the Glyph CLI for Terminal sessions
For long Terminal sessions, the Glyph CLI gives that agent structured access to the same Space: glyph search run, glyph note append --stdin, glyph daily create, and glyph task list --open. Pass --json for structured output and --dry-run to validate a change first. Update commands accept a --revision so a change does not overwrite something Glyph or another command wrote first. The CLI is open source on GitHub.
If notes edited from Terminal look stale in Glyph search, rebuild the index under Settings → Space → Search Index.
6. Turn on Git sync before the first big run
Set up Git sync so every agent run has a history. More on that below.
Example prompts and workflows
These prompts assume tools are on and AGENTS.md is attached.
Ingest a source into the wiki. Save an article into Sources/ (see the Markdown web clipper workflow), then attach it:
Read @Sources/2026-11-local-first-sync.md. Summarize it into a new Wiki page, update any existing Wiki pages it changes, link related pages with wikilinks, add the page to index.md, and log the run.
Weekly review. Glyph has weekly notes alongside daily notes. Attach the Daily/ folder:
Read this week’s daily notes. Draft a weekly review with wins, open loops, and decisions. List any unfinished tasks with links to the note they came from. Do not edit the daily notes.
Link suggestions. Ask for proposals first, then apply the ones you agree with:
Read @Wiki/index.md and @Projects/Launch.md. Suggest up to ten wikilinks this note should have, with one sentence of reasoning each. Do not edit yet.
Glyph also finds these without AI. The Unlinked mentions list in the info sidebar shows notes that mention the current note in plain text, and you can link them one at a time or with Link all. More in wikilinks and backlinks.
Task extraction. Attach a meeting note:
Pull every action item from this note into ”- [ ]” checklist lines under a Tasks heading. Keep the owner’s name in each line.
The items then appear in Glyph’s Tasks tab, which lists open checklist items across the Space.
For small edits, select text in Rich mode, run AI: Use Selection as Context, and choose Replace selection or Insert below after you read the answer. See AI editing workflows. And for reminders that point back into the wiki, Copy Deeplink on any note gives you a glyph:// link that opens Glyph at that file.
Terminal agent vs Glyph vs Obsidian with plugins
| Agent in Terminal on a folder | Glyph with an agent | Obsidian + plugins | |
|---|---|---|---|
| Notes format | Plain Markdown | Plain .md files in a Space | Plain Markdown in a vault |
| Reading and browsing | Terminal or a separate editor | Native Mac editor, backlinks, graph, Tasks tab | Full editor, graph, and backlinks |
| Agent connection | Run the CLI yourself | Built in: Claude Code, Codex, Cursor, Grok, OpenCode, Pi | Community plugins, or run an agent in the vault folder |
| Context control | Agent decides what to read | @ attach files and folders, tools on or off | Depends on the plugin |
| Reviewing edits | git diff | Git sync plus Version history in the info sidebar | Community Git plugin or Terminal |
| Local models | Depends on the agent | Ollama, llama.cpp, OpenAI-compatible servers | Depends on the plugin |
| Third-party code | Just the agent | Just the agent | Each plugin runs third-party code |
Obsidian is a strong app and a common LLM wiki reader. Its help page notes that community plugins run third-party code, so an AI layer built from plugins adds trust decisions. Glyph builds the agent connection, tasks, daily notes, and Git sync into the app. For the wider comparison, see Obsidian vs Glyph or the comparison page.
How do you keep an AI second brain safe?
Review diffs before they sync. Glyph’s Git sync commits and pushes on a timer, with the message “Glyph sync”, or when you click Sync Now. Turn on Manual commit messages and sync right before a big agent run, so you have a clean checkpoint. Afterwards, run git diff in Terminal or open Version history in the info sidebar for any note. If the agent made a mess, revert to the checkpoint. Note that Stop in the AI panel cancels a reply but does not undo file changes already made. Git sync for Markdown notes covers the habits in depth.
Scope what the agent can touch. In Glyph, keep tools off for questions and turn them on only for create work. Attach just the notes the task needs. In Terminal, use each agent’s own controls. Claude Code supports permission deny rules, such as Read(./Private/**) or Edit(./Sources/**), and Codex has a read-only sandbox mode for runs that should never write.
Keep private notes out. Deny rules are useful, but the cleanest boundary is a separate Space. Keep journals, health notes, and client records in a Space with AI off or with a local model only. Provider choice in Glyph is per Space, so the boundary holds.
Use local models for sensitive material. Set Connection type to Local and choose Ollama or llama.cpp. Glyph talks to Ollama at localhost:11434, so the text stays on your Mac. See Local models and private AI notes. Agent CLIs like Claude Code and Codex send context to their providers, so read their data terms before you attach anything sensitive.
Common questions
Do I need Obsidian to build a Claude Code second brain?
No. Any folder of Markdown files works. Glyph opens an existing folder as a Space, so you can point it at a vault you already have and keep using the same files.
Does Glyph upload my notes to run the agent?
Glyph has no cloud and no account. It calls the agent CLI on your Mac. What that agent sends to its own provider depends on the agent and your subscription, which is why a local model is the better fit for private folders.
Give your agent a folder, and yourself a notes app
The second brain trend works because it rests on plain files. The agent does the filing and linking. You keep the judgment, and Glyph is built for that split. Your notes stay as .md files on your Mac. The agent you already pay for plugs in from Settings → AI. You read the results in a native Mac app with backlinks, a graph, a Tasks tab, and daily notes built in, and Git sync gives you a way back from every run. The app is open source, needs no account, and costs a one-time $14.99 after a 7-day free trial.
Try Glyph on your notes folder, write a ten-line AGENTS.md, and let the agent take the first pass at your inbox.