@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,127 +1,127 @@
1
- ---
2
- name: pc-ops-evidence
3
- description: Writes a capturePlan in evidence.json for the Visual Evidence CI workflow to execute on a runner with Docker and Chrome access. Load after a change is implemented. Invoked by /ops-evidence and the plan-goal pipeline.
4
- license: MIT
5
- ---
6
-
7
- # Ops Evidence
8
-
9
- Write a capture plan so the Visual Evidence CI workflow can capture screenshots on a runner with full Docker and Chrome access.
10
-
11
- The agent runs inside the awf sandbox where Docker-in-Docker is unsupported and headless Chromium's sandbox is blocked by the container security policy. The agent cannot capture screenshots itself. Instead, it analyzes the diff and writes a `capturePlan` in `evidence.json`. A separate CI workflow executes the plan.
12
-
13
- ## Convention
14
-
15
- Every platform project has `pnpm run dev` at root that starts the **full stack** (database + API + web). The app runs with mock auth in development mode (no real authentication needed). This is the only contract — no per-project evidence harness, fixture apps, or scenario registries.
16
-
17
- ## Input
18
-
19
- The caller provides (all optional):
20
- - change id: locates `openspec/changes/{change-id}/` (or the archived `archive/*{change-id}/`).
21
- - issue / work-item ref and PR number: where to publish.
22
- - output mode (`default` / `push` / `pr`): whether the branch was pushed.
23
- - operation: `capture` (default), `publish`, or `both`.
24
-
25
- ## Part 1: Capture (operation: capture / both)
26
-
27
- **Step 1: Decide whether evidence is required.** Inspect the change's diff:
28
- - Required when changed files include user-visible UI: `*.tsx/jsx/vue/svelte`, `*.css/scss/less`, pages, layouts, components, navigation.
29
- - Skipped when docs-only, internal refactor, dependency-only, test-only, backend-only.
30
- - Mixed or unknown: required (be safe).
31
-
32
- If skipped: write `evidence.json` with `status: "skipped"` and reason. Done.
33
-
34
- **Step 2: Discover routes from git diff.** Parse changed files to determine which routes to screenshot:
35
- - `pages/**/*.tsx` or `app/**/page.tsx` → extract the route path
36
- - `features/**/*.tsx` or `components/**/*.tsx` → screenshot the homepage and any routes that import the changed component
37
- - If no routes found → screenshot `/` only
38
- - Always include `/` (homepage) as a baseline
39
-
40
- **Step 3: Write `evidence.json` with `capturePlan`.** The agent never attempts to start the app stack or launch a browser — those always fail inside the awf sandbox. Instead, write a `capturePlan` immediately.
41
-
42
- ### The `capturePlan` schema
43
-
44
- ```
45
- capturePlan:
46
- routes: # Array of route objects to screenshot (at minimum [{ path: "/" }])
47
- - path: string # URL path, e.g. "/quotes/:id"
48
- sampleId: # string | "first" | "any" — how to resolve dynamic segments
49
- caption: # string — human-readable description of what this screenshot shows
50
- viewports: # Array of viewport objects
51
- - width: number
52
- height: number
53
- label: string # "desktop" | "mobile" | custom
54
- requireApi: # boolean — true when the route needs the backend API running
55
- requireLogin: # boolean — true when the route needs authentication
56
- loginMethod: # string — "mock-sso" | "none" | custom method identifier
57
- reason: # string — why evidence was blocked and what the screenshots should show
58
- ```
59
-
60
- ### Rules for writing capturePlan
61
-
62
- 1. `routes` MUST always include `{ path: "/", caption: "Homepage" }` as the first entry.
63
- 2. Every additional route discovered from the diff goes after the homepage entry.
64
- 3. `sampleId: "first"` means the CI workflow should use the first record returned by the API (e.g. the first quote from the seed data). `sampleId: "any"` means any valid ID.
65
- 4. `requireApi` is `true` when any route needs the backend to return data. It is `false` only for purely static pages (login, not-found).
66
- 5. `requireLogin` is `true` when any route needs authentication. For dev mode with mock auth, `loginMethod` is `"mock-sso"`.
67
- 6. `reason` should explain both WHY capture was blocked and WHAT the screenshots should show once captured.
68
-
69
- ### Example `evidence.json`
70
-
71
- ```json
72
- {
73
- "version": 1,
74
- "changeId": "currency-in-project-details",
75
- "required": true,
76
- "status": "blocked",
77
- "assets": [],
78
- "capturePlan": {
79
- "routes": [
80
- { "path": "/", "sampleId": "any", "caption": "Homepage / accounts list" },
81
- { "path": "/quotes/:id", "sampleId": "first", "caption": "Quote editor with currency selector in ProjectDetailsCard" }
82
- ],
83
- "viewports": [
84
- { "width": 1280, "height": 720, "label": "desktop" },
85
- { "width": 375, "height": 667, "label": "mobile" }
86
- ],
87
- "requireApi": true,
88
- "requireLogin": true,
89
- "loginMethod": "mock-sso",
90
- "reason": "Currency selector moved from editor body into ProjectDetailsCard; visual change in quote editor page."
91
- },
92
- "reason": "Visual evidence cannot be captured inside the awf sandbox (Docker-in-Docker unsupported, headless Chromium sandbox blocked). A capturePlan has been written for the Visual Evidence CI workflow.",
93
- "prMarkdown": "## Evidence\n\nVisual evidence for this change is **blocked** in this agent run. A `capturePlan` has been written to `evidence.json` — the Visual Evidence CI workflow will execute it on a runner with full Docker and Chrome access.\n\nAutomated verification that did run:\n- Lint: clean\n- Tests: all pass\n- Build: success"
94
- }
95
- ```
96
-
97
- ### When evidence is not required
98
-
99
- If evidence is skipped (no UI files changed), write without a `capturePlan`:
100
-
101
- ```json
102
- {
103
- "version": 1,
104
- "changeId": "{change-id}",
105
- "required": false,
106
- "status": "skipped",
107
- "assets": [],
108
- "reason": "No user-visible UI files changed in this PR.",
109
- "prMarkdown": "## Evidence\n\nSkipped: no user-visible UI changes."
110
- }
111
- ```
112
-
113
- Capture never commits, stages, or pushes. The caller owns git.
114
-
115
- ## Part 2: Publish (operation: publish / both)
116
-
117
- Preconditions:
118
- - An issue/PR number was provided. Else skip.
119
- - Image URLs resolve only if the branch was pushed (`pr`/`push` modes).
120
- - Backlog platform from `.opencode/harness.json`; `none` means skip.
121
-
122
- <!-- PC-PLATFORM-EVIDENCE-START -->
123
- <!-- PC-PLATFORM-EVIDENCE-END -->
124
-
125
- ## Report
126
-
127
- One block: the `status` (passed/skipped/failed/blocked) and why; capturePlan written or why not. Never present a blocked capture as passed.
1
+ ---
2
+ name: pc-ops-evidence
3
+ description: Writes a capturePlan in evidence.json for the Visual Evidence CI workflow to execute on a runner with Docker and Chrome access. Load after a change is implemented. Invoked by /ops-evidence and the plan-goal pipeline.
4
+ license: MIT
5
+ ---
6
+
7
+ # Ops Evidence
8
+
9
+ Write a capture plan so the Visual Evidence CI workflow can capture screenshots on a runner with full Docker and Chrome access.
10
+
11
+ The agent runs inside the awf sandbox where Docker-in-Docker is unsupported and headless Chromium's sandbox is blocked by the container security policy. The agent cannot capture screenshots itself. Instead, it analyzes the diff and writes a `capturePlan` in `evidence.json`. A separate CI workflow executes the plan.
12
+
13
+ ## Convention
14
+
15
+ Every platform project has `pnpm run dev` at root that starts the **full stack** (database + API + web). The app runs with mock auth in development mode (no real authentication needed). This is the only contract — no per-project evidence harness, fixture apps, or scenario registries.
16
+
17
+ ## Input
18
+
19
+ The caller provides (all optional):
20
+ - change id: locates `openspec/changes/{change-id}/` (or the archived `archive/*{change-id}/`).
21
+ - issue / work-item ref and PR number: where to publish.
22
+ - output mode (`default` / `push` / `pr`): whether the branch was pushed.
23
+ - operation: `capture` (default), `publish`, or `both`.
24
+
25
+ ## Part 1: Capture (operation: capture / both)
26
+
27
+ **Step 1: Decide whether evidence is required.** Inspect the change's diff:
28
+ - Required when changed files include user-visible UI: `*.tsx/jsx/vue/svelte`, `*.css/scss/less`, pages, layouts, components, navigation.
29
+ - Skipped when docs-only, internal refactor, dependency-only, test-only, backend-only.
30
+ - Mixed or unknown: required (be safe).
31
+
32
+ If skipped: write `evidence.json` with `status: "skipped"` and reason. Done.
33
+
34
+ **Step 2: Discover routes from git diff.** Parse changed files to determine which routes to screenshot:
35
+ - `pages/**/*.tsx` or `app/**/page.tsx` → extract the route path
36
+ - `features/**/*.tsx` or `components/**/*.tsx` → screenshot the homepage and any routes that import the changed component
37
+ - If no routes found → screenshot `/` only
38
+ - Always include `/` (homepage) as a baseline
39
+
40
+ **Step 3: Write `evidence.json` with `capturePlan`.** The agent never attempts to start the app stack or launch a browser — those always fail inside the awf sandbox. Instead, write a `capturePlan` immediately.
41
+
42
+ ### The `capturePlan` schema
43
+
44
+ ```
45
+ capturePlan:
46
+ routes: # Array of route objects to screenshot (at minimum [{ path: "/" }])
47
+ - path: string # URL path, e.g. "/quotes/:id"
48
+ sampleId: # string | "first" | "any" — how to resolve dynamic segments
49
+ caption: # string — human-readable description of what this screenshot shows
50
+ viewports: # Array of viewport objects
51
+ - width: number
52
+ height: number
53
+ label: string # "desktop" | "mobile" | custom
54
+ requireApi: # boolean — true when the route needs the backend API running
55
+ requireLogin: # boolean — true when the route needs authentication
56
+ loginMethod: # string — "mock-sso" | "none" | custom method identifier
57
+ reason: # string — why evidence was blocked and what the screenshots should show
58
+ ```
59
+
60
+ ### Rules for writing capturePlan
61
+
62
+ 1. `routes` MUST always include `{ path: "/", caption: "Homepage" }` as the first entry.
63
+ 2. Every additional route discovered from the diff goes after the homepage entry.
64
+ 3. `sampleId: "first"` means the CI workflow should use the first record returned by the API (e.g. the first quote from the seed data). `sampleId: "any"` means any valid ID.
65
+ 4. `requireApi` is `true` when any route needs the backend to return data. It is `false` only for purely static pages (login, not-found).
66
+ 5. `requireLogin` is `true` when any route needs authentication. For dev mode with mock auth, `loginMethod` is `"mock-sso"`.
67
+ 6. `reason` should explain both WHY capture was blocked and WHAT the screenshots should show once captured.
68
+
69
+ ### Example `evidence.json`
70
+
71
+ ```json
72
+ {
73
+ "version": 1,
74
+ "changeId": "currency-in-project-details",
75
+ "required": true,
76
+ "status": "blocked",
77
+ "assets": [],
78
+ "capturePlan": {
79
+ "routes": [
80
+ { "path": "/", "sampleId": "any", "caption": "Homepage / accounts list" },
81
+ { "path": "/quotes/:id", "sampleId": "first", "caption": "Quote editor with currency selector in ProjectDetailsCard" }
82
+ ],
83
+ "viewports": [
84
+ { "width": 1280, "height": 720, "label": "desktop" },
85
+ { "width": 375, "height": 667, "label": "mobile" }
86
+ ],
87
+ "requireApi": true,
88
+ "requireLogin": true,
89
+ "loginMethod": "mock-sso",
90
+ "reason": "Currency selector moved from editor body into ProjectDetailsCard; visual change in quote editor page."
91
+ },
92
+ "reason": "Visual evidence cannot be captured inside the awf sandbox (Docker-in-Docker unsupported, headless Chromium sandbox blocked). A capturePlan has been written for the Visual Evidence CI workflow.",
93
+ "prMarkdown": "## Evidence\n\nVisual evidence for this change is **blocked** in this agent run. A `capturePlan` has been written to `evidence.json` — the Visual Evidence CI workflow will execute it on a runner with full Docker and Chrome access.\n\nAutomated verification that did run:\n- Lint: clean\n- Tests: all pass\n- Build: success"
94
+ }
95
+ ```
96
+
97
+ ### When evidence is not required
98
+
99
+ If evidence is skipped (no UI files changed), write without a `capturePlan`:
100
+
101
+ ```json
102
+ {
103
+ "version": 1,
104
+ "changeId": "{change-id}",
105
+ "required": false,
106
+ "status": "skipped",
107
+ "assets": [],
108
+ "reason": "No user-visible UI files changed in this PR.",
109
+ "prMarkdown": "## Evidence\n\nSkipped: no user-visible UI changes."
110
+ }
111
+ ```
112
+
113
+ Capture never commits, stages, or pushes. The caller owns git.
114
+
115
+ ## Part 2: Publish (operation: publish / both)
116
+
117
+ Preconditions:
118
+ - An issue/PR number was provided. Else skip.
119
+ - Image URLs resolve only if the branch was pushed (`pr`/`push` modes).
120
+ - Backlog platform from `.opencode/harness.json`; `none` means skip.
121
+
122
+ <!-- PC-PLATFORM-EVIDENCE-START -->
123
+ <!-- PC-PLATFORM-EVIDENCE-END -->
124
+
125
+ ## Report
126
+
127
+ One block: the `status` (passed/skipped/failed/blocked) and why; capturePlan written or why not. Never present a blocked capture as passed.
@@ -1,18 +1,18 @@
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
- Repo platform is set in `.opencode/harness.json` `platform.repo`. The platform-specific content below is injected by the CLI during onboarding.
16
-
17
- <!-- PC-PLATFORM-SHIP-START -->
18
- <!-- 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
+ Repo platform is set in `.opencode/harness.json` `platform.repo`. The platform-specific content below is injected by the CLI during onboarding.
16
+
17
+ <!-- PC-PLATFORM-SHIP-START -->
18
+ <!-- PC-PLATFORM-SHIP-END -->
@@ -1,83 +1,83 @@
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`: do not return control between waves; keep looping until every task is DONE or the progress guard / retry limit trips. On a stall or exhausted retry, stop the wave loop and report to the caller (whose failure policy governs). When all tasks are DONE, the APPLY stage is complete. Hand control back to the caller (the `/plan-goal` pipeline) so it continues with the next phase. Do not end the turn here; "report N/N tasks" is a stage boundary, not a finish line.
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` skill and follow its instructions, replacing Step 6 (Implement) with the protocol below.
29
-
30
- **Step 6: Implement via native subagent waves. Replace the default step 6 with this protocol.**
31
-
32
- 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.
33
-
34
- 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.
35
-
36
- **1. Branch.** Create `feature/{change-slug}` if not already on one. (Skip this step when the caller passed `start_from: load-plan`.)
37
-
38
- **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).
39
-
40
- 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.
41
-
42
- **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`.
43
-
44
- **4. Worker context.** Before each wave, derive file-disjointness from `touches:` globs and `git diff`.
45
-
46
- <!-- PC-OPTIMIZATION-CODEGRAPH-START -->
47
- <!-- PC-OPTIMIZATION-CODEGRAPH-END -->
48
-
49
- <!-- PC-OPTIMIZATION-MEMORY-START -->
50
- <!-- PC-OPTIMIZATION-MEMORY-END -->
51
-
52
- **5. The wave loop.** Repeat until no tasks remain:
53
-
54
- ```
55
- eligible = unchecked tasks whose every depends_on is DONE (committed/checked)
56
- if eligible is empty but tasks remain -> STALL: report blocked tasks + the failed
57
- dependency causing it, then STOP.
58
- groups = pack eligible tasks that share a file (touches and gathered context)
59
- into ONE worker each, to run sequentially (the worker uses the task's `agent`)
60
- wave = pick groups whose file-sets are pairwise DISJOINT, capped at maxConcurrentAgents
61
- (you enforce the cap: opencode runs every task() you emit at once)
62
- ```
63
-
64
- **6. Context per group.** For each group, gather the task text, relevant plan decisions, and source context needed to implement it.
65
-
66
- **7. Spawn the wave: one assistant turn, multiple `task()` calls (they run in parallel).** For each group:
67
- - `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.
68
- - `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.
69
- - `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.
70
- - 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`.
71
-
72
- **8. Collect the wave.** Each foreground `task()` returns its result to you. For each group:
73
- - 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`.
74
- - 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.
75
- - A failed group only blocks its dependents; unrelated tasks keep flowing.
76
-
77
- **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.
78
-
79
- **10. Verify.** In this (lead) session, run the project's lint, typecheck, test, build, and proposal-required validation commands. Every command must exit 0. 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.
80
-
81
- **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.
82
-
83
- 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`: do not return control between waves; keep looping until every task is DONE or the progress guard / retry limit trips. On a stall or exhausted retry, stop the wave loop and report to the caller (whose failure policy governs). When all tasks are DONE, the APPLY stage is complete. Hand control back to the caller (the `/plan-goal` pipeline) so it continues with the next phase. Do not end the turn here; "report N/N tasks" is a stage boundary, not a finish line.
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` skill and follow its instructions, replacing Step 6 (Implement) with the protocol below.
29
+
30
+ **Step 6: Implement via native subagent waves. Replace the default step 6 with this protocol.**
31
+
32
+ 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.
33
+
34
+ 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.
35
+
36
+ **1. Branch.** Create `feature/{change-slug}` if not already on one. (Skip this step when the caller passed `start_from: load-plan`.)
37
+
38
+ **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).
39
+
40
+ 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.
41
+
42
+ **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`.
43
+
44
+ **4. Worker context.** Before each wave, derive file-disjointness from `touches:` globs and `git diff`.
45
+
46
+ <!-- PC-OPTIMIZATION-CODEGRAPH-START -->
47
+ <!-- PC-OPTIMIZATION-CODEGRAPH-END -->
48
+
49
+ <!-- PC-OPTIMIZATION-MEMORY-START -->
50
+ <!-- PC-OPTIMIZATION-MEMORY-END -->
51
+
52
+ **5. The wave loop.** Repeat until no tasks remain:
53
+
54
+ ```
55
+ eligible = unchecked tasks whose every depends_on is DONE (committed/checked)
56
+ if eligible is empty but tasks remain -> STALL: report blocked tasks + the failed
57
+ dependency causing it, then STOP.
58
+ groups = pack eligible tasks that share a file (touches and gathered context)
59
+ into ONE worker each, to run sequentially (the worker uses the task's `agent`)
60
+ wave = pick groups whose file-sets are pairwise DISJOINT, capped at maxConcurrentAgents
61
+ (you enforce the cap: opencode runs every task() you emit at once)
62
+ ```
63
+
64
+ **6. Context per group.** For each group, gather the task text, relevant plan decisions, and source context needed to implement it.
65
+
66
+ **7. Spawn the wave: one assistant turn, multiple `task()` calls (they run in parallel).** For each group:
67
+ - `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.
68
+ - `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.
69
+ - `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.
70
+ - 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`.
71
+
72
+ **8. Collect the wave.** Each foreground `task()` returns its result to you. For each group:
73
+ - 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`.
74
+ - 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.
75
+ - A failed group only blocks its dependents; unrelated tasks keep flowing.
76
+
77
+ **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.
78
+
79
+ **10. Verify.** In this (lead) session, run the project's lint, typecheck, test, build, and proposal-required validation commands. Every command must exit 0. 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.
80
+
81
+ **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.
82
+
83
+ 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 -A && git commit -m "task {id}: {summary}"`.
13
- 4. After all tasks are done, run the project's typecheck/build check if one exists. Fix any errors.
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
- - If a task is too complex or blocked, mark it `completed` with a note, and continue with the next.
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 -A && git commit -m "task {id}: {summary}"`.
13
+ 4. After all tasks are done, run the project's typecheck/build check if one exists. Fix any errors.
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
+ - If a task is too complex or blocked, mark it `completed` with a note, and continue with the next.