failure-memory
Failure Memory provides AI coding agents with a shared local memory of failures, enabling them to record, recall, and learn from mistakes across sessions.
README
Failure Memory
Failure Memory gives AI coding agents a shared, local memory of mistakes worth remembering.
It exists because not every correction is a failure. A user may be adding a new requirement, clarifying missing information, or changing a preference. Saving all of those as “lessons” creates noisy memory and makes the agent less reliable.
Failure Memory records only durable lessons from real failures, recalls them before similar work, and learns whether each recall was useful.
Why use it?
Without a deliberate failure-memory system, agents tend to:
- repeat mistakes across sessions and tools;
- treat requirement changes as failures;
- save several copies of the same lesson;
- recall loosely related advice without measuring whether it helped.
Failure Memory adds two review gates:
- Failure qualification — was there an established expectation, an observable mismatch, meaningful impact or recurrence risk, a controllable cause, and a durable prevention lesson?
- Generalization review — should the incident reuse an existing lesson, support a broader version of one, or remain distinct?
Similarity search suggests at most three related lessons. It never merges or promotes a lesson automatically.
Supported agents
| Agent or harness | Support | Installation |
|---|---|---|
| OpenAI Codex | Plugin, skills, hooks, and MCP tools | Public GitHub marketplace |
| Claude Code | Plugin, skills, hooks, and MCP tools | Public GitHub marketplace |
| GitHub Copilot CLI | Plugin, skills, hooks, and MCP tools | Public GitHub marketplace |
| Cursor | Plugin, skills, hooks, and MCP tools | Local plugin or team marketplace |
| Other MCP clients | Core MCP tools | Configure the bundled stdio server manually |
All supported harnesses use the same memory for the current OS user. Installing the plugin in a second agent does not create a second database.
Install
Requirements
- Python 3.13 or newer; Python 3.14 is recommended
- Git
Check Python before installing:
python3 --version
Codex
codex plugin marketplace add CongBao/failure-memory
codex plugin add failure-memory@failure-memory
Start a new Codex task after installation so the skills, hooks, and MCP server are loaded.
Claude Code
claude plugin marketplace add CongBao/failure-memory
claude plugin install failure-memory@failure-memory
Run /reload-plugins in an active Claude Code session, or start a new session.
GitHub Copilot CLI
copilot plugin install CongBao/failure-memory
This direct GitHub installation uses the repository's Copilot plugin manifest. The repository can also be added as a Copilot marketplace for browsing and managed updates. Start a new Copilot CLI session after installation.
Cursor
Failure Memory includes a Cursor plugin projection. Until it is listed in the public Cursor Marketplace, install it as a local plugin:
git clone https://github.com/CongBao/failure-memory.git
mkdir -p ~/.cursor/plugins/local
ln -s "$PWD/failure-memory" ~/.cursor/plugins/local/failure-memory
Restart Cursor or run Developer: Reload Window. Teams and Enterprise users can also import this repository from Dashboard → Plugins → Add Marketplace.
How to use it
Failure Memory provides two agent skills:
- Recall failure lessons before risky, repeated, or failure-prone work.
- Record an agent failure after a real mismatch has been confirmed.
You can ask naturally; you do not need to call database tools yourself.
1. Recall lessons before work
Example prompts:
Before changing this installer, recall any relevant failure lessons.
Check Failure Memory for lessons about plugin identity and duplicate installs.
Recall is exact-first, then similarity-based. Results come from the global personal store, even when another supported agent recorded the lesson.
2. Evaluate a possible failure
After something goes wrong, ask the agent to evaluate it:
Evaluate whether this was a real failure. Do not record it if I only changed or
clarified the requirement.
The evaluation distinguishes:
- real failures;
- requirement updates;
- requirement clarifications;
- preference updates;
- mixed or uncertain feedback.
Rejected and deferred evaluations remain auditable, but they do not become incidents or lessons.
3. Review and record the lesson
If the evaluation is accepted, ask the agent to complete the second review:
Review this accepted failure against existing lessons. Reuse an exact match, propose a
carefully generalized lesson when justified, or keep it distinct.
Then explicitly approve recording:
Record the reviewed failure and proposed prevention lesson.
The plugin stores immutable incidents and versioned lessons. Existing history is preserved rather than overwritten.
4. Give feedback on recalled lessons
Recall feedback is important because it tells the memory which lessons actually help:
That recalled lesson was useful and prevented the same failure. Record the outcome.
That lesson was a false positive for this task. Record that outcome.
Failure Memory stores append-only recall attempts, candidates, selections, outcomes, false positives, and missed-relevant feedback. It does not store raw recall prompts.
5. Check health and learning metrics
Example prompts:
Check Failure Memory health and retrieval status.
Show recall feedback coverage, usefulness, false-positive, and missed-relevant metrics.
Search modes
Exact signature and SQLite FTS5 lexical search work without third-party dependencies.
Optional semantic search uses local sqlite-vec and FastEmbed, and hybrid search fuses
lexical and vector rankings.
Semantic dependencies and the embedding model are installed only after explicit approval:
uv run failure-memory adapters plan
uv run failure-memory adapters install
uv run failure-memory index build
Local data and privacy
Failure Memory is local-first. It does not require a hosted database or cloud account. The default global data root is:
- macOS:
~/Library/Application Support/failure-memory - Linux:
${XDG_DATA_HOME:-~/.local/share}/failure-memory - Windows:
%LOCALAPPDATA%\FailureMemory
Back up the event-store database; indexes, models, and adapter environments can be rebuilt. Recognized credentials and private keys are redacted, but do not submit secrets, personal data, raw transcripts, or unnecessary private paths.
See CONTRIBUTING.md to contribute and SECURITY.md to report a vulnerability.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。