@danmoisan/drm-copilot-mcp 1.0.11 → 1.0.14

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.
Files changed (21) hide show
  1. package/out/mcp-server.js +585 -123
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +28 -3
  4. package/resources/claude-customizations/.claude/agents/epic-planner.md +121 -0
  5. package/resources/claude-customizations/.claude/agents/orchestrator.md +2 -2
  6. package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +246 -0
  7. package/resources/claude-customizations/.claude/hooks/persist-session-id.ps1 +153 -0
  8. package/resources/claude-customizations/.claude/settings.json +22 -2
  9. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +58 -24
  10. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +189 -0
  11. package/resources/claude-customizations/.claude/skills/epic-run/SKILL.md +38 -0
  12. package/resources/claude-customizations/.claude/skills/identify-session-id/SKILL.md +44 -0
  13. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +21 -2
  14. package/resources/claude-customizations/.claude/skills/show-my-agent-tree/SKILL.md +39 -0
  15. package/resources/claude-customizations/pack-manifests/core.json +7 -0
  16. package/resources/config/orchestration-routing.json +21 -0
  17. package/resources/feature-templates/epic/epic-status.md +20 -0
  18. package/resources/feature-templates/epic/epic.md +79 -0
  19. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +4 -0
  20. package/resources/templates/new-claude-worktree-session.ps1 +58 -9
  21. package/resources/feature-templates/epic/initiative.md +0 -43
@@ -2,10 +2,17 @@
2
2
  name: epic-orchestrate
3
3
  description: Route a multi-feature epic through the deterministic wave-scheduling, integration-branch, and fan-in workflow for the epic-orchestrator agent.
4
4
  argument-hint: "[epic-manifest-path]"
5
+ context: fork
6
+ agent: epic-orchestrator
5
7
  ---
6
8
 
7
9
  # Epic Orchestrate Skill
8
10
 
11
+ A user invocation (`/epic-orchestrate <epic-manifest-path>`) forks the `epic-orchestrator`
12
+ agent with this procedure in context. The epic manifest path (or epic slug) for this run is:
13
+
14
+ $ARGUMENTS
15
+
9
16
  This skill frames work for the `epic-orchestrator` agent, parallel to how
10
17
  `.claude/skills/orchestrate/SKILL.md` frames work for `orchestrator`. It documents the epic
11
18
  checkpoint handling, wave computation, integration-branch lifecycle, wave barrier,
@@ -22,10 +29,12 @@ Before proceeding, `epic-orchestrator` must:
22
29
 
23
30
  ## Epic Dependency Manifest
24
31
 
25
- The epic manifest is Markdown with YAML frontmatter, at
26
- `docs/features/epics/<epic-slug>/epic-plan.md`. The frontmatter carries the fields that must be
27
- parsed deterministically; the Markdown body below the frontmatter carries free-text epic
28
- narrative (goal, scope, non-goals) that is not machine-parsed.
32
+ The epic manifest is the YAML frontmatter of the single epic home
33
+ `docs/features/epics/<epic-slug>/epic.md`. `epic.md` is the merged source of truth: its
34
+ frontmatter carries the fields that must be parsed deterministically, and the Markdown body
35
+ below the frontmatter carries the single free-text epic narrative (goal, scope, non-goals,
36
+ shared design, decomposition) that is not machine-parsed. `epic.md` is also the source from
37
+ which the epic GitHub issue body is generated.
29
38
 
30
39
  Frontmatter schema:
31
40
 
@@ -34,19 +43,37 @@ Frontmatter schema:
34
43
  epic: <epic-slug>
35
44
  integration_branch: epic/<epic-slug>-integration
36
45
  created_at: <iso8601>
46
+ # Optional additive SAFe-style intent block. Omit the whole block when unused; when
47
+ # present, epic_type and business_outcome_hypothesis are required and
48
+ # leading_indicators / nfrs are optional lists of strings.
49
+ intent:
50
+ epic_type: <business | enabler>
51
+ business_outcome_hypothesis: <measurable outcome the epic is expected to move>
52
+ leading_indicators: [<early validation signal>, ...]
53
+ nfrs: [<non-functional requirement>, ...]
37
54
  features:
38
- - feature_folder: <feature-folder-basename>
39
- issue_num: <int>
40
- depends_on: [<feature-folder-basename>, ...]
55
+ - issue_num: <int>
56
+ feature_folder: <resolvable-hint-basename>
57
+ depends_on: [<upstream-issue_num>, ...]
41
58
  ---
42
59
  ```
43
60
 
44
- - `feature_folder` is the canonical identifier: the exact active-feature-folder basename,
45
- matching the vocabulary already used by the per-feature checkpoint's `feature-folder` field.
46
- - `depends_on` is an array of `feature_folder` values that must each already exist as another
47
- entry in `features[]`. A `depends_on` entry that does not resolve to a defined `feature_folder`,
48
- or a duplicate `feature_folder` value, is a malformed manifest and is rejected before epic
49
- kickoff as a synthetic Blocking finding `epic-orchestrator` does not guess.
61
+ - `issue_num` is the primary key: the stable GitHub issue number for the child feature. The
62
+ DAG is keyed by `issue_num`, so it does not drift when a child is promoted from `active/` to
63
+ `completed/`.
64
+ - `feature_folder` is a resolvable hint, not a stable identifier. It may resolve to a concrete
65
+ path under `docs/features/active/<basename>` or `docs/features/completed/<basename>`; a
66
+ lifecycle prefix is stripped to the basename during resolution.
67
+ - `depends_on` is an array of `issue_num` values (legacy manifests may still use
68
+ `feature_folder` basenames). Each entry must resolve — via the union index of the
69
+ `issue_num` set plus the `feature_folder` set — to another entry in `features[]`. A
70
+ `depends_on` entry that does not resolve, or a duplicate `feature_folder` value, is a
71
+ malformed manifest and is rejected before epic kickoff as a synthetic Blocking finding —
72
+ `epic-orchestrator` does not guess.
73
+ - The optional `intent` block is additive and presence-gated: when present it is validated
74
+ (`epic_type` in {business, enabler}, non-empty `business_outcome_hypothesis`, string-list
75
+ `leading_indicators` / `nfrs`); when absent, validation is byte-identical to a manifest
76
+ without it.
50
77
 
51
78
  ## Wave Assignment
52
79
 
@@ -137,10 +164,14 @@ When `epic-orchestrator` kicks off a feature with a non-empty `depends_on`, the
137
164
  includes one literal citation line per dependency, appended after the epic-mode kickoff line
138
165
  above:
139
166
 
140
- > `Upstream context for <feature_folder>: depends on <dep_feature_folder> (spec: docs/features/active/<dep_feature_folder>/spec.md — or docs/features/completed/<dep_feature_folder>/spec.md if already promoted to completed; plan: docs/features/active/<dep_feature_folder>/plan.<ts>.md; merged as PR #<dep_pr_number>, commit <dep_merge_commit_sha>, into <integration_branch>).`
167
+ > `Upstream context for <issue_num>: depends on <dep_issue_num> (spec: <dep_resolved_folder>/spec.md; plan: <dep_resolved_folder>/plan.<ts>.md; merged as PR #<dep_pr_number>, commit <dep_merge_commit_sha>, into <integration_branch>).`
141
168
 
142
- `epic-orchestrator` resolves the concrete `<dep_...>` values from its own checkpoint's
143
- `features[]` records for each dependency before emitting the line, so the dependent feature's own
169
+ `epic-orchestrator` resolves each dependency by its stable `issue_num` against its own
170
+ checkpoint's `features[]` records, and resolves `<dep_resolved_folder>` to the dependency's
171
+ concrete `feature_folder` path — under `docs/features/active/` or `docs/features/completed/`
172
+ depending on the dependency's current lifecycle state at emit time — before emitting the line.
173
+ Because the DAG is keyed by `issue_num`, no active→completed path-drift workaround is needed: the
174
+ concrete path is resolved from the checkpoint's current state, so the dependent feature's own
144
175
  `orchestrator`/`atomic-planner` is told exactly which upstream artifacts are relevant rather than
145
176
  being expected to rediscover prior design decisions from the diff alone.
146
177
 
@@ -207,12 +238,13 @@ child worktree) issues `git worktree remove <worktree_path>`, gated by
207
238
 
208
239
  ## Documentation Maintenance Boundaries
209
240
 
210
- `epic-plan.md` (the manifest) and `epic-status.md` (a separate, epic-orchestrator-maintained
211
- status document) are kept distinct. `epic-plan.md`'s frontmatter is the human-authored, largely
212
- static input; automatic epic decomposition is out of scope, so this file is not repeatedly
213
- rewritten. `epic-orchestrator` instead maintains
214
- `docs/features/epics/<epic-slug>/epic-status.md`, regenerated (not hand-edited) from the epic
215
- checkpoint at each of the following boundaries, not only at final completion:
241
+ `epic.md` (the merged manifest + narrative source of truth) and `epic-status.md` (a separate,
242
+ epic-orchestrator-maintained status document) are kept distinct. `epic.md`'s frontmatter is the
243
+ human-authored, largely static input; automatic epic decomposition is out of scope, so this
244
+ file is not repeatedly rewritten. `epic-status.md` is a generated projection only: it is
245
+ regenerated (never hand-authored) from the epic checkpoint and is never the source of the DAG.
246
+ `epic-orchestrator` maintains `docs/features/epics/<epic-slug>/epic-status.md`, regenerated from
247
+ the epic checkpoint at each of the following boundaries, not only at final completion:
216
248
 
217
249
  - Epic kickoff — initial status table seeded from the manifest (one row per feature: wave,
218
250
  status `not_started`).
@@ -229,12 +261,14 @@ checkpoint JSON remains the durable, machine-authoritative source.
229
261
  ## Epic-Level Checkpoint
230
262
 
231
263
  `artifacts/orchestration/epic-orchestrator-state.json` carries `objective`, `route_id: "epic"`,
232
- `epic_feature_folder`, `epic_manifest_path`, `epic_status_doc_path`, `integration_branch`,
264
+ `epic_feature_folder`, `epic_manifest_path` (which points at
265
+ `docs/features/epics/<epic-slug>/epic.md`), `epic_status_doc_path`, `integration_branch`,
233
266
  `completed_steps`, `next_step`, `last_updated`, `current_wave`, `waves[]`, `features[]`,
234
267
  `epic_merge_pr`, and the three receipt arrays (`delegation_receipts[]`, `skill_receipts[]`,
235
268
  `mcp_call_receipts[]`) — the full schema is defined in `spec.md` §6 of this feature. The
236
269
  `merge_status` enum is: `not_started`, `worktree_created`, `pr_open`, `ci_green`,
237
- `merge_conflict`, `blocked_conflict_loop_limit`, `merged`, `worktree_removed`.
270
+ `merge_conflict`, `blocked_conflict_loop_limit`, `merged`, `worktree_removed`. The optional
271
+ `intent` object (projection of the `epic.md` intent block) is validated presence-gated.
238
272
 
239
273
  Every field needed to re-derive state durably on resume (`worktree_path`, `branch_name`,
240
274
  `pr_number`, `merge_status`) is re-derivable from `git worktree list --porcelain`, `git branch`,
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: epic-plan
3
+ description: Scope and prepare a multi-feature epic end-to-end before execution for the epic-planner agent - epic-worthiness gate, decomposition, dependency-wave design, complexity assessment, preparation-mode child orchestrator delegations, integration-branch fan-in, and the epic-orchestrator kickoff prompt artifact.
4
+ argument-hint: "[epic objective or epic-manifest-path]"
5
+ context: fork
6
+ agent: epic-planner
7
+ ---
8
+
9
+ # Epic Plan Skill
10
+
11
+ A user invocation (`/epic-plan <objective>`) forks the `epic-planner` agent with this procedure
12
+ in context. The epic objective (or an existing epic-manifest path) for this run is:
13
+
14
+ $ARGUMENTS
15
+
16
+ This skill frames work for the `epic-planner` agent, parallel to how
17
+ `.claude/skills/epic-orchestrate/SKILL.md` frames work for `epic-orchestrator`. It documents the
18
+ epic-worthiness gate, decomposition and wave design, per-feature complexity assessment, the
19
+ preparation-mode child delegation contract, integration-branch fan-in, the kickoff-prompt
20
+ artifact, and planning-checkpoint handling so the procedure is not re-derived ad hoc on each
21
+ planning run. Planning ends at preflight clearance; no atomic execution, PR authoring, or CI
22
+ monitoring occurs under this skill.
23
+
24
+ ## Prerequisites
25
+
26
+ Before proceeding, `epic-planner` must:
27
+
28
+ 1. Read `CLAUDE.md` for repository tone policy and architectural context.
29
+ 2. Read applicable `.claude/rules/` files for the languages in scope.
30
+ 3. Read the policy files listed in the compliance reading order section of `CLAUDE.md`.
31
+
32
+ ## Epic-Worthiness Gate
33
+
34
+ The first planning step is a deterministic assessment of whether the objective warrants an epic:
35
+
36
+ - Decompose the objective into candidate child features, each independently mergeable with its
37
+ own issue, feature folder, and PR.
38
+ - The objective warrants an epic only when BOTH hold:
39
+ 1. The decomposition yields two or more child features, and
40
+ 2. At least one candidate feature exceeds — or the combined scope clearly exceeds — a single
41
+ large-path feature's practical change budget.
42
+
43
+ When the gate fails, `epic-planner` reports to the user that the complexity does not warrant an
44
+ epic, states the rationale (feature count and estimated change budget), and offers to delegate
45
+ the work directly to a single `Agent(orchestrator)` run as one feature. It records the verdict
46
+ under `epic_worthiness` in the planning checkpoint and proceeds with epic scaffolding only when
47
+ the gate passes or the user explicitly directs it to.
48
+
49
+ ## Decomposition and Wave Design
50
+
51
+ For an epic-worthy objective:
52
+
53
+ 1. Define the epic slug and epic home `docs/features/epics/<epic-slug>/`.
54
+ 2. Author `docs/features/epics/<epic-slug>/epic.md` using the manifest frontmatter schema
55
+ defined in the `epic-orchestrate` skill (that skill is the single schema authority; do not
56
+ redefine it here). The Markdown body carries the epic narrative: goal, scope, non-goals,
57
+ shared design, and decomposition rationale.
58
+ 3. Derive `depends_on` edges from real upstream/downstream contracts only; do not add ordering
59
+ edges for stylistic reasons, because every edge reduces execution parallelism.
60
+ 4. Compute wave assignment with the longest-path layering formula from the `epic-orchestrate`
61
+ skill (`scripts/dev_tools/epic_wave_computation.py` is the tested reference implementation)
62
+ and reject cycles or unresolved references before any preparation is delegated.
63
+ 5. Record the planned waves in the planning checkpoint and in the epic narrative.
64
+
65
+ At manifest-authoring time child issues do not exist yet, so `issue_num` values are recorded as
66
+ placeholders and back-filled from each child's promotion receipt as preparation completes. The
67
+ manifest is committed in final, resolved form before the kickoff artifact is written.
68
+
69
+ ## Complexity Assessment
70
+
71
+ Assess each child feature's complexity band (`C1`-`C4`) using the `model_policy` scale and
72
+ signals in `config/orchestration-routing.json`, and record the band with a short rationale in
73
+ the planning checkpoint's `features[]` entries and in the epic narrative. The bands serve two
74
+ purposes: they feed the epic-worthiness rationale, and they give each child orchestrator's own
75
+ model-selection step a reviewed starting assessment.
76
+
77
+ ## Integration Branch Lifecycle
78
+
79
+ 1. Before any preparation delegation, create the integration branch off the tip of `main` if it
80
+ does not already exist: `git fetch origin main`,
81
+ `git checkout -b epic/<epic-slug>-integration origin/main`,
82
+ `git push -u origin epic/<epic-slug>-integration`.
83
+ 2. Commit the epic home (`epic.md`) to the integration branch before delegating preparation.
84
+ 3. All prepared child outputs fan in to the integration branch (see Fan-In below), so the
85
+ branch's final state is the complete, execution-ready epic plan.
86
+
87
+ ## Preparation-Mode Child Delegation
88
+
89
+ Delegate one `Agent(orchestrator)` run per child feature. Because preparation produces documents
90
+ and plans rather than code, dependency edges impose no build-order constraint: launch ALL child
91
+ preparations concurrently (one message, N `Agent` calls, each `isolation: "worktree"` and
92
+ `run_in_background: true`), branching each worktree from `origin/epic/<epic-slug>-integration`.
93
+ For a dependent feature, include the upstream features' planned scope (spec/plan references or
94
+ manifest excerpts) as context lines so its spec and plan cite the upstream contracts they will
95
+ consume.
96
+
97
+ Each delegation prompt includes the literal preparation-mode kickoff line:
98
+
99
+ > `Preparation mode: true. route_id: preparation. epic_feature_folder: <epic-slug>. integration_branch: epic/<epic-slug>-integration. Perform promotion, research, feature documents (spec.md, user-story.md), atomic planning, and preflight clearance only. Atomic execution, PR authoring, and CI monitoring are out of scope for this run and are executed later by epic-orchestrator. After the atomic-executor preflight returns PREFLIGHT: ALL CLEAR, commit the feature folder and plan to the current branch, set out-of-scope step statuses to not-applicable, set next_step to S5_atomic_execution, and stop, reporting the plan-path and preflight status.`
100
+
101
+ The prompt must also reference the child's target feature folder path once promotion assigns it,
102
+ or the promotion inputs (potential entry path, short name) when it does not exist yet. The
103
+ preparation-mode kickoff line deliberately omits the epic-mode marker (`Epic mode: true`) so the
104
+ `enforce-epic-wave-barrier.ps1` deterrent, which gates execution-phase delegations, does not
105
+ apply to preparation.
106
+
107
+ ### Child run contract (route_id: preparation)
108
+
109
+ A preparation-mode `orchestrator` run:
110
+
111
+ - Selects `route_id: preparation` (defined in `config/orchestration-routing.json`), whose
112
+ required receipts are `task-researcher`, `prd-feature`, `atomic-planner`, and
113
+ `atomic-executor` (preflight-only), the skills `orchestrate`,
114
+ `feature-promotion-lifecycle`, and `atomic-plan-contract`, and the promotion plus validator
115
+ MCP tools.
116
+ - Runs promotion via the MCP surface, research, feature documents, atomic planning, and the
117
+ atomic-executor preflight (precondition validation only, per the orchestrate skill's R2
118
+ semantics), iterating plan revisions until `PREFLIGHT: ALL CLEAR`.
119
+ - Terminates with `completed_steps` containing `S3_promotion` and `S4_atomic_planning`,
120
+ `next_step: "S5_atomic_execution"`, out-of-scope step statuses `not-applicable`, and
121
+ `blocked_reason: "none"`. The route's `requires_ci_gate: false` means the completion validator
122
+ demands no `ci_gate`/`pr_gate` evidence; the run must NOT assert `next_step: "complete"`.
123
+
124
+ ## Fan-In to the Integration Branch
125
+
126
+ As each child preparation completes:
127
+
128
+ 1. Fetch the child worktree's branch and merge it into `epic/<epic-slug>-integration`. Prepared
129
+ outputs live in disjoint `docs/features/active/<feature>/` trees, so conflicts indicate a
130
+ decomposition defect; on conflict, halt fan-in and record blocked state rather than resolving
131
+ ad hoc.
132
+ 2. Back-fill the child's `issue_num` (and resolved `feature_folder`) into the epic manifest.
133
+ 3. Update the planning checkpoint's `features[]` entry (`preparation_status`, `plan_path`,
134
+ `preflight_status`).
135
+ 4. Remove the child worktree once its branch is merged.
136
+
137
+ After the final fan-in, push the integration branch.
138
+
139
+ ## Kickoff Prompt Artifact
140
+
141
+ After all features are prepared and committed, write the epic-orchestrator kickoff prompt to
142
+ `artifacts/orchestration/epic-kickoff-<epic-slug>.md`, and commit a durable copy to
143
+ `docs/features/epics/<epic-slug>/epic-kickoff.md` (the `artifacts/` tree is gitignored; the
144
+ committed copy travels with the integration branch). The artifact contains:
145
+
146
+ ```markdown
147
+ # Epic Kickoff: <epic-slug>
148
+
149
+ Planned by epic-planner on <iso8601>. All child features are prepared: issues promoted, active
150
+ folders created, research complete, spec/user-story written, atomic plans approved, preflight
151
+ ALL CLEAR. Planning state: artifacts/orchestration/epic-planner-state.json (branch:
152
+ epic/<epic-slug>-integration).
153
+
154
+ ## Invocation Prompt
155
+
156
+ Run `/epic-run <epic-slug>` to execute this epic, or paste the prompt below.
157
+
158
+ Use the epic-orchestrator subagent to execute the prepared epic at
159
+ docs/features/epics/<epic-slug>/epic.md. The integration branch
160
+ epic/<epic-slug>-integration already contains every prepared feature folder and approved atomic
161
+ plan; child features resume at atomic execution from their committed plan-path rather than
162
+ re-planning. Execute per the epic-orchestrate skill: wave-scheduled child orchestrator runs in
163
+ isolated worktrees, merge-on-green fan-in to the integration branch, and the final
164
+ integration-to-main PR.
165
+
166
+ ## Feature Summary
167
+
168
+ | issue_num | feature_folder | wave | complexity | plan-path |
169
+ | --- | --- | --- | --- | --- |
170
+ | ... | ... | ... | ... | ... |
171
+ ```
172
+
173
+ The `## Invocation Prompt` section is the exact text the user replays (from the main session,
174
+ never from an `orchestrator` agent) to launch execution.
175
+
176
+ ## Checkpoint Handling
177
+
178
+ Persist `artifacts/orchestration/epic-planner-state.json` after every completed step with the
179
+ fields listed in `.claude/agents/epic-planner.md` (`## Checkpoint Persistence`). On resume,
180
+ re-derive durable ground truth from `git branch`/`git worktree list --porcelain`, the epic
181
+ manifest, and the prepared feature folders; treat the checkpoint's `next_step` as the resume
182
+ pointer, not as a substitute for on-disk state.
183
+
184
+ ## Completion Report
185
+
186
+ The final report to the user must include: the epic manifest path, one `plan-path:` line plus
187
+ preflight status per feature, the integration branch name, and the kickoff artifact paths. End
188
+ with the statement that execution has NOT started and will begin only when the user runs
189
+ `/epic-run <epic-slug>` or replays the kickoff prompt.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: epic-run
3
+ description: Execute a previously planned epic by replaying the committed epic-kickoff artifact through the epic-orchestrator agent. Use after /epic-plan has prepared the epic (issues, folders, research, specs, atomic plans, preflight clearance) and the user is ready to execute end-to-end.
4
+ argument-hint: "[epic-slug]"
5
+ context: fork
6
+ agent: epic-orchestrator
7
+ ---
8
+
9
+ # Epic Run Skill
10
+
11
+ A user invocation (`/epic-run <epic-slug>`) forks the `epic-orchestrator` agent to execute an
12
+ epic that `epic-planner` has already prepared. The epic slug (or a path under
13
+ `docs/features/epics/`) for this run is:
14
+
15
+ $ARGUMENTS
16
+
17
+ ## Procedure
18
+
19
+ 1. Resolve the epic home. A bare slug resolves to `docs/features/epics/<epic-slug>/`; a path
20
+ argument resolves to its containing epic folder.
21
+ 2. Read the committed kickoff artifact at `docs/features/epics/<epic-slug>/epic-kickoff.md`.
22
+ - If the file does not exist, STOP without delegating anything and report that the epic has
23
+ no committed kickoff artifact: the user must run `/epic-plan` first (or, for an epic that
24
+ was authored manually, invoke `/epic-orchestrate <epic-manifest-path>` directly).
25
+ 3. Execute the kickoff artifact's `## Invocation Prompt` section as the epic objective, applying
26
+ the `epic-orchestrate` skill procedure and the `## Prepared-Epic Execution (epic-planner
27
+ Handoff)` section of `.claude/agents/epic-orchestrator.md`: reuse the existing integration
28
+ branch, and have each child `Agent(orchestrator)` delegation resume at atomic execution from
29
+ its committed `plan-path` rather than re-running promotion, research, or planning.
30
+ 4. Honor existing checkpoint state: if `artifacts/orchestration/epic-orchestrator-state.json`
31
+ already tracks this epic, resume per the `epic-orchestrate` skill's resume procedure instead
32
+ of restarting.
33
+
34
+ ## Scope
35
+
36
+ This skill adds no procedure of its own beyond kickoff-artifact resolution; wave scheduling,
37
+ the wave barrier, merge-on-green fan-in, worktree cleanup, `epic-status.md` maintenance, and
38
+ the final integration-to-`main` PR are governed entirely by the `epic-orchestrate` skill.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: identify-session-id
3
+ description: Resolve the current Claude Code session id (the root transcript filename stem) without human input, using an ordered fallback chain, and report which source supplied it. Use before any workflow that needs the running session's id (for example show-my-agent-tree).
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ ---
8
+
9
+ # Identify Session Id
10
+
11
+ Resolve the current session's id — the root transcript filename stem under
12
+ `~/.claude/projects/<encoded-workspace>/` — without asking the human. Try the
13
+ sources in order and stop at the first that yields a non-empty id. Always
14
+ report which source was used.
15
+
16
+ ## Resolution Order
17
+
18
+ 1. **Environment variable (primary).** Read `CLAUDE_SESSION_ID` from the
19
+ environment with a single command, e.g.:
20
+ - Bash: `printf '%s' "$CLAUDE_SESSION_ID"`
21
+ - pwsh: `pwsh -NoProfile -Command 'Write-Output $env:CLAUDE_SESSION_ID'`
22
+
23
+ This variable is provisioned by the SessionStart hook
24
+ `.claude/hooks/persist-session-id.ps1` through the `CLAUDE_ENV_FILE`
25
+ channel. If it is non-empty, use it and report source `env:CLAUDE_SESSION_ID`.
26
+
27
+ 2. **State file (secondary).** Read `.claude/state/current-session-id`
28
+ (written by the same hook when `CLAUDE_ENV_FILE` is unset). If it exists and
29
+ is non-empty, use its trimmed contents and report source
30
+ `.claude/state/current-session-id`.
31
+
32
+ 3. **Newest transcript (tertiary heuristic).** List the root `*.jsonl` files
33
+ directly under `~/.claude/projects/<encodeWorkspacePath(cwd)>/` (the encoding
34
+ replaces every path separator and `:` with `-`), pick the one with the
35
+ newest modification time, and use its filename stem (without `.jsonl`).
36
+ Report source `newest-mtime transcript` and note that this heuristic can
37
+ pick the wrong sibling only when multiple concurrent sessions share one
38
+ workspace path.
39
+
40
+ ## Output
41
+
42
+ Report the resolved session id and the source that supplied it, for example:
43
+ `session_id = <id> (source: env:CLAUDE_SESSION_ID)`. If every source is empty,
44
+ state that the session id could not be resolved and which sources were checked.
@@ -6,7 +6,17 @@ argument-hint: "[objective]"
6
6
 
7
7
  # Orchestrate Skill
8
8
 
9
- This skill frames work for the already-active main session, which serves as the orchestrator runtime for end-to-end feature or bug delivery.
9
+ This skill frames work for the already-active main session, which serves as the orchestrator runtime for end-to-end feature or bug delivery. Orchestration deliberately stays in the main session on user invocation (`/orchestrate <objective>`); the same procedure governs a delegated `Agent(orchestrator)` run from `epic-planner` or `epic-orchestrator`.
10
+
11
+ ## Invocation Argument
12
+
13
+ When invoked as `/orchestrate`, the orchestration objective is:
14
+
15
+ $ARGUMENTS
16
+
17
+ A delegated `Agent(orchestrator)` run receives its objective in the delegation prompt instead.
18
+
19
+ Perform the scale assessment first: if the objective is epic-scale (names an epic manifest or requires multiple independently mergeable features), stop before any delegation and direct the user to `/epic-plan` (planning) or `/epic-run` (executing a prepared epic), per `## Change Budget Routing` in `.claude/agents/orchestrator.md`.
10
20
 
11
21
  ## Prerequisites
12
22
 
@@ -77,9 +87,18 @@ After reading `artifacts/orchestration/orchestrator-state.json`, the main sessio
77
87
 
78
88
  The orchestrator does not perform deep implementation itself. It coordinates, tracks state, and enforces completion.
79
89
 
90
+ ## Preparation Mode
91
+
92
+ A delegation prompt carrying the literal marker `Preparation mode: true` (issued by `epic-planner` per the `.claude/skills/epic-plan/SKILL.md` kickoff line) scopes the run to planning only:
93
+
94
+ - **Route.** Select `route_id: preparation`. The route's routing-matrix entry requires receipts for `task-researcher`, `prd-feature`, `atomic-planner`, and `atomic-executor`; the skills `orchestrate`, `feature-promotion-lifecycle`, and `atomic-plan-contract`; and the promotion plus validator MCP tools.
95
+ - **Scope.** Run promotion (MCP surface), research, feature documents (`spec.md`, `user-story.md`), atomic planning, and the atomic-executor preflight (precondition validation only, R2 semantics: iterate plan revisions until `PREFLIGHT: ALL CLEAR`). Atomic execution, PR authoring, CI monitoring, and feature review are out of scope and are executed later by `epic-orchestrator`.
96
+ - **Terminal checkpoint.** Stop with `completed_steps` containing `S3_promotion` and `S4_atomic_planning`, `next_step: "S5_atomic_execution"`, out-of-scope step statuses set to `not-applicable`, and `blocked_reason: "none"`. Do NOT assert completion (`next_step: "complete"`, `S12_complete`, or a `completed` step8/9/10 status): the run has no PR or CI evidence, and the route's `requires_ci_gate: false` exempts it from `ci_gate` at the completion validator instead.
97
+ - **Commit.** Commit the prepared feature folder and plan to the current branch (the worktree branch created off the epic integration branch) before stopping, and report the `plan-path` and preflight status in the final output.
98
+
80
99
  ## Model Selection
81
100
 
82
- Model selection is a second axis, strictly separate from `route`. `route` (`small | large | remediation | epic`) is deterministic and file-count driven; it governs `required_agents`, `required_skills`, and `required_mcp_tools` only. `route` is NOT an input to model selection anywhere. The sole feature-level input to the delegation model tier is a judgment-based `complexity_band` (`C1 | C2 | C3 | C4`). The authoritative values live in the `model_policy` block of `config/orchestration-routing.json`.
101
+ Model selection is a second axis, strictly separate from `route`. `route` (`small | large | remediation | preparation | epic`) is deterministic file-count driven for `small`/`large`, marker-driven for `preparation` (the `Preparation mode: true` kickoff line) and `epic`; it governs `required_agents`, `required_skills`, and `required_mcp_tools` only. `route` is NOT an input to model selection anywhere. The sole feature-level input to the delegation model tier is a judgment-based `complexity_band` (`C1 | C2 | C3 | C4`). The authoritative values live in the `model_policy` block of `config/orchestration-routing.json`.
83
102
 
84
103
  The two canonical, tested reference implementations express the formulas the orchestrator applies by judgment:
85
104
 
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: show-my-agent-tree
3
+ description: Render the current session's subagent call tree and print it in the assistant reply. Use when the user asks to "show my agent tree" or otherwise wants to see the subagent hierarchy of the running session.
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - mcp__drm-copilot__render_subagent_tree
8
+ ---
9
+
10
+ # Show My Agent Tree
11
+
12
+ Render the subagent call tree for the current session and print it directly in
13
+ the assistant reply. This works identically in normal turns and in `/btw`
14
+ side-conversations and needs no VS Code host API.
15
+
16
+ ## Flow
17
+
18
+ 1. **Resolve the session id.** Follow the `identify-session-id` skill to obtain
19
+ the current session id and note which source supplied it.
20
+
21
+ 2. **Call the MCP tool.** Invoke `mcp__drm-copilot__render_subagent_tree` with:
22
+ - `session_id`: the id resolved in step 1.
23
+ - `workspace_root`: an explicit absolute path to the current workspace root
24
+ (do not rely on the tool's default; pass it explicitly).
25
+
26
+ On success the tool returns `ok: true`, a `summary` naming the session id
27
+ and resolved transcript path, and a `rendered_tree` string.
28
+
29
+ 3. **Print the tree.** Output the `rendered_tree` value in the assistant reply
30
+ inside a fenced code block, so the hierarchy is legible. Include the
31
+ `summary` line above it for context.
32
+
33
+ ## Error Handling
34
+
35
+ - If the tool returns `ok: false`, report the `summary` verbatim. An unknown
36
+ session id names the searched directories; a malformed session id names the
37
+ validation rule (`^[0-9A-Za-z-]{8,64}$`).
38
+ - If `identify-session-id` cannot resolve an id, report that and do not call
39
+ the tool.
@@ -7,6 +7,7 @@
7
7
  ".claude/agents/atomic-planner.md",
8
8
  ".claude/agents/commit-message.md",
9
9
  ".claude/agents/epic-orchestrator.md",
10
+ ".claude/agents/epic-planner.md",
10
11
  ".claude/agents/epic-review.md",
11
12
  ".claude/agents/feature-review.md",
12
13
  ".claude/agents/human-exception-runbook.md",
@@ -17,6 +18,7 @@
17
18
  ".claude/agents/task-researcher.md",
18
19
  ".claude/hooks/enforce-checkpoint-monotonic.ps1",
19
20
  ".claude/hooks/enforce-completion-consistency.ps1",
21
+ ".claude/hooks/enforce-epic-invocation-origin.ps1",
20
22
  ".claude/hooks/enforce-epic-merge-gate.ps1",
21
23
  ".claude/hooks/enforce-epic-wave-barrier.ps1",
22
24
  ".claude/hooks/enforce-epic-worktree-removal-gate.ps1",
@@ -28,6 +30,7 @@
28
30
  ".claude/hooks/enforce-pr-author-skill.ps1",
29
31
  ".claude/hooks/enforce-prd-feature-before-planner.ps1",
30
32
  ".claude/hooks/enforce-promotion-mcp-only.ps1",
33
+ ".claude/hooks/persist-session-id.ps1",
31
34
  ".claude/hooks/validate-bash.ps1",
32
35
  ".claude/hooks/validate-executor-output.ps1",
33
36
  ".claude/hooks/validate-feature-review-coverage.ps1",
@@ -48,6 +51,8 @@
48
51
  ".claude/skills/atomic-plan-contract/SKILL.md",
49
52
  ".claude/skills/commit-message/SKILL.md",
50
53
  ".claude/skills/epic-orchestrate/SKILL.md",
54
+ ".claude/skills/epic-plan/SKILL.md",
55
+ ".claude/skills/epic-run/SKILL.md",
51
56
  ".claude/skills/evidence-and-timestamp-conventions/SKILL.md",
52
57
  ".claude/skills/execute-hard-lock/SKILL.md",
53
58
  ".claude/skills/feature-promotion-lifecycle/SKILL.md",
@@ -55,6 +60,7 @@
55
60
  ".claude/skills/fill-feature-docs/SKILL.md",
56
61
  ".claude/skills/human-exception-runbook/example.runbook.md",
57
62
  ".claude/skills/human-exception-runbook/SKILL.md",
63
+ ".claude/skills/identify-session-id/SKILL.md",
58
64
  ".claude/skills/make-skill-template/SKILL.md",
59
65
  ".claude/skills/orchestrate/SKILL.md",
60
66
  ".claude/skills/policy-audit-template-usage/SKILL.md",
@@ -67,6 +73,7 @@
67
73
  ".claude/skills/review-epic/SKILL.md",
68
74
  ".claude/skills/review-feature/SKILL.md",
69
75
  ".claude/skills/review-staged/SKILL.md",
76
+ ".claude/skills/show-my-agent-tree/SKILL.md",
70
77
  ".claude/skills/skill-canonical-location-audit/SKILL.md",
71
78
  ".claude/skills/translate-copilot-to-claude/SKILL.md",
72
79
  ".claude/skills/update-status/SKILL.md",
@@ -72,6 +72,27 @@
72
72
  "validate_orchestration_artifacts"
73
73
  ]
74
74
  },
75
+ "preparation": {
76
+ "description": "Epic preparation path driven by epic-planner: promotion, research, feature documents, atomic planning, and preflight clearance only. Atomic execution, PR authoring, and CI monitoring are out of scope and deferred to the epic execution phase, so this route requires no CI gate at completion.",
77
+ "requires_ci_gate": false,
78
+ "required_agents": [
79
+ "task-researcher",
80
+ "prd-feature",
81
+ "atomic-planner",
82
+ "atomic-executor"
83
+ ],
84
+ "required_skills": [
85
+ "orchestrate",
86
+ "feature-promotion-lifecycle",
87
+ "atomic-plan-contract"
88
+ ],
89
+ "required_mcp_tools": [
90
+ "new_potential_entry",
91
+ "potential_to_issue",
92
+ "new_active_feature_folder",
93
+ "validate_orchestration_artifacts"
94
+ ]
95
+ },
75
96
  "epic": {
76
97
  "description": "Epic path for scheduling a dependency graph of child features across parallel worktrees with fan-in via a shared integration branch.",
77
98
  "requires_pr_gate": true,
@@ -0,0 +1,20 @@
1
+ <!--
2
+ GENERATED FILE — DO NOT HAND-AUTHOR.
3
+
4
+ epic-status.md is a generated projection of the epic checkpoint
5
+ (artifacts/orchestration/epic-orchestrator-state.json). It is regenerated by
6
+ the epic-orchestrator agent at each lifecycle boundary (epic kickoff, every
7
+ feature merge_status change, each wave transition, and final integration
8
+ merge). It is never the source of the dependency DAG and must never be edited
9
+ by hand — the manifest in epic.md and the epic checkpoint JSON are the
10
+ authoritative sources.
11
+ -->
12
+
13
+ # <epic-name> - Epic Status (generated)
14
+
15
+ This document is regenerated from the epic checkpoint and must not be
16
+ hand-authored. Any manual edit will be overwritten on the next regeneration.
17
+
18
+ | feature_folder | issue_num | wave_number | merge_status | pr_url | merge_commit_sha |
19
+ | --- | --- | --- | --- | --- | --- |
20
+ | _(populated on epic kickoff from the manifest, then updated in place)_ | | | | | |