A comprehensive template repository that implements a Memory Bank system for maintaining project context across Claude Code sessions. This template solves the fundamental challenge of AI memory resets by providing structured documentation that serves as institutional memory for your projects.
- Why This Template?
- What's Included
- Quick Start
- How It Works
- Usage Guide
- Memory Bank Files
- Best Practices
- Advanced Usage
- Troubleshooting
- Contributing
Claude Code's memory resets completely between sessions. While this ensures privacy and clean starts, it means Claude has no context about your project when starting a new conversation. This template solves that problem by providing:
- Structured Documentation: Pre-built templates for capturing project context
- Automatic Context Loading: Claude reads your memory bank at every session start
- Planning Workflows: Built-in
/plancommand for structured feature development - Project Intelligence: System that learns and captures project-specific patterns
- Continuity: Maintain context across unlimited session resets
Without a memory system:
- ❌ You re-explain your project every session
- ❌ Context is lost between conversations
- ❌ Claude doesn't learn project patterns
- ❌ Implementation decisions aren't documented
- ❌ Progress tracking is manual and error-prone
With this template:
- ✅ Claude has full project context immediately
- ✅ Knowledge accumulates over time
- ✅ Patterns and preferences are learned
- ✅ Decisions are documented with rationale
- ✅ Progress is tracked systematically
This template provides a complete memory bank infrastructure:
.claude/
├── claude.md # Main configuration & project intelligence
├── commands/
│ └── plan.md # /plan command for structured planning
└── memory-bank/
├── QUICKSTART.md # Quick start guide
├── memory-rules.md # Complete system documentation
├── projectbrief.md # Foundation document (template)
├── productContext.md # Product vision (template)
├── systemPatterns.md # Architecture patterns (template)
├── techContext.md # Tech stack & setup (template)
├── activeContext.md # Current work focus (template)
└── progress.md # Status tracking (template)
-
Configuration (
.claude/claude.md)- Automatic memory loading via
alwaysApply: true - Project intelligence journal
- Instructions for Claude on how to use the system
- Automatic memory loading via
-
Planning Command (
.claude/commands/plan.md)- Structured feature planning workflow
- Automatic memory review
- Clarifying questions before implementation
-
Memory Bank (
.claude/memory-bank/)- 6 core template files for project documentation
- Complete system documentation
- Quick start guide
Click "Use this template" on GitHub or clone this repository:
git clone https://github.com/yourusername/claude-code-memory-bank-template.git my-project
cd my-project
rm -rf .git # Remove template git history
git init # Start freshStart by editing .claude/memory-bank/projectbrief.md:
# Open in your editor
code .claude/memory-bank/projectbrief.mdFill in:
- Project name and purpose
- Core goals
- Scope (in/out of scope)
- Success criteria
- Constraints
- Key stakeholders
This is your most important file - everything else builds on it.
Work through each template file:
- productContext.md - Why your project exists, who it's for
- systemPatterns.md - How it's architected, key patterns
- techContext.md - Tech stack, setup instructions
- activeContext.md - What you're working on now
- progress.md - What's done, what's left
Don't worry about perfection - these files evolve with your project.
Open Claude Code in your project directory:
claudeClaude will automatically read your memory bank and have full context. Try:
What does this project do?
Claude should answer based on your memory bank files!
When starting a new feature:
/plan
Claude will:
- Review all memory bank files
- Ask 4-6 clarifying questions
- Draft a comprehensive plan
- Execute systematically with your approval
The .claude/claude.md file has alwaysApply: true configured, which means:
- Every Session Start: Claude automatically reads the instructions in
claude.md - Memory Bank Loading: Instructions tell Claude to read all memory bank files in order
- Immediate Context: Claude has full project understanding without you explaining anything
Files build upon each other logically:
projectbrief.md (Foundation)
├── productContext.md (Why it exists)
├── systemPatterns.md (How it's built)
└── techContext.md (What technologies)
└── activeContext.md (Current state - synthesizes all)
└── progress.md (Tracks active context over time)
When you've made significant changes:
update memory bank
Claude will:
- Review ALL memory bank files (mandatory)
- Update files that need changes
- Focus on
activeContext.mdandprogress.md - Document new patterns in
claude.md
Just open Claude Code - memory loads automatically:
claudeClaude now has full context. Start working immediately:
Let's continue with the authentication feature
Use structured planning for complex work:
/plan
I want to add user authentication with OAuth
Claude will:
- Review memory bank
- Ask clarifying questions (OAuth provider? Token storage? Session management?)
- Draft comprehensive plan
- Get your approval
- Execute systematically
- Start Session: Open Claude Code (context loads automatically)
- Check Context: Claude references
activeContext.mdfor current priorities - Work: Implement features, fix bugs, refactor
- Update: Say "update memory bank" after significant changes
- Plan Next: Use
/planfor next major feature
Update relevant files during development:
- Making architectural decisions? → Update
systemPatterns.md - Adding dependencies? → Update
techContext.md - Completing features? → Update
progress.md - Switching focus? → Update
activeContext.md
Say "update memory bank" and Claude will help you document.
Purpose: Foundation document Update Frequency: Rarely (only when project scope changes) Contains: Goals, scope, constraints, success criteria
This is your source of truth. All other files derive from it.
Purpose: Product vision and user experience Update Frequency: Occasionally (when product direction shifts) Contains: Problems solved, user workflows, requirements
Answers "why does this exist?" and "who is it for?"
Purpose: Architecture and technical patterns Update Frequency: Regularly (as patterns emerge) Contains: Architecture, design patterns, technical decisions, critical paths
Include code examples and file references with line numbers.
Purpose: Technology stack and setup Update Frequency: When adding/removing dependencies Contains: Tech stack, dependencies, setup instructions, infrastructure
Your technical reference manual.
Purpose: Current work focus Update Frequency: Very frequently (after every significant change) Contains: Current focus, recent changes, next steps, decisions in progress
Your most dynamic file - reflects immediate state.
Purpose: Status tracking Update Frequency: Frequently (as features complete) Contains: Completed work, in-progress items, planned features, known issues
Shows project health and what's left to build.
Fill out projectbrief.md thoroughly before other files. It's your foundation.
This is your most important file for day-to-day work. Update it frequently:
- After implementing features
- When changing focus
- When making important decisions
- When encountering challenges
Vague documentation is worse than no documentation:
❌ Bad: "Fixed the bug in the auth system"
✅ Good: "Fixed OAuth token refresh race condition in src/auth/token-manager.ts:156 by adding mutex lock"
Always include file paths with line numbers:
Authentication is handled in `src/auth/oauth.ts:45-120`This helps Claude (and humans) find the code quickly.
Don't just document what you did - document why:
❌ Bad: "Using PostgreSQL" ✅ Good: "Using PostgreSQL because we need ACID transactions for financial data and team has expertise"
Don't let memory bank get stale. Update after:
- Completing features
- Making architectural decisions
- Discovering new patterns
- Changing dependencies
- Shifting focus
Set a reminder to review all memory bank files monthly to ensure accuracy.
For complex features, always use /plan:
- Ensures thorough analysis
- Clarifies requirements
- Creates systematic approach
- Tracks progress automatically
Create additional files in .claude/memory-bank/ for complex areas:
.claude/memory-bank/
├── [core files...]
├── features/
│ ├── authentication.md
│ └── payment-processing.md
├── integrations/
│ ├── stripe-api.md
│ └── sendgrid-api.md
└── testing/
└── e2e-strategy.md
Reference them in claude.md for automatic loading.
Add more commands in .claude/commands/:
# Create a review command
cat > .claude/commands/review.md << 'EOF'
---
description: Review and improve code quality
---
Review the codebase for:
1. Code quality issues
2. Security vulnerabilities
3. Performance optimizations
4. Documentation gaps
Provide specific recommendations with file references.
EOFUse with: /review
The .claude/claude.md file grows smarter over time. Add sections like:
## Project-Specific Patterns
### Error Handling
- Always use custom AppError class
- Include error codes and user messages
- Log with structured logging
### API Design
- RESTful conventions
- Consistent response format: {data, error, meta}
- Version all endpoints: /api/v1/...Claude will learn and apply these patterns automatically.
For team projects:
- Onboarding: New members read memory bank to understand project
- Knowledge Sharing: Memory bank is living documentation
- Decision History:
systemPatterns.mdexplains why things are built certain ways - Consistency: Everyone works from same understanding
Problem: Claude asks about basic project info despite memory bank
Solutions:
- Verify
.claude/claude.mdhasalwaysApply: true - Check that memory bank files are filled out (not just templates)
- Try explicitly saying "Read the memory bank first"
- Restart Claude Code session
Problem: Documentation doesn't match current code
Solution:
update memory bank
Then work with Claude to update each file systematically.
Problem: Memory bank files are overwhelming
Solution:
- Focus on
activeContext.mdandprogress.mdfor daily work - Keep
projectbrief.mdconcise (1-2 pages max) - Use additional context files for detailed specs
- Remember: better to have some context than none
Problem: /plan command doesn't trigger properly
Solutions:
- Verify
.claude/commands/plan.mdexists - Check file has proper YAML frontmatter with
description - Try restarting Claude Code
- Use alternative: just say "Let's plan this feature carefully"
# 1. Clone template
git clone <this-repo> my-new-project
cd my-new-project
# 2. Fill out project brief
code .claude/memory-bank/projectbrief.md
# (fill in your project details)
# 3. Fill out other core files
code .claude/memory-bank/productContext.md
code .claude/memory-bank/techContext.md
# etc.
# 4. Start Claude Code
claude
# 5. Verify context
> "Explain this project to me"
# Claude should explain based on your memory bank!
# 6. Start building
> "/plan
> Let's build the first feature"# 1. Open Claude Code
claude
# 2. Use planning workflow
> "/plan
> I want to add payment processing with Stripe"
# Claude asks clarifying questions, you answer
# 3. Review and approve plan
> "Yes, let's proceed with that plan"
# 4. Claude implements systematically
# 5. Update memory bank
> "update memory bank"
# Claude updates relevant files with new patterns and progress# 1. Clone project with memory bank
git clone <project-repo>
cd <project>
# 2. Read the memory bank
cat .claude/memory-bank/projectbrief.md
cat .claude/memory-bank/productContext.md
cat .claude/memory-bank/systemPatterns.md
# etc.
# 3. Start Claude Code
claude
# 4. Ask questions
> "Walk me through the authentication flow"
> "Where is error handling implemented?"
> "What's our testing strategy?"
# Claude answers based on memory bank - you're up to speed!Start with projectbrief.md and activeContext.md. Add others as your project grows. Some context is better than none.
activeContext.md: After every significant changeprogress.md: When features complete or status changes- Others: When architectural decisions are made or patterns emerge
Absolutely! Just:
- Copy
.claude/directory to your project - Fill out memory bank files based on current state
- Start using Claude Code with full context
Update projectbrief.md first (it's the foundation), then cascade changes to other files. Say "update memory bank" and work with Claude to revise documentation.
While designed for Claude Code, the memory bank structure works great for:
- Human team members (excellent documentation)
- Other AI tools
- Project handoffs
- Future reference
Memory bank provides:
- High-level context and rationale
- User perspective and product vision
- Project evolution and decision history
- Current status and next steps
Code comments explain how specific code works. Memory bank explains why the project exists and how everything fits together.
Found a way to improve this template? Contributions welcome!
- Fork the repository
- Create a feature branch
- Make your improvements
- Submit a pull request
Ideas for contributions:
- Additional template files for specific use cases
- More slash commands
- Documentation improvements
- Example projects
- Integration guides
[Your chosen license - e.g., MIT]
This memory bank system is adapted from Cursor's memory bank approach and optimized for Claude Code's architecture, hook system, and workflow patterns.
Ready to get started? Read .claude/memory-bank/QUICKSTART.md for step-by-step setup instructions.
Questions? Open an issue or check the troubleshooting section.
Happy building with Claude Code! 🚀