Leonid Huopolainen
All notes

How I set up context for Claude

Translated from Russian. Original

In the channel someone asked if I keep important things in Obsidian or in .md, and how many tokens go into constantly updating the context. Here is my answer

I don't use Obsidian, I think it's more for nice pictures with a graph of links. At the start I tried Notion. I thought it was important to control what the AI does, and I set up a task tracker for it there: tasks, descriptions, specs, screenshots, statuses, lots of things. At first it was fun to watch. But once you speed up, you just don't have time to look at it for every task. There is a lot of information there, and a decision needs only a small part of it. It's easier to ask Claude than to go and search where it wrote what

Still, storing all of this matters. I just say "make banners on the main page", and Claude writes a spec for it, a definition of done and all the rest. And it checks the requirements for conflicts: did this task break some other one I asked for earlier. It's stored in the project repository. Then if I give the project to other people, their Claude can also understand it

Now rules and knowledge are plain .md files on disk and in the git repositories of projects. Raw material is stored however is convenient: personal messages and call transcripts as text files, work chats in a database on a server, memory of past sessions in a local database. This is easiest for Claude: it opens files and queries databases itself, nothing needs to be exported

It has several layers:
– rules. The CLAUDE.md file, which Claude sees in every session from the first second: how to work with me, what is allowed and what is not. My global one is now about 6 thousand characters, I recently cut it down from 17. Plus each project has its own
– skills. Instructions for typical tasks, I have 36. Only short descriptions stay in the session all the time, the instruction itself loads when a task fits it
– project knowledge. Tasks, decisions, research, reviews live in the docs and research folders inside the repository, research alone is more than 1400 files. If we agreed on something important, Claude adds it to the project file. I turned off the built-in memory of Claude Code: it's stored apart from the project, it's not visible in git and other sessions don't find it
– memory of past sessions. A local database where it is written automatically what Claude did: which files it edited, which bug it fixed and how it ended. The records are compressed by the cheap Haiku model, there are about 55 thousand now. Before editing a file Claude pulls what already happened with it
– data lake. Messages, calls, documents, I wrote about it separately

Now about tokens. Updating costs almost nothing: messages and calls are synced by plain scripts, the model takes no part in it. Claude doesn't reread anything in full. At the start it sees the rules and tables of contents, then it searches the files and opens only what the task needs

Asking is also a check. If Claude answers not the way I expect, it means it saved something wrong or didn't find it, and that needs fixing

And I regularly clean up and improve this context. Before it was once a week, now about once a month. When I had tokens left at the end of the week, I asked Claude to study all my rules, skills, settings and session history: where rules were broken, where context was missing, what can be optimized