Skip to content

feat: expose index freshness metadata in search results #2

Description

@ktappdev

Problem

JSON search output has paths and scores but no timestamp for when the index was built. Tools reporting "snapshot from June 16" can't get this information without reading the raw index file and parsing generated_at themselves.

ContextIndex.GeneratedAt already exists in .ctx/ctx_index.json but is not surfaced in search-hints output.

Proposed Solution

Add index_generated_at to JSON output (part of the envelope from #2):

{
  "source": "snapshot",
  "index_generated_at": "2026-06-16T10:00:00Z",
  "results": [...]
}

Or as standalone top-level field if envelope approach is rejected.

Implementation Notes

  • ContextIndex.GeneratedAt is already populated by init, watch, and sync
  • Pass it through to the JSON serialization layer in command_search.go
  • For memory search, the watch server could include it in the response (or client reads from index file)

Acceptance Criteria

  • --json output includes index_generated_at in ISO 8601 format
  • Timestamp reflects actual index build time, not query time
  • Field present for both memory and snapshot sources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions