← All articles

Blog

GitAgent: industrialise your AI agents with the power of Git

A single badly written instruction dropped our agent's detection rate from 100% to 72%. Managed as code, it was found and reverted in one command.

7 min readIlyasse BENSITEL

  • Agents IA
  • IA
  • LLM
  • Gouvernance
  • CI/CD
  • Tests
We Are Beebay “Blog” visual on a navy background: GitAgent, industrialise your AI agents with the power of Git.

The instructions that drive an AI agent often change without a trace: the day it gets something wrong, nobody knows why. On a real project, a single badly written instruction dropped the rate of defects detected by our agent from 100% to 72%. Because its instructions were managed as code — dated, reviewed and reversible — the cause was found and fixed in one operation. Here is how, and what you should require before rolling agents out more widely.

Elsewhere, tracing the cause of a drift takes much longer. An agent’s instructions are typed into a tool’s interface, and everyone edits them as they go, without noting who, when or why. When the agent degrades, the real cost is not the changed text: it is the time spent looking for the cause, the decisions made in the meantime on the basis of a faulty agent, and the impossibility of explaining its behaviour to an auditor. Gartner predicts that over 40% of agentic AI projects will be abandoned by the end of 2027. [1]

Our view. A prompt is code. A rule is configuration. A memory is state. Git gives AI agents the same guarantees as software: a history, a review, a rollback and traceability.

The principle: an agent is a Git repository

Two open source projects, published under the MIT licence by the vendor Lyzr, embody this approach. GitAgent (formerly Gitclaw) runs the agent. OpenGAP is the standard that organises the files describing the agent; it is still at version 0.x (0.5.0 during our tests) and may therefore change.

Versioning code is nothing new. What is new: everything that defines the agent becomes a versioned file. Changing its behaviour therefore follows the same path as a code change: the change is proposed, reviewed, enters the history, and can be rolled back at any time.

Component File Role
Identity SOUL.md Who the agent is and what its role is
Rules RULES.md What it must comply with
Separation of duties DUTIES.md What it must and must not do
Skills skills/ What it can do
Knowledge knowledge/ The information it can consult
Memory memory/ What it retains from past experience

Each component is a file in the repository: every change is dated, attributed to its author and reversible.

What we measured

Our agent reviews code, without ever modifying it. We tested it on a real business project, some of whose files exceed 180,000 characters: the size of real production code, not a demo application.

We did not invent any defects. We took 23 bugs actually fixed in the project’s history, each linked to its ticket, and reverted their fixes to make them reappear: 6 security bugs (a missing access check, a query built from parameters), 8 logic bugs (an unhandled empty value, a transfer with no protection against concurrent access) and 9 quality bugs (an update lost without an error message, dead code). Five ordinary changes, with no known defect, serve as controls: any comment about them is noise.

The 25 changes were submitted to our agent with two models from different vendors, GPT-5 mini (OpenAI) and Claude Haiku 4.5 (Anthropic), and to two classic code analysis tools, Semgrep and SonarQube. Each test was repeated three times; all rates are per-pass averages, calculated the same way throughout the article. A defect only counts as detected if the tool points to the right file, the right line and the right type of problem.

The test bench in brief. 23 real defects across 20 changes, plus 5 controls · 2 models × 3 passes = 150 reviews · GitAgent 2.2.0, OpenGAP 0.5.0 · Set-up: one day

The results

The agent detects almost all defects: 100% with GPT-5 mini and 98.6% with Claude Haiku 4.5. The two classic tools find only one each, i.e. 4%. These tools are not designed to review a change. They remain necessary for what they do well. The agent complements them; it does not replace them.

Measure (per-pass average) Agent · GPT-5 mini Agent · Claude Haiku 4.5 Semgrep SonarQube [2]
Defects detected (out of 23) 100% 98.6% 4.3% (1) 4.3% (1)
Comments per review 3.1 1.8 0.2 0.04
Share of comments outside the fix 58% 33% 75% 0%
Comments on the controls (no defect) 3.4 1.1 0.2 0
Time per review 38 s 9 s 6 to 30 s 22 to 81 s

A detection rate means nothing on its own: a tool that flags everything finds every defect, but nobody reads its reports. About half of the agent’s comments concern something other than the introduced defects. Some point to real problems in the code, such as a block that masks authorisation refusals; to be cautious, we count them all as noise, the least favourable scenario for the agent. Semgrep spots a badly built SQL query, SonarQube dead code; neither sees a missing access check or a logic error. These are problems of meaning, not of form: that is where the agent adds real value.

What this rate really measures. Each defect appears because a fix was removed: the agent sees a safeguard disappear, and says so itself (“the deleted method explicitly contained the validation”). The rate measures its ability to spot a removed safeguard, not to find a defect in unfamiliar code. Without the details of the change, on 10 changes, detection drops to 79% (44% for security) and comments double: that is the gap between reviewing a change and auditing code.

The bad rule experiment

We deliberately added a bad rule to test control. The instruction seemed reasonable: “only report blocking issues”. The standard’s validation accepted it without warning, because it checks the form of the files, not the effect of their content.

The effect was immediate: detection fell from 100% to 72%. The reports, one comment per review instead of three, seemed clearer. But the agent now ignored more than a quarter of the defects: half of the quality defects and three minor defects out of four, including dead code and a permission check that did not take capital letters into account.

Thanks to the Git history, we found the rule at fault and reverted it in one command (git revert); a digital fingerprint confirmed an exact return to the previous state. Without history, this was impossible: the degraded file remained perfectly consistent, and nothing indicated which instruction to remove. For management, it is the difference between an unexplained drift and an incident that is dated, attributed and closed in one operation.

Key point. With the bad rule, the agent reclassified as “blocking” nine defects it had previously judged “major”, on the same code. A rule that limits what the agent can report does not change what it sees, but how it reports it: only a baseline measurement reveals this.

Benchmark: three ways to define an agent

Only the GitAgent column is based on our measurements (cells marked “measured”); the others come from each project’s public documentation.

Criterion Git-native · GitAgent / OpenGAP Code-first · LangGraph, OpenAI Agents SDK Config-first · CrewAI
Traceability Rules, memory and skills versioned by default Code yes; memory is stored in a database Configuration yes; memory is managed by the framework
Rollback One command, verifiable (measured) Revert, then redeploy Revert, then redeploy
Portability Export to around fifteen tools (measured) Tied to the framework Tied to the framework
Complex orchestration Limited: simple sequences Advanced: complex scenarios between agents Intermediate: sequential steps

Portability (measured). Exported to Claude Code, Cursor and Copilot with the same model, the agent detects 97.9% to 100% of defects. These approaches are complementary: GitAgent governs how agents are defined, an orchestration framework chains their steps.

Industrialising: four good practices

To require from your technical teams before extending the use of agents beyond testing:

  1. Limit permissions where the agent runs. Its rules are instructions given to the model; its actual permissions depend on its environment. Run it in isolation, with access limited to what is strictly necessary.
  2. Review the history, including the changes the tool makes automatically at each start-up.
  3. Test the safeguards: check that a failing check really does prevent the agent from starting.
  4. Review any external agent before using it, as you would a software library.

Key takeaways, and how to get started

  1. An agent deserves to be managed as code. History, review, rollback: Git turns an unexplained drift into a traceable incident.
  2. GitAgent is for governance, not orchestration. It answers “who changed what, when, and how do we roll back?”, not “how do we chain several business steps?”.
  3. Git is not enough without a baseline measurement. Git shows what changed; the baseline tells you whether it is an improvement. Without it, our degradation would have passed for progress.

To get started effectively, in three steps:

  1. Take the rules out of the interface and put your agents’ instructions in a Git repository.
  2. Measure before changing, on cases where you already know the right answer.
  3. Make review mandatory, then track two indicators: the share of changes reviewed before being applied, and the time to roll back when there is a problem.

What about your agents?

Your AI agents make decisions that commit your organisation. Their rules deserve the same rigour as your code. Let’s talk about governing your AI agents: we are happy to share the method, the figures and the protocol behind this experience.

Sources

  1. Gartner, “Gartner Predicts Over 40% of Agentic AI Projects Will Be Canceled by End of 2027”, 25 June 2025.
  2. SonarQube Community 26.10, source code analysis without compilation.