@plainconceptsplatform/agent-harness 3.5.0 → 3.7.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 (144) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +471 -454
  3. package/cli/commands/join.js +259 -259
  4. package/cli/commands/migrate.js +310 -310
  5. package/cli/commands/shared.js +27 -27
  6. package/cli/commands/single.js +79 -79
  7. package/cli/commands/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 +48 -48
  36. package/cli/steps/clean/index.js +120 -120
  37. package/cli/steps/copy/agents.js +120 -120
  38. package/cli/steps/copy/commands.js +79 -79
  39. package/cli/steps/copy/fullstack-engineer.js +89 -89
  40. package/cli/steps/copy/index.js +88 -88
  41. package/cli/steps/copy/opencode-json.js +324 -324
  42. package/cli/steps/copy/skills.js +316 -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 +81 -81
  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 +10 -10
  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-propose.md +11 -11
  84. package/harness/.opencode/commands/plan-quick.md +7 -7
  85. package/harness/.opencode/commands/plan-story.md +11 -11
  86. package/harness/.opencode/commands/repo-audit.md +7 -7
  87. package/harness/.opencode/commands/repo-help.md +5 -5
  88. package/harness/.opencode/commands/repo-initialize.md +5 -5
  89. package/harness/.opencode/commands/repo-onboard.md +5 -5
  90. package/harness/.opencode/commands/repo-verify.md +5 -5
  91. package/harness/.opencode/package.json +5 -5
  92. package/harness/.opencode/plugins/pc-commit-coauthor.js +41 -0
  93. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  94. package/harness/.opencode/plugins/pc-subagent-tiers.js +367 -367
  95. package/harness/.opencode/plugins/pc-system-reminders.js +404 -386
  96. package/harness/.opencode/scripts/check-diff.mjs +279 -252
  97. package/harness/.opencode/scripts/code-rules.mjs +288 -288
  98. package/harness/.opencode/scripts/platform-manifest.mjs +112 -0
  99. package/harness/AGENTS.md +49 -49
  100. package/harness/ARCHITECTURE.md +13 -13
  101. package/harness/DESIGN.md +13 -13
  102. package/harness/opencode.jsonc +36 -36
  103. package/harness/openspec/config.yaml +20 -20
  104. package/harness/skills-lock.json +17 -17
  105. package/package.json +14 -12
  106. package/skills/README.md +18 -18
  107. package/skills/agent-harness-cli/SKILL.md +86 -86
  108. package/skills/browser-automation/SKILL.md +72 -72
  109. package/skills/pc-guardrails-generic/SKILL.md +53 -53
  110. package/skills/pc-guardrails-project/SKILL.md +8 -8
  111. package/skills/pc-make-architecture/SKILL.md +33 -32
  112. package/skills/pc-make-architecture/structure-template.md +64 -64
  113. package/skills/pc-make-design/SKILL.md +45 -45
  114. package/skills/pc-make-engineer/SKILL.md +59 -59
  115. package/skills/pc-make-engineer/signal-mapping.md +53 -53
  116. package/skills/pc-make-engineer/template.md +36 -36
  117. package/skills/pc-make-guardrails/SKILL.md +44 -44
  118. package/skills/pc-make-guardrails/category-reference.md +112 -112
  119. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  120. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  121. package/skills/pc-make-user-model/SKILL.md +56 -56
  122. package/skills/pc-ops-ship/SKILL.md +22 -22
  123. package/skills/pc-plan-apply/SKILL.md +88 -88
  124. package/skills/pc-plan-apply/simple-mode.md +21 -21
  125. package/skills/pc-plan-archive/SKILL.md +66 -66
  126. package/skills/pc-plan-explore/SKILL.md +21 -21
  127. package/skills/pc-plan-goal/SKILL.md +91 -91
  128. package/skills/pc-plan-goal/branching.md +39 -39
  129. package/skills/pc-plan-goal/failure-policy.md +30 -30
  130. package/skills/pc-plan-goal/output-mode.md +10 -10
  131. package/skills/pc-plan-goal/output.md +71 -71
  132. package/skills/pc-plan-propose/SKILL.md +125 -125
  133. package/skills/pc-plan-propose/task-annotation.md +39 -39
  134. package/skills/pc-plan-quick/SKILL.md +46 -46
  135. package/skills/pc-plan-story/SKILL.md +93 -93
  136. package/skills/pc-repo-audit/SKILL.md +44 -44
  137. package/skills/pc-repo-help/SKILL.md +87 -87
  138. package/skills/pc-repo-initialize/SKILL.md +119 -119
  139. package/skills/pc-repo-onboard/SKILL.md +32 -32
  140. package/skills/pc-repo-verify/SKILL.md +150 -150
  141. package/skills/pc-userstory-az/SKILL.md +71 -71
  142. package/skills/pc-userstory-browser/SKILL.md +64 -64
  143. package/skills/pc-userstory-gh/SKILL.md +63 -63
  144. 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.