@homericintelligence/athena-opencode 0.5.0 → 0.5.2

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 (146) 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 +33 -22
  6. package/skills/_plugin.json +1 -0
  7. package/skills/_support/docs/dependency-resolution.md +203 -0
  8. package/skills/_support/docs/policies/development.md +131 -0
  9. package/skills/_support/docs/policies/evidence-integrity.md +40 -0
  10. package/skills/_support/docs/principles/README.md +565 -0
  11. package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
  12. package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
  13. package/skills/_support/docs/principles/details/p003-dry.md +126 -0
  14. package/skills/_support/docs/principles/details/p004-solid.md +165 -0
  15. package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
  16. package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
  17. package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
  18. package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
  19. package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
  20. package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
  21. package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
  22. package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
  23. package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
  24. package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
  25. package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
  26. package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
  27. package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
  28. package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
  29. package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
  30. package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
  31. package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
  32. package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
  33. package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
  34. package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
  35. package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
  36. package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
  37. package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
  38. package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
  39. package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
  40. package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
  41. package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
  42. package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
  43. package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
  44. package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
  45. package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
  46. package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
  47. package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
  48. package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
  49. package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
  50. package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
  51. package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
  52. package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
  53. package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
  54. package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
  55. package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
  56. package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
  57. package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
  58. package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
  59. package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
  60. package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
  61. package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
  62. package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
  63. package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
  64. package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
  65. package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
  66. package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
  67. package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
  68. package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
  69. package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
  70. package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
  71. package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
  72. package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
  73. package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
  74. package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
  75. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +131 -0
  76. package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
  77. package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
  78. package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
  79. package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
  80. package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
  81. package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
  82. package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
  83. package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
  84. package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
  85. package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
  86. package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
  87. package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
  88. package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
  89. package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
  90. package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
  91. package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
  92. package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
  93. package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
  94. package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
  95. package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
  96. package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
  97. package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
  98. package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
  99. package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
  100. package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
  101. package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
  102. package/skills/_support/docs/review/README.md +63 -0
  103. package/skills/_support/docs/review/behavior-first-testing.md +78 -0
  104. package/skills/_support/docs/review/common.md +400 -0
  105. package/skills/_support/docs/review/design-docs.md +74 -0
  106. package/skills/_support/docs/review/issue-planning.md +247 -0
  107. package/skills/_support/docs/review/language-routing.md +141 -0
  108. package/skills/_support/docs/review/repository-scorecard.md +170 -0
  109. package/skills/advise/SKILL.md +108 -74
  110. package/skills/advise/scripts/list_retrievable_skills.py +20 -8
  111. package/skills/advise/scripts/resolve_knowledge_checkout.py +533 -0
  112. package/skills/brainstorm/SKILL.md +163 -127
  113. package/skills/change-review/SKILL.md +91 -71
  114. package/skills/change-review/references/scope-resolution.md +69 -46
  115. package/skills/change-review/scripts/resolve_scope.py +144 -84
  116. package/skills/finalize-plan/SKILL.md +205 -139
  117. package/skills/git-worktrees/SKILL.md +100 -80
  118. package/skills/git-worktrees/scripts/prepare_worktree.py +34 -15
  119. package/skills/issue-review/SKILL.md +136 -79
  120. package/skills/learn/SKILL.md +359 -192
  121. package/skills/myrmidon-swarm/SKILL.md +126 -86
  122. package/skills/plan-issue/SKILL.md +122 -81
  123. package/skills/pr-review/SKILL.md +184 -116
  124. package/skills/pr-review/references/criteria.md +61 -37
  125. package/skills/pr-review/references/delivery.md +277 -101
  126. package/skills/pr-review/references/evidence.md +346 -149
  127. package/skills/pr-review/references/prevalidated.md +93 -61
  128. package/skills/pr-review/scripts/collect_evidence.py +312 -162
  129. package/skills/pr-review/scripts/deliver_go.py +701 -0
  130. package/skills/pr-review/scripts/diff_context.py +34 -15
  131. package/skills/pr-review/scripts/materialize_snapshot.py +141 -130
  132. package/skills/pr-review/scripts/pr_identity.py +27 -15
  133. package/skills/pr-review/scripts/resolve_pr.py +77 -41
  134. package/skills/realign/SKILL.md +516 -0
  135. package/skills/realign/references/aislop-integration.md +215 -0
  136. package/skills/realign/references/architecture-and-structure.md +271 -0
  137. package/skills/realign/references/control-flow-and-errors.md +344 -0
  138. package/skills/realign/references/tests-dependencies-and-security.md +261 -0
  139. package/skills/realign/scripts/resolve_assessment.py +1525 -0
  140. package/skills/repo-review/SKILL.md +202 -131
  141. package/skills/simplify/SKILL.md +174 -0
  142. package/skills/systematic-debugging/SKILL.md +212 -192
  143. package/skills/systematic-debugging/scripts/repository_evidence.py +26 -8
  144. package/skills/test-driven-development/SKILL.md +126 -96
  145. package/skills/tidy/SKILL.md +104 -59
  146. package/skills/tidy/scripts/run_tidy.py +54 -6
@@ -1,125 +1,155 @@
1
1
  ---
2
2
  name: test-driven-development
3
3
  license: BSD-3-Clause
4
- description: Use when implementing any feature or bugfix, before writing implementation code enforces RED-GREEN-REFACTOR cycle. Refuses to write production code without a verified failing test; a test that errors instead of failing for the expected missing behavior blocks GREEN until fixed.
4
+ description: Use this skill before you write implementation code for a feature or bug fix. Follow the RED-GREEN-REFACTOR cycle. Do not write production code until a verified test fails for the expected missing behavior. If the test has an error, correct the test before GREEN.
5
5
  argument-hint: <feature or bugfix description>
6
6
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
7
7
  ---
8
8
 
9
- # Test-Driven Development (TDD)
9
+ # Test-driven development (TDD)
10
10
 
11
- Why: seeing a focused test fail proves it can detect the missing product
12
- behavior; seeing it pass proves the smallest implementation satisfies it.
11
+ A focused test that fails proves that it can detect the missing product behavior. A passing test
12
+ proves that the smallest implementation satisfies the test.
13
13
 
14
- Use Athena's shared [behavior-first testing guidance](../../docs/review/behavior-first-testing.md)
15
- for good-test/bad-test criteria, determinism, and false-pass checks. Test
16
- observable product behavior and core contracts, not wording, documentation
17
- layout, or a private implementation arrangement.
14
+ Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to
15
+ all prose that it produces.
16
+
17
+ Use Athena's shared [behavior-first testing guidance](../_support/docs/review/behavior-first-testing.md)
18
+ for test criteria, determinism, and false-pass checks. Test observable product behavior and core
19
+ contracts. Do not test wording, documentation layout, or a private implementation arrangement.
18
20
 
19
21
  ## Engineering principles
20
22
 
21
- Use Athena's [canonical engineering-principles catalog](../../docs/principles/README.md) as the
22
- definition source. Apply these principles to this workflow:
23
-
24
- - [P022 — Test Behavior, Not Implementation](../../docs/principles/README.md#p022): drive and protect
25
- observable contracts rather than private implementation arrangements.
26
- - [P023 — Parameterized / Table-Driven Testing](../../docs/principles/README.md#p023): express repeated
27
- cases through named data when one behavioral rule covers them.
28
- - [P024 — Boundary-Value Testing](../../docs/principles/README.md#p024): include values around limits
29
- and transitions when the behavior has boundaries.
30
- - [P025 — Property-Based Testing for Invariants](../../docs/principles/README.md#p025): use generated
31
- input families when an invariant is stronger than a small example set.
32
- - [P026 — Regression Before Repair](../../docs/principles/README.md#p026): reproduce a defect with a
33
- focused failing test before repairing it when practical.
34
- - [P027 — Deterministic and Hermetic Tests](../../docs/principles/README.md#p027): control ambient
35
- inputs and external boundaries so RED and GREEN are repeatable.
36
- - [P028 — Test Failure Paths, Not Just Success Paths](../../docs/principles/README.md#p028): cover
37
- invalid input, dependency failure, cancellation, and cleanup where the contract requires them.
38
- - [P091 Test-Driven Development](../../docs/principles/README.md#p091): for behavior changes, prove
39
- missing behavior with RED, implement the smallest GREEN, then improve structure while green.
23
+ Use Athena's [canonical engineering-principles catalog](../_support/docs/principles/README.md) for the
24
+ principle definitions. Use these principles in this workflow:
25
+
26
+ - [P022 — Test Behavior, Not Implementation](../_support/docs/principles/README.md#p022): Write tests for
27
+ observable contracts. Do not write tests for a private implementation.
28
+ - [P023 — Parameterized / Table-Driven Testing](../_support/docs/principles/README.md#p023): If one rule is
29
+ applicable to two or more test cases, use named data in a parameterized or table-driven test.
30
+ - [P024 — Boundary-Value Testing](../_support/docs/principles/README.md#p024): If the behavior has
31
+ boundaries, include values near its limits and state changes.
32
+ - [P025 — Property-Based Testing for Invariants](../_support/docs/principles/README.md#p025): If a small
33
+ example set is not sufficient for an invariant, use generated input families.
34
+ - [P026 — Regression Before Repair](../_support/docs/principles/README.md#p026): If it is possible, before
35
+ you repair the defect, add one test that fails only because of the defect.
36
+ - [P027 — Deterministic and Hermetic Tests](../_support/docs/principles/README.md#p027): Set environment
37
+ inputs to specified values. Control external boundaries. Make sure that each test gives the same
38
+ result each time.
39
+ - [P028 Test Failure Paths, Not Just Success Paths](../_support/docs/principles/README.md#p028): If the
40
+ contract includes failure paths, include invalid input, dependency failure, cancellation, and
41
+ cleanup.
42
+ - [P091 — Test-Driven Development](../_support/docs/principles/README.md#p091): For a behavior change, first
43
+ add a test that shows the missing behavior (`RED`). Then, make the minimum code change that makes
44
+ the test pass (`GREEN`). After `GREEN`, make the structure better without a behavior change
45
+ (`REFACTOR`).
40
46
 
41
47
  ## Working rules
42
48
 
43
- Use TDD for features, bug fixes, and behavior changes. For a pure behavior-preserving refactor,
44
- first establish a verified green characterization baseline and enter at REFACTOR; do not manufacture
45
- a RED result. If the work introduces or changes observable behavior, begin with RED. Ask the human
46
- partner before exempting a throwaway prototype, generated code, configuration-only work, or
47
- documentation-only wording/layout change. In a swarm, the test specialist completes the applicable
48
- RED or green characterization baseline before implementation begins.
49
+ Use TDD for features, bug fixes, and behavior changes. For a pure refactor that preserves behavior,
50
+ first establish a verified green characterization baseline. Then, start at REFACTOR. Do not create
51
+ an artificial RED result.
52
+
53
+ If the work introduces or changes observable behavior, start with RED. Before you exempt a
54
+ throwaway prototype, generated code, configuration-only work, or documentation-only change, ask the
55
+ human partner. In a swarm, the test specialist must complete the applicable RED or green
56
+ characterization baseline before implementation starts.
49
57
 
50
58
  ```text
51
- BEHAVIOR CHANGES START WITH A FOCUSED FAILING TEST
52
- PURE REFACTORING STARTS FROM A VERIFIED GREEN BASELINE
59
+ START A BEHAVIOR CHANGE WITH A FOCUSED FAILING TEST
60
+ START A PURE REFACTOR FROM A VERIFIED GREEN BASELINE
53
61
  ```
54
62
 
55
- If you wrote in-scope behavior-changing implementation first, remove only that newly authored work
56
- and start with RED. If a pure refactor began without a verified baseline, stop and establish one
57
- before continuing. Preserve pre-existing or user-authored work and ask for direction when provenance
58
- or scope is unclear.
59
-
60
- ## REDGREENREFACTOR
61
-
62
- For a behavior-preserving refactor, verify the existing characterization suite, enter at step 5,
63
- and return to RED if the intended work changes the observable contract.
64
-
65
- 1. **RED:** Write one minimal, clearly named test for one observable behavior,
66
- data contract, security property, or executable artifact outcome under
67
- [P022](../../docs/principles/README.md#p022). Use real code unless a controlled substitute is
68
- needed at a genuine external boundary. Apply [P023](../../docs/principles/README.md#p023),
69
- [P024](../../docs/principles/README.md#p024),
70
- [P025](../../docs/principles/README.md#p025), and
71
- [P028](../../docs/principles/README.md#p028) when the behavior calls for them.
72
- 2. **Verify RED:** Discover the repository's focused test command and run it.
73
- The test must fail—not error—for the expected missing behavior. A filtered
74
- command must prove it selected a relevant test; C++/CMake tests must be wired
75
- to a real build and test target. If the test passes, it covers existing
76
- behavior; if it errors, fix the test setup and run it again. Keep the test
77
- deterministic and isolated under [P027](../../docs/principles/README.md#p027).
78
- 3. **GREEN:** Write the simplest behaviorally complete code that passes, following
79
- [P001 KISS Keep It Simple, Stupid](../../docs/principles/README.md#p001) and preferring
80
- [P090 Prefer Negative Code](../../docs/principles/README.md#p090) only among equally correct
81
- solutions. Do not add speculative features, unrelated refactors, or implementation beyond the
82
- test's demonstrated need.
83
- 4. **Verify GREEN:** Run the discovered relevant suite. The new and existing
84
- tests must pass without errors or warnings; fix code rather than weakening a
85
- test.
86
- 5. **REFACTOR:** After green, improve structure without adding behavior. Remove genuine knowledge
87
- duplication under [P003 — DRY — Don't Repeat Yourself](../../docs/principles/README.md#p003)
88
- without violating
89
- [P013 — AHA — Avoid Hasty Abstractions](../../docs/principles/README.md#p013); protect
90
- [P070Code Health Must Not Regress](../../docs/principles/README.md#p070),
91
- [P084 — Prefer Local Reasoning](../../docs/principles/README.md#p084), and
92
- [P086 Readability Counts](../../docs/principles/README.md#p086). Prefer deletion under
93
- [P090](../../docs/principles/README.md#p090) only when behavior and clarity remain intact. Keep
94
- tests green, then start the next RED cycle.
95
-
96
- For documentation-only changes, use existing Markdown, link, and executable
97
- example validation. Do not create production code or a text-assertion harness
98
- to manufacture a RED phase.
63
+ If you wrote an in-scope implementation that changes behavior before RED, remove only the work that
64
+ you added. Then, start with RED. If a pure refactor started without a verified baseline, stop.
65
+ Establish a verified baseline before you continue. Preserve existing work and work that the user
66
+ authored. If the source or scope of the work is not clear, ask for direction.
67
+
68
+ ## RED-GREEN-REFACTOR
69
+
70
+ For a refactor that preserves behavior, verify the existing characterization suite. Then, start at
71
+ step 5. If the intended work changes the observable contract, return to RED.
72
+
73
+ 1. **RED:** Write one minimum, clearly named test under
74
+ [P022](../_support/docs/principles/README.md#p022).
75
+
76
+ - The test must cover one observable behavior, data contract, security property, or executable
77
+ artifact result.
78
+ - Use real code unless a real external boundary requires a controlled substitute.
79
+ - If the behavior requires them, apply [P023](../_support/docs/principles/README.md#p023),
80
+ [P024](../_support/docs/principles/README.md#p024),
81
+ [P025](../_support/docs/principles/README.md#p025), and
82
+ [P028](../_support/docs/principles/README.md#p028).
83
+
84
+ 2. **Verify RED:** Verify the RED result with the focused test command for the repository.
85
+
86
+ - Before you run the command, find it in the repository.
87
+ - Run the focused test command.
88
+ - The test must fail for the expected missing behavior.
89
+ - The test must not stop because of a test error.
90
+ - For a filtered command, use the output to prove that the command selected an applicable test.
91
+ - Connect each C++/CMake test source to a real build target and test target.
92
+ - If the test passes, it covers existing behavior.
93
+ - If the test has an error, correct the test setup. Then, run the test again.
94
+ - Under [P027](../_support/docs/principles/README.md#p027), keep the test deterministic and isolated.
95
+
96
+ 3. **GREEN:** Write the simplest behaviorally complete code that passes the behavior test.
97
+
98
+ - Follow [P001KISS Keep It Simple, Stupid](../_support/docs/principles/README.md#p001).
99
+ - Prefer [P090 — Prefer Negative Code](../_support/docs/principles/README.md#p090) only if the candidate
100
+ solutions are equally correct.
101
+ - Do not add speculative features, unrelated refactors, or implementation beyond the need that
102
+ the test shows.
103
+
104
+ 4. **Verify GREEN:** Run the applicable test suite that you found in the repository.
105
+
106
+ - The new and existing tests must pass without errors or warnings.
107
+ - Correct the code. Do not weaken a test.
108
+
109
+ 5. **REFACTOR:** After GREEN, improve the structure without new behavior.
110
+
111
+ - Remove actual knowledge duplication under
112
+ [P003 — DRY — Don't Repeat Yourself](../_support/docs/principles/README.md#p003).
113
+ - Do not violate [P013 — AHA — Avoid Hasty Abstractions](../_support/docs/principles/README.md#p013).
114
+ - Protect [P070 — Code Health Must Not Regress](../_support/docs/principles/README.md#p070),
115
+ [P084 — Prefer Local Reasoning](../_support/docs/principles/README.md#p084), and
116
+ [P086 — Readability Counts](../_support/docs/principles/README.md#p086).
117
+ - Prefer deletion under [P090](../_support/docs/principles/README.md#p090) only if behavior and clarity
118
+ do not change.
119
+ - Keep the tests green.
120
+ - Start the next RED cycle.
121
+
122
+ For a documentation-only change, use existing Markdown, link, and executable-example validation.
123
+ Do not create production code. Do not create a text-assertion harness to produce an artificial RED
124
+ phase.
99
125
 
100
126
  ## Evidence before completion
101
127
 
102
- Discover commands from `AGENTS.md`, task runners, manifests, lockfiles, and
103
- required CI; prefer repository-native entry points. Record focused and relevant
104
- suite, coverage, type, and lint commands when applicable. If they conflict or
105
- no safe command is discoverable, ask the user rather than borrow another
106
- repository's command.
128
+ Find commands in `AGENTS.md`, task runners, manifests, lockfiles, and required continuous
129
+ integration (CI) configuration. Prefer repository-native entry points. When applicable, record the
130
+ focused-test, applicable-suite, coverage, type-check, and lint commands. If the sources conflict or
131
+ you cannot find a safe command, ask the user. Do not use a command from another repository.
132
+
133
+ Before completion, confirm these conditions:
134
+
135
+ - Each changed observable behavior and bug regression has proportionate test coverage.
136
+ - The tests control time, services, randomness, state, and mocks when the product requires this
137
+ control.
138
+ - Focused test selection is not empty.
139
+ - Fresh applicable tests, type checks, and lint checks pass.
107
140
 
108
- Before completion, confirm proportionate coverage for every changed observable
109
- behavior and bug regression; controlled time, services, randomness, state, and
110
- mocks where the product requires them; non-empty focused test selection; and
111
- fresh passing relevant tests, type checks, and lint. Follow the
112
- [evidence-integrity policy](../../docs/policies/evidence-integrity.md) before claiming success. Use
113
- `learn` for a durable testing lesson; its own scope and delivery rules determine whether it
114
- publishes a PR.
141
+ Before you claim success, follow the
142
+ [evidence-integrity policy](../_support/docs/policies/evidence-integrity.md). For a durable testing lesson,
143
+ use `learn`. The scope and delivery rules of `learn` determine if it publishes a pull request.
115
144
 
116
145
  ## Failed approaches
117
146
 
118
- - Writing production code before RED, or keeping in-scope implementation written ahead of the test.
119
- - Accepting an erroring test as RED instead of fixing the setup and re-running until it fails for
120
- the expected missing behavior.
121
- - Weakening a test to reach GREEN instead of fixing the code.
122
- - Adding speculative features or unrelated refactors beyond what a demonstrated test need requires.
147
+ - Do not write production code before RED.
148
+ - Do not keep in-scope implementation that you wrote before the test.
149
+ - Do not accept a test error as RED. Correct the setup. Then, run the test until it fails for the
150
+ expected missing behavior.
151
+ - Do not weaken a test to reach GREEN. Correct the code.
152
+ - Do not add speculative features or unrelated refactors beyond the need that the test shows.
123
153
 
124
154
  ---
125
155
 
@@ -1,99 +1,144 @@
1
1
  ---
2
2
  name: tidy
3
3
  license: BSD-3-Clause
4
- description: Delegate repository branch and worktree cleanup to the dependency-locked Hephaestus tidy command. Use for tidy, cleanup, or rebase requests; fail closed when the trusted automation checkout or required execution capability cannot be prepared.
4
+ description: Delegate repository branch and worktree cleanup to the dependency-locked Hephaestus tidy command. Use this skill for a tidy, cleanup, or rebase request. Stop if the trusted automation checkout or a required execution capability cannot be prepared.
5
5
  argument-hint: "<optional: hephaestus-tidy arguments>"
6
6
  allowed-tools: [Bash, Read]
7
7
  ---
8
8
 
9
9
  # Tidy through Hephaestus
10
10
 
11
- Use this when the user asks to tidy, clean up, or rebase a repository's local branches or
12
- worktrees. Athena prepares the trusted automation dependency and delegates the complete operation;
13
- `hephaestus-tidy` owns discovery, preservation rules, prompts, rebases, removal safeguards, output,
14
- and the final exit status.
11
+ Use this skill when the user asks to tidy, clean up, or rebase local repository branches or
12
+ worktrees. Athena prepares the trusted automation dependency. Then, Athena delegates the complete
13
+ operation to `hephaestus-tidy`.
14
+
15
+ `hephaestus-tidy` controls:
16
+
17
+ - discovery;
18
+ - preservation rules;
19
+ - prompts;
20
+ - rebases;
21
+ - removal safeguards;
22
+ - output;
23
+ - final exit status.
24
+
25
+ Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to
26
+ all prose that it produces.
15
27
 
16
28
  ## Engineering principles
17
29
 
18
- Use the [canonical engineering-principles catalog](../../docs/principles/README.md) through these
19
- workflow-specific rules:
20
-
21
- - [P010 — Scope Fidelity](../../docs/principles/README.md#p010): delegate only the requested tidy,
22
- cleanup, or rebase operation and do not add a second Athena cleanup policy.
23
- - [P031 — Propagate Rather Than Swallow](../../docs/principles/README.md#p031): preserve the delegated
24
- command's output, signals, and nonzero result instead of masking or retrying a failure.
25
- - [P035 — Fail Secure / Fail Closed](../../docs/principles/README.md#p035): stop when dependency
26
- identity, revision binding, checkout cleanliness, or a required capability cannot be established.
27
- - [P050 Least Privilege](../../docs/principles/README.md#p050): use only the resolved dependency,
28
- target repository, capabilities, and arguments required by this invocation.
29
- - [P058Bounded Agent Authority](../../docs/principles/README.md#p058): forwarding arguments does
30
- not widen the user's requested scope, destinations, credentials, or mutation authority.
31
- - [P061Separate Decision from High-Impact Execution](../../docs/principles/README.md#p061): bind
32
- the dependency, target, authority, and exact command vector before starting delegated execution.
33
- - [P062Human Approval for Irreversible or High-Risk Actions](../../docs/principles/README.md#p062):
34
- preserve existing authorization for scoped constructive work without redundant prompts, while
35
- leaving destructive or otherwise ungranted irreversible actions behind action-bound approval.
36
- - [P083 — Irreversible Actions Last](../../docs/principles/README.md#p083): finish dependency and
37
- command validation before handing control to an operation that may cross a point of no return.
30
+ Use the [canonical engineering-principles catalog](../_support/docs/principles/README.md) for these
31
+ workflow rules:
32
+
33
+ - [P010 — Scope Fidelity](../_support/docs/principles/README.md#p010): Delegate only the requested tidy,
34
+ cleanup, or rebase operation. Do not add a different cleanup policy for Athena.
35
+ - [P031 — Propagate Rather Than Swallow](../_support/docs/principles/README.md#p031): Give the delegated
36
+ command's output, signals, and nonzero result to the caller. Do not hide the failure. Do not
37
+ automatically retry it.
38
+ - [P035 Fail Secure / Fail Closed](../_support/docs/principles/README.md#p035): If a dependency identity or
39
+ revision-binding check is not satisfactory, stop. If the checkout is not clean, stop. If a
40
+ necessary capability is not available, stop.
41
+ - [P050Least Privilege](../_support/docs/principles/README.md#p050): Use only the resolved dependency,
42
+ target repository, capabilities, and arguments that are necessary for this invocation.
43
+ - [P058Bounded Agent Authority](../_support/docs/principles/README.md#p058): When you forward arguments,
44
+ do not increase the user's scope, destinations, credentials, or mutation authority.
45
+ - [P061Separate Decision from High-Impact Execution](../_support/docs/principles/README.md#p061): Before
46
+ you start delegated execution, record the dependency, target, authority, and full command vector.
47
+ Validate the record. During execution, use only the recorded values.
48
+ - [P062Human Approval for Irreversible or High-Risk Actions](../_support/docs/principles/README.md#p062):
49
+ If the user gave authority for scoped constructive work, do not request a second approval. If the
50
+ user did not give authority for a destructive or irreversible action, request approval for that
51
+ specified action.
52
+ - [P083 — Irreversible Actions Last](../_support/docs/principles/README.md#p083): Before you start an
53
+ irreversible operation, complete the dependency and command validation.
38
54
 
39
55
  ## Inputs
40
56
 
41
- Keep the target repository as the current working directory. Treat every argument supplied to this
42
- skill as a `hephaestus-tidy` argument and forward it unchanged. When the user wants a preview,
43
- forward `--dry-run`; do not reinterpret it or add it implicitly.
57
+ Keep the target repository as the current working directory. Treat each user argument as a
58
+ `hephaestus-tidy` argument. Forward it without a change. If the user wants a preview, forward
59
+ `--dry-run`. Do not reinterpret this option. Do not add it implicitly.
44
60
 
45
- Treat arguments as opaque, untrusted CLI data under
46
- [P053 Validate at Trust Boundaries](../../docs/principles/README.md#p053). Preserve their argument
47
- boundaries; Hephaestus's parser is the nearest responsible validation boundary.
61
+ Under [P053 Validate at Trust Boundaries](../_support/docs/principles/README.md#p053), treat the arguments
62
+ as opaque, untrusted command-line data. Preserve the boundary of each argument. The
63
+ `hephaestus-tidy` parser is the nearest responsible validation boundary.
48
64
 
49
65
  ## Workflow
50
66
 
51
67
  1. Prepare Hephaestus at `$HOME/.agent_brain/automation` under the canonical
52
- [`dependency-resolution` contract](../../docs/dependency-resolution.md). Report the resolved
53
- repository, commit SHA, and trust basis. Resolution, authentication, checkout, update,
54
- cleanliness, identity, revision-binding, or automatic-fork revalidation failure is blocking.
55
- 2. Keep the target repository as the current working directory. Resolve `scripts/run_tidy.py`
56
- against this installed skill directory and invoke that absolute helper path with the resolved
57
- automation checkout as its first internal operand, followed by every user argument in its
58
- original order and form.
59
- 3. The helper replaces itself with this dependency-locked command vector:
68
+ [`dependency-resolution` contract](../_support/docs/dependency-resolution.md).
69
+ 2. Report the resolved repository, commit SHA, and trust basis.
70
+ 3. If resolution, authentication, checkout, update, cleanliness, identity, revision binding, or
71
+ automatic-fork revalidation fails, stop.
72
+ 4. Keep the target repository as the current working directory.
73
+ 5. Resolve `scripts/run_tidy.py` against this installed skill directory.
74
+ 6. Invoke the absolute helper path with this operand order:
75
+
76
+ - the resolved automation checkout as the first internal operand;
77
+ - each user argument after the first operand, in its original order and form.
78
+ 7. The helper replaces itself with this dependency-locked command vector:
60
79
 
61
80
  ```text
62
81
  uv run --project <resolved-automation-checkout> --locked hephaestus-tidy <user-arguments>
63
82
  ```
64
83
 
65
- 4. Leave stdin, stdout, and stderr attached. Do not capture, pipe, summarize in place of, answer,
66
- retry, or otherwise mediate the command. The user answers any interactive prompt emitted by
67
- Hephaestus.
84
+ 8. Leave stdin, stdout, and stderr attached.
85
+ 9. Do not capture the command.
86
+ 10. Do not pipe the command.
87
+ 11. Do not replace the command output with a summary.
88
+ 12. Do not answer an interactive prompt from Hephaestus. The user answers each prompt.
89
+ 13. Do not retry the command.
90
+ 14. Do not otherwise mediate it.
91
+
92
+ The delegated exit status is the terminal status of the Athena tidy invocation. A nonzero status
93
+ means that cleanup is incomplete, including when the delegated output contains partial-cleanup
94
+ warnings, unresolved rebase conflicts, or checked-out-worktree skips. Athena does not inspect or
95
+ interpret delegated output to decide whether cleanup succeeded.
68
96
 
69
- Athena performs no worktree audit, candidate classification, removal, prompt, branch rebase, or
70
- cleanup safety decision of its own. It never substitutes a `hephaestus-tidy` executable found on
71
- `PATH` for the dependency-locked command.
97
+ Athena does not do these operations:
72
98
 
73
- Delegation neither withdraws already granted authority for scoped constructive actions nor creates
74
- new authority. Keep Hephaestus's prompts attached, and never use delegation to bypass action-bound
75
- approval for destructive or otherwise ungranted irreversible operations.
99
+ - worktree audit;
100
+ - candidate classification;
101
+ - removal;
102
+ - prompt;
103
+ - branch rebase;
104
+ - cleanup safety decision.
105
+
106
+ Do not replace the dependency-locked command with a `hephaestus-tidy` executable from `PATH`.
107
+
108
+ Delegation keeps existing authority for constructive actions that are in scope. It does not create
109
+ new authority. Keep the Hephaestus prompts attached. Do not use delegation to bypass action-bound
110
+ approval. This restriction applies to each destructive or other irreversible operation that the user
111
+ did not authorize.
76
112
 
77
113
  ## Dependency and capability failures
78
114
 
79
- Authenticated `gh`, Git, and network access are required by dependency preparation. Python 3 and
80
- `uv` are required to start the locked command. On any missing capability or nonzero command result,
81
- return the failure unchanged and stop. Do not fall back to a stale checkout, a similarly named
82
- repository, an ambient executable, or a second cleanup implementation.
115
+ Dependency preparation requires authenticated `gh`, Git, and network access. The locked command
116
+ requires Python 3 and `uv`. If a capability is not available or the command result is nonzero,
117
+ return the failure without a change. In that case, stop. Do not use a stale checkout, a repository with a
118
+ similar name, an ambient executable, or a second cleanup implementation.
119
+
120
+ The `hephaestus-tidy` boundary must resolve to a Hephaestus revision that propagates the inner
121
+ cleanup exit status. Athena checks that the resolved checkout includes commit
122
+ `aa357098e5d72178d248e4188e7f5e5f843cdd3f` before delegation. Athena consumes that status
123
+ transparently; it does not infer success from output. If the resolved checkout does not satisfy
124
+ that contract, stop.
83
125
 
84
126
  ## Failed approaches
85
127
 
86
- - Auditing and removing worktrees in Athena duplicated Hephaestus policy and produced a second set
87
- of destructive-action prompts.
88
- - Invoking an ambient `hephaestus-tidy` could bypass the resolved repository and its lockfile.
89
- - Parsing, normalizing, or reconstructing user arguments changed the delegated CLI contract.
90
- - Capturing or piping the process could alter interactive behavior, output, signals, or exit status.
128
+ - Do not audit worktrees in Athena. Do not remove worktrees in Athena. These actions duplicate the
129
+ Hephaestus policy and create a second set of destructive-action prompts.
130
+ - Do not invoke an ambient `hephaestus-tidy`. It can bypass the resolved repository and its lockfile.
131
+ - Do not parse user arguments. Do not normalize user arguments. Do not reconstruct user arguments.
132
+ These actions change the delegated command-line contract.
133
+ - Do not capture the process. Do not pipe the process. These actions can change interactive behavior,
134
+ output, signals, or exit status.
91
135
 
92
136
  ## Output
93
137
 
94
138
  Before execution, report the resolved Hephaestus repository, commit SHA, and trust basis. After
95
- that, preserve the delegated command's output and terminal result without adding Athena-specific
96
- worktree classifications or cleanup conclusions.
139
+ execution starts, preserve the delegated command output and terminal result. Do not add
140
+ Athena-specific worktree classifications or cleanup conclusions. Report the delegated result as-is:
141
+ success conclusions require a zero exit, and a nonzero exit is incomplete cleanup.
97
142
 
98
143
  ## Attribution
99
144
 
@@ -1,18 +1,63 @@
1
1
  #!/usr/bin/env python3
2
- """Replace this process with the dependency-locked Hephaestus tidy command."""
2
+ """Run the dependency-locked Hephaestus tidy command in place of this process."""
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
6
  import argparse
7
+ import importlib.util
7
8
  import os
9
+ import subprocess
8
10
  import sys
9
11
  from collections.abc import Sequence
10
12
  from pathlib import Path
13
+ from typing import TYPE_CHECKING
11
14
 
12
- if __package__ in {None, ""}:
13
- sys.path.insert(0, str(Path(__file__).resolve().parents[3]))
15
+ if TYPE_CHECKING or __package__ not in {None, ""}:
16
+ from skills._cli import argument_parser, git_read_arguments, git_read_environment
17
+ else:
18
+ _cli_path = Path(__file__).resolve().parents[2] / "_cli.py"
19
+ _cli_spec = importlib.util.spec_from_file_location(
20
+ "athena_installed_cli", _cli_path
21
+ )
22
+ if _cli_spec is None or _cli_spec.loader is None:
23
+ raise RuntimeError(
24
+ f"The installed Athena CLI helper is unavailable: '{_cli_path}'."
25
+ )
26
+ _cli = importlib.util.module_from_spec(_cli_spec)
27
+ _cli_spec.loader.exec_module(_cli)
28
+ argument_parser = _cli.argument_parser
29
+ git_read_arguments = _cli.git_read_arguments
30
+ git_read_environment = _cli.git_read_environment
14
31
 
15
- from skills._cli import argument_parser
32
+ _REQUIRED_HEPHAESTUS_TIDY_REVISION = "aa357098e5d72178d248e4188e7f5e5f843cdd3f"
33
+
34
+
35
+ def _validate_hephaestus_revision(automation_checkout: Path) -> int:
36
+ """Fail closed when the resolved Hephaestus checkout is older than the fix."""
37
+ command = [
38
+ "git",
39
+ *git_read_arguments(),
40
+ "-C",
41
+ str(automation_checkout),
42
+ "merge-base",
43
+ "--is-ancestor",
44
+ _REQUIRED_HEPHAESTUS_TIDY_REVISION,
45
+ "HEAD",
46
+ ]
47
+ try:
48
+ result = subprocess.run(command, check=False, env=git_read_environment())
49
+ except FileNotFoundError as error:
50
+ missing = error.filename or command[0]
51
+ print(f"The required command is not available: '{missing}'.", file=sys.stderr)
52
+ return 127
53
+ if result.returncode != 0:
54
+ print(
55
+ "The resolved Hephaestus checkout is stale; it must include "
56
+ f"commit {_REQUIRED_HEPHAESTUS_TIDY_REVISION}.",
57
+ file=sys.stderr,
58
+ )
59
+ return 1
60
+ return 0
16
61
 
17
62
 
18
63
  def main(argv: Sequence[str] | None = None) -> int:
@@ -21,6 +66,9 @@ def main(argv: Sequence[str] | None = None) -> int:
21
66
  parser.add_argument("automation_checkout", type=Path)
22
67
  parser.add_argument("arguments", nargs=argparse.REMAINDER)
23
68
  parsed = parser.parse_args(raw_arguments)
69
+ validation_status = _validate_hephaestus_revision(parsed.automation_checkout)
70
+ if validation_status != 0:
71
+ return validation_status
24
72
  command = [
25
73
  "uv",
26
74
  "run",
@@ -34,9 +82,9 @@ def main(argv: Sequence[str] | None = None) -> int:
34
82
  os.execvp(command[0], command)
35
83
  except FileNotFoundError as error:
36
84
  missing = error.filename or command[0]
37
- print(f"required command unavailable: {missing}", file=sys.stderr)
85
+ print(f"The required command is not available: '{missing}'.", file=sys.stderr)
38
86
  return 127
39
- raise RuntimeError("os.execvp returned unexpectedly")
87
+ raise RuntimeError("The os.execvp call returned control unexpectedly.")
40
88
 
41
89
 
42
90
  if __name__ == "__main__":