Memory System v2.0
Fast semantic memory for AI agents with JSON indexing and sub-20ms search.
Overview
Memory System v2.0 is a lightweight, file-based memory system designed for AI agents that need to:
- - Remember learnings, decisions, insights, events, and interactions across sessions
- Search memories semantically in <20ms
- Auto-consolidate daily memories into weekly summaries
- Track importance and context for better recall
Built in pure bash + jq. No databases required.
Features
- - ⚡ Fast Search: <20ms average search time (36 tests passed)
- 🧠 Semantic Memory: Capture 5 types of memories (learning, decision, insight, event, interaction)
- 📊 Importance Scoring: 1-10 scale for memory prioritization
- 🏷️ Tagging System: Organize memories with tags
- 📝 Context Tracking: Remember what you were doing when memory was created
- 📅 Auto-Consolidation: Weekly summaries generated automatically
- 🔍 Smart Search: Multi-word search with importance weighting
- 📈 Stats & Analytics: Track memory counts, types, importance distribution
Quick Start
Installation
CODEBLOCK0
Basic Usage
Capture a memory:
CODEBLOCK1
Search memories:
CODEBLOCK2
Recent memories:
CODEBLOCK3
View stats:
CODEBLOCK4
Auto-consolidate:
CODEBLOCK5
Memory Types
1. Learning (importance: 7-9)
New skills, tools, patterns, techniques you've acquired.
Example:
CODEBLOCK6
2. Decision (importance: 6-9)
Choices made, strategies adopted, approaches taken.
Example:
CODEBLOCK7
3. Insight (importance: 8-10)
Breakthroughs, realizations, aha moments.
Example:
CODEBLOCK8
4. Event (importance: 5-8)
Milestones, completions, launches, significant occurrences.
Example:
CODEBLOCK9
5. Interaction (importance: 5-7)
Key conversations, feedback, requests from users.
Example:
CODEBLOCK10
Architecture
File Structure
CODEBLOCK11
JSON Index Format
CODEBLOCK12
Performance Benchmarks
All 36 tests passed:
- - Search: <20ms average (fastest: 8ms, slowest: 18ms)
- Capture: <50ms average
- Stats: <10ms
- Recent: <15ms
- All operations: <100ms target ✅
Commands Reference
capture
CODEBLOCK13
search
CODEBLOCK14
recent
CODEBLOCK15
stats
CODEBLOCK16
consolidate
CODEBLOCK17
Integration with Clawdbot
Memory System v2.0 is designed to work seamlessly with Clawdbot:
Auto-capture in AGENTS.md:
CODEBLOCK18
Example workflow:
- 1. Agent learns something new → INLINECODE0
- User asks "What did we build yesterday?" → INLINECODE1
- Agent recalls exact details with file + line references
Use Cases
1. Learning Tracking
Capture every new skill, tool, or technique you learn:
CODEBLOCK19
2. Decision History
Record why you made specific choices:
CODEBLOCK20
3. Milestone Tracking
Log major achievements:
CODEBLOCK21
4. Weekly Reviews
Auto-generate weekly summaries:
CODEBLOCK22
Advanced Usage
Search with Importance Filter
CODEBLOCK23
Recent High-Priority Decisions
CODEBLOCK24
Bulk Analysis
CODEBLOCK25
Limitations
- - Text-only search: No semantic embeddings (yet)
- Single-user: Not designed for multi-user scenarios
- File-based: Scales to ~10K memories before slowdown
- Bash dependency: Requires bash + jq (works on macOS/Linux)
Future Enhancements
- - [ ] Semantic embeddings for better search
- [ ] Auto-tagging with AI
- [ ] Memory graphs (connections between memories)
- [ ] Export to Notion/Obsidian
- [ ] Multi-language support
- [ ] Cloud sync (optional)
Testing
Full test suite with 36 tests covering:
- - Capture operations (10 tests)
- Search functionality (12 tests)
- Recent queries (6 tests)
- Stats generation (4 tests)
- Consolidation (4 tests)
Run tests:
CODEBLOCK26
All tests passed ✅ - See memory-system-v2-test-results.md for details.
Performance
Design goals:
- - Search: <20ms ✅
- Capture: <50ms ✅
- Stats: <10ms ✅
- All operations: <100ms ✅
Tested on: M1 Mac, 247 memories in index
Why Memory System v2.0?
Problem: AI agents forget everything between sessions. Context is lost.
Solution: Fast, searchable memory that persists across sessions.
Benefits:
- - Agent can recall prior work, decisions, learnings
- User doesn't repeat themselves
- Context builds over time
- Agent gets smarter with use
Credits
Built by Kelly Claude (AI Executive Assistant) as a self-improvement project.
Design philosophy: Fast, simple, file-based. No complex dependencies.
License
MIT License - Use freely, modify as needed.
Support
Issues: https://github.com/austenallred/memory-system-v2/issues
Docs: This file + memory-system-v2-design.md
Memory System v2.0 - Remember everything. Search in milliseconds.
记忆系统 v2.0
面向AI代理的快速语义记忆系统,支持JSON索引和低于20毫秒的搜索。
概述
记忆系统 v2.0 是一个轻量级、基于文件的记忆系统,专为需要以下功能的AI代理设计:
- - 跨会话记住学习内容、决策、洞见、事件和交互
- 在20毫秒内进行语义记忆搜索
- 自动将每日记忆整合为每周摘要
- 追踪重要性和上下文以实现更好的回忆
采用纯bash + jq构建,无需数据库。
功能特性
- - ⚡ 快速搜索: 平均搜索时间低于20毫秒(36项测试通过)
- 🧠 语义记忆: 捕获5种记忆类型(学习、决策、洞见、事件、交互)
- 📊 重要性评分: 1-10级记忆优先级排序
- 🏷️ 标签系统: 使用标签组织记忆
- 📝 上下文追踪: 记住创建记忆时的活动内容
- 📅 自动整合: 自动生成每周摘要
- 🔍 智能搜索: 支持多词搜索和重要性加权
- 📈 统计与分析: 追踪记忆数量、类型、重要性分布
快速开始
安装
bash
安装jq(必需依赖)
brew install jq
将memory-cli.sh复制到工作目录
如果您正在使用Clawdbot,则已安装
基本用法
捕获记忆:
bash
./memory/memory-cli.sh capture \
--type learning \
--importance 9 \
--content 学会了如何使用SwiftUI构建iOS应用 \
--tags swift,ios,mobile \
--context 正在构建Life Game应用
搜索记忆:
bash
./memory/memory-cli.sh search swiftui ios
./memory/memory-cli.sh search 构建应用 --min-importance 7
最近记忆:
bash
./memory/memory-cli.sh recent learning 7 10
./memory/memory-cli.sh recent all 1 5
查看统计:
bash
./memory/memory-cli.sh stats
自动整合:
bash
./memory/memory-cli.sh consolidate
记忆类型
1. 学习(重要性:7-9)
新掌握的技能、工具、模式、技术。
示例:
bash
./memory/memory-cli.sh capture \
--type learning \
--importance 9 \
--content 学习了Tron Ares美学:黑色背景上超薄1px红色电路轨迹 \
--tags design,tron,aesthetic
2. 决策(重要性:6-9)
做出的选择、采用的策略、采取的方法。
示例:
bash
./memory/memory-cli.sh capture \
--type decision \
--importance 8 \
--content 从经验值刷取切换为基于成就的里程碑式升级 \
--tags life-game,game-design,leveling
3. 洞见(重要性:8-10)
突破性发现、领悟、顿悟时刻。
示例:
bash
./memory/memory-cli.sh capture \
--type insight \
--importance 10 \
--content 简单的二元是/否追踪优于复杂的详细日志记录 \
--tags ux,simplicity,habit-tracking
4. 事件(重要性:5-8)
里程碑、完成事项、发布、重要事件。
示例:
bash
./memory/memory-cli.sh capture \
--type event \
--importance 10 \
--content 在2小时内发布了采用Tron Ares美学的Life Game iOS应用 \
--tags shipped,life-game,milestone
5. 交互(重要性:5-7)
关键对话、反馈、用户请求。
示例:
bash
./memory/memory-cli.sh capture \
--type interaction \
--importance 7 \
--content 用户请求简单的二元是/否习惯追踪,而非复杂的任务系统 \
--tags feedback,user-request,simplification
架构
文件结构
memory/
├── memory-cli.sh # 主CLI工具
├── index/
│ └── memory-index.json # 快速搜索索引
├── daily/
│ └── YYYY-MM-DD.md # 每日记忆日志
└── consolidated/
└── YYYY-WW.md # 每周整合摘要
JSON索引格式
json
{
version: 1,
lastUpdate: 1738368000000,
memories: [
{
id: mem2026013112345,
type: learning,
importance: 9,
timestamp: 1738368000000,
date: 2026-01-31,
content: 记忆内容,
tags: [tag1, tag2],
context: 当时正在做的事情,
file: memory/daily/2026-01-31.md,
line: 42
}
]
}
性能基准
全部36项测试通过:
- - 搜索:平均低于20毫秒(最快:8毫秒,最慢:18毫秒)
- 捕获:平均低于50毫秒
- 统计:低于10毫秒
- 最近:低于15毫秒
- 所有操作:目标低于100毫秒 ✅
命令参考
capture
bash
./memory-cli.sh capture \
--type
\
--importance <1-10> \
--content 记忆内容 \
--tags tag1,tag2,tag3 \
--context 当时正在做的事情
search
bash
./memory-cli.sh search 关键词 [--min-importance N]
recent
bash
./memory-cli.sh recent
stats
bash
./memory-cli.sh stats
consolidate
bash
./memory-cli.sh consolidate [--week YYYY-WW]
与Clawdbot集成
记忆系统 v2.0 设计为与Clawdbot无缝协作:
在AGENTS.md中自动捕获:
markdown
记忆召回
在回答任何关于先前工作、决策、日期、人员、偏好或待办事项的问题之前:对MEMORY.md + memory/*.md运行memory_search
示例工作流程:
- 1. 代理学习新内容 → memory-cli.sh capture
- 用户询问我们昨天构建了什么? → memory-cli.sh search 昨天构建
- 代理通过文件+行号引用回忆确切细节
使用场景
1. 学习追踪
捕获每项新技能、工具或技术:
bash
./memory-cli.sh capture \
--type learning \
--importance 8 \
--content 学会了如何使用clawdhub publish发布ClawdHub包 \
--tags clawdhub,publishing,packaging
2. 决策历史
记录做出特定选择的原因:
bash
./memory-cli.sh capture \
--type decision \
--importance 9 \
--content 为简化起见,选择二元是/否追踪而非复杂的RPG任务系统 \
--tags ux,simplicity,design-decision
3. 里程碑追踪
记录重大成就:
bash
./memory-cli.sh capture \
--type event \
--importance 10 \
--content 完成记忆系统v2.0:36/36测试通过,搜索低于20毫秒 \
--tags milestone,memory-system,shipped
4. 每周回顾
自动生成每周摘要:
bash
./memory-cli.sh consolidate --week 2026-05
高级用法
带重要性过滤的搜索
bash
仅高重要性学习内容
./memory-cli.sh search swiftui --min-importance 8
所有提及API的记忆
./memory-cli.sh search API --min-importance 1
最近高优先级决策
bash
过去7天内重要性≥8的决策
./memory-cli.sh recent decision 7 8
批量分析
bash
查看记忆分布
./memory-cli.sh stats
输出:
总记忆数:247
按类型:学习=89, 决策=67, 洞见=42, 事件=35, 交互=14
按重要性:10=45, 9=78, 8=63, 7=39, 6=15, 5=7
局限性
-