Skip to main content

Module archive_index

Module archive_index 

Source
Expand description

§Module: archive_index

§Spec

  • Maintains a derived sqlite index at .agent-doc/archive-index.db for compacted-turn lookup.
  • Markdown archives under .agent-doc/archives/*.md remain canonical history; this DB is rebuildable and may be dropped/recreated from those files.
  • run_index(file, rebuild) creates or refreshes the index for the target project.
  • run_search(file, query, backlog_id, session, limit, json, rebuild) queries indexed archive chunks, biasing results toward the current document and recent archives.
  • Search results operate on extracted turn/section chunks rather than full-file blobs.
  • Compact-time indexing is best effort only; archive creation must still succeed when the DB update fails.

§Agentic Contracts

  • The DB lives under the same project root that owns .agent-doc/archives.
  • rebuild: true drops all derived rows and reindexes every archive markdown file on disk.
  • Search requires at least one of query, backlog_id, or session.
  • Backlog-id filters match exact #id references extracted from archive text.

§Evals

  • rebuild_indexes_archives: archive markdown corpus produces sqlite rows for archives/turns/refs
  • search_prefers_current_document_hits: same-query hits in the current doc sort above other docs
  • compact_section_archives_are_chunked: ### Re: archives index per-response sections
  • bare_id_filter_accepts_missing_hash_prefix: sqlarcidx and #sqlarcidx behave the same

Structs§

IndexedArchiveTurn

Functions§

fetch_turn_window
index_archive
list_recent_turns
run_index
run_search