jev-mem



Why this exists
Agents redo work that was already done. The fix is to bring back the earlier session's
notes, but bringing them back is where the cost hides:
- Too many tokens. In the author's setup, claude-mem loaded about 30K tokens of past
context every time a session opened.
- Context window gone before you start. On a 200K-context model that is 15-30% of the
window used before the first prompt. A 1M window softens this, but the same load repeats
in every session.
- Fast but not accurate. claude-mem finds records without AI (vector match only). That
is fast, but it cannot tell a related record from one that shares a few words, so most
of those tokens go to records the task does not need. This was the biggest problem.
- Settings are not enough. claude-mem can lower the limits, but a fixed number cannot
decide which record matters for this prompt.
jev-mem keeps the fast search as a first pass and lets JEV, an AI judge, decide which record
is actually relevant. One good record goes in; when none fit, nothing goes in. It works the
same way in Claude Code, Codex, and Antigravity.
Inject only the claude-mem records that
JEV judges relevant to the prompt you just typed.
claude-mem's built-in prompt-time injection (CLAUDE_MEM_SEMANTIC_INJECT) adds the top
vector matches every time, with no relevance floor. A prompt that starts new work still gets
five records that only share a few words with it. This plugin keeps claude-mem's vector
search as the first pass and adds JEV as the judge:
- On
UserPromptSubmit, ask the local claude-mem worker for the top 5 vector matches.
- Send the prompt and the 5 records to JEV in one request: one yes/no question per record.
- Inject the record with the highest yes-probability, only if it reaches the threshold.
If no record reaches it, inject nothing.
Measured on one machine (2026-10-18, claude-mem 14.0.1): about 0.5 s per prompt.
| Prompt | claude-mem built-in | jev-mem |
|---|
| Asks about an earlier claude-mem settings change | 5 records | 1 record (JEV 0.85) |
| Starts an unrelated blog post | 5 unrelated records | nothing (max JEV 0.05) |
| Asks to translate a screenshot | 5 unrelated records | nothing (max JEV 0.28) |
Three prompts are an example, not a benchmark. JEV judges relevance, not truth: an
outdated record on the right topic can still be selected.
Measuring AI-era work
AI-era work has two metrics:
- Lead time: the time from signal to production.
- Human intervention: how many prompts a person actually typed to get there.
jev-mem already reads every session to choose memory records, so it is also the right place to collect these statistics.
jev-mem human-count counts the prompts a person typed in every session related to a topic. It covers Claude, Codex and Antigravity.
- Coverage: it includes prompts queued while a turn was still running.
- Exclusions: it ignores hook text, system reminders and tool results.
- Relevance: a keyword filter picks the related sessions. With
--jev, JEV then decides, session by session, whether each candidate belongs to the topic.
- Privacy: everything stays on your machine unless you pass
--jev. Prompt text is not printed unless you pass --show. Reports written with --out are readable only by you.
jev-mem human-count --topic "<project>" --since 2026-10-18T00:00:00Z \
--keywords "<alias>,<alias>" --jev --json --out human-interventions.json
Run it on demand, for example from a dashboard's refresh button. Do not run it on a timer.
Lead-time measurement is not built yet.
Runtimes
Not only Claude. The same core runs behind a small adapter per runtime, so you keep using
the CLI you already use and the hook runs on its own.
| Runtime | Hook file | Hook event | Command |
|---|
| Claude Code | ~/.claude/settings.json | UserPromptSubmit | node <repo>/scripts/hook.mjs --runtime claude |
| Codex CLI | ~/.codex/hooks.json | UserPromptSubmit | node <repo>/scripts/hook.mjs --runtime codex |
Antigravity CLI (agy), experimental | ~/.gemini/config/hooks.json | PreInvocation | node <repo>/scripts/hook.mjs --runtime agy |
Hook snippets (use the absolute path of your clone):
// Claude Code: ~/.claude/settings.json (merge into an existing "hooks" key)
{ "hooks": { "UserPromptSubmit": [ { "hooks": [
{ "type": "command", "command": "node /abs/path/jev-mem/scripts/hook.mjs --runtime claude", "timeout": 10 }
] } ] } }