- ~1,360lines of Rust in the commit hook, tested against fake git clients
Commits as an output of AgentOS
AgentOS runs teams of coding agents that finish tasks constantly, often at the same moment, in the same repository. I wanted every finished task to leave a commit I could trace to its work order. I also wanted no agent touching git directly. So git became an output of the platform: agents never run raw git or push. When an agent finishes a task, a lifecycle hook commits the active work order's own project directory, and only that directory, as a tagged commit that names the work order and the task, so the history is searchable by the unit of work.
The history reads as the sequence of work, decisions and proof that built a system, and I use version control as part of the governance of AI work. Authorship trailers on those commits are one of the ways I attribute work to the model that did it. The story Closed by evidence shows that history at work on a platform build. I did not modify git itself.
Commits mark the work, carry attribution and stay out of agents' direct reach.
One scope per commit, under a lock
The hook refuses repository-root and out-of-tree scopes, so parallel teams in one repository cannot cross-commit. Concurrent agents serialise on a shared file lock with a timeout, so a stuck agent cannot block the rest. The hook never pushes; a separate service publishes to the remote on its own cadence.
Struck through: scopes the hook refuses.
Failing open
When the lock is busy or git is missing, the hook does not hold the close. It sits behind a git-client interface, so every failure path is exercised without a real repository.
A worker that pushes, a gatekeeper that proposes
Agent Swarm puts git in a worker agent's hands, inside limits. A coding agent on a local open-source model edits, tests, commits and pushes to its own branch from a throwaway container. It holds no credential for the main repository and has no path to the main branch. A separate gatekeeper agent holds the repository credential and opens the merge request on the worker's behalf. That is the story A coding agent that never holds the keys.