@plainconceptsplatform/agent-harness 2.0.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 (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +419 -0
  3. package/package.json +68 -0
  4. package/src/commands/join.js +244 -0
  5. package/src/commands/shared.js +27 -0
  6. package/src/commands/single.js +79 -0
  7. package/src/commands/update.js +109 -0
  8. package/src/commands/wizard.js +134 -0
  9. package/src/content/.agents/skills/browser-automation/SKILL.md +66 -0
  10. package/src/content/.agents/skills/pc-guardrails-generic/SKILL.md +68 -0
  11. package/src/content/.agents/skills/pc-guardrails-project/SKILL.md +8 -0
  12. package/src/content/.agents/skills/pc-make-architecture/SKILL.md +51 -0
  13. package/src/content/.agents/skills/pc-make-architecture/structure-template.md +38 -0
  14. package/src/content/.agents/skills/pc-make-design/SKILL.md +68 -0
  15. package/src/content/.agents/skills/pc-make-engineer/SKILL.md +219 -0
  16. package/src/content/.agents/skills/pc-make-engineer/signal-mapping.md +68 -0
  17. package/src/content/.agents/skills/pc-make-engineer/template.md +81 -0
  18. package/src/content/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -0
  19. package/src/content/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -0
  20. package/src/content/.agents/skills/pc-make-guardrails/SKILL.md +74 -0
  21. package/src/content/.agents/skills/pc-make-guardrails/category-reference.md +68 -0
  22. package/src/content/.agents/skills/pc-make-merge-risk-assess/SKILL.md +70 -0
  23. package/src/content/.agents/skills/pc-make-merge-risk-assess/category-reference.md +98 -0
  24. package/src/content/.agents/skills/pc-make-user-model/SKILL.md +66 -0
  25. package/src/content/.agents/skills/pc-ops-evidence/SKILL.md +127 -0
  26. package/src/content/.agents/skills/pc-ops-ship/SKILL.md +18 -0
  27. package/src/content/.agents/skills/pc-plan-apply/SKILL.md +83 -0
  28. package/src/content/.agents/skills/pc-plan-apply/simple-mode.md +21 -0
  29. package/src/content/.agents/skills/pc-plan-archive/SKILL.md +63 -0
  30. package/src/content/.agents/skills/pc-plan-explore/SKILL.md +9 -0
  31. package/src/content/.agents/skills/pc-plan-goal/SKILL.md +94 -0
  32. package/src/content/.agents/skills/pc-plan-goal/branching.md +30 -0
  33. package/src/content/.agents/skills/pc-plan-goal/failure-policy.md +30 -0
  34. package/src/content/.agents/skills/pc-plan-goal/output-mode.md +9 -0
  35. package/src/content/.agents/skills/pc-plan-goal/output.md +68 -0
  36. package/src/content/.agents/skills/pc-plan-propose/SKILL.md +125 -0
  37. package/src/content/.agents/skills/pc-plan-propose/task-annotation.md +39 -0
  38. package/src/content/.agents/skills/pc-plan-quick/SKILL.md +62 -0
  39. package/src/content/.agents/skills/pc-plan-story/SKILL.md +146 -0
  40. package/src/content/.agents/skills/pc-repo-audit/SKILL.md +44 -0
  41. package/src/content/.agents/skills/pc-repo-help/SKILL.md +91 -0
  42. package/src/content/.agents/skills/pc-repo-initialize/SKILL.md +130 -0
  43. package/src/content/.agents/skills/pc-repo-onboard/SKILL.md +87 -0
  44. package/src/content/.agents/skills/pc-repo-verify/SKILL.md +34 -0
  45. package/src/content/.agents/skills/pc-userstory-az/SKILL.md +157 -0
  46. package/src/content/.agents/skills/pc-userstory-browser/SKILL.md +132 -0
  47. package/src/content/.agents/skills/pc-userstory-gh/SKILL.md +120 -0
  48. package/src/content/.agents/skills/pc-userstory-jira/SKILL.md +131 -0
  49. package/src/content/.opencode/_gitignore +7 -0
  50. package/src/content/.opencode/commands/init.md +5 -0
  51. package/src/content/.opencode/commands/make-architecture.md +5 -0
  52. package/src/content/.opencode/commands/make-design.md +5 -0
  53. package/src/content/.opencode/commands/make-engineer.md +5 -0
  54. package/src/content/.opencode/commands/make-evidence-scaffold.md +5 -0
  55. package/src/content/.opencode/commands/make-guardrails.md +5 -0
  56. package/src/content/.opencode/commands/make-user-model.md +5 -0
  57. package/src/content/.opencode/commands/ops-backlog.md +10 -0
  58. package/src/content/.opencode/commands/ops-evidence.md +9 -0
  59. package/src/content/.opencode/commands/ops-review.md +8 -0
  60. package/src/content/.opencode/commands/ops-ship.md +9 -0
  61. package/src/content/.opencode/commands/plan-apply.md +9 -0
  62. package/src/content/.opencode/commands/plan-archive.md +5 -0
  63. package/src/content/.opencode/commands/plan-explore.md +9 -0
  64. package/src/content/.opencode/commands/plan-goal.md +5 -0
  65. package/src/content/.opencode/commands/plan-propose.md +9 -0
  66. package/src/content/.opencode/commands/plan-quick.md +5 -0
  67. package/src/content/.opencode/commands/plan-story.md +9 -0
  68. package/src/content/.opencode/commands/repo-audit.md +5 -0
  69. package/src/content/.opencode/commands/repo-help.md +5 -0
  70. package/src/content/.opencode/commands/repo-initialize.md +5 -0
  71. package/src/content/.opencode/commands/repo-onboard.md +5 -0
  72. package/src/content/.opencode/commands/repo-verify.md +5 -0
  73. package/src/content/.opencode/package.json +10 -0
  74. package/src/content/.opencode/plugins/pc-subagent-monitor.js +139 -0
  75. package/src/content/.opencode/plugins/pc-subagent-tiers.js +179 -0
  76. package/src/content/.opencode/plugins/pc-system-reminders.js +96 -0
  77. package/src/content/.opencode/plugins/pc-system-reminders.test.js +35 -0
  78. package/src/content/.opencode/tui/pc-subagents.tsx +98 -0
  79. package/src/content/.opencode/tui.json +6 -0
  80. package/src/content/AGENTS.md +71 -0
  81. package/src/content/ARCHITECTURE.md +16 -0
  82. package/src/content/DESIGN.md +16 -0
  83. package/src/content/opencode.jsonc +31 -0
  84. package/src/content/openspec/changes/archive/.gitkeep +0 -0
  85. package/src/content/openspec/config.yaml +20 -0
  86. package/src/content/openspec/specs/.gitkeep +0 -0
  87. package/src/content/skills-lock.json +17 -0
  88. package/src/fragments/archive/az.md +95 -0
  89. package/src/fragments/archive/gh.md +94 -0
  90. package/src/fragments/archive/gl.md +94 -0
  91. package/src/fragments/archive/none.md +73 -0
  92. package/src/fragments/guardrails/codegraph.md +7 -0
  93. package/src/fragments/guardrails/humanizer.md +4 -0
  94. package/src/fragments/guardrails/memory.md +4 -0
  95. package/src/fragments/guardrails/rtk.md +3 -0
  96. package/src/fragments/guardrails/simple-english.md +4 -0
  97. package/src/fragments/ops-backlog/az.md +29 -0
  98. package/src/fragments/ops-backlog/gh.md +30 -0
  99. package/src/fragments/ops-backlog/jira.md +29 -0
  100. package/src/fragments/ops-evidence/az.md +41 -0
  101. package/src/fragments/ops-evidence/gh.md +53 -0
  102. package/src/fragments/ops-evidence/jira.md +38 -0
  103. package/src/fragments/ops-review/az.md +63 -0
  104. package/src/fragments/ops-review/gh.md +53 -0
  105. package/src/fragments/ops-review/gl.md +57 -0
  106. package/src/fragments/ops-ship/az.md +81 -0
  107. package/src/fragments/ops-ship/gh.md +69 -0
  108. package/src/fragments/ops-ship/gl.md +86 -0
  109. package/src/index.js +107 -0
  110. package/src/presets/agents-content.json +53 -0
  111. package/src/presets/browser.json +22 -0
  112. package/src/presets/clean.json +21 -0
  113. package/src/presets/models.json +68 -0
  114. package/src/presets/openspec.json +1 -0
  115. package/src/presets/optimization.json +37 -0
  116. package/src/presets/platforms.json +76 -0
  117. package/src/presets/quota.json +16 -0
  118. package/src/presets/source.json +23 -0
  119. package/src/steps/browser/index.js +91 -0
  120. package/src/steps/clean/index.js +120 -0
  121. package/src/steps/copy/agents.js +118 -0
  122. package/src/steps/copy/commands.js +91 -0
  123. package/src/steps/copy/fullstack-engineer.js +83 -0
  124. package/src/steps/copy/index.js +88 -0
  125. package/src/steps/copy/opencode-json.js +129 -0
  126. package/src/steps/copy/skills.js +196 -0
  127. package/src/steps/metadata/index.js +108 -0
  128. package/src/steps/models/format.js +88 -0
  129. package/src/steps/models/index.js +64 -0
  130. package/src/steps/models/write.js +34 -0
  131. package/src/steps/openspec/index.js +136 -0
  132. package/src/steps/optimization/codegraph.js +127 -0
  133. package/src/steps/optimization/humanizer.js +17 -0
  134. package/src/steps/optimization/index.js +163 -0
  135. package/src/steps/optimization/memory.js +88 -0
  136. package/src/steps/optimization/patch-guardrails.js +108 -0
  137. package/src/steps/optimization/quota.js +119 -0
  138. package/src/steps/optimization/simple-english.js +17 -0
  139. package/src/steps/optimization/skills-lock.js +30 -0
  140. package/src/steps/platform/index.js +109 -0
  141. package/src/steps/source/index.js +123 -0
  142. package/src/utils/copy.js +108 -0
  143. package/src/utils/exec-spinner.js +47 -0
  144. package/src/utils/exec.js +134 -0
  145. package/src/utils/legacy-check.js +30 -0
  146. package/src/utils/models-cache.js +58 -0
  147. package/src/utils/models-pricing.js +42 -0
  148. package/src/utils/paths.js +64 -0
  149. package/src/utils/process.js +3 -0
  150. package/src/utils/terminal.js +6 -0
  151. package/src/utils/update-manifest.js +49 -0
@@ -0,0 +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.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: pc-plan-archive
3
+ description: Archive a completed OpenSpec change and update documentation. Interactive mode finds the oldest merged unarchived change and opens an archive PR; autonomous mode archives a named change in place on the current branch. Invoked by the /plan-archive command (interactive) and the plan-goal pipeline (autonomous).
4
+ license: MIT
5
+ ---
6
+
7
+ # Plan Archive
8
+
9
+ ## Input
10
+
11
+ The caller provides (all optional):
12
+ - A mode (see below). Default: `interactive`.
13
+ - In autonomous mode: the change id to archive (required in that mode; the caller knows which change it just implemented).
14
+
15
+ ## Modes
16
+
17
+ - interactive (default): full flow below. Find the oldest unarchived change with a completed PR, confirm with the user, archive it, update docs with approval, and open an archive PR. No input required.
18
+ - autonomous: the caller names the change to archive. Skip the working-tree prep, the PR lookup, the confirmation prompt, and the archive-PR step. Instead, archive in place on the current branch:
19
+ 1. Archive the change by its id. Prefer the `@openspec-archive-change` skill if it is available. If it is not available, run the CLI directly, and it must be non-interactive, because there is no user to answer prompts:
20
+
21
+ ```bash
22
+ openspec archive "<change-id>" -y
23
+ ```
24
+
25
+ `-y` skips the confirmation prompt (without it the command blocks forever in an unattended run). Add `--skip-specs` only for infra/tooling/doc-only changes that produced no spec deltas. If the command reports the change is already archived, treat that as success.
26
+ 2. Verify the archive actually moved. The change folder must no longer exist at `openspec/changes/<change-id>/`, and a dated copy must now exist under `openspec/changes/archive/` (the CLI renames it to `archive/YYYY-MM-DD-<change-id>/`):
27
+
28
+ ```bash
29
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
30
+ test ! -d "$REPO_ROOT/openspec/changes/<change-id>" \
31
+ && ls -d "$REPO_ROOT/openspec/changes/archive/"*"<change-id>" >/dev/null 2>&1 \
32
+ && echo ARCHIVED_OK || echo ARCHIVE_FAILED
33
+ ```
34
+
35
+ If this prints `ARCHIVE_FAILED`, run the archive once more and repeat the check. If it still fails, report it to the caller as a failure; do not pretend it succeeded.
36
+ 3. Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`; apply any needed doc updates directly (no approval prompt).
37
+ 4. If the change was a bug fix or new functionality with important impact, check if `@pc-guardrails-project` exists and update it.
38
+ 5. Do not commit or push: the caller owns the git operations.
39
+ 6. The ARCHIVE stage is complete. Hand control back to the caller (the `/plan-goal` pipeline) so it continues with evidence and output. Do not stop or end the turn here; archiving is not the end of the run.
40
+
41
+ ---
42
+
43
+ ## Interactive flow
44
+
45
+ Steps
46
+
47
+ 1. Prepare working tree
48
+
49
+ ```bash
50
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
51
+ DEFAULT_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')"
52
+ [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH="main"
53
+ ```
54
+
55
+ 1. If the tree has uncommitted changes: `git stash push -u -m "WIP before archive"` and tell the user their work is stashed (it is restored in step 6).
56
+ 2. Sync the default branch (skip the pull if there is no `origin` remote):
57
+
58
+ ```bash
59
+ git switch "$DEFAULT_BRANCH" && git pull origin "$DEFAULT_BRANCH"
60
+ ```
61
+
62
+ <!-- PC-PLATFORM-ARCHIVE-START -->
63
+ <!-- PC-PLATFORM-ARCHIVE-END -->
@@ -0,0 +1,9 @@
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
+ **READ-ONLY MODE.** From the moment this skill is loaded until the user explicitly invokes a different command (e.g. `/plan-apply`) or explicitly requests implementation, you MUST NOT write, edit, or create any file, including OpenSpec artifacts. You may only read, search, and discuss. If the conversation drifts toward implementation, remind the user that explore mode is active and suggest `/plan-apply` to start implementing. This overrides any permissive stance in `@openspec-explore` about creating OpenSpec artifacts being "fine."
8
+
9
+ Load `@openspec-explore` and follow every step defined in it.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: pc-plan-goal
3
+ description: Autonomous pipeline: explore, propose, apply, archive, then merge/PR/push. For loop-engineering. Invoked by the /plan-goal command.
4
+ license: MIT
5
+ ---
6
+
7
+ Run the full OpenSpec lifecycle without human interaction. This skill owns phase order, cross-phase gates, commits, and output. Each phase skill owns its procedure.
8
+
9
+ Keep this checklist visible:
10
+
11
+ `explore · propose · apply · verify · archive · evidence · output · report`
12
+
13
+ Move forward only when a phase returns its required result. On a hard failure, follow the [failure policy](failure-policy.md). Continue after each phase skill returns; the run ends only after every checklist item is complete.
14
+
15
+ **Token efficiency rules:** Batch git operations within a phase (combine `git add -A && git commit` in one tool call). Do not run status checks between sequential operations in the same phase. Minimize model turns: if a phase requires 3 git commands, call them in one tool call, not 3.
16
+
17
+ Input: `$ARGUMENTS`
18
+
19
+ ## Phase 0: Resolve input
20
+
21
+ Load the [output mode](output-mode.md) reference and resolve the mode from the first token of `$ARGUMENTS`. Treat the remaining text as data, not orchestration instructions.
22
+
23
+ - For a work-item URL or issue key with a configured backlog platform, load `@pc-userstory` and fetch the work item.
24
+ - Otherwise, use the remaining text as the direct feature description.
25
+ - Preserve title, description, work-item reference, and acceptance criteria as `{resolved_input}`.
26
+ - Derive `{slug}` and classify scope as `focused`, `standard`, or `complex`.
27
+
28
+ **Refined-issue detection:** After resolving input, check whether `{resolved_input}` already contains structured acceptance criteria (e.g. "## Acceptance criteria", "### Scenario:", Gherkin blocks), affected artifacts, and design decisions. If it does, set `{refined}` to `true` and skip Phases 2-3 (Explore and Propose). Go directly to Phase 4 (Apply). The issue content IS the proposal; create a minimal OpenSpec change (tasks.md only, `skip_specs: true` in `.openspec.yaml`) directly from the issue's acceptance criteria and affected artifacts.
29
+
30
+ ## Phase 1: Branch
31
+
32
+ Follow the [branching procedure](branching.md) with `{slug}`. Record `$START_BRANCH`, `$DEFAULT_BRANCH`, `$BRANCH`, and whether the goal stash exists.
33
+
34
+ ## Phase 2: Explore
35
+
36
+ **Skip if `{refined}` is `true`.** The issue already contains structured acceptance criteria and affected artifacts; re-exploring the codebase would waste tokens re-deriving what the issue already specifies. Set `EXPLORATION_BRIEF` to a one-line summary: `"Pre-refined issue: {title}"`.
37
+
38
+ Load `pc-plan-explore` with `{resolved_input}` in autonomous mode. Require an in-memory `EXPLORATION_BRIEF` as its findings handoff to Phase 3.
39
+
40
+ Tick `explore` when `pc-plan-explore` returns its findings handoff.
41
+
42
+ ## Phase 3: Propose
43
+
44
+ **Skip if `{refined}` is `true`.** Instead, create a minimal OpenSpec change directly: run `openspec new change "{change-id}"`, write `tasks.md` from the issue's acceptance criteria (one task per criterion or artifact group), create `.openspec.yaml` with `skip_specs: true` (the issue already has the spec content), and commit: `git add -A && git commit -m "propose: {title} ({change-id})"`.
45
+
46
+ Load `pc-plan-propose` in autonomous mode with `{resolved_input}`, `EXPLORATION_BRIEF`, and `scope_classification`.
47
+
48
+ Confirm its change directory and actionable `tasks.md` exist. Rename `$BRANCH` when the canonical change slug differs from `{slug}`, then commit the proposal:
49
+
50
+ ```bash
51
+ git add -A && git commit -m "propose: {title} ({change-id})"
52
+ ```
53
+
54
+ Tick `propose` when the proposal commit exists.
55
+
56
+ ## Phase 4: Apply and verify
57
+
58
+ Load `pc-plan-apply` in autonomous mode with `start_from: load-plan`. It owns worker resolution, subagent waves, commits, verification, and re-waves.
59
+
60
+ Require it to return every task complete and `VERIFIED`, then load `pc-repo-verify`. Tick `apply` and `verify` only when both phases return `VERIFIED`.
61
+
62
+ ## Phase 5: Archive
63
+
64
+ Require `verify` and a clean working tree. Load `pc-plan-archive` in autonomous mode with `{change-id}`. It owns archive verification and retry.
65
+
66
+ Require `ARCHIVED_OK` and the archive path, then commit:
67
+
68
+ ```bash
69
+ git add -A && git commit -m "archive: {title} ({change-id})"
70
+ ```
71
+
72
+ Tick `archive` when the archive commit exists.
73
+
74
+ ## Phase 5.5: Evidence
75
+
76
+ Load `pc-ops-evidence` with `operation: capture` and `{change-id}`. It owns evidence decisions, capture, and the manifest. Evidence capture is non-fatal.
77
+
78
+ The evidence skill uses `playwright-cli` (headless, works inside containers) and `pnpm run dev` (starts the full app stack with mock auth). Evidence capture works in CI.
79
+
80
+ Commit evidence when files or a manifest were written:
81
+
82
+ ```bash
83
+ git add -A && git commit -m "evidence: {title} ({change-id})"
84
+ ```
85
+
86
+ Record the manifest result and tick `evidence` after capture was attempted.
87
+
88
+ ## Phase 6: Output
89
+
90
+ Follow the [output procedure](output.md) with the mode, branch values, change id, work-item reference, archive path, and evidence result. Tick `output` only when its mode-specific postcondition holds.
91
+
92
+ ## Phase 7: Report
93
+
94
+ Print the final report from the [output procedure](output.md). Tick `report` only after every checklist item is complete.
@@ -0,0 +1,30 @@
1
+ # Branching procedure
2
+
3
+ Resolve and record the branch names:
4
+
5
+ ```bash
6
+ START_BRANCH="$(git branch --show-current)"
7
+ DEFAULT_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')"
8
+ [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH="main"
9
+ ```
10
+
11
+ Stash uncommitted work when needed and record that the goal stash exists:
12
+
13
+ ```bash
14
+ git stash push -u -m "goal-wip"
15
+ ```
16
+
17
+ Create the feature branch from the synchronized default branch:
18
+
19
+ ```bash
20
+ git switch "$DEFAULT_BRANCH"
21
+
22
+ if git remote get-url origin >/dev/null 2>&1; then
23
+ git pull origin "$DEFAULT_BRANCH"
24
+ fi
25
+
26
+ git switch -c "feature/{slug}"
27
+ BRANCH="$(git branch --show-current)"
28
+ ```
29
+
30
+ Everything through archive and evidence happens on `$BRANCH`.
@@ -0,0 +1,30 @@
1
+ # Failure policy
2
+
3
+ `/plan-goal` never asks for input, but must halt instead of shipping broken or incoherent work.
4
+
5
+ Use the failure policy when:
6
+
7
+ - exploration cannot produce a safe and coherent functional interpretation after its one retry,
8
+ - exploration determines the goal is infeasible or outside the repository's feasible responsibility,
9
+ - the proposal produces no actionable tasks,
10
+ - the proposal materially contradicts the exploration brief,
11
+ - a task wave stalls because tasks remain but none are eligible,
12
+ - a task exhausts its single retry,
13
+ - tests, lint, build, type checks, or required verification fail and cannot be cleared by re-waving,
14
+ - any verification command (lint, typecheck, test) exits non-zero after the apply phase and re-waving does not clear it,
15
+ - archive verification still prints `ARCHIVE_FAILED` after one retry,
16
+ - required repository state is missing or inconsistent before output,
17
+ - or a merge conflict cannot be resolved cleanly and automatically.
18
+
19
+ On failure:
20
+
21
+ 1. Stop the pipeline.
22
+ 2. Do not merge.
23
+ 3. Do not push the default branch.
24
+ 4. Leave `$BRANCH` intact whenever it exists.
25
+ 5. Abort any incomplete merge.
26
+ 6. Restore the Phase 1 goal stash on `$START_BRANCH`.
27
+ 7. If stash restoration conflicts, preserve the stash and report its reference.
28
+ 8. Report: the failed phase, the exact failed postcondition, commands or verification that failed, retry attempts, current branch, repository state, completed commits, archive state, and the safest manual next step.
29
+
30
+ For loop-engineering, a clean failure with the feature branch preserved is the correct outcome. Never merge or ship unverified work.
@@ -0,0 +1,9 @@
1
+ # Output mode
2
+
3
+ Determine the mode only from the first whitespace-delimited token of `$ARGUMENTS`.
4
+
5
+ - `pr`: remove the token, push the feature branch, and create a PR.
6
+ - `push`: remove the token and push the feature branch.
7
+ - Any other first token: keep the full input and merge locally into the default branch.
8
+
9
+ Words such as "push notifications" or "PR template" inside the feature description are feature data. They do not change output mode.
@@ -0,0 +1,68 @@
1
+ # Output procedure
2
+
3
+ Before output, require `verify`, `archive`, a clean working tree, no active change directory, and an archive directory for `{change-id}`.
4
+
5
+ ## Restore stash
6
+
7
+ If the goal created `goal-wip`, restore it after the mode-specific operation. When restoration conflicts, leave the stash intact, report its `git stash list` reference, and do not drop user work.
8
+
9
+ ## Default mode
10
+
11
+ Synchronize the default branch, merge, delete the feature branch, then restore the stash:
12
+
13
+ ```bash
14
+ git switch "$DEFAULT_BRANCH"
15
+
16
+ if git remote get-url origin >/dev/null 2>&1; then
17
+ git pull origin "$DEFAULT_BRANCH"
18
+ fi
19
+
20
+ git merge --no-ff "$BRANCH" -m "goal: {title} ({change-id})"
21
+ git branch -d "$BRANCH"
22
+ ```
23
+
24
+ If the merge conflicts, abort it and use the failure policy. Do not push the default branch. Evidence remains in the archive and publication is skipped because no commit-pinned repository URL exists.
25
+
26
+ ## Push mode
27
+
28
+ Push the feature branch:
29
+
30
+ ```bash
31
+ git push -u origin "$BRANCH"
32
+ ```
33
+
34
+ When a work item exists, load `pc-ops-evidence` with `operation: publish`, `{change-id}`, the work-item reference, and `mode: push`. Publication is non-fatal. Restore the stash and leave the branch available.
35
+
36
+ ## PR mode
37
+
38
+ Push the feature branch, then load `pc-ops-ship` to create a PR into `$DEFAULT_BRANCH`. Supply title, change id, functional summary, delivered acceptance criteria, task count, verification result, archive path, evidence result, and commits. Do not merge the PR.
39
+
40
+ When a work item exists, load `pc-ops-evidence` with `operation: publish`, `{change-id}`, the work-item reference, PR number, and `mode: pr`. Publication is non-fatal. Restore the stash.
41
+
42
+ ## Final report
43
+
44
+ Print:
45
+
46
+ ```text
47
+ Goal: {title}
48
+ Change ID: {change-id}
49
+ Scope classification: focused | standard | complex
50
+ Functional outcome: {one-sentence result}
51
+ Branch: {branch}
52
+ Tasks: {completed}/{total}
53
+ Acceptance criteria: {passed}/{total}
54
+ Commits: {proposal, apply, archive, evidence when present}
55
+ Verification: passed | failed
56
+ Archived: yes | no
57
+ Archive path: {path or none}
58
+ Evidence: passed | skipped | failed | blocked
59
+ Evidence assets: {paths or none}
60
+ Evidence publication: {published | skipped | failed}
61
+ Output mode: default | push | pr
62
+ Final state: merged locally | pushed branch | PR URL | branch preserved after failure
63
+ Stash restoration: not needed | restored | preserved after conflict
64
+ ```
65
+
66
+ ## External gate
67
+
68
+ An unattended caller must verify `openspec list --json` is empty and run the project's lint and typecheck commands before any later git operation.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: pc-plan-propose
3
+ description: Parse a work item or idea and produce an OpenSpec change plan (proposal.md, specs, tasks.md) with enriched task assignments (agent, tier, depends_on, touches). Load when turning a requirement into a structured plan. Invoked by the /plan-propose command (interactive) and the plan-goal pipeline (autonomous).
4
+ license: MIT
5
+ ---
6
+
7
+ # Plan Propose
8
+
9
+ **READ-ONLY UNTIL CONFIRMED.** Until the Step 3 checkpoint resolves to `yes`, this entire skill is read-only. You MUST NOT write, edit, or create any file. Build everything in context. Files hit disk only in Step 4. After Step 5, the skill ends; if the user keeps chatting without invoking a new command, remain read-only. Writing requires either an explicit user command (e.g. `/plan-apply`) or the Step 3 `yes` confirmation.
10
+
11
+ ## Input
12
+
13
+ The caller provides:
14
+ - A work item URL, issue key, or direct feature description. Exploration findings may accompany it; incorporate them.
15
+ - Optionally a mode (see below). Default: `interactive`.
16
+
17
+ ## Modes
18
+
19
+ - `interactive` (default): every checkpoint below is active. Wait for the user at each one.
20
+ - `autonomous`: there is no user. Never ask anything. Each checkpoint marked with a stop sign states its autonomous resolution inline.
21
+
22
+ ## Step 0.a: Check for unarchived changes (stop)
23
+
24
+ Before proposing a new change, inspect `openspec/changes/` (ignore `openspec/changes/archive`).
25
+ If any change folder exists in `openspec/changes/` (names vary by platform: `gh-*`, `us-*`, or a plain slug), list them in the question text, then call the `question` tool:
26
+
27
+ ```json
28
+ {
29
+ "questions": [
30
+ {
31
+ "header": "Unarchived changes",
32
+ "question": "There are unarchived changes pending:\n{change-name}\n{change-name}\n...\n\nContinue with the proposal or stop to archive first?",
33
+ "options": [
34
+ { "label": "continue", "description": "Proceed with the proposal." },
35
+ { "label": "stop", "description": "End without generating a proposal. Archive the pending change first." }
36
+ ]
37
+ }
38
+ ]
39
+ }
40
+ ```
41
+
42
+ - If the user answers `stop`, end without generating a proposal.
43
+ - If the user answers `continue`, proceed to the next step.
44
+
45
+ Autonomous mode: do not call the `question` tool; treat the answer as `continue` and proceed.
46
+
47
+ ## Step 0.b: Load proposal skill
48
+
49
+ If a work item URL or issue key is provided (GitHub Issue, Azure DevOps work item, Jira issue, or browser-based backlog): load `@pc-userstory` skill and fetch the work item before continuing. Backlog platform is set in `.opencode/harness.json` -> `platform.backlog`. If backlog platform is `none`, skip this step and work from direct input.
50
+
51
+ ## Step 1: Generate the proposal in memory
52
+
53
+ Load `@openspec-propose` skill and follow its instructions to generate proposal.md, specs, and tasks.md. Do not write them to disk yet. Build the complete proposal content in your context.
54
+
55
+ ## Step 2: Enrich task assignments
56
+
57
+ 1. List every `*-engineer.md` file in `.opencode/agents/`. For each file read:
58
+ - `description:` from the YAML frontmatter: the engineer's specialization summary
59
+ - `## Abilities` section: the skills listed under Development, Testing, Infrastructure (e.g. `@nodejs-backend`, `@secure-nextjs-api-routes`)
60
+ Build a map of `agent-name -> { description, abilities }`.
61
+ 2. For each task, compare the task text and domain against every engineer's description AND abilities. Pick the engineer whose combined profile most closely matches. `fullstack-engineer` is `mode: primary` (the user's planning agent), not a spawned worker. If no specialist matches a task, leave the agent field blank and record the missing specialization in the proposal. An annotated OpenSpec task needs a real subagent; never substitute the lead or an obsolete generic agent name.
62
+ 3. Pick a tier, derive `depends_on`, derive `touches`, and annotate each task line. Follow the [task annotation](task-annotation.md) reference for the full tier selection guide, dependency derivation, touches derivation, and annotation format with examples.
63
+
64
+ ## Step 3: Show the plan and ask for confirmation (stop)
65
+
66
+ Display the complete proposal to the user:
67
+ - Change name and description
68
+ - Total task count
69
+ - Full task list with agent (including tier suffix) and dependency annotations
70
+
71
+ Then call the `question` tool:
72
+
73
+ ```json
74
+ {
75
+ "questions": [
76
+ {
77
+ "header": "Save proposal",
78
+ "question": "Save this proposal?",
79
+ "options": [
80
+ { "label": "yes", "description": "Write all files to disk and proceed." },
81
+ { "label": "edit", "description": "Provide feedback, revise in memory, show again." },
82
+ { "label": "stop", "description": "End without writing anything." }
83
+ ]
84
+ }
85
+ ]
86
+ }
87
+ ```
88
+
89
+ - `yes` -> proceed to Step 4 and write all files
90
+ - `edit` -> user provides feedback, revise in memory, show again, ask again
91
+ - `stop` -> end without writing anything
92
+
93
+ Wait for the user's response. Do not proceed without a response.
94
+
95
+ Autonomous mode: do not call the `question` tool; treat the answer as `yes` and write the files immediately.
96
+
97
+ ## Step 4: Write (only after the Step 3 checkpoint resolves)
98
+
99
+ Write the proposal files to `openspec/changes/{change-slug}/`:
100
+ - `proposal.md`: the change description and rationale
101
+ - `specs/`: any spec files generated
102
+ - `tasks.md`: the enriched task list with agent annotations
103
+
104
+ ## Step 5: Stop (stop)
105
+
106
+ Call the `question` tool:
107
+
108
+ ```json
109
+ {
110
+ "questions": [
111
+ {
112
+ "header": "Ready to implement",
113
+ "question": "Ready to implement?",
114
+ "options": [
115
+ { "label": "yes", "description": "Load the pc-plan-apply skill to start implementation." },
116
+ { "label": "no", "description": "Stop here. You can run /plan-apply later." }
117
+ ]
118
+ }
119
+ ]
120
+ }
121
+ ```
122
+
123
+ Loading `pc-plan-apply` requires explicit user confirmation.
124
+
125
+ Autonomous mode: do not call the `question` tool. The PROPOSE stage is complete. Hand the change slug and task count back to the caller (the `/plan-goal` pipeline) so it immediately continues to the apply phase. This is a stage boundary, not the end of the run.
@@ -0,0 +1,39 @@
1
+ # Task annotation reference
2
+
3
+ ## Tier selection
4
+
5
+ Pick a tier for each task based on complexity:
6
+ - `build`: complex code: data models, APIs, auth logic, core business logic, UI components
7
+ - `fast`: light work: i18n keys, config changes, env variables, navigation links, simple markup, verification runs
8
+ - `plan`: reserved for orchestration, do not use for implementation tasks
9
+
10
+ The tier suffix is appended to the agent name with a dot (e.g. `backend-engineer.build`). This is the agent name you write in the annotation. The `pc-subagent-tiers` plugin resolves the model at startup from `models[<tier>]`.
11
+
12
+ ## depends_on
13
+
14
+ Derive `depends_on` for each task: the OpenSpec task IDs (`N.M`) it logically needs completed first (a task that consumes another's output: UI needs its RPC, tests need the code, a seed needs its migration). Root tasks get `[]`. Reference the IDs OpenSpec already generated. Never invent new ones.
15
+
16
+ ## touches
17
+
18
+ Derive `touches` for each task: the file path(s)/glob(s) it will create or modify (the task text usually names them, e.g. "Modify src/board/components/CreateForm.tsx"). This lets `pc-plan-apply` serialize same-file tasks that have no logical dependency. Include net-new files.
19
+
20
+ ## Annotation format
21
+
22
+ Annotate each task line in-place with all three fields:
23
+
24
+ ```
25
+ - [ ] <task text> <!-- agent: <name>, depends_on: [<ids>], touches: [<globs>] -->
26
+ ```
27
+
28
+ Example result (note same-file tasks like 1.1/1.2 share `touches`, so `pc-plan-apply` runs them sequentially even with no `depends_on` between them; tier suffix encodes the model):
29
+
30
+ ```
31
+ - [ ] 1.1 Add Project model to schema <!-- agent: backend-engineer.build, depends_on: [], touches: [src/types.ts] -->
32
+ - [ ] 1.2 Add projectId field to LoopOptions <!-- agent: backend-engineer.build, depends_on: [], touches: [src/types.ts] -->
33
+ - [ ] 2.1 Project RPC endpoints <!-- agent: backend-engineer.build, depends_on: [1.1], touches: [src/rpc/project/**] -->
34
+ - [ ] 3.1 Accept page UI <!-- agent: frontend-engineer.build, depends_on: [2.1], touches: [src/board/components/CreateForm.tsx] -->
35
+ - [ ] 3.2 i18n keys for invitation flow <!-- agent: frontend-engineer.fast, depends_on: [3.1], touches: [src/i18n/**] -->
36
+ - [ ] 4.1 Run typecheck and fix errors <!-- agent: backend-engineer.fast, depends_on: [2.1,3.1], touches: [] -->
37
+ ```
38
+
39
+ `pc-plan-apply` reads these annotations to build conflict-free waves: `depends_on` gates ordering, `touches` keeps concurrent agents file-disjoint, and the tier suffix in `agent` determines the model (resolved at startup by the `pc-subagent-tiers` plugin). `depends_on` is mandatory; `touches` is a best-effort hint.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: pc-plan-quick
3
+ description: Quick plan: analyze the codebase and create a task checklist using the Todo pane. No files, no OpenSpec. Invoked by the /plan-quick command.
4
+ license: MIT
5
+ ---
6
+
7
+ This command is strictly read-only. You may read files, search code, and use `todowrite` to create Todo pane items. You MUST NOT write, edit, or create any file. After completing the checklist and asking the user what's next, if the user continues chatting without invoking a new command (e.g. `/plan-apply`) or explicitly requesting implementation, remain read-only. The only output of this command is the Todo pane checklist and a question to the user.
8
+
9
+ Lightweight planning for focused changes. Reads the codebase, creates a task checklist in the Todo pane using `todowrite`, and stops. This is a thinking tool, not a file writer.
10
+
11
+ When to use this instead of `/plan-explore` then `/plan-propose`:
12
+ - The task is clear and well-scoped (not a half-formed idea)
13
+ - You don't need to think through alternatives or investigate deeply
14
+ - You want a task list in under a minute, not a full proposal
15
+
16
+ ## Step 1: Understand the task
17
+
18
+ Read the user's description. Use `glob` and `grep` to locate the relevant files, components, and patterns in the codebase. Read the key files to understand what exists and what needs to change.
19
+
20
+ ## Step 2: Create the plan in the Todo pane
21
+
22
+ Use `todowrite` to create one todo item per task. Each item must be:
23
+
24
+ - Concrete and actionable: include file paths or areas in the task text when possible
25
+ - Ordered by logical dependency: dependencies first
26
+ - Granular: one clear action per item, not a bundle
27
+
28
+ Example `todowrite` call:
29
+
30
+ ```json
31
+ {
32
+ "todos": [
33
+ { "content": "Add Project model to src/types.ts", "status": "pending", "priority": "high" },
34
+ { "content": "Add projectId field to LoopOptions in src/types.ts", "status": "pending", "priority": "high" },
35
+ { "content": "Create Project RPC endpoints in src/rpc/project/", "status": "pending", "priority": "medium" },
36
+ { "content": "Build Accept page UI in src/board/components/CreateForm.tsx", "status": "pending", "priority": "medium" },
37
+ { "content": "Run typecheck and fix errors", "status": "pending", "priority": "low" }
38
+ ]
39
+ }
40
+ ```
41
+
42
+ ## Step 3: Ask what's next
43
+
44
+ Call the `question` tool:
45
+
46
+ ```json
47
+ {
48
+ "questions": [
49
+ {
50
+ "header": "What next",
51
+ "question": "What next?",
52
+ "options": [
53
+ { "label": "/plan-apply", "description": "Implement these tasks now (creates a feature branch and works through them)." },
54
+ { "label": "/plan-propose", "description": "Turn this into a full OpenSpec proposal with agent assignments." },
55
+ { "label": "Start on specific tasks", "description": "Tell me which tasks to start on." }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ Do not create any files. Do not run `/plan-apply` or `/plan-propose` automatically. The only output is the Todo pane checklist.