🧠

AI Agent 的极速持久记忆引擎

Memory System V2 · v1.0.0
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 S 级 作者 kellyclaudeai 公开目录收录
4.8k 下载 12 安装 14.8k 收藏 36 浏览

简介

轻量级语义记忆系统,基于 Bash+jq 实现 <20ms 搜索,支持跨会话持久化学习与决策回溯

原始描述

Fast semantic memory system with JSON indexing, auto-consolidation, and <20ms search. Capture learnings, decisions, insights, events. Use when you need persistent memory across sessions or want to recall prior work/decisions.

通过你的 Agent 添加

安装目录:memory-system-v2/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/memory-system-v2/
Codex CLI~/.codex/skills/memory-system-v2/
DeepSeek Harness~/.agents/skills/memory-system-v2/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

Memory System v2 是一款轻量级、纯文件架构的语义记忆系统,专为 AI 代理设计。基于 bash + jq 实现,零外部依赖,无需数据库即可在本地构建可搜索的知识库。

主要功能模块:

  1. 记忆捕获 (capture):支持5种记忆类型——学习(learning)、决策(decision)、洞见(insight)、事件(event)、交互(interaction),按1-10重要性评分,可附加标签与上下文

  2. 智能检索 (search):多关键词联合搜索,支持重要性阈值过滤,平均响应<20ms

  3. 时间维度查询 (recent):按类型、天数、最小重要性筛选近期记忆

  4. 自动整合 (consolidate):按周自动生成摘要,实现记忆层级压缩

  5. 统计分析 (stats):展示记忆分布、类型占比、重要性分布等维度数据

文件架构:

~/clawd/memory/
├── memory-cli.sh      # 主程序
├── index/memory-index.json  # JSON索引(快速检索)
├── daily/YYYY-MM-DD.md      # 每日原始日志
└── consolidated/YYYY-WW.md  # 周度整合摘要

性能实测(247条记忆/M1 Mac):

  • 搜索:8-18ms(平均<20ms ✅)
  • 捕获:<50ms
  • 统计:<10ms

显著优点

  1. 极致速度:JSON索引 + 本地文件,避免数据库开销,搜索性能远超基于文本grep的方案

  2. 零运维成本:纯bash/jq实现,无服务依赖,无需配置数据库或Docker

  3. 语义分类科学:5种记忆类型覆盖知识管理全场景,重要性评分实现信息分层

  4. AI原生设计:专为AI代理跨会话记忆设计,上下文字段记录"当时正在做什么",召回时还原场景

  5. 完全离线:数据仅本地存储,符合隐私敏感场景需求

  6. 测试完备:36项测试覆盖全部核心功能,质量可信


潜在缺点与局限性

  1. 无语义嵌入:当前为关键词匹配,不支持向量相似度搜索,同义词召回能力有限

  2. 单机单用户:无多用户隔离机制,团队协作场景不适用

  3. 规模天花板:作者建议~10K条记忆前性能稳定,超量后需考虑迁移或分片

  4. 输入验证薄弱:捕获命令对用户输入长度、特殊字符缺乏限制,极端输入可能影响数据完整性

  5. JSON构造方式:使用heredoc字符串插值构造JSON,存在理论注入风险(虽实际影响有限)

  6. 无自动备份:依赖用户自行管理~/clawd/memory目录的备份策略


适合人群

  • AI代理开发者:为LLM工具链添加跨会话记忆能力
  • 个人知识管理用户:追踪学习路径、决策理由、项目里程碑
  • 隐私优先用户:拒绝云服务,要求数据完全本地可控
  • 轻量工具爱好者:厌倦重型Notion/Obsidian复杂功能,追求Unix哲学极简方案

不适合:

  • 需要团队协作的多人场景
  • 超大规模数据(>10万条记忆)
  • 需要向量语义搜索的复杂召回需求

常规风险

风险类别 具体描述 缓解措施
数据丢失 纯本地文件,无自动云同步 定期备份~/clawd/memory目录
注入风险 JSON构造使用字符串插值 避免在content/tags中输入未转义引号
文件膨胀 日志文件无限增长 手动清理或实现日志轮转
jq兼容性 依赖jq版本未明确 建议jq 1.6+,安装后验证功能
权限误设 目录权限问题导致读写失败 确保运行用户对~/clawd有写权限

总体评估:低风险、高实用性的本地工具,安全认证等级S,适合生产环境个人使用。

技能正文


name: memory-system-v2 description: Fast semantic memory system with JSON indexing, auto-consolidation, and <20ms search. Capture learnings, decisions, insights, events. Use when you need persistent memory across sessions or want to recall prior work/decisions. homepage: https://github.com/austenallred/memory-system-v2 metadata: {"clawdbot":{"emoji":"🧠","requires":{"bins":["jq"]},"install":[{"id":"brew-jq","kind":"brew","formula":"jq","bins":["jq"],"label":"Install jq via Homebrew"}]}}

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

# Install jq (required dependency)
brew install jq

# Copy memory-cli.sh to your workspace
# Already installed if you're using Clawdbot

Basic Usage

Capture a memory:

./memory/memory-cli.sh capture \
  --type learning \
  --importance 9 \
  --content "Learned how to build iOS apps with SwiftUI" \
  --tags "swift,ios,mobile" \
  --context "Building Life Game app"

Search memories:

./memory/memory-cli.sh search "swiftui ios"
./memory/memory-cli.sh search "build app" --min-importance 7

Recent memories:

./memory/memory-cli.sh recent learning 7 10
./memory/memory-cli.sh recent all 1 5

View stats:

./memory/memory-cli.sh stats

Auto-consolidate:

./memory/memory-cli.sh consolidate

Memory Types

1. Learning (importance: 7-9)

New skills, tools, patterns, techniques you've acquired.

Example:

./memory/memory-cli.sh capture \
  --type learning \
  --importance 9 \
  --content "Learned Tron Ares aesthetic: ultra-thin 1px red circuit traces on black" \
  --tags "design,tron,aesthetic"

2. Decision (importance: 6-9)

Choices made, strategies adopted, approaches taken.

Example:

./memory/memory-cli.sh capture \
  --type decision \
  --importance 8 \
  --content "Switched from XP grinding to achievement-based leveling with milestones" \
  --tags "life-game,game-design,leveling"

3. Insight (importance: 8-10)

Breakthroughs, realizations, aha moments.

Example:

./memory/memory-cli.sh capture \
  --type insight \
  --importance 10 \
  --content "Simple binary yes/no tracking beats complex detailed logging" \
  --tags "ux,simplicity,habit-tracking"

4. Event (importance: 5-8)

Milestones, completions, launches, significant occurrences.

Example:

./memory/memory-cli.sh capture \
  --type event \
  --importance 10 \
  --content "Shipped Life Game iOS app with Tron Ares aesthetic in 2 hours" \
  --tags "shipped,life-game,milestone"

5. Interaction (importance: 5-7)

Key conversations, feedback, requests from users.

Example:

./memory/memory-cli.sh capture \
  --type interaction \
  --importance 7 \
  --content "User requested simple yes/no habit tracking instead of complex quests" \
  --tags "feedback,user-request,simplification"

Architecture

File Structure

memory/
├── memory-cli.sh              # Main CLI tool
├── index/
│   └── memory-index.json      # Fast search index
├── daily/
│   └── YYYY-MM-DD.md          # Daily memory logs
└── consolidated/
    └── YYYY-WW.md             # Weekly consolidated summaries

JSON Index Format

{
  "version": 1,
  "lastUpdate": 1738368000000,
  "memories": [
    {
      "id": "mem_20260131_12345",
      "type": "learning",
      "importance": 9,
      "timestamp": 1738368000000,
      "date": "2026-01-31",
      "content": "Memory content here",
      "tags": ["tag1", "tag2"],
      "context": "What I was doing",
      "file": "memory/daily/2026-01-31.md",
      "line": 42
    }
  ]
}

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

./memory-cli.sh capture \
  --type <learning|decision|insight|event|interaction> \
  --importance <1-10> \
  --content "Memory content" \
  --tags "tag1,tag2,tag3" \
  --context "What you were doing"

search

./memory-cli.sh search "keywords" [--min-importance N]

recent

./memory-cli.sh recent <type|all> <days> <min-importance>

stats

./memory-cli.sh stats

consolidate

./memory-cli.sh consolidate [--week YYYY-WW]

Integration with Clawdbot

Memory System v2.0 is designed to work seamlessly with Clawdbot:

Auto-capture in AGENTS.md:

## Memory Recall
Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search on MEMORY.md + memory/*.md

Example workflow:

  1. Agent learns something new → memory-cli.sh capture
  2. User asks "What did we build yesterday?" → memory-cli.sh search "build yesterday"
  3. Agent recalls exact details with file + line references

Use Cases

1. Learning Tracking

Capture every new skill, tool, or technique you learn:

./memory-cli.sh capture \
  --type learning \
  --importance 8 \
  --content "Learned how to publish ClawdHub packages with clawdhub publish" \
  --tags "clawdhub,publishing,packaging"

2. Decision History

Record why you made specific choices:

./memory-cli.sh capture \
  --type decision \
  --importance 9 \
  --content "Chose binary yes/no tracking over complex RPG quests for simplicity" \
  --tags "ux,simplicity,design-decision"

3. Milestone Tracking

Log major achievements:

./memory-cli.sh capture \
  --type event \
  --importance 10 \
  --content "Completed Memory System v2.0: 36/36 tests passed, <20ms search" \
  --tags "milestone,memory-system,shipped"

4. Weekly Reviews

Auto-generate weekly summaries:

./memory-cli.sh consolidate --week 2026-05

Advanced Usage

Search with Importance Filter

# Only high-importance learnings
./memory-cli.sh search "swiftui" --min-importance 8

# All memories mentioning "API"
./memory-cli.sh search "API" --min-importance 1

Recent High-Priority Decisions

# Decisions from last 7 days with importance ≥ 8
./memory-cli.sh recent decision 7 8

Bulk Analysis

# See memory distribution
./memory-cli.sh stats

# Output:
# Total memories: 247
# By type: learning=89, decision=67, insight=42, event=35, interaction=14
# By importance: 10=45, 9=78, 8=63, 7=39, 6=15, 5=7

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:

./memory-cli.sh test  # If test suite is included

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.

正文来自原始仓库, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/kellyclaudeai/memory-system-v2

标签

memory-managementcli-toolknowledge-baseai-agentbashjsonproductivitynote-takingsearch-engine

同类 Skill