Joshua MoonandClaude Opus 5.5 ae95adebe4 feat(store): add query-only read path
Store::open_read opens index.sqlite3 read-only (query_only, no DDL,
2 s busy timeout capped by the query deadline, 2 MiB page cache) and
answers index_warming for a missing index or generation 0. A SQLite
progress handler interrupts statements once the request's
QueryDeadline (src/daemon/deadline.rs, 20 s) expires; classify()
relabels the interrupt as timed_out. reading_from() lets a worktree
read its own bytes through a parent member's index and save results
in its own cache. Store::index refuses on a reader.

Result sets move to <cache>/results.sqlite3 (ResultSetStore,
Store::result_sets), so saving results never queues behind a
publication; the old table is dropped at the next publish.

Search/show/refs/map/more/ctx in dispatch, workspace retrieval,
MemberSnapshot::open and navigation::read use open_read. The
workspace member loop takes a QueryDeadline and records members
reached after it as timed_out ("MEMBER timed out").

source::reextract_definition extracts one file in memory and returns
the same-name/kind definition nearest a line with its current
revision, for stale-read and worktree-diff fallbacks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 08:57:21 -04:00
2026-09-14 14:24:18 -04:00
2026-09-28 18:23:03 -04:00
2026-09-30 08:57:21 -04:00
2026-09-14 14:29:07 -04:00
2026-09-14 14:29:07 -04:00

Trufflepig

Trufflepig is a local search engine for coding agents working in large repositories. Instead of grep output that floods the context window, an agent gets one ranked, token-budgeted page of hits with stable handles, then reads exactly the source it needs, verified against the bytes on disk. Pre-alpha, Linux only.

What an agent gets

  • Bounded answers. Every response fits a token budget, 600 o200k_base tokens by default, ranked file-first with one representative hit per file. Truncation and partial coverage are reported, never silent. (CLI)
  • Handles instead of re-searching. Each hit carries an immutable handle. show returns its source with the revision and a verified: footer; more pages; ctx and refs follow relationships; map outlines a module. Handles survive restarts and never drift to a newer query. (retrieval contract)
  • Structure, not just text. Symbols, definitions, references, and resolved-versus-candidate relationships for Rust, TypeScript/JavaScript, C#, PHP, Luau, and DreamMaker. Everything else stays text-searchable. (language contract)
  • History without a checkout. hist, since, diff, and blame over local Git objects with exact before/after reads. Needs Git 2.55 or newer. (history contract)
  • Multi-repo workspaces, opt-in semantic retrieval and reranking with a 500 ms deadline and lexical fallback, and a per-session audit of every call. (workspace, semantic, diagnostics)

What is measured

The design makes no latency, memory, or retrieval-quality guarantee (design). Current evidence is a development split, not a held-out result:

  • Oracle-assisted navigation replay, 12 tasks: mean file recall at 10 is 0.25 with the old lexical lane, 0.46 with file-first lexical ranking, and 0.63 with CUDA retrieval plus rerank; misses fall from 8 to 6 to 4. (result.json)
  • A paired agent trial exists, but most assisted agents misused the wrapper, so it establishes no token-saving or task-success claim. (agent_result.json)
  • Indexing has a real cost: about 100 s cold for an 11,620-file repository in a debug build, with an index 17 to 21 times the source bytes. (performance smoke)

The external Codebase-Memory study (roughly tenfold lower token use, 2.1-fold fewer calls) motivates this work; it is not a Trufflepig result.

Get started

cargo install --path . --locked
trufflepig --root . --no-daemon index
trufflepig --root . search 'sym:TokenBucket'

Get started · Design and contracts · Agent setup for Codex, Claude Code, Kimi Code, Muse Code, and omp.

Licensed under GPLv3 only.

S
Description
No description provided
Readme MIT
5.3 MiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 82.2%
Python 17.6%