[PR #106] Make checkpoints faster on large repos #257

Closed
opened 2026-03-02 04:13:06 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/106

State: closed
Merged: Yes


AI checkpoints on extremely large repos (tens of thousands of files) used to be quite slow -- just a bit longer than a git status call. Most of that time was spent actually waiting for an underlying git status call to list changes. This PR changes that by having the AI agent/IDE hooks figure out which files the AI edited, and then scoping the status call to files that are known to have AI changes. This PR decreases AI checkpoint time on large repos from seconds to sub 300ms.

Speed up on chromium (500k+ files):

Current version: 6262ms
Improved version: 204ms

For IDEs/agents that fire off pre file edit hooks, we also significantly speed up the human checkpoint that runs before the AI edit. Currently, only Claude Code provides the necessary hook, so the full potential of the speed up will only apply to Claude Code users. Cursor should have before edit hooks at some point, along with other platforms as this feature is becoming a standard part of the hooks spec across agents.

This PR also:

  • Fix an issue with cursor tool calling not being added into prompt transcripts. The behavior for cursor has been brought in line with the other IDE integrations.
  • Update hooks to support stdin-based --hook-input (fully backwards-compatible with the args-based version)
  • Updated install-hooks command to default to the stdin-based hook input approach (eliminates concerns around having to escape hook input JSON)
  • AI hook presets (cursor, copilot, claude) track new files changed
  • Cache Repository workdir so that you don't have to actually invoke git to get the working directory every time
  • Filter edited paths/will edit paths to ensure that they are part of the repo (paths outside, if they are provided for some reason, will crash the git call)
  • Fix bug in install-hooks to avoid duplicating entries
  • Update hook docs to reflect stdin changes
  • Verify speed ups on chromium repo
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/106 **State:** closed **Merged:** Yes --- AI checkpoints on extremely large repos (tens of thousands of files) used to be quite slow -- just a bit longer than a `git status` call. Most of that time was spent actually waiting for an underlying git status call to list changes. This PR changes that by having the AI agent/IDE hooks figure out which files the AI edited, and then scoping the status call to files that are known to have AI changes. This PR decreases AI checkpoint time on large repos from seconds to sub 300ms. **Speed up on chromium (500k+ files):** ``` Current version: 6262ms Improved version: 204ms ``` For IDEs/agents that fire off pre file edit hooks, we also significantly speed up the human checkpoint that runs before the AI edit. Currently, only Claude Code provides the necessary hook, so the full potential of the speed up will only apply to Claude Code users. Cursor should have before edit hooks at some point, along with other platforms as this feature is becoming a standard part of the hooks spec across agents. This PR also: - [x] Fix an issue with cursor tool calling not being added into prompt transcripts. The behavior for cursor has been brought in line with the other IDE integrations. - [x] Update hooks to support stdin-based `--hook-input` (fully backwards-compatible with the args-based version) - [x] Updated `install-hooks` command to default to the stdin-based hook input approach (eliminates concerns around having to escape hook input JSON) - [x] AI hook presets (cursor, copilot, claude) track new files changed - [x] Cache `Repository` workdir so that you don't have to actually invoke git to get the working directory every time - [x] Filter edited paths/will edit paths to ensure that they are part of the repo (paths outside, if they are provided for some reason, will crash the git call) - [x] Fix bug in install-hooks to avoid duplicating entries - [x] Update hook docs to reflect stdin changes - [x] Verify speed ups on chromium repo
kerem 2026-03-02 04:13:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#257
No description provided.