Pensieve Docs
Docs menu

Docs

Benchmark

This page tells you how we measured Pensieve against grep, what the results are, and what we did not measure.

−47%tool calls per lookup: 1.81 against 3.42
−23%cost per lookup: $0.039 against $0.051
−29%time per lookup: 6.8 s against 9.5 s
90%tasks solved, the same as with grep (129 / 144)

These four numbers are from the latest batch (2026-10-13), with clean Claude Code settings. Pensieve solves as many tasks as grep, with about half the tool calls. An earlier batch, with Pensieve 0.5.6, solved 91% against 85% with grep. The two later clean batches did not repeat this gain. Both results are below.

Method

The script is bench/agent_search.py. It does these steps:

  1. It makes tasks from indexed code. Each task describes one piece of code. The answer is the file that holds it.
  2. It writes each task in one of these styles: a plain description, a name that the code defines, an error string from the code, or a mix of a name and words.
  3. It splits the tasks into a dev set, which we used to tune Pensieve, and a test set, which we did not use to tune.
  4. It runs Claude Sonnet headless through Claude Code (claude -p) on each test task, once in each setup.
  5. It records whether the answer names the right file, the tool calls, the tokens, the time, and the cost that Claude Code reports.
SetupTools that the agent has
grepRead, Grep and Glob
guidedRead, Grep and Glob, plus Pensieve's search, read and similar, plus the “search before you grep” instructions block. This is the recommended install.
onlyPensieve's tools and Read, with no Grep or Glob. Only in the later batches.
ItemValue
ModelClaude Sonnet, in Claude Code
Tasks72 held-out (test) tasks
Repos4 repos, from 504 to 34,847 files
RunsEach task twice in each setup: 144 runs per setup
OrderAll setups of a batch run interleaved, in one batch

Cost depends on the state of Claude's prompt cache. The same tokens can cost 4 times more with a cold cache. Thus we compare cost only between setups in one batch. Calls, tokens and time can be compared between batches.

Results: first batch (Pensieve 0.5.6)

grepguided (Pensieve)Change
Tasks solved123 / 144 (85%)131 / 144 (91%)+6 points
Tool calls per lookup3.441.97−43%
Cost per lookup$0.050$0.041−18%
Tokens per lookup67k57k−16%
Time per lookup (mean)10.9 s8.6 s−21%

In 82 of the 144 guided runs, the agent answered with one tool call or none. Pensieve solved as many tasks or more, and cost less, in every repo:

RepoSolved, grepSolved, guidedCost changeCalls, grepCalls, guided
504 files24 / 2624 / 26−15%2.851.65
Medium repo 134 / 4036 / 40−6%2.651.77
Medium repo 220 / 2624 / 26−14%2.541.46
34,847 files45 / 5247 / 52−28%4.812.54

The two medium repos have 1,783 and 2,383 files.

Results: later batches with clean settings

The first batch loaded the Claude Code settings of the computer that ran it. Later, the script loads only the settings of the repo (--setting-sources project,local). These are the last of those batches, run on 2026-10-13 with the same 72 tasks:

SetupSolvedTool callsCost per lookupTime (mean)
grep129 / 1443.42$0.0519.5 s
guided129 / 1441.81$0.0396.8 s
only130 / 1441.70$0.0386.5 s

Search alone, with no agent

A second set measures one search, with no agent. It has 2,377 queries in the same four repos. Each query has one right file. “@1” is the share of queries where the right file is first. The grep row is one case-insensitive grep, with files ranked by the number of matches.

Query kindQueriesPensieve 0.6.4 @1grep @1
Question in plain words33447.9%0%
Name plus words33370.9%0%
Name21994.1%51.3%
Exact string71484.6%85.2%
String that 2 or more files contain40437.1%39.7%
Message as it shows in a log37356.3%0%
All2,37765.9%37.1%

In the top 8 results, which is what the search tool shows, Pensieve has the right file for 91.6% of queries. Grep has it for 53.1%. On the held-out queries only, @1 is 66.7% against 35.2%. A search took 73 ms at the median, on an Apple M4 Max. Grep is level with Pensieve on exact strings. STRATEGIES.md lists every ranking method that we tried, with its numbers.

Repo overviews

We asked “Give me a high-level overview of this repository” in five repos, three times each. A second Claude run checked each claim against the code. Only confirmed errors count.

SetupWrong claims (15 answers)Tool callsCostTime (median)
grep, repo with no CLAUDE.md104.1$0.05613.0 s
Repo overview tool, repo with no CLAUDE.md41.4$0.03412.0 s
grep, repo with its CLAUDE.md31.5$0.03510.0 s
Repo overview tool, repo with its CLAUDE.md21.2$0.04411.9 s

If a repo has good notes for the agent, grep needs no help. The overview tool helps most when a repo has no notes. The test used the overview tool. Today, repo gives the same overview.

Shared threads

This test asks whether a shared thread helps a teammate's agent. The agent worked in a fresh clone, with no access to the owner's computer. It answered questions about 4 real pieces of work, 3 times each. A judge counted the facts from a list that the answer got right, and the wrong claims.

SetupFacts rightWrong claims
No shared thread6 / 60 (11%)10
With the shared thread52 / 60 (85%)0

The script is bench/workflows.py. This test is small: 4 pieces of work and 12 runs in each setup.

What we did not measure

Data and scripts

The scripts are in bench/. The run files hold paths and code from the four repos, so they are not public. To get your own numbers, run the benchmark on your repos:

uv run python bench/agent_search.py gen --repo ~/code/my-app -n 40 --tasks tasks-v2.jsonl
uv run python bench/exact_tasks.py      # adds name, error-string and mixed tasks
uv run python bench/agent_search.py run --repo ~/code/my-app --tasks tasks-v2.jsonl --arms grep,guided

Use a copy of an index (PENSIEVE_DATA), not ~/.pensieve. Run a server on the copy for the agent runs.

Something wrong or missing? Tell us on GitHub.