@homericintelligence/athena-opencode 0.4.4 → 0.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.
@@ -1,7 +1,7 @@
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
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.
5
5
  argument-hint: <feature or bugfix description>
6
6
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
7
7
  ---
@@ -16,40 +16,82 @@ for good-test/bad-test criteria, determinism, and false-pass checks. Test
16
16
  observable product behavior and core contracts, not wording, documentation
17
17
  layout, or a private implementation arrangement.
18
18
 
19
- ## Use and rule
19
+ ## Engineering principles
20
20
 
21
- Use TDD for features, bug fixes, refactoring, and behavior changes. Ask the
22
- human partner before exempting a throwaway prototype, generated code,
23
- configuration-only work, or documentation-only wording/layout change. In a
24
- swarm, the test specialist completes RED before implementation begins.
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.
40
+
41
+ ## Working rules
42
+
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.
25
49
 
26
50
  ```text
27
- NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
51
+ BEHAVIOR CHANGES START WITH A FOCUSED FAILING TEST
52
+ PURE REFACTORING STARTS FROM A VERIFIED GREEN BASELINE
28
53
  ```
29
54
 
30
- If you wrote in-scope implementation first, remove only that newly authored
31
- work and start with RED. Preserve pre-existing or user-authored work and ask for
32
- direction when provenance or scope is unclear.
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.
33
59
 
34
60
  ## RED–GREEN–REFACTOR
35
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
+
36
65
  1. **RED:** Write one minimal, clearly named test for one observable behavior,
37
- data contract, security property, or executable artifact outcome. Use real
38
- code unless a controlled substitute is needed at a genuine external boundary.
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.
39
72
  2. **Verify RED:** Discover the repository's focused test command and run it.
40
73
  The test must fail—not error—for the expected missing behavior. A filtered
41
74
  command must prove it selected a relevant test; C++/CMake tests must be wired
42
75
  to a real build and test target. If the test passes, it covers existing
43
- behavior; if it errors, fix the test setup and run it again.
44
- 3. **GREEN:** Write the simplest behaviorally complete code that passes. Do not
45
- add speculative features, unrelated refactors, or implementation beyond the
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
46
82
  test's demonstrated need.
47
83
  4. **Verify GREEN:** Run the discovered relevant suite. The new and existing
48
84
  tests must pass without errors or warnings; fix code rather than weakening a
49
85
  test.
50
- 5. **REFACTOR:** After green, remove duplication, clarify names, or extract a
51
- helper without adding behavior. Keep tests green, then start the next RED
52
- cycle.
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
+ [P070 — Code 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.
53
95
 
54
96
  For documentation-only changes, use existing Markdown, link, and executable
55
97
  example validation. Do not create production code or a text-assertion harness
@@ -66,9 +108,18 @@ repository's command.
66
108
  Before completion, confirm proportionate coverage for every changed observable
67
109
  behavior and bug regression; controlled time, services, randomness, state, and
68
110
  mocks where the product requires them; non-empty focused test selection; and
69
- fresh passing relevant tests, type checks, and lint. Follow the evidence policy
70
- before claiming success. Use `learn` for a durable testing lesson; its own
71
- scope and delivery rules determine whether it publishes a PR.
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.
115
+
116
+ ## Failed approaches
117
+
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.
72
123
 
73
124
  ---
74
125
 
@@ -13,12 +13,39 @@ worktrees. Athena prepares the trusted automation dependency and delegates the c
13
13
  `hephaestus-tidy` owns discovery, preservation rules, prompts, rebases, removal safeguards, output,
14
14
  and the final exit status.
15
15
 
16
+ ## Engineering principles
17
+
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
+ - [P058 — Bounded Agent Authority](../../docs/principles/README.md#p058): forwarding arguments does
30
+ not widen the user's requested scope, destinations, credentials, or mutation authority.
31
+ - [P061 — Separate 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
+ - [P062 — Human 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.
38
+
16
39
  ## Inputs
17
40
 
18
41
  Keep the target repository as the current working directory. Treat every argument supplied to this
19
42
  skill as a `hephaestus-tidy` argument and forward it unchanged. When the user wants a preview,
20
43
  forward `--dry-run`; do not reinterpret it or add it implicitly.
21
44
 
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.
48
+
22
49
  ## Workflow
23
50
 
24
51
  1. Prepare Hephaestus at `$HOME/.agent_brain/automation` under the canonical
@@ -43,6 +70,10 @@ Athena performs no worktree audit, candidate classification, removal, prompt, br
43
70
  cleanup safety decision of its own. It never substitutes a `hephaestus-tidy` executable found on
44
71
  `PATH` for the dependency-locked command.
45
72
 
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.
76
+
46
77
  ## Dependency and capability failures
47
78
 
48
79
  Authenticated `gh`, Git, and network access are required by dependency preparation. Python 3 and