Skip to lesson
Exit
AI editor systems and design1 / 2

1 min lesson

Keep a repository index current

Update changed chunks without letting an old index override newer editor state.

Step 1 of 2

Keep the index current

A proposed large-repository design should update only the files and chunks that changed. It should also read live editor state when an unsaved change is newer than the index. Record the index version and file hash with each result so a stale record can be detected before the model sees it.

  1. 1During the initial build, split files at useful code boundaries and store each chunk with a content hash and source location.
  2. 2After a file change, re-chunk that file and reuse records whose content hash did not change.
  3. 3Before using a retrieved chunk, compare it with the live buffer so unsaved edits do not lose to an older index entry.
  4. 4Remove records for deleted files and rebuild when an index version or embedding model changes.