|
| 1 | +--- |
| 2 | +description: Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync. |
| 3 | +--- |
| 4 | + |
| 5 | +The user input to you can be provided directly by the agent or in `$ARGUMENTS` - you **MUST** consider it before proceeding with the prompt (if not empty). |
| 6 | + |
| 7 | +User input: |
| 8 | + |
| 9 | +$ARGUMENTS |
| 10 | + |
| 11 | +You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts. |
| 12 | + |
| 13 | +Follow this execution flow: |
| 14 | + |
| 15 | +1. Load the existing constitution template at `.specify/memory/constitution.md`. |
| 16 | + - Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`. |
| 17 | + **IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly. |
| 18 | + |
| 19 | +2. Collect/derive values for placeholders: |
| 20 | + - If user input (conversation) supplies a value, use it. |
| 21 | + - Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded). |
| 22 | + - For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous. |
| 23 | + - `CONSTITUTION_VERSION` must increment according to semantic versioning rules: |
| 24 | + * MAJOR: Backward incompatible governance/principle removals or redefinitions. |
| 25 | + * MINOR: New principle/section added or materially expanded guidance. |
| 26 | + * PATCH: Clarifications, wording, typo fixes, non-semantic refinements. |
| 27 | + - If version bump type ambiguous, propose reasoning before finalizing. |
| 28 | + |
| 29 | +3. Draft the updated constitution content: |
| 30 | + - Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left). |
| 31 | + - Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance. |
| 32 | + - Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious. |
| 33 | + - Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations. |
| 34 | + |
| 35 | +4. Consistency propagation checklist (convert prior checklist into active validations): |
| 36 | + - Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles. |
| 37 | + - Read `.specify/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints. |
| 38 | + - Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline). |
| 39 | + - Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required. |
| 40 | + - Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed. |
| 41 | + |
| 42 | +5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update): |
| 43 | + - Version change: old → new |
| 44 | + - List of modified principles (old title → new title if renamed) |
| 45 | + - Added sections |
| 46 | + - Removed sections |
| 47 | + - Templates requiring updates (✅ updated / ⚠ pending) with file paths |
| 48 | + - Follow-up TODOs if any placeholders intentionally deferred. |
| 49 | + |
| 50 | +6. Validation before final output: |
| 51 | + - No remaining unexplained bracket tokens. |
| 52 | + - Version line matches report. |
| 53 | + - Dates ISO format YYYY-MM-DD. |
| 54 | + - Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate). |
| 55 | + |
| 56 | +7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite). |
| 57 | + |
| 58 | +8. Output a final summary to the user with: |
| 59 | + - New version and bump rationale. |
| 60 | + - Any files flagged for manual follow-up. |
| 61 | + - Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`). |
| 62 | + |
| 63 | +Formatting & Style Requirements: |
| 64 | +- Use Markdown headings exactly as in the template (do not demote/promote levels). |
| 65 | +- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks. |
| 66 | +- Keep a single blank line between sections. |
| 67 | +- Avoid trailing whitespace. |
| 68 | + |
| 69 | +If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps. |
| 70 | + |
| 71 | +If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items. |
| 72 | + |
| 73 | +Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file. |
0 commit comments