Columns › 8. Security and working with AI › Part 56
AI as Your Second Brain: Organising Knowledge in Obsidian So Claude Code Can Use It
AI 成為你的第二大腦:用 Obsidian 整理知識,讓 Claude Code 讀得懂
Put a project’s documents, decisions and the AI’s memory into one Obsidian vault: separate raw sources from organised knowledge, write rules for the AI to follow, link the project’s docs and memory in with symlinks, and have Claude Code read before it starts and record when it’s done, with links, search, privacy, sync and backups covered.
In this article
- What this article solves
- Step 1: What a second brain is, and what the AI does in it
- Step 2: Three layers: sources, organised knowledge, rules
- Step 3: Installing and configuring Obsidian
- Step 4: Writing rules for the AI
- Step 5: Linking the project into the vault with symlinks
- Step 6: Letting Claude Code read and write the vault
- Step 7: A fixed routine for every round: read, do, record
- Step 8: Links, search and database views
- Step 9: Privacy and security
- Step 10: Sync and backups
- Common pitfalls
- Key takeaways
- References
- Next
The previous article, “Writing an MCP Server in Go: Connecting AI to OpenProject”, let the agent read tickets. This one tackles a problem that’s easy to overlook: the AI starts from zero every time. It doesn’t remember why last week’s approach was chosen, which plan was tried and withdrawn, or which rules the user laid down. This article builds a “second brain” in Obsidian that people and the AI share: the project’s documents, decision records and the AI’s memory all live in one vault, and the AI reads it before starting and records what it did when it’s done.
What this article solves
After a while of working on a project with a tool like Claude Code, these usually show up:
- The same things have to be said every time. “Answer in Chinese”, “don’t touch production DNS”, “ask me before uploading”: repeated in every new conversation.
- The reasons behind decisions disappear. Code shows how things are done now, not why, what was tried, or why it was withdrawn. Six months later, people and the AI alike may build a withdrawn plan all over again.
- Notes are scattered. Some in the project’s
docs/, some in the AI tool’s own memory folder, some in chat history; people can’t see in their notes app what the AI recorded, and the AI can’t read what people wrote there. - What the AI organises on its own can’t be trusted. It writes guesses as facts and overwrites new information with old, until nobody knows which sentence has a basis.
This article works through:
- What a “second brain” is, and the AI’s role in it.
- Organising the vault in three layers: sources, organised knowledge, rules.
- Installing and configuring Obsidian: link format, properties, attachments and exclusions.
- Writing a rules file for the AI.
- Linking the project’s
docs/and the AI’s memory into the vault with symlinks. - Letting Claude Code read and write the vault:
CLAUDE.md, memory and tools. - A fixed routine for every round of work: read, do, record.
- Links, search and database views.
- Privacy and security.
- Sync and backups.
Step 1: What a second brain is, and what the AI does in it
A “second brain” means keeping knowledge outside your head, somewhere it can be found and connected: you don’t need to remember every detail, only where to look. This used to rest entirely on people: taking notes, organising them, adding links. It took time, so most people’s notes ended up as a pile of files never opened again.
What AI changes is the cost of organising. It can read a long record, pull out the decisions and their reasons, update the matching page and add links, following the same rules every time. It also brings a new problem: it writes fast, and just as easily writes wrongly, writes duplicates, or writes a guess as if it were true. So a second brain in the age of AI isn’t about letting the AI write whatever it likes; it’s about giving it clear structure and rules, and making every sentence point back to a source.
A division of labour:
| Who | Is responsible for |
|---|---|
| People | Deciding what to do, approving the rules, answering the AI’s questions, reading the organised pages now and then |
| The AI | Reading the rules and relevant pages before starting; afterwards writing records, updating pages, adding screenshots, marking what’s uncertain |
| The vault | The single source of truth: sources unchanged, organised knowledge updated, every change recorded |
Step 2: Three layers: sources, organised knowledge, rules
Figure: raw/ holds the sources (read only), wiki/ the organised knowledge (editable), and on top are the rules people and the AI both follow; the index is the contents, the log is append-only.
my-vault/
├── VAULT-RULES.md # rules: how to write, who may change what, what to ask first
├── raw/ # sources: read only, never edited
│ ├── docs/ # the project's documents (linked in from the project, step 5)
│ └── memory/ # the AI tool's memory (likewise)
└── wiki/ # organised knowledge: pages may be added and updated
├── index.md # contents: one line per page
├── log.md # log: append only, old entries never changed
├── images/ # screenshots and pictures
└── *.md # one page per topicWhy layers:
- Sources stay unchanged, so you can always check what the document said, or what the AI recorded, at the time. If organising went wrong, organise again from the sources.
- Organised knowledge can change, and should: one page per topic, updated when new information arrives, rather than a new page every time.
- The index saves the AI from reading everything. It reads
index.mdto learn which pages exist and what each covers, then opens only the ones it needs. It’s the same idea as “retrieve first, then read” in “RAG Basics”. - The log is append-only: the whole vault’s change history, which day, which page, and why.
Step 3: Installing and configuring Obsidian
Obsidian notes are just Markdown files in a folder, with no proprietary format. That’s exactly what makes it a good fit for working with AI: any tool can read and write them directly, without a particular API.
After creating a vault, change a few settings first (Settings → Files and links):
- Internal link format: use
[[Page name]]wikilinks. Quick to write, and Obsidian updates every link when a file is renamed. - New link path: shortest or relative both work; pick one for the whole vault.
- Default location for attachments: a folder (say
wiki/images/), so pasted images don’t litter the root. - Excluded files: folders you don’t want in search and the graph (say, very large raw exports).
Start each page with properties (YAML frontmatter) for structured information that people and the AI can both read:
---
type: decision
status: adopted
date: 2026-11-19
source: raw/docs/changelog.md
---
# Splitting the site in two
Why we split, what the result looks like, what's still to do...The source field matters most: it makes every page point back to its source.
Step 4: Writing rules for the AI
The rules file sits at the top of the vault (say VAULT-RULES.md), in short sentences. Here’s a version you can adapt directly:
# How this vault works
## Folders
- raw/ holds the sources. Read only; never modify.
- wiki/ holds organised knowledge. Markdown pages may be added or updated.
- wiki/index.md is the contents.
- wiki/log.md only gets new entries; old ones are never changed.
## Writing rules
- Every claim must point back to a source file.
- Mark what you don't know as "to confirm"; never fill it in as fact.
- When new information conflicts with an old statement, keep both sources and mark the difference.
- If a page for the concept already exists, update it; don't create a duplicate.
## What a person must confirm
- Before handling a new kind of source for the first time, propose a plan.
- Before changing five or more pages, list them first.
- Don't read private folders; don't send content to outside services.
- When done, report the sources, the pages changed, and what's still uncertain.A few principles for writing rules:
- Write sentences that can be checked. The AI can’t follow “write more clearly”; it can follow “every claim must point back to a source file”.
- Say what needs a person first. Large changes, new kinds of sources and anything touching privacy are where the AI most easily does too much out of helpfulness.
- Agree on conflicts up front. Otherwise the AI usually just overwrites the old with the new, and the history is gone.
Step 5: Linking the project into the vault with symlinks
The project has its own documents (say docs/), and the AI tool has its own memory folder. The least effort isn’t copying them, but having them actually live in the vault, with a symlink left in the project:
# 1. move the project's docs into the vault; leave a symlink in their place
mv ~/code/my-project/docs ~/vault/raw/docs
ln -s ~/vault/raw/docs ~/code/my-project/docs
# 2. do the same for the AI tool's memory folder (the path depends on the tool)
mv ~/.claude/projects/<project>/memory ~/vault/raw/memory
ln -s ~/vault/raw/memory ~/.claude/projects/<project>/memory
# check
ls -l ~/code/my-project/docsAfter this:
- The project’s code, the AI tool and Obsidian see the same files, with nothing to keep in sync.
- People can read, search and link the AI’s memory and the project’s documents right in Obsidian.
- The project’s code and paths don’t change;
docs/changelog.mdis still where it was.
Things to watch:
- git records only the symlink itself, not what’s behind it. To version the documents, use git on the vault side, or link the other way round (whichever side is your main backup).
- Sync tools treat symlinks differently: some follow them, some ignore them (step 10).
- Say clearly in the rules that
raw/holds sources: the AI only reads it when organising, never rewrites it.
Step 6: Letting Claude Code read and write the vault
Claude Code reads the project’s CLAUDE.md (and any other instruction files you configure, such as AGENTS.md) when it starts, along with its own memory. Connect the vault to both entry points:
<!-- a section of CLAUDE.md or AGENTS.md -->
## Notes and documents
- `docs/` is a shortcut to the Obsidian vault `~/vault/raw/docs/`;
the AI's memory is in the same vault under `raw/memory/`.
- For this project's memory, documents, progress and notes, the vault is the source of truth
(including notes the user added in Obsidian).
- Organised pages go in `wiki/`; the rules are in `VAULT-RULES.md` at the vault's root.
- Every screenshot for the user: copy it to `wiki/images/`, embed it in the matching page,
and add an entry to `wiki/log.md`.Two ways to read and write:
- Read and write the files directly: the vault is only a folder, and Claude Code already reads and writes files. Simplest and most dependable; start here.
- Through tools: when you need what only Obsidian offers (full-text search results, tags, backlinks), use Obsidian’s command-line tool or a community MCP server (“Writing an MCP Server in Go” explains how MCP works). Expose only this one vault, and make write tools require a person’s confirmation by default.
What memory should hold. The AI’s memory isn’t a summary of chat history; it’s what will still be useful later and can’t be seen in the code: the user’s preferences, rules that keep coming up, where external systems are, current progress and where it’s stuck. One topic per entry, a one-line description each, listed in an index file so it can be found next time. Whatever is already in the code, the git history or CLAUDE.md doesn’t need recording again.
Step 7: A fixed routine for every round: read, do, record
Write the routine into the rules, and the AI follows it every round:
- Read: before starting, read the rules file,
wiki/index.mdand the pages relevant to this work; read the sources inraw/when details are needed. - Do: follow the project’s rules; when the rules don’t cover something, or there are two or more ways to do it, ask a person first.
- Record:
- In the project’s changelog: what was done, why, measurements, and approaches tried and withdrawn.
- Update the matching
wiki/page (or create it), and add a line toindex.md. - Put screenshots in
wiki/images/and embed them in the page. - Append a line to
log.md: the date, which page, one sentence. - When reporting, say clearly: the sources, the pages changed, what’s still uncertain.
log.md looks like this (append only, old lines never changed):
- 2026-11-19 added [[www redesign]]: proposal and prototype, 12 screenshots, not applied.
- 2026-11-19 updated [[Site split plan]]: the split went live, 2 live screenshots.The routine pays off on the second and the tenth start: after reading the index and a few pages, the AI knows where things stopped and why, without anyone explaining it all again.
Step 8: Links, search and database views
Links. Pages link to each other with [[Page name]]; Obsidian’s backlinks panel lists who links to a page, and the graph draws the whole vault as a network. Have the AI add links as it writes: whenever it mentions another topic, link to it.
Embeds. ![[images/screenshot.png]] puts an image in a page; ![[Another page#A heading]] embeds one section of another page without copying it.
Search. Obsidian’s search understands conditions such as path:, tag: and [property:value]; for example path:wiki [status:to-confirm] finds every page not yet confirmed.
Database views (Bases). Properties turn pages into a table: for example, list every page with type: decision, sorted by date, with a status column. That’s why step 3 asks every page for properties.
Step 9: Privacy and security
Whatever is in the vault, the AI can read, and so it may end up in its answers, its logs or requests sent to outside services.
- No secrets. Passwords, API keys, private keys and ID numbers never go into the vault; when you need to record where a key lives, record only the location and how to use it, never the key.
- Keep private folders apart. Personal notes unrelated to the project belong in another vault, or the rules say explicitly “don’t read such-and-such folder”, with that folder excluded.
- Note content is data, not instructions. Something clipped from a web page or sent by someone else may say “ignore the rules above”. Rules belong in the rules file and
CLAUDE.md; never let the AI take a sentence from an arbitrary note as a command. It’s the same prompt injection discussed in “Security Checks with AI: Threat Modelling, Tracing Input and Verifying Findings”. - Least privilege for tools. The AI’s file or MCP access reaches only this vault; deletions and large changes need a person’s confirmation, and the vault is backed up (next step).
Step 10: Sync and backups
The vault is plain text, and there are a few common ways to sync it:
| Method | Strengths | Watch out for |
|---|---|---|
| Obsidian Sync | The official service, end-to-end encrypted, with version history | Paid; the official help says symlinks may not work well with Sync and discourages them |
| git (with a private repository on GitHub or similar) | Full change history, reviewable | Remember to commit; the repository grows with many images; never push to a public repository |
| Cloud drives such as iCloud or Dropbox | Simple to set up | Conflicts produce duplicate files; symlinks are handled inconsistently |
Whichever you use, sync isn’t backup: sync faithfully syncs an accidental deletion too. Keep separate regular backups as well (say, an archive every day), so you can get back after an accident. With the symlinks from step 5, make sure the side where the real files live is the one synced and backed up.
Common pitfalls
Letting the AI improvise with no rules. Duplicate pages, contradictory statements and unsourced “facts” soon follow. Write the rules first, then let it write notes.
Mixing sources with organised knowledge. When organising goes wrong there’s nothing to check against; when a source is rewritten, its history is gone.
A new page every time. One topic spread across five pages, and nobody knows which is current. The rules say “update; don’t create a duplicate”.
Memory full of things visible in the code. The AI’s memory should hold what’s useful later and can’t be seen in the code; everything else just makes it read more useless material at every start.
No backup on the other side of the symlink. The project side assumes the vault is backed up, the vault side assumes the project is, and neither is.
Secrets written into notes. The vault gets synced, read by the AI and pasted into conversations; once written, treat it as leaked.
Taking sentences in notes as instructions. Rules come only from the rules file and CLAUDE.md; note content is always data.
Key takeaways
- AI makes organising knowledge cheap but also makes mistakes and duplicates easier; a second brain is about clear structure and rules, with every sentence pointing back to a source.
- Three layers:
raw/sources, read only;wiki/organised knowledge, one page per topic; a rules file on top;index.mdas contents and an append-onlylog.md. - Obsidian notes are Markdown in a folder that the AI can read and write directly; set wikilinks, an attachments folder and exclusions, and give every page properties for type, status, date and source.
- Write rules as checkable sentences, including what needs a person first and how conflicts are handled.
- Use symlinks so the project’s
docs/and the AI’s memory actually live in the vault, and people, the AI and the code see the same files; mind how git and sync tools treat symlinks. - State the vault’s location and rules in
CLAUDE.md/AGENTS.md; start by reading and writing files directly, add tools or MCP for Obsidian-only features, with limited permissions. - Every round: read (rules, index, relevant pages), do, record (changelog, pages, screenshots, log, report).
- No secrets in the vault, private folders kept apart, note content treated as data, and sync is not backup.
References
- llm-wiki (Andrej Karpathy): the raw sources / LLM-maintained wiki / schema layering and the index.md catalog plus append-only log.md that step 2 is modelled on.
- How Claude remembers your project (official Claude Code documentation): how CLAUDE.md, AGENTS.md and auto memory are loaded into a session, used in step 6.
- Properties (Obsidian Help): properties are stored as YAML at the top of the file, as used for every page in step 3.
- Search (Obsidian Help): the
path:,tag:and[property:value]search syntax in step 8. - Introduction to Bases (Obsidian Help): turning notes and their properties into sortable, filterable database views, used in step 8.
- Symbolic links and junctions (Obsidian Help): Obsidian's limits on symlinks and the risks they bring to syncing, behind the cautions in steps 5 and 10.
- Introduction to Obsidian Sync (Obsidian Help): the official sync service and its version history, compared in step 10.
Next
Once the vault is organised, it is itself excellent material for retrieval: the team’s documents, decisions and incident notes are all there, structured and sourced. With rules and knowledge in place, the next step is turning repeated procedures into reusable steps. The next article, “Building Your Own AI Skill from Scratch: Doing It Right, and Turning Your Project’s Git Repo into a Claude Code Skill”, builds a first skill from scratch, sets out how to do it right, and turns the project’s own Git repo into a skill the team can share.