DEV Community

Cover image for How I gave Claude Code a long-term memory (and made it learn how I work)
taberfin
taberfin

Posted on Edited on Fully Autonomous

How I gave Claude Code a long-term memory (and made it learn how I work)

Every new Claude Code chat starts from zero. I kept re-explaining my projects, my preferences and what we decided last week. So I built a small memory system around an Obsidian vault – here's how it works.

The idea

Claude Code supports hooks: shell commands that run on events like SessionStart or Stop. That's all you need:

  1. SessionStart hook → prints my rules, my profile and the last few session notes. Claude Code adds that output to the context, so every chat starts informed.
  2. Rules in a CLAUDE.md inside the vault → tell Claude to log each working session and to update my profile whenever it learns something about me.
  3. Stop hook → if Claude finished without writing a session note, it reminds it once.

The part that made the difference: a profile

Logging sessions is nice. What really changed things was a file called About me.md:

  • how detailed answers should be
  • whether Claude should just act or ask first
  • what I'm working on, what annoys me
  • "observations" Claude adds itself, with a date

Corrections ("no, always ask before changing files") go straight into the profile – and stick across every future chat.

Minimal version

# ~/.claude/settings.json → hooks.SessionStart
cat "$VAULT/CLAUDE.md" "$VAULT/About me.md" "$VAULT/Overview.md"
ls -t "$VAULT/Sessions"/*.md | head -3 | xargs cat
Enter fullscreen mode Exit fullscreen mode

That's the core. A free, MIT-licensed starter version is on GitHub: https://github.com/taberfin/memoryvault-lite

Things I learned

  • Load only the overview + last 3 sessions, not everything – context fills up fast.
  • If the vault is on an external drive, make the hook exit silently when it's missing.
  • Normalize filenames (umlauts!) if you share the setup across macOS and Linux.
  • Never put secrets in the vault: whatever the hook prints is sent to the model.

If you don't want to build it yourself

I packaged the full setup – profile, rules, templates, reminder hook, a safe one-command installer, PDF guide, English + German – as MemoryVault. The first 20 buyers get 30% off with code LAUNCH: https://taberfin.gumroad.com/l/memoryvault/LAUNCH

Bonus: a free 2-page Claude Code cheat sheet (commands, shortcuts, config files, 10 tips): https://taberfin.gumroad.com/l/claude-code-cheat-sheet

I built this. Not affiliated with Anthropic.

How do you handle memory with Claude Code? Curious what others do.

Top comments (0)