@plainconceptsplatform/agent-harness 2.4.1 → 2.5.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 (81) hide show
  1. package/README.md +435 -437
  2. package/cli/fragments/archive/az.md +97 -95
  3. package/cli/fragments/archive/gh.md +96 -94
  4. package/cli/fragments/archive/gl.md +96 -94
  5. package/cli/fragments/archive/none.md +75 -73
  6. package/cli/fragments/guardrails/codegraph.md +5 -7
  7. package/cli/fragments/guardrails/humanizer.md +4 -4
  8. package/cli/fragments/guardrails/memory.md +4 -4
  9. package/cli/fragments/guardrails/rtk.md +3 -3
  10. package/cli/fragments/guardrails/simple-english.md +4 -4
  11. package/cli/fragments/ops-backlog/az.md +1 -1
  12. package/cli/fragments/ops-backlog/gh.md +1 -1
  13. package/cli/fragments/ops-backlog/jira.md +1 -1
  14. package/cli/fragments/ops-evidence/az.md +44 -41
  15. package/cli/fragments/ops-evidence/gh.md +54 -53
  16. package/cli/fragments/ops-evidence/jira.md +42 -38
  17. package/cli/fragments/ops-review/az.md +1 -1
  18. package/cli/fragments/ops-review/gh.md +1 -1
  19. package/cli/fragments/ops-review/gl.md +1 -1
  20. package/cli/fragments/ops-ship/az.md +81 -80
  21. package/cli/fragments/ops-ship/gh.md +68 -68
  22. package/cli/fragments/ops-ship/gl.md +85 -85
  23. package/cli/presets/agents-content.json +34 -53
  24. package/cli/steps/copy/agents.js +18 -17
  25. package/cli/steps/copy/opencode-json.js +5 -1
  26. package/cli/steps/copy/skills.js +98 -5
  27. package/cli/steps/optimization/patch-guardrails.js +5 -3
  28. package/cli/utils/copy.js +8 -3
  29. package/cli/utils/update-manifest.js +28 -2
  30. package/harness/.agents/skills/pc-guardrails-generic/SKILL.md +47 -68
  31. package/harness/.agents/skills/pc-make-architecture/SKILL.md +31 -51
  32. package/harness/.agents/skills/pc-make-design/SKILL.md +45 -68
  33. package/harness/.agents/skills/pc-make-engineer/SKILL.md +59 -219
  34. package/harness/.agents/skills/pc-make-engineer/signal-mapping.md +53 -68
  35. package/harness/.agents/skills/pc-make-engineer/template.md +42 -80
  36. package/harness/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -18
  37. package/harness/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -29
  38. package/harness/.agents/skills/pc-make-guardrails/SKILL.md +43 -74
  39. package/harness/.agents/skills/pc-make-guardrails/category-reference.md +10 -5
  40. package/harness/.agents/skills/pc-make-merge-risk-assess/category-reference.md +26 -7
  41. package/harness/.agents/skills/pc-make-user-model/SKILL.md +56 -66
  42. package/harness/.agents/skills/pc-ops-evidence/SKILL.md +133 -127
  43. package/harness/.agents/skills/pc-plan-apply/SKILL.md +14 -5
  44. package/harness/.agents/skills/pc-plan-apply/simple-mode.md +21 -21
  45. package/harness/.agents/skills/pc-plan-archive/SKILL.md +66 -66
  46. package/harness/.agents/skills/pc-plan-explore/SKILL.md +19 -2
  47. package/harness/.agents/skills/pc-plan-goal/SKILL.md +7 -5
  48. package/harness/.agents/skills/pc-plan-goal/output-mode.md +1 -0
  49. package/harness/.agents/skills/pc-plan-goal/output.md +71 -65
  50. package/harness/.agents/skills/pc-plan-propose/SKILL.md +1 -1
  51. package/harness/.agents/skills/pc-plan-quick/SKILL.md +46 -62
  52. package/harness/.agents/skills/pc-plan-story/SKILL.md +48 -149
  53. package/harness/.agents/skills/pc-repo-help/SKILL.md +89 -91
  54. package/harness/.agents/skills/pc-repo-initialize/SKILL.md +112 -130
  55. package/harness/.agents/skills/pc-repo-onboard/SKILL.md +32 -87
  56. package/harness/.agents/skills/pc-repo-verify/SKILL.md +2 -0
  57. package/harness/.agents/skills/pc-userstory-az/SKILL.md +71 -157
  58. package/harness/.agents/skills/pc-userstory-browser/SKILL.md +50 -122
  59. package/harness/.agents/skills/pc-userstory-gh/SKILL.md +63 -120
  60. package/harness/.agents/skills/pc-userstory-jira/SKILL.md +74 -131
  61. package/harness/.opencode/commands/init.md +5 -5
  62. package/harness/.opencode/commands/make-architecture.md +5 -5
  63. package/harness/.opencode/commands/make-design.md +5 -5
  64. package/harness/.opencode/commands/make-engineer.md +5 -5
  65. package/harness/.opencode/commands/make-evidence-scaffold.md +5 -5
  66. package/harness/.opencode/commands/make-guardrails.md +5 -5
  67. package/harness/.opencode/commands/make-user-model.md +5 -5
  68. package/harness/.opencode/commands/plan-apply.md +9 -9
  69. package/harness/.opencode/commands/plan-goal.md +5 -5
  70. package/harness/.opencode/commands/plan-quick.md +5 -5
  71. package/harness/.opencode/commands/plan-story.md +9 -9
  72. package/harness/.opencode/commands/repo-audit.md +5 -5
  73. package/harness/.opencode/commands/repo-initialize.md +5 -5
  74. package/harness/.opencode/commands/repo-onboard.md +5 -5
  75. package/harness/.opencode/commands/repo-verify.md +5 -5
  76. package/harness/.opencode/plugins/pc-subagent-monitor.js +82 -2
  77. package/harness/.opencode/plugins/pc-subagent-tiers.js +9 -6
  78. package/harness/.opencode/plugins/pc-system-reminders.js +312 -3
  79. package/harness/AGENTS.md +49 -71
  80. package/harness/opencode.jsonc +1 -1
  81. package/package.json +1 -1
@@ -1,95 +1,97 @@
1
- 2. **Find the oldest change with a completed PR**
2
-
3
- List unarchived changes (top-level only, excludes `archive/`):
4
-
5
- ```bash
6
- find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
- ```
8
-
9
- If empty, report a blocker and stop.
10
-
11
- List completed PRs:
12
-
13
- ```bash
14
- az repos pr list --repository {repo} --status completed --query "sort_by(@, &closedDate)[].{name:title,sourceRefName:sourceRefName,closedDate:closedDate,pullRequestId:pullRequestId}"
15
- ```
16
-
17
- Match each change to a completed PR using its ID and slug as search hints:
18
- - No match → skip (record as blocked: `no merged PR found`).
19
- - One match → eligible.
20
- - Multiple matches → ask the user which PR belongs to that change.
21
-
22
- If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `closedDate` as the candidate.
23
-
24
- 3. **Confirm the candidate**
25
-
26
- Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
27
-
28
- ```text
29
- Oldest unarchived merged change found:
30
- ID: {change-id}
31
- Title: {title from resolved PR}
32
- PR ID: {pullRequestId}
33
- Merged: {closedDate}
34
-
35
- Proceed with archiving? [yes/no]
36
- ```
37
-
38
- Stop if the user does not confirm.
39
-
40
- 4. **Archive the change**
41
-
42
- ```bash
43
- git checkout -b archive/{change-id}
44
- ```
45
-
46
- Load `@openspec-archive-change` skill and follow it to archive the change.
47
-
48
- 5. **Update docs**
49
-
50
- Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
-
52
- 6. **Create the archive PR**
53
-
54
- ```bash
55
- git add -A
56
- git commit -m "archive: {title} ({change-id})"
57
- git push origin archive/{change-id}
58
-
59
- az repos pr create \
60
- --repository {repo} \
61
- --source-branch refs/heads/archive/{change-id} \
62
- --target-branch "refs/heads/$DEFAULT_BRANCH" \
63
- --title "archive: {title} ({change-id})" \
64
- --description "Archive SDD artifacts for {change-id} after merge of {sourceRefName}." \
65
- --auto-complete
66
- ```
67
-
68
- If work was stashed in step 1, restore it after the PR is created unless the user opts out.
69
-
70
- 7. **Report**
71
-
72
- Display:
73
-
74
- ```text
75
- Archive complete
76
-
77
- Change ID: {change-id}
78
- Title: {title}
79
- Original PR: {original-pr-link}
80
- Archive PR: {archive-pr-link}
81
-
82
- Documentation updates:
83
- - ARCHITECTURE.md: {count} changes applied
84
- - DESIGN.md: {count} changes applied
85
- ```
86
-
87
- ## Rules
88
-
89
- - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
90
- - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
91
- - Use change ID and slug only as search hints; do not assume the source branch name.
92
- - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
93
- - Never proceed if the selected PR is not completed.
94
- - Never use browser tools or direct web requests for Azure DevOps. Use `az` CLI only.
95
- - Never invent or guess PR, branch, or merge metadata.
1
+ 2. **Find the oldest change with a completed PR**
2
+
3
+ List unarchived changes (top-level only, excludes `archive/`):
4
+
5
+ ```bash
6
+ find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
+ ```
8
+
9
+ If empty, report a blocker and stop.
10
+
11
+ List completed PRs:
12
+
13
+ ```bash
14
+ az repos pr list --repository {repo} --status completed --query "sort_by(@, &closedDate)[].{name:title,sourceRefName:sourceRefName,closedDate:closedDate,pullRequestId:pullRequestId}"
15
+ ```
16
+
17
+ Match each change to a completed PR using its ID and slug as search hints:
18
+ - No match → skip (record as blocked: `no merged PR found`).
19
+ - One match → eligible.
20
+ - Multiple matches → ask the user which PR belongs to that change.
21
+
22
+ If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `closedDate` as the candidate.
23
+
24
+ 3. **Confirm the candidate**
25
+
26
+ Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
27
+
28
+ ```text
29
+ Oldest unarchived merged change found:
30
+ ID: {change-id}
31
+ Title: {title from resolved PR}
32
+ PR ID: {pullRequestId}
33
+ Merged: {closedDate}
34
+
35
+ Proceed with archiving? [yes/no]
36
+ ```
37
+
38
+ Stop if the user does not confirm.
39
+
40
+ 4. **Archive the change**
41
+
42
+ ```bash
43
+ git checkout -b archive/{change-id}
44
+ ```
45
+
46
+ Load `@openspec-archive-change` skill and follow it to archive the change.
47
+
48
+ 5. **Update docs**
49
+
50
+ Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
+
52
+ 6. **Create the archive PR**
53
+
54
+ ```bash
55
+ # Stage specific paths only: a shared tree may hold another agent's or a
56
+ # person's edits, and -A commits them under this message.
57
+ git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
58
+ git commit -m "archive: {title} ({change-id})"
59
+ git push origin archive/{change-id}
60
+
61
+ az repos pr create \
62
+ --repository {repo} \
63
+ --source-branch refs/heads/archive/{change-id} \
64
+ --target-branch "refs/heads/$DEFAULT_BRANCH" \
65
+ --title "archive: {title} ({change-id})" \
66
+ --description "Archive SDD artifacts for {change-id} after merge of {sourceRefName}." \
67
+ --auto-complete
68
+ ```
69
+
70
+ If work was stashed in step 1, restore it after the PR is created unless the user opts out.
71
+
72
+ 7. **Report**
73
+
74
+ Display:
75
+
76
+ ```text
77
+ Archive complete
78
+
79
+ Change ID: {change-id}
80
+ Title: {title}
81
+ Original PR: {original-pr-link}
82
+ Archive PR: {archive-pr-link}
83
+
84
+ Documentation updates:
85
+ - ARCHITECTURE.md: {count} changes applied
86
+ - DESIGN.md: {count} changes applied
87
+ ```
88
+
89
+ ## Rules
90
+
91
+ - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
92
+ - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
93
+ - Use change ID and slug only as search hints; do not assume the source branch name.
94
+ - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
95
+ - Never proceed if the selected PR is not completed.
96
+ - Never use browser tools or direct web requests for Azure DevOps. Use `az` CLI only.
97
+ - Never invent or guess PR, branch, or merge metadata.
@@ -1,94 +1,96 @@
1
- 2. **Find the oldest change with a completed PR**
2
-
3
- List unarchived changes (top-level only, excludes `archive/`):
4
-
5
- ```bash
6
- find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
- ```
8
-
9
- If empty, report a blocker and stop.
10
-
11
- List completed PRs:
12
-
13
- ```bash
14
- gh pr list --repo {owner}/{repo} --state merged --json title,headRefName,mergedAt,number --jq 'sort_by(.mergedAt) | .[] | {name: .title, sourceRefName: .headRefName, mergedAt: .mergedAt, pullRequestId: .number}'
15
- ```
16
-
17
- Match each change to a completed PR using its ID and slug as search hints:
18
- - No match → skip (record as blocked: `no merged PR found`).
19
- - One match → eligible.
20
- - Multiple matches → ask the user which PR belongs to that change.
21
-
22
- If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `mergedAt` as the candidate.
23
-
24
- 3. **Confirm the candidate**
25
-
26
- Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
27
-
28
- ```text
29
- Oldest unarchived merged change found:
30
- ID: {change-id}
31
- Title: {title from resolved PR}
32
- PR ID: {pullRequestId}
33
- Merged: {mergedAt}
34
-
35
- Proceed with archiving? [yes/no]
36
- ```
37
-
38
- Stop if the user does not confirm.
39
-
40
- 4. **Archive the change**
41
-
42
- ```bash
43
- git checkout -b archive/{change-id}
44
- ```
45
-
46
- Load `@openspec-archive-change` skill and follow it to archive the change.
47
-
48
- 5. **Update docs**
49
-
50
- Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
-
52
- 6. **Create the archive PR**
53
-
54
- ```bash
55
- git add -A
56
- git commit -m "archive: {title} ({change-id})"
57
- git push origin archive/{change-id}
58
-
59
- gh pr create \
60
- --repo {owner}/{repo} \
61
- --base "$DEFAULT_BRANCH" \
62
- --head archive/{change-id} \
63
- --title "archive: {title} ({change-id})" \
64
- --body "Archive SDD artifacts for {change-id} after merge."
65
- ```
66
-
67
- If work was stashed in step 1, restore it after the PR is created unless the user opts out.
68
-
69
- 7. **Report**
70
-
71
- Display:
72
-
73
- ```text
74
- Archive complete
75
-
76
- Change ID: {change-id}
77
- Title: {title}
78
- Original PR: {original-pr-link}
79
- Archive PR: {archive-pr-link}
80
-
81
- Documentation updates:
82
- - ARCHITECTURE.md: {count} changes applied
83
- - DESIGN.md: {count} changes applied
84
- ```
85
-
86
- ## Rules
87
-
88
- - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
89
- - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
90
- - Use change ID and slug only as search hints; do not assume the source branch name.
91
- - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
92
- - Never proceed if the selected PR is not completed.
93
- - Never use browser tools or direct web requests for GitHub. Use `gh` CLI only.
94
- - Never invent or guess PR, branch, or merge metadata.
1
+ 2. **Find the oldest change with a completed PR**
2
+
3
+ List unarchived changes (top-level only, excludes `archive/`):
4
+
5
+ ```bash
6
+ find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
+ ```
8
+
9
+ If empty, report a blocker and stop.
10
+
11
+ List completed PRs:
12
+
13
+ ```bash
14
+ gh pr list --repo {owner}/{repo} --state merged --json title,headRefName,mergedAt,number --jq 'sort_by(.mergedAt) | .[] | {name: .title, sourceRefName: .headRefName, mergedAt: .mergedAt, pullRequestId: .number}'
15
+ ```
16
+
17
+ Match each change to a completed PR using its ID and slug as search hints:
18
+ - No match → skip (record as blocked: `no merged PR found`).
19
+ - One match → eligible.
20
+ - Multiple matches → ask the user which PR belongs to that change.
21
+
22
+ If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `mergedAt` as the candidate.
23
+
24
+ 3. **Confirm the candidate**
25
+
26
+ Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
27
+
28
+ ```text
29
+ Oldest unarchived merged change found:
30
+ ID: {change-id}
31
+ Title: {title from resolved PR}
32
+ PR ID: {pullRequestId}
33
+ Merged: {mergedAt}
34
+
35
+ Proceed with archiving? [yes/no]
36
+ ```
37
+
38
+ Stop if the user does not confirm.
39
+
40
+ 4. **Archive the change**
41
+
42
+ ```bash
43
+ git checkout -b archive/{change-id}
44
+ ```
45
+
46
+ Load `@openspec-archive-change` skill and follow it to archive the change.
47
+
48
+ 5. **Update docs**
49
+
50
+ Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
+
52
+ 6. **Create the archive PR**
53
+
54
+ ```bash
55
+ # Stage specific paths only: a shared tree may hold another agent's or a
56
+ # person's edits, and -A commits them under this message.
57
+ git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
58
+ git commit -m "archive: {title} ({change-id})"
59
+ git push origin archive/{change-id}
60
+
61
+ gh pr create \
62
+ --repo {owner}/{repo} \
63
+ --base "$DEFAULT_BRANCH" \
64
+ --head archive/{change-id} \
65
+ --title "archive: {title} ({change-id})" \
66
+ --body "Archive SDD artifacts for {change-id} after merge."
67
+ ```
68
+
69
+ If work was stashed in step 1, restore it after the PR is created unless the user opts out.
70
+
71
+ 7. **Report**
72
+
73
+ Display:
74
+
75
+ ```text
76
+ Archive complete
77
+
78
+ Change ID: {change-id}
79
+ Title: {title}
80
+ Original PR: {original-pr-link}
81
+ Archive PR: {archive-pr-link}
82
+
83
+ Documentation updates:
84
+ - ARCHITECTURE.md: {count} changes applied
85
+ - DESIGN.md: {count} changes applied
86
+ ```
87
+
88
+ ## Rules
89
+
90
+ - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
91
+ - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
92
+ - Use change ID and slug only as search hints; do not assume the source branch name.
93
+ - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
94
+ - Never proceed if the selected PR is not completed.
95
+ - Never use browser tools or direct web requests for GitHub. Use `gh` CLI only.
96
+ - Never invent or guess PR, branch, or merge metadata.
@@ -1,94 +1,96 @@
1
- 2. **Find the oldest change with a completed MR**
2
-
3
- List unarchived changes (top-level only, excludes `archive/`):
4
-
5
- ```bash
6
- find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
- ```
8
-
9
- If empty, report a blocker and stop.
10
-
11
- List completed merge requests:
12
-
13
- ```bash
14
- glab mr list --repo {owner}/{repo} --merged --output json --jq 'sort_by(.merged_at) | .[] | {name: .title, sourceRefName: .source_branch, mergedAt: .merged_at, mergeRequestId: .iid}'
15
- ```
16
-
17
- Match each change to a completed MR using its ID and slug as search hints:
18
- - No match → skip (record as blocked: `no merged MR found`).
19
- - One match → eligible.
20
- - Multiple matches → ask the user which MR belongs to that change.
21
-
22
- If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** MR `merged_at` as the candidate.
23
-
24
- 3. **Confirm the candidate**
25
-
26
- Show the candidate (ID, title, MR ID, merged date) and any blocked changes, then ask:
27
-
28
- ```text
29
- Oldest unarchived merged change found:
30
- ID: {change-id}
31
- Title: {title from resolved MR}
32
- MR ID: {iid}
33
- Merged: {merged_at}
34
-
35
- Proceed with archiving? [yes/no]
36
- ```
37
-
38
- Stop if the user does not confirm.
39
-
40
- 4. **Archive the change**
41
-
42
- ```bash
43
- git checkout -b archive/{change-id}
44
- ```
45
-
46
- Load `@openspec-archive-change` skill and follow it to archive the change.
47
-
48
- 5. **Update docs**
49
-
50
- Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
-
52
- 6. **Create the archive MR**
53
-
54
- ```bash
55
- git add -A
56
- git commit -m "archive: {title} ({change-id})"
57
- git push origin archive/{change-id}
58
-
59
- glab mr create \
60
- --repo {owner}/{repo} \
61
- --source-branch "archive/{change-id}" \
62
- --target-branch "$DEFAULT_BRANCH" \
63
- --title "archive: {title} ({change-id})" \
64
- --description "Archive SDD artifacts for {change-id} after merge."
65
- ```
66
-
67
- If work was stashed in step 1, restore it after the MR is created unless the user opts out.
68
-
69
- 7. **Report**
70
-
71
- Display:
72
-
73
- ```text
74
- Archive complete
75
-
76
- Change ID: {change-id}
77
- Title: {title}
78
- Original MR: {original-mr-link}
79
- Archive MR: {archive-mr-link}
80
-
81
- Documentation updates:
82
- - ARCHITECTURE.md: {count} changes applied
83
- - DESIGN.md: {count} changes applied
84
- ```
85
-
86
- ## Rules
87
-
88
- - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
89
- - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
90
- - Use change ID and slug only as search hints; do not assume the source branch name.
91
- - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which MR if multiple match one change).
92
- - Never proceed if the selected MR is not completed.
93
- - Never use browser tools or direct web requests for GitLab. Use `glab` CLI only.
94
- - Never invent or guess MR, branch, or merge metadata.
1
+ 2. **Find the oldest change with a completed MR**
2
+
3
+ List unarchived changes (top-level only, excludes `archive/`):
4
+
5
+ ```bash
6
+ find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
7
+ ```
8
+
9
+ If empty, report a blocker and stop.
10
+
11
+ List completed merge requests:
12
+
13
+ ```bash
14
+ glab mr list --repo {owner}/{repo} --merged --output json --jq 'sort_by(.merged_at) | .[] | {name: .title, sourceRefName: .source_branch, mergedAt: .merged_at, mergeRequestId: .iid}'
15
+ ```
16
+
17
+ Match each change to a completed MR using its ID and slug as search hints:
18
+ - No match → skip (record as blocked: `no merged MR found`).
19
+ - One match → eligible.
20
+ - Multiple matches → ask the user which MR belongs to that change.
21
+
22
+ If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** MR `merged_at` as the candidate.
23
+
24
+ 3. **Confirm the candidate**
25
+
26
+ Show the candidate (ID, title, MR ID, merged date) and any blocked changes, then ask:
27
+
28
+ ```text
29
+ Oldest unarchived merged change found:
30
+ ID: {change-id}
31
+ Title: {title from resolved MR}
32
+ MR ID: {iid}
33
+ Merged: {merged_at}
34
+
35
+ Proceed with archiving? [yes/no]
36
+ ```
37
+
38
+ Stop if the user does not confirm.
39
+
40
+ 4. **Archive the change**
41
+
42
+ ```bash
43
+ git checkout -b archive/{change-id}
44
+ ```
45
+
46
+ Load `@openspec-archive-change` skill and follow it to archive the change.
47
+
48
+ 5. **Update docs**
49
+
50
+ Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
51
+
52
+ 6. **Create the archive MR**
53
+
54
+ ```bash
55
+ # Stage specific paths only: a shared tree may hold another agent's or a
56
+ # person's edits, and -A commits them under this message.
57
+ git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
58
+ git commit -m "archive: {title} ({change-id})"
59
+ git push origin archive/{change-id}
60
+
61
+ glab mr create \
62
+ --repo {owner}/{repo} \
63
+ --source-branch "archive/{change-id}" \
64
+ --target-branch "$DEFAULT_BRANCH" \
65
+ --title "archive: {title} ({change-id})" \
66
+ --description "Archive SDD artifacts for {change-id} after merge."
67
+ ```
68
+
69
+ If work was stashed in step 1, restore it after the MR is created unless the user opts out.
70
+
71
+ 7. **Report**
72
+
73
+ Display:
74
+
75
+ ```text
76
+ Archive complete
77
+
78
+ Change ID: {change-id}
79
+ Title: {title}
80
+ Original MR: {original-mr-link}
81
+ Archive MR: {archive-mr-link}
82
+
83
+ Documentation updates:
84
+ - ARCHITECTURE.md: {count} changes applied
85
+ - DESIGN.md: {count} changes applied
86
+ ```
87
+
88
+ ## Rules
89
+
90
+ - All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
91
+ - Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
92
+ - Use change ID and slug only as search hints; do not assume the source branch name.
93
+ - The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which MR if multiple match one change).
94
+ - Never proceed if the selected MR is not completed.
95
+ - Never use browser tools or direct web requests for GitLab. Use `glab` CLI only.
96
+ - Never invent or guess MR, branch, or merge metadata.