@homericintelligence/athena-opencode 0.4.4 → 0.5.1

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 (136) hide show
  1. package/README.md +30 -17
  2. package/package.json +2 -2
  3. package/plugin.js +20 -5
  4. package/skills/TECHNICAL_ENGLISH.md +78 -0
  5. package/skills/_cli.py +26 -18
  6. package/skills/_support/docs/dependency-resolution.md +192 -0
  7. package/skills/_support/docs/policies/development.md +117 -0
  8. package/skills/_support/docs/policies/evidence-integrity.md +40 -0
  9. package/skills/_support/docs/principles/README.md +542 -0
  10. package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
  11. package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
  12. package/skills/_support/docs/principles/details/p003-dry.md +126 -0
  13. package/skills/_support/docs/principles/details/p004-solid.md +165 -0
  14. package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
  15. package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
  16. package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
  17. package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
  18. package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
  19. package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
  20. package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
  21. package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
  22. package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
  23. package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
  24. package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
  25. package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
  26. package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
  27. package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
  28. package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
  29. package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
  30. package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
  31. package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
  32. package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
  33. package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
  34. package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
  35. package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
  36. package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
  37. package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
  38. package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
  39. package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
  40. package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
  41. package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
  42. package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
  43. package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
  44. package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
  45. package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
  46. package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
  47. package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
  48. package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
  49. package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
  50. package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
  51. package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
  52. package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
  53. package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
  54. package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
  55. package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
  56. package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
  57. package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
  58. package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
  59. package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
  60. package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
  61. package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
  62. package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
  63. package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
  64. package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
  65. package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
  66. package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
  67. package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
  68. package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
  69. package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
  70. package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
  71. package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
  72. package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
  73. package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
  74. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +129 -0
  75. package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
  76. package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
  77. package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
  78. package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
  79. package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
  80. package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
  81. package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
  82. package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
  83. package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
  84. package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
  85. package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
  86. package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
  87. package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
  88. package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
  89. package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
  90. package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
  91. package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
  92. package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
  93. package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
  94. package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
  95. package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
  96. package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
  97. package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
  98. package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
  99. package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
  100. package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
  101. package/skills/_support/docs/review/README.md +59 -0
  102. package/skills/_support/docs/review/behavior-first-testing.md +73 -0
  103. package/skills/_support/docs/review/common.md +365 -0
  104. package/skills/_support/docs/review/design-docs.md +74 -0
  105. package/skills/_support/docs/review/issue-planning.md +220 -0
  106. package/skills/_support/docs/review/language-routing.md +141 -0
  107. package/skills/_support/docs/review/repository-scorecard.md +170 -0
  108. package/skills/advise/SKILL.md +102 -40
  109. package/skills/advise/scripts/list_retrievable_skills.py +3 -3
  110. package/skills/brainstorm/SKILL.md +167 -76
  111. package/skills/change-review/SKILL.md +99 -43
  112. package/skills/change-review/references/scope-resolution.md +70 -41
  113. package/skills/change-review/scripts/resolve_scope.py +119 -73
  114. package/skills/finalize-plan/SKILL.md +208 -100
  115. package/skills/git-worktrees/SKILL.md +108 -59
  116. package/skills/git-worktrees/scripts/prepare_worktree.py +16 -10
  117. package/skills/issue-review/SKILL.md +143 -47
  118. package/skills/learn/SKILL.md +284 -162
  119. package/skills/myrmidon-swarm/SKILL.md +136 -61
  120. package/skills/plan-issue/SKILL.md +129 -47
  121. package/skills/pr-review/SKILL.md +170 -71
  122. package/skills/pr-review/references/criteria.md +61 -14
  123. package/skills/pr-review/references/delivery.md +159 -80
  124. package/skills/pr-review/references/evidence.md +268 -139
  125. package/skills/pr-review/references/prevalidated.md +91 -48
  126. package/skills/pr-review/scripts/collect_evidence.py +211 -140
  127. package/skills/pr-review/scripts/diff_context.py +6 -4
  128. package/skills/pr-review/scripts/materialize_snapshot.py +112 -120
  129. package/skills/pr-review/scripts/pr_identity.py +27 -15
  130. package/skills/pr-review/scripts/resolve_pr.py +53 -31
  131. package/skills/repo-review/SKILL.md +209 -87
  132. package/skills/systematic-debugging/SKILL.md +195 -131
  133. package/skills/systematic-debugging/scripts/repository_evidence.py +9 -4
  134. package/skills/test-driven-development/SKILL.md +134 -53
  135. package/skills/tidy/SKILL.md +97 -33
  136. package/skills/tidy/scripts/run_tidy.py +3 -3
@@ -1,129 +1,237 @@
1
1
  ---
2
2
  name: finalize-plan
3
3
  license: BSD-3-Clause
4
- description: Materialize one exact, actor-owned, GO-reviewed issue-planning epoch into its implementation-facing issue body. Use after plan-issue and issue-review approve a plan; `--draft` is read-only and every missing, foreign, stale, ambiguous, or unverifiable input fails closed.
4
+ description: Create an issue body after `plan-issue` and `issue-review` approve one exact actor-owned epoch with `GO`. `--draft` is read-only. Stop if an input is missing, foreign, stale, ambiguous, or not verifiable.
5
5
  argument-hint: "[--draft] ISSUE_NUMBER_OR_URL"
6
6
  allowed-tools: [Read, Bash, Grep, Glob]
7
7
  ---
8
8
 
9
9
  # Finalize an approved issue plan
10
10
 
11
- Why: an approved plan should be the readable implementation entry point without
12
- turning review history, suggestions, or a generated body into new requirements.
13
-
14
- Use the shared [issue-planning contract](../../docs/review/issue-planning.md),
15
- [review contract](../../docs/review/common.md),
16
- [design-document structure](../../docs/review/design-docs.md),
17
- [language routing](../../docs/review/language-routing.md), and
18
- [behavior-first testing](../../docs/review/behavior-first-testing.md).
11
+ Purpose: Make the approved plan the implementation entry point. Do not convert review history,
12
+ suggestions, or generated text into requirements.
13
+
14
+ Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to all
15
+ prose that it produces.
16
+
17
+ Use the shared [issue-planning contract](../_support/docs/review/issue-planning.md),
18
+ [review contract](../_support/docs/review/common.md),
19
+ [design-document structure](../_support/docs/review/design-docs.md),
20
+ [language routing](../_support/docs/review/language-routing.md), and
21
+ [behavior-first testing](../_support/docs/review/behavior-first-testing.md).
22
+
23
+ ## Engineering principles
24
+
25
+ Use the canonical [engineering-principles catalog](../_support/docs/principles/README.md) to make these
26
+ finalization decisions:
27
+
28
+ - [P010 Scope Fidelity](../_support/docs/principles/README.md#p010): Change only the issue body and the two
29
+ sealed, actor-owned comments for the verified epoch.
30
+ - [P061 Separate Decision from High-Impact Execution](../_support/docs/principles/README.md#p061): Before a
31
+ write, make sure that the epoch and authority agree with this skill's delivery contract.
32
+ - [P062 Human Approval for Irreversible or High-Risk Actions](../_support/docs/principles/README.md#p062):
33
+ If the delivery contract gives authority for the write, continue without a second approval.
34
+ - [P063 Requirement-to-Code Traceability](../_support/docs/principles/README.md#p063): Map each source
35
+ requirement to the issue body without information loss.
36
+ - [P065 Verify Before Claiming Completion](../_support/docs/principles/README.md#p065): Before you report
37
+ that finalization is completed, read the issue body. Make sure that it is the same as the approved
38
+ body.
39
+ - [P044 Atomicity Where Possible](../_support/docs/principles/README.md#p044): Use one body update for the
40
+ replacement.
41
+ - [P083 Irreversible Actions Last](../_support/docs/principles/README.md#p083): Do not remove an applicable
42
+ comment before you verify the body update.
43
+ - [P031 Propagate Rather Than Swallow](../_support/docs/principles/README.md#p031): Report each partial or
44
+ unknown outcome. Do not report a different outcome. Do not automatically retry the update.
19
45
 
20
46
  ## Scope and delivery
21
47
 
22
- `--draft` is read-only. Without it, this skill may replace the resolved issue
23
- body once and, only after exact body readback, delete the two sealed,
24
- actor-owned plan and review comments. It must not update the title, labels,
25
- assignment, milestone, project fields, state, branches, pull requests, or
26
- repository files. The finalized body retains the required provenance after
27
- those intermediate comments are removed.
28
-
29
- Use the forge's native issue-body mechanism. If the host cannot authenticate the
30
- actor, enumerate and delete exact comments, read the issue body, compare
31
- identities, or make and read back one exact body update, return a
32
- ready-to-publish draft and identify the capability gap. Never create, adopt,
33
- edit, or replace plan or review comments to make finalization possible.
48
+ `--draft` is read-only. If you do not use `--draft`, first revalidate the authority and target under
49
+ [P061 Separate Decision from High-Impact Execution](../_support/docs/principles/README.md#p061). This skill
50
+ can then replace the resolved issue body one time. Only after an exact body readback, it can delete
51
+ the two sealed, actor-owned plan and review comments. Do not update these items:
52
+
53
+ - title;
54
+ - labels;
55
+ - assignment;
56
+ - milestone;
57
+ - project fields;
58
+ - state;
59
+ - branches;
60
+ - pull requests; or
61
+ - repository files.
62
+
63
+ After the skill removes the intermediate comments, the finalized body must retain the required
64
+ provenance.
65
+
66
+ Use the forge's native issue-body mechanism. The host must have these capabilities:
67
+
68
+ - authenticate the actor;
69
+ - enumerate exact comments;
70
+ - delete exact comments;
71
+ - read the issue body;
72
+ - compare identities;
73
+ - make one exact body update; and
74
+ - read back that body update.
75
+
76
+ If one capability is not available, return a ready-to-publish draft. Identify the capability gap.
77
+ Do not create plan or review comments to make finalization possible. Do not adopt plan or review
78
+ comments for this purpose. Do not edit plan or review comments for this purpose. Do not replace plan
79
+ or review comments for this purpose.
34
80
 
35
81
  ## Finalized planning epoch
36
82
 
37
- An epoch has these sealed source identities:
83
+ A planning epoch is one set of these sealed source identities:
38
84
 
39
- - `R`: the canonical digest of the original issue requirements: exact issue ID,
40
- title, body, and acceptance criteria before finalization;
41
- - `P`: one actor-owned `<!-- athena:plan-issue -->` comment ID and canonical
42
- plan-content digest; and
43
- - `V`: one actor-owned `<!-- athena:issue-review -->` comment ID and
44
- review-content digest.
85
+ - `R` is the canonical digest of the original issue requirements. It contains the exact issue ID,
86
+ title, body, and acceptance criteria before finalization.
87
+ - `P` identifies one actor-owned `<!-- athena:plan-issue -->` comment ID and its canonical plan-content
88
+ digest.
89
+ - `V` identifies one actor-owned `<!-- athena:issue-review -->` comment ID and its review-content
90
+ digest.
45
91
 
46
- The review must embed and exactly match the same issue, `R`, plan-comment ID,
47
- and `P`. It must have an exact `GO` disposition with no unresolved `critical`,
48
- `major`, or other `required` finding. A conditional, partial, malformed, stale,
49
- foreign, duplicated, absent, or unverifiable artifact is not authorization.
92
+ The review must contain the same issue, `R`, plan-comment ID, and `P`. These values must match
93
+ exactly. The review must have the exact `GO` disposition. It must not have an unresolved `critical`,
94
+ `major`, or other `required` finding. Do not write if an artifact is conditional, partial,
95
+ malformed, stale, foreign, duplicated, absent, or not verifiable.
50
96
 
51
- The rendered body records exactly one marker:
52
- `<!-- athena:finalize-plan R=<R> P=<P> V=<V> F=<F> -->`. Define `F` by hashing
53
- the final body after replacing that marker's `F` value with the literal
54
- `<F>` placeholder; do not hash a marker containing its own digest. The marker
55
- lets a host distinguish sealed source identities from the generated body and
56
- verify later readback without recursion.
97
+ Record exactly one marker in the rendered body:
98
+ `<!-- athena:finalize-plan R=<R> P=<P> V=<V> F=<F> -->`. Before you calculate `F`, use the literal
99
+ `<F>` placeholder as the marker's `F` value. Calculate `F` from the final body. Do not calculate a
100
+ digest from a marker that contains its own digest. The marker identifies the sealed source
101
+ identities separately from the generated body. It also permits later readback verification without
102
+ recursion.
57
103
 
58
104
  ## Finalize
59
105
 
60
- 1. Resolve one exact issue, including node or URL, title, body, state, and
61
- authenticated actor. Enumerate every current comment before interpreting a
62
- marker.
63
- 2. Resolve exactly one actor-owned plan marker and one actor-owned review marker.
64
- Compute `R`, `P`, and `V`, then verify the review's embedded bindings and
65
- clean GO result. Any ownership, multiplicity, binding, disposition, or
66
- required-finding failure returns no write.
67
- 3. Build a compact, lossless synthesis. Lead with **Why** (the preserved
68
- original problem, outcome, and non-negotiable requirements), then include a
69
- compact system-shape diagram only when it makes at least three relationships,
70
- boundaries, or state transitions materially clearer. Follow with architecture
71
- breakdown, implementation plan, operations, and provenance.
72
- 4. Preserve every acceptance criterion, implementation boundary, validation,
73
- migration or cutover step, rollback condition, dependency, residual risk, and
74
- out-of-scope decision. Record review suggestions as optional residual context
75
- unless the reviewed canonical plan already adopted them. Do not invent files,
76
- commands, requirements, architecture, implementation results, or validation
77
- evidence; do not copy historical revision transcripts or duplicate the plan
78
- and review verbatim when a smaller lossless synthesis suffices.
79
- 5. Add the finalized marker and compute `F` over its non-self-referential
80
- canonical representation. In `--draft`, return the complete body, `R/P/V/F`,
81
- source links, and all withheld-write reasons without invoking a forge write.
82
- 6. Immediately before publication, resolve the issue, actor, every comment and
83
- marker, `R/P/V`, review disposition, and target body again. If any input
84
- drifted, return the ready-to-publish body as stale; do not write.
85
- 7. Publish exactly one issue-body replacement. Read the issue back immediately
86
- and verify the exact body, marker, `R/P/V`, and `F`. A timeout, indeterminate
87
- response, or mismatched readback is an unknown outcome: do not retry or make
88
- another mutation.
89
- 8. After successful body readback, re-read each sealed comment by its exact ID,
90
- actor, marker, and digest, then delete the plan comment and review comment.
91
- Delete no foreign, replacement, or drifted comment. A failed, timed-out, or
92
- indeterminate deletion is a partial-cleanup unknown outcome: do not retry,
93
- compensate, or remove the finalized body; report the surviving identities.
94
-
95
- ## Re-finalization and restart
96
-
97
- If the live body exactly verifies its finalized marker and both sealed comments
98
- are absent, re-running for that epoch returns a documented no-change result. A
99
- surviving sealed comment is partial cleanup, not authorization to retry a prior
100
- deletion. If the marker is absent, malformed, foreign, or its canonical `F` does
101
- not match, the epoch is not valid evidence. A later material human edit is a new
102
- requirements state and must pass a fresh `plan-issue` plus `issue-review` cycle
103
- before another finalization. Do not treat generated plan text or provenance
104
- fields as newly authored requirements.
106
+ 1. Resolve one exact issue with its node or URL, title, body, state, and authenticated actor.
107
+ 2. Before you interpret a marker, enumerate each current comment.
108
+ 3. Resolve exactly one actor-owned plan marker.
109
+ 4. Resolve exactly one actor-owned review marker.
110
+ 5. Calculate `R/P/V`.
111
+ 6. Verify the review bindings and the clean `GO` result.
112
+ 7. If ownership, multiplicity, binding, disposition, or required-finding verification fails, do not
113
+ write.
114
+ 8. Build a compact and lossless final body.
115
+ 9. Apply [P001 KISS Keep It Simple, Stupid](../_support/docs/principles/README.md#p001) only to the
116
+ sealed content.
117
+ 10. Make the presentation simple.
118
+ 11. Do not remove a requirement.
119
+ 12. Do not change the meaning of the approved architecture.
120
+ 13. Start the final body with **Why**.
121
+ 14. Preserve the original problem, outcome, and requirements that cannot change.
122
+ 15. If a system diagram makes at least three relationships, boundaries, or state transitions
123
+ clearer, include it.
124
+ 16. Include the architecture description, implementation plan, operations, and provenance.
125
+ 17. Preserve all items in this list:
126
+
127
+ - acceptance criteria;
128
+ - implementation boundaries;
129
+ - validation;
130
+ - migration or cutover steps;
131
+ - rollback conditions;
132
+ - dependencies;
133
+ - residual risks; and
134
+ - out-of-scope decisions.
135
+
136
+ 18. Unless the reviewed canonical plan adopted a review suggestion, record the suggestion as optional
137
+ residual context.
138
+ 19. Do not invent files, commands, requirements, architecture, implementation results, or validation
139
+ evidence.
140
+ 20. If a smaller lossless result is sufficient, do not copy historical revision transcripts.
141
+ 21. If a smaller lossless result is sufficient, do not duplicate the plan and review verbatim.
142
+ 22. Add the finalized marker.
143
+ 23. Calculate `F` from its canonical representation that does not contain its own value.
144
+ 24. If the user selects `--draft`, return the complete body, `R`, `P`, `V`, `F`, and source links.
145
+ 25. For `--draft`, return all reasons for withheld writes.
146
+ 26. For `--draft`, do not make a forge write.
147
+ 27. Immediately before publication, apply
148
+ [P061 Separate Decision from High-Impact Execution](../_support/docs/principles/README.md#p061).
149
+ 28. For this check, resolve the issue, actor, each comment and marker, `R`, `P`, `V`, review
150
+ disposition, and target body again.
151
+ 29. If an input changed, return the ready-to-publish body with the `stale` status.
152
+ 30. After an input changes, do not write.
153
+ 31. Under [P044 Atomicity Where Possible](../_support/docs/principles/README.md#p044), publish exactly one
154
+ issue-body replacement.
155
+ 32. Immediately read the issue again.
156
+ 33. Under [P065 Verify Before Claiming Completion](../_support/docs/principles/README.md#p065), verify the
157
+ exact body, marker, `R`, `P`, `V`, and `F`.
158
+ 34. If a timeout, indeterminate response, or readback mismatch occurs, report `unknown-outcome`.
159
+ 35. After a timeout, indeterminate response, or readback mismatch, do not retry.
160
+ 36. After a timeout, indeterminate response, or readback mismatch, do not make another mutation.
161
+ 37. Only after a successful body readback, use
162
+ [P083 Irreversible Actions Last](../_support/docs/principles/README.md#p083) to read each sealed comment
163
+ again.
164
+ 38. Verify the exact ID, actor, marker, and digest of each sealed comment.
165
+ 39. Delete the plan comment only after its exact verification.
166
+ 40. Delete the review comment only after its exact verification.
167
+ 41. Do not delete a foreign, replacement, or changed comment.
168
+ 42. If deletion fails, times out, or has an indeterminate result, report `partial-cleanup`.
169
+ 43. State that an indeterminate deletion result is unknown.
170
+ 44. After a deletion failure, timeout, or indeterminate result, do not retry.
171
+ 45. After a deletion failure, timeout, or indeterminate result, do not compensate.
172
+ 46. After a deletion failure, timeout, or indeterminate result, do not remove the finalized body.
173
+ 47. After a deletion failure, timeout, or indeterminate result, report the identities of the comments
174
+ that remain.
175
+
176
+ If the final material contains architecture, test, error, or security decisions, preserve the
177
+ reviewed use of these principles:
178
+
179
+ - [P015 Architecture Conformance](../_support/docs/principles/README.md#p015);
180
+ - [P022 Test Behavior, Not Implementation](../_support/docs/principles/README.md#p022);
181
+ - [P029 Generalize Error Policy; Preserve Specific Cause](../_support/docs/principles/README.md#p029); and
182
+ - [P048 Secure by Design](../_support/docs/principles/README.md#p048).
183
+
184
+ Finalization does not reopen these decisions. Do not make new decisions.
185
+
186
+ ## Finalize again or restart
187
+
188
+ If the live body verifies its finalized marker exactly and both sealed comments are absent, a second
189
+ run returns a documented `no-change` result. If a sealed comment remains, report
190
+ `partial-cleanup`. Its presence does not authorize another deletion attempt. If the marker is absent,
191
+ malformed, foreign, or has a canonical `F` mismatch, do not use the epoch as evidence. A later
192
+ substantive edit by a person creates a new requirements state. Before another finalization, this new
193
+ state must pass a new `plan-issue` and `issue-review` cycle. Do not treat generated plan text or
194
+ provenance fields as new requirements from a person.
105
195
 
106
196
  ## Behavior-first verification
107
197
 
108
- Use controlled issue, comment, actor, and forge fixtures to demonstrate:
198
+ Use controlled issue, comment, actor, and forge fixtures to demonstrate these behaviors:
199
+
200
+ - A clean `GO` plan and review epoch preserves requirements and operational details.
201
+ - `--draft` returns the body without a forge mutation.
202
+ - Publication makes one body update. It verifies the exact readback. Then it deletes only the two
203
+ sealed actor-owned comments.
204
+ - A sealed epoch that did not change is idempotent.
205
+ - Each absent, foreign, duplicate, mismatched, stale, `NO-GO`, required-finding, drift,
206
+ unsupported-write, timeout, readback-mismatch, or deletion-uncertainty case stops before an unsafe
207
+ mutation or retry.
208
+
209
+ Verify the identities and order classes. Verify content preservation and the number and scope of
210
+ mutations. Verify that failures occur before a write. Do not make tests depend on editorial wording,
211
+ headings, paragraph counts, or an example issue body.
109
212
 
110
- - one clean GO plan/review epoch preserves requirements and operational details;
111
- - `--draft` returns the body without a forge mutation;
112
- - publish performs one body update, verifies its exact readback, then deletes
113
- only the two sealed actor-owned comments;
114
- - an unchanged sealed epoch is idempotent; and
115
- - every absent, foreign, duplicate, mismatched, stale, NO-GO, required-finding,
116
- drift, unsupported-write, timeout, readback-mismatch, or deletion-uncertainty
117
- case fails before an unsafe mutation or retry.
213
+ ## Failed approaches
118
214
 
119
- Assert identities, ordering classes, preservation, mutation count and scope, and
120
- failure-before-write behavior. Do not freeze editorial wording, headings,
121
- paragraph counts, or an example issue body.
215
+ - Do not finalize an epoch again without a new request or a new requirements state.
216
+ - Do not treat generated plan text or sealed provenance fields as new executable requirements from
217
+ a person.
218
+ - Do not replace behavior-first verification with wording checks. Do not invent files, commands, or
219
+ validation evidence during synthesis.
220
+ - After a timeout or readback mismatch, do not retry. Report `unknown-outcome`.
221
+ - After an indeterminate deletion, do not retry. Report `partial-cleanup`. State that the deletion
222
+ result is unknown.
122
223
 
123
224
  ## Result
124
225
 
125
- Return the issue and actor identities; `R/P/V/F`; GO decision and finding
126
- summary; requirement-preservation map; draft, no-change, published, stale,
127
- partial-cleanup, or unknown-outcome status; body-update receipt, readback
128
- evidence, deleted-comment receipts when present; and every unresolved capability
129
- or residual risk.
226
+ Return these items:
227
+
228
+ - issue and actor identities;
229
+ - `R/P/V/F`;
230
+ - the `GO` decision and finding summary;
231
+ - the requirement-preservation map;
232
+ - the exact `draft`, `no-change`, `published`, `stale`, `partial-cleanup`, or `unknown-outcome`
233
+ status;
234
+ - the body-update receipt;
235
+ - readback evidence;
236
+ - deleted-comment receipts, if present; and
237
+ - each unresolved capability or residual risk.
@@ -1,112 +1,161 @@
1
1
  ---
2
2
  name: git-worktrees
3
3
  license: BSD-3-Clause
4
- description: Use when starting feature work that needs isolation from current workspace creates isolated git worktrees with safety verification
4
+ description: Use for feature work that needs an isolated Git worktree. If Git does not ignore a project-local directory, use the verified temporary-directory fallback. If repository guidance requires the local directory, report the problem. In that case, stop before creation. If the helper cannot verify a clean base commit, report the problem. In that case, stop before creation. Do not delete anything.
5
5
  argument-hint: <branch-name or feature description>
6
6
  allowed-tools: [Bash, Read]
7
7
  ---
8
8
 
9
- # Using Git Worktrees
9
+ # Use Git worktrees
10
10
 
11
11
  ## Overview
12
12
 
13
- Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
14
-
15
- **Core principle:** Systematic directory selection + safety verification = reliable isolation.
16
-
17
- **When NOT to use this skill manually:** The `myrmidon-swarm` skill owns worktree creation for its
18
- background subagents. Use this skill for manual development work, not to duplicate swarm setup.
19
-
20
- ## Directory Selection
13
+ Git worktrees are isolated workspaces that share one repository. You can work on multiple branches
14
+ at the same time. You do not have to switch the active branch.
15
+
16
+ Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to all
17
+ prose that it produces.
18
+
19
+ **Rule:** Select the directory systematically. Then complete the safety checks. These actions give
20
+ reliable isolation.
21
+
22
+ **Do not use this skill for `myrmidon-swarm` worktrees.** That skill creates worktrees for its
23
+ background subagents. Use this skill for manual development work.
24
+
25
+ ## Engineering principles
26
+
27
+ Use the [canonical engineering-principles catalog](../_support/docs/principles/README.md) for these
28
+ workflow-specific rules:
29
+
30
+ - [P010 — Scope Fidelity](../_support/docs/principles/README.md#p010): Make only the requested isolated
31
+ branch and worktree. Delegate cleanup and unrelated changes to the applicable workflows.
32
+ - [P012 — Evidence Before Modification](../_support/docs/principles/README.md#p012): Before creation,
33
+ examine repository guidance, the selected base revision, directory state, ignore rules, and
34
+ baseline checks.
35
+ - [P021 — Evolutionary and Reversible Design](../_support/docs/principles/README.md#p021): Put feature work
36
+ in an isolated worktree at the selected base commit. Only if you have user authority and can use
37
+ the cleanup workflow, remove the worktree.
38
+ - [P033 — State-Safe Failure Semantics](../_support/docs/principles/README.md#p033): If validation is not
39
+ satisfactory, stop before creation. If setup or a test after creation is not satisfactory, keep
40
+ the worktree.
41
+ - [P053 — Validate at Trust Boundaries](../_support/docs/principles/README.md#p053): Use the tested helper
42
+ to validate branch, base, path, and path-root values. Do not use these values in a Git command
43
+ without the helper.
44
+ - [P058 — Bounded Agent Authority](../_support/docs/principles/README.md#p058): Make only the named branch
45
+ and worktree for the requested feature. Use the selected start commit and validated destination.
46
+ - [P065 — Verify Before Claiming Completion](../_support/docs/principles/README.md#p065): Before you report
47
+ that you prepared the worktree, do the repository checks for a clean baseline. Report the path
48
+ and start commit.
49
+ - [P083 — Irreversible Actions Last](../_support/docs/principles/README.md#p083): Before creation, complete
50
+ the dry-run. Before creation, complete the safety validation. Use `tidy` for removal.
51
+
52
+ ## Select the directory
21
53
 
22
54
  Follow this priority order:
23
55
 
24
- ### 1. Check Existing Directories
56
+ ### 1. Check existing directories
25
57
 
26
58
  The tested `scripts/prepare_worktree.py` helper checks `.worktrees` and then `worktrees`. If both
27
- exist, `.worktrees` wins.
59
+ directories exist, the helper selects `.worktrees`.
28
60
 
29
61
  ### 2. Check repository guidance
30
62
 
31
- Read `AGENTS.md` and its referenced repository guidance. If a preference is specified, pass it to
32
- the helper with `--directory DIRECTORY`.
63
+ Read `AGENTS.md` and its referenced repository guidance. If repository guidance specifies a
64
+ preference, pass it to the helper with `--directory DIRECTORY`.
33
65
 
34
66
  ### 3. Portable default
35
67
 
36
- When no repository preference exists, use the host's temporary directory from
37
- `tempfile.gettempdir()` with `<project>-<branch>`. This is commonly `/tmp` on Unix-like hosts and
38
- avoids polluting the project directory.
68
+ If the repository does not specify a location, use the host temporary directory from
69
+ `tempfile.gettempdir()` with `<project>-<branch>`. On Unix-like hosts, this directory is usually
70
+ `/tmp`. This location keeps the worktree outside the project directory.
39
71
 
40
72
  The helper computes the project name from the repository root.
41
73
 
42
- ## Safety Verification
74
+ ## Verify safety
43
75
 
44
- ### For Project-Local Directories (.worktrees or worktrees)
76
+ ### For project-local directories
45
77
 
46
- **MUST verify directory is ignored before creating worktree.** The helper fails closed when its
47
- project-local directory is not ignored.
78
+ Before you create a project-local worktree, verify that Git ignores its directory. If Git does not
79
+ ignore the directory, the helper stops before it makes a change.
48
80
 
49
- **If NOT ignored:**
81
+ #### If Git does not ignore the directory
50
82
 
51
- 1. Add `.worktrees/` to `.gitignore`
52
- 2. Commit the change
53
- 3. Then proceed with worktree creation
83
+ 1. Do not edit `.gitignore`.
84
+ 2. Do not commit `.gitignore`.
85
+ 3. Do not create the project-local worktree.
86
+ 4. If repository guidance requires the project-local directory, report the ignore-policy
87
+ prerequisite.
88
+ 5. If repository guidance requires the project-local directory, stop.
89
+ 6. Change `.gitignore` only in a separate authorized change.
90
+ 7. After that change is validated and committed, prepare the worktree again.
91
+ 8. If repository guidance does not require the project-local directory, get `<temporary-root>` from
92
+ the host.
93
+ 9. Give preference to a safe temporary destination.
94
+ 10. Pass `--path <temporary-root>/<project>-<branch>` and `--path-root <temporary-root>` to the helper.
95
+ 11. Report the fallback path.
54
96
 
55
- **Why critical:** Prevents accidentally committing worktree contents to repository.
97
+ This check prevents Git from tracking the worktree contents.
56
98
 
57
- ### For /tmp Locations
99
+ ### For `/tmp` locations
58
100
 
59
- No `.gitignore` verification needed outside the project entirely.
101
+ You do not have to verify `.gitignore` for a path under `/tmp`. This path is outside the project.
60
102
 
61
- ## Creation Steps
103
+ ## Create the worktree
62
104
 
63
- 1. Resolve and record the intended base commit SHA.
64
- 2. Keep the target repository as the current working directory. Resolve `scripts/prepare_worktree.py`
65
- against this installed skill directory and invoke that absolute helper path with
66
- `BRANCH_NAME --start-point BASE_SHA --dry-run`. For a contract requiring a distinct branch and
67
- path, also pass exact `--path` and `--path-root` values.
68
- 3. Create it with the same arguments without `--dry-run`, optionally supplying the documented
69
- repository preference through `--directory`. Never replace the recorded SHA with ambient HEAD.
70
- 4. Change to the returned path and run the repository-defined bootstrap when one exists.
71
- 5. Verify a clean baseline with the repository-defined tests and report the path, start SHA, and result.
105
+ 1. Resolve the intended base commit SHA.
106
+ 2. Record the intended base commit SHA.
107
+ 3. Keep the target repository as the current working directory.
108
+ 4. Resolve `scripts/prepare_worktree.py` from this installed skill directory.
109
+ 5. Prepare `BRANCH_NAME --start-point BASE_SHA --dry-run` as the helper arguments.
110
+ 6. If the contract requires a distinct branch and path, add exact `--path` and `--path-root` values.
111
+ 7. If repository guidance specifies a directory, add it through `--directory`.
112
+ 8. If an unignored local directory requires the temporary fallback, retain the exact `--path` and
113
+ `--path-root` values.
114
+ 9. For this fallback, use those values for both helper calls.
115
+ 10. Invoke the helper by its absolute path with the prepared dry-run arguments.
116
+ 11. Create the worktree with the same arguments without `--dry-run`.
117
+ 12. Do not replace the recorded SHA with the current `HEAD`.
118
+ 13. Change to the returned path.
119
+ 14. If the repository defines a bootstrap, run it.
120
+ 15. Use the repository tests to verify a clean baseline.
121
+ 16. Report the path, start SHA, and result.
72
122
 
73
- **If tests fail:** Report failures, ask whether to proceed or investigate.
123
+ **If the tests fail:** Report the failures. Ask whether to continue or investigate.
74
124
 
75
- **If tests pass:** Report ready.
125
+ **If the tests pass:** Report that the worktree is ready.
76
126
 
77
- ## Cleanup
127
+ ## Clean up
78
128
 
79
- When work is done, invoke `tidy` for branch and worktree cleanup. It prepares the trusted
80
- Hephaestus dependency and delegates directly to `hephaestus-tidy`, whose interactive workflow owns
81
- discovery, preservation rules, deletion prompts, rebases, and cleanup safeguards. Do not duplicate
82
- that policy or improvise deletion commands in this skill.
129
+ When the work is complete, invoke `tidy` for branch and worktree cleanup. `tidy` prepares the trusted
130
+ Hephaestus dependency. It delegates the work directly to `hephaestus-tidy`. The interactive workflow
131
+ controls discovery, preservation rules, deletion prompts, rebases, and cleanup safeguards. Do not
132
+ duplicate that policy. Do not write deletion commands in this skill.
83
133
 
84
134
  Preserve the worktree by default. Delivery, merge, abandonment, or a general cleanup request does
85
- not itself authorize this skill to remove it; route any cleanup through `tidy` and leave the
86
- decision to the Hephaestus workflow and the user's answers to its prompts.
135
+ not authorize this skill to remove the worktree. Use `tidy` for each cleanup. The Hephaestus
136
+ workflow and the user's answers to its prompts control the removal decision.
87
137
 
88
138
  ## Quick Reference
89
139
 
90
140
  | Situation | Action |
91
141
  | ----------- | -------- |
92
- | `.worktrees/` exists + ignored | Use it |
142
+ | `.worktrees/` exists and is ignored | Use it. |
93
143
  | Neither exists | Use the host temporary directory with `<project>-<branch>` |
94
- | Directory not ignored | Add to `.gitignore` + commit first |
95
- | Tests fail at baseline | Report failures + ask before proceeding |
96
-
97
- ## Common Mistakes
144
+ | Directory is not ignored | Use an explicit temporary path. Report the path. If the repository requires a local path, stop. |
145
+ | Tests fail at baseline | Report the failures. Ask before you continue. |
98
146
 
99
- - **Skipping ignore verification** for project-local worktrees → contents get tracked
100
- - **Proceeding with failing baseline** → can't distinguish new bugs from pre-existing
101
- - **Not cleaning up** → stale worktrees accumulate
147
+ ## Failed approaches
102
148
 
103
- ## Integration
149
+ - Do not skip ignore verification for a project-local worktree. Git can track the worktree contents.
150
+ - If the baseline tests fail, do not continue unless the user explicitly tells you to continue. You
151
+ cannot separate new defects from existing defects.
152
+ - When cleanup is authorized, use `tidy`. Do not leave stale worktrees.
104
153
 
105
- **Pairs with:**
154
+ ## Related workflow
106
155
 
107
156
  - Invoke `tidy` for dependency-locked delegation to Hephaestus branch and worktree cleanup.
108
- - Verify with fresh runnable evidence per the evidence-integrity policy before finishing and
109
- cleaning up.
157
+ - Before you report completion or start cleanup, get fresh runnable evidence. Follow the
158
+ evidence-integrity policy.
110
159
 
111
160
  ---
112
161