idx

ADR 0004: Use checksum-based incremental sync

Date: 2026-04-24

Status

Accepted

Context

The sync command currently rebuilds every directory index on each run, even when file content has not changed. This increases indexing time and unnecessary disk writes.

The current search flow reads per-directory BM25 indices from .idx/index.idx and expects those files to keep the same structure and semantics.

Decision

Sync now uses per-directory checksum metadata stored in .idx/checksum.idx.

For each eligible directory:

The checksum map key is the file name inside each indexed directory, and the value is the file content SHA-256 hash.

Consequences

Positive:

Trade-offs:

Notes

This decision preserves compatibility with existing search behavior and output while improving sync efficiency.