@danmoisan/drm-copilot-mcp 1.1.23 → 1.1.24

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 (199) hide show
  1. package/out/mcp-server.js +13347 -7926
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/discovery-capability-sentinel.md +34 -0
  4. package/resources/claude-customizations/.claude/agents/legacy-parity-analyst.md +101 -43
  5. package/resources/claude-customizations/.claude/agents/migration-coverage-reviewer.md +107 -43
  6. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +14 -0
  7. package/resources/claude-customizations/.claude/agents/parallel-planner.md +21 -1
  8. package/resources/claude-customizations/.claude/agents/pr-author.md +17 -1
  9. package/resources/claude-customizations/.claude/agents/requirements-reconciler.md +117 -42
  10. package/resources/claude-customizations/.claude/agents/runtime-characterization-analyst.md +103 -43
  11. package/resources/claude-customizations/.claude/hooks/discovery-capability-probe.ps1 +102 -0
  12. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +69 -194
  13. package/resources/claude-customizations/.claude/hooks/enforce-discovery-planning-gate.ps1 +87 -0
  14. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +7 -1
  15. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +6 -3
  16. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +168 -48
  17. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +1 -1
  18. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +59 -20
  19. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-command-allowlist.ps1 +44 -3
  20. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +60 -4
  21. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1 +4 -2
  22. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +59 -20
  23. package/resources/claude-customizations/.claude/hooks/record-discovery-agent-start.ps1 +132 -0
  24. package/resources/claude-customizations/.claude/hooks/validate-discovery-artifact-gate.ps1 +56 -212
  25. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-rejection.ps1 +172 -0
  26. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +9 -1
  27. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadius.psm1 +9 -3
  28. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusAggregate.psm1 +154 -0
  29. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusCombination.psm1 +228 -0
  30. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +1 -0
  31. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusNormalization.psm1 +4 -2
  32. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusScheduling.psm1 +63 -16
  33. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusTokenShape.psm1 +56 -1
  34. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusWriteIntent.psm1 +4 -1
  35. package/resources/claude-customizations/.claude/lib/codex-routing/CodexDeployment.psm1 +5 -1
  36. package/resources/claude-customizations/.claude/lib/codex-routing/CodexDiscoveryRouting.psm1 +161 -0
  37. package/resources/claude-customizations/.claude/lib/codex-routing/CodexTopology.psm1 +25 -2
  38. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryAuthority.psd1 +90 -0
  39. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryAuthority.psm1 +493 -0
  40. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryAuthorization.psm1 +479 -0
  41. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryCapability.psm1 +468 -0
  42. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryEncoding.psm1 +156 -0
  43. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryManifest.psm1 +384 -0
  44. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryObservation.psm1 +217 -0
  45. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryPayload.psm1 +276 -0
  46. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryPlanning.psm1 +336 -0
  47. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryRootGrant.psm1 +164 -0
  48. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryStart.psm1 +440 -0
  49. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryStartRecord.psm1 +296 -0
  50. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryStop.psm1 +336 -0
  51. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryToolRouting.psm1 +228 -0
  52. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryValidation.psm1 +188 -341
  53. package/resources/claude-customizations/.claude/lib/worktree-resolution/HookTargetWorktree.psm1 +391 -0
  54. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +1 -0
  55. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +150 -18
  56. package/resources/claude-customizations/.claude/settings.json +32 -3
  57. package/resources/claude-customizations/.claude/skills/adjudicate-unspecified-behavior/SKILL.md +135 -0
  58. package/resources/claude-customizations/.claude/skills/characterize-runtime-behavior/SKILL.md +134 -0
  59. package/resources/claude-customizations/.claude/skills/discovery-behavior-reconciliation/SKILL.md +28 -47
  60. package/resources/claude-customizations/.claude/skills/discovery-coverage-ledger/SKILL.md +32 -48
  61. package/resources/claude-customizations/.claude/skills/discovery-parity-matrix/SKILL.md +28 -45
  62. package/resources/claude-customizations/.claude/skills/discovery-repo-inventory/SKILL.md +28 -62
  63. package/resources/claude-customizations/.claude/skills/discovery-runtime-characterization/SKILL.md +28 -45
  64. package/resources/claude-customizations/.claude/skills/discovery-validate-artifacts/SKILL.md +28 -61
  65. package/resources/claude-customizations/.claude/skills/discovery-workflow/SKILL.md +55 -139
  66. package/resources/claude-customizations/.claude/skills/execution-environment/SKILL.md +24 -9
  67. package/resources/claude-customizations/.claude/skills/extract-feature-contract/SKILL.md +133 -0
  68. package/resources/claude-customizations/.claude/skills/generate-acceptance-scenarios/SKILL.md +132 -0
  69. package/resources/claude-customizations/.claude/skills/initialize-discovery-workspace/SKILL.md +131 -0
  70. package/resources/claude-customizations/.claude/skills/inventory-legacy-system/SKILL.md +131 -0
  71. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +5 -4
  72. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +21 -1
  73. package/resources/claude-customizations/.claude/skills/parallel-close/SKILL.md +11 -1
  74. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +34 -0
  75. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +69 -6
  76. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +15 -0
  77. package/resources/claude-customizations/.claude/skills/parallel-run/SKILL.md +6 -0
  78. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +21 -4
  79. package/resources/claude-customizations/.claude/skills/reconcile-parity-matrix/SKILL.md +131 -0
  80. package/resources/claude-customizations/.claude/skills/review-discovery-coverage/SKILL.md +129 -0
  81. package/resources/claude-customizations/.claude/skills/validate-discovery-artifacts/SKILL.md +127 -0
  82. package/resources/claude-customizations/config/blast-radius.json +6 -5
  83. package/resources/claude-customizations/config/orchestration-routing.json +61 -1
  84. package/resources/claude-customizations/pack-manifests/core.json +33 -1
  85. package/resources/codex-and-agents-customizations/.agents/skills/adjudicate-unspecified-behavior/SKILL.md +135 -0
  86. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +7 -0
  87. package/resources/codex-and-agents-customizations/.agents/skills/characterize-runtime-behavior/SKILL.md +134 -0
  88. package/resources/codex-and-agents-customizations/.agents/skills/discovery-behavior-reconciliation/SKILL.md +46 -0
  89. package/resources/codex-and-agents-customizations/.agents/skills/discovery-coverage-ledger/SKILL.md +50 -0
  90. package/resources/codex-and-agents-customizations/.agents/skills/discovery-parity-matrix/SKILL.md +46 -0
  91. package/resources/codex-and-agents-customizations/.agents/skills/discovery-repo-inventory/SKILL.md +46 -0
  92. package/resources/codex-and-agents-customizations/.agents/skills/discovery-runtime-characterization/SKILL.md +46 -0
  93. package/resources/codex-and-agents-customizations/.agents/skills/discovery-validate-artifacts/SKILL.md +46 -0
  94. package/resources/codex-and-agents-customizations/.agents/skills/discovery-workflow/SKILL.md +62 -0
  95. package/resources/codex-and-agents-customizations/.agents/skills/execution-environment/SKILL.md +24 -9
  96. package/resources/codex-and-agents-customizations/.agents/skills/extract-feature-contract/SKILL.md +133 -0
  97. package/resources/codex-and-agents-customizations/.agents/skills/generate-acceptance-scenarios/SKILL.md +132 -0
  98. package/resources/codex-and-agents-customizations/.agents/skills/initialize-discovery-workspace/SKILL.md +131 -0
  99. package/resources/codex-and-agents-customizations/.agents/skills/inventory-legacy-system/SKILL.md +131 -0
  100. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +8 -0
  101. package/resources/codex-and-agents-customizations/.agents/skills/reconcile-parity-matrix/SKILL.md +131 -0
  102. package/resources/codex-and-agents-customizations/.agents/skills/review-discovery-coverage/SKILL.md +129 -0
  103. package/resources/codex-and-agents-customizations/.agents/skills/validate-discovery-artifacts/SKILL.md +127 -0
  104. package/resources/codex-and-agents-customizations/.codex/agents/discovery-capability-sentinel.toml +51 -0
  105. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst-c1.toml +148 -0
  106. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst-c2.toml +148 -0
  107. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst-c3-elevated.toml +148 -0
  108. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst-c3.toml +148 -0
  109. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst-c4.toml +148 -0
  110. package/resources/codex-and-agents-customizations/.codex/agents/legacy-parity-analyst.toml +148 -0
  111. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer-c1.toml +154 -0
  112. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer-c2.toml +154 -0
  113. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer-c3-elevated.toml +154 -0
  114. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer-c3.toml +154 -0
  115. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer-c4.toml +154 -0
  116. package/resources/codex-and-agents-customizations/.codex/agents/migration-coverage-reviewer.toml +154 -0
  117. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler-c1.toml +164 -0
  118. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler-c2.toml +164 -0
  119. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler-c3-elevated.toml +164 -0
  120. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler-c3.toml +164 -0
  121. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler-c4.toml +164 -0
  122. package/resources/codex-and-agents-customizations/.codex/agents/requirements-reconciler.toml +164 -0
  123. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst-c1.toml +150 -0
  124. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst-c2.toml +150 -0
  125. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst-c3-elevated.toml +150 -0
  126. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst-c3.toml +150 -0
  127. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst-c4.toml +150 -0
  128. package/resources/codex-and-agents-customizations/.codex/agents/runtime-characterization-analyst.toml +150 -0
  129. package/resources/codex-and-agents-customizations/.codex/config.toml +33 -3
  130. package/resources/codex-and-agents-customizations/.codex/hooks/codex-agent-profile-attestation.ps1 +22 -0
  131. package/resources/codex-and-agents-customizations/.codex/hooks/discovery-capability-probe.ps1 +97 -0
  132. package/resources/codex-and-agents-customizations/.codex/hooks/discovery-start-attestation.ps1 +171 -0
  133. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-codex-model-routing.ps1 +4 -1
  134. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-discovery-artifact-gate.ps1 +187 -0
  135. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-discovery-planning-gate.ps1 +149 -0
  136. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +239 -2
  137. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +6 -15
  138. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +54 -15
  139. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +54 -15
  140. package/resources/codex-and-agents-customizations/.codex/hooks/hook-target-worktree.ps1 +369 -0
  141. package/resources/codex-and-agents-customizations/.codex/hooks/record-subagent-routing-attestation.ps1 +8 -0
  142. package/resources/codex-and-agents-customizations/.codex/hooks/validate-codex-subagent-routing.ps1 +22 -1
  143. package/resources/codex-and-agents-customizations/.codex/hooks/validate-discovery-agent-output.ps1 +178 -0
  144. package/resources/codex-and-agents-customizations/.codex/scripts/Resolve-CodexTopology.ps1 +11 -1
  145. package/resources/codex-and-agents-customizations/pack-manifests/core.json +63 -1
  146. package/resources/config/orchestration-routing.json +61 -1
  147. package/resources/customizations/.github/agents/discovery-capability-sentinel.agent.md +34 -0
  148. package/resources/customizations/.github/agents/legacy-parity-analyst.agent.md +122 -0
  149. package/resources/customizations/.github/agents/migration-coverage-reviewer.agent.md +128 -0
  150. package/resources/customizations/.github/agents/requirements-reconciler.agent.md +138 -0
  151. package/resources/customizations/.github/agents/runtime-characterization-analyst.agent.md +124 -0
  152. package/resources/customizations/.github/hooks/discovery-agent-start.ps1 +139 -0
  153. package/resources/customizations/.github/hooks/discovery-agent-stop.ps1 +123 -0
  154. package/resources/customizations/.github/hooks/discovery-capability-probe.ps1 +98 -0
  155. package/resources/customizations/.github/hooks/discovery-planning.ps1 +91 -0
  156. package/resources/customizations/.github/hooks/discovery-pre-tool.ps1 +123 -0
  157. package/resources/customizations/.github/hooks/discovery.json +35 -0
  158. package/resources/customizations/.github/instructions/mermaid.instructions.md +85 -0
  159. package/resources/customizations/.github/prompts/execute-hard-lock.prompt.md +105 -0
  160. package/resources/customizations/.github/skills/adjudicate-unspecified-behavior/SKILL.md +135 -0
  161. package/resources/customizations/.github/skills/characterize-runtime-behavior/SKILL.md +134 -0
  162. package/resources/customizations/.github/skills/discovery-behavior-reconciliation/SKILL.md +46 -0
  163. package/resources/customizations/.github/skills/discovery-coverage-ledger/SKILL.md +50 -0
  164. package/resources/customizations/.github/skills/discovery-parity-matrix/SKILL.md +46 -0
  165. package/resources/customizations/.github/skills/discovery-repo-inventory/SKILL.md +46 -0
  166. package/resources/customizations/.github/skills/discovery-runtime-characterization/SKILL.md +46 -0
  167. package/resources/customizations/.github/skills/discovery-validate-artifacts/SKILL.md +46 -0
  168. package/resources/customizations/.github/skills/discovery-workflow/SKILL.md +62 -0
  169. package/resources/customizations/.github/skills/execution-environment/SKILL.md +24 -9
  170. package/resources/customizations/.github/skills/extract-feature-contract/SKILL.md +133 -0
  171. package/resources/customizations/.github/skills/generate-acceptance-scenarios/SKILL.md +132 -0
  172. package/resources/customizations/.github/skills/initialize-discovery-workspace/SKILL.md +131 -0
  173. package/resources/customizations/.github/skills/inventory-legacy-system/SKILL.md +131 -0
  174. package/resources/customizations/.github/skills/reconcile-parity-matrix/SKILL.md +131 -0
  175. package/resources/customizations/.github/skills/review-discovery-coverage/SKILL.md +129 -0
  176. package/resources/customizations/.github/skills/validate-discovery-artifacts/SKILL.md +127 -0
  177. package/resources/lib/codex-routing/CodexDeployment.psm1 +5 -1
  178. package/resources/lib/codex-routing/CodexDiscoveryRouting.psm1 +161 -0
  179. package/resources/lib/codex-routing/CodexTopology.psm1 +25 -2
  180. package/resources/lib/discovery-validation/DiscoveryAuthority.psd1 +90 -0
  181. package/resources/lib/discovery-validation/DiscoveryAuthority.psm1 +493 -0
  182. package/resources/lib/discovery-validation/DiscoveryAuthorization.psm1 +479 -0
  183. package/resources/lib/discovery-validation/DiscoveryCapability.psm1 +468 -0
  184. package/resources/lib/discovery-validation/DiscoveryEncoding.psm1 +156 -0
  185. package/resources/lib/discovery-validation/DiscoveryManifest.psm1 +384 -0
  186. package/resources/lib/discovery-validation/DiscoveryObservation.psm1 +217 -0
  187. package/resources/lib/discovery-validation/DiscoveryPayload.psm1 +276 -0
  188. package/resources/lib/discovery-validation/DiscoveryPlanning.psm1 +336 -0
  189. package/resources/lib/discovery-validation/DiscoveryRootGrant.psm1 +164 -0
  190. package/resources/lib/discovery-validation/DiscoveryStart.psm1 +440 -0
  191. package/resources/lib/discovery-validation/DiscoveryStartRecord.psm1 +296 -0
  192. package/resources/lib/discovery-validation/DiscoveryStop.psm1 +336 -0
  193. package/resources/lib/discovery-validation/DiscoveryToolRouting.psm1 +228 -0
  194. package/resources/powershell/PoshQC/PoshQC.Parallel.psm1 +452 -0
  195. package/resources/powershell/PoshQC/PoshQC.Shard.psm1 +106 -8
  196. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +12 -0
  197. package/resources/powershell/PoshQC/PoshQC.psd1 +6 -1
  198. package/resources/powershell/PoshQC/PoshQC.psm1 +7 -1
  199. package/resources/powershell/PoshQC/README.md +20 -1
@@ -0,0 +1,98 @@
1
+ <#
2
+ .SYNOPSIS
3
+ GitHub Copilot (VS Code local harness) capability probe for discovery agents.
4
+
5
+ .DESCRIPTION
6
+ Not an event hook. The gateway doctor and the operator script
7
+ scripts/dev-tools/Test-DiscoveryHostCapability.ps1 run this probe to observe
8
+ whether this workspace's Copilot local harness provides the required discovery
9
+ controls: the SubagentStart, PreToolUse and SubagentStop handlers registered in
10
+ .github/hooks/discovery.json, their current hashes, and the host observations
11
+ the PreToolUse gate recorded while the discovery-capability-sentinel agent ran
12
+ in session SessionId. Workspace Trust and enabled hooks are host requirements
13
+ the harness enforces before running any hook; the caller reports them through
14
+ -WorkspaceTrusted. The result is a capability-attestation-shaped JSON document
15
+ on stdout; exit 0 when supported, 1 when unsupported. A session without
16
+ observations is unsupported.
17
+
18
+ .NOTES
19
+ Issue #980. Requires PowerShell 7+. Invokes NO external process and makes no
20
+ in-process sentinel decision.
21
+ #>
22
+ [CmdletBinding()]
23
+ param(
24
+ [Parameter(Mandatory = $false)][string]$WorkspaceRoot = (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent),
25
+ [Parameter(Mandatory = $false)][string]$SessionId = 'capability-probe',
26
+ [Parameter(Mandatory = $false)][AllowNull()][string]$Nonce = $null,
27
+ [Parameter(Mandatory = $false)][bool]$WorkspaceTrusted = $true,
28
+ [Parameter(Mandatory = $false)][AllowNull()][string]$RuntimeJson = $null
29
+ )
30
+
31
+ Import-Module (Join-Path $PSScriptRoot '../../.claude/lib/discovery-validation/DiscoveryCapability.psm1') -Force -Global -ErrorAction Stop
32
+ . (Join-Path $PSScriptRoot 'discovery-pre-tool.ps1')
33
+
34
+ function Get-DiscoveryProbeRuntime {
35
+ <#
36
+ .SYNOPSIS
37
+ Returns the runtime identity the probe records: the caller's JSON, or the local configuration digest.
38
+ #>
39
+ [CmdletBinding()]
40
+ [OutputType([System.Collections.Specialized.OrderedDictionary])]
41
+ param([Parameter(Mandatory = $false)][AllowNull()][string]$RuntimeJson, [Parameter(Mandatory = $true)][string]$WorkspaceRoot)
42
+
43
+ if (-not [string]::IsNullOrWhiteSpace($RuntimeJson)) {
44
+ $parsed = ConvertFrom-Json -InputObject $RuntimeJson -Depth 4
45
+ $runtime = [ordered]@{}
46
+ foreach ($key in @('build_sha256', 'package_version', 'policy_sha256', 'policy_version', 'schema_version')) {
47
+ # The runtime identity contract types policy_version as an integer; the hosts compare it canonically.
48
+ $runtime[$key] = $(if ($key -eq 'policy_version') { [int]$parsed.$key } else { [string]$parsed.$key })
49
+ }
50
+ return $runtime
51
+ }
52
+ # The workspace root is a host-modelled path string; Join-Path would require its drive to exist locally.
53
+ $configuration = "$($WorkspaceRoot.TrimEnd('/', '\'))/.github/hooks/discovery.json"
54
+ $digest = $(if (Test-Path -LiteralPath $configuration -PathType Leaf) { Get-DiscoveryBytesSha256Hex -Bytes ([System.IO.File]::ReadAllBytes($configuration)) } else { '0' * 64 })
55
+ return [ordered]@{ build_sha256 = $digest; package_version = '2.0.0'; policy_sha256 = $digest; policy_version = 2; schema_version = '2.0.0' }
56
+ }
57
+
58
+ function Invoke-DiscoveryCapabilityProbe {
59
+ <#
60
+ .SYNOPSIS
61
+ Runs the Copilot capability observation and returns the attestation-shaped document.
62
+ #>
63
+ [CmdletBinding()]
64
+ [OutputType([System.Collections.Specialized.OrderedDictionary])]
65
+ param(
66
+ [Parameter(Mandatory = $true)][string]$WorkspaceRoot,
67
+ [Parameter(Mandatory = $true)][string]$SessionId,
68
+ [Parameter(Mandatory = $false)][AllowNull()][string]$Nonce = $null,
69
+ [Parameter(Mandatory = $false)][bool]$WorkspaceTrusted = $true,
70
+ [Parameter(Mandatory = $false)][AllowNull()][string]$RuntimeJson = $null,
71
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$HostEnvironment = $null,
72
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$Store = $null,
73
+ [Parameter(Mandatory = $false)][AllowNull()][scriptblock]$ReadBytes = $null,
74
+ [Parameter(Mandatory = $false)][AllowNull()][nullable[datetime]]$Now = $null
75
+ )
76
+
77
+ if ([string]::IsNullOrEmpty($Nonce)) { $Nonce = Get-DiscoveryAuthorizationNonce }
78
+ if ($null -eq $HostEnvironment) { $HostEnvironment = Get-DiscoveryTrustedHostEnvironment }
79
+ if ($null -eq $Store) { $Store = Get-DiscoveryDefaultStore }
80
+ if ($null -eq $Now) { $Now = [datetime]::UtcNow }
81
+ $parameters = @{
82
+ HostName = 'github-copilot'; WorkspaceRoot = $WorkspaceRoot; SessionId = $SessionId; Nonce = $Nonce; WorkspaceTrusted = $WorkspaceTrusted; Now = $Now
83
+ Runtime = (Get-DiscoveryProbeRuntime -RuntimeJson $RuntimeJson -WorkspaceRoot $WorkspaceRoot)
84
+ HostEnvironment = $HostEnvironment; Store = $Store
85
+ }
86
+ if ($null -ne $ReadBytes) { $parameters['ReadBytes'] = $ReadBytes }
87
+ $observation = Get-DiscoveryCapabilityObservation @parameters
88
+ # The doctor, the agent preparation and the start attestation read only the protected session copy.
89
+ [void](Write-DiscoveryCapabilityAttestation -Observation $observation -WorkspaceRoot $WorkspaceRoot -HostEnvironment $HostEnvironment -Store $Store)
90
+ return $observation
91
+ }
92
+
93
+ if ($MyInvocation.InvocationName -eq '.') {
94
+ return
95
+ }
96
+ $observation = Invoke-DiscoveryCapabilityProbe -WorkspaceRoot $WorkspaceRoot -SessionId $SessionId -Nonce $Nonce -WorkspaceTrusted $WorkspaceTrusted -RuntimeJson $RuntimeJson
97
+ $observation | ConvertTo-Json -Depth 8 | Write-Output
98
+ exit $(if ($observation['status'] -eq 'supported') { 0 } else { 1 })
@@ -0,0 +1,91 @@
1
+ <#
2
+ .SYNOPSIS
3
+ GitHub Copilot (VS Code local harness) PreToolUse hook that gates planner and orchestrator launches on discovery authority.
4
+
5
+ .DESCRIPTION
6
+ Registered through .github/hooks/*.json. The hook reads the Copilot PreToolUse
7
+ envelope from stdin (camelCase keys, snake_case accepted), recognizes an
8
+ atomic-planner or orchestrator launch, and takes its decision from the shared
9
+ DiscoveryPlanning module under .claude/lib/discovery-validation:
10
+
11
+ - a call that is not a planner or orchestrator launch, and a workspace without
12
+ a protected discovery activation, are allowed so existing behavior continues;
13
+ - an active workspace must still hold the activated locator and domain profile
14
+ and the protected session must hold a current, passing, gateway-written
15
+ planning-mode receipt for this host and session; otherwise the launch is
16
+ denied with the DISCOVERY_PLANNING_GATE_BLOCKED: prefix.
17
+
18
+ A helper that fails to load and an envelope that cannot be read both deny with
19
+ the prefix; the hook never fails open and never runs Python.
20
+
21
+ .NOTES
22
+ Issue #980. Requires PowerShell 7+. Invokes NO external process.
23
+ #>
24
+ [CmdletBinding()]
25
+ param()
26
+
27
+ $script:DiscoveryPlanningReasonPrefix = 'DISCOVERY_PLANNING_GATE_BLOCKED:'
28
+ $script:DiscoveryPlanningDependencyFailures = [System.Collections.Generic.List[object]]::new()
29
+
30
+ function Add-DiscoveryPlanningDependencyFailure {
31
+ <#
32
+ .SYNOPSIS
33
+ Records one helper module that failed to load.
34
+ #>
35
+ [CmdletBinding()]
36
+ param(
37
+ [Parameter(Mandatory = $true)][string]$Name,
38
+ [Parameter(Mandatory = $false)][AllowNull()][System.Management.Automation.ErrorRecord]$ErrorRecord
39
+ )
40
+
41
+ $message = 'no error record'
42
+ if ($null -ne $ErrorRecord) { $message = ([string]$ErrorRecord.Exception.Message -split "`r?`n")[0] }
43
+ [void]$script:DiscoveryPlanningDependencyFailures.Add([pscustomobject]@{ Name = $Name; Message = $message })
44
+ }
45
+
46
+ foreach ($moduleName in @('DiscoveryEncoding.psm1', 'DiscoveryAuthority.psm1', 'DiscoveryManifest.psm1', 'DiscoveryPayload.psm1', 'DiscoveryToolRouting.psm1', 'DiscoveryAuthorization.psm1', 'DiscoveryStartRecord.psm1', 'DiscoveryPlanning.psm1')) {
47
+ try { Import-Module (Join-Path $PSScriptRoot "../../.claude/lib/discovery-validation/$moduleName") -Force -Global -ErrorAction Stop } catch { Add-DiscoveryPlanningDependencyFailure -Name $moduleName -ErrorRecord $_ }
48
+ }
49
+
50
+ function Invoke-DiscoveryPlanningDecision {
51
+ <#
52
+ .SYNOPSIS
53
+ Parses the Copilot PreToolUse envelope and returns the hookSpecificOutput decision.
54
+ #>
55
+ [CmdletBinding()]
56
+ [OutputType([System.Collections.Specialized.OrderedDictionary])]
57
+ param(
58
+ [Parameter(Mandatory = $false)][AllowNull()][AllowEmptyString()][string]$ToolInputRaw,
59
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$HostEnvironment = $null,
60
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$Store = $null,
61
+ [Parameter(Mandatory = $false)][AllowNull()][scriptblock]$ReadBytes = $null
62
+ )
63
+
64
+ if ($script:DiscoveryPlanningDependencyFailures.Count -gt 0) {
65
+ $first = $script:DiscoveryPlanningDependencyFailures[0]
66
+ return [ordered]@{
67
+ hookSpecificOutput = [ordered]@{
68
+ hookEventName = 'PreToolUse'
69
+ permissionDecision = 'deny'
70
+ permissionDecisionReason = "$($script:DiscoveryPlanningReasonPrefix) the dependency '$($first.Name)' failed to load ($($first.Message)); the gate fails closed."
71
+ }
72
+ }
73
+ }
74
+ if ($null -eq $HostEnvironment) { $HostEnvironment = Get-DiscoveryTrustedHostEnvironment }
75
+ if ($null -eq $Store) { $Store = Get-DiscoveryStartStore }
76
+
77
+ $normalized = ConvertFrom-DiscoveryHostPayloadText -HostName 'github-copilot' -Text $ToolInputRaw
78
+ $parameters = @{ Normalized = $normalized; HostEnvironment = $HostEnvironment; Store = $Store }
79
+ if ($null -ne $ReadBytes) { $parameters['ReadBytes'] = $ReadBytes }
80
+ $outcome = Get-DiscoveryPlanningDecision @parameters
81
+ return ConvertTo-DiscoveryPlanningHookOutput -Outcome $outcome -ReasonPrefix $script:DiscoveryPlanningReasonPrefix
82
+ }
83
+
84
+ # Guard allows dot-sourcing in tests without executing the entrypoint.
85
+ if ($MyInvocation.InvocationName -eq '.') {
86
+ return
87
+ }
88
+
89
+ $decision = Invoke-DiscoveryPlanningDecision -ToolInputRaw ([Console]::In.ReadToEnd())
90
+ $decision | ConvertTo-Json -Compress -Depth 5 | Write-Output
91
+ exit 0
@@ -0,0 +1,123 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Native PreToolUse authorization adapter for GitHub Copilot (VS Code local harness) discovery agents.
4
+
5
+ .DESCRIPTION
6
+ Registered through .github/hooks/*.json. The hook reads the Copilot PreToolUse
7
+ envelope from stdin (camelCase keys, snake_case accepted), derives the trusted
8
+ principal from the payload alone (session, agentId and agentType when the
9
+ harness supplies them, and parentAgentId or the literal parent root), and
10
+ takes its decision from the shared DiscoveryAuthorization module under
11
+ .claude/lib/discovery-validation:
12
+
13
+ - a root call (no agentId) of prepare_discovery_agent, run_discovery_doctor or
14
+ a controlled discovery tool is allowed with a one-use root grant the MCP
15
+ server consumes; every other root call and every call of an agent that is
16
+ not a discovery specialist is allowed, so ordinary sessions keep their behavior;
17
+ - a sentinel envelope is observed for the capability probe and never granted;
18
+ - a discovery specialist may use read-only native tools and the controlled
19
+ discovery MCP tools only; shell, terminal, exec and evaluation tools, generic
20
+ file mutations, nested agents, foreign MCP servers, root-only discovery
21
+ operations and caller-supplied identity fields are denied before execution;
22
+ - the specialist's first controlled call binds the single prepared invocation
23
+ of its session, parent and agent type (the Copilot subagentStart payload
24
+ carries no agent identifier); every controlled call must name that invocation
25
+ through invocation_ref and is recorded as one short-lived, one-use tool-authorization.
26
+
27
+ A helper that fails to load and an envelope that cannot be read both deny with
28
+ the DISCOVERY_ARTIFACT_GATE_BLOCKED: prefix; the hook never fails open.
29
+
30
+ .NOTES
31
+ Issue #980. Requires PowerShell 7+. Invokes NO external process.
32
+ #>
33
+ [CmdletBinding()]
34
+ param()
35
+
36
+ $script:DiscoveryGateReasonPrefix = 'DISCOVERY_ARTIFACT_GATE_BLOCKED:'
37
+ $script:DiscoveryGateHandlerPath = $PSCommandPath
38
+ $script:DiscoveryGateDependencyFailures = [System.Collections.Generic.List[object]]::new()
39
+
40
+ function Add-DiscoveryGateDependencyFailure {
41
+ <#
42
+ .SYNOPSIS
43
+ Records one helper module that failed to load.
44
+ #>
45
+ [CmdletBinding()]
46
+ param(
47
+ [Parameter(Mandatory = $true)][string]$Name,
48
+ [Parameter(Mandatory = $false)][AllowNull()][System.Management.Automation.ErrorRecord]$ErrorRecord
49
+ )
50
+
51
+ $message = 'no error record'
52
+ if ($null -ne $ErrorRecord) { $message = ([string]$ErrorRecord.Exception.Message -split "`r?`n")[0] }
53
+ [void]$script:DiscoveryGateDependencyFailures.Add([pscustomobject]@{ Name = $Name; Message = $message })
54
+ }
55
+
56
+ foreach ($moduleName in @('DiscoveryEncoding.psm1', 'DiscoveryAuthority.psm1', 'DiscoveryPayload.psm1', 'DiscoveryToolRouting.psm1', 'DiscoveryStartRecord.psm1', 'DiscoveryRootGrant.psm1', 'DiscoveryObservation.psm1', 'DiscoveryStart.psm1', 'DiscoveryAuthorization.psm1')) {
57
+ try { Import-Module (Join-Path $PSScriptRoot "../../.claude/lib/discovery-validation/$moduleName") -Force -Global -ErrorAction Stop } catch { Add-DiscoveryGateDependencyFailure -Name $moduleName -ErrorRecord $_ }
58
+ }
59
+
60
+ function Get-DiscoveryGateHandlerSha256 {
61
+ <#
62
+ .SYNOPSIS
63
+ Returns the SHA-256 of this handler's own bytes for the authorization writer record.
64
+ #>
65
+ [CmdletBinding()]
66
+ [OutputType([string])]
67
+ param([Parameter(Mandatory = $false)][AllowNull()][string]$HandlerPath = $script:DiscoveryGateHandlerPath)
68
+
69
+ if ([string]::IsNullOrEmpty($HandlerPath) -or -not (Test-Path -LiteralPath $HandlerPath -PathType Leaf)) {
70
+ return ('0' * 64)
71
+ }
72
+ return Get-DiscoveryBytesSha256Hex -Bytes ([System.IO.File]::ReadAllBytes($HandlerPath))
73
+ }
74
+
75
+ function Invoke-DiscoveryPreToolDecision {
76
+ <#
77
+ .SYNOPSIS
78
+ Parses the Copilot PreToolUse envelope and returns the hookSpecificOutput decision.
79
+ .DESCRIPTION
80
+ Every seam defaults to the real host and is injectable so tests run over
81
+ in-memory values. A recorded helper failure denies before the envelope is read.
82
+ #>
83
+ [CmdletBinding()]
84
+ [OutputType([System.Collections.Specialized.OrderedDictionary])]
85
+ param(
86
+ [Parameter(Mandatory = $false)][AllowNull()][AllowEmptyString()][string]$ToolInputRaw,
87
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$HostEnvironment = $null,
88
+ [Parameter(Mandatory = $false)][AllowNull()][hashtable]$Store = $null,
89
+ [Parameter(Mandatory = $false)][AllowNull()][nullable[datetime]]$Now = $null,
90
+ [Parameter(Mandatory = $false)][AllowNull()][string]$Nonce = $null
91
+ )
92
+
93
+ if ($script:DiscoveryGateDependencyFailures.Count -gt 0) {
94
+ $first = $script:DiscoveryGateDependencyFailures[0]
95
+ return [ordered]@{
96
+ hookSpecificOutput = [ordered]@{
97
+ hookEventName = 'PreToolUse'
98
+ permissionDecision = 'deny'
99
+ permissionDecisionReason = "$($script:DiscoveryGateReasonPrefix) the dependency '$($first.Name)' failed to load ($($first.Message)); the gate fails closed."
100
+ }
101
+ }
102
+ }
103
+ # Seams resolve only after the dependency check so a missing module denies
104
+ # instead of raising while a default is evaluated.
105
+ if ($null -eq $HostEnvironment) { $HostEnvironment = Get-DiscoveryTrustedHostEnvironment }
106
+ if ($null -eq $Store) { $Store = Get-DiscoveryDefaultStore }
107
+ if ($null -eq $Now) { $Now = [datetime]::UtcNow }
108
+ if ([string]::IsNullOrEmpty($Nonce)) { $Nonce = Get-DiscoveryAuthorizationNonce }
109
+
110
+ $normalized = ConvertFrom-DiscoveryHostPayloadText -HostName 'github-copilot' -Text $ToolInputRaw
111
+ $outcome = Get-DiscoveryPreToolDecision -Normalized $normalized -HostEnvironment $HostEnvironment `
112
+ -HandlerSha256 (Get-DiscoveryGateHandlerSha256) -Store $Store -Now $Now -Nonce $Nonce
113
+ return ConvertTo-DiscoveryPreToolHookOutput -Outcome $outcome -ReasonPrefix $script:DiscoveryGateReasonPrefix
114
+ }
115
+
116
+ # Guard allows dot-sourcing in tests without executing the entrypoint.
117
+ if ($MyInvocation.InvocationName -eq '.') {
118
+ return
119
+ }
120
+
121
+ $decision = Invoke-DiscoveryPreToolDecision -ToolInputRaw ([Console]::In.ReadToEnd())
122
+ $decision | ConvertTo-Json -Compress -Depth 5 | Write-Output
123
+ exit 0
@@ -0,0 +1,35 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "SubagentStart": [
5
+ {
6
+ "type": "command",
7
+ "powershell": "pwsh -NoProfile -File .github/hooks/discovery-agent-start.ps1",
8
+ "bash": "pwsh -NoProfile -File .github/hooks/discovery-agent-start.ps1",
9
+ "timeout": 30
10
+ }
11
+ ],
12
+ "PreToolUse": [
13
+ {
14
+ "type": "command",
15
+ "powershell": "pwsh -NoProfile -File .github/hooks/discovery-pre-tool.ps1",
16
+ "bash": "pwsh -NoProfile -File .github/hooks/discovery-pre-tool.ps1",
17
+ "timeout": 30
18
+ },
19
+ {
20
+ "type": "command",
21
+ "powershell": "pwsh -NoProfile -File .github/hooks/discovery-planning.ps1",
22
+ "bash": "pwsh -NoProfile -File .github/hooks/discovery-planning.ps1",
23
+ "timeout": 30
24
+ }
25
+ ],
26
+ "SubagentStop": [
27
+ {
28
+ "type": "command",
29
+ "powershell": "pwsh -NoProfile -File .github/hooks/discovery-agent-stop.ps1",
30
+ "bash": "pwsh -NoProfile -File .github/hooks/discovery-agent-stop.ps1",
31
+ "timeout": 60
32
+ }
33
+ ]
34
+ }
35
+ }
@@ -0,0 +1,85 @@
1
+ ---
2
+ applyTo: "**"
3
+ ---
4
+ # Mermaid AI Skills
5
+
6
+ When the user asks to create, edit, or visualize any diagram, use the Mermaid
7
+ VS Code extension tools and commands described below.
8
+
9
+ ## Workflow
10
+
11
+ 1. Determine the diagram type and generate Mermaid syntax.
12
+ 2. Write the diagram to a `.mmd` file in the project.
13
+ 3. Validate syntax: correct first-line keyword, arrow types, balanced brackets.
14
+ 4. Preview via the Mermaid extension — open the `.mmd` file (auto-preview) or run
15
+ **MermaidChart: Preview Diagram** (`mermaidChart.preview`).
16
+
17
+ ## LM Tools — call these for every diagram interaction
18
+
19
+ - `mermaid-diagram-validator` — validate Mermaid syntax before presenting any diagram
20
+ - `mermaid-diagram-preview` — render a live preview inside VS Code after generating
21
+ - `get-syntax-docs-mermaid` — fetch correct syntax docs for any diagram type
22
+
23
+ ## VS Code Commands
24
+
25
+ Invoke via Command Palette or the VS Code command API (GitHub Copilot in VS Code only).
26
+ Do not invent command IDs. Prefer writing/editing `.mmd` files when a command is not needed.
27
+
28
+ ### Diagram editing & preview
29
+ - **Preview** (`mermaidChart.preview`) — preview the active Mermaid editor (`.mmd` / `.mermaid` must be open).
30
+ - **Create Diagram** (`mermaidChart.createMermaidFile`) — creates a demo flowchart and opens preview side by side.
31
+ - **Repair Diagram** (`mermaidChart.repairDiagram`) — Mermaid AI repair for the active diagram; uses Mermaid AI credits — tell the user before running.
32
+ - **Improve Diagram** (`mermaidChart.improveDiagram`) — uses Copilot / LM API; suggests layout + styling variants for the active diagram.
33
+
34
+ ### Generate diagrams (GitHub Copilot required)
35
+ - **Generate Diagram from Code** (`mermaidChart.generateDiagramFromCode`)
36
+ - **Generate Cloud Diagram** (`mermaidChart.generateCloudDiagram`)
37
+ - **Generate ER Diagram** (`mermaidChart.generateERDiagram`)
38
+ - **Generate Docker Diagram** (`mermaidChart.generateDockerDiagram`)
39
+ - **Open AI Chat** (`mermaidChart.openCopilotChat`)
40
+
41
+ ### Mermaid Chart cloud
42
+ - **Login** (`mermaidChart.login`) / **Logout** (`mermaidChart.logout`)
43
+ - **Connect Diagram** (`mermaidChart.connectDiagramToMermaidChart`) — link a local diagram to Mermaid Chart.
44
+ - **Sync Diagram** (`mermaidChart.syncDiagramWithMermaid`) — only for diagrams already connected (frontmatter has `id:`). Example:
45
+ ```yaml
46
+ ---
47
+ id: cbd9e9ba-a2cb-47c5-a98e-8c28a753428d
48
+ ---
49
+ ```
50
+
51
+ ### Review Mermaid Sync
52
+ For diagrams updated by the Mermaid Chart GitHub Sync app (or pre-commit regenerate):
53
+ - **Review Mermaid Sync** (`mermaidChart.reviewAppCommits`) — start / open the review flow.
54
+ - **Regenerate with Mermaid AI** (`mermaidChart.regenerateDiagramWithMermaidAI`) — regenerate from source references.
55
+ Do not manually rewrite diagrams managed by this workflow. Accept/reject/diff UI actions stay in the extension UI.
56
+
57
+ ### Install / update this pack
58
+ - **MermaidChart: Install AI Skills…** (`mermaidChart.installAiSkills`)
59
+
60
+ ## @mermaid-chart slash commands
61
+
62
+ | Command | Purpose |
63
+ |---|---|
64
+ | `/generate_diagram_from_code` | General diagram from any source file |
65
+ | `/generate_execution_sequence` | Sequence diagram from code flow |
66
+ | `/generate_er_diagram` | ER diagram from schema / models |
67
+ | `/generate_cloud_architecture_diagram` | Cloud / CI-CD architecture |
68
+ | `/generate_docker_diagram` | Architecture from Dockerfiles |
69
+ | `/generate_c4_topdown_architecture` | C4 top-down architecture |
70
+ | `/analyze_code_ownership` | Code ownership diagram |
71
+ | `/generate_dependency_diagram` | Dependency / security visualisation |
72
+
73
+ ## Rules
74
+
75
+ 1. Always call `mermaid-diagram-validator` before showing any diagram.
76
+ 2. Always call `mermaid-diagram-preview` after generating a diagram.
77
+ 3. Use `get-syntax-docs-mermaid` before generating an unfamiliar diagram type.
78
+ 4. Prefer `@mermaid-chart` slash commands for complex generation.
79
+ 5. Write diagrams to `.mmd` files; never return unvalidated Mermaid syntax.
80
+ 6. Warn the user before Repair (Mermaid AI credits).
81
+ 7. Cooperate with the Sync workflow — do not manually regenerate managed diagrams.
82
+
83
+ ## Docs
84
+
85
+ More commands and features: https://marketplace.visualstudio.com/items?itemName=MermaidChart.vscode-mermaid-chart
@@ -0,0 +1,105 @@
1
+ YOU ARE OPERATING IN ATOMIC EXECUTION MODE (atomic_executor).
2
+
3
+ IDENTITY & SCOPE
4
+ - Execution-only persona. No planning, no redesign, no reordering.
5
+ - Execute an atomic_planner plan exactly as written.
6
+ - Preserve Phase headings, task IDs ([P#-T#]), checkbox format, and task order.
7
+ - Complete tasks strictly one-by-one.
8
+ - Verify acceptance criteria before checking off any task.
9
+
10
+ SUPREMACY & PRECONDITIONS (NON-NEGOTIABLE)
11
+ - Repository policy files override these instructions.
12
+ - BEFORE executing any task, you must confirm compliance with:
13
+ 1) .github/copilot-instructions.md
14
+ 2) .github/instructions/general-code-change.instructions.md
15
+ 3) .github/instructions/general-unit-test.instructions.md
16
+ 4) Any applicable language-specific policies
17
+ - If Phase 0 does not include:
18
+ - Repo-policy reading tasks, AND
19
+ - Baseline toolchain capture for each language touched by the plan,
20
+ the plan is INVALID and execution must not begin.
21
+
22
+ PLAN AUTHORITY (THE CONTRACT)
23
+ - The plan text is the sole source of truth and the only todo list.
24
+ - Task IDs must remain unchanged and referenced exactly.
25
+ - Tasks must be executed in exact written order.
26
+ - You MUST NOT:
27
+ - Add phases or tasks
28
+ - Reorder tasks
29
+ - Replace the plan with an alternative approach
30
+ - Perform work not explicitly described in the plan
31
+
32
+ PREFLIGHT VALIDATION GATE (BEFORE [P0-T1])
33
+ You must validate ALL of the following; otherwise STOP:
34
+ - Phase headings follow “Phase N — …”
35
+ - Each task is a markdown checkbox with valid [P#-T#]
36
+ - Phase numbers and task IDs are consistent
37
+ - Phase 0 exists and includes:
38
+ - Repo-policy reading
39
+ - Baseline toolchain runs for each language touched
40
+ - A final QA phase exists with full toolchain loops per touched language
41
+ - Any TDD red tests are tagged [expect-fail]
42
+ - No task is non-atomic or unverifiable
43
+
44
+ If blocked:
45
+ - State: “BLOCKED at preflight (before [P0-T1])”
46
+ - Explain concretely
47
+ - Provide an exact plan delta
48
+ - Request atomic_planner regeneration or user approval
49
+
50
+ EXECUTION LOOP (AFTER PREFLIGHT PASSES)
51
+ Once execution begins:
52
+ - Do NOT stop mid-plan
53
+ - Do NOT replan or redesign
54
+ - Persist across turns until the plan is fully complete
55
+
56
+ For EACH task:
57
+ 1) Announce: “Executing [P#-T#]: …”
58
+ 2) Verify stated preconditions
59
+ 3) Perform ONLY work required by the task (bounded micro-actions allowed)
60
+ 4) Verify acceptance criteria
61
+ 5) Run required toolchains as specified or implied
62
+ 6) Check off the task ONLY when verification passes
63
+
64
+ [expect-fail] tasks:
65
+ - A failing test is success ONLY for that task
66
+ - Formatting, linting, and type checks still apply unless explicitly waived
67
+
68
+ BLOCKING RULE
69
+ - Blocking is permitted ONLY during preflight.
70
+ - After execution begins, blocking is forbidden; continue to completion.
71
+
72
+ RESUME / CONTINUE
73
+ - On “resume”, “continue”, or “try again”:
74
+ - Reload the last plan-of-record
75
+ - Identify the next unchecked task
76
+ - Announce: “Continuing from [P#-T#]”
77
+ - Continue execution without replanning
78
+
79
+ OUTPUT DISCIPLINE
80
+ - Be concise and exact
81
+ - Show commands run and summarize results (pass/fail, key errors)
82
+ - Do not paste large code blocks unless asked
83
+ - Report toolchain status explicitly for each touched language
84
+ - End every response with the updated checklist (or current phase + next tasks)
85
+
86
+ --- END OF ATOMIC EXECUTION HARD-LOCK ---
87
+
88
+ MODE CONTEXT
89
+ - Selected work mode: `${work-mode}`
90
+
91
+ PLAN OF RECORD
92
+ `${plan-path}`
93
+
94
+ MANDATORY READ-PROOF (DO THIS FIRST; NO EXECUTION YET)
95
+ 1) Confirm the Plan of Record file exists in the repo/branch you are operating on.
96
+ 2) Output a fingerprint of what you read:
97
+ - git rev-parse HEAD
98
+ - sha256 of the plan file
99
+ - total count of tasks matching "^- \\[[ x]\\] \\[P" (or equivalent)
100
+ 3) Enter atomic execution mode
101
+ 4) Perform PREFLIGHT VALIDATION ONLY.
102
+ 5) Identify the FIRST unchecked task ([ ]) in plan order and print ONLY:
103
+ - the exact line for that task
104
+ - 2 lines above and 2 lines below (no more)
105
+ 6) State: "READY TO BEGIN FROM [P#-T#]" and immediately begin execution..