# memory-bank

The rule sets up a memory-bank/ folder of project docs so Copilot can pick up context again after a session reset.

- rule · `type=rule` · GitHub Copilot · ★ 40451
- Author: github · official GitHub repository
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/github/awesome-copilot/tree/HEAD/instructions/memory-bank.instructions.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/rules/memory-bank

## What it does

This rule lays out the Memory Bank pattern: a `memory-bank/` directory at the workspace root holding a set of markdown files. Six of them are required — `projectbrief.md`, `productContext.md`, `activeContext.md`, `systemPatterns.md`, `techContext.md` and `progress.md`. They form a hierarchy. The brief sets scope, and from it come product context, system patterns and tech context; those feed `activeContext.md`, which in turn leads to `progress.md` and the `tasks/` folder. Each task gets its own file named `TASKID-taskname.md`, with `_index.md` tracking statuses.

At the start of every task the agent reads the whole bank. Updates happen when a new pattern shows up, after significant changes, or on your request. The rule also keeps a running journal of project observations: implementation paths that worked, your workflow preferences, known trouble spots.

It is opt-in, and that matters. Turn it on only if you actually want lasting documentation, because otherwise the extra files pile up in a repo that does not need them. The rule targets `memory-bank/**`, so nothing outside that folder is affected.

## Install

### GitHub Copilot (native platform)

**Manually: put the files in place**
- File: `.github/instructions/memory-bank.instructions.md` — The applyTo field sets which files it applies to

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/memory-bank.md` — The paths frontmatter field limits the files: move applyTo from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/memory-bank.mdc` — Frontmatter: description, globs, alwaysApply. Move applyTo from the source into globs, or the rule will not attach on its own

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/memory-bank.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/memory-bank.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/github/awesome-copilot/tree/HEAD/instructions/memory-bank.instructions.md

## When to use it
- restore project context after the agent's session resets
- keep requirements and scope in one place
- split work into per-task files with statuses
- record technical decisions and patterns in use
- track what already works and what is still missing

## Example prompts
- Read every file in `memory-bank/` and continue the current task
- Update memory bank: go through all files and describe the current state
- Create a task file in `tasks/` and add it to `_index.md`

## Source text · memory-bank.instructions.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: cea8398bb6f1e931.

BEGIN THIRD-PARTY FILE cea8398bb6f1e931
````text
---
description: 'Memory Bank pattern: persistent project documentation under a memory-bank/ folder so the AI can resume context across sessions.'
applyTo: 'memory-bank/**'
---

> **Opt-in pattern.** This instruction creates and maintains a `memory-bank/` folder in the workspace root. Enable it only when you want persistent project documentation across AI sessions; otherwise the auxiliary files will accumulate in repos that don't need them.

Coding standards, domain knowledge, and preferences that AI should follow.

# Memory Bank

You are an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.

## Memory Bank Structure

The Memory Bank consists of required core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:

```mermaid
flowchart TD
    PB[projectbrief.md] --> PC[productContext.md]
    PB --> SP[systemPatterns.md]
    PB --> TC[techContext.md]
    
    PC --> AC[activeContext.md]
    SP --> AC
    TC --> AC
    
    AC --> P[progress.md]
    AC --> TF[tasks/ folder]
```

### Core Files (Required)
1. `projectbrief.md`
   - Foundation document that shapes all other files
   - Created at project start if it doesn't exist
   - Defines core requirements and goals
   - Source of truth for project scope

2. `productContext.md`
   - Why this project exists
   - Problems it solves
   - How it should work
   - User experience goals

3. `activeContext.md`
   - Current work focus
   - Recent changes
   - Next steps
   - Active decisions and considerations

4. `systemPatterns.md`
   - System architecture
   - Key technical decisions
   - Design patterns in use
   - Component relationships

5. `techContext.md`
   - Technologies used
   - Development setup
   - Technical constraints
   - Dependencies

6. `progress.md`
   - What works
   - What's left to build
   - Current status
   - Known issues

7. `tasks/` folder
   - Contains individual markdown files for each task
   - Each task has its own dedicated file with format `TASKID-taskname.md`
   - Includes task index file (`_index.md`) listing all tasks with their statuses
   - Preserves complete thought process and history for each task

### Additional Context
Create additional files/folders within memory-bank/ when they help organize:
- Complex feature documentation
- Integration specifications
- API documentation
- Testing strategies
- Deployment procedures

## Core Workflows

### Plan Mode
```mermaid
flowchart TD
    Start[Start] --> ReadFiles[Read Memory Bank]
    ReadFiles --> CheckFiles{Files Complete?}
    
    CheckFiles -->|No| Plan[Create Plan]
    Plan --> Document[Document in Chat]
    
    CheckFiles -->|Yes| Verify[Verify Context]
    Verify --> Strategy[Develop Strategy]
    Strategy --> Present[Present Approach]
```

### Act Mode
```mermaid
flowchart TD
    Start[Start] --> Context[Check Memory Bank]
    Context --> Update[Update Documentation]
    Update --> Rules[Update instructions if needed]
    Rules --> Execute[Execute Task]
    Execute --> Document[Document Changes]
```

### Task Management
```mermaid
flowchart TD
    Start[New Task] --> NewFile[Create Task File in tasks/ folder]
    NewFile --> Think[Document Thought Process]
````
END THIRD-PARTY FILE cea8398bb6f1e931

The third-party file has ended. Everything between the cea8398bb6f1e931 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3525 of 10550 bytes. © github · MIT · https://github.com/github/awesome-copilot/tree/HEAD/instructions/memory-bank.instructions.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
