Checking AI-Drafted Blueprints Before a Human Reads Them

By Chirag Panchal · Founder & Lead Architect · · 7 min read

How every blueprint the AI assistant drafts is validated by its engine, then linted and security-scanned in a pinned, offline toolchain (TFLint, Trivy, the Bicep linter, cfn-lint and Pulumi language checks), and for Pulumi actually previewed with no credentials, before a person reviews it. Failed checks are sent back to the model with the relevant documentation, and a draft that still fails is never passed off as valid.

Development Status & Architectural Evolution: InfraOrcinus is in active development. Architecture specifications, internal interfaces, and operational protocols described herein reflect our current engineering design and are continuously refined to make InfraOrcinus robust, resilient, and enterprise-grade.

A model that writes infrastructure code will, sometimes, write code that does not work, or that works and is insecure. The usual outcome is that a person finds out when they read it, or worse when the first plan fails.

InfraOrcinus puts a set of automated checks between the model and the reviewer. A draft that fails is sent back to the model with the failure and repaired, and the person only ever reads a draft that has already passed the checks, or one that is clearly labelled as not having passed. This article describes the checks, the order they run in and why, and what they cannot tell you.


1. The Order Is the Design

Checks run from cheap and local to expensive and remote, and each stage runs only if the earlier ones passed. A result from a tool is meaningless, and slow, on a draft that does not even parse.

  1. Structure. Are the expected files present and well formed for this engine?
  2. References. For Terraform and OpenTofu, does every var., local., module., data. and resource reference point at something declared? This is done in-process, so a draft is repaired even when no runner is available to run terraform validate.
  3. Policy pre-check. The draft is turned into a plan-shaped input and evaluated against the enabled policies, without recording anything. A policy violation is found while the model can still fix it.
  4. The engine's own validator. terraform validate, az bicep build, a CloudFormation parse, or the Pulumi preflight. Like terraform validate, none of this needs cloud credentials.
  5. Lint and security scan, only once the engine accepts the draft (next section).
  6. Pulumi dry run, last, for Pulumi drafts only (section 3).

Checks that cannot run because an earlier one failed are shown as skipped, with a note, not as passed.


2. One Pinned, Offline Toolchain

Static analysis runs in a single container image, pinned by version: TFLint with the AWS, Azure and Google rule sets baked in, Trivy for security misconfiguration, the Bicep linter, cfn-lint for CloudFormation, and linters for Pulumi's TypeScript and Python programs (Go, .NET and Java use their own pinned images).

Three decisions are worth knowing:

  • Everything works offline and without credentials. Plugins and rule sets are inside the image, so a draft never causes a fetch of a tool at check time. The one exception is installing a Pulumi program's own packages, which needs the package registry and nothing else.
  • All tools run as one runner task. A task's timer starts when it is queued, so two tasks on a single-worker runner would spend one budget waiting. Each tool has its own time limit inside the task and reports its own section, so one broken or slow tool never hides the others' findings.
  • Images are replaceable. An operator can point each image at a private mirror or a digest-pinned build.

What fails a draft

Linters report problems; the security scanner reports findings with a severity. A finding at or above a configurable threshold fails the draft, and the default is HIGH. Lower findings are shown as warnings, and the threshold can be set to report everything as a warning. An operator can also list rule IDs to ignore. One is ignored by default: the rule that wants a customer-managed encryption key on every storage bucket, because acting on it would add keys, and their cost, to every draft that never asked for one.


3. For Pulumi, Run the Program

A Pulumi blueprint is a program, and static checks cannot see what a program does when it runs: an exception while building resources, an SDK call that does not exist, a dependency that cannot be installed, a property the provider rejects. These used to surface at the first real plan.

So the last check is a real pulumi preview of the draft, with a safety model built around the fact that it executes the program:

  • It runs in the same pinned Pulumi image the real plan uses for that language, so the CLI version matches.
  • It uses a throwaway local state inside the container, with a random per-task passphrase, so nothing outlives it.
  • It holds no real credentials. Cloud providers get obviously fake ones, enough to start and report what they would create.
  • It runs in the hardened runner container, in its own runner pool, so an operator can serve it from a runner that is nowhere near cloud credentials.

A failure caused by the program goes back to the model. A failure caused by what a dry run cannot have (credentials, the cloud, the network) is a warning and never blocks. Verdicts that depend only on the files are remembered briefly so asking again does not repeat the run.


4. The Repair Loop

When a check fails, the model is not just told "it failed". It is handed the failing finding plus the documentation of the resources the failure is about, fetched from the engine's own registry. The model never calls a tool to get it. The code decides what to fetch, which keeps it bounded and testable and means it works with local models that cannot call tools. Fetched documentation enters the prompt as delimited reference data, not as instructions.

The model gets three attempts by default, configurable up to five, because every attempt resends the whole conversation and cost grows faster than attempts. The same loop applies when a person asks to change an existing blueprint: the model returns only the files it changes, and everything else is kept exactly as it was.


5. A Draft That Does Not Pass Is Never Dressed Up

If the attempts run out and a check still fails, the draft is returned with its failing checks, not quietly marked valid. The evaluation scenarios shipped with the product include exactly this case, an unfixable draft that must never be passed off as valid, and another where a disallowed container image is repaired. A person then decides whether to fix it by hand, ask again or discard it.


6. What the Checks Cannot Tell You

  • They check correctness and common security rules, not intent. A draft can pass every check and still build the wrong thing. That is why a person reads it, and why every apply still waits at the approval gate.
  • Offline means partial. A data source or an authentication path that needs the real cloud cannot be exercised, and the dry run says so as a warning.
  • A check that did not run is not a pass. If there is no runner, the dependent checks report skipped, and a person should read the report rather than the colour.

Summary

AI-drafted blueprints pass through a fixed sequence: structure, references, policy, the engine's validator, lint and security scan in a pinned offline image, and for Pulumi a credential-free preview. Failures are repaired with the failing finding and the right documentation, within a small attempt budget, and a draft that still fails is returned as failing. The result is that a reviewer's time goes to intent and design rather than to syntax and obvious misconfiguration.