Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Stop fighting rego infrastructure assistant now writes and tests your policies
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Stop Fighting Rego: Infrastructure Assistant Now Writes and Tests Your Policies

Source: Spacelift•November 25, 2026 at 03:15 PM

Stop Fighting Rego: Infrastructure Assistant Now Writes and Tests Your Policies

Describe the rule you want and Infrastructure Assistant drafts, tests, and enforces the policy before handing it over.

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.

← All articles

What this article says

More in Cloud & Infrastructure

All →
How “don’t ask again” in Claude Code leaks secrets on GitHub: The click that keeps on giving
Sysdig

How “don’t ask again” in Claude Code leaks secrets on GitHub: The click that keeps on giving

Introducing Search for Agents
Cloudflare

Introducing Search for Agents

Amazon and Meta reportedly in talks to lift blockade on AI agent MuseПресса
Amazon

Amazon and Meta reportedly in talks to lift blockade on AI agent Muse

JFrog and Pluto Partner Together on AI Supply Chain Security
JFrog

JFrog and Pluto Partner Together on AI Supply Chain Security

Alert Fatigue: Why It Happens and How AIOps Fixes It
New Relic

Alert Fatigue: Why It Happens and How AIOps Fixes It

Generative AI Monitoring: What to Track Once LLMs Are in Production
New Relic

Generative AI Monitoring: What to Track Once LLMs Are in Production

More from Spacelift

OpenTofu Management Platforms: Features and Top Options
Spacelift

OpenTofu Management Platforms: Features and Top Options

Spacelift vs GitHub Actions: Key Differences
Spacelift

Spacelift vs GitHub Actions: Key Differences

Spacelift vs Terraform Enterprise: Features & Pricing Comparison
Spacelift

Spacelift vs Terraform Enterprise: Features & Pricing Comparison

Spacelift Puts OpenTofu Run Observability to Work for Platform Teams
Spacelift

Spacelift Puts OpenTofu Run Observability to Work for Platform Teams

How to Import Existing Resources to OpenTofu [Tutorial]
Spacelift

How to Import Existing Resources to OpenTofu [Tutorial]

What Is the OpenTofu MCP Server and How to Use It
Spacelift

What Is the OpenTofu MCP Server and How to Use It