constitutional
constitutional is a three-step pipeline inspired by Constitutional AI: generate initial output, critique it against a set of principles, then revise to comply.
When to use it
Section titled “When to use it”- Safe content generation (harmlessness, helpfulness, honesty checks)
- Style or brand guideline compliance
- Any task where output must adhere to a fixed set of rules
- Structured quality enforcement
File structure
Section titled “File structure”agents/my-constitutional/├── AGENT.md ← pattern: constitutional, config├── critique.md ← critique step: check against principles└── revise.md ← revise step: fix violationsAGENT.md
Section titled “AGENT.md”---name: safe-writerdescription: Generates content that adheres to safety and style guidelines.version: "1.0.0"pattern: constitutionalcall: model: role: writer---
Generate a helpful, informative response to the user's request.Be thorough and provide concrete examples where relevant.Call finish with key="done" and your response as value.critique.md
Section titled “critique.md”You are a compliance reviewer. You have received a generated response.
Evaluate it against these principles:1. **Accuracy** — no false claims or unsupported assertions2. **Clarity** — no jargon without explanation3. **Safety** — no potentially harmful instructions or content4. **Tone** — professional and respectful
For each violation, quote the problematic text and explain the issue.If there are no violations, say "COMPLIANT".
Call finish with key="done" and the critique (or "COMPLIANT") as value.revise.md
Section titled “revise.md”You have an original response and a compliance critique.
If the critique says "COMPLIANT", return the original response unchanged.Otherwise, revise the response to address every identified violation.
Make targeted fixes — don't rewrite what's already compliant.
Call finish with key="done" and the revised response as value.Scaffold
Section titled “Scaffold”tama add constitutional my-agentHow it works
Section titled “How it works”AGENT.md body → generate initial response ↓critique.md → check against principles, list violations ↓revise.md → fix violations, return compliant outputThree steps, always executed unconditionally. The revise step handles the “already compliant” case by checking the critique text.