Talk to us
Back to Blogs
Research16 min read

Why AI coding guidelines fail, and what habit-level evidence looks like

Evaluate AI coding habits against rollbacks and security findings before policy changes, then keep testing as tools and workflows evolve.

Written by

Key takeaways

  • Treat a behavior associated with better outcomes as a hypothesis to test.
  • Compare results while accounting for uncertainty, workload and other changes.
  • Keep established security safeguards in place while evaluating additional habits.

AI coding guidelines are harder to assess when they prescribe behaviors without measuring what happens after your team follows them. If your organization has adopted AI coding tools and written guidelines to govern them, you have probably already hit this wall: the guidelines exist, but you cannot answer whether following them reduces bugs, rollbacks, or security findings.

A working guideline system starts with observing a habit that reduces incidents, sandboxing it with one team through a proving window, and promoting it to policy only when the data justifies the organizational overhead. Everything else is vibe-coding dressed up as governance.

What you will get from this article: a repeatable three-stage loop (detect, sandbox, promote) for turning developer behaviors into evidence-backed policies, a worked example showing how the loop plays out end-to-end, and a checklist for assessing where your current guidelines stand.

Why do AI coding guidelines collapse under their own weight?

Guidelines proliferate faster than teams can adopt them because they originate from anxiety rather than evidence. A vendor publishes a prompt injection taxonomy, a conference talk warns about context window leaks, and platform teams respond by drafting twenty-page documents that nobody reads. The guidelines themselves may be technically sound, but they arrive without proof that following them prevents the specific problems your organization encounters. Without that proof, engineers may treat them as suggestions, and auditors may struggle to see them as working controls. The gap between “we have guidelines” and “we measure adherence and correlate it with outcomes” is where governance theater lives.

The NIST AI Risk Management Framework’s Measure function addresses a related need: it calls for tools and methods to assess and monitor AI risk and related impacts. MEASURE 1.1 of the voluntary AI RMF 1.0 (published January 2023) recommends that organizations select measurement approaches for their most significant AI risks and document which risks cannot yet be measured. Most AI coding guidelines skip straight to prescription without establishing the measurement infrastructure that would prove their value or reveal their irrelevance. (NIST AI RMF 1.0)

What does a habit-level evidence loop actually contain?

A habit is a repeatable developer behavior that either increases or decreases the likelihood of a production incident. Habits worth governing show up in session telemetry: pasting file references instead of re-attaching full files, trimming context before starting a long session, tagging a prompt with a ticket number, or reviewing AI-generated code in a separate pass rather than accepting it inline. The evidence loop has three stages: detect, sandbox, promote.

Detect

Detect means identifying a candidate habit from real session data. For example, you might observe that engineers who paste file paths instead of uploading entire codebases to a chat session produce fewer token-limit errors and fewer instances of the model hallucinating APIs from outdated context. You have timestamps, session IDs, and outcome flags (did this session result in a rollback, a security finding, a support ticket?). The habit is not invented by a committee; it emerges from what already works in your environment.

Sandbox

Sandbox means running a proving window with a single team. You make the habit explicit, instrument it, and track whether the team’s incident rate changes over a period chosen for the outcome frequency and sample size. The sandbox is not a pilot; it is a controlled experiment. You need a baseline (the team’s prior incident rate), a treatment period (they adopt the habit), and a comparison group (another team of similar size and risk profile that does not adopt the habit). If the sandbox team’s incident rate drops and the comparison group’s does not, you have evidence. If both drop, investigate shared changes and other explanations. If neither drops, the study may show no benefit, or it may lack enough observations to detect one.

Promote

Promote means converting the habit into an organization-wide policy only when the sandbox data justifies the overhead. Promotion includes enforcement (automated checks, peer review checklists, guardrails in the AI platform) and ongoing measurement (does the org-wide incident rate improve?). Policies that survive promotion are the ones where the cost of enforcement is lower than the cost of the incidents they prevent. Everything else stays in the sandbox or gets discarded.

Detect: Identify a candidate behavior. Sandbox: Compare outcomes and uncertainty. Decide: Promote, refine or retire.
Detect: Identify a candidate behavior. Sandbox: Compare outcomes and uncertainty. Decide: Promote, refine or retire.

Why does the vibe-coding backlash make this urgent now?

The backlash against AI-assisted coding has less to do with the technology than with the absence of measurement. An engineering organization that adopts AI tools quickly and drafts guidelines after early incidents can find, months later, that it cannot answer basic questions: Did the guidelines reduce bugs? Did they slow velocity? Which guidelines matter and which are cargo cult? The vibe-coding critique is that we are governing by intuition and calling it rigor.

This matters because the next wave of AI adoption depends on proving that the first wave was controlled. Boards want to expand AI use to customer-facing systems, but they need evidence that internal coding use is already governed. Your review should connect the control to its intended outcome and the evidence you actually have. An experiment can inform that assessment; it does not, by itself, establish compliance.

How do teams typically govern AI coding today, and where does each approach break?

Blanket prohibitions

Blanket prohibitions are the easiest to write and the hardest to enforce. “No pasting proprietary code into public models” is a reasonable rule, but without session telemetry you cannot verify compliance, and the rule still needs enforceable access controls and a way to check adherence. Engineers can route around blanket bans using personal accounts or unsanctioned tools, which moves the risk out of view.

Checklist-based reviews

Checklist-based reviews add a step to pull requests: “Did you review AI-generated code for hallucinated dependencies?” Checklists work when the habit they encode has been proven in a sandbox and the cost of checking is low. They fail when the checklist grows to thirty items, none of which are tied to measured outcomes, and engineers start checking boxes without reading the questions.

Vendor-provided best practices

Vendor-provided best practices arrive as PDFs or onboarding decks. They are generic by necessity, because the vendor does not have your session data or your incident history. A vendor might recommend “always validate AI-generated SQL queries,” which is sound advice but not evidence that your team’s SQL-related incidents stem from AI generation rather than manual errors. Adopting vendor practices without sandboxing them first is outsourcing your measurement obligation.

Post-incident guidelines

Post-incident guidelines are reactive: an engineer pastes an API key into a chat session, the key leaks, and the platform team writes a rule against pasting secrets. This approach captures real risk, but it writes the rule before measuring whether the rule prevents recurrence. Keep established protections against secret disclosure in place while evaluating how additional checks improve adherence. A study is not a reason to delay a known security safeguard.

Start by instrumenting AI coding sessions to capture structured telemetry: session start and end times, token counts, file references versus full file uploads, whether the session included a code review step, and whether the session output was committed, reverted, or flagged in a security scan. Keep this data at the individual session level, because a habit happens in individual sessions and org-wide averages can hide which sessions show it.

Next, analyze the telemetry to identify candidate habits. Look for behaviors that correlate with better outcomes. As a hypothetical example, your telemetry might associate a particular context-preparation habit with fewer corrections. Treat that association as a hypothesis for evaluation, not evidence that the habit caused the improvement.

Choose a proving window and sample size that fit the frequency of the outcomes you are measuring. Make the candidate habit explicit: “Before starting a session longer than ten prompts, trim your context to the files directly relevant to the task.” Instrument the team’s sessions to confirm they are adopting the habit. Track their incident rate (rollbacks, security findings, production bugs traced to AI-generated code) and compare it to a similar team that does not adopt the habit. Define your decision criteria before the study. Assess uncertainty, workload differences and other changes alongside any observed improvement.

Promote the habit to an organization-wide policy by encoding it in your AI platform. This might mean a guardrail that prompts engineers to review their context window size before long sessions, a linter that flags sessions with more than fifty files attached, or a peer review checklist item that asks “Did you trim context before generation?” Promotion includes ongoing measurement: you continue tracking org-wide incident rates and session telemetry to confirm that the policy delivers the expected benefit at scale.

Discard habits that do not survive the sandbox. If trimming context does not reduce incidents, or if the overhead of trimming is higher than the cost of the incidents it might prevent, the habit stays in the sandbox or gets dropped. The evidence loop is a filter, not a rubber stamp.

Before the change: Record outcomes and workload. During the evaluation: Track adoption and comparison conditions. Assess the result: Check uncertainty and other explanations.
Before the change: Record outcomes and workload. During the evaluation: Track adoption and comparison conditions. Assess the result: Check uncertainty and other explanations.

Where does an AI control plane fit into the habit loop?

An AI control plane provides the instrumentation and enforcement infrastructure that makes the habit loop operational. Without telemetry from real coding sessions, you cannot detect candidate habits because you do not know what behaviors are occurring. Without policy enforcement at the platform level, you cannot promote habits to organization-wide controls because you are relying on individual discipline rather than systemic guardrails.

moring’s AI Control Plane instruments the coding agent itself through lightweight hooks on the developer’s machine. Each habit ships as a detector: when an engineer re-attaches a file instead of referencing its path, or starts a long session without trimming context, the detector fires and the event syncs to the platform. Detection runs where the behavior happens, and the platform sees habit events (not prompt contents, not source code). That boundary matters as much to engineers as it does to security review.

Every habit begins in a sandbox with its own proving window. During the window the platform records how often the habit fires and on which teams, so those events can be compared with each team’s rollback and security-finding outcomes. That evidence, rather than a committee vote, decides whether the habit is promoted to policy or discarded. Once promoted, the same hook that detected the habit starts nudging at the moment the behavior occurs, and engineers comply because the habit is proven rather than aspirational.

The control plane also closes the loop by tracking whether the promoted policy continues to deliver the expected benefit. If org-wide incident rates do not improve after promotion, or if the policy introduces new friction that offsets its value, you have the data to revise or retire the policy. Ongoing measurement feeds the next round of detection. A policy that stops paying off returns to the sandbox for refinement or gets discarded.

For teams managing AI-assisted software delivery more broadly, moring’s AI-DLC governs how coding assistants and engineering agents participate in each change, connecting context, models, tools, evaluations, and release controls into one reviewable record.

What does a worked example look like end-to-end?

The numbers below are illustrative, a composite of how the loop plays out, not a client case study. Imagine a platform team at a financial services company noticing that 15% of production rollbacks in a given quarter trace back to AI-generated code that introduced breaking changes to internal APIs. They review session telemetry and observe that engineers who paste API documentation links (rather than uploading full API spec files) into their AI sessions produce code with fewer breaking changes. The correlation is strong but not yet causal.

They run a sandbox with an eight-person team working on payment services. The habit: before generating code that calls an internal API, paste a link to the API docs in the internal wiki rather than uploading the OpenAPI spec file. The sandbox runs for six weeks. The share of the treatment team’s deployments that are rolled back drops from 12% to 5%. A comparison team of similar size working on a different service, which does not adopt the habit, maintains a rollback rate of 11%. The difference warrants investigation; these illustrative percentages alone cannot establish statistical significance.

The platform team promotes the habit to a policy: the AI control plane now surfaces a reminder when an engineer uploads an API spec file, suggesting they paste a documentation link instead. The reminder includes a one-line explanation: “Uploaded spec files can be out of date; a link to current API docs can provide fresher context if the assistant can retrieve and read the page.” Over the next quarter, the share of production rollbacks traced to AI-generated API changes drops from 15% to 7%. The policy cost is a single reminder prompt. Because the org-wide drop has no comparison group, the team treats it as supporting evidence and keeps measuring before calling the policy proven.

Six months later, the team reviews the policy’s ongoing performance. The share of rollbacks traced to AI-generated API changes has plateaued at 7%, which prompts the team to review the policy alongside other changes to its services and tooling. They detect a new candidate habit from telemetry: engineers who run a local integration test before committing AI-generated API calls have even lower rollback rates. The habit loop begins again.

Candidate habit: Check that API context is current. Evaluation: Compare outcomes and review effort. Ongoing review: Revisit the habit as conditions change.
Candidate habit: Check that API context is current. Evaluation: Compare outcomes and review effort. Ongoing review: Revisit the habit as conditions change.

Checklist: Is your AI coding guideline system evidence-backed?

  • You have session-level telemetry (timestamps, token counts, file references, outcome flags) for your AI coding tools
  • You can identify at least one developer behavior that correlates with fewer rollbacks or security findings in your data
  • You have run at least one controlled sandbox with a treatment team and a comparison group
  • Your most important guidelines trace back to a sandbox result, not a vendor PDF or committee decision
  • You track whether promoted policies continue to reduce incidents after org-wide rollout
  • You have a process for retiring guidelines that do not survive ongoing measurement

If you cannot check most of these boxes, your guidelines are likely still aspirational. This approach can support a discussion about risk measurement under the voluntary NIST AI RMF, and it does not amount to a compliance certification. Guidelines that survive this loop are the ones worth enforcing. Everything else is noise.

Frequently asked questions

How long should a sandbox proving window run?

Choose the duration from the event frequency, sample size and effect you need to detect. No fixed number of weeks guarantees statistical significance. Rare incidents may require longer observation or additional evaluation methods.

What if a habit shows correlation but the sandbox fails to prove causation?

Discard it or refine the hypothesis. Correlation in aggregate telemetry often reflects confounding variables: teams that paste doc links might also be more senior, more careful, or working on lower-risk services. A well-designed sandbox helps distinguish the habit from those variables, but residual confounding can remain. If the sandbox shows no effect, revisit sample size, adoption, confounders and the original hypothesis before deciding what the result means.

Can you run multiple sandboxes in parallel?

Yes, but keep them orthogonal. If you sandbox “trim context” with one team and “paste doc links” with another, you can measure both independently. If you sandbox two habits with the same team simultaneously, you cannot isolate which habit drove the outcome. Sequence them or use separate teams.

How do you handle habits that reduce incidents but increase friction?

Measure both. If a habit cuts rollbacks by 50% but adds five minutes to every session, calculate the cost trade-off: is five minutes per session cheaper than the cost of a rollback (incident response time, customer impact, reputational risk)? Promote the habit only if the benefit exceeds the friction cost. If the trade-off is marginal, refine the habit to reduce friction before promoting.

What role does the NIST AI RMF play in this approach?

NIST AI RMF 1.0 (January 2023) MEASURE 1.1 recommends that organizations select measurement approaches for their most significant AI risks and document which risks cannot yet be quantified. The habit-level evidence loop is one way to act on MEASURE 1.1: each habit becomes a measurable behavior, and its effect on incident rates becomes the evidence for or against a promoted policy. The NIST Generative AI Profile (NIST AI 600-1, July 2024) extends this to GenAI-specific risks including hallucination, data leakage, and prompt injection. The habit loop applies to all of these. (NIST AI RMF 1.0)

How does this relate to AI-DLC?

The habit-level evidence loop governs individual developer behaviors during AI coding sessions. AI-DLC governs the full software delivery lifecycle: it connects coding assistants and engineering agents to approved context, models, and tools, then records how each change is evaluated, approved, and released. The two are complementary. Habit governance answers “which behaviors reduce incidents during a session?” AI-DLC answers “how do we control and record everything that happened between task definition and production release?”

Does this approach apply outside software engineering?

The detect-sandbox-promote loop applies to any AI-assisted workflow where you can instrument behavior and measure outcomes. Software engineering is the clearest case because session telemetry is technically accessible and incident rates are measurable. For other workflows, the same logic holds: identify a candidate behavior from real data, run a controlled proving window, promote only when the evidence justifies it.

To discuss how your team governs AI-assisted software delivery, explore moring’s AI-DLC approach or bring your workflow to a workshop.

Sources and scope

The habit loop is the author’s proposed approach. The worked example is illustrative, not measured customer evidence. For the wider architecture, see where an AI control plane fits.

AI coding guidelinesAI coding agentssoftware engineering governancedeveloper workflowsAI evaluation