nemp-memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nemp Memory — 为Claude Code打造的本地持久化内存

# Nemp Memory — Persistent Local Memory for Claude Code
You have access to a local memory system stored in
.nemp/
in the project root. Use it to persist context across sessions so users never have to repeat themselves.
## When to Use This Skill
- **Session start**: Always check for existing memories by reading
.nemp/memories.json
- **Architecture decisions**: Save decisions so future sessions know why
- **Stack detection**: On first use, auto-detect the project stack and save it
- **User preferences**: Save coding style, conventions, patterns the user prefers
- **Agent coordination**: When working with other agents, save context they'll need
## Memory Storage Format
Memories are stored in
.nemp/memories.json
as an array of objects with keys: key, value, tags, timestamp, source, agent_id.
## How to Save a Memory
Read
.nemp/memories.json
, add or update the entry, write back. Rules:
- Compress values: remove filler words, keep under 200 chars
- Use descriptive keys: auth-provider, database, styling-framework
- Tag appropriately: stack, architecture, convention, preference, api
- Track agent_id: use "main" for single agent or your agent name
- Upsert: if key exists, update it
## How to Recall Memories
Search
.nemp/memories.json
with keyword expansion:
- auth -> authentication, login, session, jwt, token, oauth
- database -> db, postgres, mysql, sqlite, mongo, prisma, drizzle
- styling -> css, tailwind, sass, scss, styled-components, shadcn
- testing -> test, jest, vitest, cypress, playwright, e2e
- deploy -> deployment, docker, vercel, netlify, aws, ci, cd
## Auto-Detection (First Session)
Scan package.json, requirements.txt, pyproject.toml, go.mod, Cargo.toml, tsconfig.json, docker-compose.yml, .env to auto-detect stack. Save each with source: "auto-detect" and agent_id: "nemp-init".
## Access Logging
Log every operation to
.nemp/access.log
with timestamp, operation, key, and agent.
## Critical Rules
1. ALL data stays local. Never make network calls.
2. Create
.nemp/
directory if it doesn't exist.
3. Always read before write to avoid overwriting other agents' memories.
4. Compress aggressively — keep values under 200 chars.
5. Log every operation to
.nemp/access.log
.
6. Regenerate
.nemp/MEMORY.md
after every write/delete.
你可以访问存储在项目根目录
.nemp/
中的本地内存系统。利用它在不同会话间持久化上下文,这样用户就无需重复说明信息。

何时使用该Skill

  • 会话启动:始终通过读取
    .nemp/memories.json
    检查是否存在已有记忆
  • 架构决策:保存决策内容,以便后续会话了解决策原因
  • 技术栈检测:首次使用时,自动检测项目技术栈并保存
  • 用户偏好:保存用户偏好的编码风格、规范和模式
  • Agent协作:与其他Agent协作时,保存它们需要的上下文信息

内存存储格式

记忆内容以对象数组的形式存储在
.nemp/memories.json
中,每个对象包含以下键:key、value、tags、timestamp、source、agent_id。

如何保存记忆

读取
.nemp/memories.json
,添加或更新条目后写回。规则如下:
  • 压缩内容:删除冗余词汇,确保内容不超过200字符
  • 使用描述性键名:如auth-provider、database、styling-framework
  • 合理添加标签:如stack、architecture、convention、preference、api
  • 跟踪agent_id:单个Agent使用"main",或使用你的Agent名称
  • 插入或更新:如果键已存在,则更新对应内容

如何调用记忆

通过关键词扩展搜索
.nemp/memories.json
  • auth -> authentication、login、session、jwt、token、oauth
  • database -> db、postgres、mysql、sqlite、mongo、prisma、drizzle
  • styling -> css、tailwind、sass、scss、styled-components、shadcn
  • testing -> test、jest、vitest、cypress、playwright、e2e
  • deploy -> deployment、docker、vercel、netlify、aws、ci、cd

自动检测(首次会话)

扫描package.json、requirements.txt、pyproject.toml、go.mod、Cargo.toml、tsconfig.json、docker-compose.yml、.env文件以自动检测技术栈。每个检测结果的source设为"auto-detect",agent_id设为"nemp-init"。

访问日志

将每次操作记录到
.nemp/access.log
中,包含时间戳、操作类型、键名和Agent信息。

核心规则

  1. 所有数据均保存在本地,绝不发起网络请求。
  2. 如果
    .nemp/
    目录不存在,自动创建。
  3. 写入前务必先读取,避免覆盖其他Agent的记忆。
  4. 严格压缩内容——确保内容不超过200字符。
  5. 每次操作都要记录到
    .nemp/access.log
  6. 每次写入/删除操作后,重新生成
    .nemp/MEMORY.md