feat(ce-plan): add U-IDs and origin trace to plan template (#632)
Some checks failed
CI / pr-title (push) Has been cancelled
CI / test (push) Has been cancelled
Release PR / release-pr (push) Has been cancelled
Release PR / publish-cli (push) Has been cancelled

This commit is contained in:
Trevin Chow
2026-04-21 16:07:28 -07:00
committed by GitHub
parent 21666f0b67
commit 44ce9dd127
5 changed files with 502 additions and 12 deletions

View File

@@ -328,6 +328,8 @@ Avoid:
- Units that span multiple unrelated concerns
- Units that are so vague an implementer still has to invent the plan
Each unit carries a stable plan-local **U-ID** assigned in Phase 3.5 (`U1`, `U2`, …). U-IDs survive reordering, splitting, and deletion: new units take the next unused number, gaps are fine, and existing IDs are never renumbered. This lets `ce-work` reference units unambiguously across plan edits.
#### 3.4 High-Level Technical Design (Optional)
Before detailing implementation units, decide whether an overview would help a reviewer validate the intended approach. This section communicates the *shape* of the solution — how pieces fit together — without dictating implementation.
@@ -371,16 +373,20 @@ The tree is a scope declaration showing the expected output shape. It is not a c
#### 3.5 Define Each Implementation Unit
Each unit's heading carries a stable U-ID prefix matching the format used for R/A/F/AE in requirements docs: `- [ ] U1. **[Name]**`. The prefix is plain text, not bolded — the bold is reserved for the unit name. Number sequentially within the plan starting at U1.
**Stability rule.** Once assigned, a U-ID is never renumbered. Reordering units leaves their IDs in place (e.g., U1, U3, U5 in their new order is correct; renumbering to U1, U2, U3 is not). Splitting a unit keeps the original U-ID on the original concept and assigns the next unused number to the new unit. Deletion leaves a gap; gaps are fine. This rule matters most during deepening (Phase 5.3), which is the most likely accidental-renumber vector.
For each unit, include:
- **Goal** - what this unit accomplishes
- **Requirements** - which requirements or success criteria it advances
- **Dependencies** - what must exist first
- **Requirements** - which requirements or success criteria it advances (cite R-IDs, and A/F/AE IDs when origin supplies them)
- **Dependencies** - what must exist first (cite by U-ID, e.g., "U1, U3")
- **Files** - repo-relative file paths to create, modify, or test (never absolute paths)
- **Approach** - key decisions, data flow, component boundaries, or integration notes
- **Execution note** - optional, only when the unit benefits from a non-default execution posture such as test-first or characterization-first
- **Technical design** - optional pseudo-code or diagram when the unit's approach is non-obvious and prose alone would leave it ambiguous. Frame explicitly as directional guidance, not implementation specification
- **Patterns to follow** - existing code or conventions to mirror
- **Test scenarios** - enumerate the specific test cases the implementer should write, right-sized to the unit's complexity and risk. Consider each category below and include scenarios from every category that applies to this unit. A simple config change may need one scenario; a payment flow may need a dozen. The quality signal is specificity — each scenario should name the input, action, and expected outcome so the implementer doesn't have to invent coverage. For units with no behavioral change (pure config, scaffolding, styling), use `Test expectation: none -- [reason]` instead of leaving the field blank.
- **Test scenarios** - enumerate the specific test cases the implementer should write, right-sized to the unit's complexity and risk. Consider each category below and include scenarios from every category that applies to this unit. A simple config change may need one scenario; a payment flow may need a dozen. The quality signal is specificity — each scenario should name the input, action, and expected outcome so the implementer doesn't have to invent coverage. For units with no behavioral change (pure config, scaffolding, styling), use `Test expectation: none -- [reason]` instead of leaving the field blank. **AE-link convention:** when a test scenario directly enforces an origin Acceptance Example, prefix it with `Covers AE<N>.` (or `Covers F<N> / AE<N>.`). This is sparse-by-design — most test scenarios are finer-grained than AEs and do not link. Do not force AE links onto tests that only cover lower-level implementation details.
- **Happy path behaviors** - core functionality with expected inputs and outputs
- **Edge cases** (when the unit has meaningful boundaries) - boundary values, empty inputs, nil/null states, concurrent access
- **Error and failure paths** (when the unit has failure modes) - invalid input, downstream service failures, timeout behavior, permission denials
@@ -444,6 +450,8 @@ For sufficiently large, risky, or cross-cutting work, add the sections that genu
Do not add these as boilerplate. Include them only when they improve execution quality or stakeholder alignment.
**Alternatives Considered — what to vary.** When this section is included, alternatives must differ on *how* the work is built: architecture, sequencing, boundaries, integration pattern, rollout strategy. Tiny implementation variants (which hash function, which serialization format) belong in Key Technical Decisions, not Alternatives. Product-shape alternatives (different actors, different core outcome, different positioning) belong in `ce-brainstorm`, not here — surface them back upstream rather than re-litigating product questions during planning.
#### 4.2 Core Plan Template
Omit clearly inapplicable optional sections, especially for Lightweight plans.
@@ -464,25 +472,73 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
[What is changing and why]
---
## Problem Frame
[Summarize the user/business problem and context. Reference the origin doc when present.]
---
## Requirements Trace
- R1. [Requirement or success criterion this plan must satisfy]
- R2. [Requirement or success criterion this plan must satisfy]
<!-- Origin trace sub-blocks: include only when the upstream requirements doc supplies the
corresponding section. Each sub-block is independent — include only the ones that apply.
Omit cleanly (no header, no empty line) when no origin doc exists or the origin had no
Actors / Key Flows / Acceptance Examples sections. -->
**Origin actors:** [A1 (role/name), A2 (role/name), …]
**Origin flows:** [F1 (flow name), F2 (flow name), …]
**Origin acceptance examples:** [AE1 (covers R1, R4), AE2 (covers R3), …]
---
## Scope Boundaries
<!-- Default structure (no origin doc, or origin was Lightweight / Standard / Deep-feature):
a single bulleted list of explicit non-goals. The optional `### Deferred to Follow-Up Work`
subsection below may still be included when this plan's implementation is intentionally
split across other PRs/issues/repos. -->
- [Explicit non-goal or exclusion]
<!-- Optional: When some items are planned work that will happen in a separate PR, issue,
or repo, use this sub-heading to distinguish them from true non-goals. -->
### Deferred to Separate Tasks
<!-- Optional plan-local subsection — include when this plan's implementation is intentionally
split across other PRs, issues, or repos. Distinct from origin-carried "Deferred for later"
(product sequencing) and "Outside this product's identity" (positioning). -->
### Deferred to Follow-Up Work
- [Work that will be done separately]: [Where or when -- e.g., "separate PR in repo-x", "future iteration"]
<!-- Triggered structure: replace the single list above with the three subsections below ONLY
when the origin doc is Deep-product (detectable by presence of an "Outside this product's
identity" subsection in the origin's Scope Boundaries). At all other tiers and when no
origin exists, use the single-list structure above. -->
<!--
### Deferred for later
[Carried from origin — product/version sequencing. Work that will be done eventually but not in v1.]
- [Item]
### Outside this product's identity
[Carried from origin — positioning rejection. Adjacent product the plan must not accidentally build.]
- [Item]
### Deferred to Follow-Up Work
[Plan-local — implementation work intentionally split across other PRs/issues/repos. Distinct from origin's "Deferred for later" (product) and "Outside this product's identity" (positioning).]
- [Item]
-->
---
## Context & Research
### Relevant Code and Patterns
@@ -497,10 +553,14 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
- [Relevant external docs or best-practice source, if used]
---
## Key Technical Decisions
- [Decision]: [Rationale]
---
## Open Questions
### Resolved During Planning
@@ -511,6 +571,8 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
- [Question or unknown]: [Why it is intentionally deferred]
---
<!-- Optional: Include when the plan creates a new directory structure (greenfield plugin,
new service, new package). Shows the expected output shape at a glance. Omit for plans
that only modify existing files. This is a scope declaration, not a constraint --
@@ -519,6 +581,8 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
[directory tree showing new directories and files]
---
<!-- Optional: Include this section only when the work involves DSL design, multi-component
integration, complex data flow, state-heavy lifecycle, or other cases where prose alone
would leave the approach shape ambiguous. Omit it entirely for well-patterned or
@@ -529,15 +593,23 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
[Pseudo-code grammar, mermaid diagram, data flow sketch, or state diagram — choose the medium that best communicates the solution shape for this work.]
---
## Implementation Units
- [ ] **Unit 1: [Name]**
<!-- Each unit carries a stable plan-local U-ID (U1, U2, …) assigned sequentially.
U-IDs are never renumbered: reordering preserves them in place, splitting keeps the
original U-ID and assigns the next unused number to the new unit, deletion leaves
a gap. This anchor is what ce-work references in blockers and verification, so
stability across plan edits is load-bearing. -->
- [ ] U1. **[Name]**
**Goal:** [What this unit accomplishes]
**Requirements:** [R1, R2]
**Dependencies:** [None / Unit 1 / external prerequisite]
**Dependencies:** [None / U1 / external prerequisite]
**Files:**
- Create: `path/to/new_file`
@@ -561,6 +633,8 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
**Verification:**
- [Outcome that should hold when this unit is complete]
---
## System-Wide Impact
- **Interaction graph:** [What callbacks, middleware, observers, or entry points may be affected]
@@ -570,16 +644,22 @@ deepened: YYYY-MM-DD # optional, set when the confidence check substantively st
- **Integration coverage:** [Cross-layer scenarios unit tests alone will not prove]
- **Unchanged invariants:** [Existing APIs, interfaces, or behaviors that this plan explicitly does not change — and how the new work relates to them. Include when the change touches shared surfaces and reviewers need blast-radius assurance]
---
## Risks & Dependencies
| Risk | Mitigation |
|------|------------|
| [Meaningful risk] | [How it is addressed or accepted] |
---
## Documentation / Operational Notes
- [Docs, rollout, monitoring, or support impacts when relevant]
---
## Sources & References
- **Origin document:** [docs/brainstorms/YYYY-MM-DD-<topic>-requirements.md](path)
@@ -595,20 +675,28 @@ For larger `Deep` plans, extend the core template only when useful with sections
- [Approach]: [Why rejected or not chosen]
---
## Success Metrics
- [How we will know this solved the intended problem]
---
## Dependencies / Prerequisites
- [Technical, organizational, or rollout dependency]
---
## Risk Analysis & Mitigation
| Risk | Likelihood | Impact | Mitigation |
|------|-----------|--------|------------|
| [Risk] | [Low/Med/High] | [Low/Med/High] | [How addressed] |
---
## Phased Delivery
### Phase 1
@@ -617,10 +705,14 @@ For larger `Deep` plans, extend the core template only when useful with sections
### Phase 2
- [What follows and why]
---
## Documentation Plan
- [Docs or runbooks to update]
---
## Operational / Rollout Notes
- [Monitoring, migration, feature flag, or rollout considerations]
@@ -628,6 +720,7 @@ For larger `Deep` plans, extend the core template only when useful with sections
#### 4.3 Planning Rules
- **Horizontal rules (`---`) between top-level sections** in Standard and Deep plans, mirroring the `ce-brainstorm` requirements doc convention. Improves scannability of dense plans where many H2 sections sit close together. Omit for Lightweight plans where the whole doc fits on a single screen.
- **All file paths must be repo-relative** — never use absolute paths like `/Users/name/Code/project/src/file.ts`. Use `src/file.ts` instead. Absolute paths make plans non-portable across machines, worktrees, and teammates. When a plan targets a different repo than the document's home, state the target repo once at the top of the plan (e.g., `**Target repo:** my-other-project`) and use repo-relative paths throughout
- Prefer path plus class/component/pattern references over brittle line numbers
- Keep implementation units checkable with `- [ ]` syntax for progress tracking
@@ -659,7 +752,8 @@ Before finalizing, check:
- If a High-Level Technical Design section is included, it uses the right medium for the work, carries the non-prescriptive framing, and does not contain implementation code (no imports, exact signatures, or framework-specific syntax)
- Per-unit technical design fields, if present, are concise and directional rather than copy-paste-ready
- If the plan creates a new directory structure, would an Output Structure tree help reviewers see the overall shape?
- If Scope Boundaries lists items that are planned work for a separate PR or task, are they under `### Deferred to Separate Tasks` rather than mixed with true non-goals?
- If Scope Boundaries lists items that are planned work for a separate PR, issue, or repo, are they under `### Deferred to Follow-Up Work` rather than mixed with true non-goals?
- U-IDs are unique within the plan and follow the stability rule — no two units share an ID; reordering or splitting did not renumber existing units; gaps from deletions are preserved
- Would a visual aid (dependency graph, interaction diagram, comparison table) help a reader grasp the plan structure faster than scanning prose alone?
If the plan originated from a requirements document, re-read that document and verify:
@@ -667,6 +761,8 @@ If the plan originated from a requirements document, re-read that document and v
- Scope boundaries and success criteria are preserved
- Blocking questions were either resolved, explicitly assumed, or sent back to `ce-brainstorm`
- Every section of the origin document is addressed in the plan — scan each section to confirm nothing was silently dropped
- If origin supplies A/F/AE IDs: every origin R/F/AE that *affects implementation* is referenced in Requirements Trace, a U-ID unit, test scenarios, verification, scope boundaries, or explicitly deferred. Actors are carried forward when they affect behavior, permissions, UX, orchestration, handoff, or verification. The standard is preservation of product intent, not mandatory ID spam — irrelevant origin IDs may be omitted
- If origin was Deep-product (origin contains an `Outside this product's identity` subsection): the plan's Scope Boundaries preserves the three-way split — `Deferred for later` and `Outside this product's identity` carried verbatim from origin, `Deferred to Follow-Up Work` reserved for plan-local implementation sequencing
#### 5.2 Write Plan File

View File

@@ -28,6 +28,7 @@ If the plan already has a `deepened:` date:
- Success criteria are missing or not reflected downstream
- Units do not clearly advance the traced requirements
- Origin requirements are not clearly carried forward
- Origin A/F/AE IDs (when supplied by the upstream brainstorm) are not preserved where planning decisions touch them, or are referenced inconsistently across Requirements Trace, units, and test scenarios
**Context & Research / Sources & References**
- Relevant repo patterns are named but never used in decisions or implementation units
@@ -66,6 +67,8 @@ If the plan already has a `deepened:` date:
- Test scenarios are vague (don't name inputs and expected outcomes), skip applicable categories (e.g., no error paths for a unit with failure modes, no integration scenarios for a unit crossing layers), or are disproportionate to the unit's complexity
- Feature-bearing units have blank or missing test scenarios (feature-bearing units require actual test scenarios; the `Test expectation: none` annotation is only valid for non-feature-bearing units)
- Verification outcomes are vague or not expressed as observable results
- Existing U-IDs were renumbered after a unit was reordered, split, or deleted (U-IDs are stable: never renumber existing IDs; gaps from deletions are preserved; new units take the next unused number)
- A unit realizing an origin Key Flow does not cite the F-ID, or a unit enforcing an origin Acceptance Example does not cite the AE-ID, when origin supplies them
**System-Wide Impact**
- Affected interfaces, callbacks, middleware, entry points, or parity surfaces are missing
@@ -224,7 +227,7 @@ Strengthen only the selected sections. Keep the plan coherent and preserve its o
Allowed changes:
- Clarify or strengthen decision rationale
- Tighten requirements trace or origin fidelity
- Reorder or split implementation units when sequencing is weak
- Reorder or split implementation units when sequencing is weak — but **never renumber existing U-IDs**. Reordering preserves U-IDs in their new order (e.g., U1, U3, U5 reordered is correct; renumbering to U1, U2, U3 is not). Splitting keeps the original U-ID on the original concept and assigns the next unused number to the new unit. Renumbering breaks ce-work blocker and verification references that were written against the original IDs
- Add missing pattern references, file/test paths, or verification outcomes
- Expand system-wide impact, risks, or rollout treatment where justified
- Reclassify open questions between `Resolved During Planning` and `Deferred to Implementation` when evidence supports the change
@@ -238,6 +241,7 @@ Do **not**:
- Add generic `Research Insights` subsections everywhere
- Rewrite the entire plan from scratch
- Invent new product requirements, scope changes, or success criteria without surfacing them explicitly
- Renumber existing U-IDs as part of reordering, splitting, deletion, or "tidying" the unit list. Deepening is the most likely accidental-renumber vector — preserve U-IDs even when the new order would look cleaner with sequential numbering
If research reveals a product-level ambiguity that should change behavior or scope:
- Do not silently decide it here

View File

@@ -167,6 +167,7 @@ Determine how to proceed based on what was provided in `<input_document>`.
3. **Create Todo List** _(skip if Phase 0 already built one, or if Phase 0 routed as Trivial)_
- Use your available task tracking tool (e.g., TodoWrite, task lists) to break the plan into actionable tasks
- Derive tasks from the plan's implementation units, dependencies, files, test targets, and verification criteria
- When the plan defines U-IDs for Implementation Units, preserve the unit's U-ID as a prefix in the task subject (e.g., "U3: Add parser coverage"). This keeps blocker references, deferred-work notes, and final summaries anchored to the same identifier the plan uses, so progress and traceability remain unambiguous across plan edits
- Carry each unit's `Execution note` into the task when present
- For each unit, read the `Patterns to follow` field before implementing — these point to specific files or conventions to mirror
- Use each unit's `Verification` field as the primary "done" signal for that task
@@ -359,7 +360,7 @@ Determine how to proceed based on what was provided in `<input_document>`.
- Note any blockers or unexpected discoveries
- Create new tasks if scope expands
- Keep user informed of major milestones
- When the plan or origin document carries stable R-IDs (and optionally A/F/AE IDs), reference them in blockers, deferred-work notes, task summaries, and final verification — not routine status updates. This preserves traceability back to requirements without burying signal under noise.
- When the plan defines U-IDs for Implementation Units, or the plan or origin document carries stable R-IDs (and optionally A/F/AE IDs), reference them in blockers, deferred-work notes, task summaries, and final verification — not routine status updates. U-IDs anchor units across plan edits; R/A/F/AE anchor product intent across the brainstorm-plan handoff. Use the IDs the plan supplies and do not invent ones it does not. This preserves traceability without burying signal under noise.
### Phase 3-4: Quality Check and Ship It

View File

@@ -114,6 +114,7 @@ Determine how to proceed based on what was provided in `<input_document>`.
3. **Create Todo List** _(skip if Phase 0 already built one, or if Phase 0 routed as Trivial)_
- Use your available task tracking tool (e.g., TodoWrite, task lists) to break the plan into actionable tasks
- Derive tasks from the plan's implementation units, dependencies, files, test targets, and verification criteria
- When the plan defines U-IDs for Implementation Units, preserve the unit's U-ID as a prefix in the task subject (e.g., "U3: Add parser coverage"). This keeps blocker references, deferred-work notes, and final summaries anchored to the same identifier the plan uses, so progress and traceability remain unambiguous across plan edits
- Carry each unit's `Execution note` into the task when present
- For each unit, read the `Patterns to follow` field before implementing — these point to specific files or conventions to mirror
- Use each unit's `Verification` field as the primary "done" signal for that task
@@ -294,7 +295,7 @@ Determine how to proceed based on what was provided in `<input_document>`.
- Note any blockers or unexpected discoveries
- Create new tasks if scope expands
- Keep user informed of major milestones
- When the plan or origin document carries stable R-IDs (and optionally A/F/AE IDs), reference them in blockers, deferred-work notes, task summaries, and final verification — not routine status updates. This preserves traceability back to requirements without burying signal under noise.
- When the plan defines U-IDs for Implementation Units, or the plan or origin document carries stable R-IDs (and optionally A/F/AE IDs), reference them in blockers, deferred-work notes, task summaries, and final verification — not routine status updates. U-IDs anchor units across plan edits; R/A/F/AE anchor product intent across the brainstorm-plan handoff. Use the IDs the plan supplies and do not invent ones it does not. This preserves traceability without burying signal under noise.
### Phase 3-4: Quality Check and Ship It