feat(project): enrich repo constitution (invariants, branch policy, escalation)
Per the layered-authority clarification (base myth → global Constitution → repo constitution = local law → task packet → runtime policy), extend .codewhale/constitution.json beyond authority+verification with optional: - protected_invariants — repo invariants the agent must not break - branch_policy — branch/release policy in effect - escalate_when — conditions to stop and escalate to the user All optional; rendered as concise model-facing prose. The global Brother Whale identity anchor and Constitution in prompts/base.md are unchanged (verified untouched on this branch). Dogfood constitution.json filled with CodeWhale's real invariants (prefix-cache byte-stability, transcript replay, stable Rust, cli/tui parity), branch policy (codex/v0.8.53), and escalation rules. Docs note the layered hierarchy. cargo test -p codewhale-tui --bins → 3946 passed; clippy clean.
This commit is contained in:
+19
-3
@@ -29,14 +29,30 @@ Each repo can carry two distinct, complementary files:
|
||||
"memory",
|
||||
"old handoffs"
|
||||
],
|
||||
"protected_invariants": [
|
||||
"do not break old-session transcript replay"
|
||||
],
|
||||
"branch_policy": "PRs target the integration branch, not main",
|
||||
"verification_policy": {
|
||||
"before_claiming_done": ["run focused tests", "read changed files back"]
|
||||
}
|
||||
},
|
||||
"escalate_when": [
|
||||
"a destructive action was not explicitly authorized"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
When present, it is rendered into the system prompt as a higher-authority
|
||||
block and takes precedence over a legacy `WHALE.md`.
|
||||
All fields are optional. When present, the file is rendered into the system
|
||||
prompt as concise prose in a higher-authority block and takes precedence over
|
||||
a legacy `WHALE.md`.
|
||||
|
||||
This is the **local-law** layer in CodeWhale's hierarchy: *base myth & global
|
||||
Constitution* (the model prompt in `prompts/base.md`, including the Brother
|
||||
Whale identity anchor) → *repo constitution* (`.codewhale/constitution.json`,
|
||||
this file) → *task packet* (the current objective) → *runtime policy*
|
||||
(permissions/sandbox/cost limits enforced in code). The repo constitution
|
||||
gives decision rules; it does not replace the global Constitution or the
|
||||
current user request.
|
||||
|
||||
> **`WHALE.md` is deprecated.** It overlapped confusingly with `AGENTS.md`.
|
||||
> CodeWhale still **reads** an existing `WHALE.md` (below `AGENTS.md`) so old
|
||||
|
||||
Reference in New Issue
Block a user