Using git for parallel gemini instances #3395
Replies: 3 comments 3 replies
-
or borrow from Claude Code and use git worktrees https://docs.anthropic.com/en/docs/claude-code/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees ? |
Beta Was this translation helpful? Give feedback.
-
Welcome to the realm of concurrency with shared data. To run agents in parallel in one workspace is indeed a challenging task. It highly depends on how the codebase is structured and the underlying architecture is implemented. If your codebase follows the horizontal layered architecture, it is likely more difficult to run parallel agents rather the architecture follows the vertically sliced architecture approach, where each user journey can be found in one module folder isolated by the others. It also depends in all cases, how many code is shared for features or implementation and if the agent needs to make changes to that. If you really want to implement several features in once, it shouldn't be an issue to do so as long as shared code will not be touched, and the sub-tasks are independent from each other. For example, you can always run agents in parallel if it comes to context gathering because those are all read-only operations. Make yourself comfortable with the orchestrator-worker pattern in multi-agent systems. Then check how capable an LLM model is to clearly distinguish between sequentially and parallel planning of tasks. |
Beta Was this translation helpful? Give feedback.
-
Gemini AI warned me that GIT (and git workspaces) is not race condition safe on a single computer, with a single git repository. So the plan is now to use a bigger setup:
This software setup is almost done, and then I will work on the system prompts necessary to try and make the AIs work together... I will also consult gemini and co-pilot to suggest git workflows... This is quite an interesting idea/setup, it's basically simulating a mini-software development company but with AIs. It was surprising to see how co-pilot built-into-windows 11 did not understand the race condition problems with git initially, so gemini kinda saved me an alerted me that git + worktrees was not going to work and I believe gemini, so I started investigating/discussing possibilities and came up with this solution. Amazing software... it takes time to setup... but could be worth it. I am also interested in running a local newsgroup/usenet server... I kinda miss those usenet days... Anyway back to the AI parallel idea. The idea is then to for example feed a file list into the AI and constrain each AI to a set of files from this filelist that it can work in (or a set of folders/subfolders). I think in theory this has a good chance of working. Co-Pilot did suggest a custom locking mechanism for git + git worktrees but that would be pretty tricky to get working and it would introduce locking mechanisms and sequential access, so it sounded kinda slow... and since I have a powerfull PC I decided to try this much bigger approach to see what this new/modern software can do so far it was quite impressive, plus there is the possibility to scale things up, plus I kinda learned a bit about the e-mail system/dns limitations etc/security checks/anti spam checks etc. I was quite surprised how e-mail actually works, it's quite direct, unlike newsgroups/usenet which is more routing based/flood fill. For now I ran out of steam... it was exhausting to explore all the possible security implications of running a e-mail server and gitea, but it was interesting to do anyway... now I need some rest and get some new energy and guts and then maybe/hopefully the AIs will be off to "parallel processing files" which would be a pretty major achievement... Anyway why I am reporting back on this is that the "simple git client" wasn't really designed for single computer parallel usage... it assumes there is only one repository to work on from a single process... not multiple processes or multiple threads and such... doing so would lead to data/file corruption according to gemini AI. So basically my request to implement this in google gemini cli might be overkill/too difficult/too much work and would have to replicate all this functionality from gitea/postgresql... on the other hand it would ofcourse be cool if gemini cli could do it anyway (without requiring all this extra software/setup work), but I don't think it will happen any time soon :) (then again with the assistence of gemini cli as a programming aid, who knows ?! ;) :):):)) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
To speed up conversion of large code bases using gemini cli the idea is to use multiple gemini cli instances and multiple gemini keys.
The question is now how to make the AIs work together and prevent conflicts:
Two main ideas exist:
Divide the work to split the code bases into certain file/folder ranges
Use GIT to prevent file lock and file overwrites and other problems, use git to keep it in sync, pull latest updates/changes and also re-base/merge.
However such a parallel workflow would probably require a very smart and experienced GIT user who has experience on working on a high velocity git repo with many pull requests being applied to understand what kind of work flow would truely be best.
(I would like this parallel capability to be build into gemini cli, so it can speed up big conversion projects ! ;))
The Co-Pilot AI has some suggestions though, to try it out:
Beta Was this translation helpful? Give feedback.
All reactions