Quick Setup
- Copy the custom instructions below
- Add to custom instructions or a
.clinerulesfile - Ask Cline to “initialize memory bank”
How It Works
Memory Bank files are regular markdown files in your project that both you and Cline can access. They’re organized hierarchically to build a complete picture of your project:.png)
Core Files
| File | Purpose |
|---|---|
projectbrief.md | Foundation document with core requirements and goals |
productContext.md | Why the project exists, problems it solves, UX goals |
activeContext.md | Current focus, recent changes, next steps (updates most frequently) |
systemPatterns.md | Architecture, design patterns, component relationships |
techContext.md | Tech stack, setup, constraints, dependencies |
progress.md | What works, what’s left, known issues |
Key Commands
- “follow your custom instructions” - Tells Cline to read Memory Bank and continue where you left off
- “initialize memory bank” - Creates the initial structure for a new project
- “update memory bank” - Triggers a full documentation review and update
/newtask and /smol help you manage context windows without losing progress.
Working with Plan & Act Modes
Memory Bank pairs naturally with Plan & Act mode:- Plan mode: Start here when resuming a project. Ask Cline to read the Memory Bank, review the current state, and discuss strategy before making changes.
- Act mode: Switch to Act mode once you have a plan. Cline retains everything from the planning session and can implement changes.
/deep-planning to have Cline investigate your codebase and create a detailed implementation plan. The Memory Bank gives Cline the project context it needs to plan effectively.
Managing Context Windows
Every AI model has a context window that limits how much information it can process at once. As you work, this window fills with conversation history, file contents, and tool results. Memory Bank helps you preserve important knowledge when you need to free up space.Manual approach
When your context window fills up:- Ask Cline to “update memory bank” to document the current state
- Start a new conversation
- Ask Cline to “follow your custom instructions”
Using slash commands
Cline’s built-in commands offer more targeted options:/smolcompresses your conversation history while keeping you in the same task. Use this when you want to free up space without starting over./newtaskdistills key decisions, file changes, and progress into a fresh task with a clean context window. This is like a developer handoff that preserves what matters.
Automatic context management
Enable Auto-Compact to let Cline automatically compress context as you work. This reduces how often you need to manually manage the context window, though you should still update the Memory Bank after significant milestones..png)
Memory Bank and Checkpoints
Memory Bank and Checkpoints solve different sides of the same problem:- Memory Bank preserves knowledge: project context, decisions, patterns, and progress across sessions.
- Checkpoints preserve code state: file snapshots you can restore if something goes wrong.
Reducing Your Context Footprint
Memory Bank works best when your starting context is lean. If Cline loads your entire project into context, including dependencies, build artifacts, and generated files, you burn through tokens before the real work starts. Add a.clineignore file. This is the single biggest improvement most users can make. It tells Cline which files to skip when scanning your project. Adding one can drop your starting context from 200k+ tokens to under 50k, which means faster responses, lower costs, and the ability to use smaller models effectively.
Keep Memory Bank files concise. Each file adds to your context when Cline reads it at the start of a session. Keep projectbrief.md to one page, activeContext.md to current state only (not a running log), and progress.md to a summary rather than a detailed changelog. If a file grows beyond a page or two, split the detail into a separate doc and link to it. Cline can read linked files on demand.
Use Cline Rules strategically. Rules load into every request. Use conditional rules to activate rules only when working with matching files, so frontend rules don’t load when you’re editing backend code.
Best Practices
- Start with a basic project brief and let structure evolve
- Let Cline help create the initial structure
activeContext.mdchanges most frequently; update it after each sessionprogress.mdtracks milestones; review it when resuming work- Update after significant milestones or direction changes
- Use Cline Rules to store the Memory Bank instructions per-project
- Add a
.clineignoreearly to keep your starting context small
Memory Bank Custom Instructions
Copy this into custom instructions or a.clinerules file:
FAQ
Custom instructions or .clinerules? Either works. Custom instructions apply globally across all projects. A.clinerules file is project-specific and stored in your repo, which makes it easy to share with collaborators. You can also use conditional rules to activate Memory Bank instructions only when working with memory-bank/ files.
How often should I update?
After significant milestones or direction changes. For active development, every few sessions. You can also let Auto-Compact handle routine context management and reserve manual “update memory bank” for important checkpoints.
How does Memory Bank relate to checkpoints?
Checkpoints save your code state (file snapshots). Memory Bank saves your project knowledge (context, decisions, progress). They complement each other: checkpoints let you roll back code, Memory Bank lets you pick up where you left off intellectually.
How does Memory Bank relate to context window limitations?
Memory Bank stores important information in structured files that Cline can load efficiently at the start of each session. This prevents context bloat while keeping critical information available. For more on how context windows work, see Task Management.
Does this work with other AI tools?
Yes. Memory Bank is a documentation methodology that works with any AI that can read docs. Commands may differ but the approach works across tools.
Different from README files?
Memory Bank provides structured, comprehensive documentation designed for AI context management, going beyond what a single README covers. It includes files for active context and progress tracking that change frequently, unlike a typical README.
For more information, see the Memory Bank blog post.
Related
- Plan & Act Mode - Separate thinking from doing with structured planning sessions
- Checkpoints - Roll back code changes while keeping your conversation context
- Cline Rules - Define persistent instructions including Memory Bank setup
- Task Management - Understand tasks, context windows, and when to start fresh

