Inspiration

Most CI pipelines are not broken — they are simply wasteful. Documentation-only merge requests routinely trigger integration tests, e2e suites, and packaging jobs designed for source-code changes. We wanted to build an agent that fixes this automatically.

What it does

CI Waste Cutter is a GitLab Duo flow that reviews merge requests, detects low-risk changes (docs-only, markdown edits), and safely patches .gitlab-ci.yml to skip unnecessary heavy jobs. It adds rules:changes and interruptible: true — nothing more.

How we built it

We used the GitLab Duo Agent Platform with a custom flow definition. The agent uses native GitLab tools: get_merge_request, list_merge_request_diffs, read_file, ci_linter, create_commit, and create_merge_request_note. The system prompt enforces a strict safety model — no app code changes, no job removal, mandatory CI Lint validation before every commit.

Challenges we ran into

Getting the project context resolution right in the flow execution environment was the biggest challenge. We also had to carefully balance the agent's autonomy — it should be confident enough to act, but conservative enough to never break a pipeline.

What we learned

The GitLab Duo Agent Platform is powerful for building narrowly-scoped, safe automations. The key insight: the best AI agents do one thing well rather than trying to do everything.

What's next

  • Support for monorepo patterns with multiple CI configs
  • Workflow-level optimizations (workflow:auto_cancel)
  • Integration with GitLab CI analytics for data-driven recommendations

Built With

  • gitlab-ci/cd
  • gitlab-duo-agent-platform
  • lint
  • yaml
Share this project:

Updates