Inspiration

I co-founded Finecoin, a micro-lending platform in Rwanda. In lending and mobile-money software, the worst bugs are not crashes. They are silent money bugs: a float rounding error in interest, a mobile-money callback that gets retried and credits a borrower twice, a ledger entry with no matching side, or a phone number written to the logs. Ordinary code review misses them because the code looks fine.

What it does

LedgerGuard is a custom GitLab Duo Agent Platform flow that reviews merge requests for money safety. When the LedgerGuard service account is assigned as a reviewer on a merge request, the flow:

  1. reads the merge request and its diff (get_merge_request, list_merge_request_diffs)
  2. checks only four categories: FLOAT_MONEY, IDEMPOTENCY, UNBALANCED_LEDGER and PII_LEAK
  3. posts exactly one comment (create_merge_request_note) with severity, file, the money risk in one plain sentence, and a suggested fix. It never comments on style.

In the demo, MR !1 adds an Airtel Money callback. LedgerGuard flagged a HIGH IDEMPOTENCY issue on its own: the handler ignores Airtel's transaction_id and uses a random reference, so a retried callback would credit the borrower twice. It suggested a unique reference plus get_or_create.

How I built it

  • Demo lending API: Django + Django REST Framework with a real double-entry ledger, Decimal money, idempotent MoMo callbacks, masked phone logging, and a reconcile script.
  • Tests and CI: 14 pytest tests covering amortization schedules, ledger balance and the API, run in GitLab CI alongside SAST (Semgrep) and Secret Detection.
  • Bug branches: four branches, each planting one realistic money bug (float interest, non-idempotent Airtel callback, late-fee ledger imbalance, phone numbers in logs), so the agent can be tested on them.
  • Flow: a v1 ambient flow YAML with one AgentComponent, a tight system prompt that treats MR content as untrusted data, and a minimal toolset. It is triggered by mention, assign or assign-reviewer.
  • Cloud: containerized with Docker, with a Google Cloud project and Artifact Registry set up for deployment.

Challenges

  • Learning the flow YAML schema. For example, prompt_template.params was rejected by this GitLab version and had to be removed.
  • Getting the project into the hackathon group with Developer permissions, where import and mirroring are blocked, so everything was pushed manually.
  • Writing a prompt narrow enough to avoid noise: one comment, four categories, no style nits.

What I learned

How the Duo Agent Platform composes agents, prompts, tools and triggers, and how to turn domain knowledge from fintech into precise review rules an agent can apply.

What's next

Run LedgerGuard on all four bug branches. Then add agents that write a failing test for each finding and check that the ledger still balances in CI before a release is approved.

Built by Ophelie Bisamaza with help from Claude (Anthropic) as a coding assistant.

Built With

Share this project:

Updates

Submission history