DEV Community

Pini Solomon
Pini Solomon

Posted on

Why Your AI Agent Needs a Constitution (Not Just a Prompt)

I've been running an autonomous AI agent for 48 hours. It manages my content pipeline, scans for freelance leads, and reports via Telegram. Along the way, it's made every mistake in the book.

The fix wasn't better prompts. It was a constitution.

The Problem With Prompts

Most people build AI agents like this: "You are a helpful assistant. Research topics, write articles, and find leads."

This works for about 10 minutes. Then the agent does something you didn't anticipate — like applying to a job that requires gender verification, or burning through a platform's rate limit in 90 minutes, or posting comments that get shadow-removed because it doesn't understand karma.

Prompts tell an agent what to do. They don't tell it when to stop.

What a Constitution Looks Like

After watching my agent make mistake after mistake, I built a governance framework. It's not code — it's a markdown file with three sections.

Section 1: The Traffic Light System

Every possible action gets a color:

GREEN — Do it autonomously: Research, drafting content, updating internal memory, analyzing data.

YELLOW — Do it, but tell me: Publishing on approved platforms, changing content topics, starting new experiments.

RED — Stop and wait for my approval: Creating accounts, contacting any person, spending any money, applying to any job.

The pattern is simple: data operations are GREEN, human interactions are RED.

Section 2: Memory Rules

The agent maintains 8 files tracking state, earnings, content, leads, and more. The critical rule: the daily journal is append-only. Even if every other file gets corrupted, the journal preserves the full history.

This has already saved me when the agent overwrote its own state file mid-cycle.

Section 3: The Guardrails

Ten things the agent must never do: Never spend money. Never contact people without approval. Never spam. Never mislead. Never share personal info. Never plagiarize. Never bypass platform rules. Never assume approval. Never store passwords. Never make get-rich-quick claims.

These aren't suggestions. They're hard constraints that override everything else.

The 3 Questions Test

Before your agent takes any action, it should answer three questions:

  1. Is this reversible? If yes, GREEN. If no, at least YELLOW.
  2. Does this involve another human? If yes, RED. Always.
  3. Could this create a legal or financial obligation? If yes, RED. No exceptions.

If your agent can't answer these questions about a given action, the action is RED by default.

What I Got Wrong

Even with a constitution, I made errors:

  • I didn't include platform-specific rules (karma requirements, rate limits)
  • I didn't build in a "check before acting" step for social platforms
  • I underestimated how fast the agent would exhaust all GREEN tasks

The constitution is a living document. After 31 cycles, it has 18 amendments. That's not failure — that's the system working as intended.

Try It Yourself

If you're building an AI agent, start with the constitution before you write the first prompt:

  1. List every action your agent might take
  2. Assign each one a color (GREEN/YELLOW/RED)
  3. When in doubt, make it RED
  4. Add an append-only journal
  5. Review and amend after every failure

Your agent doesn't need to be perfect. It needs to fail safely.


Part of an ongoing experiment: building an autonomous AI agent with zero budget, documenting everything with real numbers. 31 cycles in, $0 earned, 18 lessons learned. The system works. The revenue is still a human problem.

Top comments (0)