| Status | Draft for review |
| Last updated | 2026-12-04 |
| Related | Architecture · Conventions catalog |
AI-assisted development is increasing the amount of code we write. Agents write code quickly and confidently, but the style varies from one prompt to the next. Without hard limits and/or careful scrutiny, repositories can tend to drift toward a mix of naming schemes, oversized functions, missing tests, leftover placeholders and comments that narrate the code instead of explaining it. Review can’t catch all of this at the volume agents produce.
No infrastructure is currently set up to manage this. A survey of the 100 most recently active projects (activity from Nov 2025 to Dec 2026, out of 541 total) found the following; details are in Appendix A:
Conventions that exist only in a document, or in a prompt, are suggestions. Agents and people follow them some of the time.
All code that reaches a protected branch meets one agreed, versioned set of conventions, whether a person or an agent wrote it. Machines check those conventions as early as possible: ideally while the agent is still writing the code, and at the latest before merge. The only way around a rule is an explicit, reviewed exception.
For an AI agent, a convention is part of the environment rather than an instruction it can forget. The agent’s edits are checked as it makes them, and the agent cannot report “done” while its changes violate a rule. For a developer, conventions are mostly invisible: the formatter fixes style on save, and the merge request shows any remaining problem inline. For reviewers, review time goes to design and intent, not spacing and naming.
| Principle | What it means in practice |
|---|---|
| Deterministic first, advisory second | Formatters and linters decide. AI review and human review handle only what tools cannot judge, and they are labeled that way. |
| Fix automatically when possible | If a tool can fix a problem (formatting, import order, simple lint fixes), it does, and nobody discusses it. |
| Enforce where the code is written | The cheapest place to fix a violation is in the agent’s own edit loop, before a human ever sees it. |
| The merge gate is the guarantee | Local checks are fast feedback that can be bypassed. The CI gate on a mandatory merge request is what cannot be bypassed. |
| Only changed code is gated | Each change is judged by the files it touches; old code is not held against it. |
| Exceptions are data, not comments | An exception is a reviewed entry in .conventions/, never a // eslint-disable added in passing. |
| Rules are versioned and staged | Rules change through releases. A new rule warns before it blocks. |
| Who | What they need |
|---|---|
| Developers | Fast, clear feedback; automatic fixes; no surprises at merge time; a clear way to request an exception. |
| AI coding agents (Claude Code, Codex) | Immediate, machine-readable feedback after each edit; a hard stop before reporting work done; written conventions for the rules that need judgment. |
| Reviewers and maintainers | MRs that already meet the mechanical rules; findings shown inline in the diff; reviews focused on design. |
| Conventions owners (a small group of engineering leads) | Own the rules and their versions, approve exceptions, decide on threshold changes, watch the rollout measures. |
| GitLab administrators | Group-level settings and policies that roll out in rings and can’t be removed project by project. |
| Clients and auditors (indirectly) | Consistent, maintainable, accessible and secure deliverables across client projects. |
The conventions are organized into 19 categories, plus one process rule. The full table is in the conventions catalog.
“Significant” means used in more than one active project, or used heavily in one.
| Profile | Languages |
|---|---|
| Full (every applicable category) | JavaScript, TypeScript, Svelte, Astro · CSS/SCSS · HTML (a web profile and an email profile) · PHP (WordPress) · Python · Go · Shell/Bash · PowerShell · C# |
| Config/infra (format and lint) | YAML (including CI files), JSON, Dockerfile, Markdown, SQL |
| Not covered | Java and Rust (too little use); data files (XML, CSV, SVG, RTF); generated, vendored or minified output |
The language list will be confirmed against all non-archived projects before rollout. The current survey covers only the 100 most recently active.
Today, code can be pushed directly to default branches. No gate can work while that is true, so making merge requests mandatory is a prerequisite and a convention in its own right:
These are set as group-level defaults, so each new project is covered automatically when its group joins the rollout.
Rollout expands in rings, one group at a time. Each ring goes through the same steps: turn on mandatory MRs → conventions in warn mode → conventions blocking.
| Ring | Scope | Entry state |
|---|---|---|
| 0 – Pilot | 4–6 representative repos (Svelte/TS, TS/SCSS, WordPress, Python, Go, email) | MRs required; conventions warn only |
| 1 – Early adopters | 2–3 internal groups (e.g. cg-life, toolhouse) |
MRs required; conventions blocking on changed files |
| 2 – Active client groups | e.g. novo, scholar-rock, genmab |
Two weeks of warn mode, then blocking |
| 3 – Everywhere | Every group; the instance-wide default | Blocking; new projects covered automatically |
A ring is ready to expand when: - False positives are under the agreed rate. - Agent per-edit check latency is within target. - The exception request rate is stable. - Developer feedback has been addressed.
A rule added later follows the same warn-then-block cycle.
| Measure | Target |
|---|---|
| Projects in scope that require MRs and run the conventions gate | 100% of Ring 3 scope |
| Changes merged to protected branches without an MR (outside logged emergencies) | 0 |
| Agent sessions that finish with convention violations in changed files | ≈ 0 (enforced by the Stop hook) |
| Agent per-edit check latency | p95 under 2 s |
| MRs that fail the gate in CI after passing local and agent checks | Under 2% (a measure of local/CI parity) |
| Exceptions per 1,000 changed lines | Watched; a rising trend triggers a rule review |
| Review comments about formatting or naming style | Trending to near zero |
| Item | Notes / mitigation |
|---|---|
| Managed GitLab tier unknown | The cleanest design needs Ultimate: pipeline execution policies centrally inject a job that projects can’t remove. On Premium, each project includes the gate and a scheduled audit catches removal. Both are described in the architecture. |
| Codex hook details | Codex supports PostToolUse and Stop-style hooks with managed configuration. The exact matcher names and behavior must be checked against the current Codex docs during implementation. |
| Thresholds too strict or too loose | The pilot tunes complexity and size limits. New rules start in warn mode. |
| Developer friction | Autofix on save and in agent hooks; changed files only; a clear, fast exception path. |
| Email and generated HTML | Email HTML gets its own profile (layout tables and inline styles allowed). Generated output (e.g. Google Web Designer exports) is excluded by path. |
| Unmanaged agents and cloud agents | They may skip local hooks, but the merge gate still catches every violation. |
| Rule ownership | Requires a named conventions-owners group with time set aside to answer exception requests promptly. |
Collected on 2026-12-04 with scripts/gitlab-metrics.sh (code metrics from scc), plus a read-only GitLab API survey of each project’s root files, package.json and .gitlab-ci.yml. The raw database is not kept; re-run the script for fresh numbers.
Coverage: 100 of the 541 projects, the most recently active ones (last activity between Nov 2025 and Dec 2026). 44 of the 541 are archived.
| Language | Projects | Code lines | Notes |
|---|---|---|---|
| HTML | 55 | 881k | Mostly email templates and banner ads |
| JavaScript | 62 | 199k | Includes generated Google Web Designer banner output (gwd-banner-ads/*, ~85k) |
| CSS | 38 | 127k | |
| Sass/SCSS | 32 | 114k | |
| Svelte | 9 | 46k | SvelteKit sites and apps |
| TypeScript | 23 | 35k | |
| PHP | 4 | 20k | WordPress themes and sites |
| C# | 1 | 12k | One backend project |
| Python | 5 | 7k | |
| PowerShell | 2 | 6.6k | |
| Astro | 1 | 5.4k | |
| Shell / Bash | 19 | 6k | |
| Go | 6 | 3k | |
| Java | 1 | 1.2k | Below the threshold |
| SQL | 4 | 1.1k | |
| Rust | 1 | 0.4k | Below the threshold |
| YAML / JSON / Markdown / Dockerfile | 76 / 84 / 87 / 53 | — | Config and infrastructure |
| XML, CSV, SVG, RTF | — | — | Data files; out of scope |
| Finding | Count |
|---|---|
Projects with .gitlab-ci.yml |
72 |
| CI pipelines that run a linter | 0 |
| CI pipelines that check formatting | 1 (yarn format:check, i.e. Prettier) |
CI files that use a shared include: |
1 |
Projects with a lint or format dependency in package.json |
22 |
| Projects with a Prettier / ESLint / Stylelint / EditorConfig config file | 13 / 9 / 5 / 6 |
Projects with AGENTS.md / .claude/ |
7 / 3 |