The Adapter as a Checkable Contract – Gate IDs, SKIP Semantics and Gate Debt
A structure nobody checks is just a request. How I turned my adapter files into a machine-verified contract, why the gate numbers stay identical across all projects – and why every weakening needs a target date.
11/08/2026
•10 min readNote on the Content
This series describes my insights from using AI in the software development process. These are personal experiences and conclusions from which I derived measures that worked for my projects. The series does not claim to be a comprehensive guide or universally valid — it is meant as inspiration for your own projects.
In Part 1 I took my agent workflow apart into three layers: generic core, stack adapter, project content. The core reads the adapter, the adapter describes the project. Part 2 and Part 3 were then about the context load. This post goes back to the beginning.
Two weeks after taking it apart, that structure had a hole I had not seen coming: it only works if the adapter is actually filled in. And nobody was checking.
The Half-Filled Adapter
Setting up a new project went the way such things go. I created the adapter files, filled three of them carefully, noticed on the fourth that I first had to sort out the test setup, and resolved to come back to it later.
Then I kept working. The solution architect agent started up, read
testing-strategy.md, found a heading with a placeholder underneath and wrote
a concept with a complete test plan. For a framework that did not exist in the
project.
That is the same failure mode as the agent from Part 1 that was built for a different stack, only one level earlier: an agent that finds an empty specification treats it like a missing one and improvises. It did not report the placeholder as an error. In its world that was a file with text in it.
The lesson was uncomfortable: a layer separation that only exists in a document has exactly the same binding force as "please always write tests".
Since version 2.0 the workflow contains a stop line: if the adapter is not filled
in, the agent is supposed to stop. That too is only an instruction, and I have
not measured whether agents really stop there. A hook at the start of the session
or of a subagent could not have enforced it: according to the
hooks docs, SessionStart and
SubagentStart cannot block.
What Exactly Is the Contract Here?
Before you can check something, you have to state what applies. The contract between core and adapter consists of two things in my setup, and explicitly not of two others:
| Part of the contract | Applies |
|---|---|
| Adapter names | stable across all stacks — project-context.md is called that everywhere |
Mandatory sections (the ## headings) | stable — an agent jumps to "reference module", whatever it says |
| Content of the sections | free — that is the whole point |
| Order, wording, length | free |
That is the entire trick. A core agent does not have to know what applies in the project. It has to know where it is written. The heading is the interface.
With version 2.0, four of the five adapter documents became skills; only
project-context.md is still a rule. Names and mandatory sections stayed the
same, only the location changed. That an update would have classified the moved
adapters as core and overwritten them (see Part 2) is
handled by a dedicated migration skill: it brings existing projects to 2.0 with a
dry run and a confirmation, without anyone moving files by hand.
And because the contract is a formal statement, it can be checked. In my setup a small Python script does that before every gate run and fails if:
- an adapter file is missing or a mandatory section does not exist,
- a placeholder marker is still sitting somewhere,
- the named reference module does not exist as a path,
- the gates script still contains a
TODOfrom the template, - a workflow update has announced migration steps that are not done yet.
The third entry is the most important one. The reference module is the piece of information the agents orient themselves by before they build: existing code from which they read how the architecture rules are implemented here. A typo in the path would have gone unnoticed: the agent would not have found the file, would not have understood that as a problem, and would instead have inferred from the rest of the code how things are probably meant to be done here. Now a script fails first.
Because the script runs before every gate run, it would have reported the placeholder from the beginning at the latest at the first plan step, so only after the concept. Before the concept, only the stop line applies.
The silent failure mode is not that an agent gets something wrong. It is that nobody notices it guessed.
A silent default is the same guessing in script form. Up to version 2.0, core
scripts silently assumed Flutter when they found no adapter configuration. Since
then they abort. The test agent and the two templates that, as described in
Part 1, were coupled to Flutter are stack-neutral; their
Flutter values sit in an example adapter. check-core-neutrality.py checks the
core for stack vocabulary and itself says that it only checks vocabulary.
Fixed Gate Numbers, Even for Gates That Do Not Exist
The second part of the contract concerns the quality gates, and here I first did the obvious thing: in every project exactly the gates that make sense there. In the Nuxt project that meant typecheck and build, in the backend project linter, tests and formatter, neatly numbered in each case.
The result was that "gate 3 is green" meant two different things in two projects. In a PR description that is worthless, and in an agent prompt it is worse than worthless, because the agent reads the name as meaning.
So the gate numbers are now fixed across projects:
| ID | Gate |
|---|---|
| 0 | Dependencies |
| 1 | Static analysis |
| 2 | Codegen drift |
| 3 | Formatting |
| 4 | Tests |
| 5 | Doc lifecycle |
| 6 | AC coverage |
And with it the rule that makes the actual difference: a gate that is not applicable in the project stays as an explicit SKIP with a reason. It is never removed and never renumbered.
The gate run in this blog, for instance, reports that gate 2 (codegen drift) is skipped because all generated artefacts are gitignored and there is therefore no checkable drift against Git at all. That is a statement. "Gate 2 does not exist" would not be.
The side effect I underestimated: a SKIP with a reason is an invitation to resolve it eventually. A deleted gate is a question nobody asks any more.
Gate Debt: Every Weakening With a Target Date
The hardest moment during setup is the first gate run in an existing project. It is red. Not slightly red: the linter reports a three-digit number of findings, the formatter would touch every file, there are no tests.
At this point there are exactly two paths, and both are temptingly wrong:
- Clean everything up immediately. Takes weeks and has nothing to do with the task you actually came here for.
- Weaken the gates until they are green. Takes ten minutes and makes them meaningless.
The path I chose is the second one, but with bookkeeping. Every weakening is gate debt and is recorded with three pieces of information: what was weakened, why (which concrete legacy issue), and by when it should be reversed.
No target date, no weakening.
There are five such debts in this blog. One of them is that there is no test framework and gate 4 is therefore a SKIP — with a target date, and with the explicit note that until then the production build plus a manual two-language check carries the verification. That is not a pretty line, but it states the actual situation.
The principle behind it is what has stayed with me most from this whole rebuild:
Gates start honestly green. Legacy issues are documented, not hidden.
A green gate is supposed to mean something. If it only means that because someone looked away, you have built yourself a measuring instrument that always shows the same reading.
The Ratchet as a Middle Path
For the case "the rule applies, but there is legacy code" I use a third path that I like best in this blog project: a ratchet. Instead of switching a rule off entirely, the current number of violations is recorded as a baseline. More hits than the baseline means red; fewer means: lower the baseline.
That way the rule applies to everything new from now on without the existing code blocking anything. In practice this was the point at which rules could be introduced into a long-grown project at all.
One Script Instead of Three Truths
The last part of the contract is almost boring and still has the greatest day-to-day effect: there is one gates script, and it is invoked identically by every caller.
Before, I had the commands in three places: in the CI configuration, in a note to myself, and paraphrased in the agent prompt. They were never exactly the same, and I always noticed the deviations only when CI went red.
The wording matters: the definition of a gate is now identical everywhere, its behaviour can still differ. The next section covers that.
What Still Goes Wrong
Three things this setup did not take off my hands.
First: "green locally, red in CI" does not disappear. It just means something different now. When the same script passes here and fails there, the cause is almost always non-deterministic: a codegen with a timestamp, a warm local cache, a dependency on the machine. The cold CI checkout reveals what the warm local run hides. That is a useful finding, but it is work.
Second: a gate can go red for reasons that have nothing to do with the code. In this blog, static generation renders all OG images via worker processes. Under high system load they abort with a timeout (measured once at a load average around 22), and the gate goes red without anything being wrong with the code. Two repetitions without load passed cleanly.
That now sits as a paragraph in the gate documentation, with a clear instruction: if the log names renderer errors only, it is an environment problem — repeat it without parallel load. If it names a different error, it is a real finding. And the sentence that mattered to me:
Never report "green" without having actually performed the repeated run.
Because this is exactly where the discipline is tested, for me just as much as for an agent. A flaky gate is the perfect excuse, and whoever uses it once will use it again.
Third: when the gates run is governed by two texts, and they do not agree. The agent text requires the full gates after every plan step. The adapter in target project B, one of my Nuxt projects, provides for shortened runs only "for quick intermediate checks". In the large feature from Part 3, however, the full gates ran only after steps 5, 10 and 17 of 17, with only subsets in between. The implementation agent named this openly in its report. I have not yet decided whether to adapt the rule to this practice or enforce it mechanically.
Open Points
A checkable contract checks form, not substance. The script sees that the "reference module" section is filled and the path exists. It does not see whether the named module actually exemplifies the rules. It sees that a gate debt has a target date, but not whether that date was realistic.
So the contract catches the silent error (empty entry, guessed content). For wrong content you still need a human who looks, and when in doubt a second look from a fresh context. More on that later in this series.
Conclusion
For a long time I believed the problem with agent rules was that models do not follow them reliably. That is true too. But the more expensive part was a different one: that I did not maintain the rules reliably — and that nothing pointed it out to me.
What helped was a formal commitment you can violate: fixed names, fixed sections, fixed gate numbers, SKIPs with reasons, debts with dates. All of it is unspectacular and not a single line of it is AI-specific. It just becomes more urgent as soon as something in the repo is reading along that carries on when a value is missing instead of asking.
The next post goes from structure back to process: why every stage got its own reviewer — and not just the code.
How do you deal with the first red gate run in an existing project? Clean up, weaken, or work with a baseline? I am curious whether you have found a fourth path.