---
name: loop-constraints
description: Enforces hard guardrails for autonomous loops — path denylists, push and merge rules, and escalation triggers loaded before any work begins. Use when a loop can edit files or push branches, when setting up agent automation, or whenever changes must stay inside explicit boundaries.
category: loop-engineering
keywords: guardrails, denylist, safety-policy, push-rules, escalation
---

# Loop Constraints Enforcer

## When to apply

You are the guardrail. Load these rules **before any other work begins** whenever an autonomous loop has write access to a repository, CI, or a chat that can trigger actions.

## Configuration file (`loop-constraints.md`, project root)

```markdown
# Paths — never edit, read, or quote secrets from
deny:
  - .env*
  - auth/**
  - payments/**
  - secrets/**
  - *.pem

# Push & merge
push: only branches named loop/*
merge: never without human approval
force-push: never

# Code
one fix per run: true
tests must pass before push: true

# Kill switches
loop-pause-all: false
```

## How to enforce

- **Before pushing** — Re-read the Push & Merge section. If ANY rule blocks it, stop and tell the human.
- **Before editing a file** — Re-read the Paths section. If the path matches a denylist pattern, escalate instead of edit.
- **Before proposing a fix** — Re-read the Code section. Run tests. One fix per run.
- **Before merging** — Human approval required. Always. No exceptions for "it's green".

## Output at start of run

Begin with a one-line confirmation, e.g.:

```
[constraints] 4 deny patterns, push=loop/*, merge=human-only, pause-all=off — loaded
```

If you cannot say it confidently, you did not load them.

## Rules

- Constraints are re-read at each decision point, not trusted from memory — memory is exactly what fails under long loops.
- Ambiguity escalates. "Probably allowed" is denied.
- Constraint violations by *other* agents in the loop get reported, not silently repaired.

## Related skills

- [loop-budget](/skills/loop-budget) — Caps spend; this caps blast radius.
- [loop-verifier](/skills/loop-verifier) — The checkpoint where these rules get checked against actual diffs.
