@plainconceptsplatform/agent-harness 3.8.3 → 3.9.0-alpha.1

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 (148) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +551 -551
  3. package/cli/commands/join.js +259 -259
  4. package/cli/commands/migrate.js +310 -310
  5. package/cli/commands/shared.js +27 -27
  6. package/cli/commands/single.js +79 -79
  7. package/cli/commands/update.js +121 -121
  8. package/cli/commands/wizard.js +134 -134
  9. package/cli/fragments/archive/az.md +97 -97
  10. package/cli/fragments/archive/gh.md +96 -96
  11. package/cli/fragments/archive/gl.md +96 -96
  12. package/cli/fragments/archive/none.md +75 -75
  13. package/cli/fragments/guardrails/codegraph.md +5 -5
  14. package/cli/fragments/guardrails/humanizer.md +4 -4
  15. package/cli/fragments/guardrails/memory.md +4 -4
  16. package/cli/fragments/guardrails/rtk.md +3 -3
  17. package/cli/fragments/guardrails/simple-english.md +4 -4
  18. package/cli/fragments/ops-backlog/az.md +28 -28
  19. package/cli/fragments/ops-backlog/gh.md +28 -28
  20. package/cli/fragments/ops-backlog/jira.md +28 -28
  21. package/cli/fragments/ops-review/az.md +62 -62
  22. package/cli/fragments/ops-review/gh.md +51 -51
  23. package/cli/fragments/ops-review/gl.md +55 -55
  24. package/cli/fragments/ops-ship/az.md +81 -81
  25. package/cli/fragments/ops-ship/gh.md +67 -67
  26. package/cli/fragments/ops-ship/gl.md +84 -84
  27. package/cli/index.js +116 -116
  28. package/cli/presets/agents-content.json +34 -34
  29. package/cli/presets/browser.json +10 -10
  30. package/cli/presets/clean.json +21 -21
  31. package/cli/presets/models.json +68 -68
  32. package/cli/presets/optimization.json +32 -32
  33. package/cli/presets/platforms.json +76 -76
  34. package/cli/presets/source.json +23 -23
  35. package/cli/steps/browser/index.js +52 -48
  36. package/cli/steps/clean/index.js +120 -120
  37. package/cli/steps/copy/agents.js +176 -176
  38. package/cli/steps/copy/commands.js +79 -79
  39. package/cli/steps/copy/fullstack-engineer.js +81 -89
  40. package/cli/steps/copy/index.js +88 -88
  41. package/cli/steps/copy/opencode-json.js +324 -324
  42. package/cli/steps/copy/skills.js +316 -316
  43. package/cli/steps/metadata/index.js +115 -115
  44. package/cli/steps/models/format.js +88 -88
  45. package/cli/steps/models/index.js +64 -64
  46. package/cli/steps/models/write.js +38 -38
  47. package/cli/steps/openspec/index.js +136 -136
  48. package/cli/steps/optimization/codegraph.js +141 -141
  49. package/cli/steps/optimization/detect.js +66 -66
  50. package/cli/steps/optimization/humanizer.js +17 -17
  51. package/cli/steps/optimization/index.js +158 -158
  52. package/cli/steps/optimization/memory.js +91 -91
  53. package/cli/steps/optimization/patch-guardrails.js +111 -111
  54. package/cli/steps/optimization/simple-english.js +17 -17
  55. package/cli/steps/optimization/skills-lock.js +30 -30
  56. package/cli/steps/platform/index.js +109 -109
  57. package/cli/steps/source/index.js +123 -123
  58. package/cli/utils/agent-color.js +111 -111
  59. package/cli/utils/copy.js +134 -134
  60. package/cli/utils/exec-spinner.js +47 -47
  61. package/cli/utils/exec.js +134 -134
  62. package/cli/utils/legacy-check.js +30 -30
  63. package/cli/utils/models-cache.js +58 -58
  64. package/cli/utils/models-pricing.js +42 -42
  65. package/cli/utils/paths.js +82 -82
  66. package/cli/utils/process.js +3 -3
  67. package/cli/utils/terminal.js +6 -6
  68. package/cli/utils/update-manifest.js +75 -75
  69. package/harness/.opencode/_gitignore +12 -10
  70. package/harness/.opencode/commands/init.md +5 -5
  71. package/harness/.opencode/commands/make-architecture.md +5 -5
  72. package/harness/.opencode/commands/make-design.md +5 -5
  73. package/harness/.opencode/commands/make-engineer.md +5 -5
  74. package/harness/.opencode/commands/make-guardrails.md +5 -5
  75. package/harness/.opencode/commands/make-user-model.md +5 -5
  76. package/harness/.opencode/commands/ops-backlog.md +10 -10
  77. package/harness/.opencode/commands/ops-review.md +10 -10
  78. package/harness/.opencode/commands/ops-ship.md +9 -9
  79. package/harness/.opencode/commands/plan-apply.md +9 -9
  80. package/harness/.opencode/commands/plan-archive.md +7 -7
  81. package/harness/.opencode/commands/plan-explore.md +11 -11
  82. package/harness/.opencode/commands/plan-goal.md +5 -5
  83. package/harness/.opencode/commands/plan-propose.md +11 -11
  84. package/harness/.opencode/commands/plan-quick.md +7 -7
  85. package/harness/.opencode/commands/plan-story.md +11 -11
  86. package/harness/.opencode/commands/repo-audit.md +7 -7
  87. package/harness/.opencode/commands/repo-help.md +5 -5
  88. package/harness/.opencode/commands/repo-initialize.md +5 -5
  89. package/harness/.opencode/commands/repo-onboard.md +5 -5
  90. package/harness/.opencode/commands/repo-verify.md +5 -5
  91. package/harness/.opencode/package.json +6 -5
  92. package/harness/.opencode/plugins/pc-commit-coauthor.js +41 -41
  93. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  94. package/harness/.opencode/plugins/pc-subagent-tiers-core.js +337 -0
  95. package/harness/.opencode/plugins/pc-subagent-tiers.js +56 -367
  96. package/harness/.opencode/plugins/pc-system-reminders.js +424 -424
  97. package/harness/.opencode/scripts/check-diff.mjs +305 -305
  98. package/harness/.opencode/scripts/code-rules.mjs +288 -288
  99. package/harness/.opencode/scripts/harness-doctor.mjs +52 -0
  100. package/harness/.opencode/scripts/harness-doctor.test.mjs +58 -0
  101. package/harness/.opencode/scripts/platform-contract.mjs +366 -366
  102. package/harness/.opencode/scripts/sync-agents.mjs +29 -0
  103. package/harness/AGENTS.md +55 -55
  104. package/harness/ARCHITECTURE.md +13 -13
  105. package/harness/DESIGN.md +13 -13
  106. package/harness/opencode.jsonc +36 -36
  107. package/harness/openspec/config.yaml +20 -20
  108. package/harness/skills-lock.json +17 -17
  109. package/package.json +14 -12
  110. package/skills/README.md +18 -18
  111. package/skills/agent-harness-cli/SKILL.md +86 -86
  112. package/skills/browser-automation/SKILL.md +100 -72
  113. package/skills/pc-guardrails-generic/SKILL.md +53 -53
  114. package/skills/pc-guardrails-project/SKILL.md +8 -8
  115. package/skills/pc-make-architecture/SKILL.md +33 -33
  116. package/skills/pc-make-architecture/structure-template.md +64 -64
  117. package/skills/pc-make-design/SKILL.md +45 -45
  118. package/skills/pc-make-engineer/SKILL.md +59 -59
  119. package/skills/pc-make-engineer/signal-mapping.md +53 -53
  120. package/skills/pc-make-engineer/template.md +36 -36
  121. package/skills/pc-make-guardrails/SKILL.md +44 -44
  122. package/skills/pc-make-guardrails/category-reference.md +112 -112
  123. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  124. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  125. package/skills/pc-make-user-model/SKILL.md +56 -56
  126. package/skills/pc-ops-ship/SKILL.md +22 -22
  127. package/skills/pc-plan-apply/SKILL.md +90 -90
  128. package/skills/pc-plan-apply/simple-mode.md +21 -21
  129. package/skills/pc-plan-archive/SKILL.md +66 -66
  130. package/skills/pc-plan-explore/SKILL.md +21 -21
  131. package/skills/pc-plan-goal/SKILL.md +91 -91
  132. package/skills/pc-plan-goal/branching.md +39 -39
  133. package/skills/pc-plan-goal/failure-policy.md +30 -30
  134. package/skills/pc-plan-goal/output-mode.md +10 -10
  135. package/skills/pc-plan-goal/output.md +71 -71
  136. package/skills/pc-plan-propose/SKILL.md +127 -127
  137. package/skills/pc-plan-propose/task-annotation.md +39 -39
  138. package/skills/pc-plan-quick/SKILL.md +46 -46
  139. package/skills/pc-plan-story/SKILL.md +93 -93
  140. package/skills/pc-repo-audit/SKILL.md +44 -44
  141. package/skills/pc-repo-help/SKILL.md +87 -87
  142. package/skills/pc-repo-initialize/SKILL.md +119 -119
  143. package/skills/pc-repo-onboard/SKILL.md +32 -32
  144. package/skills/pc-repo-verify/SKILL.md +150 -150
  145. package/skills/pc-userstory-az/SKILL.md +71 -71
  146. package/skills/pc-userstory-browser/SKILL.md +73 -64
  147. package/skills/pc-userstory-gh/SKILL.md +63 -63
  148. package/skills/pc-userstory-jira/SKILL.md +74 -74
@@ -1,70 +1,70 @@
1
- ---
2
- name: pc-make-merge-risk-assess
3
- description: Generate or update the pc-merge-risk-assess skill from project guardrails and architecture. Produces a PR-level risk assessment that loop recipes can gate automerge on. Invoked by the /make-merge-risk-assess command and the repo-initialize flow.
4
- license: MIT
5
- ---
6
-
7
- # Make Merge Risk Assess
8
-
9
- Analyze `ARCHITECTURE.md`, the project guardrails skill, and other project files to generate or update an `pc-merge-risk-assess` skill: a checklist of risk indicators that an AI agent evaluates before auto-merging a pull request. When any indicator matches, the agent blocks automerge and leaves the PR for human review with an explanation.
10
-
11
- ## Steps
12
-
13
- 1. **Check current state**
14
-
15
- Read `.agents/skills/pc-merge-risk-assess/SKILL.md`. Determine which mode to use:
16
- - Does not exist: Generate mode. Create from scratch.
17
- - Exists and has a `<!-- Last updated:` footer: Update mode. Incrementally update.
18
- - Exists but no timestamp: proceed in Generate mode (full regeneration).
19
-
20
- 2a. **Generate mode: read source documents**
21
-
22
- Read ALL of the following that exist:
23
- - `.agents/skills/pc-guardrails-project/SKILL.md` (primary source — project-specific constraints)
24
- - `.agents/skills/pc-guardrails-generic/SKILL.md` (generic safety rules)
25
- - `ARCHITECTURE.md` (architecture boundaries, critical paths)
26
- - `AGENTS.md` (non-negotiable constraints, verification rules)
27
- - `.opencode/harness.json` (platform, concurrency)
28
- - CI/CD workflows: `.github/workflows/*`, `azure-pipelines.yml`: whatever exists
29
- - Loop recipes: `.loops/recipes/*-loop.yaml` (understand the automerge flow)
30
-
31
- Use file tools to discover risk-critical code paths: `grep` for calculation engines, audit appenders, auth middleware, schema migrations, permission checks, and other sensitive areas.
32
-
33
- 2b. **Update mode: incremental analysis**
34
-
35
- Extract the `<!-- Last updated: <ISO date> -->` timestamp from the existing skill file. Then:
36
- - Read `.agents/skills/pc-guardrails-project/SKILL.md` and check its `<!-- Last updated:` timestamp. If the guardrails haven't changed and ARCHITECTURE.md hasn't changed since the risk skill was last generated, report "Merge risk assessment up to date" and stop.
37
- - Run `git log --oneline --since="<date>" -- <relevant config and architecture files>` to find what changed.
38
- - If nothing changed: report "Merge risk assessment up to date" and stop.
39
- - Update only the affected risk categories. Preserve manually-added risk indicators in unchanged categories.
40
- - If changes are pervasive, fall back to Generate mode.
41
-
42
- 3. **Extract risk indicators**
43
-
44
- From the documents and code analysis, extract concrete, testable risk indicators. Follow the [category reference](category-reference.md) for the full list of categories, indicator quality standards, and the skill file template.
45
-
46
- Each risk indicator must identify a code path or change pattern that, when touched, makes a PR too dangerous to auto-merge. The indicator must be something an AI agent can detect by reading the PR diff.
47
-
48
- 4. **Write the skill**
49
-
50
- Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md` using the template from the [category reference](category-reference.md). Only include sections that have real indicators. Omit empty sections.
51
-
52
- 5. **Update agents**
53
-
54
- For every `*-engineer.md` in `.opencode/agents/`, add `@pc-merge-risk-assess` to the Agent Workflow ability group (skip if already present). This ensures every engineer can evaluate risk before merge. Use this pattern:
55
- ```markdown
56
- ## Abilities
57
- - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
58
- ...
59
- - Development, Agent Workflow: @pc-merge-risk-assess[, ...existing entries unchanged]
60
- ```
61
-
62
- If no "Development, Agent Workflow" line exists, create it. Exclude tier variant files (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are generated copies; only update the base templates.
63
-
64
- 6. **Report**
65
-
66
- Tell the user:
67
- - Whether the skill was generated or updated (and which categories changed)
68
- - Number of risk indicators extracted per category
69
- - Number of agent files updated
70
- - Tip: "Rerun `/make-merge-risk-assess` any time the architecture or project guardrails change significantly."
1
+ ---
2
+ name: pc-make-merge-risk-assess
3
+ description: Generate or update the pc-merge-risk-assess skill from project guardrails and architecture. Produces a PR-level risk assessment that loop recipes can gate automerge on. Invoked by the /make-merge-risk-assess command and the repo-initialize flow.
4
+ license: MIT
5
+ ---
6
+
7
+ # Make Merge Risk Assess
8
+
9
+ Analyze `ARCHITECTURE.md`, the project guardrails skill, and other project files to generate or update an `pc-merge-risk-assess` skill: a checklist of risk indicators that an AI agent evaluates before auto-merging a pull request. When any indicator matches, the agent blocks automerge and leaves the PR for human review with an explanation.
10
+
11
+ ## Steps
12
+
13
+ 1. **Check current state**
14
+
15
+ Read `.agents/skills/pc-merge-risk-assess/SKILL.md`. Determine which mode to use:
16
+ - Does not exist: Generate mode. Create from scratch.
17
+ - Exists and has a `<!-- Last updated:` footer: Update mode. Incrementally update.
18
+ - Exists but no timestamp: proceed in Generate mode (full regeneration).
19
+
20
+ 2a. **Generate mode: read source documents**
21
+
22
+ Read ALL of the following that exist:
23
+ - `.agents/skills/pc-guardrails-project/SKILL.md` (primary source — project-specific constraints)
24
+ - `.agents/skills/pc-guardrails-generic/SKILL.md` (generic safety rules)
25
+ - `ARCHITECTURE.md` (architecture boundaries, critical paths)
26
+ - `AGENTS.md` (non-negotiable constraints, verification rules)
27
+ - `.opencode/harness.json` (platform, concurrency)
28
+ - CI/CD workflows: `.github/workflows/*`, `azure-pipelines.yml`: whatever exists
29
+ - Loop recipes: `.loops/recipes/*-loop.yaml` (understand the automerge flow)
30
+
31
+ Use file tools to discover risk-critical code paths: `grep` for calculation engines, audit appenders, auth middleware, schema migrations, permission checks, and other sensitive areas.
32
+
33
+ 2b. **Update mode: incremental analysis**
34
+
35
+ Extract the `<!-- Last updated: <ISO date> -->` timestamp from the existing skill file. Then:
36
+ - Read `.agents/skills/pc-guardrails-project/SKILL.md` and check its `<!-- Last updated:` timestamp. If the guardrails haven't changed and ARCHITECTURE.md hasn't changed since the risk skill was last generated, report "Merge risk assessment up to date" and stop.
37
+ - Run `git log --oneline --since="<date>" -- <relevant config and architecture files>` to find what changed.
38
+ - If nothing changed: report "Merge risk assessment up to date" and stop.
39
+ - Update only the affected risk categories. Preserve manually-added risk indicators in unchanged categories.
40
+ - If changes are pervasive, fall back to Generate mode.
41
+
42
+ 3. **Extract risk indicators**
43
+
44
+ From the documents and code analysis, extract concrete, testable risk indicators. Follow the [category reference](category-reference.md) for the full list of categories, indicator quality standards, and the skill file template.
45
+
46
+ Each risk indicator must identify a code path or change pattern that, when touched, makes a PR too dangerous to auto-merge. The indicator must be something an AI agent can detect by reading the PR diff.
47
+
48
+ 4. **Write the skill**
49
+
50
+ Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md` using the template from the [category reference](category-reference.md). Only include sections that have real indicators. Omit empty sections.
51
+
52
+ 5. **Update agents**
53
+
54
+ For every `*-engineer.md` in `.opencode/agents/`, add `@pc-merge-risk-assess` to the Agent Workflow ability group (skip if already present). This ensures every engineer can evaluate risk before merge. Use this pattern:
55
+ ```markdown
56
+ ## Abilities
57
+ - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
58
+ ...
59
+ - Development, Agent Workflow: @pc-merge-risk-assess[, ...existing entries unchanged]
60
+ ```
61
+
62
+ If no "Development, Agent Workflow" line exists, create it. Exclude tier variant files (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are generated copies; only update the base templates.
63
+
64
+ 6. **Report**
65
+
66
+ Tell the user:
67
+ - Whether the skill was generated or updated (and which categories changed)
68
+ - Number of risk indicators extracted per category
69
+ - Number of agent files updated
70
+ - Tip: "Rerun `/make-merge-risk-assess` any time the architecture or project guardrails change significantly."
@@ -1,114 +1,114 @@
1
- # Merge risk assessment category reference
2
-
3
- From the project guardrails, architecture, and code analysis, extract concrete, testable risk indicators in these categories. Only include a category if you found real evidence for it.
4
-
5
- - **Calculation integrity**: changes to whatever this project computes and cannot get wrong — an engine, its formula inputs, its reference tables, its assumptions. Any file under that namespace is an indicator. See the worked example below for the shape.
6
- - **Audit & compliance**: modifications to audit appenders, audit log storage, hash-chaining, or tamper-evident mechanisms. Any change that could affect regulatory traceability.
7
- - **Authentication & authorization**: changes to auth middleware, permission checks, role definitions, token issuance, or session management. Changes to `.RequirePermission()` calls or permission seed data.
8
- - **Data schema & migration**: EF Core entity changes, new migrations, column type changes, constraint additions/removals, or seed data modifications. Schema changes are always risky because they affect production data.
9
- - **Reference data versioning**: changes to effective-dated configuration, rate or band tables, assumptions, or any constant an output depends on. Changes to versioning or snapshot logic.
10
- - **Cross-boundary violations**: imports that break the layering direction (e.g. Domain referencing Application, Application referencing ASP.NET), cross-context data access bypassing ports.
11
- - **Security surface**: new endpoints without authorization, input validation removal, secrets exposure, dependency version downgrades, or changes to security scanning configuration.
12
- - **Financial correctness**: where the project handles money, any change that could produce a wrong amount — tax, currency, precision, rounding, or the type money is stored in.
13
- - **State machine transitions**: modifications to entity lifecycle transitions (e.g. quote status flow, approval gates, sign-off logic). Breaking a state machine can leave data in unrecoverable states.
14
- - **Integration contracts**: changes to external API contracts, webhook payloads, or CRM integration ports. Breaking integrations can cascade to downstream systems.
15
-
16
- Each indicator must be:
17
-
18
- - **Concrete**: name the type, method or path — "Changes to `OrderTotal.Calculate`" not "Changes to important calculations".
19
- - **Evidence-based**: derived from the project guardrails, the architecture, and actual code paths.
20
- - **Detectable**: findable by reading the PR diff alone — file paths, class names, method names, import changes.
21
- - **Exclusive**: each indicator belongs to one category. Never repeat it in a second.
22
- - **Not enforced elsewhere.** Skip anything CI already fails the build on. An indicator that duplicates a required check adds a human review the pipeline did not need.
23
-
24
- **At most 40 indicators, across all categories.** Rank by what a missed regression costs and cut from the bottom. A file this size is read on every merge decision, and past roughly this many, compliance drops regardless of how good each line is — so an indicator that will not change a verdict is worse than absent.
25
-
26
- ## Worked example
27
-
28
- One project's calculation-integrity indicator, for shape only. Replace it with this repository's own: edits between the `PC-PROJECT-EXAMPLE` markers are carried over when the harness updates, and anything outside them is replaced by the shipped version.
29
-
30
- <!-- PC-PROJECT-EXAMPLE-START -->
31
- ```markdown
32
- ### Calculation Integrity
33
- - Any change under `src/pricing/engine/` — `RateEngine.Compute` is static and deterministic, and every change to it needs a golden vector in `PricingParityTests`. A wrong number here is invisible in review and correct-looking in production.
34
- - Any change to a rate table, band, or assumption constant, including its effective dates. The engine reads them by date, so an edit silently rewrites past outputs.
35
- ```
36
- <!-- PC-PROJECT-EXAMPLE-END -->
37
-
38
- ## Skill template
39
-
40
- Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md`:
41
-
42
- ```markdown
43
- ---
44
- name: pc-merge-risk-assess
45
- description: Evaluate a pull request for merge risk. Load when a loop recipe or agent needs to decide whether a PR is safe to auto-merge or requires human review. Produces a structured risk assessment with a binary outcome and reasoning.
46
- license: MIT
47
- ---
48
-
49
- # Merge Risk Assessment
50
-
51
- > Auto-generated by `/make-merge-risk-assess`. Regenerate when architecture or guardrails change.
52
-
53
- ## Purpose
54
-
55
- Determine whether a pull request is safe to auto-merge or requires human review. This skill is loaded by AI agents in loop recipes (e.g. `dev-assess-risk`) before merging. The agent inspects the PR diff and evaluates each risk indicator below.
56
-
57
- ## Output contract
58
-
59
- On completion, produce a single JSON object on stdout:
60
-
61
- ```json
62
- {"riskLevel":"safe"|"risky","reason":"<one-sentence explanation if risky, or 'No risk indicators detected' if safe>"}
63
- ```
64
-
65
- - `riskLevel: "risky"` → exit non-zero. The loop recipe routes to the "leave for human review" path.
66
- - `riskLevel: "safe"` → exit zero. The loop recipe routes to the automerge path.
67
-
68
- ## Risk indicators
69
-
70
- ### Calculation Integrity
71
- - <indicator: file path, class, or method pattern>
72
- - <indicator>
73
-
74
- ### Audit & Compliance
75
- - <indicator>
76
-
77
- ### Authentication & Authorization
78
- - <indicator>
79
-
80
- ### Data Schema & Migration
81
- - <indicator>
82
-
83
- ### Reference Data Versioning
84
- - <indicator>
85
-
86
- ### Cross-Boundary Violations
87
- - <indicator>
88
-
89
- ### Security Surface
90
- - <indicator>
91
-
92
- ### Financial Correctness
93
- - <indicator>
94
-
95
- ### State Machine Transitions
96
- - <indicator>
97
-
98
- ### Integration Contracts
99
- - <indicator>
100
-
101
- ## Evaluation rules
102
-
103
- 1. **Load `@pc-guardrails-project` first.** Every non-negotiable constraint in the project guardrails is a potential risk indicator. If a change violates or weakens any guardrail, the outcome is `risky`.
104
- 2. **Inspect the full PR diff** using `gh pr diff <url>`. Do not guess based on the PR title or description alone.
105
- 3. **Check each risk indicator** against the diff. A single matching indicator is sufficient to flag as `risky`.
106
- 4. **When risky, explain why.** The `reason` field must name the specific indicator that matched and the files involved. Do not give vague explanations.
107
- 5. **Do not second-guess the developer.** If the changes look intentional and no indicator matches, classify as `safe`. The purpose is to catch dangerous changes, not to block all non-trivial work.
108
- 6. **Pure additions are lower risk.** New files, new endpoints with authorization, new tests, new UI components that don't touch existing critical paths are generally safe unless they introduce schema changes or cross-boundary imports.
109
- 7. **Refactors within a single layer are generally safe.** Renaming, extracting methods, or reorganizing within the same bounded context and same architectural layer rarely triggers a risk indicator unless the refactor changes behavior.
110
-
111
- <!-- Last updated: <current ISO timestamp> -->
112
- ```
113
-
114
- Only include sections that have real indicators. Omit empty sections and their headers.
1
+ # Merge risk assessment category reference
2
+
3
+ From the project guardrails, architecture, and code analysis, extract concrete, testable risk indicators in these categories. Only include a category if you found real evidence for it.
4
+
5
+ - **Calculation integrity**: changes to whatever this project computes and cannot get wrong — an engine, its formula inputs, its reference tables, its assumptions. Any file under that namespace is an indicator. See the worked example below for the shape.
6
+ - **Audit & compliance**: modifications to audit appenders, audit log storage, hash-chaining, or tamper-evident mechanisms. Any change that could affect regulatory traceability.
7
+ - **Authentication & authorization**: changes to auth middleware, permission checks, role definitions, token issuance, or session management. Changes to `.RequirePermission()` calls or permission seed data.
8
+ - **Data schema & migration**: EF Core entity changes, new migrations, column type changes, constraint additions/removals, or seed data modifications. Schema changes are always risky because they affect production data.
9
+ - **Reference data versioning**: changes to effective-dated configuration, rate or band tables, assumptions, or any constant an output depends on. Changes to versioning or snapshot logic.
10
+ - **Cross-boundary violations**: imports that break the layering direction (e.g. Domain referencing Application, Application referencing ASP.NET), cross-context data access bypassing ports.
11
+ - **Security surface**: new endpoints without authorization, input validation removal, secrets exposure, dependency version downgrades, or changes to security scanning configuration.
12
+ - **Financial correctness**: where the project handles money, any change that could produce a wrong amount — tax, currency, precision, rounding, or the type money is stored in.
13
+ - **State machine transitions**: modifications to entity lifecycle transitions (e.g. quote status flow, approval gates, sign-off logic). Breaking a state machine can leave data in unrecoverable states.
14
+ - **Integration contracts**: changes to external API contracts, webhook payloads, or CRM integration ports. Breaking integrations can cascade to downstream systems.
15
+
16
+ Each indicator must be:
17
+
18
+ - **Concrete**: name the type, method or path — "Changes to `OrderTotal.Calculate`" not "Changes to important calculations".
19
+ - **Evidence-based**: derived from the project guardrails, the architecture, and actual code paths.
20
+ - **Detectable**: findable by reading the PR diff alone — file paths, class names, method names, import changes.
21
+ - **Exclusive**: each indicator belongs to one category. Never repeat it in a second.
22
+ - **Not enforced elsewhere.** Skip anything CI already fails the build on. An indicator that duplicates a required check adds a human review the pipeline did not need.
23
+
24
+ **At most 40 indicators, across all categories.** Rank by what a missed regression costs and cut from the bottom. A file this size is read on every merge decision, and past roughly this many, compliance drops regardless of how good each line is — so an indicator that will not change a verdict is worse than absent.
25
+
26
+ ## Worked example
27
+
28
+ One project's calculation-integrity indicator, for shape only. Replace it with this repository's own: edits between the `PC-PROJECT-EXAMPLE` markers are carried over when the harness updates, and anything outside them is replaced by the shipped version.
29
+
30
+ <!-- PC-PROJECT-EXAMPLE-START -->
31
+ ```markdown
32
+ ### Calculation Integrity
33
+ - Any change under `src/pricing/engine/` — `RateEngine.Compute` is static and deterministic, and every change to it needs a golden vector in `PricingParityTests`. A wrong number here is invisible in review and correct-looking in production.
34
+ - Any change to a rate table, band, or assumption constant, including its effective dates. The engine reads them by date, so an edit silently rewrites past outputs.
35
+ ```
36
+ <!-- PC-PROJECT-EXAMPLE-END -->
37
+
38
+ ## Skill template
39
+
40
+ Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md`:
41
+
42
+ ```markdown
43
+ ---
44
+ name: pc-merge-risk-assess
45
+ description: Evaluate a pull request for merge risk. Load when a loop recipe or agent needs to decide whether a PR is safe to auto-merge or requires human review. Produces a structured risk assessment with a binary outcome and reasoning.
46
+ license: MIT
47
+ ---
48
+
49
+ # Merge Risk Assessment
50
+
51
+ > Auto-generated by `/make-merge-risk-assess`. Regenerate when architecture or guardrails change.
52
+
53
+ ## Purpose
54
+
55
+ Determine whether a pull request is safe to auto-merge or requires human review. This skill is loaded by AI agents in loop recipes (e.g. `dev-assess-risk`) before merging. The agent inspects the PR diff and evaluates each risk indicator below.
56
+
57
+ ## Output contract
58
+
59
+ On completion, produce a single JSON object on stdout:
60
+
61
+ ```json
62
+ {"riskLevel":"safe"|"risky","reason":"<one-sentence explanation if risky, or 'No risk indicators detected' if safe>"}
63
+ ```
64
+
65
+ - `riskLevel: "risky"` → exit non-zero. The loop recipe routes to the "leave for human review" path.
66
+ - `riskLevel: "safe"` → exit zero. The loop recipe routes to the automerge path.
67
+
68
+ ## Risk indicators
69
+
70
+ ### Calculation Integrity
71
+ - <indicator: file path, class, or method pattern>
72
+ - <indicator>
73
+
74
+ ### Audit & Compliance
75
+ - <indicator>
76
+
77
+ ### Authentication & Authorization
78
+ - <indicator>
79
+
80
+ ### Data Schema & Migration
81
+ - <indicator>
82
+
83
+ ### Reference Data Versioning
84
+ - <indicator>
85
+
86
+ ### Cross-Boundary Violations
87
+ - <indicator>
88
+
89
+ ### Security Surface
90
+ - <indicator>
91
+
92
+ ### Financial Correctness
93
+ - <indicator>
94
+
95
+ ### State Machine Transitions
96
+ - <indicator>
97
+
98
+ ### Integration Contracts
99
+ - <indicator>
100
+
101
+ ## Evaluation rules
102
+
103
+ 1. **Load `@pc-guardrails-project` first.** Every non-negotiable constraint in the project guardrails is a potential risk indicator. If a change violates or weakens any guardrail, the outcome is `risky`.
104
+ 2. **Inspect the full PR diff** using `gh pr diff <url>`. Do not guess based on the PR title or description alone.
105
+ 3. **Check each risk indicator** against the diff. A single matching indicator is sufficient to flag as `risky`.
106
+ 4. **When risky, explain why.** The `reason` field must name the specific indicator that matched and the files involved. Do not give vague explanations.
107
+ 5. **Do not second-guess the developer.** If the changes look intentional and no indicator matches, classify as `safe`. The purpose is to catch dangerous changes, not to block all non-trivial work.
108
+ 6. **Pure additions are lower risk.** New files, new endpoints with authorization, new tests, new UI components that don't touch existing critical paths are generally safe unless they introduce schema changes or cross-boundary imports.
109
+ 7. **Refactors within a single layer are generally safe.** Renaming, extracting methods, or reorganizing within the same bounded context and same architectural layer rarely triggers a risk indicator unless the refactor changes behavior.
110
+
111
+ <!-- Last updated: <current ISO timestamp> -->
112
+ ```
113
+
114
+ Only include sections that have real indicators. Omit empty sections and their headers.
@@ -1,56 +1,56 @@
1
- ---
2
- name: pc-make-user-model
3
- description: Set the model for a tier (plan, build, or fast). Team-wide or user-local override. Invoked by the /make-user-model command.
4
- license: MIT
5
- ---
6
-
7
- Point one tier at one model, in the team config or in a machine-local override.
8
-
9
- ## Rules
10
-
11
- - Only `models.<tier>` in `.opencode/harness.json` or `.opencode/harness.user.json` changes. Agent files, `opencode.jsonc` and `tasks.md` are not this command's business, and tier variants are rebuilt from these configs at startup anyway.
12
- - Never guess the id behind `current`: read it from the status line. A guessed id writes a model that does not exist into the team's config.
13
- - Never write anything when the arguments do not parse. Print the usage and stop.
14
- - Preserve the file's other fields and its 2-space formatting.
15
-
16
- ## Contract
17
-
18
- ```
19
- /make-user-model <tier> <model>
20
- /make-user-model user <tier> <model>
21
- ```
22
-
23
- `user` writes `.opencode/harness.user.json`, which is gitignored and wins on this machine only; without it the target is `.opencode/harness.json`, which is shared. `<tier>` is exactly `plan`, `build` or `fast`. `<model>` is a fully-qualified id (`opencode/big-pickle`) or `current` for the model this session is running.
24
-
25
- No arguments means show the `models` block from both files, team first, then the usage. Change nothing.
26
-
27
- A team config that does not exist yet is a stop: onboarding has not run. A missing user config is created as `{ "models": {} }`.
28
-
29
- An id with no `/` in it is malformed; confirm before writing it:
30
-
31
- ```json
32
- {
33
- "questions": [
34
- {
35
- "header": "Malformed model id",
36
- "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
37
- "options": [
38
- { "label": "yes", "description": "Write the value as-is to the config file." },
39
- { "label": "no", "description": "Cancel. Do not write anything." }
40
- ]
41
- }
42
- ]
43
- }
44
- ```
45
-
46
- ## Report
47
-
48
- ```
49
- <team|user> config updated
50
- <tier> model -> <resolved-id>
51
- file: <path written>
52
- ```
53
-
54
- The change lands on the next opencode start, when `pc-subagent-tiers` reads the configs and rebuilds the tier variants.
55
-
56
- Arguments: `$ARGUMENTS`
1
+ ---
2
+ name: pc-make-user-model
3
+ description: Set the model for a tier (plan, build, or fast). Team-wide or user-local override. Invoked by the /make-user-model command.
4
+ license: MIT
5
+ ---
6
+
7
+ Point one tier at one model, in the team config or in a machine-local override.
8
+
9
+ ## Rules
10
+
11
+ - Only `models.<tier>` in `.opencode/harness.json` or `.opencode/harness.user.json` changes. Agent files, `opencode.jsonc` and `tasks.md` are not this command's business, and tier variants are rebuilt from these configs at startup anyway.
12
+ - Never guess the id behind `current`: read it from the status line. A guessed id writes a model that does not exist into the team's config.
13
+ - Never write anything when the arguments do not parse. Print the usage and stop.
14
+ - Preserve the file's other fields and its 2-space formatting.
15
+
16
+ ## Contract
17
+
18
+ ```
19
+ /make-user-model <tier> <model>
20
+ /make-user-model user <tier> <model>
21
+ ```
22
+
23
+ `user` writes `.opencode/harness.user.json`, which is gitignored and wins on this machine only; without it the target is `.opencode/harness.json`, which is shared. `<tier>` is exactly `plan`, `build` or `fast`. `<model>` is a fully-qualified id (`opencode/big-pickle`) or `current` for the model this session is running.
24
+
25
+ No arguments means show the `models` block from both files, team first, then the usage. Change nothing.
26
+
27
+ A team config that does not exist yet is a stop: onboarding has not run. A missing user config is created as `{ "models": {} }`.
28
+
29
+ An id with no `/` in it is malformed; confirm before writing it:
30
+
31
+ ```json
32
+ {
33
+ "questions": [
34
+ {
35
+ "header": "Malformed model id",
36
+ "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
37
+ "options": [
38
+ { "label": "yes", "description": "Write the value as-is to the config file." },
39
+ { "label": "no", "description": "Cancel. Do not write anything." }
40
+ ]
41
+ }
42
+ ]
43
+ }
44
+ ```
45
+
46
+ ## Report
47
+
48
+ ```
49
+ <team|user> config updated
50
+ <tier> model -> <resolved-id>
51
+ file: <path written>
52
+ ```
53
+
54
+ The change lands on the next opencode start, when `pc-subagent-tiers` reads the configs and rebuilds the tier variants. For CI or a non-interactive run, `node .opencode/scripts/sync-agents.mjs` rebuilds the agents and `.opencode/harness-models.json`; `node .opencode/scripts/harness-doctor.mjs --strict` prints and validates the effective routing.
55
+
56
+ Arguments: `$ARGUMENTS`
@@ -1,22 +1,22 @@
1
- ---
2
- name: pc-ops-ship
3
- description: Create a pull request for the current feature branch, with screenshots if UI changed. Load when shipping a finished feature branch. Invoked by the /ops-ship command and the plan-goal pipeline (pr mode).
4
- license: MIT
5
- ---
6
-
7
- # Ops Ship
8
-
9
- ## Input
10
-
11
- The caller provides (all optional):
12
- - PR title and body. When absent, derive them from the change context (change id, tasks completed, commit list).
13
- - The base branch. When absent, resolve the default branch as shown in the platform steps below.
14
-
15
- ## Before opening
16
-
17
- Run the project's verification (`pnpm verify` when package.json defines it) and `node .opencode/scripts/check-diff.mjs` on the branch as it will be pushed. If any commit landed after the last passing run, run both again. Do not open the pull request while either fails, and paste the verification summary into the body: a body that says "lint clean" without the output is how a formatting error reached CI.
18
-
19
- Repo platform is set in `.opencode/harness.json` `platform.repo`. The platform-specific content below is injected by the CLI during onboarding.
20
-
21
- <!-- PC-PLATFORM-SHIP-START -->
22
- <!-- PC-PLATFORM-SHIP-END -->
1
+ ---
2
+ name: pc-ops-ship
3
+ description: Create a pull request for the current feature branch, with screenshots if UI changed. Load when shipping a finished feature branch. Invoked by the /ops-ship command and the plan-goal pipeline (pr mode).
4
+ license: MIT
5
+ ---
6
+
7
+ # Ops Ship
8
+
9
+ ## Input
10
+
11
+ The caller provides (all optional):
12
+ - PR title and body. When absent, derive them from the change context (change id, tasks completed, commit list).
13
+ - The base branch. When absent, resolve the default branch as shown in the platform steps below.
14
+
15
+ ## Before opening
16
+
17
+ Run the project's verification (`pnpm verify` when package.json defines it) and `node .opencode/scripts/check-diff.mjs` on the branch as it will be pushed. If any commit landed after the last passing run, run both again. Do not open the pull request while either fails, and paste the verification summary into the body: a body that says "lint clean" without the output is how a formatting error reached CI.
18
+
19
+ Repo platform is set in `.opencode/harness.json` `platform.repo`. The platform-specific content below is injected by the CLI during onboarding.
20
+
21
+ <!-- PC-PLATFORM-SHIP-START -->
22
+ <!-- PC-PLATFORM-SHIP-END -->