@danmoisan/drm-copilot-mcp 1.0.21 → 1.0.22

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 (31) hide show
  1. package/out/mcp-server.js +1624 -190
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agent-memory/epic-orchestrator/MEMORY.md +5 -1
  4. package/resources/claude-customizations/.claude/agent-memory/epic-orchestrator/feedback_commit_push_memory_before_pr.md +48 -2
  5. package/resources/claude-customizations/.claude/agent-memory/epic-orchestrator/feedback_no_sendmessage_tool.md +35 -0
  6. package/resources/claude-customizations/.claude/agent-memory/epic-orchestrator/feedback_worktree_isolation_branches_from_main.md +45 -0
  7. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +238 -0
  8. package/resources/claude-customizations/.claude/agents/parallel-planner.md +149 -0
  9. package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +23 -11
  10. package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +259 -0
  11. package/resources/claude-customizations/.claude/hooks/enforce-parallel-cohort-barrier.ps1 +499 -0
  12. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate-helpers.ps1 +302 -0
  13. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate.ps1 +359 -0
  14. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +244 -0
  15. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadius.psm1 +379 -0
  16. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusConfig.psm1 +491 -0
  17. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +490 -0
  18. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusGlob.psm1 +429 -0
  19. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusValidation.psm1 +366 -0
  20. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +184 -0
  21. package/resources/claude-customizations/.claude/settings.json +25 -0
  22. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +148 -0
  23. package/resources/claude-customizations/.claude/skills/parallel-close/SKILL.md +93 -0
  24. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +960 -0
  25. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +420 -0
  26. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +176 -0
  27. package/resources/claude-customizations/.claude/skills/parallel-run/SKILL.md +56 -0
  28. package/resources/claude-customizations/pack-manifests/core.json +19 -1
  29. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  30. package/resources/config/orchestration-routing.json +22 -0
  31. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +29 -0
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: parallel-add
3
+ description: Admit one new item into a running parallel run — preparation via a preparation-mode child orchestrator run, conflict-edge computation against all items including in-flight ones, and the admission decision that either places the item in the current cohort or defers it and recolors the unstarted subgraph. Appends exactly one mutations[] entry. In-flight items are never moved.
4
+ argument-hint: "[issue|potential-entry]"
5
+ context: fork
6
+ agent: parallel-orchestrator
7
+ ---
8
+
9
+ # Parallel Add Skill
10
+
11
+ A user invocation (`/parallel-add <issue|potential-entry>`) forks the `parallel-orchestrator`
12
+ agent with this procedure in context. The issue reference or potential-entry path to admit is:
13
+
14
+ $ARGUMENTS
15
+
16
+ This skill implements the mutation-protocol add operation (spec FR1). It mutates a parallel run
17
+ that is already executing: the run's cohorts, its `recolor_generation`, and its `mutations[]`
18
+ audit log all belong to the parallel-orchestrator checkpoint, and the pinning invariant of the
19
+ `## Mutation Protocol (F6)` section of `.claude/skills/parallel-orchestrate/SKILL.md` governs what
20
+ this operation may and may not disturb. Read that section before applying anything here.
21
+
22
+ ## Prerequisites
23
+
24
+ - A parallel run is in progress and `artifacts/orchestration/parallel-orchestrator-state.json`
25
+ tracks its `parallel_slug`. This skill does not start a run; use `/parallel-plan` and
26
+ `/parallel-run` for that.
27
+ - `$ARGUMENTS` names exactly one item: a GitHub issue number or reference, or a path to an entry
28
+ under `docs/features/potential/`. An argument naming more than one item is rejected; admit one
29
+ item per invocation so each admission decision and its mutation entry stay attributable.
30
+
31
+ ## Re-Derive Durable State Before Applying Anything
32
+
33
+ The checkpoint is a CACHE of durable state, not the source of truth
34
+ (`.claude/rules/parallel-orchestration.md`, Cache Doctrine). Before computing any admission
35
+ decision, re-derive the run's true state and rewrite the checkpoint from it when they disagree:
36
+
37
+ - `git worktree list --porcelain` — worktree existence and path per item.
38
+ - `git branch` — branch existence and name per item.
39
+ - `gh pr view <pr> --json state,mergedAt,headRefOid` — pull-request state and merge outcome per
40
+ item.
41
+
42
+ The in-flight set this operation reads is derived from that re-verified state. Admitting against a
43
+ stale in-flight set is the one way this operation can violate the pinning invariant, so the
44
+ re-derivation is mandatory and is not an optimization to skip when the checkpoint "looks current".
45
+
46
+ ## Procedure
47
+
48
+ 1. **Enter `proposed`.** Add the item to `items[]` in state `proposed` with its `issue_num` as the
49
+ primary key. Item keys are integers throughout this surface; there is no string key.
50
+
51
+ 2. **Prepare the item.** Run preparation through a preparation-mode child `Agent(orchestrator)`
52
+ run, reusing the existing `route_id: preparation` contract UNCHANGED: promotion, research,
53
+ `spec.md`, `user-story.md`, the atomic plan, and preflight clearance. Do not fork a variant
54
+ contract for parallel admission. Preparation yields the item's DECLARED blast radius, and only
55
+ the planner-computed declared radius is authoritative for scheduling. The item's lifecycle
56
+ advances `proposed` -> `admitted` -> `prepared` during this step, recorded as item-state updates in
57
+ `items[]` with the checkpoint's lifecycle timestamps.
58
+
59
+ 3. **Compute conflict edges over ALL items, including in-flight ones.** Invoke the landed
60
+ contention relation `conflicts(a, b, config)` from `scripts/dev_tools/compute_blast_radius.py`
61
+ (defined in `scripts/dev_tools/_blast_radius_conflicts.py`). `a` and `b` are the two items'
62
+ `BlastRadius` value objects, not strings, and `config` is the required parsed
63
+ `config/blast-radius.json` mapping. Map each conflicting pair onto an `(int, int)` conflict edge
64
+ of `items[].issue_num` values, normalized so `a < b`. Do not reimplement the relation and do not
65
+ compute edges over the unstarted subset only: an in-flight conflict is precisely what the
66
+ admission decision turns on.
67
+
68
+ 4. **Decide admission.** Call
69
+ `decide_admission(candidate, conflict_edges, in_flight, current_cohort_members=current_cohort_members)`
70
+ from `scripts/dev_tools/parallel_mutation_protocol.py`.
71
+ - `ADMIT_CURRENT_COHORT` — the candidate shares no edge with any member of the current cohort,
72
+ pinned or unstarted. Admit it into the current cohort. NO recompute occurs and
73
+ `recolor_generation` is unchanged — precisely because the candidate conflicts with no
74
+ current-cohort member, so no cohort assignment needs to change.
75
+ - `DEFER_AND_RECOLOR` — the candidate shares an edge with at least one member of the current
76
+ cohort, pinned or not-yet-launched. Defer it to a future cohort and recolor by calling
77
+ `recolor_unstarted(unstarted_items, conflict_edges, pinned, current_generation, current_cohort=current_cohort)`.
78
+ The recolor is a recompute: `recolor_generation` increments by exactly one, and it places every
79
+ unstarted item at an index at or above `current_cohort`, strictly above it when a pinned
80
+ conflict exists.
81
+
82
+ Derive `current_cohort_members` from the re-verified durable state, not from the cached
83
+ checkpoint: it is the full membership of the current-generation cohort at `current_cohort`,
84
+ INCLUDING its not-yet-launched `scheduled` members. Derive `current_cohort` from that same
85
+ re-verified state; it is F3's top-level `current_cohort` field and is the index the pinned items
86
+ occupy. Both matter because `max_concurrency` caps simultaneously in-flight items independently
87
+ of cohort size and refills each freed slot from the same current cohort — see
88
+ `## Cohort Barrier and Max-Concurrency Slot Filling` in
89
+ `.claude/skills/parallel-orchestrate/SKILL.md` — so the current cohort durably holds `scheduled`
90
+ members that a candidate can contend with.
91
+
92
+ A conflict with an unstarted member of the CURRENT cohort defers the candidate and recolors,
93
+ because the next `max_concurrency` batch would otherwise launch the two concurrently. A conflict
94
+ with an unstarted item OUTSIDE the current cohort does not defer: the cohort barrier keeps the
95
+ two from running concurrently, so the coloring's existing separation already resolves it.
96
+
97
+ 5. **Apply the recolor result.** Write `RecolorResult.cohort_assignments` into `cohorts[]` and set
98
+ the top-level `recolor_generation` to `RecolorResult.generation`. The result's key set equals the
99
+ unstarted set exactly and contains no pinned key: no in-flight item changes cohort or state as a
100
+ result of this admission. Verify that before writing, and stop rather than write a result that
101
+ names a pinned key. The admit branch performs no recolor at all, precisely because the candidate
102
+ conflicts with no current-cohort member.
103
+
104
+ The returned `cohort_assignments` values are **ABSOLUTE cohort indices**. Write them VERBATIM
105
+ into `cohorts[].index`; never re-base them to zero. When the lowest returned index equals
106
+ `current_cohort` — the no-pinned-conflict case, where the offset is not applied — the returned
107
+ keys at that index are **MERGED into the single existing current-generation cohort entry at
108
+ `current_cohort`** alongside its pinned members, and are never written as a second cohort entry
109
+ carrying the same `index`, because F3 invariant 13 requires current-generation `cohorts[].index`
110
+ values to be unique (`scripts/dev_tools/_parallel_state_structures.py:282-305` — duplicate-index
111
+ detection at 282-293, error emission at 301-305).
112
+
113
+ 6. **Append exactly one `mutations[]` entry**, at admission-decision time, built by
114
+ `build_add_entry` from `scripts/dev_tools/parallel_mutation_protocol.py`:
115
+
116
+ | Case | `op` | `item_key` | `prior_state` | `new_state` | `disposition` | `recolor_generation` |
117
+ | --- | --- | --- | --- | --- | --- | --- |
118
+ | No-conflict admit | `add` | item key | null | `scheduled` | null | `g` (unchanged) |
119
+ | Deferred admit | `add` | item key | null | `scheduled` | null | `g` + 1 |
120
+
121
+ `prior_state` is null on BOTH add rows. The accompanying `prepared` -> `scheduled` transition is
122
+ not lost and is not recorded in the mutation entry: it is recorded as an item-state update in
123
+ `items[]`, the same mechanism that records `proposed` -> `admitted` -> `prepared` in step 2. The
124
+ `at` timestamp comes from the engine's injected clock seam.
125
+
126
+ 7. **Validate the checkpoint** before treating the admission as applied. Run the
127
+ `validate_orchestration_artifacts` MCP tool with `artifact_type:
128
+ "parallel-orchestrator-state"`. A non-empty error list means the admission was applied
129
+ incorrectly; correct the checkpoint rather than proceeding.
130
+
131
+ ## Constraints
132
+
133
+ - One admission per invocation, one `mutations[]` entry per successful admission. A failed
134
+ preparation appends no entry and leaves `items[]` without the candidate.
135
+ - No field and no enum member is added to `mutations[]`, `conflict_edges[]`, `items[]`, or any
136
+ state or merge-status enum. The nine parallel enums are owned by
137
+ `.claude/rules/parallel-orchestration.md` and are consumed, never extended.
138
+ - This operation never moves, restates, or re-derives an in-flight item's cohort or state.
139
+ - This operation performs no destructive side effect: it closes no pull request and removes no
140
+ worktree. Those belong to `/parallel-remove` with `--disposition abandon`.
141
+
142
+ ## Completion Requirements
143
+
144
+ - Report the admitted item key, the admission outcome, the resulting `recolor_generation`, and the
145
+ single appended `mutations[]` entry.
146
+ - Report the cohort index the item landed in, and confirm explicitly that no in-flight item's
147
+ cohort or state changed.
148
+ - Report the checkpoint validation result.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: parallel-close
3
+ description: Terminate an open-mode parallel run. Rejected while any item is in flight, in which case nothing is appended and no state changes. A successful close appends one run-scoped mutations[] entry and performs no recompute. This is the only way an open-mode run terminates; open mode never auto-completes.
4
+ argument-hint: "[parallel-slug]"
5
+ context: fork
6
+ agent: parallel-orchestrator
7
+ ---
8
+
9
+ # Parallel Close Skill
10
+
11
+ A user invocation (`/parallel-close <parallel-slug>`) forks the `parallel-orchestrator` agent with
12
+ this procedure in context. The parallel slug of the run to terminate is:
13
+
14
+ $ARGUMENTS
15
+
16
+ This skill implements the mutation-protocol close operation (spec FR3). It terminates an
17
+ `open`-mode run, which has no other termination signal: the mode-dependent completion semantics in
18
+ the `## Mutation Protocol (F6)` section of `.claude/skills/parallel-orchestrate/SKILL.md` state that
19
+ an `open`-mode run never auto-completes. Read that section before applying anything here.
20
+
21
+ ## Prerequisites
22
+
23
+ - A parallel run is in progress and `artifacts/orchestration/parallel-orchestrator-state.json`
24
+ tracks the `parallel_slug` named in `$ARGUMENTS`.
25
+ - The run's `mode` is `open`. A `closed`-mode run completes through its completion predicate — every
26
+ non-withdrawn item `merged` or `worktree_removed` — and needs no close. Report that and stop
27
+ rather than closing a `closed`-mode run to force completion.
28
+
29
+ ## Re-Derive Durable State Before Applying Anything
30
+
31
+ The checkpoint is a CACHE of durable state, not the source of truth
32
+ (`.claude/rules/parallel-orchestration.md`, Cache Doctrine). Before deciding the close, re-derive
33
+ the run's true per-item state and rewrite the checkpoint from it when they disagree:
34
+
35
+ - `git worktree list --porcelain` — worktree existence and path per item.
36
+ - `git branch` — branch existence and name per item.
37
+ - `gh pr view <pr> --json state,mergedAt,headRefOid` — pull-request state and merge outcome per
38
+ item.
39
+
40
+ The close gate turns entirely on whether any item is in flight, so a stale in-flight set decides
41
+ the gate wrongly. Closing while an item is genuinely running would abandon that work implicitly,
42
+ which is exactly what the gate exists to prevent. The re-derivation is mandatory.
43
+
44
+ ## Procedure
45
+
46
+ 1. Re-derive durable state as above and resolve the run's `items[]`.
47
+
48
+ 2. **Gate the close on no item being in flight.** Call `decide_close(items)` from
49
+ `scripts/dev_tools/parallel_mutation_protocol.py`. It raises the dedicated rejection exception
50
+ carrying EVERY in-flight key, so the rejection names all the work that must finish first rather
51
+ than one item at a time. On rejection: report the blocking keys and stop. A rejected close
52
+ appends NO `mutations[]` entry and makes NO state change — do not record the attempt.
53
+
54
+ 3. **Append exactly one run-scoped `mutations[]` entry** for a successful close, built by
55
+ `build_close_entry` from `scripts/dev_tools/parallel_mutation_protocol.py`:
56
+
57
+ | Case | `op` | `item_key` | `prior_state` | `new_state` | `disposition` | `recolor_generation` |
58
+ | --- | --- | --- | --- | --- | --- | --- |
59
+ | Close | `close` | null (run-scoped) | null | null | null | `g` (unchanged) |
60
+
61
+ The entry is run-scoped, so `item_key` is null: the close acts on the run, not on an item. The
62
+ `at` timestamp comes from the engine's injected clock seam.
63
+
64
+ 4. **Do not recompute.** Run termination changes no cohort assignment, so `recolor_generation` is
65
+ UNCHANGED and `cohorts[]` is not rewritten. Do not call `recolor_unstarted` as part of a close.
66
+
67
+ 5. **Stop admitting.** After the close is recorded, the run accepts no further `/parallel-add`. The
68
+ close record is the run's final mutation; nothing may be appended to `mutations[]` after it.
69
+
70
+ 6. **Validate the checkpoint** before treating the close as applied. Run the
71
+ `validate_orchestration_artifacts` MCP tool with `artifact_type:
72
+ "parallel-orchestrator-state"`. A non-empty error list means the close was applied incorrectly;
73
+ correct the checkpoint rather than proceeding.
74
+
75
+ ## Constraints
76
+
77
+ - One close per run, one `mutations[]` entry per successful close.
78
+ - No field and no enum member is added to `mutations[]` or to any state or merge-status enum. The
79
+ nine parallel enums are owned by `.claude/rules/parallel-orchestration.md` and are consumed, never
80
+ extended.
81
+ - The close performs no destructive side effect: it closes no pull request and removes no worktree.
82
+ An item whose work should be destroyed must be removed first through `/parallel-remove` with
83
+ `--disposition abandon`, which is also what makes the close gate passable.
84
+ - The close does not change any item's state. Items that never started remain in their recorded
85
+ states; the close records that the run stopped admitting, not that those items were withdrawn.
86
+
87
+ ## Completion Requirements
88
+
89
+ - Report the `parallel_slug`, the gate outcome, and the single appended `mutations[]` entry — or,
90
+ for a rejected close, the full list of in-flight keys and the explicit confirmation that nothing
91
+ was appended and no state changed.
92
+ - Report the unchanged `recolor_generation`.
93
+ - Report the checkpoint validation result.