@houseofwolvesllc/claude-scrum-skill 1.8.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: design-patterns
3
+ description: >-
4
+ Faithful Gang of Four design-pattern catalog for complex core-domain design.
5
+ Used by project-spec (to name candidate patterns against real axes of
6
+ variation) and project-orchestrate (to refactor toward a named pattern while
7
+ implementing core-domain epics). Surfaces on a specific, demonstrated design
8
+ problem — conditional/switch logic on a type spreading across call sites, a
9
+ need for runtime-substitutable behavior, adding variants without modifying
10
+ existing classes, an object that must notify dependents, or a deliberate
11
+ extension point — or when a pattern is named explicitly. NOT for CRUD,
12
+ scripts, glue code, one-off transforms, or routine feature work; for those,
13
+ prefer the simplest thing that works.
14
+ ---
15
+
16
+ # Design Patterns (Gang of Four)
17
+
18
+ The classic catalog from *Design Patterns: Elements of Reusable Object-Oriented
19
+ Software* (Gamma, Helm, Johnson, Vlissides). This skill is the **situational
20
+ layer** — it composes on top of the Engineering Baseline and never overrides it.
21
+
22
+ ---
23
+
24
+ ## Read this before reaching for any pattern
25
+
26
+ **You almost certainly do not need a pattern.** Patterns are a destination you
27
+ **refactor toward** once a smell proves you need the flexibility — not a design
28
+ you start from. This is the discipline of *Refactoring to Patterns* (Kerievsky),
29
+ and it is the only safe way to use this catalog.
30
+
31
+ Subordinate every entry below to the **Arbitration Rule** in
32
+ `../shared/references/ENGINEERING_BASELINE.md`:
33
+
34
+ > Simple design is the default. Abstractions and patterns are responses to
35
+ > demonstrated complexity — never anticipatory architecture.
36
+
37
+ Guardrails:
38
+
39
+ - **Prefer the simplest thing that works.** Three similar lines beat a premature
40
+ abstraction. A function, a closure, a map, or a plain conditional usually wins.
41
+ - **Apply the rule of three.** Don't introduce a pattern for one or two cases.
42
+ Wait until duplication or repeated change in the same place demands it.
43
+ - **Patterns are a vocabulary, not a checklist.** Naming the pattern you arrived
44
+ at aids communication; hunting for a pattern to apply causes over-engineering.
45
+ - **A named pattern can always collapse back.** If the variation it anticipated
46
+ never materializes, refactor it away.
47
+
48
+ ### Two modes (set by the calling skill)
49
+ - **Design time (`project-spec`):** name a *candidate* pattern for an identified
50
+ axis of variation. Always in the form
51
+ `Pattern — because <real axis of variation>; revisit at build (may collapse to
52
+ a simpler form if the variation does not materialize)`. Candidate, justified,
53
+ revisitable — never binding.
54
+ - **Implementation time (`project-orchestrate`, core epics only):** refactor
55
+ *toward* a candidate pattern only once the variation it anticipated has
56
+ actually appeared in the code. Otherwise implement the simplest sufficient
57
+ thing and leave the pattern unbuilt.
58
+
59
+ ---
60
+
61
+ ## The 23 patterns
62
+
63
+ Each entry describes the pattern's intent in plain terms; the *reach for it* line
64
+ is practical guidance for when a demonstrated smell justifies it. For the canonical
65
+ treatment — motivation, structure, participants, and sample code — consult the book
66
+ itself (cited under Acknowledgments).
67
+
68
+ ### Creational — how objects get made
69
+
70
+ - **Abstract Factory** — create whole families of related or dependent objects
71
+ through one interface, without binding code to their concrete classes. Reach for
72
+ it when the system must stay independent of how a product *family* is produced.
73
+ - **Builder** — separate the construction of a complex object from its
74
+ representation, so one construction process can yield different representations.
75
+ Reach for it for multi-step assembly or many optional parts.
76
+ - **Factory Method** — define a creation interface but let subclasses choose which
77
+ class to instantiate, deferring instantiation to them.
78
+ - **Prototype** — produce new objects by copying a prototypical instance rather
79
+ than instantiating classes directly. Reach for it when instantiation is costly or
80
+ types are chosen at runtime.
81
+ - **Singleton** — guarantee a single instance with one global access point. Use
82
+ sparingly — global mutable state, often an anti-pattern; prefer dependency
83
+ injection.
84
+
85
+ ### Structural — how objects compose
86
+
87
+ - **Adapter** — convert a class's interface into the one clients expect, letting
88
+ otherwise-incompatible interfaces work together. Typically at a boundary.
89
+ - **Bridge** — decouple an abstraction from its implementation so the two can vary
90
+ independently. Reach for it to avoid a combinatorial subclass explosion.
91
+ - **Composite** — arrange objects into tree structures for part-whole hierarchies,
92
+ letting clients treat individual objects and compositions uniformly.
93
+ - **Decorator** — attach responsibilities to an object dynamically — a flexible
94
+ alternative to subclassing for extending behavior.
95
+ - **Facade** — offer a single higher-level interface to a subsystem, making it
96
+ easier to use and decoupling clients from its internals.
97
+ - **Flyweight** — share fine-grained objects to support large numbers of them
98
+ efficiently. Reach for it when many objects share intrinsic state.
99
+ - **Proxy** — stand in for another object to control access to it (lazy loading,
100
+ access control, remoting, caching).
101
+
102
+ ### Behavioral — how objects interact and distribute responsibility
103
+
104
+ - **Chain of Responsibility** — give several objects a chance to handle a request
105
+ by passing it along a chain until one handles it, decoupling sender from receiver.
106
+ - **Command** — encapsulate a request as an object, enabling parameterization,
107
+ queuing, logging, and undo.
108
+ - **Interpreter** — represent a grammar and an interpreter that evaluates sentences
109
+ in that language. Reach for it only for simple, well-understood grammars.
110
+ - **Iterator** — traverse the elements of an aggregate sequentially without
111
+ exposing its underlying representation. Usually built into the language.
112
+ - **Mediator** — encapsulate how a set of objects interact in a mediator object,
113
+ promoting loose coupling by removing their direct references to each other.
114
+ - **Memento** — capture and externalize an object's internal state without breaking
115
+ encapsulation, so it can be restored later. Reach for it for undo/checkpoint.
116
+ - **Observer** — establish a one-to-many dependency so that when one object changes
117
+ state, its dependents are notified and updated automatically.
118
+ - **State** — let an object change its behavior when its internal state changes, as
119
+ if it changed class. Reach for it to replace sprawling state conditionals.
120
+ - **Strategy** — encapsulate a family of interchangeable algorithms behind a common
121
+ interface so the algorithm can vary independently of the clients that use it.
122
+ - **Template Method** — define the skeleton of an algorithm and defer some steps to
123
+ subclasses, which can redefine those steps without changing the structure.
124
+ - **Visitor** — represent an operation to perform on the elements of an object
125
+ structure, letting you add new operations without modifying those elements.
126
+
127
+ ---
128
+
129
+ These intents are paraphrased descriptions of the patterns from *Design Patterns:
130
+ Elements of Reusable Object-Oriented Software* (Gamma, Helm, Johnson, Vlissides);
131
+ the catalog is credited under Acknowledgments. Selecting among these patterns — and
132
+ resisting them when the simplest thing suffices — is governed by the counterweight
133
+ above and the Engineering Baseline's Arbitration Rule.
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: domain-modeling
3
+ description: >-
4
+ Tactical Domain-Driven Design for modeling complex core domains — deciding
5
+ where a business rule belongs, designing aggregate boundaries and their
6
+ consistency rules, choosing between an entity and a value object, introducing
7
+ domain events, and keeping code aligned with the domain's ubiquitous language.
8
+ Used by project-spec (advisory, shaping the spec and classifying subdomains)
9
+ and project-orchestrate (active, while implementing core-domain epics). Fires
10
+ only for behavior-rich core-domain logic. STAYS DORMANT for CRUD, generic and
11
+ supporting subdomains, technical plumbing, data pipelines, and simple
12
+ persistence — per Evans's own scoping: tactical DDD is for the core domain's
13
+ essential complexity, not generic subdomains.
14
+ ---
15
+
16
+ # Domain Modeling (Tactical DDD)
17
+
18
+ The tactical building blocks from *Domain-Driven Design* (Eric Evans). This skill
19
+ is the **situational layer** — it composes on top of the Engineering Baseline and
20
+ never overrides it.
21
+
22
+ ---
23
+
24
+ ## Read this before modeling
25
+
26
+ **Apply this only to the complex core domain.** Evans's own thesis: tactical DDD
27
+ earns its structure where essential business complexity lives — not in generic or
28
+ supporting subdomains, and never in CRUD, plumbing, or simple persistence. For
29
+ those, the Engineering Baseline's Arbitration Rule governs: write the simplest
30
+ thing that works.
31
+
32
+ The `subdomain` classification (`core` / `supporting` / `generic`) is set once,
33
+ at design time, by `project-spec`. `project-orchestrate` reads it and applies
34
+ this guidance **only to `core` epics**. Do not re-derive the classification
35
+ downstream.
36
+
37
+ Subordinate every decision below to the **Arbitration Rule** in
38
+ `../shared/references/ENGINEERING_BASELINE.md`. Aggregates and domain services add
39
+ layers; pay for them only where invariants demand it.
40
+
41
+ ---
42
+
43
+ ## Ubiquitous language
44
+
45
+ Evans's idea: make the domain model the backbone of a shared language, and have
46
+ the whole team use that language relentlessly — in speech, writing, diagrams, and
47
+ the code itself.
48
+
49
+ In practice: name classes, methods, and modules after the terms stakeholders
50
+ actually use. When the code's language drifts from the conversation, the model is
51
+ wrong — fix the names, and often the design follows.
52
+
53
+ ---
54
+
55
+ ## Building blocks (decision-oriented)
56
+
57
+ ### Entity vs. Value Object — choose deliberately
58
+ - **Entity** (Evans) — an object distinguished by its identity and life-cycle
59
+ continuity rather than its attributes; keep its definition focused on identity
60
+ and continuity over time. Use when the thing has a lifecycle and must be tracked
61
+ (an `Order`, an `Account`).
62
+ - **Value Object** (Evans) — an object you care about only for its attributes;
63
+ make it immutable, give it no identity, let it carry related behavior, and let
64
+ its attributes form a single conceptual whole (`Money`, `DateRange`, `Address`).
65
+ **Default to value objects** — they are simpler, safe to share, and push behavior
66
+ to where the data lives. Reach for an entity only when identity genuinely matters.
67
+
68
+ ### Where does a business rule live?
69
+ - A rule about a single concept belongs **on that entity or value object** (rich
70
+ behavior, not an anemic data bag — this aligns with Clean Code's "objects
71
+ expose behavior").
72
+ - A rule that spans several objects and belongs to none belongs in a **Domain
73
+ Service** (Evans) — a stateless operation offered as a standalone interface in
74
+ the model (unlike entities and value objects, it encapsulates no state). Name it
75
+ in the ubiquitous language. Use sparingly; most logic belongs on the model.
76
+ - A rule that enforces consistency across a cluster belongs at the **aggregate
77
+ root** (below).
78
+
79
+ ### Aggregates
80
+ - Evans's idea: cluster related entities and value objects into an **aggregate**
81
+ with a defined boundary, pick one entity as the **root**, and route all external
82
+ access through it — outside objects may hold a reference only to the root.
83
+ - Because the root controls access, it can enforce every invariant of the aggregate
84
+ on any state change.
85
+ - **Boundary heuristics:** keep aggregates small; one transaction modifies one
86
+ aggregate; reference other aggregates by identity, not by holding the object;
87
+ let cross-aggregate consistency be eventual.
88
+
89
+ ### Repositories
90
+ - Evans's idea: for each type that needs global access, provide an object that acts
91
+ like an in-memory collection of all objects of that type — with methods to add,
92
+ remove, and select by criteria — while hiding the actual data store. One
93
+ repository per aggregate root.
94
+ - Keep persistence concerns out of the domain; map rows to domain types behind
95
+ the repository interface (depend on the abstraction, per the baseline).
96
+
97
+ ### Factories
98
+ - Evans's idea: move creation of complex objects and aggregates into a dedicated
99
+ object whose interface encapsulates the assembly and hides the concrete classes
100
+ from the client. Use a factory to enforce invariants at creation; don't add one
101
+ for simple construction — that's anticipatory abstraction.
102
+
103
+ ### Domain Events
104
+ - **Note on provenance:** Domain Events are **not** a building block in Evans's
105
+ original 2003 *Domain-Driven Design*. They were added later (Evans's 2014
106
+ *Domain-Driven Design Reference*; popularized by Vernon's *Implementing DDD*).
107
+ Treat them as a widely-adopted extension, not original Evans canon.
108
+ - A **Domain Event** captures something meaningful that happened in the domain,
109
+ named in past tense (`OrderPlaced`, `PaymentCaptured`).
110
+ - Use to decouple aggregates and drive eventual consistency across boundaries —
111
+ not as a generic message bus for every state change.
112
+
113
+ ---
114
+
115
+ ## How this composes with design-patterns
116
+
117
+ Tactical DDD answers *what the domain objects are and which invariants they hold*;
118
+ `design-patterns` answers *how to structure code-level variation*. They can meet
119
+ (a Factory appears in both vocabularies), but model the domain first — let the
120
+ behavior and invariants drive the shape, and reach for a GoF pattern only if a
121
+ demonstrated axis of variation then calls for one, per its own counterweight.
@@ -303,6 +303,33 @@ After writing new tests, re-run the full suite to confirm all tests pass and cov
303
303
 
304
304
  ---
305
305
 
306
+ ## Phase 5.5: Multi-Lens Review Panel (v2.0.0+)
307
+
308
+ After fixes are applied (or in `--report-only` mode after the catalog is built) and BEFORE Final Validation, invoke the **review_panel.js** workflow script to run a multi-lens review across the final diff or scoped change set.
309
+
310
+ #### Path Resolution
311
+
312
+ Workflow ships at `<skills-root>/_workflows/review_panel.js`.
313
+
314
+ #### Invocation
315
+
316
+ ```yaml
317
+ diff: <git diff against the pre-cleanup baseline>
318
+ files: [{ path, contents }, ...] # for files that lack a pre-baseline (new files)
319
+ lenses: ["correctness", "security", "style", "tests"] # default; override per project
320
+ projectConventionsPath: <project>/CLAUDE.md # optional
321
+ ```
322
+
323
+ The workflow returns `{ panelVerdict, perLensVerdicts }`. The panel verdict is aggregated per the workflow's rule (any lens blocks → panel blocks; any accept-with-followups → panel accept-with-followups; else accept).
324
+
325
+ #### Apply the panel verdict
326
+
327
+ - `panelVerdict.recommendation === "block"` → record the blocking findings in the cleanup report's Critical section; do NOT proceed to Final Validation; surface the per-lens verdicts to the user.
328
+ - `panelVerdict.recommendation === "accept-with-followups"` → record follow-up findings in the cleanup report; proceed to Final Validation.
329
+ - `panelVerdict.recommendation === "accept"` → proceed to Final Validation.
330
+
331
+ Per-lens verdicts (with `lens` attribution preserved on each finding) are written verbatim to the cleanup report so users can see which lens raised each concern.
332
+
306
333
  ## Phase 6: Final Validation
307
334
 
308
335
  After all fixes (or after cataloging all issues in report-only mode), run a final validation pass.
@@ -505,6 +505,35 @@ Not every project will have all stages. Skip what doesn't apply. Add stages that
505
505
 
506
506
  ---
507
507
 
508
+ ## Phase 5.5: Adversarial Verification of Findings (v2.0.0+)
509
+
510
+ After Phase 5 produces raw findings and BEFORE the Coverage Report is finalized, invoke the **adversarial_verify.js** workflow script to verify each finding via the claimant / skeptic / judge pattern. This lifts emulation from "trust the emulator" to structured verdicts.
511
+
512
+ #### Path Resolution
513
+
514
+ Workflow ships at `<skills-root>/_workflows/adversarial_verify.js` (parent of this SKILL.md's parent → `_workflows/`).
515
+
516
+ #### Invocation
517
+
518
+ Pass the finding list (per `EmulationFindingSchema`) and optional `codebaseContext`:
519
+
520
+ ```yaml
521
+ findings: [<EmulationFinding>, ...] # collected during Phases 1-5
522
+ codebaseContext: { projectRoot: <path>, languages: ["typescript", ...] }
523
+ ```
524
+
525
+ The workflow returns `[{ finding, claim, skeptic, verdict }, ...]` where `verdict.isReal` is a boolean and `verdict.severity_adjustment` may suggest raising/lowering severity.
526
+
527
+ #### Apply the verdicts
528
+
529
+ For each verified finding:
530
+ - `verdict.isReal === false` → demote to Info OR drop entirely (your choice; if dropping, log the false-positive in a separate "Dismissed" section of ISSUES.md).
531
+ - `verdict.isReal === true` AND `verdict.severity_adjustment === "raise"` → bump severity one level.
532
+ - `verdict.isReal === true` AND `verdict.severity_adjustment === "lower"` → drop severity one level (Critical → Warning, Warning → Info).
533
+ - Otherwise keep as-is.
534
+
535
+ Findings that survive verification (and the survivors only) drive the Coverage Report and any hardening PRD downstream skills generate.
536
+
508
537
  ## Phase 6: Coverage Report
509
538
 
510
539
  After the walkthrough, produce a structured report:
@@ -11,10 +11,13 @@ Fully autonomous project lifecycle driver. Plans sprints, executes stories via p
11
11
 
12
12
  ## Before You Start
13
13
 
14
+ 0. **v2.0.0 runtime check.** Confirm the Claude Code **Workflow tool** is available in this session. v2.0.0 invokes workflow scripts at `<skills-root>/_workflows/*.js` for sprint execution, Pass 2 epic elaboration, multi-spec queueing, emulation finding verification, and the review gate. If the Workflow tool is absent, abort with: "v2.0.0 requires the Claude Code Workflow tool. Update Claude Code, or install the v1.8.x fallback (`npm install --save-dev @houseofwolvesllc/claude-scrum-skill@1.8.1`)." Do not proceed.
14
15
  1. Read `../shared/references/CONVENTIONS.md` for all project management standards. Follow these conventions exactly. Pay particular attention to **Epic Structure → Design-Spike Epic** — orchestration honors the design-spike epic's gating, so implementation work in a scoped run does not begin until the design-spike epic completes. Also note **Frontmatter Fields → PRD Document Frontmatter** — the `depends_on` field controls inter-spec execution order in sequential multi-path mode.
15
16
  1a. **Multi-path mode and new flags:** when invoked with 2+ existing-file paths, `/project-orchestrate` runs in sequential multi-path mode (each spec receives its own complete orchestration end-to-end). Two new flags are accepted: `--skip-on-pause` (default off; advance the queue when a spec hits a safety gate instead of pausing) and `--merged` (default off; treat multi-path inputs as one combined legacy multi-spec project with a deprecation warning). See **Input Parsing and Mode Detection** for the full classification and **Sequential Multi-Path Mode** for execution details.
16
17
  2. Read `../shared/config.json` to determine the scaffolding mode (`scaffolding` key: `"local"`, `"github"`, `"jira"`, or `"trello"`, default: `"local"`). If `"local"`, also read the `paths.backlog` and `paths.context` values (`paths.context` defaults to `.claude-scrum-skill/context` and is where Step 3 subagents look for per-epic CONTEXT.md files). Read `../shared/references/PROVIDERS.md` for provider-specific API commands when using a remote provider.
17
18
  3. Read the project's `CLAUDE.md` (if it exists) for project-specific rules. **All subagents you spawn must also read and follow `CLAUDE.md`** — include this instruction explicitly in every subagent prompt.
19
+ 3a. Read `../shared/references/ENGINEERING_BASELINE.md` — the universal engineering baseline (Clean Code, Test-Driven Development, and the simple-design Arbitration Rule). It applies to **all** work this orchestration drives, across every epic and story. Resolve its absolute path; you will pass it to the sprint pipeline as `baselinePath` so every implementation and review subagent follows it. Order of precedence: project `CLAUDE.md` > engineering baseline > situational guidance (`design-patterns`, `domain-modeling`).
20
+ 3b. **Subdomain classification gates situational guidance.** `/project-spec` classifies each epic as `core`, `supporting`, or `generic`, and `/project-scaffold` persists that classification into epic metadata: the `subdomain` field of each `_epic.md` frontmatter (local mode) or a `subdomain:<value>` label on the epic's issues (remote modes). Read the classification from that epic metadata — the single authoritative source — and do NOT re-derive it. At implementation time, only **`core`** epics receive the situational guidance skills (`design-patterns`, `domain-modeling`); `supporting`, `generic`, and unclassified epics get the baseline only. Resolve the absolute `SKILL.md` paths for the `design-patterns` and `domain-modeling` skills so you can pass them as `situationalGuidance` for core epics.
18
21
  4. Read `../shared/references/PERSONAS.md` for role preambles. When spawning
19
22
  subagents, select the persona matching each story's `persona:*` label (GitHub mode)
20
23
  or `persona` frontmatter field (local mode). If no persona exists, use `impl` (the default).
@@ -381,94 +384,57 @@ After planning completes, update the state file with the sprint stories and thei
381
384
 
382
385
  ### Step 3: Story Execution
383
386
 
384
- Execute all `executor:claude` stories in the current sprint. Skip `executor:human` and `executor:cowork` stories — they will roll over to the next sprint automatically.
387
+ Execute all `executor:claude` stories in the current sprint by invoking the **sprint_pipeline.js** workflow script. Skip `executor:human` and `executor:cowork` stories — they roll over to the next sprint automatically.
385
388
 
386
- **Parallel execution via Task subagents:**
389
+ #### Path Resolution
387
390
 
388
- For stories with no unresolved dependencies, spawn parallel Task subagents (using the `Task` tool with `subagent_type: "Bash"` or `subagent_type: "general-purpose"` as appropriate). Each subagent receives:
391
+ The workflow script ships at `<skills-root>/_workflows/sprint_pipeline.js`, where `<skills-root>` is the parent directory of this SKILL.md's parent. For a SKILL.md at `~/.claude/skills/project-orchestrate/SKILL.md`, the workflow script absolute path is `~/.claude/skills/_workflows/sprint_pipeline.js`. The same algorithm works for global, local, and plugin install layouts.
389
392
 
390
- **Persona resolution:** Before spawning each subagent, resolve its persona:
393
+ #### Pre-spawn checks
391
394
 
392
- 1. **GitHub mode:** Check the story's labels for a `persona:*` label (e.g., `persona:ops`, `persona:research`).
393
- **Local mode:** Read the `persona` field from the story file's frontmatter.
394
- 2. If found, load the matching preamble from `../shared/references/PERSONAS.md`.
395
- 3. If no persona exists, use the `impl` preamble.
396
- 4. If the persona references a name not defined in `PERSONAS.md`, fall back
397
- to `impl` and log a warning.
395
+ Before invoking the workflow:
398
396
 
399
- **Subagent prompt structure:**
397
+ 1. **Independence check.** Exclude stories whose `blocked_by` references unresolved blockers. Only pass ready stories to the workflow.
398
+ 2. **Persona resolution.** For each story, resolve its persona (`impl`, `ops`, `research`) from labels (GitHub/Trello/Jira) or the `persona` frontmatter field (local mode). Default to `impl`. Build a `personaPreambles` map from the preambles in `../shared/references/PERSONAS.md` to pass to the workflow.
399
+ 3. **Skip human/cowork stories.** Log them as skipped in the state file before invoking.
400
400
 
401
- ```
402
- <persona preamble from PERSONAS.md>
401
+ #### Invocation
403
402
 
404
- ---
403
+ Invoke the Workflow tool with `scriptPath` set to the resolved absolute path and `args` set to:
405
404
 
406
- You are executing story #<number> for repo <owner/repo>.
407
-
408
- **IMPORTANT:** First read the project's CLAUDE.md file if it exists, and
409
- follow all instructions in it. CLAUDE.md is authoritative for stack,
410
- patterns, and style it overrides any general guidance in this preamble.
411
-
412
- **IMPORTANT:** Before writing any code, if `<paths.context>/<epic-slug>/CONTEXT.md`
413
- exists, read it in full. Treat its Naming Conventions, File Layout, Shared
414
- Types & Interfaces, Patterns to Follow, and Patterns to Avoid sections as
415
- binding for this epic they override generic conventions in CLAUDE.md when
416
- in conflict, and you should follow them even when CLAUDE.md is silent. The
417
- `<paths.context>` and `<epic-slug>` values are substituted from the resolved
418
- config and the story's epic at spawn time.
419
-
420
- **Story:** <title>
421
- **Acceptance criteria:** <from issue body or story file>
422
- **Branch strategy:** Create branch `story/<number>-<slug>` from
423
- `release/<epic-slug>`, implement, commit, push, and open a PR targeting
424
- `release/<epic-slug>`.
425
-
426
- After implementation:
427
-
428
- GitHub mode:
429
- 1. Open a PR with a clear description of changes
430
- 2. Ensure CI passes
431
- 3. The PR should target the release branch, NOT development or main
432
- 4. Do NOT merge the PR — just open it and report back.
433
-
434
- Local mode:
435
- 1. Commit all changes to the story branch
436
- 2. Merge the story branch into release/<epic-slug>
437
- 3. Push the release branch
438
- 4. Report back what was implemented.
405
+ ```yaml
406
+ stories: <array of StorySchema-shaped story objects from the current sprint, filtered to executor:claude + ready>
407
+ epicSlug: <current epic slug>
408
+ releaseBranch: release/<epic-slug>
409
+ contextMdPath: <paths.context>/<epic-slug>/CONTEXT.md (or omit if no design-spike)
410
+ claudeMdPath: project CLAUDE.md absolute path (or omit if absent)
411
+ backendMode: local | github | jira | trello
412
+ repoIdentifier: <owner/repo> (github mode only)
413
+ personaPreambles: { impl: "...", ops: "...", research: "..." }
414
+ baselinePath: <absolute path to shared/references/ENGINEERING_BASELINE.md> (always set; applies to every story)
415
+ situationalGuidance: <array of absolute SKILL.md paths for design-patterns and domain-modeling set ONLY when the current epic's subdomain is `core`; omit or pass [] for supporting/generic/untagged epics>
439
416
  ```
440
417
 
441
- **Execution rules:**
442
-
443
- 1. **Independence check:** Before spawning subagents, analyze story dependencies. Only spawn stories whose blockers are all resolved.
444
- 2. **Concurrency limit:** Run up to 3 subagents in parallel to avoid rate limiting.
445
- 3. **Progress tracking:** As each subagent completes, update the state file and check if any blocked stories are now unblocked. Spawn newly unblocked stories immediately.
446
- 4. **Failure handling:** If a subagent fails, retry once with additional context about the failure. If it fails again, mark the story as blocked with a note and continue with remaining stories.
447
- 5. **Story completion:**
448
- - **GitHub mode:** After a story PR is opened and CI passes, merge it to the release branch:
449
- ```bash
450
- gh pr merge <pr-number> --repo <owner/repo> --squash --auto
451
- ```
452
- - **Local mode:** The subagent merges the story branch directly into the release branch. After completion, update the story file's frontmatter to `status: done`.
453
- 6. **Skip human/cowork stories:** Log them as skipped in the state file. They roll over naturally during sprint release.
454
- 7. **Persona routing:** When resolving personas:
455
- - **GitHub mode:**
456
- ```bash
457
- persona=$(gh issue view <number> --repo <owner/repo> --json labels \
458
- --jq '[.labels[].name | select(startswith("persona:"))] | first // empty' \
459
- | sed 's/persona://')
460
- persona=${persona:-impl}
461
- ```
462
- - **Local mode:** Read the `persona` field from the story file's frontmatter. Default to `impl` if not set.
463
-
464
- Load the corresponding preamble section from `../shared/references/PERSONAS.md`
465
- and prepend it to the subagent prompt. Log the persona assignment in the
466
- state file.
467
-
468
- **Progress updates** — Print a concise progress line every 2-3 story completions:
418
+ Wait for the workflow to return. The return is `SprintStoryReturn[]` — one entry per completed (or blocked / failed) story per `lib/workflows/schemas/SprintStoryReturnSchema.json`.
419
+
420
+ #### Post-workflow persistence
421
+
422
+ For each entry in the workflow's return:
423
+
424
+ - `status: "done"` — Update the story file's frontmatter to `status: done`. Record `branch`, `prUrl` (github) or merge commit (local), and commit SHAs in the state file's "Current Sprint Stories" table.
425
+ - `status: "blocked"` Record `blockers[]` and `reason` in the state file. Add the `blocked` label to the story (or mark blocked locally). Continue.
426
+ - `status: "failed"` — Same persistence as blocked, plus log the failure for sprint-release to roll over.
427
+
428
+ #### Concurrency and barriers
429
+
430
+ The workflow runs up to `min(16, cpu_cores - 2)` stories concurrently with no per-stage barriers — each story's pipeline is independent, so one slow review doesn't gate other stories' implementations. The barrier-removal benefit is unconditional; the concurrency lift is conditional on host cores (a 4-core host gets concurrency 2, an 8-core host gets 6, a 18+-core host gets the full 16). On all hosts this still beats v1.x's hardcoded 3 + barriers model on most sprint sizes.
431
+
432
+ #### Progress updates
433
+
434
+ The workflow surfaces structured progress via the Workflow tool's UI. Additionally, the executing agent SHOULD emit a concise summary line after the workflow returns:
469
435
 
470
436
  ```
471
- Sprint 2: 5/8 stories done (13/19 pts) — #21 auth middleware ✓, #22 rate limiting ✓
437
+ Sprint 2: 5/8 stories done (13/19 pts) — 2 blocked, 1 needs review
472
438
  ```
473
439
 
474
440
  ### Step 4: Sprint Release
@@ -906,16 +872,20 @@ Applies when Mode Classification selected sequential multi-path mode (2+ tokens,
906
872
 
907
873
  ### Per-Spec Loop
908
874
 
875
+ The per-spec loop is **executed by the skill markdown** (not a wrapping workflow), because the inner per-spec orchestration invokes individual workflows (`sprint_pipeline.js`, `elaborate_epics.js`, etc.) via the Workflow tool. The Workflow tool's nesting constraint ("one level of nesting only") prevents a multi-spec-queue workflow from invoking sub-workflows that themselves invoke workflows; the skill markdown is the right layer to orchestrate per-spec iteration.
876
+
909
877
  For each spec in the topologically-sorted execution order:
910
878
 
911
- 1. Update the queue state file (see below): mark this spec's row as `in-progress`, record `Started` timestamp.
912
- 2. Invoke the full single-spec orchestration against this spec. This is the existing v1.7.1 flow — Phase 1 (Epic Completion Loop, including scaffolding via `/project-scaffold`), Phase 2 (Emulation Hardening Loop), Phase 3 (Project Cleanup), Step 16 (ADR Update). Step 17 (state file cleanup) is **suppressed** in multi-path mode; the wrapper handles archival instead.
879
+ 1. Update the queue state file: mark this spec's row as `in-progress`, record `Started` timestamp.
880
+ 2. Invoke the full single-spec orchestration against this spec re-enter Phase 1 (Epic Completion Loop, including scaffolding via `/project-scaffold`), Phase 2 (Emulation Hardening Loop), Phase 3 (Project Cleanup), Step 16 (ADR Update). Each of these phases internally invokes workflows (`sprint_pipeline.js`, `elaborate_epics.js`, `adversarial_verify.js`, `review_panel.js`) as documented in their respective sections. Step 17 (state file cleanup) is **suppressed** in multi-path mode; archive instead with the slug-suffixed naming below.
913
881
  3. On the spec's natural completion: archive `.claude-scrum-skill/orchestration-state.md` to `.claude-scrum-skill/orchestration-state-<spec-slug>.previous.md` BEFORE the next spec begins. Update the queue state file: mark this spec's row as `completed`, record `Completed` timestamp, update aggregate stats.
914
882
  4. On the spec's safety-gate pause:
915
- - **Without `--skip-on-pause`** (default): the per-spec state file remains at `.claude-scrum-skill/orchestration-state.md` with `Status: paused`. Update the queue state file: mark this spec's row as `paused`, set queue `Status: paused`. Exit the wrapper. The remaining specs in the queue are NOT started. The user resolves the gate, re-invokes `/project-orchestrate` with the same arguments, and the queue resumes from this spec.
883
+ - **Without `--skip-on-pause`** (default): per-spec state file remains at `.claude-scrum-skill/orchestration-state.md` with `Status: paused`. Update the queue state file: mark this spec's row as `paused`, set queue `Status: paused`. Exit. Remaining specs are NOT started. User resolves the gate and re-invokes; queue resumes from the paused spec.
916
884
  - **With `--skip-on-pause`**: archive `.claude-scrum-skill/orchestration-state.md` to `.claude-scrum-skill/orchestration-state-<spec-slug>.skipped.md`. Update the queue state file: mark this spec's row as `skipped`, record the pause reason. Continue to the next spec.
917
885
  5. Per-spec orchestration runs to completion (or pause) before the next spec begins — no interleaving of sprints, no concurrent execution.
918
886
 
887
+ After all specs are processed, emit the Cumulative Summary per the subsection below.
888
+
919
889
  ### Spec Slug Derivation
920
890
 
921
891
  A spec's slug is derived from its filename: `basename(path, ".md")`.
@@ -146,6 +146,7 @@ epics:
146
146
  - name: <string>
147
147
  slug: <kebab-case string>
148
148
  description: <one-paragraph string>
149
+ subdomain: <core | supporting | generic — from the spec's .spec.json epic entry (SpecSchema)>
149
150
  slice:
150
151
  start_line: <int>
151
152
  end_line: <int>
@@ -173,29 +174,27 @@ After Pass 1 completes, evaluate the epic count:
173
174
 
174
175
  ### Pass 2 — Per-Epic Elaboration
175
176
 
176
- Spawn one subagent per epic. Each subagent receives a focused context:
177
+ Pass 2 is performed by the **elaborate_epics.js** workflow script. Replaces the v1.x Task-based fan-out (concurrency cap of 3) with one parallel wave (concurrency 16) and schema-validated returns.
177
178
 
178
- - The **global preamble** from Pass 1 (project overview, glossary, NFRs)
179
- - Its **assigned epic's PRD slice**, extracted using `slice.start_line`
180
- and `slice.end_line` from the manifest
181
- - A **skeleton summary** of sibling epics (name, slug, one-paragraph
182
- description, dependencies) — for cross-epic dependency awareness, NOT
183
- for elaboration
179
+ #### Path Resolution
184
180
 
185
- Each Pass 2 subagent produces the complete story list for its epic:
181
+ Workflow script ships at `<skills-root>/_workflows/elaborate_epics.js`, where `<skills-root>` is the parent of this SKILL.md's parent directory. For `~/.claude/skills/project-scaffold/SKILL.md`, the absolute workflow path is `~/.claude/skills/_workflows/elaborate_epics.js`.
186
182
 
187
- - Story titles
188
- - Acceptance criteria
189
- - Technical context
190
- - Story points (per CONVENTIONS.md guidelines)
191
- - Executor assignment (per CONVENTIONS.md guidelines)
192
- - Persona designation (local mode: the `persona` frontmatter field; GitHub/Jira/Trello modes: a `persona:*` label — see CONVENTIONS.md "Persona Labels" and PERSONAS.md for the canonical set)
193
- - Dependency declarations (`blocked_by`, `blocks`)
194
- - All other required frontmatter fields
183
+ #### Invocation
195
184
 
196
- **Concurrency cap:** Up to 3 Pass 2 subagents in parallel (matches
197
- `/project-orchestrate` Step 3 convention). Additional epics queue and
198
- start as earlier ones complete.
185
+ Invoke the Workflow tool with `scriptPath` set to the resolved path and `args`:
186
+
187
+ ```yaml
188
+ skeleton: { project: { name, description, global_preamble, non_functional_requirements }, epics: [...] } # the Pass 1 manifest
189
+ prdPath: <absolute path to the PRD>
190
+ conventionsPath: ../shared/references/CONVENTIONS.md # optional but recommended
191
+ ```
192
+
193
+ The workflow returns `Epic[]` per `lib/workflows/schemas/EpicSchema.json`, each with `stories[]` populated. Failed epics return `null` in the array.
194
+
195
+ #### Per-epic context (encoded by the workflow)
196
+
197
+ Each `elaborate:<epic-slug>` agent receives the global preamble, its epic's PRD slice (using `slice.start_line` / `slice.end_line` from the manifest), and a sibling-epic skeleton summary for cross-epic dependency awareness. The output story shape matches `lib/workflows/schemas/StorySchema.json`: title, slug, acceptance_criteria, technical_context, points (Fibonacci), executor, persona, priority, blocked_by, blocks, labels.
199
198
 
200
199
  ### Story Assembly
201
200
 
@@ -429,6 +428,7 @@ For each epic, create `<backlog-path>/<epic-slug>/`:
429
428
  title: <Epic Name>
430
429
  slug: <epic-slug>
431
430
  status: open
431
+ subdomain: <core | supporting | generic>
432
432
  created: <ISO timestamp>
433
433
  ---
434
434
 
@@ -437,6 +437,14 @@ created: <ISO timestamp>
437
437
  <Epic description from PRD>
438
438
  ```
439
439
 
440
+ **Carry the `subdomain` classification** from the spec's `.spec.json` epic entry
441
+ (per `SpecSchema`) into epic metadata: the `_epic.md` frontmatter above in local
442
+ mode, and a `subdomain:<value>` label on the epic's issues in remote modes. This
443
+ is the single authoritative carrier `/project-orchestrate` reads to gate
444
+ situational design guidance (`design-patterns`, `domain-modeling`) to `core`
445
+ epics. If the spec carries no `subdomain` (e.g., not produced by the extended
446
+ `/project-spec`), omit the field — orchestrate then treats the epic as generic.
447
+
440
448
  ### Local Step 5: Create Story Files
441
449
 
442
450
  For each story, create a numbered file in the epic directory. Use sequential