AI Coding Tip 020 – Create a Second Brain

Build a Persistent Memory Layer Your AI Can Actually Use

TL;DR: Use Obsidian with Markdown notes, YAML metadata, and direct AI file access to build a Second Brain with LLMs that gives your tools persistent project context.

Common Mistake ❌

You paste a snippet of code or a problem description into an AI chat, get a good answer, and close the tab.

The next week you face the same problem again.

You search your chat history, find nothing useful, and paste the same snippet again.

Your AI starts fresh every session with zero memory of what you built, decided, or debugged before.

Problems Addressed 😔

  • You repeat yourself constantly because context resets between sessions and your AI remembers nothing.
  • You lose architectural decisions, debugging notes, meeting commitments, and design rationale after each conversation ends.
  • Your AI gives generic answers because it lacks the specific context of your project and past decisions.
  • Mental load accumulates as you juggle multiple projects, notifications, and context switches simultaneously.
  • You lose track of decisions made weeks ago without a structured retrieval system.
  • As you age or face cognitive overload, you forget context between sessions, repeat past mistakes, and lose the thread of long-running projects.
  • Notification fatigue builds when every system demands your attention in real time instead of on your schedule and you forget what you were searching for.

How to Do It 🛠️

  1. Choose a local Markdown tool like ObsidianLogseqFoam, or Tolaria to store all your knowledge as plain .md files you own and control.
  2. Organize your vault using the PARA system: Projects (active work with deadlines), Areas (ongoing responsibilities), Resources (reference material), and Archives (inactive items).
  3. Write atomic Zettelkasten notes: one idea per file, with a unique identifier and explicit links that explain why two concepts relate, not just what they are.
  4. Add YAML front matter to every note so your AI gets searchable, structured metadata it can query and filter:
---
title: "JWT Authentication Design"
type: architecture-decision
status: approved
component: auth-service
tags: [security, backend]
created: 2018-12-09
related: ["OAuth Flow", "Session Management"]
---
  1. Use Dataview or Obsidian Bases to query your vault like a database and surface all tasks due today, pending decisions, or notes grouped by component with a single dynamic query; every note is a record with metadata and legible text.
  2. Give your AI direct access to all your vault as local files so Claude, Devin, and Codex can read your entire codebase and notes simultaneously.
  3. Create a AGENTS.md in each sub-project that points to the relevant vault sections, following the nested agents pattern from AI Coding Tip 014.
  4. Dictate notes on the go using voice input and paste the transcript into your vault to capture context in real time without interrupting your flow.
  5. Sync your vault to mobile and tablet using Obsidian Sync, Dropbox, OneDrive, or Syncthing so your Second Brain travels with you everywhere.
  6. Set up OpenClaw or a local LLM (Ollama or LM Studio) to index your vault and answer questions via Telegram or WhatsApp, as a private assistant that never sends your data to the cloud.
  7. Ask your AI to scan your vault periodically for orphaned notes, missing connections, and hidden patterns, acting as a tireless librarian that reorganizes your knowledge network over time without falling into vault-design paralysis.
  8. Bootstrap your vault from your existing knowledge: ask ChatGPT, Claude, Grok, or Gemini to summarize and export your most relevant past conversations as Markdown notes, since you already have a Second Brain scattered across chat history waiting to be harvested.

Benefits 🎯

  1. Persistent Context: Your AI starts every session knowing your architecture, past decisions, and current priorities instead of starting blank.
  2. Pattern Discovery: The LLM finds connections between notes you wrote months apart and surfaces forgotten solutions to current problems.
  3. Focus Protection: You capture every interruption into your inbox and process it on your schedule, eliminating notification fatigue.
  4. Memory Extension: You can retrieve exact decisions and reasoning from months ago without relying on biological memory alone, making it especially valuable for senior developers, people with attention challenges, or anyone whose cognitive load has grown beyond what one brain can hold.
  5. Privacy by Default: When you use local models like Ollama with OpenClaw, your notes, code, and queries never leave your machine.
  6. Compounding Knowledge: Every note you add makes your Second Brain denser: the more you use it, the more valuable it becomes.
  7. Mobile Access: You can query and update your knowledge base from any device, making your Second Brain available wherever you work.
  8. Distraction-Free Writing: You work in plain text files with minimal formatting, much like zenware, so you stay focused on ideas instead of tools.
  9. Visual Graph: You can open Obsidian’s Graph View to see all your notes as a visual network where nodes are notes and edges are links, revealing clusters, hub concepts, and hidden connections at a glance.

Context 🧠

Tiago Forte’s “Building a Second Brain” methodology introduced the CODE framework: Capture, Organize, Distill, Express.

For developers, this maps directly to how you learn, document, and reuse knowledge across projects.

Niklas Luhmann, a sociologist who wrote over 50 books, developed the Zettelkasten method using a physical slip box of interconnected atomic notes.

Your Obsidian vault is that slip box, and your AI can search, analyze, and extend it at any time.

LLMs have three types of memory: parametric (knowledge encoded during training), working (the current context window), and external (your files on disk).

Your Second Brain fills the external memory layer and gives the AI permanent access to your project-specific knowledge that survives every session reset.

Just as neural networks in LLMs store patterns in weights, your Second Brain stores patterns in linked Markdown files, extending the model’s memory with your lived experience as a developer.

Andrej Karpathy captured this architecture in one sentence: “Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase.”

The front matter you add to each note acts as structured metadata that significantly improves how AI retrieves and ranks relevant information.

RAG (Retrieval-Augmented Generation) pipelines embed your notes as vectors and return the most semantically similar ones when you ask a question, injecting them directly into the AI’s context window.

I borrowed this idea many years ago from @Ernesto Kiszkurno and have written more than 500 technical articles since then.

Prompt Reference 📝

Bad Article 🚫

Create a note about the movie
"Howl's Moving Castle".

Good Article 👉

---
title: "Howl's Moving Castle"
type: movie-note
status: draft
director: Hayao Miyazaki
year: 2004
genre: [fantasy, animation, anti-war]
rating: 9/10
tags: [ghibli, miyazaki, adaptation]
related: ["Studio Ghibli", "Diana Wynne Jones"]
created: 2026-05-16
expected publish date: 2026-06-12
---

## Poster
_ _ _
IMPORT IMAGE Howls-moving-castleposter.jpg
_ _ _

## Summary
Two or three lines describing the plot without
spoiling the ending.

## Themes to Explore
Bullet list of ideas: anti-war message,
identity and transformation, Sophie's arc,
Miyazaki's pacifism compared to the novel.

## Characters
Use wikilinks: [Howl], [Sophie Hatter],
[Calcifer], [The Witch of the Waste].

## Article Ideas
Numbered list of angles for a critical article:
compare Miyazaki's changes from the Diana Wynne
Jones novel, analyze the anti-war allegory,
explore the feminist reading of Sophie's curse.

## Related Notes
[Studio Ghibli filmography]
[Diana Wynne Jones bibliography]
[War themes in animation]

Considerations ⚠️

Keep your notes in plain Markdown files, not HTML (despite current trends) or proprietary formats.

Markdown is readable by both humans and LLMs, diffs cleanly in Git, and works with every static site generator.

Don’t use MCP connectors or remote APIs to give your AI access to your vault.

Point it directly at local files instead.

Direct file access is faster, cheaper, and requires no extra infrastructure.

The AGENTS.md files you create per project are part of your Second Brain, not separate from it.

If you have privacy concerns about cloud AI providers reading your notes, run a local model with Ollama or LM Studio through OpenClaw.

Your data never leaves your machine or private cloud.

Mind maps and Canvas diagrams in Obsidian help you visualize codebase architecture and sprint planning spatially, while the linked Markdown notes behind each node stay searchable by your AI.

Your files are local.

Nobody can see them, nobody can index them, and you can open any note with the simplest text editor in the world.

If you use a cloud AI model instead of a local one, you can add a guardrail to restrict what files the AI can read, so sensitive notes never leave your control.

Type 📝

[X] Semi-Automatic

Limitations ⚠️

Large vaults with thousands of notes can slow down semantic search and local LLM indexing on low-end hardware.

Front matter requires discipline to maintain consistently: inconsistent metadata reduces query quality over time.

Local LLMs powerful enough to reason over a large vault require significant RAM (16 GB minimum, 32 GB recommended).

Tags 🏷️

  • Knowledge Management

Level 🔋

[X] Intermediate

Related Tips 🔗

https://hackernoon.com/ai-coding-tip-010-access-all-your-code?embedable=true

https://hackernoon.com/ai-coding-tip-014-one-agentsmd-is-hurting-your-ai-coding-assistant?embedable=true

https://hackernoon.com/ai-coding-tip-018-dictate-your-prompts-instead-of-typing-them?embedable=true

Conclusion 🏁

Your biological brain is for having ideas, not storing them.

Build a Second Brain from local Markdown files and give your AI direct access to it.

You get persistent context, pattern discovery, and a knowledge base that compounds every time you use it. 🧠

More Information ℹ️

https://zettelkasten.de/introduction/?embedable=true

https://obsidian.md

https://x.com/2039805659525644595?embedable=true

https://en.wikipedia.org/wiki/Book_design?embedable=true#Front_matter

https://blacksmithgu.github.io/obsidian-dataview/?embedable=true

https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f?embedable=true

https://foambubble.github.io/foam/?embedable=true

https://www.buildingasecondbrain.com/?embedable=true

https://ernestokiszkurno.blogspot.com/2021/08/second-brain.html?embedable=true

Also Known As 🎭

  • Personal-Knowledge-Management
  • AI-Memory-Extension
  • Developer-Second-Brain
  • Local-Knowledge-Base

Tools 🧰

Disclaimer 📢

The views expressed here are my own.

I am a human who writes as best as possible for other humans.

I use AI proofreading tools to improve some texts.

I welcome constructive criticism and dialogue.

I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.


This article is part of the AI Coding Tip series.

https://maximilianocontieri.com/ai-coding-tips

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.