hn.today

Local Indexing to reduce tool calling and token usage

tedhaley.ca44 points8 comments
Screenshot of Local Indexing to reduce tool calling and token usage

Pensieve is a macOS tool that builds a local semantic and exact search index of files, git repositories (including uncommitted changes and worktrees), and coding-agent sessions so agents find the few passages that matter instead of grepping whole disks. It integrates with many MCP clients (Claude Code, Codex, Cursor, Gemini CLI, VS Code, etc.) and adds a “search before you grep” hook so an agent can ask Pensieve one question and get back relevant snippets with file and line. Search supports meaning or exact phrases, scoping, filters, and excludes secrets. Indexing runs locally with an on-device embedding model and a private index; sources can be toggled and summaries/AIs are optional.

Benchmarks show concrete benefits: across four repos (504-34,847 files) Pensieve reduced agent tool calls by 43% (2.0 vs 3.4 per lookup), cut lookup cost by 18% ($0.041 vs $0.050), sped lookups by 21% (8.6s vs 10.9s), and found the correct file in 131/144 runs versus 123/144 with grep; it also used 16% fewer tokens. Additional features map owners via git blame, flag knowledge gaps and bus factor, keep indexes current in seconds, and suggest experts to consult. Pensieve is free, open source, Apple Silicon only (macOS 14+), and installs via a one-line script with agent integration.

Read on tedhaley.ca8 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.