Pensieve

Give your coding agent a local index: ask one question, get back a few passages with line numbers instead of grepping and reading forty files

What it is

Pensieve is a local retrieval tool written in Python by Canadian developer Ted Haley and released under the MIT license. The repository is github.com/TedHaley/pensieve and the project page is tedhaley.ca/pensieve. It reached the Hacker News front page on 12 October 2026 under the title about local indexing reducing tool calls and token usage. Its scope is narrow: it indexes your files, folders, git repositories and saved coding-agent sessions locally on your Mac, exposes that index to you through a Control+Shift overlay, and serves it to agents over the Model Context Protocol. Search works by meaning, by exact phrase or a mix of both, supports exclusions with a leading minus sign, and filters such as kind:code, ext:pdf or in: to scope a query to a folder or repository. The official integration list covers Claude Code, Codex, Cursor, Gemini CLI, Windsurf, Claude Desktop and VS Code, and any other MCP client can connect over stdio via pensieve mcp or over HTTP. The detail that shows the author understands agents is the pensieve integrate command: it appends a search-before-you-grep block to the instruction files of Claude Code, Codex and Gemini CLI and installs a search skill plus two hooks for Claude Code, because agents grep by habit and will ignore a tool they were never told to prefer. With that in place, the agent used Pensieve in all 144 runs of the official benchmark. The benchmark is self-reported: Claude Sonnet ran headless through Claude Code on 72 code-finding tasks across four real repositories ranging from 504 to 34,847 files, each task phrased five ways and each configuration run twice, for 144 runs in total. With Pensieve 0.5.6 enabled, 131 of 144 runs found the right file against 123 with grep alone; lookups averaged 2.0 tool calls versus 3.4, a 43 percent reduction, with 82 of 144 answered in a single call; cost per lookup was 0.041 dollars against 0.050, an 18 percent saving that held in all four repositories; time per lookup was 8.6 seconds against 10.9; and token use fell 16 percent. The project stresses that the tasks were never used for tuning and that the benchmark scripts are open source in the repository’s bench directory so anyone can rerun them. There is an honest caveat in the fine print: on tasks involving exact error messages, a single plain grep still beat the index. Beyond search, the index watches folders, repositories and agent sessions and re-indexes on change, includes uncommitted edits, and tracks each git worktree by branch so agents are not working from stale context. It also maps code ownership using git blame weighted by lines that still exist today, letting you ask who knows a topic rather than a file, and flags knowledge gaps: areas whose original authors are no longer active, how many people still know the code and who knows it best, so handovers can be planned before an incident forces one.

Highlights

  • Developers running coding agents against real repositories, especially teams whose codebases are large enough that a single grep fans out into a chain of file reads and whose token bill is starting to hurt. It also fits environments where code must not leave the machine, such as companies with strict rules on sending source code to third-party services. Individual users who want to look back through what they discussed with an agent yesterday will get value too. Right now it needs an Apple Silicon Mac running macOS 14 or later; Windows and Linux users can install the backend and browser visualiser but not the full desktop experience.

How to use

The quickest install is uv tool install git+https://github.com/TedHaley/pensieve, which gives you the pensieve command; the first run downloads the Qwen3-Embedding-0.6B model at about 1.2GB. The full desktop build, with the Control+Shift search panel, the 3D map and the login item, comes from a dmg and is not notarised yet, so if macOS blocks it open System Settings, go to Privacy and Security and click Open Anyway once. Day to day you run pensieve setup recommended so it discovers and connects your repositories and documents, then pensieve integrate recommended to write the search-before-you-grep block into each agent’s instruction file. Use —data or the PENSIEVE_DATA environment variable to keep the index somewhere else. Once the service is up, agents such as Claude Code prefer the index automatically, or you can run pensieve mcp and wire up any MCP client by hand. To uninstall, run pensieve integrate all —remove first, then quit the app, drag it to the Trash and delete ~/.pensieve, ~/.local/share/uv/tools/pensieve and ~/.local/bin/pensieve.

License

Released under MIT. Read the terms before commercial use or redistribution, especially if you plan to offer it as a service.