Skip to content
subuilds.dev

← logbuild #21 passedcc85c25

Your LLM Has Amnesia. Build It a Wiki.

A structured Markdown wiki gives every LLM session a shared memory of your codebase. It saves tokens, survives a model switch, and catches spec bugs that unit tests can't.

· 12 min read

I spent 2–3 days vibe-coding a web app with Claude Code and Opus, Anthropic’s strongest coding model. Vibe-coding means you describe what you want and the AI writes the code. I gave it an agent, skills, and prompts that described the stack, the business logic, the data models, the UI elements, and the forms. It set up the frontend, the backend, and the database. It connected nice-looking forms all the way to the schema. Everything worked.

Then I checked the token meter.

The tokens were going fast. (Tokens are the units of text you pay the model for.) Every few hours the agent also forgot what we were doing. I pasted conventions again that I had written days earlier. Sometimes I caught it repeating a mistake I had already corrected. Almost always the root cause was mine: a rule I had written unclearly, or never written at all. I tried /clear to drop the long history. That saved tokens, but it created a different problem at once. Claude Code had to read the codebase again from zero to find which files mattered for the next change. The loop only got worse: longer context, more tokens, more work to find the same facts again.

Then Andrej Karpathy’s gist appeared in my feed. His idea matched the way I already used my Obsidian graph. I followed it and rebuilt the project around a structured Markdown wiki that the agent reads when it needs to. This post is the result: the folder layout I now use in all my projects, and the reason for each part.

In Simple Words#

The problem
Your LLM agent forgets the project between sessions. You paste the same stack and rules again. The token cost grows fast.
The root cause
The project knowledge lives only in the chat history, or in the hidden context of one tool. A new session starts with no memory.
The solution
Keep the project knowledge in a Markdown wiki with fixed folders, typed frontmatter and links. The agent reads only the pages it needs. You update the wiki when the work is done.
Think of it like this
A new worker joins your team every morning and knows nothing about the job. You can explain everything again each day. Or you keep one notebook on the table. Every worker reads it first and writes in it before going home.

What We’ll Cover#

  1. The four problems a project wiki fixes
  2. The folder layout — epics, stories, tasks, bugs, releases, retros, tech-docs
  3. Frontmatter as the LLM’s API
  4. Wikilinks: how the agent walks a graph and does not grep everything
  5. The brainstorming checklist that catches spec bugs unit tests miss
  6. Token and time tracking per task and per story
  7. The release lifecycle, day by day
  8. The afternoon starter kit

Environment: any plain-text editor works. I use Obsidian for the wikilink graph and Dataview for release pages that build themselves. The files on disk are plain Markdown with YAML frontmatter. There is no proprietary (vendor-owned) format.

1. The Four Problems a Project Wiki Fixes#

When you work with an LLM agent on a real codebase, four things go wrong again and again:

  • Token re-derivation. Each new chat asks again: “what’s the stack? what’s the URL scheme? what’s the data model?” You pay for the same paragraph every time.
  • Vendor lock-in by accident. Your project memory may live in the hidden context of one tool. Then a model switch wipes it: Claude to GPT to a local Llama.
  • Cold-start drift. Without a single source of truth, the agent invents names again and finds conventions again. It picks slightly different patterns in each session. The codebase becomes inconsistent while you work on it.
  • Retro amnesia. You learn a lesson from a painful mistake in sprint one. By sprint three, nobody remembers it, human or model.

The wiki sits between you, the agent, and the code. It is the system prompt you pay to write only once.

  1. Without a wiki, every new session starts with no memory. You explain the stack and the rules again, and you pay for it each time.
  2. You write the project knowledge into a Markdown wiki once: specs before the work, retros after it.
  3. A session reads only the pages it needs. That is cheap. Then it writes commits to the codebase.
  4. The task is done. Its commit hash and completed date go back into the wiki.
  5. A GPT session, or tomorrow’s session, reads the same wiki. The memory survives a model switch.
5 / 5

2. The Folder Layout#

There are eight top-level folders. Each one holds one document type, with a strict naming pattern and typed frontmatter. Frontmatter is the block of YAML fields at the top of a Markdown file.

Folder Doc type Role
epics/ Epic A high-level goal, a group of stories
stories/ Story One testable user-facing outcome
tasks/ Task A single execution unit, frontend or backend
bugs/ Bug A defect with traceback to its task or story
releases/ Release A deployable bundle, auto-rolled from frontmatter
retrospectives/ Retro Root cause analysis and action items
tech-docs/ Reference Stable architecture facts
_assets/ Images Diagrams and screenshots

The file names follow a pattern that a program can read. So the agent works out the relationships from the file names alone:

text
epics/{Word}.md
stories/{epic-key}-{seq}--{slug}.md
tasks/{story-id}-T{seq}--{slug}.md
bugs/{story-id}-B{seq}--{slug}.md
releases/v{major}.{minor}.md
retrospectives/retro-{release}--{slug}.md

The id EPC-01-T1 tells you at once: epic EPC, story 01, task 1. The agent does not need to scan folders or guess a match.

3. Frontmatter as the LLM’s API#

Every doc starts with typed YAML. This is the contract that both humans and agents read. Stories have the richest schema:

yaml
type: story
epic: "[[Epic-Name]]"
id: EPC-01
status: in-progress
priority: high
story_point: 8
actor: end-user
goal: short verb-phrase goal
business_value: why this matters
tasks:
  - "[[EPC-01-T1--first-task]]"
  - "[[EPC-01-T2--second-task]]"
release: v1.3
created: 2026-04-15
used_tokens:
time_spent:

Two audiences read this:

  • You, in your editor, where queries turn it into summary tables.
  • The agent, which can grep it, filter it, and reason about it without parsing prose.

Take a query like “show all in-progress stories in the next release”. For the human it is one Dataview block. For the agent it is one grep -l 'release: v1.3' stories/. One source, two readers. That is the whole point of typed frontmatter.

Wikilinks are not decoration. A wikilink is a link from one page of the wiki to another. The agent uses these links to find context without a grep of the full vault.

Obsidian graph view of the project wiki — clusters of epics, stories, tasks, bugs, and releases connected by wikilinks

A story lists its tasks as wikilinks. A bug links back to the task that introduced it. A release links to its retrospective. A retro links to the stories it reviewed. Every path is two hops or fewer:

text
epic -> story -> task -> bug -> release -> retro -> action item -> _index.md

The agent doesn’t need to load the whole vault. It loads the story, follows one link, arrives at the right task or bug, and stops. It spends very few tokens and still gets the right context. Compare two requests. “Search the codebase for X” is expensive and noisy. “Read this one file and follow the link” is cheap and exact.

5. The Brainstorming Checklist That Catches Spec Bugs#

Unit tests catch logic bugs. They do not catch spec bugs. A spec bug is a mistake in the description of the work: the wrong screen, a missing config setting, a value that breaks a database rule nobody documented. Most LLM-written code that ships broken is broken because of the spec, not the logic.

Before any story moves from brainstorming to todo, the wiki makes you answer four questions:

  1. Step-by-step UI flow. What does the user see at each step? What page loads? What are the error and loading states? Don’t say “user verifies email”. Name the page, the URL, and what shows on success and on failure.
  2. Backend integration points. Which service handles each step? How are tokens or sessions passed between server and client? Who creates the session, who reads it?
  3. External config requirements. What dashboard settings, env vars, DNS records, or third-party config are needed? List them in an ## External Config section.
  4. Data entity values. Check every column value in the story against the real rules in the schema: CHECK, enum, NOT NULL. If the spec says role = 'parent', check that this string exists in the rule.

Each of these questions takes minutes to answer before the work and saves hours of debugging later. They exist because retros keep finding these same questions at the root of bugs.

6. Token and Time Tracking#

Two fields on every task and every story:

yaml
used_tokens:
time_spent:

You fill them in when the work changes to done. Tasks record their own real numbers. Stories add up their tasks. After a few sprints you have real cost data per story: token spend by feature area, by agent, by complexity level.

You cannot improve what you don’t measure. “The AI is expensive” is a feeling. “Auth stories cost 3× what CRUD stories cost” is a number you can act on.

7. The Release Lifecycle, Day by Day#

The whole point of the wiki is that it grows with every piece of work. One release shows it:

  1. Epic drafted. A short page in epics/ names a goal and gets a key.
  2. Story brainstormed. The four-item checklist runs. Status moves to todo.
  3. Tasks executed. Each task gets a completed date and a commit hash. Status done.
  4. Bugs filed. When something breaks in QA or production, a bug links back via related: to the task that introduced it.
  5. Release cut. A releases/v{x.y}.md page collects everything tagged release: v1.3 via Dataview. No tables to maintain by hand.
  6. Retro written. After the release ships, a retrospectives/retro-*.md page sorts the bugs by root cause category and produces action items.
  7. Action items feed back. The action items update _index.md itself: new rules, new checklist items, new conventions. The wiki gets smarter every sprint.

Every step leaves a typed, linked document. Tomorrow’s session reads them and knows the state of the project in seconds.

8. The Afternoon Starter Kit#

You don’t need the full structure on day one. You can build the smallest useful wiki in one afternoon:

  • _index.md — your project overview, tech stack, URL scheme, data model. The one file every session reads first.
  • epics/, stories/, tasks/ — three folders, nothing more. Skip bugs, releases, and retros until you have something to ship.
  • The four-item brainstorming checklist, pasted into _index.md. Use it on the first story. You’ll feel the difference.

Add the rest when you need it: bugs the first time something breaks, releases when you make your first version, retros after the first release ships. Dataview can wait until release two. By then its value is clear.

What You Have Now#

You used to You now
Re-paste the stack each session The agent reads _index.md once
Lose decisions when you switch models The wiki survives the model swap
Discover spec gaps in QA The brainstorming checklist shows them before you code
Guess what the agent costs used_tokens per story, summed from tasks
Repeat sprint mistakes Retro action items land back in _index.md

Next Steps#

  1. Create the eight folders. Write _index.md with your stack, URL scheme, and data model. One paste, ten minutes.
  2. Start to use the four-item brainstorming checklist. Apply it to the next story you start. Ship it. Notice what you would have missed.
  3. After your first bug, write a retro. After your second sprint, you will have a wiki that pays back its cost in every session.

Markdown plus frontmatter is not exciting. That’s the point: boring formats live longer than vendors. Build memory you own.