memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory

记忆系统

A hybrid search memory system for your project. Save important information and find it later using semantic search.
First run: If slow on first use, run
bunx memory-search --warmup
to pre-download the embedding model (~300MB).
为你的项目打造的混合搜索记忆系统。保存重要信息,之后通过语义搜索快速找到。
首次运行:如果首次使用时速度较慢,请运行
bunx memory-search --warmup
预下载嵌入模型(约300MB)。

Memory File Structure

记忆文件结构

project/
├── MEMORY.md           # Long-term: preferences, patterns, decisions
└── memory/
    └── YYYY-MM-DD.md   # Daily: session notes, context, progress

project/
├── MEMORY.md           # 长期存储:偏好、模式、决策
└── memory/
    └── YYYY-MM-DD.md   # 日常存储:会话笔记、上下文、进度

Searching Memory

搜索记忆内容

When the user asks about past decisions, preferences, or wants to recall information:
bash
bunx memory-search "QUERY_HERE"
当用户询问过往决策、偏好,或想要回忆信息时:
bash
bunx memory-search "QUERY_HERE"

Search Examples

搜索示例

bash
bunx memory-search "database choice decision"
bunx memory-search "error handling pattern"
bunx memory-search "user preferences coding style"
bunx memory-search "authentication implementation"
bash
bunx memory-search "database choice decision"
bunx memory-search "error handling pattern"
bunx memory-search "user preferences coding style"
bunx memory-search "authentication implementation"

Output Format

输出格式

Returns matching snippets with:
  • path: File where the match was found
  • lines: Line range (startLine-endLine)
  • score: Relevance score (0-1)
  • snippet: The matching text
返回匹配的片段,包含:
  • path:匹配内容所在文件
  • lines:行范围(起始行-结束行)
  • score:相关性分数(0-1)
  • snippet:匹配文本片段

After Searching

搜索后操作

  1. Present the relevant results to the user
  2. If they want more detail, use
    Read
    to get the full file content
  3. If no results found, offer to search with different terms

  1. 向用户展示相关结果
  2. 如果用户需要更多细节,使用
    Read
    功能获取完整文件内容
  3. 如果未找到结果,提供更换搜索词重新搜索的选项

Saving to Memory

保存到记忆系统

When the user says "remember this", "save this", "note that", or wants to store information:
当用户说“记住这个”、“保存这个”、“记下那个”,或想要存储信息时:

Decide Which File

选择存储文件

MEMORY.md (Permanent):
  • User preferences ("I prefer TypeScript")
  • Project decisions ("We chose PostgreSQL for X reason")
  • Coding patterns ("Always use async/await")
  • Architecture decisions
  • Important URLs, contacts, credentials references
memory/YYYY-MM-DD.md (Daily):
  • What was worked on today
  • Bugs found and fixed
  • Ideas to explore later
  • Meeting notes
  • Temporary context
MEMORY.md(永久存储):
  • 用户偏好(如“我偏好TypeScript”)
  • 项目决策(如“我们因X原因选择PostgreSQL”)
  • 编码模式(如“始终使用async/await”)
  • 架构决策
  • 重要URL、联系人、凭证参考
memory/YYYY-MM-DD.md(日常存储):
  • 今日工作内容
  • 发现并修复的Bug
  • 后续探索的想法
  • 会议笔记
  • 临时上下文

How to Save

保存方法

  1. Read existing file first (if it exists) to avoid overwriting
  2. Append new content with a timestamp or section header
  3. Use clear, searchable language (will be vector-searched later)
  4. Run sync after saving to update the search index
bash
bunx memory-search --sync
  1. 先读取现有文件(如果存在),避免覆盖内容
  2. 附加新内容,可添加时间戳或章节标题
  3. 使用清晰、便于搜索的语言(后续会进行向量搜索)
  4. 保存后运行同步以更新搜索索引
bash
bunx memory-search --sync

Example: MEMORY.md

示例:MEMORY.md

markdown
undefined
markdown
undefined

User Preferences

用户偏好

  • Prefers Bun over Node for TypeScript projects
  • Uses pnpm as package manager
  • Likes minimal dependencies
  • 在TypeScript项目中偏好使用Bun而非Node
  • 使用pnpm作为包管理器
  • 喜欢精简的依赖

Project Decisions

项目决策

2024-01-15: Database Choice

2024-01-15: 数据库选择

Chose SQLite over PostgreSQL because:
  • Single-user application
  • No need for concurrent writes
  • Simpler deployment
undefined
选择SQLite而非PostgreSQL的原因:
  • 单用户应用
  • 无需并发写入
  • 部署更简单
undefined

Example: memory/2024-01-15.md

示例:memory/2024-01-15.md

markdown
undefined
markdown
undefined

2024-01-15

2024-01-15

Session Notes

会话笔记

10:30 - Authentication Setup

10:30 - 认证设置

  • Implemented JWT auth flow
  • Added refresh token rotation
  • TODO: Add rate limiting
  • 实现了JWT认证流程
  • 添加了刷新令牌轮换机制
  • 待办:添加速率限制

14:00 - Bug Fix

14:00 - Bug修复

  • Fixed race condition in user creation
  • Root cause: missing transaction wrapper

---
  • 修复了用户创建流程中的竞态条件
  • 根本原因:缺少事务包装器

---

Tips

小贴士

  • Use descriptive queries, not single keywords
  • The search is semantic (understands meaning, not just exact words)
  • If unsure which file to use, ask the user
  • Always sync after saving new content
  • 使用描述性查询,而非单个关键词
  • 搜索为语义搜索(理解含义,而非仅匹配精确词汇)
  • 若不确定应使用哪个文件,询问用户
  • 保存新内容后务必同步