Orchestrating Coding Agents with Issue as Code
An experiment to use git-issue to spawn coding agents such as Gemini CLI in separate worktree.
I am a big fan of the everything-as-code movement (if that’s a thing). I have researched the topic of issue-as-code since CLI coding agents started to appear. Today, I built a full prototype of what such a system would look like. I think there is great potential in technology advancement in this direction.
My pain started with the need to retype prompts to AI agents. It happened to be Gemini CLI.
Copying and pasting results in taking some of the decorative glyphs. The Gemini /clear command seems to remove the chat history.
I didn’t like the solutions described in 5556, so I decided to revisit issue-as-code.
The idea is to have the ticket or task written in a low-friction tool (not web-based ones) and allow the AI to quickly
grab it. If one AI is not doing a good job, I can simply assign another. I have picked git-issue as my tool for
issue-as-code. Then wrote a task for Gemini to work on using the command git issue new. To spice things up, I have
assigned the issue to Gemini with git issue assign e18ac2c gemini; note that this doesn’t have any effect right now.
Then I have created a custom Gemini command to pull tasks from the issue-as-code system. The idea is to query for issues
assigned to Gemini and grab the latest one and work on it. The custom Gemini command looks like this:
description="Pull Latest Issue"
prompt = """
!{git --no-pager issue list -l "%i %A" | grep gemini | awk '{print $1}' | xargs git --no-pager issue show}
"""
Eliminate the Need for Command
I wasn’t quite satisfied with this, so I have started adding more tools. I wanted Gemini to start a new Git worktree, and
immediately work on the task in a tmux session such that I can peep into it. Once it finishes, it should announce it
through OS notification and by voice.
Because git-issue is a Git repository, I have leveraged post-commit to notify Gemini. A push approach compared to the
command approach. It worked, but then the post-commit will just run in the foreground until Gemini finishes, which is not
satisfying. Luckily Gemini has a -i that runs it in interactive mode, and I have made Gemini run in a separate tmux
session.
After a few vibe coding iterations (you seriously don’t expect me to code this myself), it worked!
I can now write issues using git issue new and then assign them to Gemini or any CLI agent. The final code can be found here:
The architecture of the system looks like this:
repo: project.git {
gi: git-issue repo
# main: Main Worktree
worktree: Gemini Worktrees
worktree.style.multiple: true
}
tmux: {
main-session
gemini-session: {
style.multiple: true
gemini
}
}
tmux.main-session -> cmd -> repo.gi: 1. create and assign issue
repo.gi -> tmux.gemini-session: 2. trigger post-commit,\nwhich spawns gemini inside tmux
tmux.gemini-session.gemini <-> repo.worktree: 3. gemini works on its own work dir
cmd: |sh
git issue assign abc123 gemini
|
More Crazy Ideas
It is actually possible to give each agent a voice, as the Mac say command supports many voice.
A config file could be passed to give each AI agent a different voice. It might be possible,
to make the AI agent ask for help through notification or voice. Since each agent has a different
voice, a different personality, one could quickly tell which agent; I am assuming a mental capacity
to run parallel agents, which I don’t think is easy.
The git-issue project supports commenting, which could be used to leverage communication
with CLI agent or multiple agents collaborating and utilizing git-hooks as a means to notify each other.
Back to Reality
I don’t believe that many of these ideas are feasible. However, I do believe that issue-as-code will enable
better local agents workflows. I believe I am not the only one, as I have come across a site for
Issue as Code manifesto on. Moreover, source control systems that came after git have issue-as-code
as an integrated. I know Fossil has it, but I am in no position to judge if it is good or bad.