Active guardrails
How preset AI moves from passive guidance to active constraint enforcement for AI workflows.
Objective
Ensure AI-generated output is system-aligned by design, not corrected after drift appears.
Guardrail model
Active guardrails combine three moments:
- Constraints before generation: the agent reads what's allowed before writing
- Validation after generation: generated code is checked against rules
- Policy gates before apply: canonical writes are gated on approval
Together these create a controlled loop instead of ad-hoc assistant behavior.
Core guardrail layers
- Forbidden primitives and anti-pattern constraints
- Context-aware active constraints by file, intent, or surface
- Pre-generation validation checks
- Post-generation code validation and drift checks
- Mode-aware apply policy gates
Expected outcomes
- lower cleanup work after AI generation
- fewer policy violations entering PRs
- more predictable assistant behavior across teams
Integration guidance
Use guardrails as the default policy in AI-assisted coding flows:
- retrieve constraints first
- generate within constraints
- validate before commit or apply
- route unresolved cases into the proposal workflow
Relationship to compliance modes
Each compliance mode tunes how strictly guardrails block versus advise:
- Observe / Assist: emphasis on guidance and learning
- Guard / Enforce: stricter blocking and approval requirements
See Rule model for the underlying rule contract and Validation and confidence for how guardrail results feed scoring.
Last reviewed by @jschuyler