You know what the guardrail should be: block unencrypted S3 buckets, or require a second approval before anything touches production. Getting it into Rego is where the afternoon goes. You ask an AI to write it and paste the result into the policy editor, where it fails because the draft referenced a field that doesn’t exist in the policy input or mixed Rego v0 and v1 syntax in one body. You copy the error back into the chat, paste the next attempt, and go around again, with no way to know the policy makes the right call until a real run hits it.
The policies already in your account aren’t much easier. Nobody wants to touch the one someone wrote months ago, and when a run sits waiting on approval, figuring out why means reading Rego. Every new guardrail ends up waiting on whoever on your team knows the language best.
Fixing this takes an assistant that checks its work against the same policy contract Spacelift evaluates against, before you see a single line. Infrastructure Assistant now does that. It writes and tests policies against the real input schema before handing them over, and it explains the policies you already have.
Infrastructure Assistant has a new read-only tool that fetches the input schema for any policy type, pulled straight from the policy contract Spacelift maintains. Each policy type gets its own input document, and the Assistant reads that shape before it writes a line. A plan policy draft uses input.terraform.resource_changes for proposed changes and input.spacelift.run for run context. An approval policy draft reads reviews from input.reviews.
A second read-only tool evaluates a draft against a sample input and returns either the compile errors or the decision the policy produced. The Assistant runs that loop on its own, drafting, evaluating, reading the result, and fixing until the policy compiles and returns the decision you asked for. Only then does it hand you the body.
For anything headed to production, ask for both sides of the rule: Before you save it, test it against a plan that creates an unencrypted bucket and one with an encrypted bucket, and show me both decisions.
You see each decision in the chat before anything is saved, so a rule that blocks the wrong bucket gets caught there instead of in a stalled run.
After the policy goes live, the policy workbench picks up from there. Turn on sampling and it captures real evaluations from your runs, so you can simulate changes against your own inputs.
New policies are written in Rego v1, which Spacelift recommends. On an existing v0 policy, the Assistant states which version it’s writing in and keeps v1 constructs like if, contains, and import rego.v1 out of the body. The policy keeps running as v0 until you decide to migrate it.
Understand any policy from its own page
Every policy page now has an Ask button. It opens Infrastructure Assistant in Ask mode, scoped to that policy, with a prompt ready for you to edit. Point it at the policy nobody remembers writing:
What does this policy do, and what breaks if I delete it?
Or use it to unstick a run:
Why is this run waiting on approval, and who can approve it?
The Assistant answers from the policy body and the run itself, so you get the specific reason and the people who can move it forward.
Schema lookup, evaluation, and Ask all run in Ask mode. None of them save anything, so there’s no approval prompt. Creating or editing a policy requires Build mode, so nothing changes in your account until you switch into it.
Go to Policies > Create policy and select Create with Infrastructure Assistant. It opens Build mode with a starter prompt. Add the outcome you want:
Block unencrypted S3 buckets.
Answer the Assistant’s questions, and it picks the policy type and creates a tested policy in Spacelift. Add the test request from above if you want to review both decisions before it saves.
There’s nothing to set up. Open Policies, select Create policy > Create with Infrastructure Assistant, and describe the guardrail you want. Or open the policy you’ve been avoiding and click Ask.
Read the policy docs for the full reference on policy types and their inputs.
Tim Davis
Tim is the Technical Product Marketing Manager for Spacelift. He has years of experience in infrastructure, operations, and automation. He has been a speaker at numerous global conferences, created and managed technical communities, and created a large array of technical content over the years.











![How to Import Existing Resources to OpenTofu [Tutorial]](/_next/image?url=%2Fapi%2Fuploads%2Farticles%2F959228ac34584bfc1a7416d4541e12d8.webp&w=1920&q=75)
