I wanted a loop where an AI writes code and pushes it to version control, I review it, and the agent reads those reviews and acts on them. Gerrit caught my eye: a code review tool built on top of Git that reviews on a per-commit basis rather than per-pull-request. That commit-centric model is unusual, and I wanted to feel it out.
Honest takeaway up front: it did not make the agent loop noticeably smoother for me. But it was a fun thing to wire up, and the setup below is the smallest version I landed on.
Start Gerrit in Docker
One container, two ports: the web UI on 8080 and SSH on 29418.
docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerritAdd an SSH key
The REST API can take a public key directly:
curl -u admin:secret \ -X POST \ -d '{"ssh_public_key": "'"$(cat ~/.ssh/id_rsa.pub)"'"}' \ http://localhost:8080/a/accounts/admin/sshkeysThis did not actually work for me, so do it by hand instead at
http://localhost:8080/#/settings/ssh-keys.
Create a project
ssh -p 29418 admin@localhost gerrit create-project vibecode --branch mainCreates a project named vibecode with a default main branch.
Clone over SSH
git clone ssh://admin@localhost:29418/vibecodeInstall the commit-msg hook
Gerrit identifies a change by a Change-Id line in the commit message. The
commit-msg hook adds it for you.
curl -Lo `git rev-parse --git-dir`/hooks/commit-msg http://localhost:8080/tools/hooks/commit-msg && chmod +x `git rev-parse --git-dir`/hooks/commit-msgPush a commit for review
The magic refspec is refs/for/main - it routes the push into a review instead of
straight onto the branch.
git push origin main:refs/for/mainFeed the review back to the agent
Query a change and its comments over SSH, then hand the output to your coding agent and let it work out the improvements on its own.
ssh -p 29418 admin@localhost gerrit query --comments --current-patch-set 27eac4ed28b66d45e0ad30e795dda14ba70925d3That last step is the whole point: the review becomes structured text an agent can read and respond to. Gerrit was not the unlock I hoped for, but the review-as-text-the-agent-consumes idea is worth keeping around regardless of the tool underneath.