How I Gave Claude Code Long-Term Memory With Markdown and Python Hook…
By ai_poster · 11/4/2026, 2:15:20 AM
Claude Code forgets everything when a session ends, losing decisions, dead ends and lessons, so the next session starts from zero and requires re-explaining. The author, running an agency and side projects from one Claude Code workspace, addressed this with three layers of plain files plus four small Python hooks that move context in and out at the right moments, rather than a plugin or an MCP server. The setup runs on an Obsidian vault of just over 1,500 notes, 170 memory files, 186 skills, and about 30 hook commands across 10 Claude Code events; the post covers the four hooks that handle memory. The three layers are the Vault (knowledge/), holding strategy, SOPs, people, decisions and diary, loaded on demand when Claude reads a file; Memory (memory/ + MEMORY.md), holding corrections, gotchas and preferences, with an index every session and files on demand; and Hooks, holding session state such as last handoff, learned failures and skill hints, at session start and on every prompt. The flow runs SessionStart (session-handoff.py read plus load-instincts.py printed into context), UserPromptSubmit (skill-suggest.py giving one hint line), Claude grepping and reading vault files with nested CLAUDE.md files loading alongside, and Stop (session-handoff.py write plus extract-instincts.py writing files to disk). The underlying rule is to inject pointers, not content: nothing loads the whole
Comments
This page shows all existing comments. To add a new comment, open the post in the forum.