You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The creator should support the language-first, guided-plus-open-canvas shape, with one important correction: autonomy/risk posture is not allowed to directly flip runtime security settings from inside the constitution file.
Creator flow:
Framing screen: localized explanation, with Guided, Preset, and Skip/use bundled as valid on-ramps.
Must-know calibration: verification bar, escalation triggers, work context, communication style, privacy/memory stance, and an autonomy preference as model-facing guidance.
Open canvas: bounded free prose in the user’s chosen language for purpose, values, tone, and extra principles. Render it as subordinate user-global law, not a raw system-prompt replacement.
Live preview: show the exact rendered <codewhale_user_constitution> prose and the surrounding layer order.
AI-assisted drafting/polish can be offered only after provider/model connectivity exists and must remain optional. The deterministic renderer is the v0.8.67 must-have; AI polish is not required for checkpoint completion.
Security boundary: the structured constitution may guide model behavior but must not bypass or mutate enforced runtime controls without a separate explicit config action.
Maintainer direction update (2026-06-29)
This supersedes older wording below that frames the guided creator as writing the full prompts/constitution.md base-prompt override.
The v0.8.67 guided creator should make the user-global constitution a structured policy file rendered to prose, not a blank Markdown system-prompt editor and not a full replacement for the bundled Constitution.
Target architecture:
Bundled global Constitution Markdown: crates/tui/src/prompts/constitution.md remains the shared identity/judgment frame and is still compiled into the binary.
User-global constitution: setup writes a structured file under $CODEWHALE_HOME such as $CODEWHALE_HOME/constitution.json (or a clearly named TOML equivalent if implementation chooses config-native storage). It captures guided answers: purpose, authority order, protected invariants, autonomy/risk posture, verification bar, communication style, privacy/memory stance, and escalation rules.
Renderer: CodeWhale renders that structured user-global policy into a concise prose <codewhale_user_constitution> block that is injected after the bundled Constitution and before repo/project context. The model reads prose; setup/doctor/tests inspect structured data.
Advanced full-prompt override: $CODEWHALE_HOME/prompts/constitution.md plus CODEWHALE_ALLOW_BASE_PROMPT_OVERRIDE=1 remains an advanced escape hatch from exposed main prompt for broader use cases #3638, not the normal setup output.
Repo constitution: .codewhale/constitution.json remains repo-local law and should not be edited by this global creator except through a separate project/repo setup flow.
Why: the model is best served by stable prose in the final system prompt, while users and setup are best served by structured, safe, inspectable fields. JSON should not point the model at Markdown, and Markdown should not point the model at JSON; the runtime should render the structured policy into the final prompt.
This issue should therefore build the creator around structured answers + previewed rendered prose, with bundled/default as the one-key safe path.
Related cleanup: remove WHALE.md as an active setup/context surface in #3798.
Constitution surfaces — what this creator is (and is not)
The guided creator produces exactly one thing: the user-global constitution override (the prompts/constitution.md override path in crates/tui/src/prompts.rs, CONSTITUTION_OVERRIDE_FILE). It is deliberately distinct from every other instruction surface:
Bundled constitution (prompts/constitution.md, BASE_PROMPT): the shipped English single-source law. "Use bundled" means no override file; the creator never edits the in-tree file.
User-global constitution override(this issue): the user's standing personal law across all projects, generated from presets/answers.
Repo .codewhale/constitution.json: per-repo law for this checkout only — not touched by the global creator.
AGENTS.md / CLAUDE.md: repo agent guidance — a separate surface.
Memory: recalled facts, not standing law.
--append-system-prompt: a per-launch ad-hoc addition, not a durable constitution.
The creator must name which surface it is writing and never blur the line (see acceptance below and the #3412 docs table).
Non-goals
Not editing the shipped bundled constitution.md; "use bundled" means no override file is created.
Not per-locale-branching the bundled law — the creator UI and presets are localized; the generated override is rendered prose the model follows.
Not replacing --append-system-prompt, repo constitution, AGENTS.md, or memory.
Not forcing custom prompt authoring — bundled/default is a first-class valid result.
Product shape
A CodeWhale constitution is not just a long prompt and not just a preferences page. It is the user's stable standing law for CodeWhale: the rules that should survive across projects, models, sessions, and momentary task wording.
A good constitution answers four questions:
Who is CodeWhale supposed to be for this user?
Which instructions and evidence win when sources conflict?
What should CodeWhale protect even when moving fast?
What does “done” mean before CodeWhale claims success?
Setup should turn those answers into a readable constitution through guided questions, presets, and preview. The default path should be “use bundled constitution”; the custom path should feel like choosing a character class/play style and house rules, not editing a hidden system prompt.
For v0.8.67, this creator also feeds the required update checkpoint in #3794. Existing users must make an explicit constitution choice after updating, but choosing the bundled/default constitution is a valid completion path.
What makes a constitution a constitution
A constitution should have stable articles, not ad hoc advice:
Identity and purpose: coding assistant, research assistant, writing partner, operations helper, mixed workbench.
Authority order: current user request, live tool evidence, repo instructions, memory, old handoffs, generated plans.
Protected invariants: secrets, user files, git history, production data, budget, brand voice, language, accessibility.
Autonomy default: ask-first, normal agent, high-trust local mode, or task-specific escalation.
Verification bar: tests, build, screenshots, docs, citations, human approval, or “explain uncertainty.”
Communication style: concise, teaching, bilingual, formal, direct, exploratory, low-jargon.
Tool and risk posture: when to browse, run commands, edit files, install dependencies, spawn agents, or stop and ask.
Memory and privacy stance: what can be remembered, what should never be retained, and what belongs only in the current project.
Escalation rules: when CodeWhale must ask before continuing.
It should be structured enough for setup, doctor, and context reports to inspect, but rendered as prose clean enough for the model to follow.
Questions the setup wizard should ask
Use a small guided builder with presets first and advanced editing second.
Starter questions:
What will you mostly use CodeWhale for? Coding, research, writing, ops, mixed, or custom.
How should CodeWhale behave by default? Careful collaborator, fast builder, reviewer, teacher, creative partner, or quiet operator.
How much should it do before asking? Ask before edits, ask before risky actions, proceed inside the workspace, or high-trust local work.
What should it protect? Secrets, git history, uncommitted changes, production systems, cost, privacy, tone/brand, time.
What counts as finished? Tests pass, build passes, screenshots checked, docs updated, cited sources, or concise summary with known gaps.
How should it talk? Concise, explanatory, direct, bilingual, formal, casual, or domain-specific.
When should it stop and ask you? Destructive action, missing credentials, unclear product choice, legal/security risk, high cost, or conflicting instructions.
Should this be global for all CodeWhale sessions, or should this repo get its own .codewhale/constitution.json later?
Advanced questions:
Which sources should outrank memory and old handoffs?
Should web/current information be verified by default for unstable facts?
Should CodeWhale prefer minimal patches, broad refactors, or ask case-by-case?
Are there project types where this constitution should not apply?
Localization requirements
All constitution creator questions, presets, explanations, warnings, validation errors, preview labels, and completion states must be localized through the same setup localization layer used by the v0.8.67 wizard.
The flow needs localized copy for:
bundled/default constitution,
preset-generated constitution,
existing custom constitution review,
disable/restore bundled constitution,
global constitution vs repo .codewhale/constitution.json,
generated constitution preview and confirm/cancel actions,
repair states for missing, unreadable, empty, or flag-disabled overrides.
Do not ship this as an English-only wizard with translated docs around it.
Current behavior
The underlying capability exists from #3638, but it is not part of the v0.8.67 setup journey yet.
Evidence from the current tree and issue history:
README documents the instruction hierarchy: the global constitution is the compiled base law, while .codewhale/constitution.json is repo-local law.
docs/CONFIGURATION.md documents the exposed main prompt for broader use cases #3638 per-user override path: ~/.codewhale/prompts/constitution.md under $CODEWHALE_HOME plus the explicit CODEWHALE_ALLOW_BASE_PROMPT_OVERRIDE=1 opt-in.
Add a setup/onboarding step for global CodeWhale constitution customization that builds on #3638 rather than inventing a second prompt path:
Detect whether the active base constitution is bundled or user-global, and show the source path and opt-in state clearly.
Offer deliberate actions: keep bundled, pick a preset, answer guided questions, preview the generated constitution, save it, edit/inspect the existing user-global constitution, disable the override, or repair an invalid/empty override.
Write only under $CODEWHALE_HOME/prompts/constitution.md or ~/.codewhale/prompts/constitution.md; do not edit repo .codewhale/constitution.json unless the user is in a separate project-setup flow.
Preserve the two-step trust boundary from exposed main prompt for broader use cases #3638: a file alone is ignored until the user explicitly opts in through the supported flag or any future approved config gate.
Make /context report, setup reports, and doctor output show whether a user-global constitution was loaded, ignored, missing, malformed, or disabled.
Keep runtime enforcement separate: a custom constitution may change persona and general guidance, but it must not bypass sandbox, approvals, managed config, tool gates, or other policy enforced in code.
Support both new-user first-run setup and the required v0.8.67 update checkpoint.
UX guardrails
Do not lead with a raw text editor. Lead with presets and short questions.
Show a readable preview before enabling the generated constitution.
Keep “start now with bundled constitution” as a one-key escape hatch.
Make the global/repo distinction explicit: global constitution is user-wide; .codewhale/constitution.json is repo-local law; AGENTS.md is project working instructions; memory is not law.
Include a revert path that disables the override and returns to the bundled constitution.
Localized copy should explain the checkpoint without sounding like an error or punishment for updating.
Acceptance criteria
/setup includes a global constitution/personality step, marked optional for normal first-run users and required as the v0.8.67 update checkpoint.
The step can generate a constitution from presets plus guided answers without requiring raw prompt editing.
A clean CODEWHALE_HOME can scaffold a user-global constitution file from the bundled prompt or generated template.
Existing override states are handled explicitly: no file, file present with flag off, file present with flag on, unreadable file, empty file, and malformed/too-large content.
The setup report and /context report show the active constitution source without leaking unrelated local paths beyond the relevant CodeWhale config path.
Constitution creator UX update (2026-06-29)
The creator should support the language-first, guided-plus-open-canvas shape, with one important correction: autonomy/risk posture is not allowed to directly flip runtime security settings from inside the constitution file.
Creator flow:
<codewhale_user_constitution>prose and the surrounding layer order./constitution(v0.8.67 Setup: make /constitution the primary constitution management surface #3806) reopens this surface; rollback to bundled/default must be one clear action.AI-assisted drafting/polish can be offered only after provider/model connectivity exists and must remain optional. The deterministic renderer is the v0.8.67 must-have; AI polish is not required for checkpoint completion.
Security boundary: the structured constitution may guide model behavior but must not bypass or mutate enforced runtime controls without a separate explicit config action.
Maintainer direction update (2026-06-29)
This supersedes older wording below that frames the guided creator as writing the full
prompts/constitution.mdbase-prompt override.The v0.8.67 guided creator should make the user-global constitution a structured policy file rendered to prose, not a blank Markdown system-prompt editor and not a full replacement for the bundled Constitution.
Target architecture:
crates/tui/src/prompts/constitution.mdremains the shared identity/judgment frame and is still compiled into the binary.$CODEWHALE_HOMEsuch as$CODEWHALE_HOME/constitution.json(or a clearly named TOML equivalent if implementation chooses config-native storage). It captures guided answers: purpose, authority order, protected invariants, autonomy/risk posture, verification bar, communication style, privacy/memory stance, and escalation rules.<codewhale_user_constitution>block that is injected after the bundled Constitution and before repo/project context. The model reads prose; setup/doctor/tests inspect structured data.$CODEWHALE_HOME/prompts/constitution.mdplusCODEWHALE_ALLOW_BASE_PROMPT_OVERRIDE=1remains an advanced escape hatch from exposed main prompt for broader use cases #3638, not the normal setup output..codewhale/constitution.jsonremains repo-local law and should not be edited by this global creator except through a separate project/repo setup flow.Why: the model is best served by stable prose in the final system prompt, while users and setup are best served by structured, safe, inspectable fields. JSON should not point the model at Markdown, and Markdown should not point the model at JSON; the runtime should render the structured policy into the final prompt.
This issue should therefore build the creator around structured answers + previewed rendered prose, with bundled/default as the one-key safe path.
Related cleanup: remove
WHALE.mdas an active setup/context surface in #3798.Constitution surfaces — what this creator is (and is not)
The guided creator produces exactly one thing: the user-global constitution override (the
prompts/constitution.mdoverride path incrates/tui/src/prompts.rs,CONSTITUTION_OVERRIDE_FILE). It is deliberately distinct from every other instruction surface:prompts/constitution.md,BASE_PROMPT): the shipped English single-source law. "Use bundled" means no override file; the creator never edits the in-tree file..codewhale/constitution.json: per-repo law for this checkout only — not touched by the global creator.AGENTS.md/CLAUDE.md: repo agent guidance — a separate surface.--append-system-prompt: a per-launch ad-hoc addition, not a durable constitution.The creator must name which surface it is writing and never blur the line (see acceptance below and the #3412 docs table).
Non-goals
constitution.md; "use bundled" means no override file is created.--append-system-prompt, repo constitution,AGENTS.md, or memory.Product shape
A CodeWhale constitution is not just a long prompt and not just a preferences page. It is the user's stable standing law for CodeWhale: the rules that should survive across projects, models, sessions, and momentary task wording.
A good constitution answers four questions:
Setup should turn those answers into a readable constitution through guided questions, presets, and preview. The default path should be “use bundled constitution”; the custom path should feel like choosing a character class/play style and house rules, not editing a hidden system prompt.
For v0.8.67, this creator also feeds the required update checkpoint in #3794. Existing users must make an explicit constitution choice after updating, but choosing the bundled/default constitution is a valid completion path.
What makes a constitution a constitution
A constitution should have stable articles, not ad hoc advice:
It should be structured enough for setup, doctor, and context reports to inspect, but rendered as prose clean enough for the model to follow.
Questions the setup wizard should ask
Use a small guided builder with presets first and advanced editing second.
Starter questions:
.codewhale/constitution.jsonlater?Advanced questions:
Localization requirements
All constitution creator questions, presets, explanations, warnings, validation errors, preview labels, and completion states must be localized through the same setup localization layer used by the v0.8.67 wizard.
The flow needs localized copy for:
.codewhale/constitution.json,AGENTS.mdvs constitution vs memory,Do not ship this as an English-only wizard with translated docs around it.
Current behavior
The underlying capability exists from #3638, but it is not part of the v0.8.67 setup journey yet.
Evidence from the current tree and issue history:
.codewhale/constitution.jsonis repo-local law.docs/CONFIGURATION.mddocuments the exposed main prompt for broader use cases #3638 per-user override path:~/.codewhale/prompts/constitution.mdunder$CODEWHALE_HOMEplus the explicitCODEWHALE_ALLOW_BASE_PROMPT_OVERRIDE=1opt-in.Desired behavior
Add a setup/onboarding step for global CodeWhale constitution customization that builds on #3638 rather than inventing a second prompt path:
$CODEWHALE_HOME/prompts/constitution.mdor~/.codewhale/prompts/constitution.md; do not edit repo.codewhale/constitution.jsonunless the user is in a separate project-setup flow./context report, setup reports, and doctor output show whether a user-global constitution was loaded, ignored, missing, malformed, or disabled.UX guardrails
.codewhale/constitution.jsonis repo-local law;AGENTS.mdis project working instructions; memory is not law.Acceptance criteria
/setupincludes a global constitution/personality step, marked optional for normal first-run users and required as the v0.8.67 update checkpoint.CODEWHALE_HOMEcan scaffold a user-global constitution file from the bundled prompt or generated template./context reportshow the active constitution source without leaking unrelated local paths beyond the relevant CodeWhale config path.$CODEWHALE_HOMEresolution, flag-off ignore behavior, flag-on load behavior, generated-template load behavior, update-checkpoint completion behavior, and secret/log redaction around setup diagnostics..codewhale/constitution.json,AGENTS.md, memory, and--append-system-prompt.Related
Safe fallback
needs-action/deferred(notfailed).