Ship changes with proof, not hope.
ArcGuard is a GitLab-native merge confidence system built for the GitLab Duo Agent Platform hackathon. Its primary deliverable is a custom public GitLab Duo flow that reacts to merge requests, runs a deterministic analysis engine, and posts a Merge Confidence Report back into the MR.
The repository also includes a polished Next.js demo app that uses the exact same analysis engine for fast local demos.
Generic AI review comments are often broad, subjective, and disconnected from the actual merge decision. ArcGuard is opinionated about merge confidence:
- it checks architecture drift
- it clusters review work into a minimap
- it validates intent against code, tests, and docs
- it surfaces flaky-test evidence
- it evaluates rollback realism
- it scores CI waste and sustainability impact
- it computes a final verdict from explicit rules
apps/web: companion demo app built with Next.js App Router, React, TypeScript, Tailwind, shadcn-style components, Framer Motion, Lucide, Recharts, and Zodpackages/core: shared deterministic analysis enginepackages/fixtures: seeded MR scenarios.gitlab/duo/agent-config.yml: GitLab Duo flow execution config.gitlab/duo/flows/arcguard-merge-confidence.yml: custom flow sourcescripts: local CLI entry points for scenario analysis and flow simulationdocs: setup, architecture, demo, and submission notes
ArcGuard computes a Merge Confidence Report across seven areas:
- Architecture Drift
- Review Minimap
- Intent Contracts
- Flake Witness Capsule
- Rollback Reality Check
- Sustainability / CI Waste
- Final Merge Confidence Verdict
Verdicts are:
Safe to MergeNeeds FixesBlocked
Three seeded scenarios are included and scored by the engine:
scenario-a-low-risk: safe refactor, aligned tests/docs, rollback safe, verdictSafe to Mergescenario-b-medium-risk: moderate design concern, partial docs mismatch, manageable review complexity, some CI waste, verdictNeeds Fixesscenario-c-high-risk: cross-layer drift, destructive rollback hazard, flaky-test evidence, docs mismatch, significant CI waste, verdictBlocked
The category scores and verdicts are computed from structured scenario data and scoring rules in packages/core. They are not hardcoded.
ArcGuard is designed as a custom public GitLab Duo flow.
- A merge request mentions ArcGuard or assigns ArcGuard as reviewer.
- GitLab Duo starts the flow in CI using
.gitlab/duo/agent-config.yml. - The flow runs
pnpm arcguard:analyze:flow. - The script converts
AI_FLOW_CONTEXTinto ArcGuard input or hydrates a seeded scenario if a scenario marker is present. - The shared engine computes the report.
- The flow posts a Merge Confidence Report into the merge request via
create_merge_request_note.
- Flow YAML:
.gitlab/duo/flows/arcguard-merge-confidence.yml - Execution config:
.gitlab/duo/agent-config.yml - Flow instructions:
AGENTS.md
pnpm installpnpm devOpen:
http://localhost:3000/http://localhost:3000/demo
pnpm analyze -- --scenario scenario-a-low-risk
pnpm report:scenario -- --scenario scenario-b-medium-risk
pnpm arcguard:analyze:flow -- --scenario scenario-c-high-riskpnpm lint
pnpm typecheck
pnpm test
pnpm buildArcGuard uses deterministic logic in packages/core/src/analysis.ts.
- architecture score: layer violations, risky dependencies, cross-boundary coupling
- review score: semantic zone spread, churn, risky file clusters
- intent score: claims matched against code, docs, and tests
- flake score: frequency and severity of flaky-test evidence
- rollback score: reversibility, schema hazards, public interface risk
- sustainability score: duplicate jobs, retries, and avoidable CI minutes
- green opportunity: avoidable CI share and waste concentration for Green Agent-style optimization wins
The final confidence score is a weighted combination of those categories. The final verdict is then derived from score thresholds plus blocking conditions such as critical architecture drift or unsafe rollback.
- Zod validation for analysis inputs
- no unsafe HTML injection
- no client-side secrets
- strict TypeScript
- no
eval - security headers in
apps/web/next.config.ts - flow instructions explicitly prevent fabricated scores
- semantic HTML and keyboard-accessible controls
- visible focus states
- reduced-motion aware animation timing
- responsive layout across desktop and mobile
- readable contrast in the demo UI
Use the path in docs/demo.md. The fastest path is:
- land on
/ - jump to
/demo - run Scenario A
- run Scenario B
- run Scenario C
- end on the final verdict and reviewer guidance
ArcGuard is not a chat wrapper around a static dashboard. It is a triggerable GitLab workflow with a local-first demo path and a deterministic scoring engine that both the flow and the web app share.