Skip to content

savings telemetry is not wired into the search flow (blocks semble#206) #81

Description

@amondnet

Finding (surfaced while implementing #75)

csp::stats::save_search_stats exists and is unit-tested, but it is never called from the search flow — no call site in main.rs, mcp.rs, or indexing/index.rs. CspIndex also has no file_sizes field.

Upstream SembleIndex records stats inside search() / find_related():

self._file_sizes = self._compute_file_sizes(root) if root else {}
...
save_search_stats(results, CallType.SEARCH, self._file_sizes, max_snippet_lines)

So today csp savings / ~/.csp/savings.jsonl never receives records from real searches — the savings report has nothing to summarize.

Impact

Proposed work

  • Add file_sizes to CspIndex (compute on build from the indexed root).
  • Call save_search_stats inside CspIndex::search / find_related (or at the CLI/MCP layer), keyed by the default stats file.
  • Then apply semble#206: pass max_snippet_lines into the stats so the "delivered chars" reflect the truncated snippet, not the full chunk.

Refs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2Priority 2 - Mediumtype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions