How I Gave Claude Code Long-Term Memory With Markdown and Python Hooks
Claude Code forgets everything when a session ends. Close the terminal and the decisions, the dead ends and the "never do that again" lessons go with it. The next session starts from zero, and you pay for it in re-explaining.
I run my agency and side projects from one Claude Code workspace, and most of this year has gone into fixing that one problem. The fix isn't a plugin or an MCP server. It's three layers of plain files, plus four small Python hooks that move context in and out at the right moments.
This post is the code. Everything below runs on my machine today: an Obsidian vault of just over 1,500 notes, 170 memory files, 186 skills, and about 30 hook commands across 10 Claude Code events. This post covers the four hooks that handle memory.
The architecture
Three layers, each answering a different question:
Vault (knowledge/)
What...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE