Constraint Rules Engine
Persistent Rules for Persistent Agents
Instead of re-stating boundaries every session, users define persistent rules an agent must always follow — organized by category, individually toggleable. When the agent runs, every action is checked against the rulebook in real-time.
Framing
The problem
Agents drift when boundaries exist only inside one prompt.
The pattern
Represent rules as durable, inspectable constraints enforced at runtime.
Why chat breaks here
Prompt reminders are fragile, forgettable, and hard to audit.
Risks
Rigid rules can block sensible actions or become outdated.
Avoid when
The workflow changes so fast that lightweight guidance is enough.
Use when
Agents must respect durable boundaries that prompt reminders cannot reliably enforce.
DOPE evaluation
- Directability
- Toggle, edit, or add rules anytime — agent adapts immediately
- Observability
- All active rules visible in one place, enforcement shown live
- Predictability
- Same rulebook produces consistent agent behavior across sessions
- Explainability
- Rule enforcement is shown live with pass/fail reasons for each action
In the wild
- Cursor Rules (Cursor) — .cursor/rules/*.mdc as standardized format (legacy .cursorrules deprecated). Version-controlled, glob-scoped, type-tagged (Always/Auto-Attach/Manual), visible in the Cursor settings rules panel.
- Claude Code CLAUDE.md (Anthropic) — 4-tier hierarchy (~/.claude, project root, subdirectory, .local). Loaded at session start, viewable/editable as plain markdown. Auto Memory writes back to it.
- GitHub Copilot Instructions (GitHub) — .github/copilot-instructions.md (repo-wide) plus .github/instructions/*.instructions.md (path-scoped). Applied across GitHub.com, VS Code, Visual Studio. Promoted from preview to GA in 2025.
- AGENTS.md cross-tool standard (Open standard) — Emerging cross-tool convention used by Claude Code, OpenAI Codex CLI, and others. The file-based, version-controlled, hierarchically-loaded rules format is becoming a de facto standard.
FAQ
When should I use the Constraint Rules Engine pattern?
Agents must respect durable boundaries that prompt reminders cannot reliably enforce.
When should I avoid the Constraint Rules Engine pattern?
The workflow changes so fast that lightweight guidance is enough.
What problem does Constraint Rules Engine solve?
Agents drift when boundaries exist only inside one prompt.
Why is chat the wrong fit for this?
Prompt reminders are fragile, forgettable, and hard to audit.
Related patterns
- Often paired with: Autonomy Dial — Hard rules + soft delegation level give layered control over agent scope.
- Often paired with: Approval Gates — Rules block silently; gates pause for review when limits are close.
- Often paired with: AI Memory — Persistent rules sit beside persistent context, both visible and editable.