<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Patronum</title>
    <description>The latest articles on DEV Community by Patronum (@maweis1981).</description>
    <link>https://dev.to/maweis1981</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3970827%2F94b24669-6d85-4355-9739-986cb27b555c.jpeg</url>
      <title>DEV Community: Patronum</title>
      <link>https://dev.to/maweis1981</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maweis1981"/>
    <language>en</language>
    <item>
      <title>My AI agent's CI bill was 6 higher than my last project's. Here's the spec I wrote to fix it.</title>
      <dc:creator>Patronum</dc:creator>
      <pubDate>Sat, 06 Jun 2026 06:37:08 +0000</pubDate>
      <link>https://dev.to/maweis1981/my-ai-agents-ci-bill-was-6x-higher-than-my-last-projects-heres-the-spec-i-wrote-to-fix-it-4n6a</link>
      <guid>https://dev.to/maweis1981/my-ai-agents-ci-bill-was-6x-higher-than-my-last-projects-heres-the-spec-i-wrote-to-fix-it-4n6a</guid>
      <description>&lt;h2&gt;
  
  
  My AI agent's CI bill was 6× higher than my last project's. Here's the spec I wrote to fix it.
&lt;/h2&gt;

&lt;p&gt;For three months I let Claude Code and Cursor drive a real&lt;br&gt;
production project — a small B2B SaaS, Next.js on Vercel, Postgres&lt;br&gt;
on Neon, three engineers and two designers. By week two, the AI&lt;br&gt;
agents were producing code maybe three times faster than the team&lt;br&gt;
could review. The numbers that should have been celebrated were&lt;br&gt;
instead a problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 commits per day on &lt;code&gt;main&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Half of those commits titled &lt;code&gt;wip&lt;/code&gt;, &lt;code&gt;fix&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, or &lt;code&gt;asdf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A CI bill 6× our comparable non-AI project&lt;/li&gt;
&lt;li&gt;Four partial-migration incidents in three weeks, all the same
pattern (Prisma migration run against a pooled connection, half-applied,
app crashed)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this was Claude's or Cursor's fault. The agents were doing&lt;br&gt;
exactly what their default settings told them to do: commit on save,&lt;br&gt;
push on commit, run CI on every push, deploy preview on every CI&lt;br&gt;
green. The economics of Git, GitHub, and managed databases were&lt;br&gt;
designed for a few commits per day per human developer. Plugging in&lt;br&gt;
an agent that does 50 doesn't break Git — it breaks the bill.&lt;/p&gt;

&lt;p&gt;So I started writing down what we actually changed to get back to&lt;br&gt;
sane.&lt;/p&gt;
&lt;h3&gt;
  
  
  What the rules look like
&lt;/h3&gt;

&lt;p&gt;Three principles, then a lot of detail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. AI may modify frequently. Systems may not commit frequently.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The single most important rule, and the one all the others&lt;br&gt;
derive from. &lt;em&gt;Modification&lt;/em&gt; — editing a file, regenerating a function&lt;br&gt;
— is local, cheap, reversible. &lt;em&gt;Commit / push / merge / deploy /&lt;br&gt;
migrate&lt;/em&gt; is system-wide, expensive, observable, not always reversible.&lt;br&gt;
Agents naturally want to commit at the speed they modify. The discipline&lt;br&gt;
is to slow them at exactly that boundary.&lt;/p&gt;

&lt;p&gt;In practice: disable "Auto Commit" / "Auto Sync" / "Auto Push" in&lt;br&gt;
every tool you control. Configure CLAUDE.md and AGENTS.md to make&lt;br&gt;
this expectation explicit. Use &lt;code&gt;git stash&lt;/code&gt; and local feature branches&lt;br&gt;
for intermediate states. The remote does not need to see your&lt;br&gt;
agent's middle-of-iteration state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. A commit is a stable snapshot, not a thought process.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A useful commit answers &lt;em&gt;"what is the system, in a coherent state,&lt;br&gt;
after this change?"&lt;/em&gt; — not &lt;em&gt;"what was the agent thinking at minute 14?"&lt;/em&gt;&lt;br&gt;
Commit messages describe the resulting capability ("complete&lt;br&gt;
onboarding workflow"), not the journey ("fix typo, retry, fix import,&lt;br&gt;
retry, fix padding"). One feature, one commit. Squash-merge into&lt;br&gt;
&lt;code&gt;main&lt;/code&gt;. Conventional Commits.&lt;/p&gt;

&lt;p&gt;We added a tiny bash lint script that rejects commit subjects like&lt;br&gt;
&lt;code&gt;wip&lt;/code&gt;, &lt;code&gt;fix&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, &lt;code&gt;asdf&lt;/code&gt;. It catches the agent embarrassingly&lt;br&gt;
often.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Search before generating.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI agents have an extreme bias toward generation. Without explicit&lt;br&gt;
discipline, every prompt produces a near-duplicate of something&lt;br&gt;
that already exists in the codebase. Six months later you have&lt;br&gt;
&lt;code&gt;useDebounce&lt;/code&gt;, &lt;code&gt;useDebounce2&lt;/code&gt;, &lt;code&gt;useDebouncedValue&lt;/code&gt;, and &lt;code&gt;useDelay&lt;/code&gt;&lt;br&gt;
— all subtly different, all maintained by nobody.&lt;/p&gt;

&lt;p&gt;The rule: before writing any new code, search the codebase for&lt;br&gt;
existing implementations, APIs, hooks, components, schemas,&lt;br&gt;
prompts. Extend the existing one. Only generate if nothing exists.&lt;/p&gt;
&lt;h3&gt;
  
  
  Where the bill actually went
&lt;/h3&gt;

&lt;p&gt;Once the commit cadence got under control, the CI bill dropped&lt;br&gt;
~70%. The single biggest lever was &lt;code&gt;concurrency:&lt;br&gt;
cancel-in-progress&lt;/code&gt; in every GitHub Actions workflow — when the&lt;br&gt;
agent pushes 20 times in 10 minutes, only the latest build runs&lt;br&gt;
to completion. The rest are cancelled before they consume&lt;br&gt;
minutes.&lt;/p&gt;

&lt;p&gt;The second biggest lever was &lt;code&gt;paths-ignore&lt;/code&gt;. The agent does a lot&lt;br&gt;
of doc edits while iterating; building the full app for a&lt;br&gt;
docs-only PR is pure waste. Filtering docs paths out of expensive&lt;br&gt;
workflows cut another ~20%.&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;on: push&lt;/code&gt; got banned for everything except &lt;code&gt;main&lt;/code&gt;. Production&lt;br&gt;
deploys come from merging to &lt;code&gt;main&lt;/code&gt;, full stop. AI branches get&lt;br&gt;
preview deploys, not production deploys.&lt;/p&gt;
&lt;h3&gt;
  
  
  Where the migrations actually went
&lt;/h3&gt;

&lt;p&gt;The four migration incidents had a common cause: Prisma migration&lt;br&gt;
running against &lt;code&gt;DATABASE_URL&lt;/code&gt;, which on Neon is the pooled&lt;br&gt;
endpoint. Pooled connections in transaction mode don't reliably&lt;br&gt;
support &lt;code&gt;CREATE INDEX CONCURRENTLY&lt;/code&gt; and don't preserve&lt;br&gt;
session-scoped settings. The migration starts, the agent moves on,&lt;br&gt;
half the changes apply, the app deploys, the app crashes.&lt;/p&gt;

&lt;p&gt;Fix: split into two URLs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;DATABASE_URL&lt;/span&gt;=&lt;span class="n"&gt;postgres&lt;/span&gt;://...?&lt;span class="n"&gt;pgbouncer&lt;/span&gt;=&lt;span class="n"&gt;true&lt;/span&gt;   &lt;span class="c"&gt;# runtime
&lt;/span&gt;&lt;span class="n"&gt;DIRECT_URL&lt;/span&gt;=&lt;span class="n"&gt;postgres&lt;/span&gt;://...                    &lt;span class="c"&gt;# migrations
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prisma and Drizzle both support this split natively. The agent&lt;br&gt;
should never have been running migrations through the pooled&lt;br&gt;
endpoint to begin with — but the default configuration didn't&lt;br&gt;
distinguish, and the agent did what was easy.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's actually in the spec
&lt;/h3&gt;

&lt;p&gt;The repo is structured for three audiences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Humans&lt;/strong&gt; read &lt;code&gt;STANDARDS.md&lt;/code&gt; (single file) or &lt;code&gt;docs/&amp;lt;topic&amp;gt;.md&lt;/code&gt;
(chaptered). Both bilingual EN / 中文.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vibe-coding tools&lt;/strong&gt; autoload from &lt;code&gt;skills/&lt;/code&gt; (Claude Code Skill
packages, superpower-style with YAML frontmatter) or read
&lt;code&gt;CLAUDE.md&lt;/code&gt; / &lt;code&gt;AGENTS.md&lt;/code&gt; at repo root.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Downstream projects&lt;/strong&gt; copy &lt;code&gt;templates/&lt;/code&gt; (CLAUDE.md, AGENTS.md,
preview workflow, CODEOWNERS, commitlint config) and &lt;code&gt;scripts/&lt;/code&gt;
(four bash lint scripts that enforce most rules in CI).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The v0.2 release this week adds eight new chapters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI-specific: secrets &amp;amp; OIDC, prompts as code, evals for AI
features, observability + cost guardrails&lt;/li&gt;
&lt;li&gt;Platform engineering: IDP integration (Backstage / Harness IDP /
Port / Cortex), CODEOWNERS for AI-authored diffs, doc
freshness, DORA metrics adapted for AI cadence&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What you should steal
&lt;/h3&gt;

&lt;p&gt;If you do nothing else this week:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;concurrency: cancel-in-progress&lt;/code&gt; to every workflow file you
own. It's three lines and it costs you nothing if no flurry of
pushes happens.&lt;/li&gt;
&lt;li&gt;Disable auto-commit, auto-sync, auto-push in your editor / agent
settings. Three minutes of looking through preferences.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;grep -r "DATABASE_URL"&lt;/code&gt; in your repo and verify your
migrations are not pointed at a pooled endpoint. If they are,
fix it before the next migration lands.&lt;/li&gt;
&lt;li&gt;Add a one-line CODEOWNERS entry for any path that touches
payments, auth, or schema. Two minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those four take an afternoon and roughly halve your AI-driven&lt;br&gt;
project's pain.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I got wrong, and what's next
&lt;/h3&gt;

&lt;p&gt;The first version of the spec said "one feature = one commit, ever."&lt;br&gt;
After three months I had to relax it: in practice features often&lt;br&gt;
need two commits (the change + tests, or schema + code) and forcing&lt;br&gt;
them into one made the diffs worse, not better. The rule is now&lt;br&gt;
"no intermediate commits exposed to the remote that don't stand on&lt;br&gt;
their own."&lt;/p&gt;

&lt;p&gt;What I haven't figured out yet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Evals at scale.&lt;/strong&gt; The spec says "every prompt has a suite,
every PR runs it, regressions block merge." This works for 5
prompts. For 500 prompts, even cached evals get expensive.
There's a chapter to write here once I've seen it work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monorepo CI affected detection&lt;/strong&gt; with three different tools
in play (Turborepo, Nx, custom). The monorepo chapter is OK
for one tool; reality is messier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solo-maintainer branch protection.&lt;/strong&gt; The spec assumes ≥ 2
reviewers exist. For a 1-person OSS repo, you're either the
author or you're not merging — needs a documented exception.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The repo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/maweis1981/agents-md" rel="noopener noreferrer"&gt;github.com/maweis1981/agents-md&lt;/a&gt;&lt;br&gt;
— MIT licensed, no commercial interest, no upsell. The spec&lt;br&gt;
itself is in &lt;code&gt;STANDARDS.md&lt;/code&gt; / &lt;code&gt;STANDARDS.zh-CN.md&lt;/code&gt;; chaptered&lt;br&gt;
docs are under &lt;code&gt;docs/&lt;/code&gt;; installable Claude Code Skills are&lt;br&gt;
under &lt;code&gt;skills/&lt;/code&gt;; drop-in templates are under &lt;code&gt;templates/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;PRs, translations, and "your team does it differently and it&lt;br&gt;
works better"-style issues are very welcome.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>cicd</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
