商业产业 Hacker News Claude 2026-09-25T16:04 正文 ok 1725 words

Jevmem:基于 Jev 的 Claude Code 自动化项目记忆系统

英文标题:🔶 Jevmem – automatic project memory for Claude Code, built on Jev

Jevmem 是一款专为 Claude Code 打造的自动化项目记忆工具,同时兼容 Cursor 和 Codex。它能在对话过程中自动将架构决策、技术约束、Bug 及待办事项写入本地的 `JEVMEM.md` 文件中,并支持记录更新与废弃标注,以便在后续会话中按需召回上下文。系统基于 TypeSafe AI 的 Jev 引擎实现概率决策与本地代码阈值过滤,中位决策延迟仅 300 毫秒、成本极低,并内置针对恶意 PR 和手写规则的防记忆投毒(Memory Poisoning)审查机制。该工具为解决 AI 编码智能体长期上下文丢失、跨会话配置漂移与多协作者记忆污染提供了轻量且兼顾安全性的工程实践方案。
打开原文相关 3 · 机会 0
media1.2 KB media1.2 KB media1.2 KB media2.2 KB media1.0 KB media65.6 KB

中文

适用于 Claude Code 的自动化项目记忆工具。同样支持 Cursor 和 Codex。

npm version license node CI M8ven Verified

视频/嵌入内容:jevmem 发布演示视频

  • 自动将 Claude Code 对话中的技术决策、约束条件、Bug 和待办事项保存到 JEVMEM.md 中。
  • 当你改变主意时,旧记录会被标记为已废弃(superseded),而不会被直接删除。
  • 在下一次会话中,相关的记录行会被自动注入到 Claude 的上下文中。
  • 在 Claude 看到其他人添加的内容之前,先对这些记录行进行安全检查。

markdown

  • [decision] Use Postgres 16 for the primary store; SQLite locks under load

  • [constraint] Node 20 is the floor; CI runs 20 and 22

  • [superseded] Use SQLite as the primary store → id:k3d9xq

    • 支持作为 Claude Code 插件安装,按项目自选启用:在你于仓库中运行 jevmem enable 之前,它不会执行任何操作。
    • 召回时的记忆投毒检查(Memory-Poisoning Check): 凡不是 jevmem 在你本机上写入的行(来自队友、Pull Request 或自己手动编辑的内容),在 Claude 看到之前都会由 Jev 进行检查。在我们包含 44 行规则的测试集中,它拦截了 22 个植入攻击行中的 20 个,且对 22 条合法规则保持 0 误报(SECURITY.md)。
    • Jev 故障期间进入队列缓冲: 请求会按顺序在后台排队并在后续重试,而不是直接丢弃。
    • 支持 jevmem import: 可用于导入现有的 CLAUDE.md、AGENTS.md 或 Cursor 规则。

你需要一个用于 Jev 的 TypeSafe AI API Key(OpenAI 或 Anthropic Key 为选填项)。

方式 1:Claude Code 插件(推荐)

bash npm install -g jevmem claude plugin marketplace add Avinash-jetwani/jevmem claude plugin install jevmem@jevmem cd your-project && jevmem enable

该插件通过 npm 运行 jevmem 命令行工具,因此请先安装 CLI:若缺少 CLI,钩子(hooks)将无法触发,且 MCP 服务器将启动失败(/mcp 中会显示为失败状态)。当你启用插件时,Claude Code 会要求输入你的密钥,并将其保存在系统的安全凭证库中。插件在你在项目中运行 jevmem enable 之前不会做任何操作;关于它运行的具体内容以及如何关闭,详见:docs/hooks.md。

方式 2:npm(同时配置 Cursor 和 Codex)

bash npm install -g jevmem cd your-project jevmem init --tool claude

init 会创建 JEVMEM.md、jevmem.config.json 和 .jevmem/,并注册两个 Claude Code 钩子(详情)。由于钩子无法稳定读取你的 shell 配置文件,请将密钥写入 ~/.jevmem/env(TYPESAFE_API_KEY=...)。

已经有现成的 CLAUDE.md? jevmem import 会将 CLAUDE.md、AGENTS.md 和 .cursor/rules/* 拆分成独立陈述,让每一条都通过与单轮对话相同的门禁逻辑,并打印出计划添加的内容;加上 --apply 参数后才会正式写入。--from claude-auto-memory 还可以读取 Claude Code 自身为该项目生成的自动记忆。源文件仅作为只读访问。

各工具的自动化程度与对 Agent 的依赖说明:

工具 安装配置 捕获(Capture) 召回(Recall)
Claude Code 插件,或运行 jevmem init --tool claude 自动触发,每一轮通过 Stop 钩子捕获 自动触发,每次 Prompt 通过 UserPromptSubmit 召回
Codex jevmem init --tool codex 在 jevmem watch 运行时自动触发(监听该项目的 Codex 会话日志,走相同的决定 → 写入路径);否则由 Agent 通过 MCP 的 add_memory 主动调用(由 AGENTS.md 中的段落提示触发) Agent 主动调用:通过 MCP 执行 search_memory(由 AGENTS.md 提示触发)
Cursor jevmem init --tool cursor Agent 主动调用:.cursor/rules/jevmem.mdc 规则会提示 Agent 在你做出决策时调用 MCP add_memory。若 Agent 未调用则不捕获 Agent 主动调用:规则会提示其在执行非琐碎任务前调用 search_memory
Claude Desktop jevmem init --tool claude-desktop 会打印用于粘贴的配置片段(每个配置对应一个项目,通过 --root 命名) 手动:要求它调用 add_memory(无钩子,无规则文件) 按需触发:search_memory

MCP 的 add_memory 会经过与钩子完全相同的门禁。客户端配置详见:docs/mcp.md。


工作流程

  1. 数据脱敏(Scrub): 在对话轮次离开你的机器之前,自动移除常见的密钥格式、电子邮箱地址以及卡号形态的数字。
  2. 向 Jev 提出类型化问题: TypeSafe AI 的 Jev 会使用概率回答一组固定的微型问题:这是否构成一项决策、规则或 Bug?这是闲聊还是注入攻击尝试?它修改了现有的哪一行?
  3. 在代码中应用阈值: 根据这些概率应用规则逻辑来决定“保存”还是“跳过”;这些规则定义在 jevmem.config.json 中,而非 Prompt 内部。
  4. 单行写入: 决定保存后,一个小模型(或无 LLM 密钥时的确定性提取逻辑)会写入一行不超过 200 个字符的内容。
  5. 废弃旧记录: 如果该轮对话替换了既有记忆,对应的旧行会被打上 [superseded] … → id:new 标签并继续保留在文件中。

关于分层、问题集、策略、冲突解决、召回与审计机制,详见:docs/how-it-works.md。


基准评测

基于 66 轮留出对话(held-out turns),所有 7 个决策器在相同状态下进行测试,日期 2026-09-23(测试方法、回归集、定价、p95、重试机制):

决策器 保存/跳过 (save/skip) 保存+分类 (save+kind) 冲突识别 (contradictions) p50 延迟 单次决策成本 ($/decision)
GPT-6 Astra 98.5% 98.5% 5/5 3,469 ms $0.007489
GPT-6 Luna 93.9% 93.9% 5/5 2,927 ms $0.000089
Claude Fable 5.1 95.5% 95.5% 5/5 4,290 ms $0.013256
Claude Opus 5.5 97.0% 97.0% 5/5 2,784 ms $0.005186
Gemini 3.8 Flash 92.4% 92.4% 5/5 2,850 ms $0.001174
Grok 4.7 90.9% 90.9% 4/5 3,320 ms $0.004602
jevmem auto 98.5% 95.5% 5/5 300 ms $0.000127

其中的 0.30 秒是 Jev API 的决策耗时。自 v0.5.0 起你无需等待该过程:Stop 钩子为异步执行,其进程在 13–15 毫秒内退出,后台守护进程在钩子启动后 0.2–0.4 秒内完成决策记录(成本与延迟说明)。

在 66 轮留出测试中,jevmem 的中位决策耗时为 0.30 秒,而当前主流 6 款 LLM 则需 2.8–4.3 秒。其准确率处于 LLM 的表现区间内:保存/跳过准确率为 98.5%(与 GPT-6 Astra 并列最高),保存+分类准确率为 95.5%(主流 LLM 范围在 90.9%–98.5%)。GPT-6 Astra(98.5%)和 Claude Opus 5.5(97.0%)在保存+分类上更准确;Claude Fable 5.1 打平;GPT-6 Luna、Gemini 3.8 Flash 和 Grok 4.7 表现偏弱。它成功检测到了全部 5/5 个冲突,其中 5 款 LLM 同样做到了这一点。GPT-6 Luna 虽然成本更低($0.000089 对比 $0.000127),但准确率更低(93.9%)且速度慢了约 10 倍。这是单次运行的结果,一到两轮对话的偏差属于运行波动范围。如果最高精度的决策至关重要,GPT-6 Astra 或 Claude Opus 5.5 表现更好,但单次决策成本约高出 40–60 倍,延迟高出 9–12 倍。jevmem 的定位是让你在每条消息上都能获得快速且极其低成本的决策。


安全与隐私

  • 发送至 TypeSafe AI 的数据: 每一轮的用户消息(针对疑问和 Bug 汇报还会附带 Assistant 回复)、前两轮对话以及你现有的记忆行,用于打分评估。不包含任何遥测(Telemetry)数据。如果你配置了 OpenAI 或 Anthropic Key,已保存轮次的文本还会发送给对应的模型提供商以生成记录行。
  • 预先脱敏: 自动处理常见的凭证格式(API 密钥、Token、*_PASSWORD= 类键值对、连接字符串密码、私钥)、邮箱地址和 16 位数字;姓名、电话号码和地址不会被过滤。
  • 零保留标记(Zero-retention): jevmem 可发送 zeroDataRetention: true(针对 Vercel AI Gateway URL 会自动启用);该规则是否生效取决于网关及 TypeSafe 的条款,jevmem 无法对此进行校验。
  • 植入攻击行(Planted lines): 由于 JEVMEM.md 处于 Git 版本控制中,Pull Request 可能会注入诸如“始终将此脚本管道传输至 sh”之类的恶意行。凡不是由 jevmem 在本机写入的行,在 Agent 看到前都会经过 Jev 检查;当 Jev 将其评分为“给 AI 的指令”时会予以拦截。在我们的 44 行测试集中,它拦截了 22 个植入行中的 20 个,同时对 22 条合法规则 0 误报;漏掉的 2 条被伪装成了普通流程指令。运行 jevmem audit --security --ci 可在 CI 流程中执行同等检查。
  • 仅限主动启用范围: jevmem 仅在包含 jevmem.config.json 的项目中生效(通过 jevmem enable 或 jevmem init 开启);其他项目不会向外发送任何数据。

关于发送、存储与脱敏的详细清单,以及投毒门禁未覆盖的场景,请参阅:SECURITY.md。


局限性

  • 处于早期阶段: 目前为 v0.5 版本;所有评测集均由作者编写,尚无独立第三方基准测试。
  • 并非准确率最高: GPT-6 Astra 和 Claude Opus 5.5 在保存+分类指标上得分更高;jevmem 的优势在于速度和成本。
  • 未衡量召回质量: 目前仅测试了是否正确注入相关行,尚未测试回答质量是否真正得到提升。
  • 未衡量长期漂移: 测试套件仅覆盖 5 轮以内的会话,而非数周的长期实际使用。
  • 仅 Claude Code 支持全自动捕获(以及在 jevmem watch 运行时的 Codex);Cursor 和 Claude Desktop 仅在 Agent 主动调用 add_memory 时才会保存。
  • 投毒门禁属于过滤器,而非绝对保证: 在评测中漏掉了 22 个植入行中的 2 个(两者均表述为常规开发流程);当 Agent 直接将 JEVMEM.md 作为文件打开读取时此门禁不生效;在全新克隆的仓库中,首次检查每行需要消耗一个 noul。请像审查代码一样审查 JEVMEM.md 的 diff(SECURITY.md)。
  • Jev 服务中断会导致轮次延迟,但设有上限: 每次 Jev 调用的超时预算为 2 秒。当超时或 Jev 返回 5xx/529/429 错误时,脱敏后的对话轮次会暂存在 .jevmem/queue.jsonl 中,并在下一次钩子运行或后台空闲守护进程激活时按退避策略(15 秒起步,翻倍递增直至每 10 分钟重试一次)按序重试并保存一次。若超过 24 小时仍未保存,或排队轮次超过 200 条,该记录会被丢弃并输出日志行;jevmem stats 会统计所有此类情况。

命令参考

bash jevmem init [--tool claude|cursor|codex|claude-desktop|all] [--no-hooks] [--command ""] jevmem init --remove-hooks # 从当前项目中移除 jevmem 的 Claude Code 钩子(针对插件用户) jevmem hook # 钩子入口点;从 stdin 读取 Claude Code 钩子 JSON 数据 jevmem daemon [status|start|stop] # 钩子使用的预热 Jev 客户端(自动启动,闲置时退出) jevmem watch [--replay] [--once] # 从当前项目的 Codex 会话日志中捕获轮次 jevmem mcp [--root ] # Stdio MCP 服务器 jevmem audit [--dry-run] # 对照仓库重新评估所有记忆行,标记 [stale?] jevmem audit --security [--ci] # 列出疑似为给 AI 发出指令的记录行(--ci:若存在则 exit 1) jevmem search [--limit N] # 按相关性排序检索记忆 jevmem list [--all] # 打印记忆(--all:包含已废弃的行及来源追溯) jevmem add # 手动添加一行(敏感信息自动脱敏;不经过 Jev 检查) jevmem import [--from ] [--apply] # 导入 CLAUDE.md、AGENTS.md、.cursor/rules/*(可按需包含 claude-auto-memory);默认 dry run 试运行 jevmem why <id|hash> # 查看单行记录或被跳过轮次背后的所有 Jev 回答 jevmem right <id|hash> # 将某个决策标记为正确 jevmem wrong <id|hash> [--should-be <kind|none>] # 将某个决策标记为错误 jevmem missed "" [--kind ] # 标记本应保存的遗漏轮次 jevmem fit [--dry-run] [--force] # 根据标注重新拟合权重和阈值(需 40 条以上数据) jevmem stats # 统计 p50/p95 延迟、每日成本、缓存命中率、上报率、标注情况与最近一次拟合 jevmem log # 汇总 .jevmem/log.jsonl 中每个标签的延迟、Token 与成本摘要

每个命令均支持 --help。设置 JEVMEM_VERBOSE=1 可在每次钩子运行后输出单行延迟/成本摘要。

English / 原文

Automatic project memory for Claude Code. Also works with Cursor and Codex.

npm version license node CI M8ven Verified

jevmem-launch-readme-v2.mp4

  • Saves decisions, constraints, bugs and todos from your Claude Code chats into JEVMEM.md, automatically.

  • When you change your mind, the old line is marked superseded, not deleted.

  • Next session, the relevant lines are added to Claude's context.

  • Checks lines added by others before Claude sees them.

    • [decision] Use Postgres 16 for the primary store; SQLite locks under load
    • [constraint] Node 20 is the floor; CI runs 20 and 22
    • [superseded] Use SQLite as the primary store → id:k3d9xq
  • Install as a Claude Code plugin , opt-in per project: it does nothing until you run jevmem enable in a repo.

  • A memory-poisoning check on recall: lines that jevmem did not write on your machine (a teammate's, a pull request's, your own hand edits) are checked by Jev before Claude sees them. In our 44-line test set it blocked 20 of 22 planted lines, with 0 of 22 false blocks on legitimate rules (SECURITY.md).

  • Turns queued during Jev outages and retried later, in order, instead of being dropped.

  • jevmem import for an existing CLAUDE.md, AGENTS.md or Cursor rules.

You need a TypeSafe AI key for Jev (an OpenAI or Anthropic key is optional).

Option 1: Claude Code plugin (recommended)

npm install -g jevmem
claude plugin marketplace add Avinash-jetwani/jevmem
claude plugin install jevmem@jevmem
cd your-project && jevmem enable

The plugin runs the jevmem CLI from npm, so install that first: without it the hooks stay silent and the MCP server fails to start (/mcp shows it as failed). Claude Code asks for your key when you enable the plugin and keeps it in your system's secure credential store. The plugin does nothing until you run jevmem enable in a project; what it runs, and how to switch it off: docs/hooks.md.

Option 2: npm (also sets up Cursor and Codex)

npm install -g jevmem
cd your-project
jevmem init --tool claude

init creates JEVMEM.md, jevmem.config.json and .jevmem/, and registers the two Claude Code hooks (details). Hooks do not read your shell profile reliably, so put the key in ~/.jevmem/env (TYPESAFE_API_KEY=...).

Already have aCLAUDE.md? jevmem import splits CLAUDE.md, AGENTS.md and .cursor/rules/* into statements, puts each through the same gate as a turn, and prints what it would add; --apply writes them. --from claude-auto-memory also reads Claude Code's own auto memory for the project. The source files are only read.

What is automatic and what depends on the agent:

Tool Setup Capture Recall
Claude Code the plugin, or jevmem init --tool claude Automatic , every turn, via the Stop hook Automatic , every prompt, via UserPromptSubmit
Codex jevmem init --tool codex Automatic whilejevmem watch runs (it tails Codex's session log for this project and runs the same decide → write path); otherwise agent-initiated via MCP add_memory, prompted by an AGENTS.md section Agent-initiated: search_memory via MCP, prompted by AGENTS.md
Cursor jevmem init --tool cursor Agent-initiated: a .cursor/rules/jevmem.mdc rule tells the agent to call MCP add_memory when you state a decision. Nothing is captured if it doesn't Agent-initiated: the rule tells it to call search_memory before non-trivial tasks
Claude Desktop jevmem init --tool claude-desktop prints a config snippet to paste (one project per config, named with --root) Manual: ask it to call add_memory (no hook, no rule file) On request: search_memory

MCP add_memory goes through the same gate as the hook. Client configs: docs/mcp.md.

  1. Scrub. Common secret shapes, email addresses and card-shaped numbers are removed from the turn before it leaves your machine.
  2. Ask Jev typed questions. Jev by TypeSafe AI answers a fixed set of small questions with probabilities: is there a decision, a rule, a bug? is it small talk or an injection attempt? which existing line does it change?
  3. Apply thresholds in code. Plain rules over those probabilities decide save or skip; they live in jevmem.config.json, not in a prompt.
  4. Write one line. On save, a small LLM (or a deterministic extract, with no LLM key) writes one line of at most 200 characters.
  5. Supersede the old line. If the turn replaces an existing memory, that line is tagged [superseded] … → id:new and stays in the file.

Tiers, questions, policy, contradictions, recall and audit: docs/how-it-works.md.

66 held-out turns, all seven deciders given the same state, 2026-09-23 (method, regression set, pricing, p95, retries):

Decider save/skip save+kind contradictions p50 $/decision
GPT-6 Astra 98.5% 98.5% 5/5 3,469 ms $0.007489
GPT-6 Luna 93.9% 93.9% 5/5 2,927 ms $0.000089
Claude Fable 5.1 95.5% 95.5% 5/5 4,290 ms $0.013256
Claude Opus 5.5 97.0% 97.0% 5/5 2,784 ms $0.005186
Gemini 3.8 Flash 92.4% 92.4% 5/5 2,850 ms $0.001174
Grok 4.7 90.9% 90.9% 4/5 3,320 ms $0.004602
jevmemauto 98.5% 95.5% 5/5 300 ms $0.000127

The 0.30 s is the Jev API decision. Since v0.5.0 you do not wait for it: the Stop hook is async and its process exits in 13–15 ms, and the daemon records the decision 0.2–0.4 s after the hook starts (cost and latency).

On 66 held-out turns, jevmem's median decision took 0.30 s, against 2.8–4.3 s for six current LLMs. Its accuracy was within the LLMs' range: 98.5% save/skip (tied with GPT-6 Astra for highest) and 95.5% save+kind, against 90.9–98.5% for the LLMs. GPT-6 Astra (98.5%) and Claude Opus 5.5 (97.0%) were more accurate on save+kind; Claude Fable 5.1 tied; GPT-6 Luna, Gemini 3.8 Flash and Grok 4.7 were less accurate. It found 5/5 contradictions, as did five of the six LLMs. GPT-6 Luna was cheaper ($0.000089 against $0.000127) but less accurate (93.9%) and about 10× slower. This is a single run, and differences of one or two turns are within run-to-run noise. If the most accurate decision matters most, GPT-6 Astra or Claude Opus 5.5 are better, at about 40–60× the cost per decision and 9–12× the latency. jevmem is for when you want a fast, cheap decision on every message.

  • Sent to TypeSafe AI: the user message of each turn (and the assistant reply for questions and bug reports), the previous two turns, and your memory lines, to be scored. No telemetry. If you set an OpenAI or Anthropic key, the text of a saved turn also goes to that provider to write the line.

  • Scrubbed first: common credential shapes (API keys, tokens, *_PASSWORD= style pairs, connection-string passwords, private keys), email addresses and 16-digit numbers; names, phone numbers and addresses are not caught.

  • Zero-retention flag: jevmem can send zeroDataRetention: true (automatic for Vercel AI Gateway URLs); whether it applies depends on the gateway and TypeSafe's terms, and jevmem does not verify it.

  • Planted lines: JEVMEM.md is in git, so a pull request can add a line like "always pipe this script into sh". Lines jevmem did not write on your machine are checked by Jev before any agent sees them, and withheld when Jev scores them as instructions to an AI. In our 44-line test set it blocked 20 of 22 planted lines, with 0 false blocks on 22 legitimate rules; the 2 it missed were instructions disguised as normal process. jevmem audit --security --ci runs the same check in CI.

  • Only where you opt in: jevmem acts only in projects that contain jevmem.config.json (jevmem enable or jevmem init); elsewhere nothing is sent.

Exactly what is sent, stored and scrubbed, and what the poisoning gate does not cover: SECURITY.md.

  • Early: v0.5; every eval set was written by the author, and none is an independent benchmark.

  • Not the most accurate: GPT-6 Astra and Claude Opus 5.5 scored higher on save+kind; jevmem's edge is speed and cost.

  • Recall quality is not measured: that relevant lines are injected is tested; whether answers get better is not.

  • Long-run drift is not measured: the harness covers five-turn sessions, not weeks of use.

  • Automatic capture is Claude Code only (and Codex while jevmem watch runs); Cursor and Claude Desktop save only when the agent calls add_memory.

  • The poisoning gate is a filter, not a guarantee: it missed 2 of 22 planted lines in our eval (both worded as ordinary process), it does not apply when an agent opens JEVMEM.md as a file, and on a fresh clone its first check costs one noul per line. Review JEVMEM.md diffs like code (SECURITY.md).

  • Jev outages delay turns, up to a limit: each Jev call has a 2 s budget. When it times out or Jev answers 5xx/529/429, the scrubbed turn waits in .jevmem/queue.jsonl and is retried with backoff (15 s, doubling to every 10 min) on the next hook run or by the idle daemon, in order, and saved once. A turn still unsaved after 24 hours, or past 200 queued turns, is dropped with a log line; jevmem stats counts all of these.

    jevmem init [--tool claude|cursor|codex|claude-desktop|all] [--no-hooks] [--command ""] jevmem init --remove-hooks Remove jevmem's Claude Code hooks from this project (plugin users) jevmem hook Hook entrypoint; reads the Claude Code hook JSON on stdin jevmem daemon [status|start|stop] Warm Jev client used by the hook (auto-started, exits when idle) jevmem watch [--replay] [--once] Capture turns from Codex's session log for this project jevmem mcp [--root ] Stdio MCP server jevmem audit [--dry-run] Re-score every memory against the repo, flag [stale?] jevmem audit --security [--ci] List lines that read as instructions to an AI (--ci: exit 1 if any) jevmem search [--limit N] Rank memories by relevance jevmem list [--all] Print memories (--all: with superseded lines and provenance) jevmem add Add a line by hand (secrets scrubbed; no Jev check) jevmem import [--from ] [--apply] Import CLAUDE.md, AGENTS.md, .cursor/rules/* (claude-auto-memory on request); dry run by default jevmem why <id|hash> Every Jev answer behind a line or a skipped turn jevmem right <id|hash> Label a decision as correct jevmem wrong <id|hash> [--should-be <kind|none>] Label a decision as wrong jevmem missed "" [--kind ] Label a turn that should have been saved jevmem fit [--dry-run] [--force] Refit weights and thresholds from labels (needs 40+) jevmem stats Latency p50/p95, cost per day, cache hit rate, escalation rate, labels, last fit jevmem log Per-label latency, token and cost summary of .jevmem/log.jsonl

Every command accepts --help. Set JEVMEM_VERBOSE=1 for a one-line latency/cost summary after every hook run.