The grep loop has a shape.
Pensieve 0.6.0 landed on October 11 with local search across files, repositories, and coding-agent sessions. Its MCP server scopes an agent to the current repository by default. It can search by exact words or meaning and return passages with file locations.[1]
The project reports a held-out benchmark with 72 code-finding tasks across four repositories. Each task ran twice. The Pensieve setup solved 131 of 144 runs, compared with 123 for grep, glob, and read. It used 1.97 tool calls per lookup instead of 3.44. The benchmark belongs to the project, used Claude Sonnet through Claude Code, and measured file finding. It does not establish the same gain for your repository or for code correctness.[1]
A faster lookup is useful. A lookup you can audit is useful twice.
Scope is part of the answer.
A result can be textually correct and still come from the wrong place. Pensieve's default MCP scope uses the repository where the agent started. Named scopes can join repositories and specification folders. Its README says tools refuse items outside the active scope.[2]
That boundary belongs in the result record. Write down which repository, worktree, session set, or document folder was eligible. If the search crossed several sources, keep those source names. If it fell back to unrestricted search, mark the wider boundary.
The MCP documentation makes a second distinction. Resources provide read-only context. Tools can perform actions. Retrieval should not quietly inherit write authority merely because both routes arrive through one server connection.[3]
Match the query to the index.
An exact error string, a function name, and a behavioral question are different search jobs. Pensieve combines a trigram text index with vector indexes. Its own benchmark reports that grep did better on exact error strings while its search did better on function names, mixed queries, descriptions, and short questions.[1]
Do not turn that project result into a universal ranking. Use the query shape to pick a first route. Keep a fallback. Exact text can start with literal search. A concept can start with semantic retrieval. A historical decision should search sessions and then check the current repository before it steers a patch.
Freshness needs a witness.
The Pensieve README says file changes are watched, pending changes are indexed before search, and returned files are compared with disk. It also describes a five-minute sweep and a thirty-second update period for live sessions.[2]
Those are product behaviors, not proof for a particular result. A useful retrieval card records the file revision, worktree, or observed modification time beside the passage. If the index marks an item as changed since indexing, the agent should read the current file before acting.
Multi-Agent Self-Supervision offers a related lesson about handoffs. Its workflow format gives each subagent a role, instruction, output contract, and call order. Later agents know what evidence they should receive before they continue.[4] Context retrieval deserves the same explicit handoff.
Compress the route, not the receipt.
Maurice Heumann describes lowering a coding agent's compaction threshold during a long decompilation project because completed function work no longer needed to stay in the active context. The same report says reviewer agents accepted bad deviations when worker comments supplied persuasive explanations.[5]
These observations point in opposite directions and belong together. Remove stale working detail from the prompt. Keep the source route and acceptance evidence outside the prompt so a polished summary cannot replace inspection.
The manifold below drafts that retrieval contract. It does not search a repository, prove index freshness, or validate a returned passage. It produces a request template with four conditions and visible missing evidence.