Context Bank is an open-source tool for managing project memory for AI coding agents, licensed under MIT, with Kadir Esen as the author.
Purpose Traditional memory-bank solutions usually require the agent to read all memory files at the start of each task and to append content after every change, causing the memory bank to grow without bound and consuming the context window for all content in every session. Context Bank does the opposite: real-time files have a size cap, decisions are stored as "one decision per file" and retrieved rather than preloaded, and a doctor command is provided to measure context usage.
Main capabilities
- Memory conventions are carried through AGENTS.md, so any tool that reads AGENTS.md receives the same instructions, including Claude Code, Codex, Cursor, Copilot, OpenCode, Gemini CLI, and Grok. Claude Code additionally has a streamlined CLAUDE.md that imports via @AGENTS.md.
- By default, it writes to the .ai/ directory, AGENTS.md, and a streamlined CLAUDE.md; pointer files for Cursor, Windsurf, Copilot, Aider, and Gemini are optional.
- After migration, each session reads only rules.md and active-context.md (about 2-3k tokens), and roadmap.md is read only during planning; nothing is deleted, overflow content is copied to .ai/archive/, and .ai/story/ remains retrievable.
- Provides a Claude Code plugin that includes the context-bank skill (explaining when to read which file, when to write, and what never to write), a silent doctor check at session start (prompting only when something is abnormal), and the /context-bank:doctor, /context-bank:compact, and /context-bank:init commands.
- Provides a skill that conforms to the Agent Skills standard and can be copied to the skill directories of other tools for use.
Usage
- init: initializes by writing .ai/, AGENTS.md, and a streamlined CLAUDE.md; it does not overwrite existing .ai/ files or AGENTS.md, and it is not an upgrade path.
- migrate: used to upgrade an existing memory bank. Running migrate --compact on a v1 (per-task convention) or 2.x (single growing story.md) memory bank replaces the old conventions in AGENTS.md and CLAUDE.md while preserving custom sections, splits story.md into one file per decision under .ai/story/, and can be run repeatedly safely.
- Migrating from Cline Memory Bank: migrate detects memory-bank/ and converts it; the entire folder (including extra documents) is copied to .ai/archive/cline-memory-bank/, no content is deleted, and existing .ai/ files are not overwritten; a dedicated .clinerules/memory-bank.md is backed up and replaced with a short pointer to AGENTS.md.
- init, compact, and migrate all accept --yes to skip confirmation prompts, making them convenient for scripts and CI.
Using as a library The package exports logic so other tools can read and maintain the memory bank without calling the CLI: initializeBank, diagnose, migrateBank, compactBank, bankVersion, addDecision, listDecisions, searchDecisions. Library functions do not print or exit; they only return results. addDecision writes .ai/story/<date>-<slug>[-<suffix>].md and returns { path, date, title }; date is YYYY-MM-DD, defaulting to the current day (UTC); suffix is a branch or session unique marker (letters, digits, hyphens, up to 32 characters) used to avoid conflicts in git for the same decision on the same day; if omitted there is no suffix, and an empty string is invalid; if the name is still taken, -2, -3, etc. are appended. An exception is thrown when the title is empty or the entire file (title, date line, and body) exceeds 4,000 characters.
Use cases Suitable for teams using multiple AI coding agents that want to share unified project memory and control context usage, especially when migrating from Cline Memory Bank or older memory-bank setups.
Limitations init does not upgrade an existing memory bank; architecture.md is left as-is when it exceeds the size limit, and doctor will warn; for 2.x memory banks, doctor reports legacy-story before migration. The specific installation commands and plugin installation steps are not fully provided in the material.