Skip to content

Idea: Re-indexing changes #35

Open

Description

@qdrddr

I wanted to share a few ideas, and hope they could be useful:

Since octocode relying on a LanceDB database it seems this addition introduces the need to re-sync or re-index changes, ideally touching re-indexing the changed parts of the code only.

One possible approach could be to leverage Git itself to track the last indexed state. For example, a dedicated "sister" technical/octocode branch could be maintained for each branch (e.g., octocode-main corresponding to main). This branch would store the repository code state at the moment of the last successful DB indexing. While the indexed DB should probably be ignored with git, and likely could be used to store all the information across branches.

With this setup, the system could compute a diff between the current branch and the octocode branch, allowing it to identify only the modified portions of the codebase that require re-indexing.

This approach also presents the ability to capture per-commit graph versioning and build & traverse a unified graph across branches that can be stored as stated before in a dedicated singular database for all the branches.

If combined with an AST-aware diff tool, we could extract semantic code changes rather than raw text diffs and update the index more precisely. For example: https://github.com/afnanenayet/diffsitter

This might enable incremental graph updates instead of full re-indexing.

Activity

  1. donhardman commented on Mar 8, 2026

    @donhardman
    Contributor

    Hey. It indexes already in this way. When it's in a git repository, we skip indexing of non-committed changes, and once it's committed, we are incrementally indexing it and touching only those that change from the last commit to the current commit. I did not hear about Diffsitter, but it seems worth checking. However, at the moment we have only one copy of the indexed state. So if a branch changes, it may reindex those things that have changed since the last commit was reindexed, and due to those changes, it can trigger more reindexes, which is suboptimal.

    Anyway, thanks for the issue. I will take a deeper look into diffsitter.

    It would be great to hear the real-life scenario as well as what issues you currently have with indexing the Git repository.

  2. qdrddr commented on Mar 8, 2026

    @qdrddr
    Author

    I was thinking along lines of finding a way to also index not committed changes, so user would have more in-sync data what they currently have at hand.

  3. donhardman commented on Apr 4, 2026

    @donhardman
    Contributor

    Working on branching. But still not sure about unstaged chagnes indexing. But if this will go through it will be next thing to think about. Here is the pull with wip: #41

  4. self-assigned this
    on Apr 4, 2026
  5. added
    enhancement
    on Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions