When should you use it?
- Claude Code keeps forgetting your preferences and project decisions between sessions
- Your CLAUDE.md file has grown so long that sessions start slowly and rules get ignored
- You work on the same projects from more than one computer or server
Not for: One-off scripts or short projects where a few notes are enough; People not comfortable editing hook scripts and git settings; Storing secrets; keep credentials out of every memory repository
What do you need, and what do you get?
You need
- A private git host for the memory repositories
- Your existing rules and preferences, ideally tied to past incidents
- Claude Code with hooks enabled on each machine
You get
- A rules repository with one small skill per kind of job
- A project repository with a readme, a dated log and a decisions file per project
- Session-start, routing, pre-action, post-write and stop hooks
- A habit of dated write-backs committed at the end of every task
How does it work, step by step?
- Split how from whatCreate one repository for your working rules and another for project records; keep raw reading notes in a third if you want a source trail.
- Write rules with reasonsFor each rule give its strength (must, never or prefer), a one-line reason, and a date when it came from your own decision.
- Load a small sliceAdd a session-start hook that pulls both repositories and injects only your core rules and the current project's short card, and have it run again after context compaction.
- Guard risky actionsAdd a pre-action hook that refuses to deploy or publish until the matching rules are loaded, and asks you before production changes.
- Close the loopUse a stop hook to remind the agent to append a dated log entry, update the project status and commit when files changed.
The prompt
Our own prompt, inspired by u/tahayelkenci on r/ClaudeCode and written to work in Claude Code. Values in lime are placeholders.
Fill in the blanks (optional; the copied prompt uses your values)
Help me set up long-term memory for you in plain markdown, kept in git. 1. Create {rules_repo} for how I work: one small file per kind of job ({job_types}). Each rule gets a strength (must, never, prefer), a short reason, and a date if it came from my decision. 2. Create {projects_repo} with one folder per project: a readme (summary, where things live, current status, tasks still pending), a log with dates and a decisions file. 3. Draft hook scripts that: load my core rules plus the current project's readme at session start and after compaction; refuse to deploy until the deploy rules are loaded and ask me first; remind you to log and commit when files changed. 4. Keep the start-of-session load under {token_budget} tokens and never store secrets. Show me every file before you write it.
Inspired by u/tahayelkenci on r/ClaudeCode: Reddit post: my Claude Code memory is 3 git repos of markdown and 5 hooks. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.
What can go wrong?
- Mixing rules and history in one file recreates the bloated CLAUDE.md problem. Keep them separate from day one.
- Hooks that fail open give a false sense of safety. Test what happens when a hook script errors.
- Logs grow without limit. Only load them on demand and trim the status block now and then.
- A memory repository is easy to push to the wrong remote. Keep it private and secret-free.
Our take
This is one of the clearest descriptions we have seen of agent memory that a person can actually maintain. The key move is separating how you like work done from what has happened on each project. Rules stay short and stable, history grows in dated logs that are only opened when needed, and neither crowds the other out of the context window. Two ideas are worth copying even without the full setup. First, every rule carries a reason and a strength, which gives the agent something to reason with instead of a bare command. Second, hooks turn memory from a suggestion into a gate: a deploy simply does not run until the deploy rules are loaded. Our cautions are about maintenance and safety. Test how each hook behaves when it fails, keep the repositories private and free of credentials, and prune the status sections. In our dry run we described a fictional two-project consultancy to Claude Code with our prompt, and it produced the two repositories, a 40-line session-start card and a pre-deploy rule, and logged a dated decision when asked to change a preference.
Where the time goes back: Sessions start with the right rules and the latest project status already loaded, so you stop re-explaining preferences and decisions, and the guard hooks prevent the mistakes that cost the most time to undo.
FAQ
Why not a vector database or a memory plugin?
How much context does it use?
Where do I start if hooks feel like too much?
Source and credit
Inspired by u/tahayelkenci on r/ClaudeCode. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.
- Inspired by
- Reddit post: my Claude Code memory is 3 git repos of markdown and 5 hooks
- Creator
- u/tahayelkenci on r/ClaudeCode
- Published on
- Original date
- Nov 4, 2026
- License
- Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
- Originally for
- Claude Code
- AI dry run
- Nov 5, 2026: passed. Dry-run tested by our AI test agent on sample input. Clear split of rules and history, reasons and strengths on rules, a small session-start load, a deploy gate and dated write-backs, all shown before writing.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails. - Verified
- Nov 5, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.
Are you the creator? Claim or correct this page.