Skip to main content

Constitution Guide

The Constitution is Era's immutable governance layer. It defines the non-negotiable principles that AI agents must follow in all Era-governed projects.

Key Concept

Era Code operates on a two-tier governance model:

LayerMutabilityManaged ByPurpose
ConstitutionImmutableEraCore safety and security principles
DirectivesCustomizableYour teamProject-specific standards

The constitution always wins. Directives may extend but never contradict it.

Constitution Location

After running era-code init, the constitution lives at:

.era/memory/constitution.md

[!WARNING] Do not edit this file. It is Era-managed and will be overwritten on updates.

Constitution Principles

I. System Engineering Best Practices

All features must integrate with existing architecture. Destructive operations require explicit confirmation.

Prohibited without explicit approval:

  • Removing version control (.git)
  • Force pushing to shared branches
  • Dropping databases or deleting production data
  • Exposing secrets in source code

II. Directive Population

Agents must verify directives are populated before execution. Missing directives must be flagged and resolved.

III. Branch Discipline

New work requires a fresh feature branch. Main/master branches are protected—changes flow through pull requests.

IV. Quality Assurance

Code must be planned with full testing procedures. Breaking changes require documentation. Dependencies must be reviewed.

V. Security First

  • No secrets, credentials, or API keys in source code
  • Dependencies from trusted sources only
  • Security-sensitive changes require review

VI. AI-Assisted Development Safety

  • Review AI-generated code before committing
  • Verify AI suggestions against project patterns
  • Do not blindly execute destructive AI recommendations

How Updates Work

Constitutional updates are delivered through Era releases:

era-code upgrade # Checks and upgrades era-code, OpenCode, and plugins
era-code init # Re-running init applies the latest constitution

This ensures all Era-governed projects maintain consistent governance standards.

Handling Conflicts

If a constitutional principle conflicts with your project needs:

  1. Document the exception in your directives
  2. Do not modify the constitution file
  3. Flag the conflict for team discussion

The constitution remains the authoritative source, but documented exceptions provide context for why certain patterns differ.

Auditing Compliance

Use the /era-audit command in OpenCode to verify your project follows constitutional principles:

/era-audit

This checks each principle and reports violations with remediation steps.

To fix violations:

/era-constitution-fix