Persistent context for Claude Code, Cursor, and other AI tools. Skips the database, MCP servers, embeddings for simple markdown files and good ol' git.
WARNING: This is a PUBLIC template. Once you clone it and add your notes, DO NOT push your personal version to a public repo. Your memory will contain secrets (both dark personal secrets and security risk secrets), personal information and your working style. Keep it local or push to a NEW private repo.
DO NOT use GitHub's "Fork" button - forks of public repos cannot be made private. Use
git cloneinstead (see Quick Start below).
AI assistants forget everything between sessions. Your engineering decisions (which I think are especially important), coding patterns, project context.
Double solves this with organised markdown files that you control. Think of it as a second brain for your AI assistant.
Why "Double"? Named after Dostoevsky's novel "The Double" - it's your second self. Not just engineering and research, but business ideas, personal notes, hobbies, workflow preferences.
- Smart routing:
/synconly loads files relevant to your work - Python session won't load iOS context - Concise capture:
/handoffwrites terse, reusable insights (not verbose essays) - Context efficient: Compressed memory files reduce token overhead by ~65% while keeping essential knowledge
- No dependencies: Just markdown files and git
This is a template, not a rigid system. The folder structure, commands, and workflows here are a starting point based on one person's working style. You should heavily customise it:
- Rename folders to match your mental model
- Delete categories you don't need (maybe you don't track business ideas or research)
- Add new ones that fit your work (design/, writing/, client-work/, whatever)
- Modify commands to match your workflow
- Change the rules in
meta/to fit your style
The only critical parts are:
- Organised markdown files you control
- A capture → process → load workflow
- Using absolute paths (
~/double/) in commands
Everything else? Change it.
~/double/
├── business/ # Ideas, metrics, product decisions
├── engineering/ # Technical patterns, best practices, lessons learned
├── tasks/ # Active work, backlog, waiting
├── projects/ # Project-specific context and decisions
├── research/ # Intelligence on companies, people, markets
├── personal/ # Writing style, preferences, workflows
├── meta/ # System rules, processed entries, changelog
└── .claude/
└── commands/ # Skills that load context
The directory lives at ~/double/ in your home directory (not nested in a project folder or .claude/ directory) because the commands need to work from anywhere.
When you run /handoff from /Users/you/projects/blog/, the command writes to ~/double/.inbox.md - not ./inbox.md in your current directory.
This means:
- Commands work regardless of where you are
- No relative path issues
- One centralised memory across all your projects
- I've found its less likely to accidentally commit to project repos!
All commands use absolute paths (~/double/) to avoid this entirely.
Also no sandbox issues from what I've found: Claude Code already has filesystem access, so ~/double/ doesn't add new attack surface. The commands are markdown files Claude reads, not executable scripts, so no injection risk.
1. Clone the template to your home directory:
IMPORTANT: Clone to
~/double/(your home directory), NOT inside a project folder or.claude/directory.
git clone https://github.com/ossa-ma/double ~/double
cd ~/double
# IMPORTANT: If you plan to use git, keep it local or make your repo PRIVATE
# Your memory will contain personal info, API keys, and private notes2. Make commands available globally:
Claude Code discovers commands from ~/.claude/commands/ (available everywhere) and .claude/commands/ (project-specific). To use the Double commands from any directory, copy them to your personal commands directory:
cp ~/double/.claude/commands/*.md ~/.claude/commands/Advanced: Auto-sync with individual file symlinks
If you want double commands to auto-update and still keep non-double personal commands separate:
# Symlink each double command individually
for file in ~/double/.claude/commands/*.md; do
ln -s "$file" ~/.claude/commands/$(basename "$file")
doneBenefits:
- Auto-sync for double commands
- Can add other commands to
~/.claude/commands/that stay separate - Note: Need to re-run when adding new commands to double
See Claude Code Slash Commands docs for more details on how command discovery works.
3. Use the commands:
/handoff- End of session, capture what matters/sync- Route insights to organised files/engineering- Load engineering context (or/tasks,/business,/research)
That's it. Commands are now available in Claude Code from any directory.
Captures concise, reusable insights from your session to ~/double/.inbox.md.
What to capture:
- Architecture decisions (why X over Y)
- Patterns/principles that apply broadly
- Technical knowledge for engineering files
- Non-obvious blockers or next steps
Don't capture:
- Specific edits or task status
- One-off decisions without broader lesson
- Obvious next steps
Format: Short, direct, informal. One line per insight. No fluff.
Routes entries from ~/double/.inbox.md to appropriate files with smart routing - only loads files relevant to inbox content.
Lists all available files (engineering, projects, business, research, tasks) so you know what exists, then uses judgment to determine which files actually need updating based on content meaning. Some insights span multiple files (e.g., logging patterns apply to both Python and iOS).
Goal: Efficiency (load less) without rigidity (use actual judgment about relevance).
Example: Python-only session won't load iOS files. Cross-domain architecture insights might update multiple engineering files.
You are now working on engineering/coding tasks. Load and reference the following context:
(Customize this list based on your tech stack and engineering files)
**General Engineering:** `~/double/engineering/everything.md`
**Python:** `~/double/engineering/python.md`
**TypeScript:** `~/double/engineering/typescript.md`
**Databases:** `~/double/engineering/databases.md`
**Deployment:** `~/double/engineering/deployment.md`
When writing code:
- Follow established patterns and preferences
- Avoid documented antipatterns
- Suggest updates when you discover new patterns
- Reference relevant best practices from these files
Read the contents of these files now to understand coding preferences and patterns.Similar commands exist for /tasks, /business, /research, and /memory (loads everything).
/new-task- Quick task capture without opening files/task-done- Mark tasks complete/project-status- Overview of active projects/weekly- Generate weekly review
Cursor:
Add .cursorrules file pointing to your double directory (see meta/ for template).
Gemini CLI:
Copy GEMINI.md template to auto-load context in any directory.
Any tool:
Just read the markdown files in ~/double/. No special configuration needed.
- Single Source of Truth: Store each fact in one canonical location
- Date Everything: Add "Last updated: YYYY-MM-DD" to time-sensitive info
- Cross-Reference: Use
[[links]]instead of duplicating data - Human-Readable: Write for humans first, AI second
- No dependencies: No database, no MCP server, no npm packages
- Human-readable:
cat ~/double/engineering/python.md- that's it - Portable: Works with any tool that can read markdown
- Transparent: You see exactly what's stored
- Actual git: Full version control, not "inspired by" git
Read the full explanation: Double: Claude Code Memory Without MCPs and DBs