@plainconceptsplatform/agent-harness 3.3.1 → 3.4.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 (95) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +454 -454
  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/wizard.js +134 -134
  8. package/cli/fragments/ops-backlog/az.md +28 -28
  9. package/cli/fragments/ops-backlog/gh.md +28 -28
  10. package/cli/fragments/ops-backlog/jira.md +28 -28
  11. package/cli/fragments/ops-review/az.md +62 -62
  12. package/cli/fragments/ops-review/gh.md +51 -51
  13. package/cli/fragments/ops-review/gl.md +55 -55
  14. package/cli/fragments/ops-ship/gh.md +67 -67
  15. package/cli/fragments/ops-ship/gl.md +84 -84
  16. package/cli/index.js +116 -116
  17. package/cli/presets/clean.json +21 -21
  18. package/cli/presets/models.json +68 -68
  19. package/cli/presets/optimization.json +32 -32
  20. package/cli/presets/platforms.json +76 -76
  21. package/cli/presets/source.json +23 -23
  22. package/cli/steps/clean/index.js +120 -120
  23. package/cli/steps/copy/agents.js +120 -120
  24. package/cli/steps/copy/fullstack-engineer.js +89 -89
  25. package/cli/steps/copy/opencode-json.js +324 -324
  26. package/cli/steps/copy/skills.js +316 -316
  27. package/cli/steps/models/format.js +88 -88
  28. package/cli/steps/models/index.js +64 -64
  29. package/cli/steps/openspec/index.js +136 -136
  30. package/cli/steps/optimization/codegraph.js +141 -141
  31. package/cli/steps/optimization/detect.js +66 -66
  32. package/cli/steps/optimization/humanizer.js +17 -17
  33. package/cli/steps/optimization/index.js +158 -158
  34. package/cli/steps/optimization/memory.js +91 -91
  35. package/cli/steps/optimization/patch-guardrails.js +111 -111
  36. package/cli/steps/optimization/simple-english.js +17 -17
  37. package/cli/steps/optimization/skills-lock.js +30 -30
  38. package/cli/steps/platform/index.js +109 -109
  39. package/cli/steps/source/index.js +123 -123
  40. package/cli/utils/agent-color.js +111 -111
  41. package/cli/utils/copy.js +134 -134
  42. package/cli/utils/exec-spinner.js +47 -47
  43. package/cli/utils/exec.js +134 -134
  44. package/cli/utils/legacy-check.js +30 -30
  45. package/cli/utils/models-cache.js +58 -58
  46. package/cli/utils/models-pricing.js +42 -42
  47. package/cli/utils/paths.js +81 -80
  48. package/cli/utils/process.js +3 -3
  49. package/cli/utils/terminal.js +6 -6
  50. package/cli/utils/update-manifest.js +75 -75
  51. package/harness/.opencode/_gitignore +10 -9
  52. package/harness/.opencode/commands/ops-backlog.md +10 -10
  53. package/harness/.opencode/commands/ops-review.md +10 -8
  54. package/harness/.opencode/commands/ops-ship.md +9 -9
  55. package/harness/.opencode/commands/plan-archive.md +7 -5
  56. package/harness/.opencode/commands/plan-explore.md +11 -9
  57. package/harness/.opencode/commands/plan-propose.md +11 -9
  58. package/harness/.opencode/commands/plan-quick.md +7 -5
  59. package/harness/.opencode/commands/plan-story.md +11 -9
  60. package/harness/.opencode/commands/repo-audit.md +7 -5
  61. package/harness/.opencode/commands/repo-help.md +5 -5
  62. package/harness/.opencode/package.json +5 -5
  63. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  64. package/harness/.opencode/plugins/pc-subagent-tiers.js +367 -354
  65. package/harness/.opencode/plugins/pc-system-reminders.js +386 -386
  66. package/harness/.opencode/scripts/check-diff.mjs +244 -244
  67. package/harness/.opencode/scripts/code-rules.mjs +288 -288
  68. package/harness/ARCHITECTURE.md +13 -13
  69. package/harness/DESIGN.md +13 -13
  70. package/harness/opencode.jsonc +36 -36
  71. package/harness/openspec/config.yaml +20 -20
  72. package/harness/skills-lock.json +17 -17
  73. package/package.json +12 -14
  74. package/skills/agent-harness-cli/SKILL.md +86 -86
  75. package/skills/pc-guardrails-generic/SKILL.md +53 -53
  76. package/skills/pc-guardrails-project/SKILL.md +8 -8
  77. package/skills/pc-make-architecture/structure-template.md +64 -64
  78. package/skills/pc-make-engineer/SKILL.md +59 -59
  79. package/skills/pc-make-engineer/template.md +36 -36
  80. package/skills/pc-make-guardrails/category-reference.md +112 -112
  81. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  82. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  83. package/skills/pc-ops-ship/SKILL.md +22 -22
  84. package/skills/pc-plan-apply/SKILL.md +86 -86
  85. package/skills/pc-plan-apply/simple-mode.md +21 -21
  86. package/skills/pc-plan-explore/SKILL.md +21 -21
  87. package/skills/pc-plan-goal/SKILL.md +91 -91
  88. package/skills/pc-plan-goal/failure-policy.md +30 -30
  89. package/skills/pc-plan-goal/output-mode.md +10 -10
  90. package/skills/pc-plan-propose/SKILL.md +125 -125
  91. package/skills/pc-plan-propose/task-annotation.md +39 -39
  92. package/skills/pc-plan-quick/SKILL.md +46 -46
  93. package/skills/pc-repo-audit/SKILL.md +44 -44
  94. package/skills/pc-repo-help/SKILL.md +87 -87
  95. package/skills/pc-repo-verify/SKILL.md +150 -150
@@ -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,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 -->
@@ -1,86 +1,86 @@
1
- ---
2
- name: pc-plan-apply
3
- description: Implement tasks from a plan. OpenSpec-annotated tasks (from pc-plan-propose) run as parallel subagent waves; Todo pane tasks (from /plan-quick) run sequentially in-session. Load when implementing a prepared plan. Invoked by the /plan-apply command (interactive) and the plan-goal pipeline (autonomous).
4
- license: MIT
5
- ---
6
-
7
- # Plan Apply
8
-
9
- ## Input
10
-
11
- The caller provides (all optional):
12
- - A mode (see below). Default: `interactive`.
13
- - A `start_from` hint: `branch` (default, full protocol from step 1) or `load-plan` (the caller already created the feature branch; skip step 1).
14
-
15
- ## Modes
16
-
17
- - `interactive` (default): report progress to the user and surface failures for their decision.
18
- - `autonomous`: there is no user to return to between waves. Loop until every task is DONE, or until the progress guard or the retry limit trips, then report to the caller, whose failure policy governs. APPLY completes by handing control back to `/plan-goal`, which has four phases left to run: `N/N tasks` is this stage's boundary, not the pipeline's.
19
-
20
- ## Plan source detection
21
-
22
- 1. Check if an OpenSpec change exists: inspect `openspec/changes/` for an active change folder with a `tasks.md`.
23
- 2. If found and tasks have `<!-- agent` annotations (written by `pc-plan-propose`): OpenSpec mode. Follow the protocol below. Annotated tasks run in subagent waves. They never become sequential lead work because the task count seems small, the lead prefers direct implementation, or a worker has not yet been inspected.
24
- 3. If no OpenSpec change exists, but there are `pending` items in the Todo pane (from `/plan-quick`): Simple mode. Follow the [simple mode](simple-mode.md) reference.
25
-
26
- ## OpenSpec mode: parallel subagent waves
27
-
28
- Load `@openspec-apply-change` for change selection, status, and closing. Its own implement step does not apply here: annotated tasks are implemented only by spawning the annotated tier worker, and the lead never implements. Take that step from the protocol below instead.
29
-
30
- Referring to it by number would break silently. `@openspec-apply-change` is installed by `openspec init --force` with no version pinned, so an inserted step upstream renumbers the one being replaced, and the sequential default would then run alongside these waves.
31
-
32
- **Implement via native subagent waves.**
33
-
34
- You are the lead. You orchestrate from this session only; you spawn workers with the native `task` tool. Workers are ephemeral (one batch, then they exit) and navigable (`ctrl+x` arrow down, left/right arrows). There is no board, no claiming, no merging, no external dashboard.
35
-
36
- Core rule: push, don't pull. A worker is born with its work: every `task()` spawn prompt contains the exact task IDs and text it must do. There is no claim step, so a worker can never sit idle waiting for an assignment.
37
-
38
- **1. Branch.** Create `feature/{change-slug}` if not already on one. (Skip this step when the caller passed `start_from: load-plan`.)
39
-
40
- **2. Load the plan and workers.** Parse `tasks.md`. Each task carries `<!-- agent, depends_on, touches -->` (from `pc-plan-propose`). Inspect `.opencode/agents/` for each base engineer and its generated `.<tier>.md` variants. The tier-suffixed name in an annotation (for example, `backend-engineer.build`) is the worker to spawn: `pc-subagent-tiers` resolves its model at startup and registers it as `mode: subagent`. Read `.opencode/harness.json` -> `agents.maxConcurrent` (the wave cap, 1 to 5, enforced by `pc-subagent-monitor`).
41
-
42
- Before hydrating the Todo board, resolve every task's annotated worker. If any task has a blank agent annotation, its base template is missing, or its tier variant is unavailable, stop the APPLY stage and report the task ID, expected worker, and missing file. Do not replace the worker with `fullstack-engineer`, `general`, or the lead session.
43
-
44
- **3. Hydrate the Todo board.** `todowrite` one item per task: `pending`. The Todo pane is the visible subagent board (opencode plugins cannot draw a custom pane, so the native Todo widget is the live UI). While a task is in flight, its label must carry the worker: `<agent> · <model>`: so the pane shows which agent on which model is doing what. The Todo list is a projection only: never read it for recovery; rebuild it from `tasks.md` and git and `.opencode/harness-run.json`.
45
-
46
- **4. Worker context.** Before each wave, derive file-disjointness from `touches:` globs and `git diff`.
47
-
48
- <!-- PC-OPTIMIZATION-CODEGRAPH-START -->
49
- <!-- PC-OPTIMIZATION-CODEGRAPH-END -->
50
-
51
- <!-- PC-OPTIMIZATION-MEMORY-START -->
52
- <!-- PC-OPTIMIZATION-MEMORY-END -->
53
-
54
- **5. The wave loop.** Repeat until no tasks remain:
55
-
56
- ```
57
- eligible = unchecked tasks whose every depends_on is DONE (committed/checked)
58
- if eligible is empty but tasks remain -> STALL: report blocked tasks + the failed
59
- dependency causing it, then STOP.
60
- groups = pack eligible tasks that share a file (touches and gathered context)
61
- into ONE worker each, to run sequentially (the worker uses the task's `agent`)
62
- wave = pick groups whose file-sets are pairwise DISJOINT, capped at maxConcurrentAgents
63
- (opencode runs every task() you emit at once; a spawn past the cap
64
- is denied, and a denied spawn is not a failed group: re-issue it)
65
- ```
66
-
67
- **6. Context per group.** For each group, gather the task text, relevant plan decisions, and source context needed to implement it.
68
-
69
- **7. Spawn the wave: one assistant turn, multiple `task()` calls (they run in parallel).** For each group:
70
- - `subagent_type` = the task's `agent` exactly as written in `tasks.md` (e.g. `frontend-engineer.build`, `backend-engineer.fast`). It is the tier-suffixed `mode: subagent` worker created by `pc-subagent-tiers`. Worker resolution happened in step 2; a missing worker stops the stage before spawning. `fullstack-engineer`, `general`, and the lead session are not fallbacks for annotated implementation work.
71
- - `description` = `"<task-ids>: <short label>"` (e.g. `"2.1,2.2: RPC endpoints"`) so the subagent is legible in the left/right list and the monitor.
72
- - `prompt` must contain the exact task IDs and text plus the gathered context. The worker follows the Engineer workflow defined in `@pc-guardrails-generic`; do not restate it in the prompt. **Worker output discipline:** instruct each worker to return a compact summary: what it changed (file names, not contents), pass/fail status of any verification it ran, and any blockers. Workers must NOT return file contents or full diffs as their result — the lead can `git diff` if needed.
73
- - Flip each spawned task's Todo item to `in_progress` and prefix its label with `<agent>: ` (e.g. `frontend-engineer.build: 2.1 Consolidate logic`) so the running worker is visible in the Todo pane. On completion, drop the prefix and mark `completed`.
74
-
75
- **8. Collect the wave.** Each foreground `task()` returns its result to you. For each group:
76
- - success: `git add` the group's `touches` paths and commit `"{ids}: {summary}"` in a single tool call (`git add <paths> && git commit -m "..."`); mark its Todo items `completed`; check `[x]` in `tasks.md`.
77
- - error / empty: revert that group's impact: `git checkout -- <tracked paths> && git clean -f -- <paths>` (one tool call). Mark `failed` and record the reason in `tasks.md`; `.opencode/harness-run.json` is owned by the monitor plugin. Then retry once with a shorter prompt. Still failing: leave failed and surface it; do not loop.
78
- - A failed group only blocks its dependents; unrelated tasks keep flowing.
79
-
80
- **9. Progress guard.** If a full wave moved zero tasks to DONE: STOP (do not re-spawn the identical failing set). Otherwise recompute `eligible` and loop to step 5.
81
-
82
- **10. Verify.** In this (lead) session, run the project's verification (`pnpm verify` when package.json defines it, otherwise its lint, typecheck, test and build), the proposal-required validation commands, then `node .opencode/scripts/check-diff.mjs`. Every command must exit 0. Anything changed to satisfy `check-diff` is a change: run the whole verification again afterwards, so the last run is on the tree you ship. Never delete a test that covers a branch the change added to fit the test budget; a complexity or coverage gate in CI measures it. A `check-diff` failure lists file, line and fix: reopen the tasks that own those files. On failure, reopen the offending tasks (uncheck, mark failed) so they re-enter `eligible` and run another wave. When every task is checked, no eligible task remains, and every command passes, report `VERIFIED` to the caller.
83
-
84
- **11. Close.** Mark all `tasks.md` checkboxes, run `openspec status --change "<name>" --json`, and report progress (N/M tasks). The wave state in `.opencode/harness-run.json` persists for resume.
85
-
86
- Resume: re-loading this skill after any crash recomputes DONE / FAILED / eligible from `tasks.md`, git, and `harness-run.json` and continues. State is on disk, not in this conversation.
1
+ ---
2
+ name: pc-plan-apply
3
+ description: Implement tasks from a plan. OpenSpec-annotated tasks (from pc-plan-propose) run as parallel subagent waves; Todo pane tasks (from /plan-quick) run sequentially in-session. Load when implementing a prepared plan. Invoked by the /plan-apply command (interactive) and the plan-goal pipeline (autonomous).
4
+ license: MIT
5
+ ---
6
+
7
+ # Plan Apply
8
+
9
+ ## Input
10
+
11
+ The caller provides (all optional):
12
+ - A mode (see below). Default: `interactive`.
13
+ - A `start_from` hint: `branch` (default, full protocol from step 1) or `load-plan` (the caller already created the feature branch; skip step 1).
14
+
15
+ ## Modes
16
+
17
+ - `interactive` (default): report progress to the user and surface failures for their decision.
18
+ - `autonomous`: there is no user to return to between waves. Loop until every task is DONE, or until the progress guard or the retry limit trips, then report to the caller, whose failure policy governs. APPLY completes by handing control back to `/plan-goal`, which has four phases left to run: `N/N tasks` is this stage's boundary, not the pipeline's.
19
+
20
+ ## Plan source detection
21
+
22
+ 1. Check if an OpenSpec change exists: inspect `openspec/changes/` for an active change folder with a `tasks.md`.
23
+ 2. If found and tasks have `<!-- agent` annotations (written by `pc-plan-propose`): OpenSpec mode. Follow the protocol below. Annotated tasks run in subagent waves. They never become sequential lead work because the task count seems small, the lead prefers direct implementation, or a worker has not yet been inspected.
24
+ 3. If no OpenSpec change exists, but there are `pending` items in the Todo pane (from `/plan-quick`): Simple mode. Follow the [simple mode](simple-mode.md) reference.
25
+
26
+ ## OpenSpec mode: parallel subagent waves
27
+
28
+ Load `@openspec-apply-change` for change selection, status, and closing. Its own implement step does not apply here: annotated tasks are implemented only by spawning the annotated tier worker, and the lead never implements. Take that step from the protocol below instead.
29
+
30
+ Referring to it by number would break silently. `@openspec-apply-change` is installed by `openspec init --force` with no version pinned, so an inserted step upstream renumbers the one being replaced, and the sequential default would then run alongside these waves.
31
+
32
+ **Implement via native subagent waves.**
33
+
34
+ You are the lead. You orchestrate from this session only; you spawn workers with the native `task` tool. Workers are ephemeral (one batch, then they exit) and navigable (`ctrl+x` arrow down, left/right arrows). There is no board, no claiming, no merging, no external dashboard.
35
+
36
+ Core rule: push, don't pull. A worker is born with its work: every `task()` spawn prompt contains the exact task IDs and text it must do. There is no claim step, so a worker can never sit idle waiting for an assignment.
37
+
38
+ **1. Branch.** Create `feature/{change-slug}` if not already on one. (Skip this step when the caller passed `start_from: load-plan`.)
39
+
40
+ **2. Load the plan and workers.** Parse `tasks.md`. Each task carries `<!-- agent, depends_on, touches -->` (from `pc-plan-propose`). Inspect `.opencode/agents/` for each base engineer and its generated `.<tier>.md` variants. The tier-suffixed name in an annotation (for example, `backend-engineer.build`) is the worker to spawn: `pc-subagent-tiers` resolves its model at startup and registers it as `mode: subagent`. Read `.opencode/harness.json` -> `agents.maxConcurrent` (the wave cap, 1 to 5, enforced by `pc-subagent-monitor`).
41
+
42
+ Before hydrating the Todo board, resolve every task's annotated worker. If any task has a blank agent annotation, its base template is missing, or its tier variant is unavailable, stop the APPLY stage and report the task ID, expected worker, and missing file. Do not replace the worker with `fullstack-engineer`, `general`, or the lead session.
43
+
44
+ **3. Hydrate the Todo board.** `todowrite` one item per task: `pending`. The Todo pane is the visible subagent board (opencode plugins cannot draw a custom pane, so the native Todo widget is the live UI). While a task is in flight, its label must carry the worker: `<agent> · <model>`: so the pane shows which agent on which model is doing what. The Todo list is a projection only: never read it for recovery; rebuild it from `tasks.md` and git and `.opencode/harness-run.json`.
45
+
46
+ **4. Worker context.** Before each wave, derive file-disjointness from `touches:` globs and `git diff`.
47
+
48
+ <!-- PC-OPTIMIZATION-CODEGRAPH-START -->
49
+ <!-- PC-OPTIMIZATION-CODEGRAPH-END -->
50
+
51
+ <!-- PC-OPTIMIZATION-MEMORY-START -->
52
+ <!-- PC-OPTIMIZATION-MEMORY-END -->
53
+
54
+ **5. The wave loop.** Repeat until no tasks remain:
55
+
56
+ ```
57
+ eligible = unchecked tasks whose every depends_on is DONE (committed/checked)
58
+ if eligible is empty but tasks remain -> STALL: report blocked tasks + the failed
59
+ dependency causing it, then STOP.
60
+ groups = pack eligible tasks that share a file (touches and gathered context)
61
+ into ONE worker each, to run sequentially (the worker uses the task's `agent`)
62
+ wave = pick groups whose file-sets are pairwise DISJOINT, capped at maxConcurrentAgents
63
+ (opencode runs every task() you emit at once; a spawn past the cap
64
+ is denied, and a denied spawn is not a failed group: re-issue it)
65
+ ```
66
+
67
+ **6. Context per group.** For each group, gather the task text, relevant plan decisions, and source context needed to implement it.
68
+
69
+ **7. Spawn the wave: one assistant turn, multiple `task()` calls (they run in parallel).** For each group:
70
+ - `subagent_type` = the task's `agent` exactly as written in `tasks.md` (e.g. `frontend-engineer.build`, `backend-engineer.fast`). It is the tier-suffixed `mode: subagent` worker created by `pc-subagent-tiers`. Worker resolution happened in step 2; a missing worker stops the stage before spawning. `fullstack-engineer`, `general`, and the lead session are not fallbacks for annotated implementation work.
71
+ - `description` = `"<task-ids>: <short label>"` (e.g. `"2.1,2.2: RPC endpoints"`) so the subagent is legible in the left/right list and the monitor.
72
+ - `prompt` must contain the exact task IDs and text plus the gathered context. The worker follows the Engineer workflow defined in `@pc-guardrails-generic`; do not restate it in the prompt. **Worker output discipline:** instruct each worker to return a compact summary: what it changed (file names, not contents), pass/fail status of any verification it ran, and any blockers. Workers must NOT return file contents or full diffs as their result — the lead can `git diff` if needed.
73
+ - Flip each spawned task's Todo item to `in_progress` and prefix its label with `<agent>: ` (e.g. `frontend-engineer.build: 2.1 Consolidate logic`) so the running worker is visible in the Todo pane. On completion, drop the prefix and mark `completed`.
74
+
75
+ **8. Collect the wave.** Each foreground `task()` returns its result to you. For each group:
76
+ - success: `git add` the group's `touches` paths and commit `"{ids}: {summary}"` in a single tool call (`git add <paths> && git commit -m "..."`); mark its Todo items `completed`; check `[x]` in `tasks.md`.
77
+ - error / empty: revert that group's impact: `git checkout -- <tracked paths> && git clean -f -- <paths>` (one tool call). Mark `failed` and record the reason in `tasks.md`; `.opencode/harness-run.json` is owned by the monitor plugin. Then retry once with a shorter prompt. Still failing: leave failed and surface it; do not loop.
78
+ - A failed group only blocks its dependents; unrelated tasks keep flowing.
79
+
80
+ **9. Progress guard.** If a full wave moved zero tasks to DONE: STOP (do not re-spawn the identical failing set). Otherwise recompute `eligible` and loop to step 5.
81
+
82
+ **10. Verify.** In this (lead) session, run the project's verification (`pnpm verify` when package.json defines it, otherwise its lint, typecheck, test and build), the proposal-required validation commands, then `node .opencode/scripts/check-diff.mjs`. Every command must exit 0. Anything changed to satisfy `check-diff` is a change: run the whole verification again afterwards, so the last run is on the tree you ship. Never delete a test that covers a branch the change added to fit the test budget; a complexity or coverage gate in CI measures it. A `check-diff` failure lists file, line and fix: reopen the tasks that own those files. On failure, reopen the offending tasks (uncheck, mark failed) so they re-enter `eligible` and run another wave. When every task is checked, no eligible task remains, and every command passes, report `VERIFIED` to the caller.
83
+
84
+ **11. Close.** Mark all `tasks.md` checkboxes, run `openspec status --change "<name>" --json`, and report progress (N/M tasks). The wave state in `.opencode/harness-run.json` persists for resume.
85
+
86
+ Resume: re-loading this skill after any crash recomputes DONE / FAILED / eligible from `tasks.md`, git, and `harness-run.json` and continues. State is on disk, not in this conversation.
@@ -1,21 +1,21 @@
1
- # Simple mode: sequential in-session
2
-
3
- When the plan lives in the Todo pane (from `/plan-quick`) and no OpenSpec change exists:
4
-
5
- 1. Read the task list from the Todo pane (the `pending` items created by `/plan-quick`).
6
- 2. Create a feature branch if not already on one: `git switch -c feature/{slug}`. (Skip when the caller passed `start_from: load-plan`.)
7
- 3. Work through tasks one at a time, in order, directly in this session:
8
- - Read the task text from the Todo item.
9
- - Mark it `in_progress` via `todowrite`.
10
- - Implement it (edit files, run commands as needed).
11
- - Mark it `completed` via `todowrite`.
12
- - Commit the change: `git add <the paths this task wrote> && git commit -m "task {id}: {summary}"`. Unscoped staging is denied (`pc-system-reminders`).
13
- 4. After all tasks are done, run the project's verification (`pnpm verify` when package.json defines it, otherwise its typecheck/build check), then `node .opencode/scripts/check-diff.mjs`. Fix any errors until both exit 0. Anything changed to satisfy `check-diff` is a change: run the whole verification again afterwards, so the last run is on the tree you ship. Never delete a test that covers a branch the change added to fit the test budget; a complexity or coverage gate in CI measures it.
14
- 5. Report: tasks N/N completed, commits made, branch name.
15
-
16
- Rules:
17
- - Work in this session only. No subagent spawning.
18
- - No OpenSpec commands.
19
- - Keep each commit focused on one task.
20
- - Use `todowrite` to track progress: `pending` -> `in_progress` -> `completed`.
21
- - Never mark a task `completed` that you did not finish. Use `cancelled` with the reason and continue with the next; a false green is invisible to whoever reads the report.
1
+ # Simple mode: sequential in-session
2
+
3
+ When the plan lives in the Todo pane (from `/plan-quick`) and no OpenSpec change exists:
4
+
5
+ 1. Read the task list from the Todo pane (the `pending` items created by `/plan-quick`).
6
+ 2. Create a feature branch if not already on one: `git switch -c feature/{slug}`. (Skip when the caller passed `start_from: load-plan`.)
7
+ 3. Work through tasks one at a time, in order, directly in this session:
8
+ - Read the task text from the Todo item.
9
+ - Mark it `in_progress` via `todowrite`.
10
+ - Implement it (edit files, run commands as needed).
11
+ - Mark it `completed` via `todowrite`.
12
+ - Commit the change: `git add <the paths this task wrote> && git commit -m "task {id}: {summary}"`. Unscoped staging is denied (`pc-system-reminders`).
13
+ 4. After all tasks are done, run the project's verification (`pnpm verify` when package.json defines it, otherwise its typecheck/build check), then `node .opencode/scripts/check-diff.mjs`. Fix any errors until both exit 0. Anything changed to satisfy `check-diff` is a change: run the whole verification again afterwards, so the last run is on the tree you ship. Never delete a test that covers a branch the change added to fit the test budget; a complexity or coverage gate in CI measures it.
14
+ 5. Report: tasks N/N completed, commits made, branch name.
15
+
16
+ Rules:
17
+ - Work in this session only. No subagent spawning.
18
+ - No OpenSpec commands.
19
+ - Keep each commit focused on one task.
20
+ - Use `todowrite` to track progress: `pending` -> `in_progress` -> `completed`.
21
+ - Never mark a task `completed` that you did not finish. Use `cancelled` with the reason and continue with the next; a false green is invisible to whoever reads the report.
@@ -1,21 +1,21 @@
1
- ---
2
- name: pc-plan-explore
3
- description: Explore an idea or requirement before planning. Invoked by the /plan-explore command.
4
- license: MIT
5
- ---
6
-
7
- Explore, then hand back what you learned. `@openspec-explore` supplies the stance; this skill adds one prohibition and one handoff.
8
-
9
- ## Rules
10
-
11
- - Never write, edit, or create a file while this skill is loaded, OpenSpec artifacts included. This overrides `@openspec-explore`, which says creating them is "fine". Reading, searching, and discussing are the whole job.
12
- - If the conversation turns toward implementation, say explore mode is active and point at `/plan-apply`.
13
-
14
- Load `@openspec-explore` for the approach.
15
-
16
- ## Autonomous handoff
17
-
18
- When a caller loads this skill in autonomous mode, return `EXPLORATION_BRIEF` in memory rather than writing a file. It holds: the problem in one or two sentences, the affected paths, the approach chosen, the risks worth knowing, and anything deliberately out of scope. `pc-plan-goal` requires it before its propose phase.
19
-
20
- <!-- PC-OPTIMIZATION-MEMORY-START -->
21
- <!-- PC-OPTIMIZATION-MEMORY-END -->
1
+ ---
2
+ name: pc-plan-explore
3
+ description: Explore an idea or requirement before planning. Invoked by the /plan-explore command.
4
+ license: MIT
5
+ ---
6
+
7
+ Explore, then hand back what you learned. `@openspec-explore` supplies the stance; this skill adds one prohibition and one handoff.
8
+
9
+ ## Rules
10
+
11
+ - Never write, edit, or create a file while this skill is loaded, OpenSpec artifacts included. This overrides `@openspec-explore`, which says creating them is "fine". Reading, searching, and discussing are the whole job.
12
+ - If the conversation turns toward implementation, say explore mode is active and point at `/plan-apply`.
13
+
14
+ Load `@openspec-explore` for the approach.
15
+
16
+ ## Autonomous handoff
17
+
18
+ When a caller loads this skill in autonomous mode, return `EXPLORATION_BRIEF` in memory rather than writing a file. It holds: the problem in one or two sentences, the affected paths, the approach chosen, the risks worth knowing, and anything deliberately out of scope. `pc-plan-goal` requires it before its propose phase.
19
+
20
+ <!-- PC-OPTIMIZATION-MEMORY-START -->
21
+ <!-- PC-OPTIMIZATION-MEMORY-END -->