Problem
A local index is useful only if callers can trust it. If an indexed file changes after the index is written, Search, Read, or Context could use stale token estimates or signatures. That would damage agent trust and lead to unnecessary follow-up calls.
Goal
Add freshness checks around indexed metadata and resync stale files on demand where cheap.
Scope
- Compare stored mtime and hash against current filesystem state.
- Detect stale files for paths touched by Search, Read, and Context.
- Attempt a narrow resync before returning indexed metadata when feasible.
- Warn in the response if stale metadata remains.
- Expose freshness in
wash index status.
Response behavior
When stale metadata is detected, the tool response should include a structured warning field and a concise text warning. Avoid noisy warnings when the tool falls back to live filesystem reads and no stale data is used.
Acceptance criteria
- Stale indexed signatures are not served silently.
- Deleted files are removed from the index on sync.
- Modified files are re-indexed by path without full repo re-index.
- Read still works from live file content even if index resync fails.
- Tests cover modified file, deleted file, failed resync, and clean index paths.
Implementation notes
This should be built after the minimal index substrate. Keep the first version synchronous and simple. A watcher or daemon can be a later optimization.
Problem
A local index is useful only if callers can trust it. If an indexed file changes after the index is written, Search, Read, or Context could use stale token estimates or signatures. That would damage agent trust and lead to unnecessary follow-up calls.
Goal
Add freshness checks around indexed metadata and resync stale files on demand where cheap.
Scope
wash index status.Response behavior
When stale metadata is detected, the tool response should include a structured warning field and a concise text warning. Avoid noisy warnings when the tool falls back to live filesystem reads and no stale data is used.
Acceptance criteria
Implementation notes
This should be built after the minimal index substrate. Keep the first version synchronous and simple. A watcher or daemon can be a later optimization.