◉ANTIGRAVITY LABJP
Articles/Agents & Manager
◈ Agents & Manager/2026-07-01Advanced

When the Tech-Debt Score Drops but the Same Files Keep Breaking — Field Notes on Instrumenting Fan-in and Churn

Letting Antigravity's architecture agent score technical debt is not enough — bugs often recur in the same files after refactoring. Here is how we instrumented the fan-in times churn that static complexity misses, and reconciled the score against real incidents.

antigravity458agents143tech-debtcode-analysisrefactoring8dependency-mapping

✦ Premium Article

The score got healthier, but the fires stayed in the same place

On one project I had Antigravity's architecture agent score technical debt, then worked down the list from the top. Average cyclomatic complexity dropped, and the "critical" files in the report steadily thinned out. On paper, the codebase was getting healthier.

Yet the file names lined up in the month-end incident review barely changed. The recurring failures were landing in files with low scores — the supposedly clean ones.

After seeing that gap clearly once, I stopped letting static complexity alone decide the refactoring order. The score is a necessary signal, but on its own it does not tell you where things actually break. Here are the notes on how I measured that blind spot and filled it, with the code I actually used.

Why complexity scores miss the target

Cyclomatic and cognitive complexity capture how hard a file is to read the moment you open it. Deeply nested, branch-heavy functions really are more accident-prone. No argument there.

The problem is that complexity says nothing about how often a file will be touched, or how many modules a change ripples into. A complex function that is rarely edited keeps running quietly in its complexity. Meanwhile a file that looks simple but gets rewritten weekly and is referenced by many modules produces a small tear on every change. That is where the incidents happen.

Real risk correlates far more strongly with the product of change frequency (churn) and inbound references (fan-in) than with complexity itself. Neither of those falls out of static analysis alone. One lives in Git history, the other in the dependency graph. The score we hand the agent needs both baked in from the start.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Why cyclomatic complexity can fall without incidents falling, plus code that redefines hotspots as fan-in multiplied by churn
✦A reconciliation harness that measures how well the agent's debt ranking actually captures the files that incidents touched
✦An operational recipe for correcting the agent's refactoring order with incident history instead of trusting the static score
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

◈ Agents & Manager2026-09-04
Snapshot Your Agents' Effective Scope So You Notice the Day a Default Changes
Antigravity 1.1.25 made Markdown-defined custom agents inherit the surrounding skills, rules, and subagents by default. Here is the snapshot-and-diff routine I now use to check whether an agent I meant to keep narrow quietly got wider after an update.
◈ Agents & Manager2026-08-21
Why I Check Description Overlap Before Turning On inheritCustomizations
CLI 1.1.14 collapsed markdown agent inheritance into a single inheritCustomizations switch. Here is what happened when I actually inventoried the 47 skills in my workspace and decided the switch on description overlap rather than on context size.
◈ Agents & Manager2026-05-27
Record & Replay for Antigravity Agents
How to deterministically replay a failed Antigravity Agent run offline, drawn from a month of running it across four production sites. Covers boundary recording, R2 + KV storage costs, PII masking, and a working TypeScript harness.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links