The thesis
Three layers of law
As a project ages, instructions pile up and conflict: the original spec, a refactor that contradicts it, stale memory, a previous agent's handoff, your current request, fresh test output that doesn't match what the handoff claimed. A flat system prompt makes the model resolve that by guess. Codewhale uses a nested constitution with a defined rank. The harness enforces the order, tests assert it can't drift, and it stays intact when you swap models.
Since v0.9.0
Constitution-first setup — first launch walks language, model, posture, and your constitution; /setup any time. The model can draft it. You ratify it.
The rank, most-static first
Below the three layers rank project instructions (AGENTS.md), then memory and handoffs. Your current request and live tool evidence still control the active turn — the model may be given many layers, but it is instructed never to report a fact the tools did not return.
Bundled Constitution
The base law. Its priority article fixes the authority order for any conflict, so a stale handoff can never outrank a fresh test result by accident.
/constitution — your standing law
Structured data, not a raw prompt editor: guided setup renders it into a model-facing prose block. Drafted with your model's help, ratified by you, and carried across every project.
Your repo's law
Protected invariants, branch policy, verification requirements, escalation conditions — loaded as a repo-local authority block above project instructions, memory, and handoffs.
The honest boundary
Approval, sandbox, network, and trust controls are enforced in code — constitution text never overrides them.
Observable in the reasoning
The rank is not a claim on a landing page. These are faithful excerpts from a real session — the model cites the articles as it decides.
Per Article II (truth) and V (verification), I report what's actually in the tree — not what the previous agent claimed.
Article II · TruthArticle V · Verification
Reported the uncommitted work the summary left out, instead of repeating the claim.
The user's current request outranks the runtime statute — so I keep executing the task, not stopping on a technicality.
Article III · User agencyArticle VII · Hierarchy
Finished the work the user actually asked for.
Deleting community credit would break the project's own ethos. Relocate it instead — zero names lost.
Community ethos
Moved 200 lines of credits to docs/CONTRIBUTORS.md and linked from the README.