Memory Bank Skill
Overview
Memory Bank is a cross-session context continuity system for AI coding agents. It maintains a memory-bank/ directory in the project root with structured markdown files that capture project knowledge, architecture decisions, progress, and active context. Every AI agent reads these files at session start, ensuring continuity across sessions and across different agents working on the same project.
This skill handles four intents: SETUP, UPDATE, STATUS, and READ. It detects user intent from natural language in any language.
Intent Detection
Detect the user's intent from their message. The user may write in any language — use natural language understanding to map to the correct intent.
| Intent |
Trigger Words (examples, not exhaustive) |
| SETUP |
setup, install, initialize, init, create, bootstrap, kur, kurulum, başlat, einrichten, configurar, installer, configurer, 설치, セットアップ |
| UPDATE |
update, refresh, sync, güncelle, yenile, aktualisieren, actualizar, mettre à jour, 업데이트, 更新 |
| STATUS |
status, check, durumu, durum, kontrol, estado, statut, 상태, ステータス |
| READ |
read, show, review, display, present, oku, göster, lesen, anzeigen, lire, leer, mostrar, 읽기, 読む |
Route to the matching flow below. If the intent is ambiguous, ask the user which action they want.
SETUP Flow
Follow these steps in order. Get user confirmation at each major step.
Step 1: Language & Profile Preference
1a. Language:
Ask the user which language the memory bank files should be written in:
- TR (Turkish)
- EN (English)
Store this choice — all file headings, labels, and descriptions will be in this language. Templates in templates/ are in English; translate headings and labels to the chosen language when filling them.
1b. Profile:
Ask the user which profile they want:
- Basic (7 files) — Suitable for small/medium projects. Includes the core files for project context, architecture, tech stack, active context, and progress tracking.
- Extended (7 core + optional extra files) — Suitable for enterprise/production projects. Includes the core files plus specialized files for business logic, data models, security, observability, and more.
If the user selects Extended, present the list of optional extended files and let them pick which ones they need:
| Extended File |
Purpose |
businessLogic.md |
Domain rules, business workflows, validation logic |
dataModel.md |
Database schema, entity relationships, data flow |
dependencies.md |
Detailed dependency map, version constraints, upgrade notes |
events.md |
Event-driven architecture, pub/sub topics, event schemas |
externalIntegrations.md |
3rd party APIs, webhooks, service contracts |
featureToggles.md |
Feature flags, A/B tests, gradual rollout rules |
observability.md |
Logging, monitoring, tracing, alerting setup |
security.md |
Auth flows, security policies, vulnerability tracking |
technicalDebt.md |
Known debt items, refactoring priorities, cleanup plans |
contextCoverage.md |
Memory bank completeness tracking, coverage gaps |
The user can select all, some, or none. Store the selection for Steps 4 and 5.
Step 2: Ask User Which Agent(s) They Use
CRITICAL: This skill can run inside any agent (Claude Code, Cursor, Windsurf, Cline, etc.). The agent running this skill is NOT necessarily the agent the user wants to configure. You MUST always ask the user which agent(s) they use for this project. NEVER assume the running agent is the target. NEVER skip this question. NEVER auto-create a rules file based on which agent you are.
2a. Ask the user:
Ask: "Which AI coding agent(s) do you use for this project?" and present these options:
- Claude Code →
CLAUDE.md or .claude/rules/*.md
- Cursor →
.cursor/rules/*.mdc (legacy: .cursorrules)
- Windsurf →
.windsurf/rules/*.md (legacy: .windsurfrules)
- Cline →
.clinerules/ directory or .clinerules file
- GitHub Copilot →
.github/copilot-instructions.md
- Roo Code →
.roo/rules/*.md (legacy: .roorules)
- Aider →
CONVENTIONS.md + .aider.conf.yml
- Antigravity →
.gemini/GEMINI.md
- OpenAI Codex →
AGENTS.md
- Other → ask for the rules file name/path
The user may select multiple agents. Store the selection for Step 3.
2b. Scan for existing rules files:
Read reference.md for the full agent-to-rules-file mapping table.
IMPORTANT: Rules files are NOT always in the project root. Search the ENTIRE project tree to find them. Use glob/find patterns to locate all known rules files regardless of their location.
Search for the rules files of the agent(s) the user selected:
| Agent |
File Names to Search |
| Claude Code |
CLAUDE.md, .claude/CLAUDE.md, .claude/rules/*.md |
| Cursor |
.cursor/rules/*.mdc, .cursorrules (legacy) |
| Windsurf |
.windsurf/rules/*.md, .windsurfrules (legacy) |
| Cline |
.clinerules/ (directory), .clinerules (file) |
| GitHub Copilot |
.github/copilot-instructions.md, .github/instructions/*.instructions.md |
| Roo Code |
.roo/rules/*.md, .roorules (legacy) |
| Aider |
CONVENTIONS.md, .aider.conf.yml |
| Antigravity |
.gemini/GEMINI.md |
| OpenAI Codex |
AGENTS.md |
Search strategy:
- Use glob patterns like
**/.cursor/rules/*.mdc, **/.windsurf/rules/*.md, **/CLAUDE.md, **/.claude/rules/*.md, **/.clinerules, **/.github/copilot-instructions.md, **/.roo/rules/*.md, **/.aider.conf.yml, **/CONVENTIONS.md, **/AGENTS.md, **/.gemini/GEMINI.md
- Also search for legacy files:
**/.cursorrules, **/.windsurfrules, **/.roorules
- Exclude
node_modules/, .git/, dist/, build/, .next/, vendor/ directories from search
- For ambiguous names (like
CONVENTIONS.md), verify by checking parent directory context
2c. Report results and handle unrecognized agents:
- If the rules file for the user's selected agent(s) already exists, report the path(s) and proceed to inject the protocol
- If the rules file does not exist, create it at the standard location for that agent
- If the user selected multiple agents, handle each one
- If the user's agent is NOT in the supported list above, or the agent cannot be matched to a known rules file format:
- Create
AGENTS.md in the project root as a generic fallback
- Inject the Memory Bank protocol into
AGENTS.md
- Display a clear warning to the user:
⚠️ Your agent ([agent name]) is not in our supported list.
The Memory Bank protocol has been written to AGENTS.md in the project root.
For Memory Bank to work correctly, you MUST manually add or copy
the contents of AGENTS.md into your agent's own rules file.
Please check your agent's documentation for the correct rules file
location and format, then ensure the Memory Bank protocol is included.
- This ensures the protocol content is available even if automatic injection isn't possible
Step 3: Inject Protocol into Rules Files
For each selected rules file:
- Read the file
- Check if it already contains "Memory Bank Protocol" — if yes, skip it
- Read
templates/rules-protocol.md for the protocol block
- Prepend the protocol block to the top of the file (before existing content)
- Show the user the change and get confirmation before writing
Step 4: Create memory-bank/ Directory
Check if memory-bank/ exists in the project root:
- If it exists, check which files are present and only create missing ones
- If it doesn't exist, create it
Core files (always created — 7 total):
RULES.md
projectbrief.md
productContext.md
systemPatterns.md
techContext.md
activeContext.md
progress.md
Extended files (only if user selected Extended profile — based on their selection):
8. businessLogic.md
9. dataModel.md
10. dependencies.md
11. events.md
12. externalIntegrations.md
13. featureToggles.md
14. observability.md
15. security.md
16. technicalDebt.md
17. contextCoverage.md
Step 5: Fill Templates with Project Data
For each missing file:
- Read the corresponding template from
templates/
- Scan the project for real data to fill the template:
package.json — project name, dependencies, scripts
README.md — project description, vision
tsconfig.json / jsconfig.json — import aliases, compiler options
- Folder structure — architecture patterns
- Git log (last 10-20 commits) — recent changes, active work
- Existing rules files — conventions, preferences
- Fill placeholders with discovered project data
- Translate headings/labels to the user's chosen language
- Show the filled content to the user
- Get approval before writing each file
Important: RULES.md is created from templates/RULES.md and is immutable after creation — the skill must never modify it in subsequent runs.
Step 6: .gitignore Check
Verify that memory-bank/ is NOT listed in .gitignore. Memory bank files should be committed to git so all team members and agents can access them.
If memory-bank/ is found in .gitignore, warn the user and offer to remove it.
Step 7: Validation Checklist
Run the validation checklist and display results:
[✓/✗] Rules file found and Memory Bank protocol injected
[✓/✗] memory-bank/ directory exists
Core files:
[✓/✗] RULES.md exists
[✓/✗] projectbrief.md exists
[✓/✗] productContext.md exists
[✓/✗] systemPatterns.md exists
[✓/✗] techContext.md exists
[✓/✗] activeContext.md exists
[✓/✗] progress.md exists
If Extended profile was selected, also validate the selected extended files:
Extended files:
[✓/✗] businessLogic.md exists
[✓/✗] dataModel.md exists
[✓/✗] dependencies.md exists
... (only show files the user selected)
If all pass, show completion message:
Memory Bank setup complete!
Profile: [Basic/Extended]
Agent: [agent name]
Rules file: [file path]
Memory Bank: memory-bank/ ([N] files)
From now on, memory-bank/ files will be read at every session start.
Try: "memory bank status" or "memory bank read"
If any fail, explain the issue and offer to fix it.
UPDATE Flow
Step 1: Read Current Memory Bank
Read all 7 files from memory-bank/ (skip RULES.md — it is immutable).
Step 2: Scan Current Project State
Gather current project information:
- Git status, recent commits, current branch
- Package.json changes (new dependencies, scripts)
- Folder structure changes
- Any new/modified rules files
Step 3: Detect Changes & Propose Updates
Compare current project state with memory bank contents. For each file that needs updates:
- Show what changed (diff-style or summary)
- Show proposed new content
- Get user approval before writing
Step 4: Write Approved Updates
Write only the approved changes. Add date stamps [YYYY-MM-DD] to entries.
Step 5: Summary
Show a summary of what was updated and what was left unchanged.
STATUS Flow
- Read
memory-bank/activeContext.md
- Read
memory-bank/progress.md
- Present a concise summary:
- Current focus / active work
- Recent changes
- What's completed
- What's in progress
- Known issues
- Next steps
Respond in the same language as the existing memory bank files (auto-detect from headings).
READ Flow
- Read ALL files in
memory-bank/
- Present the full context in an organized format:
- Start with project overview (from
projectbrief.md)
- Then product context (from
productContext.md)
- Then technical details (from
techContext.md + systemPatterns.md)
- Then current state (from
activeContext.md + progress.md)
- Highlight any areas that appear outdated or incomplete
Respond in the same language as the existing memory bank files (auto-detect from headings).
Important Rules
- NEVER modify
memory-bank/RULES.md after initial creation
- NEVER write secrets (API keys, tokens, passwords) to memory bank files
- NEVER skip user confirmation for file writes during setup
- Keep each file under 500 lines
- Use date stamps
[YYYY-MM-DD] for temporal entries
- Don't duplicate information across files
- When updating, preserve existing content and append/modify — don't overwrite entire files unless the user approves
For detailed rules, agent mapping, and update triggers, see reference.md.
Source: halilbarim/hbm-skills — distributed by TomeVault.
1---2name: halilbarim-hbm-skills-memory-bank3description: Memory Bank Skill4---56# Memory Bank Skill78## Overview910Memory Bank is a cross-session context continuity system for AI coding agents. It maintains a `memory-bank/` directory in the project root with structured markdown files that capture project knowledge, architecture decisions, progress, and active context. Every AI agent reads these files at session start, ensuring continuity across sessions and across different agents working on the same project.1112This skill handles four intents: **SETUP**, **UPDATE**, **STATUS**, and **READ**. It detects user intent from natural language in any language.1314## Intent Detection1516Detect the user's intent from their message. The user may write in any language — use natural language understanding to map to the correct intent.1718| Intent | Trigger Words (examples, not exhaustive) |19|--------|------------------------------------------|20| **SETUP** | setup, install, initialize, init, create, bootstrap, kur, kurulum, başlat, einrichten, configurar, installer, configurer, 설치, セットアップ |21| **UPDATE** | update, refresh, sync, güncelle, yenile, aktualisieren, actualizar, mettre à jour, 업데이트, 更新 |22| **STATUS** | status, check, durumu, durum, kontrol, estado, statut, 상태, ステータス |23| **READ** | read, show, review, display, present, oku, göster, lesen, anzeigen, lire, leer, mostrar, 읽기, 読む |2425Route to the matching flow below. If the intent is ambiguous, ask the user which action they want.2627---2829## SETUP Flow3031Follow these steps in order. Get user confirmation at each major step.3233### Step 1: Language & Profile Preference3435**1a. Language:**3637Ask the user which language the memory bank files should be written in:38- **TR** (Turkish)39- **EN** (English)4041Store this choice — all file headings, labels, and descriptions will be in this language. Templates in `templates/` are in English; translate headings and labels to the chosen language when filling them.4243**1b. Profile:**4445Ask the user which profile they want:4647- **Basic** (7 files) — Suitable for small/medium projects. Includes the core files for project context, architecture, tech stack, active context, and progress tracking.48- **Extended** (7 core + optional extra files) — Suitable for enterprise/production projects. Includes the core files plus specialized files for business logic, data models, security, observability, and more.4950If the user selects **Extended**, present the list of optional extended files and let them pick which ones they need:5152| Extended File | Purpose |53|---------------|---------|54| `businessLogic.md` | Domain rules, business workflows, validation logic |55| `dataModel.md` | Database schema, entity relationships, data flow |56| `dependencies.md` | Detailed dependency map, version constraints, upgrade notes |57| `events.md` | Event-driven architecture, pub/sub topics, event schemas |58| `externalIntegrations.md` | 3rd party APIs, webhooks, service contracts |59| `featureToggles.md` | Feature flags, A/B tests, gradual rollout rules |60| `observability.md` | Logging, monitoring, tracing, alerting setup |61| `security.md` | Auth flows, security policies, vulnerability tracking |62| `technicalDebt.md` | Known debt items, refactoring priorities, cleanup plans |63| `contextCoverage.md` | Memory bank completeness tracking, coverage gaps |6465The user can select all, some, or none. Store the selection for Steps 4 and 5.6667### Step 2: Ask User Which Agent(s) They Use6869**CRITICAL:** This skill can run inside any agent (Claude Code, Cursor, Windsurf, Cline, etc.). The agent running this skill is NOT necessarily the agent the user wants to configure. You MUST always ask the user which agent(s) they use for this project. NEVER assume the running agent is the target. NEVER skip this question. NEVER auto-create a rules file based on which agent you are.7071**2a. Ask the user:**7273Ask: "Which AI coding agent(s) do you use for this project?" and present these options:74- Claude Code → `CLAUDE.md` or `.claude/rules/*.md`75- Cursor → `.cursor/rules/*.mdc` (legacy: `.cursorrules`)76- Windsurf → `.windsurf/rules/*.md` (legacy: `.windsurfrules`)77- Cline → `.clinerules/` directory or `.clinerules` file78- GitHub Copilot → `.github/copilot-instructions.md`79- Roo Code → `.roo/rules/*.md` (legacy: `.roorules`)80- Aider → `CONVENTIONS.md` + `.aider.conf.yml`81- Antigravity → `.gemini/GEMINI.md`82- OpenAI Codex → `AGENTS.md`83- Other → ask for the rules file name/path8485The user may select multiple agents. Store the selection for Step 3.8687**2b. Scan for existing rules files:**8889Read `reference.md` for the full agent-to-rules-file mapping table.9091**IMPORTANT:** Rules files are NOT always in the project root. Search the ENTIRE project tree to find them. Use glob/find patterns to locate all known rules files regardless of their location.9293Search for the rules files of the agent(s) the user selected:9495| Agent | File Names to Search |96|-------|---------------------|97| Claude Code | `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md` |98| Cursor | `.cursor/rules/*.mdc`, `.cursorrules` (legacy) |99| Windsurf | `.windsurf/rules/*.md`, `.windsurfrules` (legacy) |100| Cline | `.clinerules/` (directory), `.clinerules` (file) |101| GitHub Copilot | `.github/copilot-instructions.md`, `.github/instructions/*.instructions.md` |102| Roo Code | `.roo/rules/*.md`, `.roorules` (legacy) |103| Aider | `CONVENTIONS.md`, `.aider.conf.yml` |104| Antigravity | `.gemini/GEMINI.md` |105| OpenAI Codex | `AGENTS.md` |106107Search strategy:1081. Use glob patterns like `**/.cursor/rules/*.mdc`, `**/.windsurf/rules/*.md`, `**/CLAUDE.md`, `**/.claude/rules/*.md`, `**/.clinerules`, `**/.github/copilot-instructions.md`, `**/.roo/rules/*.md`, `**/.aider.conf.yml`, `**/CONVENTIONS.md`, `**/AGENTS.md`, `**/.gemini/GEMINI.md`1092. Also search for legacy files: `**/.cursorrules`, `**/.windsurfrules`, `**/.roorules`1103. Exclude `node_modules/`, `.git/`, `dist/`, `build/`, `.next/`, `vendor/` directories from search1114. For ambiguous names (like `CONVENTIONS.md`), verify by checking parent directory context112113**2c. Report results and handle unrecognized agents:**114115- If the rules file for the user's selected agent(s) already exists, report the path(s) and proceed to inject the protocol116- If the rules file does not exist, create it at the standard location for that agent117- If the user selected multiple agents, handle each one118- **If the user's agent is NOT in the supported list above**, or the agent cannot be matched to a known rules file format:119 1. Create `AGENTS.md` in the project root as a generic fallback120 2. Inject the Memory Bank protocol into `AGENTS.md`121 3. Display a clear warning to the user:122 ```123 ⚠️ Your agent ([agent name]) is not in our supported list.124 The Memory Bank protocol has been written to AGENTS.md in the project root.125126 For Memory Bank to work correctly, you MUST manually add or copy127 the contents of AGENTS.md into your agent's own rules file.128129 Please check your agent's documentation for the correct rules file130 location and format, then ensure the Memory Bank protocol is included.131 ```132 4. This ensures the protocol content is available even if automatic injection isn't possible133134### Step 3: Inject Protocol into Rules Files135136For each selected rules file:1371. Read the file1382. Check if it already contains "Memory Bank Protocol" — if yes, skip it1393. Read `templates/rules-protocol.md` for the protocol block1404. Prepend the protocol block to the top of the file (before existing content)1415. Show the user the change and get confirmation before writing142143### Step 4: Create memory-bank/ Directory144145Check if `memory-bank/` exists in the project root:146- If it exists, check which files are present and only create missing ones147- If it doesn't exist, create it148149**Core files (always created — 7 total):**1501. `RULES.md`1512. `projectbrief.md`1523. `productContext.md`1534. `systemPatterns.md`1545. `techContext.md`1556. `activeContext.md`1567. `progress.md`157158**Extended files (only if user selected Extended profile — based on their selection):**1598. `businessLogic.md`1609. `dataModel.md`16110. `dependencies.md`16211. `events.md`16312. `externalIntegrations.md`16413. `featureToggles.md`16514. `observability.md`16615. `security.md`16716. `technicalDebt.md`16817. `contextCoverage.md`169170### Step 5: Fill Templates with Project Data171172For each missing file:1731. Read the corresponding template from `templates/`1742. Scan the project for real data to fill the template:175 - `package.json` — project name, dependencies, scripts176 - `README.md` — project description, vision177 - `tsconfig.json` / `jsconfig.json` — import aliases, compiler options178 - Folder structure — architecture patterns179 - Git log (last 10-20 commits) — recent changes, active work180 - Existing rules files — conventions, preferences1813. Fill placeholders with discovered project data1824. Translate headings/labels to the user's chosen language1835. Show the filled content to the user1846. Get approval before writing each file185186**Important:** `RULES.md` is created from `templates/RULES.md` and is **immutable** after creation — the skill must never modify it in subsequent runs.187188### Step 6: .gitignore Check189190Verify that `memory-bank/` is NOT listed in `.gitignore`. Memory bank files should be committed to git so all team members and agents can access them.191192If `memory-bank/` is found in `.gitignore`, warn the user and offer to remove it.193194### Step 7: Validation Checklist195196Run the validation checklist and display results:197198```199[✓/✗] Rules file found and Memory Bank protocol injected200[✓/✗] memory-bank/ directory exists201202Core files:203[✓/✗] RULES.md exists204[✓/✗] projectbrief.md exists205[✓/✗] productContext.md exists206[✓/✗] systemPatterns.md exists207[✓/✗] techContext.md exists208[✓/✗] activeContext.md exists209[✓/✗] progress.md exists210```211212If Extended profile was selected, also validate the selected extended files:213```214Extended files:215[✓/✗] businessLogic.md exists216[✓/✗] dataModel.md exists217[✓/✗] dependencies.md exists218... (only show files the user selected)219```220221If all pass, show completion message:222```223Memory Bank setup complete!224Profile: [Basic/Extended]225Agent: [agent name]226Rules file: [file path]227Memory Bank: memory-bank/ ([N] files)228229From now on, memory-bank/ files will be read at every session start.230Try: "memory bank status" or "memory bank read"231```232233If any fail, explain the issue and offer to fix it.234235---236237## UPDATE Flow238239### Step 1: Read Current Memory Bank240241Read all 7 files from `memory-bank/` (skip `RULES.md` — it is immutable).242243### Step 2: Scan Current Project State244245Gather current project information:246- Git status, recent commits, current branch247- Package.json changes (new dependencies, scripts)248- Folder structure changes249- Any new/modified rules files250251### Step 3: Detect Changes & Propose Updates252253Compare current project state with memory bank contents. For each file that needs updates:2541. Show what changed (diff-style or summary)2552. Show proposed new content2563. Get user approval before writing257258### Step 4: Write Approved Updates259260Write only the approved changes. Add date stamps `[YYYY-MM-DD]` to entries.261262### Step 5: Summary263264Show a summary of what was updated and what was left unchanged.265266---267268## STATUS Flow2692701. Read `memory-bank/activeContext.md`2712. Read `memory-bank/progress.md`2723. Present a concise summary:273 - Current focus / active work274 - Recent changes275 - What's completed276 - What's in progress277 - Known issues278 - Next steps279280Respond in the same language as the existing memory bank files (auto-detect from headings).281282---283284## READ Flow2852861. Read ALL files in `memory-bank/`2872. Present the full context in an organized format:288 - Start with project overview (from `projectbrief.md`)289 - Then product context (from `productContext.md`)290 - Then technical details (from `techContext.md` + `systemPatterns.md`)291 - Then current state (from `activeContext.md` + `progress.md`)2923. Highlight any areas that appear outdated or incomplete293294Respond in the same language as the existing memory bank files (auto-detect from headings).295296---297298## Important Rules299300- **NEVER** modify `memory-bank/RULES.md` after initial creation301- **NEVER** write secrets (API keys, tokens, passwords) to memory bank files302- **NEVER** skip user confirmation for file writes during setup303- Keep each file under 500 lines304- Use date stamps `[YYYY-MM-DD]` for temporal entries305- Don't duplicate information across files306- When updating, preserve existing content and append/modify — don't overwrite entire files unless the user approves307308For detailed rules, agent mapping, and update triggers, see `reference.md`.309310---311> Source: [halilbarim/hbm-skills](https://github.com/halilbarim/hbm-skills) — distributed by [TomeVault](https://tomevault.io).312<!-- tomevault:4.0:skill_md:2026-05-23 -->