@plainconceptsplatform/agent-harness 3.9.0 → 3.11.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 (145) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +555 -551
  3. package/cli/commands/join.js +259 -259
  4. package/cli/commands/migrate.js +310 -310
  5. package/cli/commands/shared.js +27 -27
  6. package/cli/commands/single.js +79 -79
  7. package/cli/commands/update.js +121 -121
  8. package/cli/commands/wizard.js +134 -134
  9. package/cli/fragments/archive/az.md +97 -97
  10. package/cli/fragments/archive/gh.md +96 -96
  11. package/cli/fragments/archive/gl.md +96 -96
  12. package/cli/fragments/archive/none.md +75 -75
  13. package/cli/fragments/guardrails/codegraph.md +5 -5
  14. package/cli/fragments/guardrails/humanizer.md +4 -4
  15. package/cli/fragments/guardrails/memory.md +4 -4
  16. package/cli/fragments/guardrails/rtk.md +3 -3
  17. package/cli/fragments/guardrails/simple-english.md +4 -4
  18. package/cli/fragments/ops-backlog/az.md +28 -28
  19. package/cli/fragments/ops-backlog/gh.md +28 -28
  20. package/cli/fragments/ops-backlog/jira.md +28 -28
  21. package/cli/fragments/ops-review/az.md +62 -62
  22. package/cli/fragments/ops-review/gh.md +51 -51
  23. package/cli/fragments/ops-review/gl.md +55 -55
  24. package/cli/fragments/ops-ship/az.md +81 -81
  25. package/cli/fragments/ops-ship/gh.md +67 -67
  26. package/cli/fragments/ops-ship/gl.md +84 -84
  27. package/cli/index.js +116 -116
  28. package/cli/presets/agents-content.json +34 -34
  29. package/cli/presets/browser.json +10 -10
  30. package/cli/presets/clean.json +21 -21
  31. package/cli/presets/models.json +68 -68
  32. package/cli/presets/optimization.json +32 -32
  33. package/cli/presets/platforms.json +76 -76
  34. package/cli/presets/source.json +23 -23
  35. package/cli/steps/browser/index.js +52 -48
  36. package/cli/steps/clean/index.js +120 -120
  37. package/cli/steps/copy/agents.js +176 -176
  38. package/cli/steps/copy/commands.js +79 -79
  39. package/cli/steps/copy/fullstack-engineer.js +81 -81
  40. package/cli/steps/copy/index.js +88 -88
  41. package/cli/steps/copy/opencode-json.js +359 -324
  42. package/cli/steps/copy/skills.js +353 -316
  43. package/cli/steps/metadata/index.js +115 -115
  44. package/cli/steps/models/format.js +88 -88
  45. package/cli/steps/models/index.js +64 -64
  46. package/cli/steps/models/write.js +38 -38
  47. package/cli/steps/openspec/index.js +136 -136
  48. package/cli/steps/optimization/codegraph.js +141 -141
  49. package/cli/steps/optimization/detect.js +66 -66
  50. package/cli/steps/optimization/humanizer.js +17 -17
  51. package/cli/steps/optimization/index.js +158 -158
  52. package/cli/steps/optimization/memory.js +91 -91
  53. package/cli/steps/optimization/patch-guardrails.js +111 -111
  54. package/cli/steps/optimization/simple-english.js +17 -17
  55. package/cli/steps/optimization/skills-lock.js +30 -30
  56. package/cli/steps/platform/index.js +109 -109
  57. package/cli/steps/source/index.js +123 -123
  58. package/cli/utils/agent-color.js +111 -111
  59. package/cli/utils/copy.js +134 -134
  60. package/cli/utils/exec-spinner.js +47 -47
  61. package/cli/utils/exec.js +134 -134
  62. package/cli/utils/legacy-check.js +30 -30
  63. package/cli/utils/models-cache.js +58 -58
  64. package/cli/utils/models-pricing.js +42 -42
  65. package/cli/utils/paths.js +82 -82
  66. package/cli/utils/process.js +3 -3
  67. package/cli/utils/terminal.js +6 -6
  68. package/cli/utils/update-manifest.js +75 -75
  69. package/harness/.opencode/_gitignore +12 -12
  70. package/harness/.opencode/commands/init.md +5 -5
  71. package/harness/.opencode/commands/make-architecture.md +5 -5
  72. package/harness/.opencode/commands/make-design.md +5 -5
  73. package/harness/.opencode/commands/make-engineer.md +5 -5
  74. package/harness/.opencode/commands/make-guardrails.md +5 -5
  75. package/harness/.opencode/commands/make-user-model.md +5 -5
  76. package/harness/.opencode/commands/ops-backlog.md +10 -10
  77. package/harness/.opencode/commands/ops-review.md +10 -10
  78. package/harness/.opencode/commands/ops-ship.md +9 -9
  79. package/harness/.opencode/commands/plan-apply.md +9 -9
  80. package/harness/.opencode/commands/plan-archive.md +7 -7
  81. package/harness/.opencode/commands/plan-explore.md +11 -11
  82. package/harness/.opencode/commands/plan-goal.md +5 -5
  83. package/harness/.opencode/commands/plan-mockup.md +11 -0
  84. package/harness/.opencode/commands/plan-propose.md +11 -11
  85. package/harness/.opencode/commands/plan-quick.md +7 -7
  86. package/harness/.opencode/commands/plan-story.md +11 -11
  87. package/harness/.opencode/commands/repo-audit.md +7 -7
  88. package/harness/.opencode/commands/repo-help.md +5 -5
  89. package/harness/.opencode/commands/repo-initialize.md +5 -5
  90. package/harness/.opencode/commands/repo-onboard.md +5 -5
  91. package/harness/.opencode/commands/repo-verify.md +5 -5
  92. package/harness/.opencode/plugins/pc-commit-coauthor.js +41 -41
  93. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  94. package/harness/.opencode/plugins/pc-system-reminders.js +424 -424
  95. package/harness/.opencode/scripts/check-diff.mjs +305 -305
  96. package/harness/.opencode/scripts/code-rules.mjs +288 -288
  97. package/harness/.opencode/scripts/platform-contract.mjs +366 -366
  98. package/harness/AGENTS.md +55 -55
  99. package/harness/ARCHITECTURE.md +13 -13
  100. package/harness/DESIGN.md +13 -13
  101. package/harness/opencode.jsonc +37 -36
  102. package/harness/openspec/config.yaml +20 -20
  103. package/harness/skills-lock.json +23 -17
  104. package/package.json +14 -12
  105. package/skills/README.md +18 -18
  106. package/skills/agent-harness-cli/SKILL.md +86 -86
  107. package/skills/browser-automation/SKILL.md +100 -72
  108. package/skills/pc-guardrails-generic/SKILL.md +53 -53
  109. package/skills/pc-guardrails-project/SKILL.md +8 -8
  110. package/skills/pc-make-architecture/SKILL.md +33 -33
  111. package/skills/pc-make-architecture/structure-template.md +64 -64
  112. package/skills/pc-make-design/SKILL.md +45 -45
  113. package/skills/pc-make-engineer/SKILL.md +59 -59
  114. package/skills/pc-make-engineer/signal-mapping.md +53 -53
  115. package/skills/pc-make-engineer/template.md +36 -36
  116. package/skills/pc-make-guardrails/SKILL.md +44 -44
  117. package/skills/pc-make-guardrails/category-reference.md +112 -112
  118. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  119. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  120. package/skills/pc-make-user-model/SKILL.md +56 -56
  121. package/skills/pc-ops-ship/SKILL.md +22 -22
  122. package/skills/pc-plan-apply/SKILL.md +92 -90
  123. package/skills/pc-plan-apply/simple-mode.md +21 -21
  124. package/skills/pc-plan-archive/SKILL.md +66 -66
  125. package/skills/pc-plan-explore/SKILL.md +22 -21
  126. package/skills/pc-plan-goal/SKILL.md +91 -91
  127. package/skills/pc-plan-goal/branching.md +39 -39
  128. package/skills/pc-plan-goal/failure-policy.md +30 -30
  129. package/skills/pc-plan-goal/output-mode.md +10 -10
  130. package/skills/pc-plan-goal/output.md +71 -71
  131. package/skills/pc-plan-mockup/SKILL.md +85 -0
  132. package/skills/pc-plan-mockup/mockup-contract.md +65 -0
  133. package/skills/pc-plan-propose/SKILL.md +127 -127
  134. package/skills/pc-plan-propose/task-annotation.md +39 -39
  135. package/skills/pc-plan-quick/SKILL.md +46 -46
  136. package/skills/pc-plan-story/SKILL.md +96 -93
  137. package/skills/pc-repo-audit/SKILL.md +44 -44
  138. package/skills/pc-repo-help/SKILL.md +90 -87
  139. package/skills/pc-repo-initialize/SKILL.md +119 -119
  140. package/skills/pc-repo-onboard/SKILL.md +32 -32
  141. package/skills/pc-repo-verify/SKILL.md +150 -150
  142. package/skills/pc-userstory-az/SKILL.md +71 -71
  143. package/skills/pc-userstory-browser/SKILL.md +73 -64
  144. package/skills/pc-userstory-gh/SKILL.md +63 -63
  145. package/skills/pc-userstory-jira/SKILL.md +74 -74
@@ -1,91 +1,91 @@
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 · 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 <paths> && 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
- Stage the paths a phase wrote; unscoped staging is denied (`pc-system-reminders`). A shared tree once put a Teams tool and its tests inside a commit named after a YAML input rename, so unreviewed work reached the default branch under a heading nobody would look twice at.
18
-
19
- Input: `$ARGUMENTS`
20
-
21
- <!-- PC-OPTIMIZATION-MEMORY-START -->
22
- <!-- PC-OPTIMIZATION-MEMORY-END -->
23
-
24
- ## Phase 0: Resolve input
25
-
26
- 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.
27
-
28
- - For a work-item URL or issue key with a configured backlog platform, load `@pc-userstory` and fetch the work item.
29
- - Otherwise, use the remaining text as the direct feature description.
30
- - Preserve title, description, work-item reference, and acceptance criteria as `{resolved_input}`.
31
- - Derive `{slug}` and classify scope as `focused`, `standard`, or `complex`.
32
-
33
- **Refined-issue detection:** set `{refined}` to `true` only when all three hold. The input came from a backlog work item, not free text. It contains at least one `Scenario:` with `Given` / `When` / `Then`. It names affected paths, and at least one of them exists in this repository. Anything less runs Phases 2 and 3 in full: `{refined}` skips a gate, so a near miss must fall back rather than guess.
34
-
35
- When it is `true`, the issue content is the proposal. Phase 2 is skipped and Phase 3 runs with `skip_specs: true`.
36
-
37
- ## Phase 1: Branch
38
-
39
- Follow the [branching procedure](branching.md) with `{slug}`. Record `$START_BRANCH`, `$DEFAULT_BRANCH`, `$BRANCH`, and whether the goal stash exists.
40
-
41
- ## Phase 2: Explore
42
-
43
- **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}"`.
44
-
45
- Load `pc-plan-explore` with `{resolved_input}` in autonomous mode. Require an in-memory `EXPLORATION_BRIEF` as its findings handoff to Phase 3.
46
-
47
- Tick `explore` when `pc-plan-explore` returns its findings handoff.
48
-
49
- ## Phase 3: Propose
50
-
51
- Load `pc-plan-propose` in autonomous mode with `{resolved_input}`, `EXPLORATION_BRIEF`, and `scope_classification`.
52
-
53
- **When `{refined}` is `true`,** pass the work item as the proposal body and set `skip_specs: true` in `.openspec.yaml`: the issue already carries the spec content. Propose still runs, because it owns task enrichment. A hand-written `tasks.md` has no `<!-- agent, depends_on, touches -->` annotations, and Phase 4 stops on a task whose worker is unresolved.
54
-
55
- Confirm its change directory and actionable `tasks.md` exist. Rename `$BRANCH` when the canonical change slug differs from `{slug}`, then commit the proposal:
56
-
57
- ```bash
58
- git add openspec/changes/{change-id}/ && git commit -m "propose: {title} ({change-id})"
59
- ```
60
-
61
- Tick `propose` when the proposal commit exists.
62
-
63
- ## Phase 4: Apply and verify
64
-
65
- Load `pc-plan-apply` in autonomous mode with `start_from: load-plan`. It owns worker resolution, subagent waves, commits, verification, and re-waves.
66
-
67
- Require it to return every task complete and `VERIFIED`, then load `pc-repo-verify`. Tick `apply` when apply returns `VERIFIED`. When `pc-repo-verify` returns `PLAN_WRITTEN` or `STUB_WRITTEN`, commit the plan, which the evidence workflow replays once the pull request merges, then tick `verify`:
68
-
69
- ```bash
70
- git add openspec/changes/{change-id}/verification-plan.md && git commit -m "verify: {title} ({change-id})"
71
- ```
72
-
73
- ## Phase 5: Archive
74
-
75
- Require `verify` and a clean working tree. Load `pc-plan-archive` in autonomous mode with `{change-id}`. It owns archive verification and retry.
76
-
77
- Require `ARCHIVED_OK` and the archive path, then commit:
78
-
79
- ```bash
80
- git add openspec/changes/ && git commit -m "archive: {title} ({change-id})"
81
- ```
82
-
83
- Tick `archive` when the archive commit exists.
84
-
85
- ## Phase 6: Output
86
-
87
- Follow the [output procedure](output.md) with the mode, branch values, change id, work-item reference, and archive path. Tick `output` only when its mode-specific postcondition holds.
88
-
89
- ## Phase 7: Report
90
-
91
- Print the final report from the [output procedure](output.md). Tick `report` only after every checklist item is complete.
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 · 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 <paths> && 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
+ Stage the paths a phase wrote; unscoped staging is denied (`pc-system-reminders`). A shared tree once put a Teams tool and its tests inside a commit named after a YAML input rename, so unreviewed work reached the default branch under a heading nobody would look twice at.
18
+
19
+ Input: `$ARGUMENTS`
20
+
21
+ <!-- PC-OPTIMIZATION-MEMORY-START -->
22
+ <!-- PC-OPTIMIZATION-MEMORY-END -->
23
+
24
+ ## Phase 0: Resolve input
25
+
26
+ 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.
27
+
28
+ - For a work-item URL or issue key with a configured backlog platform, load `@pc-userstory` and fetch the work item.
29
+ - Otherwise, use the remaining text as the direct feature description.
30
+ - Preserve title, description, work-item reference, and acceptance criteria as `{resolved_input}`.
31
+ - Derive `{slug}` and classify scope as `focused`, `standard`, or `complex`.
32
+
33
+ **Refined-issue detection:** set `{refined}` to `true` only when all three hold. The input came from a backlog work item, not free text. It contains at least one `Scenario:` with `Given` / `When` / `Then`. It names affected paths, and at least one of them exists in this repository. Anything less runs Phases 2 and 3 in full: `{refined}` skips a gate, so a near miss must fall back rather than guess.
34
+
35
+ When it is `true`, the issue content is the proposal. Phase 2 is skipped and Phase 3 runs with `skip_specs: true`.
36
+
37
+ ## Phase 1: Branch
38
+
39
+ Follow the [branching procedure](branching.md) with `{slug}`. Record `$START_BRANCH`, `$DEFAULT_BRANCH`, `$BRANCH`, and whether the goal stash exists.
40
+
41
+ ## Phase 2: Explore
42
+
43
+ **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}"`.
44
+
45
+ Load `pc-plan-explore` with `{resolved_input}` in autonomous mode. Require an in-memory `EXPLORATION_BRIEF` as its findings handoff to Phase 3.
46
+
47
+ Tick `explore` when `pc-plan-explore` returns its findings handoff.
48
+
49
+ ## Phase 3: Propose
50
+
51
+ Load `pc-plan-propose` in autonomous mode with `{resolved_input}`, `EXPLORATION_BRIEF`, and `scope_classification`.
52
+
53
+ **When `{refined}` is `true`,** pass the work item as the proposal body and set `skip_specs: true` in `.openspec.yaml`: the issue already carries the spec content. Propose still runs, because it owns task enrichment. A hand-written `tasks.md` has no `<!-- agent, depends_on, touches -->` annotations, and Phase 4 stops on a task whose worker is unresolved.
54
+
55
+ Confirm its change directory and actionable `tasks.md` exist. Rename `$BRANCH` when the canonical change slug differs from `{slug}`, then commit the proposal:
56
+
57
+ ```bash
58
+ git add openspec/changes/{change-id}/ && git commit -m "propose: {title} ({change-id})"
59
+ ```
60
+
61
+ Tick `propose` when the proposal commit exists.
62
+
63
+ ## Phase 4: Apply and verify
64
+
65
+ Load `pc-plan-apply` in autonomous mode with `start_from: load-plan`. It owns worker resolution, subagent waves, commits, verification, and re-waves.
66
+
67
+ Require it to return every task complete and `VERIFIED`, then load `pc-repo-verify`. Tick `apply` when apply returns `VERIFIED`. When `pc-repo-verify` returns `PLAN_WRITTEN` or `STUB_WRITTEN`, commit the plan, which the evidence workflow replays once the pull request merges, then tick `verify`:
68
+
69
+ ```bash
70
+ git add openspec/changes/{change-id}/verification-plan.md && git commit -m "verify: {title} ({change-id})"
71
+ ```
72
+
73
+ ## Phase 5: Archive
74
+
75
+ Require `verify` and a clean working tree. Load `pc-plan-archive` in autonomous mode with `{change-id}`. It owns archive verification and retry.
76
+
77
+ Require `ARCHIVED_OK` and the archive path, then commit:
78
+
79
+ ```bash
80
+ git add openspec/changes/ && git commit -m "archive: {title} ({change-id})"
81
+ ```
82
+
83
+ Tick `archive` when the archive commit exists.
84
+
85
+ ## Phase 6: Output
86
+
87
+ Follow the [output procedure](output.md) with the mode, branch values, change id, work-item reference, and archive path. Tick `output` only when its mode-specific postcondition holds.
88
+
89
+ ## Phase 7: Report
90
+
91
+ Print the final report from the [output procedure](output.md). Tick `report` only after every checklist item is complete.
@@ -1,39 +1,39 @@
1
- # Branching procedure
2
-
3
- Resolve and record the branch names. If the invoking workflow already placed you on a feature branch (`feature/*`, `fix/*`, etc.), it owns the branch: do not stash, switch, pull, or rename. The sandbox hosting the workflow has no git credentials, so those commands would either corrupt the tree or hang, and the workflow has already cut the branch from the default branch. Treat its result as given.
4
-
5
- ```bash
6
- BRANCH="$(git branch --show-current)"
7
- case "$BRANCH" in
8
- feature/*|fix/*|chore/*|docs/*|refactor/*)
9
- START_BRANCH="$BRANCH"
10
- DEFAULT_BRANCH="$BRANCH"
11
- GOAL_STASH="none"
12
- ;;
13
- *)
14
- START_BRANCH="$BRANCH"
15
- DEFAULT_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')"
16
- [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH="main"
17
-
18
- # Stash uncommitted work when needed and record that the goal stash exists.
19
- git stash push -u -m "goal-wip"
20
- GOAL_STASH="goal-wip"
21
-
22
- # Create the feature branch from the synchronized default branch.
23
- git switch "$DEFAULT_BRANCH"
24
-
25
- if git remote get-url origin >/dev/null 2>&1; then
26
- git pull origin "$DEFAULT_BRANCH"
27
- fi
28
-
29
- git switch -c "feature/{slug}"
30
- BRANCH="$(git branch --show-current)"
31
- ;;
32
- esac
33
- ```
34
-
35
- Record the branch name and that `feature/{slug}` was applied unconditionally, so downstream phases can restore if they move off it.
36
-
37
- Everything through archive happens on `$BRANCH`.
38
-
39
- When a later phase renames `$BRANCH` to match the canonical change slug (Phase 3 of `pc-plan-goal`), skip the rename if the workflow already fixed the name. Renaming would call `git branch -m`, which a credentialless sandbox refuses, and the workflow's `create_pull_request` is told to use the branch as named. Detect this by checking that `$BRANCH` already starts with `feature/`; if it does, keep it.
1
+ # Branching procedure
2
+
3
+ Resolve and record the branch names. If the invoking workflow already placed you on a feature branch (`feature/*`, `fix/*`, etc.), it owns the branch: do not stash, switch, pull, or rename. The sandbox hosting the workflow has no git credentials, so those commands would either corrupt the tree or hang, and the workflow has already cut the branch from the default branch. Treat its result as given.
4
+
5
+ ```bash
6
+ BRANCH="$(git branch --show-current)"
7
+ case "$BRANCH" in
8
+ feature/*|fix/*|chore/*|docs/*|refactor/*)
9
+ START_BRANCH="$BRANCH"
10
+ DEFAULT_BRANCH="$BRANCH"
11
+ GOAL_STASH="none"
12
+ ;;
13
+ *)
14
+ START_BRANCH="$BRANCH"
15
+ DEFAULT_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')"
16
+ [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH="main"
17
+
18
+ # Stash uncommitted work when needed and record that the goal stash exists.
19
+ git stash push -u -m "goal-wip"
20
+ GOAL_STASH="goal-wip"
21
+
22
+ # Create the feature branch from the synchronized default branch.
23
+ git switch "$DEFAULT_BRANCH"
24
+
25
+ if git remote get-url origin >/dev/null 2>&1; then
26
+ git pull origin "$DEFAULT_BRANCH"
27
+ fi
28
+
29
+ git switch -c "feature/{slug}"
30
+ BRANCH="$(git branch --show-current)"
31
+ ;;
32
+ esac
33
+ ```
34
+
35
+ Record the branch name and that `feature/{slug}` was applied unconditionally, so downstream phases can restore if they move off it.
36
+
37
+ Everything through archive happens on `$BRANCH`.
38
+
39
+ When a later phase renames `$BRANCH` to match the canonical change slug (Phase 3 of `pc-plan-goal`), skip the rename if the workflow already fixed the name. Renaming would call `git branch -m`, which a credentialless sandbox refuses, and the workflow's `create_pull_request` is told to use the branch as named. Detect this by checking that `$BRANCH` already starts with `feature/`; if it does, keep it.
@@ -1,30 +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.
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.
@@ -1,10 +1,10 @@
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
- - `branch`: remove the token, keep the feature branch, merge nothing and push nothing.
8
- - Any other first token: keep the full input and merge locally into the default branch.
9
-
10
- Words such as "push notifications" or "PR template" inside the feature description are feature data. They do not change output mode.
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
+ - `branch`: remove the token, keep the feature branch, merge nothing and push nothing.
8
+ - Any other first token: keep the full input and merge locally into the default branch.
9
+
10
+ Words such as "push notifications" or "PR template" inside the feature description are feature data. They do not change output mode.
@@ -1,71 +1,71 @@
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.
25
-
26
- ## Push mode
27
-
28
- Push the feature branch:
29
-
30
- ```bash
31
- git push -u origin "$BRANCH"
32
- ```
33
-
34
- 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, and commits. Do not merge the PR.
39
-
40
- Restore the stash.
41
-
42
- ## Branch mode
43
-
44
- Leave `$BRANCH` in place with its commits. Merge nothing, push nothing, delete nothing.
45
-
46
- Restore the stash.
47
-
48
- ## Final report
49
-
50
- Print:
51
-
52
- ```text
53
- Goal: {title}
54
- Change ID: {change-id}
55
- Scope classification: focused | standard | complex
56
- Functional outcome: {one-sentence result}
57
- Branch: {branch}
58
- Tasks: {completed}/{total}
59
- Acceptance criteria: {passed}/{total}
60
- Commits: {proposal, apply, archive}
61
- Verification: passed | failed
62
- Archived: yes | no
63
- Archive path: {path or none}
64
- Output mode: default | push | pr | branch
65
- Final state: merged locally | pushed branch | PR URL | branch preserved | branch preserved after failure
66
- Stash restoration: not needed | restored | preserved after conflict
67
- ```
68
-
69
- ## External gate
70
-
71
- An unattended caller must verify `openspec list --json` is empty and run the project's lint and typecheck commands before any later git operation.
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.
25
+
26
+ ## Push mode
27
+
28
+ Push the feature branch:
29
+
30
+ ```bash
31
+ git push -u origin "$BRANCH"
32
+ ```
33
+
34
+ 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, and commits. Do not merge the PR.
39
+
40
+ Restore the stash.
41
+
42
+ ## Branch mode
43
+
44
+ Leave `$BRANCH` in place with its commits. Merge nothing, push nothing, delete nothing.
45
+
46
+ Restore the stash.
47
+
48
+ ## Final report
49
+
50
+ Print:
51
+
52
+ ```text
53
+ Goal: {title}
54
+ Change ID: {change-id}
55
+ Scope classification: focused | standard | complex
56
+ Functional outcome: {one-sentence result}
57
+ Branch: {branch}
58
+ Tasks: {completed}/{total}
59
+ Acceptance criteria: {passed}/{total}
60
+ Commits: {proposal, apply, archive}
61
+ Verification: passed | failed
62
+ Archived: yes | no
63
+ Archive path: {path or none}
64
+ Output mode: default | push | pr | branch
65
+ Final state: merged locally | pushed branch | PR URL | branch preserved | branch preserved after failure
66
+ Stash restoration: not needed | restored | preserved after conflict
67
+ ```
68
+
69
+ ## External gate
70
+
71
+ 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,85 @@
1
+ ---
2
+ name: pc-plan-mockup
3
+ description: Build a self-contained HTML mockup of a UI change from this repository's own design tokens and components, so a person and the implementing agent agree on the experience before any code is written. The mockup states UX intent, not a spec. Use when a feature touches the frontend and the layout, flow or states are worth seeing. Invoked by the /plan-mockup command (interactive) and by the refine workflow (autonomous).
4
+ license: MIT
5
+ ---
6
+
7
+ Draw the change before building it. The mockup answers one question: is this the experience we mean? It is never the implementation. The real components, `DESIGN.md` and `ARCHITECTURE.md` decide how it is built, and the mockup tells the implementer which of those components each part of the screen should be.
8
+
9
+ [The contract](mockup-contract.md) defines the files, the HTML rules and `mockup.json`. Read it before writing anything.
10
+
11
+ ## Input
12
+
13
+ A feature idea, an exploration brief from `/plan-explore`, a story from `/plan-story`, or an issue. Ask what screen or flow to draw only when none of those says.
14
+
15
+ ## Modes
16
+
17
+ - `interactive` (default): the person is here. Show the mockup, ask what to change, iterate until they are happy.
18
+ - `autonomous`: a workflow called this skill and gave an output directory. Ask nothing. Write `index.html` and `mockup.json` there and stop.
19
+
20
+ <!-- PC-OPTIMIZATION-MEMORY-START -->
21
+ <!-- PC-OPTIMIZATION-MEMORY-END -->
22
+
23
+ ## Rules
24
+
25
+ - Never use a component, colour or font the repository does not have. When the screen needs something that does not exist, mark it `new:<Name>` so the implementer knows it is new work.
26
+ - Never load anything from outside the file, and never use a utility framework runtime. Plain CSS from the tokens keeps it approximate, and approximate is the point.
27
+ - Never touch the source tree. The mockup lives in `.mockups/` locally and on the `mockups` branch once published.
28
+ - Data is invented. No real names, customers or email addresses, even ones the conversation used.
29
+
30
+ ## Flow
31
+
32
+ 1. **Tokens.** Find `DESIGN.md` at the root, or in `ai/` or `docs/`. Read its frontmatter by meaning, not by exact key: `color.primitives.brand-blue` and `color.primitive.brand_blue` are the same token. If it is missing or still the placeholder, in interactive mode run `/make-design` first; in autonomous mode read the theme stylesheet the web app imports and set `designSource` to `theme-css`.
33
+
34
+ 2. **Components.** List the UI components the area uses: the shared UI folder (often `src/shared/ui/` or `src/components/ui/`), the feature's own components, and the packages they import from. Read the few the screen needs, enough to draw them with the right anatomy (a table's header and pagination, a sheet's footer actions), never to copy their code.
35
+
36
+ 3. **States.** Decide which states the scenario can reach: empty, loading, error, success, disabled, mobile, or one the issue names. Draw only those.
37
+
38
+ 4. **Method.** If `@html-prototype` is installed, load it and use it in mockup mode for how to scope the flow, model states and check widths. This skill stays the authority on look and components.
39
+
40
+ 5. **Write.** `index.html` and `mockup.json`, as the contract says. Tag every region with `data-mockup-section` and every component stand-in with `data-component`. Interactive mode writes to `.mockups/<slug>/` and adds `.mockups/` to `.gitignore` when it is missing; autonomous mode writes to the directory it was given.
41
+
42
+ 6. **Check.** Open the file at 1440 and 390 pixels wide, with `@browser-automation` when it is available, and save `desktop.png` and `mobile.png` beside it. Look for overflow, unreadable contrast and empty regions. Without a browser, say which checks did not run.
43
+
44
+ 7. **Hand off.** In interactive mode, show the screenshots and the component table (section, element, component, path), then ask what next.
45
+
46
+ ## Publish
47
+
48
+ When the person picks Publish, or names an issue, put the folder on the `mockups` branch so the refine and implement workflows find it:
49
+
50
+ ```bash
51
+ issue=<number>
52
+ dir=$(mktemp -d)
53
+ git fetch origin mockups 2>/dev/null || true
54
+ if git rev-parse --verify -q origin/mockups >/dev/null; then
55
+ git worktree add "$dir" origin/mockups --detach
56
+ else
57
+ git worktree add --detach "$dir" && git -C "$dir" checkout --orphan mockups && git -C "$dir" rm -rfq .
58
+ fi
59
+ rm -rf "$dir/issue-$issue" && mkdir -p "$dir/issue-$issue"
60
+ cp .mockups/<slug>/* "$dir/issue-$issue/"
61
+ git -C "$dir" add "issue-$issue"
62
+ git -C "$dir" commit -m "mockup: issue #$issue [skip ci]"
63
+ git -C "$dir" push origin HEAD:refs/heads/mockups
64
+ git worktree remove --force "$dir"
65
+ ```
66
+
67
+ Set `issue` in `mockup.json` before copying. Then comment on the issue with a link to `issue-<number>/index.html` on that branch, the desktop screenshot when there is one, the component table and the line `UX mockup: intent, not a spec. Build with the components listed.` Use the repository's platform CLI for the comment; when there is none, give the person the text to paste.
68
+
69
+ ## Contracts
70
+
71
+ ```json
72
+ {
73
+ "questions": [
74
+ {
75
+ "header": "What next",
76
+ "question": "What next?",
77
+ "options": [
78
+ { "label": "Change the mockup", "description": "Say what to move, add or remove." },
79
+ { "label": "/plan-story", "description": "Write the user story, with this mockup in its UX section." },
80
+ { "label": "Publish", "description": "Put the mockup on the mockups branch and link it from an issue." }
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ ```
@@ -0,0 +1,65 @@
1
+ # Mockup contract
2
+
3
+ What a mockup folder holds, so the people and the workflows that read it can rely on it. The agentic workflows validate a mockup against this file before they render or publish it; a mockup that breaks it is dropped, never fixed up.
4
+
5
+ ## Files
6
+
7
+ | File | Required | What it is |
8
+ |---|---|---|
9
+ | `index.html` | yes | The mockup. One file, opens offline in any browser. |
10
+ | `mockup.json` | yes | What the mockup claims, in a form a workflow can read without parsing HTML. |
11
+ | `desktop.png`, `mobile.png` | no | Screenshots at 1440 and 390 pixels wide. The refine workflow renders them itself when they are missing. |
12
+
13
+ ## `index.html`
14
+
15
+ - One self-contained file under 400 KB. Styles sit in one inline `<style>`; a small inline `<script>` is allowed for toggling states.
16
+ - Nothing is loaded from anywhere: no `http://` or `https://` URL, no `<script src>`, no `<link href>` to a stylesheet, no web font, no image file. Icons are inline SVG or text.
17
+ - Colours, radii, spacing and type come from the repository's design tokens, declared once as CSS custom properties on `:root` (and `.dark` when the repository has a dark mode). No utility framework runtime, Tailwind included: the mockup is approximate on purpose, and a runtime would make it look more authoritative than it is.
18
+ - The first element in `<body>` is a banner reading `UX mockup: intent, not a spec`.
19
+ - Every screen region carries `data-mockup-section="<id>"`, a kebab-case id unique in the file.
20
+ - Every element that stands for a real component carries `data-component="<reference>"`:
21
+ - a path relative to the repository root for a component the repository owns, such as `apps/web/src/shared/ui/button.tsx`;
22
+ - a package export for a component it imports, such as `@plainconceptsplatform/ui-components/data-table`;
23
+ - `new:<Name>` for a component that does not exist yet and the change has to build.
24
+ - Data is fictional and internally consistent. No real person, customer, email address or identifier.
25
+
26
+ ## `mockup.json`
27
+
28
+ ```json
29
+ {
30
+ "version": 1,
31
+ "title": "Claim timeline panel",
32
+ "issue": 42,
33
+ "designSource": "DESIGN.md",
34
+ "sections": [
35
+ { "id": "timeline", "purpose": "Every status change of the claim, newest first" }
36
+ ],
37
+ "components": [
38
+ { "section": "timeline", "element": "Status chip", "component": "Badge", "path": "apps/web/src/shared/ui/badge.tsx" },
39
+ { "section": "timeline", "element": "Timeline row", "component": "new:TimelineItem", "path": "new" }
40
+ ],
41
+ "states": ["empty", "loading", "mobile"],
42
+ "notes": "The approver's comment is collapsed past three lines."
43
+ }
44
+ ```
45
+
46
+ | Field | Rule |
47
+ |---|---|
48
+ | `version` | `1`. |
49
+ | `title` | Short name of the screen or flow. |
50
+ | `issue` | The issue number, or `null` before there is one. |
51
+ | `designSource` | `DESIGN.md`, `theme-css` (tokens read from the theme stylesheet because `DESIGN.md` was missing) or `none`. |
52
+ | `sections` | One entry per `data-mockup-section` in the HTML, same ids, same order. |
53
+ | `components` | One entry per distinct `data-component` reference. `component` is the name the code uses; `path` is the reference from the HTML, or `new`. |
54
+ | `states` | The states the mockup draws, from `default`, `empty`, `loading`, `error`, `success`, `disabled`, `mobile`, or a domain state named in the issue. |
55
+ | `notes` | Optional. Behaviour the picture cannot show. |
56
+
57
+ ## When the work is split
58
+
59
+ Each smaller issue covers some sections of the one mockup. Its body says which, on a line of its own: `Mockup sections: timeline, filters`, using the section ids. The refine workflow reads that line and links the issue to those sections.
60
+
61
+ ## Where a published mockup lives
62
+
63
+ On the repository's `mockups` branch, an orphan branch that never merges into anything, at `issue-<number>/`. Every publish replaces that folder. Nothing on that branch is source code, and nothing in the source tree may import or copy from it.
64
+
65
+ The issue links it from a section the workflow writes between `<!-- agent-mockup:start -->` and `<!-- agent-mockup:end -->`, which opens with `<!-- agent-mockup: issue-<number> -->` naming the folder. A split child names its parent's folder there.