Status: draft · Date: 2026-05-11 · Related ADRs: 008 Audience: anyone editing
leviathan-protocol/meta/constitution/content
This spec defines the file format for constitutional elements (principles, rules, terms, shadows, references) in leviathan-protocol/meta/. Format choice: Markdown + YAML frontmatter (Option B per format decision 2026-05-11).
- GitHub-native rendering — anyone viewing a file in browser sees formatted content
- Long content friendly — markdown handles paragraphs, lists, code blocks naturally
- Diff-friendly — PRs show exactly what constitutional text changed
- Editorial separation built-in —
<hr>divides on-chain content from editorial context - Compile-friendly —
python-frontmatterlibrary parses metadata + body in 2 lines
Element type encoded at folder level. Mutability tier (IMMUTABLE / LOCKED / MUTABLE) declared in frontmatter (authoritative source). Restructured 2026-05-14 to align with founder's POS pattern; all federation repos follow this layout.
leviathan-protocol/<repo>/constitution/
├── terms/ # @TERM definitional vocabulary
├── principles/ # #PRINCIPLE guiding values (any mutability)
├── rules/ # !RULE operational + metarules (any mutability)
├── shadows/ # 🜏SHADOW anti-patterns (future)
├── protocols/ # ⚙PROTOCOL situational behavior sets (future)
└── README.md
One file per element. Filename = element slug (kebab-case). No numeric prefix required (sort order is alphabetical or by frontmatter current_version if needed).
Domain repos (e.g., leviathan-protocol/animal-welfare) use the same folder structure. Each repo's manifest declares inherits_from: leviathan-kernel@v0.1 so the federation kernel IMMUTABLES inherit transitively.
---
slug: user_sovereignty # snake_case, unique across all elements
element_type: PRINCIPLE # PRINCIPLE | RULE | TERM | SHADOW | REFERENCE
mutability: IMMUTABLE # IMMUTABLE | LOCKED | MUTABLE
inline: true # true = on-chain inline; false = contentURI used
current_version: 1 # incremented on each ratification
contentURI: null # IPFS or HTTPS URI if inline: false
---| Field | Type | Notes |
|---|---|---|
slug |
string (snake_case) | Unique identifier; used as on-chain key. Never change after ratification. |
element_type |
enum | Maps to ConstitutionalRegistry.ElementType |
mutability |
enum | IMMUTABLE = soulbound forever; LOCKED = high-bar governance vote required; MUTABLE = regular vote |
inline |
bool | true if content ≤ 500 chars (goes on-chain directly); false if longer (URI used) |
current_version |
int | Latest ratified version. Repo file = this version. History on chain. |
contentURI |
string | null | When inline: false, IPFS CID or HTTPS URL where full content lives. Hash computed from URI-fetched content. |
Two zones separated by horizontal rule:
[CONSTITUTIONAL CONTENT — goes on chain]
<!-- BELOW THIS LINE: editorial context. Not stored on-chain. -->
---
[EDITORIAL CONTENT — for human readers, contributors, future maintainers]- This is what gets ratified, hashed, stored on-chain
- Should be terse, precise, normative
- Avoid examples, reasoning, history — those go below
- Markdown allowed but kept minimal (paragraphs, light emphasis)
- Total length ≤ 500 chars if
inline: true, otherwise no limit (but URI used)
- For humans only; never goes on-chain
- Reasoning, examples, enforcement details, historical context
- Cross-references to other elements
- Update freely without governance vote (just a PR)
- Compile script strips this section before hashing
---
slug: user_sovereignty
element_type: PRINCIPLE
mutability: IMMUTABLE
inline: true
current_version: 1
contentURI: null
---
Users grant initial consent by bonding with an agent and defining its operating boundaries. After that, the agent acts independently within those bounds. The validator network ensures the agent stays within bounds — not the user checking every action. Users retain absolute revocation rights through unbonding.
<!-- BELOW THIS LINE: editorial context. Not stored on-chain. -->
---
## What this principle establishes
The bonding contract between user and agent is the foundational consent mechanism. Once a user bonds with an agent and accepts its values, the agent operates autonomously within defined boundaries until explicitly revoked.
## Enforcement mechanisms
1. **Bonding ceremony** — User explicitly accepts agent's values before any autonomous action
2. **Boundary definition** — User declares what the agent may and may not do
3. **Autonomous operation** — No per-action consent required within boundaries
4. **Revocation right** — User can unbond at any time, ending the agent's authority
## Why immutable
This principle is `IMMUTABLE` because it is constitutive of the agent-user relationship. Changing it would not be amending the constitution — it would be replacing the protocol entirely. Forks may choose different bonding semantics; this Leviathan instance does not.
## Reasoning trail
- Initial framing draws on Hobbes' social contract: citizens grant authority to sovereign, retain natural rights
- Adapted to AI agent context: user grants authority to agent, retains revocation right
- The Magistrate (validator) network exists precisely so users don't have to check every agent action
## Related elements
- `validator_consensus` (mutable) — defines how the network enforces boundaries
- `revocation_mechanism` (locked) — technical implementation of unbond
- `bonding_ceremony` (locked) — protocol for initial consentIn this example:
- On-chain content = the first paragraph after frontmatter (≤ 500 chars, fits inline)
- Editorial content = everything below the
<hr> - Compile script extracts only the on-chain portion, computes its hash, generates
ratifyNewVersion()calldata
leviathan-protocol/meta/scripts/compile-to-registry-calldata.py:
- Walk
constitution/recursively - For each
.mdfile:- Parse frontmatter → element metadata
- Split body at the editorial separator (
<!-- BELOW THIS LINE: -->) - Take only the pre-separator content
- Compute
keccak256(content)→contentHash - If
inline: trueandlen(content) > 500: ERROR (fix file) - If
inline: falseandcontentURIis null: ERROR (upload to IPFS first or fix)
- Sort elements: IMMUTABLE first, then LOCKED, then MUTABLE
- Emit
compiled/ratification-calls.json— array ofratifyNewVersion(...)calldata - Emit
compiled/ui-snapshot.json— JSON snapshot for UI fallback rendering
leviathan-protocol/meta/scripts/verify-against-chain.py:
- Read each
.mdfile inconstitution/ - Compute its hash (same algorithm as compile)
- Query
ConstitutionalRegistry.getCurrentContent(slug)for the same slug - Compare hashes — must match
- Report mismatches (= chain drifted from repo, or repo edited without ratification)
1. Contributor edits a .md file in their fork
2. Open PR against leviathan-protocol/meta
3. Review (technical correctness, governance fit)
4. If approved + would be ratified on-chain:
- Compile script runs in CI
- Generates ratification calldata
- Calldata submitted to ConstitutionalRegistry via governance vote
- On successful ratification: PR merged + current_version frontmatter bumped
5. If editorial-only changes (below `<hr>`):
- PR merged directly (no on-chain action needed)
- No version bump
The <hr> separator is the key — it determines whether a change is constitutional (requires governance) or editorial (PR + merge).
- Filename must match
slugfield (user_sovereignty↔user-sovereignty.mdorN-user-sovereignty.md) slugmust be unique across entireconstitution/treeinline: truecontent must be ≤ 500 chars (after editorial strip)inline: falsemust have non-nullcontentURIcurrent_versionmust be monotonically increasing (no rewinds)element_typeandmutabilitymust be valid enum values- Editorial separator (
<!-- BELOW THIS LINE: -->) must appear exactly once OR not at all (if entire file is constitutional)
- Should compile script also enforce a max constitutional text length even when
inline: false(e.g., 5000 chars hard cap)? - Should we allow multi-language variants per element (English + Turkish)? If so, format extension needed.
- How are deprecated/retired elements represented in repo? (One option: move to
99-retired/subfolder; another:retired: truefrontmatter flag) - Should the compile script also produce a printable PDF of the full constitution as a release artifact?
These are deferred to the implementation team and will become ADRs as decided.