Everyone's rushing to measure AI code gen productivity. Lines per hour. Stories per sprint. Great.
But I've yet to see a single team track the *security review tax*. The model suggests a function, you accept it, then spend 45 minutes in a PR review unpicking it because it's a minefield of:
* Hardcoded credentials patterns masked as "example values"
* SQL concatenation instead of parameterized queries
* Overly permissive file system calls
* NPM package suggestions with known CVEs
The "cost saving" gets wiped out by the senior dev and security engineer time spent auditing every single suggestion. The velocity graph looks fine until you factor in the incident response spike next quarter when one of these patterns slips through.
You're not getting a junior dev. You're getting a junior dev who is impossibly confident and has memorized every bad StackOverflow answer from 2012.
—dw
Trust but verify.
You're absolutely right about the hidden audit cost. I've seen this manifest in infrastructure code, where Terraform modules generated by AI tools routinely ignore state isolation and suggest monolithic outputs with zero secrets management. The tools pull from public examples that use `local_file` for sensitive outputs instead of proper SSM parameters or vault integrations.
The deeper problem is that AI-generated code lacks architectural intent. It solves the immediate functional requirement while disregarding the surrounding control plane. That missing context is exactly what senior reviewers must reconstruct, and that's where the 45 minutes gets burned.
We need to shift from measuring raw output to measuring "secure, context-aware suggestions per hour." Otherwise we're just automating the creation of technical debt.
infrastructure is code
Good point on infrastructure code. Have you seen any tools that let you set security and architecture guardrails upfront? Like a policy file the AI has to adhere to, so it won't even suggest a local_file for secrets.
If not, that missing feature feels like a pricing blind spot. Vendors talk about cost per line, but what's the cost of configuring and enforcing these guardrails? That's a new subscription tier waiting to happen.
I haven't seen guardrails integrated directly into the generation tool itself. The pattern I've encountered is a secondary enforcement layer, which adds its own overhead. For example, you might use a pre-commit hook running a tool like checkov or tfsec on the AI-generated Terraform, but that's just shifting the audit cost earlier in the cycle. The model still wasted tokens suggesting the insecure pattern.
What you're describing is essentially policy-as-code for the AI's *prompt*, not just its output. That's a significant architectural challenge. The policy would need to be context-aware enough to understand whether a `local_file` is for a trivial config versus a secret, which circles back to the original point about missing architectural intent. The vendor cost for building that would be substantial.
A more immediate, though clunky, mitigation is embedding your security constraints directly into the initial prompt. It's tedious and often forgotten, but it can reduce the suggestion noise.