@plainconceptsplatform/agent-harness 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +426 -419
  2. package/package.json +3 -3
  3. package/src/commands/join.js +244 -244
  4. package/src/commands/shared.js +27 -27
  5. package/src/commands/single.js +79 -79
  6. package/src/commands/update.js +109 -109
  7. package/src/commands/wizard.js +134 -134
  8. package/src/content/.agents/skills/browser-automation/SKILL.md +66 -66
  9. package/src/content/.agents/skills/pc-guardrails-generic/SKILL.md +68 -68
  10. package/src/content/.agents/skills/pc-guardrails-project/SKILL.md +8 -8
  11. package/src/content/.agents/skills/pc-make-architecture/SKILL.md +51 -51
  12. package/src/content/.agents/skills/pc-make-architecture/structure-template.md +38 -38
  13. package/src/content/.agents/skills/pc-make-design/SKILL.md +68 -68
  14. package/src/content/.agents/skills/pc-make-engineer/SKILL.md +219 -219
  15. package/src/content/.agents/skills/pc-make-engineer/signal-mapping.md +68 -68
  16. package/src/content/.agents/skills/pc-make-engineer/template.md +81 -81
  17. package/src/content/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -18
  18. package/src/content/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -29
  19. package/src/content/.agents/skills/pc-make-guardrails/SKILL.md +74 -74
  20. package/src/content/.agents/skills/pc-make-guardrails/category-reference.md +68 -68
  21. package/src/content/.agents/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  22. package/src/content/.agents/skills/pc-make-merge-risk-assess/category-reference.md +98 -98
  23. package/src/content/.agents/skills/pc-make-user-model/SKILL.md +66 -66
  24. package/src/content/.agents/skills/pc-ops-evidence/SKILL.md +127 -127
  25. package/src/content/.agents/skills/pc-ops-ship/SKILL.md +18 -18
  26. package/src/content/.agents/skills/pc-plan-apply/SKILL.md +83 -83
  27. package/src/content/.agents/skills/pc-plan-apply/simple-mode.md +21 -21
  28. package/src/content/.agents/skills/pc-plan-archive/SKILL.md +63 -63
  29. package/src/content/.agents/skills/pc-plan-explore/SKILL.md +9 -9
  30. package/src/content/.agents/skills/pc-plan-goal/SKILL.md +94 -94
  31. package/src/content/.agents/skills/pc-plan-goal/branching.md +30 -30
  32. package/src/content/.agents/skills/pc-plan-goal/failure-policy.md +30 -30
  33. package/src/content/.agents/skills/pc-plan-goal/output-mode.md +9 -9
  34. package/src/content/.agents/skills/pc-plan-goal/output.md +68 -68
  35. package/src/content/.agents/skills/pc-plan-propose/SKILL.md +125 -125
  36. package/src/content/.agents/skills/pc-plan-propose/task-annotation.md +39 -39
  37. package/src/content/.agents/skills/pc-plan-quick/SKILL.md +62 -62
  38. package/src/content/.agents/skills/pc-plan-story/SKILL.md +146 -146
  39. package/src/content/.agents/skills/pc-repo-audit/SKILL.md +44 -44
  40. package/src/content/.agents/skills/pc-repo-help/SKILL.md +91 -91
  41. package/src/content/.agents/skills/pc-repo-initialize/SKILL.md +130 -130
  42. package/src/content/.agents/skills/pc-repo-onboard/SKILL.md +87 -87
  43. package/src/content/.agents/skills/pc-repo-verify/SKILL.md +34 -34
  44. package/src/content/.agents/skills/pc-userstory-az/SKILL.md +157 -157
  45. package/src/content/.agents/skills/pc-userstory-browser/SKILL.md +132 -132
  46. package/src/content/.agents/skills/pc-userstory-gh/SKILL.md +120 -120
  47. package/src/content/.agents/skills/pc-userstory-jira/SKILL.md +131 -131
  48. package/src/content/.opencode/_gitignore +9 -7
  49. package/src/content/.opencode/commands/init.md +5 -5
  50. package/src/content/.opencode/commands/make-architecture.md +5 -5
  51. package/src/content/.opencode/commands/make-design.md +5 -5
  52. package/src/content/.opencode/commands/make-engineer.md +5 -5
  53. package/src/content/.opencode/commands/make-evidence-scaffold.md +5 -5
  54. package/src/content/.opencode/commands/make-guardrails.md +5 -5
  55. package/src/content/.opencode/commands/make-user-model.md +5 -5
  56. package/src/content/.opencode/commands/ops-backlog.md +10 -10
  57. package/src/content/.opencode/commands/ops-evidence.md +9 -9
  58. package/src/content/.opencode/commands/ops-review.md +8 -8
  59. package/src/content/.opencode/commands/ops-ship.md +9 -9
  60. package/src/content/.opencode/commands/plan-apply.md +9 -9
  61. package/src/content/.opencode/commands/plan-archive.md +5 -5
  62. package/src/content/.opencode/commands/plan-explore.md +9 -9
  63. package/src/content/.opencode/commands/plan-goal.md +5 -5
  64. package/src/content/.opencode/commands/plan-propose.md +9 -9
  65. package/src/content/.opencode/commands/plan-quick.md +5 -5
  66. package/src/content/.opencode/commands/plan-story.md +9 -9
  67. package/src/content/.opencode/commands/repo-audit.md +5 -5
  68. package/src/content/.opencode/commands/repo-help.md +5 -5
  69. package/src/content/.opencode/commands/repo-initialize.md +5 -5
  70. package/src/content/.opencode/commands/repo-onboard.md +5 -5
  71. package/src/content/.opencode/commands/repo-verify.md +5 -5
  72. package/src/content/.opencode/plugins/pc-subagent-monitor.js +139 -139
  73. package/src/content/.opencode/plugins/pc-subagent-tiers.js +281 -179
  74. package/src/content/.opencode/plugins/pc-system-reminders.js +96 -96
  75. package/src/content/.opencode/tui/pc-subagents.tsx +98 -98
  76. package/src/content/.opencode/tui.json +6 -6
  77. package/src/content/AGENTS.md +71 -71
  78. package/src/content/opencode.jsonc +39 -31
  79. package/src/fragments/archive/az.md +95 -95
  80. package/src/fragments/archive/gh.md +94 -94
  81. package/src/fragments/archive/gl.md +94 -94
  82. package/src/fragments/archive/none.md +73 -73
  83. package/src/fragments/guardrails/codegraph.md +7 -7
  84. package/src/fragments/guardrails/humanizer.md +4 -4
  85. package/src/fragments/guardrails/memory.md +4 -4
  86. package/src/fragments/guardrails/rtk.md +3 -3
  87. package/src/fragments/guardrails/simple-english.md +4 -4
  88. package/src/fragments/ops-backlog/az.md +28 -28
  89. package/src/fragments/ops-backlog/gh.md +29 -29
  90. package/src/fragments/ops-backlog/jira.md +28 -28
  91. package/src/fragments/ops-evidence/az.md +41 -41
  92. package/src/fragments/ops-evidence/gh.md +53 -53
  93. package/src/fragments/ops-evidence/jira.md +38 -38
  94. package/src/fragments/ops-review/az.md +62 -62
  95. package/src/fragments/ops-review/gh.md +52 -52
  96. package/src/fragments/ops-review/gl.md +56 -56
  97. package/src/fragments/ops-ship/az.md +80 -80
  98. package/src/fragments/ops-ship/gh.md +68 -68
  99. package/src/fragments/ops-ship/gl.md +85 -85
  100. package/src/index.js +107 -107
  101. package/src/presets/agents-content.json +53 -53
  102. package/src/presets/models.json +68 -68
  103. package/src/steps/copy/agents.js +118 -118
  104. package/src/steps/copy/commands.js +91 -91
  105. package/src/steps/copy/fullstack-engineer.js +85 -83
  106. package/src/steps/copy/index.js +88 -88
  107. package/src/steps/copy/opencode-json.js +147 -129
  108. package/src/steps/copy/skills.js +196 -196
  109. package/src/steps/metadata/index.js +108 -108
  110. package/src/steps/models/write.js +34 -34
  111. package/src/steps/optimization/patch-guardrails.js +108 -108
  112. package/src/utils/copy.js +108 -108
  113. package/src/utils/legacy-check.js +30 -30
  114. package/src/utils/models-cache.js +58 -58
  115. package/src/utils/paths.js +67 -64
  116. package/src/utils/update-manifest.js +49 -49
  117. package/src/content/.opencode/plugins/pc-system-reminders.test.js +0 -35
@@ -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,98 +1,98 @@
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 pricing, quoting, or calculation engines; modifications to formula inputs, salary tables, assumptions, or margin waterfalls. Any file under a calculation or quoting namespace is a risk indicator.
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, salary bands, assumptions, or any "magic number" that affects calculations. 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**: any change that could produce incorrect monetary values, incorrect tax calculations, incorrect currency handling, or rounding changes. Money is `decimal` — changes to precision or conversion logic are risk indicators.
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
- - **Concrete**: "Changes to `QuoteCalculator.Calculate`" not "Changes to important calculations"
18
- - **Evidence-based**: derive from the project guardrails, architecture, and actual code paths
19
- - **Detectable**: an AI agent can find it by reading the PR diff (file paths, class names, method names, import changes)
20
- - **Exclusive**: do not duplicate indicators across categories — each belongs in its primary category
21
-
22
- ## Skill template
23
-
24
- Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md`:
25
-
26
- ```markdown
27
- ---
28
- name: pc-merge-risk-assess
29
- 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.
30
- license: MIT
31
- ---
32
-
33
- # Merge Risk Assessment
34
-
35
- > Auto-generated by `/make-merge-risk-assess`. Regenerate when architecture or guardrails change.
36
-
37
- ## Purpose
38
-
39
- 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.
40
-
41
- ## Output contract
42
-
43
- On completion, produce a single JSON object on stdout:
44
-
45
- ```json
46
- {"riskLevel":"safe"|"risky","reason":"<one-sentence explanation if risky, or 'No risk indicators detected' if safe>"}
47
- ```
48
-
49
- - `riskLevel: "risky"` → exit non-zero. The loop recipe routes to the "leave for human review" path.
50
- - `riskLevel: "safe"` → exit zero. The loop recipe routes to the automerge path.
51
-
52
- ## Risk indicators
53
-
54
- ### Calculation Integrity
55
- - <indicator: file path, class, or method pattern>
56
- - <indicator>
57
-
58
- ### Audit & Compliance
59
- - <indicator>
60
-
61
- ### Authentication & Authorization
62
- - <indicator>
63
-
64
- ### Data Schema & Migration
65
- - <indicator>
66
-
67
- ### Reference Data Versioning
68
- - <indicator>
69
-
70
- ### Cross-Boundary Violations
71
- - <indicator>
72
-
73
- ### Security Surface
74
- - <indicator>
75
-
76
- ### Financial Correctness
77
- - <indicator>
78
-
79
- ### State Machine Transitions
80
- - <indicator>
81
-
82
- ### Integration Contracts
83
- - <indicator>
84
-
85
- ## Evaluation rules
86
-
87
- 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`.
88
- 2. **Inspect the full PR diff** using `gh pr diff <url>`. Do not guess based on the PR title or description alone.
89
- 3. **Check each risk indicator** against the diff. A single matching indicator is sufficient to flag as `risky`.
90
- 4. **When risky, explain why.** The `reason` field must name the specific indicator that matched and the files involved. Do not give vague explanations.
91
- 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.
92
- 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.
93
- 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.
94
-
95
- <!-- Last updated: <current ISO timestamp> -->
96
- ```
97
-
98
- 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 pricing, quoting, or calculation engines; modifications to formula inputs, salary tables, assumptions, or margin waterfalls. Any file under a calculation or quoting namespace is a risk indicator.
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, salary bands, assumptions, or any "magic number" that affects calculations. 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**: any change that could produce incorrect monetary values, incorrect tax calculations, incorrect currency handling, or rounding changes. Money is `decimal` — changes to precision or conversion logic are risk indicators.
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
+ - **Concrete**: "Changes to `QuoteCalculator.Calculate`" not "Changes to important calculations"
18
+ - **Evidence-based**: derive from the project guardrails, architecture, and actual code paths
19
+ - **Detectable**: an AI agent can find it by reading the PR diff (file paths, class names, method names, import changes)
20
+ - **Exclusive**: do not duplicate indicators across categories — each belongs in its primary category
21
+
22
+ ## Skill template
23
+
24
+ Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md`:
25
+
26
+ ```markdown
27
+ ---
28
+ name: pc-merge-risk-assess
29
+ 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.
30
+ license: MIT
31
+ ---
32
+
33
+ # Merge Risk Assessment
34
+
35
+ > Auto-generated by `/make-merge-risk-assess`. Regenerate when architecture or guardrails change.
36
+
37
+ ## Purpose
38
+
39
+ 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.
40
+
41
+ ## Output contract
42
+
43
+ On completion, produce a single JSON object on stdout:
44
+
45
+ ```json
46
+ {"riskLevel":"safe"|"risky","reason":"<one-sentence explanation if risky, or 'No risk indicators detected' if safe>"}
47
+ ```
48
+
49
+ - `riskLevel: "risky"` → exit non-zero. The loop recipe routes to the "leave for human review" path.
50
+ - `riskLevel: "safe"` → exit zero. The loop recipe routes to the automerge path.
51
+
52
+ ## Risk indicators
53
+
54
+ ### Calculation Integrity
55
+ - <indicator: file path, class, or method pattern>
56
+ - <indicator>
57
+
58
+ ### Audit & Compliance
59
+ - <indicator>
60
+
61
+ ### Authentication & Authorization
62
+ - <indicator>
63
+
64
+ ### Data Schema & Migration
65
+ - <indicator>
66
+
67
+ ### Reference Data Versioning
68
+ - <indicator>
69
+
70
+ ### Cross-Boundary Violations
71
+ - <indicator>
72
+
73
+ ### Security Surface
74
+ - <indicator>
75
+
76
+ ### Financial Correctness
77
+ - <indicator>
78
+
79
+ ### State Machine Transitions
80
+ - <indicator>
81
+
82
+ ### Integration Contracts
83
+ - <indicator>
84
+
85
+ ## Evaluation rules
86
+
87
+ 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`.
88
+ 2. **Inspect the full PR diff** using `gh pr diff <url>`. Do not guess based on the PR title or description alone.
89
+ 3. **Check each risk indicator** against the diff. A single matching indicator is sufficient to flag as `risky`.
90
+ 4. **When risky, explain why.** The `reason` field must name the specific indicator that matched and the files involved. Do not give vague explanations.
91
+ 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.
92
+ 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.
93
+ 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.
94
+
95
+ <!-- Last updated: <current ISO timestamp> -->
96
+ ```
97
+
98
+ Only include sections that have real indicators. Omit empty sections and their headers.
@@ -1,66 +1,66 @@
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
- Set the concrete model for one tier. Writes to `models` in either the team config (shared, git-tracked) or a user-local override (gitignored).
7
-
8
- Usage:
9
-
10
- ```
11
- /make-user-model <tier> <model>
12
- /make-user-model user <tier> <model>
13
- ```
14
-
15
- - `user`: optional prefix. If present, writes to `.opencode/harness.user.json` (gitignored, overrides team config for this machine only). If absent, writes to `.opencode/harness.json` (shared with the team).
16
- - `<tier>`: one of `plan`, `build`, `fast`.
17
- - `<model>`: a fully-qualified model id (e.g. `opencode/big-pickle`) OR the keyword `current` to use the model active in this session.
18
-
19
- Arguments: `$ARGUMENTS`
20
-
21
- Steps
22
-
23
- 1. Parse `$ARGUMENTS`** by whitespace.
24
- - If first token is `user`: `isUser = true`, `<tier>` = second token, `<model>` = third token.
25
- - Otherwise: `isUser = false`, `<tier>` = first token, `<model>` = second token.
26
- - If `$ARGUMENTS` is empty: read both `.opencode/harness.json` and `.opencode/harness.user.json` and show the current `models` from each (team first, user override second), then show the usage above. Change nothing.
27
- - If `<tier>` is not exactly one of `plan` / `build` / `fast`, or `<model>` is missing: print the usage and stop. Change nothing.
28
-
29
- 2. **Resolve `<model>`:**
30
- - If it is the literal `current`: use the model id visible in the opencode status line for this session. Use only the model id shown there, not a guessed value.
31
- - Otherwise use the value verbatim. It must look like `provider/model-id`. If it contains no `/`, warn that it looks malformed and call the `question` tool to confirm before writing:
32
-
33
- ```json
34
- {
35
- "questions": [
36
- {
37
- "header": "Malformed model id",
38
- "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
39
- "options": [
40
- { "label": "yes", "description": "Write the value as-is to the config file." },
41
- { "label": "no", "description": "Cancel. Do not write anything." }
42
- ]
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- Only proceed to write if the user answers `yes`.
49
-
50
- 3. Determine target file.
51
- - `isUser = false` -> `.opencode/harness.json` (team). If it does not exist, stop and tell the user onboarding has not generated it yet.
52
- - `isUser = true` -> `.opencode/harness.user.json` (user override). If it does not exist, create it with `{ "models": {} }`.
53
-
54
- 4. Update the config. Read the target file, set `models.<tier>` to the resolved model id (create `models` if absent). Do not touch any other field. Preserve the existing 2-space JSON formatting, then write the file back.
55
-
56
- 5. Confirm:
57
-
58
- ```
59
- <team|user> config updated
60
- <tier> model -> <resolved-id>
61
- file: <path written>
62
- ```
63
-
64
- Restart opencode for the change to take effect. The `pc-subagent-tiers` plugin reads the model configs at startup and injects tier-suffixed agent variants (`<engineer>.<tier>`) into the live config. After restart, `/plan-apply` will spawn agents on the new model.
65
-
66
- This command edits `harness.json` (team) or `harness.user.json` (user) only. It never modifies agent files, `opencode.json`, or `tasks.md`. Tier variants are generated in-memory by the `pc-subagent-tiers` plugin at startup: no file re-stamping needed.
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
+ Set the concrete model for one tier. Writes to `models` in either the team config (shared, git-tracked) or a user-local override (gitignored).
7
+
8
+ Usage:
9
+
10
+ ```
11
+ /make-user-model <tier> <model>
12
+ /make-user-model user <tier> <model>
13
+ ```
14
+
15
+ - `user`: optional prefix. If present, writes to `.opencode/harness.user.json` (gitignored, overrides team config for this machine only). If absent, writes to `.opencode/harness.json` (shared with the team).
16
+ - `<tier>`: one of `plan`, `build`, `fast`.
17
+ - `<model>`: a fully-qualified model id (e.g. `opencode/big-pickle`) OR the keyword `current` to use the model active in this session.
18
+
19
+ Arguments: `$ARGUMENTS`
20
+
21
+ Steps
22
+
23
+ 1. Parse `$ARGUMENTS`** by whitespace.
24
+ - If first token is `user`: `isUser = true`, `<tier>` = second token, `<model>` = third token.
25
+ - Otherwise: `isUser = false`, `<tier>` = first token, `<model>` = second token.
26
+ - If `$ARGUMENTS` is empty: read both `.opencode/harness.json` and `.opencode/harness.user.json` and show the current `models` from each (team first, user override second), then show the usage above. Change nothing.
27
+ - If `<tier>` is not exactly one of `plan` / `build` / `fast`, or `<model>` is missing: print the usage and stop. Change nothing.
28
+
29
+ 2. **Resolve `<model>`:**
30
+ - If it is the literal `current`: use the model id visible in the opencode status line for this session. Use only the model id shown there, not a guessed value.
31
+ - Otherwise use the value verbatim. It must look like `provider/model-id`. If it contains no `/`, warn that it looks malformed and call the `question` tool to confirm before writing:
32
+
33
+ ```json
34
+ {
35
+ "questions": [
36
+ {
37
+ "header": "Malformed model id",
38
+ "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
39
+ "options": [
40
+ { "label": "yes", "description": "Write the value as-is to the config file." },
41
+ { "label": "no", "description": "Cancel. Do not write anything." }
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ ```
47
+
48
+ Only proceed to write if the user answers `yes`.
49
+
50
+ 3. Determine target file.
51
+ - `isUser = false` -> `.opencode/harness.json` (team). If it does not exist, stop and tell the user onboarding has not generated it yet.
52
+ - `isUser = true` -> `.opencode/harness.user.json` (user override). If it does not exist, create it with `{ "models": {} }`.
53
+
54
+ 4. Update the config. Read the target file, set `models.<tier>` to the resolved model id (create `models` if absent). Do not touch any other field. Preserve the existing 2-space JSON formatting, then write the file back.
55
+
56
+ 5. Confirm:
57
+
58
+ ```
59
+ <team|user> config updated
60
+ <tier> model -> <resolved-id>
61
+ file: <path written>
62
+ ```
63
+
64
+ Restart opencode for the change to take effect. The `pc-subagent-tiers` plugin reads the model configs at startup and injects tier-suffixed agent variants (`<engineer>.<tier>`) into the live config. After restart, `/plan-apply` will spawn agents on the new model.
65
+
66
+ This command edits `harness.json` (team) or `harness.user.json` (user) only. It never modifies agent files, `opencode.json`, or `tasks.md`. Tier variants are generated in-memory by the `pc-subagent-tiers` plugin at startup: no file re-stamping needed.