Some teams now hold tests back from their AI coding agent, so it can’t game them.
I don’t think it’s that simple.
A better solution is more nuanced than just holding tests back. It depends on which tests you decide to hold back.
Hold out some end-to-end scenarios. Hand over your regression tests.
Where the idea comes from
The clearest version I’ve seen comes from StrongDM’s AI team. They build software where no human writes the code and no human reviews it.
Tests kept inside the codebase weren’t enough for that. So they wrote scenarios as well.
A scenario is an end-to-end user story, kept outside the codebase. They compare it to a holdout set in model training.
I think that comparison only goes so far, which I’ll come back to. I do think the concept is good though.
Simon Willison wrote it up and called the idea fascinating. I tend to agree. For StrongDM, what they’re holding out makes sense.
But holding tests out because you think it’ll give you better AI-generated code? I’m not sure that’s the right way to view it.
What a holdout is good for
A scenario asks a broad question. Can a user get this job done, from start to finish?
The scenario doesn’t care how the software is built. It doesn’t care if a rule you came up with 2 years ago still applies.
It only cares that the end user can get the job done.
It looks at the finished product from the outside, the way a user would. That’s worth keeping apart from the coding.
Regression tests are different
A regression test asks a narrow question. Does this behaviour still work the way it did?
It’s a rule that should still hold true, and the software should still obey it.

The hold out concept
The hold out idea borrows from LLM training, where hold outs are standard practice.
In model training you hold out examples. You’re checking the model learned the pattern, and didn’t just memorise the answers.
I think that comparison works for scenarios you might use when testing software. It breaks down for regression tests.
Hiding examples tests learning. Hiding rules just withholds the specification.

When it comes to AI coding and hold outs, this analogy comes to mind…
Think about building an extension. You give the builder the building regulations before they draw the plans.
You don’t keep them back so the inspector can catch the builder out. You’d only pay to have the work re-done.

However, just building an extension to meet the regulations doesn’t ensure that you’ll have a nice usable extension.
Your regression tests are your best spec
I’ve written before that a well-kept regression pack is the most accurate spec you have.
Requirements go out of date and nobody notices. A regression test that stops matching the code fails, and someone has to fix it.
So if you hold those tests back, your agent works from whatever else it can read. That might be a requirements document that’s months out of date. Or it might just guess.
I’d argue that holding back regression tests is hindering your AI coding agent, not helping it create a better solution.
I saw how much the tests help when two AI agents built the same feature. The one that read the regression tests first didn’t fail one.
If you’re worried about gaming
The worry behind holding tests out is a fair one. An agent might rewrite a test to suit its code. Or it might write code that passes the test and does little else.
Hiding the tests doesn’t fix that. It covers up a weak spot in the process.
I’d fix the cause instead.
One potential solution to this is maintaining both test specs and test scripts (not as onerous as you might think with AI agents helping you).
Keep a human-readable test case for every test. That’s the master copy. Your agent can help write it, but it can’t change it without your approval.
Let the agent write the test scripts. Link each script to its test case, one to one. Then ask one question of each. Does this script check what its test case says it should?
Now the agent can’t quietly rewrite the rules. And a script that passes while checking nothing has a test case to be measured against.

Keep the broader checks
Handing over the regression tests doesn’t mean everything sits in the agent’s view.
You just want to identify and hand over the regression tests that are key to the code that needs writing and modifying.
That identification process is a topic for another day. It’s important though.
Write the new tests for the change up front, and hand those over too.
Identify a handful of regression tests to use during the coding. Run the full regression pack at the end.
And then ALSO add end-to-end scenarios into the mix too.
Possibly add some agent exploratory testing at the end too.
Meeting the building regs doesn’t give you a nice extension. That’s what the scenarios and the exploratory testing are for.
This is the key point though… identifying the different types of testing techniques and using the right one in the right place.

Hold out or hand over

A broad check on the finished product, like an end-to-end scenario. Hold it out.
A rule about behaviour that must not change, like a regression test. Hand it over, and have your agent read it before it designs anything.

