Problem
The symbol store at ~/.cache/lgrep/symbols/index_*.json accumulates indexes forever. There is no CLI or MCP tool to prune stale entries. Only the semantic cache (~/.cache/lgrep/{hash}/) has cleanup (lgrep gc, lgrep prune-orphans).
Evidence
On a multi-agent host running ~5–10 OpenCode sessions with frequent per-change worktree creation/deletion (ADV workflow):
$ lgrep list_repos | jq ".repos | length"
101
$ du -sh ~/.cache/lgrep/symbols
477M /home/jon/.cache/lgrep/symbols
Sampled 19 entries from lgrep list_repos; 9 of 19 point at deleted worktree paths. The on-disk semantic cache is clean:
$ lgrep gc
{"prune_orphans": {"dirs_examined": 18, "orphans": [], ...}}
lgrep gc only scans the semantic cache dirs. Symbol store is never touched.
Impact
- Disk growth unbounded — 477M today, growing with every new worktree query.
list_repos output is noise — stale paths dominate.
search_symbols correctness risk — may return symbols from deleted worktrees.
- Conflicts with documented
lgrep gc mental model.
Source
lgrep/src/lgrep/storage/index_store.py: list_repos() reads repo_path from each index_*.json; delete_index() exists but is not exposed via CLI/MCP.
lgrep gc --help: "Run garbage collection on semantic caches" — no mention of symbol store.
Proposed API
Option A: Extend lgrep gc with --symbol-store flag (default on or opt-in).
Option B: New lgrep prune-symbols subcommand mirroring prune-orphans.
Either: stale = repo_path no longer exists on disk.
Context
Surfaced on a host that uses lgrep as the sole agent-facing local code intelligence surface (OpenCode LSP disabled). Symbol-store hygiene is load-bearing.
Happy to PR if maintainers indicate direction.
Environment
lgrep 3.1.3, Python 3.13, Ubuntu 24.04 headless, multi-agent OpenCode host.
Problem
The symbol store at
~/.cache/lgrep/symbols/index_*.jsonaccumulates indexes forever. There is no CLI or MCP tool to prune stale entries. Only the semantic cache (~/.cache/lgrep/{hash}/) has cleanup (lgrep gc,lgrep prune-orphans).Evidence
On a multi-agent host running ~5–10 OpenCode sessions with frequent per-change worktree creation/deletion (ADV workflow):
Sampled 19 entries from
lgrep list_repos; 9 of 19 point at deleted worktree paths. The on-disk semantic cache is clean:lgrep gconly scans the semantic cache dirs. Symbol store is never touched.Impact
list_reposoutput is noise — stale paths dominate.search_symbolscorrectness risk — may return symbols from deleted worktrees.lgrep gcmental model.Source
lgrep/src/lgrep/storage/index_store.py:list_repos()readsrepo_pathfrom eachindex_*.json;delete_index()exists but is not exposed via CLI/MCP.lgrep gc --help: "Run garbage collection on semantic caches" — no mention of symbol store.Proposed API
Option A: Extend
lgrep gcwith--symbol-storeflag (default on or opt-in).Option B: New
lgrep prune-symbolssubcommand mirroringprune-orphans.Either: stale =
repo_pathno longer exists on disk.Context
Surfaced on a host that uses lgrep as the sole agent-facing local code intelligence surface (OpenCode LSP disabled). Symbol-store hygiene is load-bearing.
Happy to PR if maintainers indicate direction.
Environment
lgrep 3.1.3, Python 3.13, Ubuntu 24.04 headless, multi-agent OpenCode host.