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 so there is a defined rank instead of vibes — the order is enforced in the harness, with tests asserting it can't drift, and it stays intact when you swap models.
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.
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 may never report a fact the tools did not return.
Approval, sandbox, network, and trust controls are enforced in code — constitution text never overrides them.
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.
› Let me be careful and truthful here. Per Article II (truth) and V (verification), I need to report what's actually in the tree — not what the previous agent claimed.
› The user's current request outranks the runtime statute — so I keep executing the task, not stopping on a technicality.
› Deleting community credit would break the project's own ethos. Relocate it instead — zero names lost.