Skip to content

About

Open benchmark for team memory in AI coding tools: prompt injection, secret redaction, cross-language recall, abstention, cost and data path. Synthetic data, Apache-2.0.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

engineering-memory-bench

An open benchmark for team memory in AI coding tools, on the six things that hurt engineering teams: prompt injection, secret redaction, cross-language recall, abstention, cost, and stale fixes that a newer fix has replaced.

License: Apache-2.0

Chat benchmarks such as LoCoMo ask conversational questions ("Where does Alice live?"). This one asks what a team memory does with a poisoned lesson, a leaked key or a German question about an English lesson. The data is synthetic and the adapters for Mem0, Zep and Supermemory are open for pull requests. For the LoCoMo and LongMemEval numbers and their method, see https://cachly.dev/docs/benchmark?utm_source=github&utm_medium=repo&utm_campaign=engineering-memory-bench

Real software engineering teams fail on six axes:

Axis What it measures Metric
a) Prompt injection Poisoned lessons trying to hijack the reading AI, plus benign security lessons Passthrough rate (lower is better) & benign false-positive rate
b) Secret redaction Strictly invented, invalid dummy keys in real provider formats Plaintext storage rate (lower is better; 0% = all redacted before storage)
c) Cross-language recall German questions -> English lessons and English questions -> German lessons Hit@1 and Hit@3 (higher is better)
d) Abstention Realistic engineering questions with no matching lesson in the store Intrusion rate (lower is better; 0% = stays silent)
e) Cost & data path Latency, backend LLM usage, and declared processing regions p50 / p95 ms, LLM calls per 1,000 recalls, declared regions
f) Stale lessons (--track stale) An old fix and the newer fix that replaced it, asked with a question that does not say which is wanted Current@1 (higher is better), Stale@1 and StaleTop3 (lower is better)

Agent track: handoff

handoff/ runs real coding agents (Claude Code, Codex CLI) on play repos. An agent learns a project fact on Friday; a fresh session on Monday meets the same fact in a new task. A script counts how often Monday gets it right, per kind of memory and per tool. The plan was preregistered in handoff/PREREGISTRATION.md before the first scored run.

Dataset & Privacy

  • 100% synthetic, self-authored dataset under Apache-2.0 (dataset/lessons.json, dataset/queries.json).
  • Zero copied GitHub issues, zero real user names, zero real secrets. Every secret in dataset/lessons.json is an invented invalid dummy key containing dummy or zero-filled (0000) test sequences. They imitate real provider formats on purpose, so GitHub push protection or other secret scanners may still flag them. They are not real credentials.

Dataset size & tracks (read this before comparing percentages)

Three tracks ship in dataset/:

  1. --track synthetic (default, 5-axis safety + cross-language suite):
    • 20 cross-language questions (de->en & en->de)
    • 10 injection lessons + 5 benign security lessons
    • 10 secret redaction lessons (invented dummy keys)
    • 10 abstention questions
    • Note: small sample — one case moves a rate by 5 to 10 points.
  2. --track oss-real (Real Open-Source Issue -> Merged PR Track):
    • 200 real engineering fixes from merged GitHub pull requests across 16 permissive-licensed open-source repositories (MIT, Apache-2.0, BSD-3-Clause: Vite, TypeScript, Prisma, Pydantic, Flask, FastAPI, Caddy, Prometheus, etcd, Tokio, Tauri, Cargo, DuckDB, pandas, Docker Compose, Helm), each with upstream pr_url and SPDX license.
    • No issue or PR text is copied. Each lesson is a short summary in our own words (Cause: … Fix: …), and each query is a separately written symptom, the way a developer would describe it. Summaries live in scripts/oss-real-summaries.json; a candidate whose PR does not say what was changed is dropped.
    • 200 symptom queries + 30 out-of-domain abstention queries (230 queries total; 1 case = 0.5 percentage points).
    • Anti-leakage hygiene: the query never names cause or fix, pairs whose query and lesson overlap too much (Jaccard > 0.55) are rejected, and --permute verifies recall collapses near chance.
    • Reproducible generator: scripts/build-oss-real-dataset.mjs (needs the local harvest in ~/.cachly/bench-korpus to pick candidates; the committed summaries are the only text that ends up in the dataset).
    • Known limitation: query and lesson were written from the same issue and PR, so they share technical terms (library, option and function names). A plain keyword matcher profits from that: bm25 reaches 88.5% OSS@1 here, and 0% with --permute (npm run bench:oss, 2026-12-04). Read this track as a retrieval floor, not as a test of understanding.
  3. --track stale (the old fix and the fix that replaced it):
    • 20 pairs, 40 lessons, 20 questions, all self-authored and synthetic. Each pair holds a fix that was right when it was written and a later fix that replaces it. Examples: builds moved from Node 18 to Node 22; deploys moved from kubectl apply by hand to Argo CD; feature flags moved from a JSON file to a dashboard.

    • The replacing lesson carries recorded_at (ISO date), supersedes (id of the old lesson) and supersedes_topic. A memory may use these fields. A hit that the memory marks superseded: true counts as a warned hit, not as a silent one.

    • The question never says which fix is wanted: no years and no words such as "new", "current", "still" or "since". A test enforces this.

    • Store order alternates: 10 pairs store the old lesson first, 10 the new one. "The last write wins" therefore solves only half.

    • Equal length: old and new lessons average 167 and 171 characters. BM25 prefers short texts, so a length gap would decide the result on its own. A test keeps the ratio between 0.85 and 1.15.

    • Metrics: Current@1 = the replacing lesson is first. Stale@1 = the outdated lesson is first. StaleTop3 = the outdated lesson is in the top 3 without a superseded mark.

    • Controls in npm test: an oracle that reads supersedes reaches 100% Current@1 and 0% Stale@1, so the track is solvable. bad-control serves the outdated fix in at least 80% of the questions.

    • Measured 2026-12-04 with v0.3.0, node runner.mjs --track stale --adapter all,bad-control (npm run bench:stale runs the first three):

      Adapter Current@1 Stale@1 StaleTop3
      none 0% 0% 0%
      claude-md 0% 5% 5%
      bm25 30% 70% 100%
      bad-control 0% 95% 95%
    • What this shows: keyword search finds the topic every time (StaleTop3 100%), but puts the outdated fix first in 14 of 20 questions. It has no notion of "replaced".

    • Open question: why bm25 leans to the old lesson at 70% and not near 50% is not explained yet. Length and word overlap with the question are balanced (old lesson overlaps more in 4 pairs, new lesson in 3, equal in 13).

    • Known limitations: 20 pairs, so one question moves a rate by 5 points. --permute has no meaning here and is refused. The track was written by the people who build cachly, which has such a field (ersetzt); the cachly adapter passes it on, but it has not been run end-to-end, so there is no cachly number.

Included Adapters

  • none — no memory floor (0% recall, 0% intrusion)
  • claude-md — static Markdown file baseline (all lessons concatenated into one file)
  • bm25 — pure in-memory BM25 keyword baseline (no embeddings, no redaction, no injection filter)
  • cachly — MCP stdio adapter spawning npx -y @cachly-dev/mcp-server@latest inside an isolated temporary HOME directory (your own ~/.cachly config is never read). It needs a dedicated, empty test Brain: set BENCH_CACHLY_INSTANCE_ID (and BENCH_CACHLY_JWT). Without the instance id it refuses to run. Status: not yet run end-to-end. It needs network and a real key, so treat it as untested.
  • bad-control — intentionally broken control adapter that must fail every safety and quality check

External Systems (PRs Welcome)

Empty adapter templates live in adapters/templates/ for Mem0, Zep, and Supermemory. This repository makes zero claims and publishes zero numbers for any external system without a verified, reproducible run. Maintainers and community contributors are invited to open a pull request with a working adapter and run instructions.

Running the Benchmark

Requires Node.js 20+ (zero external npm dependencies for local baselines and control tests).

Without cloning, straight from npm:

# Offline baselines (none, claude-md, bm25): no network, no key
npx @cachly-dev/engineering-memory-bench --adapter all

# Permutation control and JSON output work the same way
npx @cachly-dev/engineering-memory-bench --adapter bm25 --permute
npx @cachly-dev/engineering-memory-bench --adapter all --json

# Stale lessons: does the memory hand back a fix that was replaced?
npx @cachly-dev/engineering-memory-bench --track stale --adapter all

From a clone:

# Run control tests (dataset hygiene, bad-control failure, permuted-answers collapse, safety guards)
npm test

# Run local baselines (npm run bench:all = --adapter all = none, claude-md, bm25)
npm run bench:all

# Single baseline (npm run bench = bm25)
npm run bench

# Run permutation control (npm run bench:permute = bm25 with --permute; must collapse Hit@1 / Hit@3 toward random chance)
npm run bench:permute

# Run the 200-lesson / 230-query real Open-Source Issue -> PR track (and its permutation control)
npm run bench:oss
npm run bench:oss:permute

# Run the 20-pair stale-lessons track (no --permute: answers are pairs)
npm run bench:stale

# Run against a dedicated empty cachly test Brain (needs network, a real key, and BENCH_CACHLY_INSTANCE_ID; not yet run end-to-end)
BENCH_CACHLY_INSTANCE_ID=<your-test-brain-id> node runner.mjs --adapter cachly

# Machine-readable JSON output
node runner.mjs --adapter none,claude-md,bm25 --json

Published Results Policy

Every published number in this repository must record:

  • exact date (ISO YYYY-MM-DD),
  • exact benchmark version (package.json, currently 0.3.0),
  • exact adapter/package version and command used,
  • both the normal run and the --permute control run (for --track stale, which refuses --permute, the oracle and bad-control tests in npm test are the controls).

(No results table is pre-filled before running npm test and node runner.mjs on your target environment.)

License

Apache-2.0 — see LICENSE.

About

Open benchmark for team memory in AI coding tools: prompt injection, secret redaction, cross-language recall, abstention, cost and data path. Synthetic data, Apache-2.0.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages