On this page#
- The definition
- Why it exists
- How it actually works
- Repository invariants
- When you need it and when you do not
- The part vendors leave out
- FAQ
The definition#
A cline memory bank is a repository-local set of Markdown files that gives Cline durable project context across otherwise independent conversations. It records the system’s purpose, constraints, architecture, current state, and progress; it is not model memory, a database, or a substitute for reading the code before making changes.
The key distinction is durability. A large language model generates responses from the context available to it during a request. It does not inherently preserve a trustworthy, continuously updated understanding of your repository between tasks.
A memory bank puts selected context into files that can be reviewed, versioned, and corrected. That makes it closer to operational documentation than intelligence embedded in the model.
Photo by Snapwire on Pexels.
Why it exists#
Memory banks exist because an agent repeatedly reconstructing a mature repository from source is slow, expensive, and unreliable. Before this pattern, teams relied on long prompts, scattered documentation, chat history, or one engineer’s explanations. Those approaches fail because they are either transient, unstructured, or detached from the repository’s current state.
Real codebases contain facts that are difficult to infer safely:
- Which architectural boundaries are intentional
- Which strange-looking behavior is a compatibility requirement
- Which commands are approved for validation
- Which generated files must not be edited
- Which migration is incomplete
- Which tempting refactor has already been rejected
Code reveals implementation, but not every reason behind it. An agent can correctly understand a function and still violate a repository-level invariant.
The memory bank pattern described in the Cline documentation makes this context explicit and reloadable. Its value is not “the agent remembers everything.” Its value is that engineers decide which facts deserve to survive the conversation.
Without that discipline, developers usually compensate in one of three ways:
- Re-explain the repository at the start of every task.
- Keep one increasingly unmanageable conversation alive.
- Let the agent rediscover architecture from whichever files it happens to inspect.
All three create hidden variance. The same request can produce different changes depending on what the agent saw first.
If your repository lacks written foundations entirely, fix that before optimizing agent memory. PairFoundry’s foundations material is the more useful starting point: stable context must exist before a tool can load it reliably.
How it actually works#
A memory bank works through context injection, not background learning. At the beginning of a task, Cline reads repository files containing curated project knowledge and includes their contents in the working context. During or after the task, those files may be updated so the next session starts from a newer written state.
A practical layout separates stable facts from volatile state:
memory-bank/
projectbrief.md
productContext.md
systemPatterns.md
techContext.md
activeContext.md
progress.mdThe official Cline documentation explains the product’s expected workflow. In a production repository, however, the filenames matter less than maintaining clear ownership for each kind of information.
Use narrow files with explicit responsibilities:
| File | Put this in it | Keep this out |
|---|---|---|
| projectbrief.md | Scope, users, non-negotiable outcomes | Current task notes |
| systemPatterns.md | Boundaries, data flow, architectural rules | A tour of every directory |
| techContext.md | Supported tooling and validation commands | Unverified setup guesses |
| activeContext.md | Current work, decisions pending, immediate risks | Permanent architecture |
| progress.md | Completed and remaining work | A duplicate commit log |
Write constraints as testable instructions, not aspirations:

*Photo by Digital Buggu on [Pexels](https://www.pexels.com/photo/monitor-displaying-computer-application-374559/).*
## Repository invariants
- Do not edit generated files under `dist/`.
- Database changes require a forward migration and rollback path.
- Keep transport concerns outside the domain package.
- Run the smallest relevant validation command before the full suite.
- Ask before changing public interfaces or dependency declarations.That is useful context. “Follow best practices” is not.
Permissions should be equally narrow. Default access should allow reading the memory bank and relevant source. Writing should be restricted to files required by the accepted task. Shell commands, dependency changes, migrations, generated output, and external actions should require separate approval.
This is where teams often confuse memory with authority. A file telling the agent how deployments work must not silently grant permission to deploy.
Other agents use different persistence surfaces. For example, Claude Code’s documentation describes its own project instructions and working conventions. The transferable idea is not a Cline-specific folder name; it is keeping durable repository rules separate from temporary conversation context.
When you need it and when you do not#
Use a memory bank when repeated rediscovery is creating material risk: the repository has durable invariants, tasks cross several subsystems, sessions regularly restart, or multiple engineers expect agents to make consistent decisions. Skip it when the project is small, the work is isolated, or existing repository documentation already supplies concise, maintained context.
You probably need one if at least several of these are true:
- Correctness depends on rules that are not obvious from code.
- The agent repeatedly asks the same architectural questions.
- Work continues across separate sessions.
- More than one engineer delegates changes to coding agents.
- The repository contains generated, regulated, legacy, or migration-sensitive areas.
- A technically valid patch can still be operationally wrong.
You probably do not need one for:
- A disposable prototype
- A single-file change with local acceptance criteria
- A repository whose existing contributor documentation already covers the same ground
- Tasks where fresh inspection is safer than inherited assumptions
Do not create a memory bank merely because Cline supports it. Extra context consumes attention and can bias an agent toward stale conclusions. A five-page architectural essay is often worse than ten precise invariants.
The decision is straightforward: add durable context only when the cost of reconstructing or missing it exceeds the cost of maintaining it.
For teams standardizing more than memory files—review rules, task framing, and reusable operating constraints—the PairFoundry packs provide the broader view. The memory bank is one layer, not the entire agent workflow.
Photo by ThisIsEngineering on Pexels.
The part vendors leave out#
The main failure mode is not that the agent forgets the memory bank. It is that the bank confidently preserves yesterday’s truth. Once stale context is treated as authoritative, it can override evidence in the code and make wrong changes look deliberate. Maintenance ownership is therefore part of the implementation, not optional housekeeping.
Three costs are routinely understated.
First, every stored statement competes for context. More documentation does not produce proportionally better decisions. Keep stable rules compact, and move historical narrative elsewhere.
Second, shared memory creates merge and ownership problems. Two engineers can update activeContext.md from different branches, each accurately describing a different state. Resolve it as operational state, not ordinary prose: choose the current branch reality and delete obsolete claims.
Third, agents may update memory files with interpretations rather than facts. That is unacceptable. A proposed architectural conclusion should remain marked as pending until a human or repository evidence confirms it.
Use a simple control loop:
- Treat source code, tests, and accepted configuration as primary evidence.
- Treat stable memory files as reviewed repository policy.
- Treat active context as disposable working state.
- Review memory-bank changes in the same pull request as the change that made them necessary.
- Revert incorrect memory through version control, then restart the task with corrected context.
A second engineer should be able to distinguish fact, decision, and open question without reading the originating chat. If they cannot, the bank is personal scratch space pretending to be team infrastructure.
That distinction is central to other plain definitions as well: naming a mechanism accurately is more useful than repeating the vendor’s promise.
Related reading#
- What is MCP server in AI, explained without the marketing
- What Claude Code context window actually is, and when you need it
FAQ#
Should the memory bank be committed to the repository?#
Commit the stable files when they express shared project rules that every engineer and agent should follow. Keep personal notes, speculative diagnoses, credentials, and branch-specific scratch work out. Volatile files can be committed only when the team accepts their merge conflicts and assigns someone to remove stale state.
Repository history makes incorrect changes reviewable and reversible. It does not make their contents trustworthy automatically.
How do we stop two engineers from corrupting the shared context?#
Separate durable policy from active work, keep each file narrowly scoped, and review updates alongside the code that justifies them. Do not let every completed task rewrite every file. If two branches disagree, reconcile against repository evidence rather than combining both narratives into a misleading compromise.
A named owner for architectural memory is better than collective but imaginary ownership.
What should we do when the memory bank is wrong?#
Correct or revert the relevant file, identify any code change made from the false assumption, and restart the agent with clean context. Do not patch the conversation with another instruction while leaving the bad repository state intact; the next session will reload the same error.
The recovery path should be ordinary version control plus targeted validation, not a special memory-reset ceremony.
When should we avoid using a memory bank?#
Avoid it when maintained repository documentation already provides the same context, when tasks are genuinely local, or when the project changes so quickly that written state becomes stale between sessions. Also avoid it if nobody will review updates. An unowned memory bank is not neutral documentation; it is an accumulating source of confident mistakes.