Get started

How we monitor for compliance drift

A daily sweep checks resources against policy for public buckets, untagged resources, and over-broad roles, files findings, and proposes remediation as a reviewed change rather than applying it.

Written by
The OpenChatly Team
Published
June 3, 2026
Reading time
6 min read
Topics
Security, Case Study, Enterprise

Infrastructure drifts out of compliance quietly. A bucket gets made public for a one-off, a resource ships without its tags, a role picks up a permission it no longer needs. Each change is small and reasonable in the moment, but they accumulate, and nobody notices until an audit or an incident surfaces them all at once. By then reconstructing when each drift happened is hard.

We handle this by checking the infrastructure against policy every day, so drift surfaces the day it appears. This writes up how we run that on Kortix — the connections, the steps, and the guardrails — so you can set up the same sweep.

Team
Kortix
Trigger
A daily scheduled sweep
Connected systems
AWS · Audit logs · Slack
Mode
Cron-driven · Review-gated

The problem

The common approaches each have limits. A quarterly manual audit finds drift late and in bulk, when the context is hardest to recover. A fixed rules engine catches the checks it was configured for and nothing beyond them. And auto-remediation that fixes drift on its own can break a service that depended on the very configuration it "corrected."

We wanted the infrastructure checked against policy daily, with findings filed where the team already works and fixes proposed as reviewed changes rather than applied silently.

What we built

On Kortix, a daily schedule triggers an agent. Each sweep runs in its own isolated session — a cloud sandbox — with scoped, read access to AWS and the audit logs. The agent checks resources against policy — public buckets, untagged resources, over-broad roles — and files what it finds to Slack. Remediation is proposed as a reviewed change, never applied automatically.

How it works

1

Copy the setup prompt into a new session

Open your Kortix workspace, start a new session, paste this prompt and send it. The agent writes the agent file, the compliance-sweep skill and the daily trigger, and opens a change request for you to review. Prefer clicks? Choose Use this template instead.

Setup prompt

Set up a daily compliance monitoring agent in this workspace.

  1. Create the agent agents/compliance-monitoring.md. Its job is to check AWS against our compliance policy and propose fixes as change requests. It may use the AWS and Slack connectors. It only reads AWS.

  2. Create the skill skills/compliance-sweep/SKILL.md with these rules:

    • Read the policy from memory/compliance-policy.md on every run. If the file does not exist, start from the rules below and propose it.
    • No S3 bucket is public unless the policy allow-lists it by name.
    • Every resource carries the owner and environment tags.
    • No IAM role holds a full wildcard grant or an unscoped iam:PassRole.
    • For each finding, look up in CloudTrail when it changed and who changed it, then open a change request with the fix. Never apply a fix in AWS.
  3. Add a cron trigger daily-compliance-sweep to kortix.yaml. It runs the compliance-monitoring agent every day at 06:00 UTC with the prompt "Load the compliance-sweep skill, run one complete sweep, and post the findings to #security."

  4. Tell me which of these connectors are not connected yet.

  5. Open a change request with all of it. Do not merge it.

2

Connect your tools

Open Connectors in your workspace and connect AWS with read-only access and Slack. Credentials are brokered server-side and never enter the agent's machine.

AWS

Checks buckets, tags and IAM roles, and reads audit logs.

Or useGoogle CloudAzure
Required
Slack

Posts findings with their audit trail and proposed fixes.

Or useMicrosoft Teams
Required
Jira

Tracks each finding as a ticket for its owner.

Or useLinear
Optional
3

Run it once with this prompt

Merge the change request, then start a session with the compliance-monitoring agent and send this prompt. Review the change requests it opens before you let the schedule take over.

Prompt

Run one compliance sweep on AWS. Read only.

  1. Load the policy from memory/compliance-policy.md.
  2. List every S3 bucket and IAM role once, and check each against the policy: public buckets, missing required tags and over-broad roles.
  3. For each finding, look up in CloudTrail when it changed and who changed it.
  4. Open one change request per finding with the proposed fix. Do not apply any fix.
  5. Post each finding with its audit trail and change request link to #security, or one line if nothing drifted.
4

Let the daily schedule take over

The change request added this trigger to kortix.yaml. From now on the agent runs every day at 06:00 UTC, each run in a new session on its own cloud computer. To change the time, edit the cron line, or open Triggers in the workspace.

kortix.yaml
triggers:- slug: daily-compliance-sweep  name: Daily compliance sweep  on:    cron: "0 0 6 * * *"  run:    agent: compliance-monitoring    prompt: Load the compliance-sweep skill, run one complete sweep, and post the findings to #security.
5

Propose every fix as a change request

The agent only reads AWS. Each fix arrives as a change request with the diagnosis and the proposed change. A person reviews it, merges it and applies it. Nothing changes in AWS without that review.

6

Read the findings

Each run ends with one message in the channel. This is what a run looks like in the session:

Daily compliance sweep · 06:00
Load the compliance-sweep skill, run one complete sweep, and post the findings to #security.
Worked for 3m 26s
aws · list bucketsaws · get bucket policy status × 40aws · list rolesaws · lookup events × 3kortix · open change request × 3slack · post message → #security

Found 3 findings: 1 newly public bucket, 1 resource without the owner tag, and 1 role with a wildcard grant. CloudTrail shows when each one changed and who changed it. 3 change requests with the proposed fixes wait for review.

Illustrative example. Your findings depend on your AWS accounts.

The pattern

Run the sweep on a cron trigger, give the agent scoped read connectors into AWS and the audit logs, encode the compliance policy as skills and memory, and propose every fix as a reviewed change request rather than applying it.

Make it do more

Once it works, paste any of these into the same session.

Check security groups

Extend the policy to flag security groups that allow 0.0.0.0/0 on any port other than 443, in every region I list.

Weekly posture report

Every Monday, post the count of open findings by type to #security, and list the change requests that still wait for review.

Keep audit evidence

Each month, write a dated summary of every finding and its fix to memory/compliance-evidence.md for audit review.

Guardrails

Giving an agent a standing view of the infrastructure is a trust question. The relevant controls on Kortix:

  • Isolation. Every sweep runs in its own isolated sandbox on its own branch. The session is granted access only to what it's scoped to read, and only the findings it files are written back out.
  • Scoped secrets. Each credential is encrypted in the secrets manager, injected into the sandbox at runtime, and scoped to the agents you grant them to or the logs.
  • Human approval gate. Remediation is proposed, never auto-applied; a person reviews and applies each change.
  • Everything is code. The agent's persona, skills, and permissions are files in the repo — versioned and changed through a reviewed change request, not a dashboard setting.

The outcome

Infrastructure re-checked against policy every day
Daily
Drift caught before it accumulates for an audit
Same-day
Every fix proposed as a change, never auto-applied
Review-gated

The drift that used to surface in bulk at audit time now arrives as small daily findings in Slack, each with a proposed fix a person reviews before it's applied. The team reviews a change instead of reconstructing months of drift, and the infrastructure stays close to policy.

On this page

  • The problem
  • What we built
  • How it works
  • Make it do more
  • Guardrails
  • The outcome

Run this yourself

Install this exact setup — agent, connectors, schedule, and guardrails — in a guided flow.

More use cases.

  • How we handle GDPR data-subject requests on a deadline

    Legal·July 11, 2026

  • OpenChatly

    How we keep our docs in sync with the code

    Documentation·July 5, 2026

  • OpenChatly

    How we QA every pull request automatically

    QA·July 5, 2026

Own your AI.Start today, in our cloud.

Start for free

OpenChatly is the AI workspace for everything. One person directing, agents executing, from goal to finished work.

©2026 OpenChatly AI.沪ICP备2025124785号-5

Resource guide

  • Product overview
  • Skills marketplace

Terms of service

  • User agreement
  • Privacy policy

Contact us