@homericintelligence/athena-opencode 0.5.1 → 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 (40) hide show
  1. package/package.json +1 -1
  2. package/skills/_cli.py +7 -4
  3. package/skills/_plugin.json +1 -0
  4. package/skills/_support/docs/dependency-resolution.md +49 -38
  5. package/skills/_support/docs/policies/development.md +16 -2
  6. package/skills/_support/docs/principles/README.md +191 -168
  7. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +7 -5
  8. package/skills/_support/docs/review/README.md +5 -1
  9. package/skills/_support/docs/review/behavior-first-testing.md +5 -0
  10. package/skills/_support/docs/review/common.md +44 -9
  11. package/skills/_support/docs/review/issue-planning.md +36 -9
  12. package/skills/advise/SKILL.md +82 -74
  13. package/skills/advise/scripts/list_retrievable_skills.py +17 -5
  14. package/skills/advise/scripts/resolve_knowledge_checkout.py +533 -0
  15. package/skills/brainstorm/SKILL.md +3 -0
  16. package/skills/change-review/scripts/resolve_scope.py +25 -11
  17. package/skills/finalize-plan/SKILL.md +10 -3
  18. package/skills/git-worktrees/SKILL.md +1 -1
  19. package/skills/git-worktrees/scripts/prepare_worktree.py +18 -5
  20. package/skills/learn/SKILL.md +136 -59
  21. package/skills/pr-review/SKILL.md +33 -15
  22. package/skills/pr-review/references/criteria.md +3 -0
  23. package/skills/pr-review/references/delivery.md +136 -18
  24. package/skills/pr-review/references/evidence.md +92 -12
  25. package/skills/pr-review/scripts/collect_evidence.py +101 -22
  26. package/skills/pr-review/scripts/deliver_go.py +701 -0
  27. package/skills/pr-review/scripts/diff_context.py +28 -11
  28. package/skills/pr-review/scripts/materialize_snapshot.py +29 -10
  29. package/skills/pr-review/scripts/resolve_pr.py +24 -10
  30. package/skills/realign/SKILL.md +516 -0
  31. package/skills/realign/references/aislop-integration.md +215 -0
  32. package/skills/realign/references/architecture-and-structure.md +271 -0
  33. package/skills/realign/references/control-flow-and-errors.md +344 -0
  34. package/skills/realign/references/tests-dependencies-and-security.md +261 -0
  35. package/skills/realign/scripts/resolve_assessment.py +1525 -0
  36. package/skills/simplify/SKILL.md +174 -0
  37. package/skills/systematic-debugging/SKILL.md +2 -0
  38. package/skills/systematic-debugging/scripts/repository_evidence.py +17 -4
  39. package/skills/tidy/SKILL.md +13 -1
  40. package/skills/tidy/scripts/run_tidy.py +51 -3
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: simplify
3
+ license: BSD-3-Clause
4
+ description: Review a repository or target path for safe deletion, reuse, consolidation, or retention when subtraction may satisfy the current requirement with less code or less system complexity. Use this skill for read-only review. Stop if the repository root, revision, worktree overlay, or in-scope inventory cannot be bound.
5
+ argument-hint: "[TARGET]"
6
+ allowed-tools: [Read, Bash, Grep, Glob, Agent]
7
+ ---
8
+
9
+ # Simplify review
10
+
11
+ Use this skill when you need a subtraction-first review. Do not use it for implementation.
12
+
13
+ Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to
14
+ all prose that it produces.
15
+
16
+ Use the [shared review contract](../_support/docs/review/common.md) and the
17
+ [review framework overview](../_support/docs/review/README.md).
18
+
19
+ ## When to use
20
+
21
+ - The task asks if an existing module, abstraction, interface, dependency, configuration path, or
22
+ state owner can be removed, reused, consolidated, simplified, or retained.
23
+ - The task asks for a read-only review.
24
+ - The host can bind the repository root, revision, worktree overlay, and in-scope inventory.
25
+ - Stop if a required binding or capability is missing.
26
+
27
+ ## Required inputs
28
+
29
+ - Repository root.
30
+ - Revision.
31
+ - Worktree overlay or other mutable view.
32
+ - Target path, if one exists.
33
+ - Validation evidence, when available. If no current-head receipt exists, report the evidence gap
34
+ and do not state that validation succeeded.
35
+
36
+ ## Principles
37
+
38
+ Use the [canonical engineering-principles catalog](../_support/docs/principles/README.md) for the
39
+ principle definitions. Use only these principles because they materially affect this workflow:
40
+
41
+ - [P001 KISS](../_support/docs/principles/README.md#p001): Choose the smallest evidence-backed result
42
+ that fits the requirement.
43
+ - [P002 YAGNI](../_support/docs/principles/README.md#p002): Do not keep or add a mechanism for a future
44
+ use only.
45
+ - [P003 DRY](../_support/docs/principles/README.md#p003): Treat duplicate authority as a consolidation
46
+ candidate.
47
+ - [P007 Subtraction Over Addition](../_support/docs/principles/README.md#p007): Start with remove, reuse,
48
+ consolidate, or simplify before you ask for a new addition.
49
+ - [P008 Understand Before Subtracting](../_support/docs/principles/README.md#p008): Verify purpose,
50
+ consumers, history, tests, and contracts before deletion.
51
+ - [P013 AHA](../_support/docs/principles/README.md#p013): Do not invent a new abstraction when evidence
52
+ does not show a stable repeated need.
53
+ - [P074 Prefer Existing Mechanisms](../_support/docs/principles/README.md#p074): Reuse the current
54
+ repository mechanism if it meets the requirement.
55
+ - [P088 Delete Dead Code](../_support/docs/principles/README.md#p088): Remove unreachable, superseded, or
56
+ obsolete code after safety evidence.
57
+ - [P089 Delete Obsolete Configuration and Dependencies](../_support/docs/principles/README.md#p089):
58
+ Remove obsolete config, dependencies, tests, docs, and scaffolding after no consumer remains.
59
+ - [P090 Prefer Negative Code](../_support/docs/principles/README.md#p090): Prefer less code, state,
60
+ config, and maintenance when options are equally clear.
61
+
62
+ ## Candidate signals and ownership
63
+
64
+ Use these items only as signals for investigation:
65
+
66
+ - code or another artifact that evidence shows is unreachable, superseded, or obsolete;
67
+ - a dependency, configuration item, test, document, or scaffold that has no current purpose or
68
+ consumer;
69
+ - a comment that only repeats the code or describes an internal work plan;
70
+ - a wrapper or alias that only forwards an operation;
71
+ - repeated code or authority that evidence shows represents one stable concept;
72
+ - a guard, validation step, or compatibility mechanism that duplicates an authoritative mechanism
73
+ or has completed its supported lifetime; and
74
+ - residue from a patch, such as debug output, abandoned branches, unrelated edits, or unnecessary
75
+ file churn.
76
+
77
+ Confirm each candidate with evidence about its consumers, behavior, contracts, history, and
78
+ validation. An AISlop diagnostic, another scanner result, a score, a line count, a complexity
79
+ metric, or a churn metric is only an investigation lead. It is not proof of a finding. Do not infer
80
+ the source author from these signals.
81
+
82
+ Retain a wrapper, guard, validation step, or compatibility mechanism when it has a necessary
83
+ boundary, security, observability, framework, or published-API function. Retain intentional
84
+ duplication when it prevents an incorrect shared abstraction.
85
+
86
+ Use [`realign`](../realign/SKILL.md) when a candidate needs a structural change to error policy,
87
+ responsibility, state or invariant ownership, a type model, test architecture, or security
88
+ architecture. `simplify` can identify and route this candidate. It must not design or make the
89
+ structural change.
90
+
91
+ ## Workflow
92
+
93
+ 1. Bind the repository root, revision, worktree overlay, and full in-scope inventory before
94
+ analysis.
95
+ 2. If no target is given, inspect the complete bound repository and worktree overlay. Do not
96
+ sample.
97
+ 3. If a module or directory target is given, start there. Expand only to connected callers, tests,
98
+ exports, configuration, dependencies, and documentation. Report each scope expansion.
99
+ 4. Compare concepts, control flow, interfaces, dependencies, configuration, state, and code.
100
+ 5. Collect evidence about consumers, behavior, purpose, contracts, history, risk, and validation.
101
+ 6. Before you classify a deletion or breaking interface change, check if it affects a published
102
+ public API.
103
+ 7. If a candidate affects a published public API, identify the published surface, current
104
+ consumers, required deprecation notice or compatibility bridge, migration path, supported
105
+ version or removal window, and validation evidence.
106
+ 8. If the repository has no documented deprecation policy for that published public API, stop and
107
+ request maintainer direction.
108
+ 9. Until the deprecation and compatibility conditions are complete, classify that published public
109
+ API candidate as `retain` or limit it to deprecation and migration work.
110
+ 10. Give each supported candidate `category: simplification`. Classify its action as `delete`,
111
+ `consolidate`, `reuse`, `simplify`, or `retain`. Also give it a routing owner.
112
+ 11. Give each candidate a stable ID.
113
+ 12. For each candidate, report scope, preserved behavior, the smaller alternative, dependencies and
114
+ order, validation, rollback, and expected net reduction.
115
+ 13. If the repository changes during review, stop and report drift.
116
+ 14. After the read-only report, stop at a checkpoint. Offer one of these actions:
117
+ - stop;
118
+ - hand off compatible approved candidate IDs through an explicit `realign --apply` request; or
119
+ - hand off approved candidate IDs and deletion paths to `plan-issue` or another
120
+ write-authorized workflow outside `simplify`.
121
+ 15. `simplify` does not create issues, trackers, or any other forge write. If a write task is
122
+ needed, hand off to a separate workflow with explicit write authority.
123
+ 16. Candidate approval inside `simplify` authorizes only the specified handoff. The explicit
124
+ `realign --apply` request supplies bounded code-repair authority. Neither action authorizes a
125
+ dependency installation, forge write, published-API migration, or unrelated cleanup. The
126
+ receiving workflow must bind the repository again.
127
+ 17. If no supported candidate exists, report that result and do not create an empty tracker.
128
+ 18. If a required capability is absent, use the documented safe fallback or stop with the missing
129
+ evidence. Do not guess.
130
+
131
+ ## Review output
132
+
133
+ Report these items:
134
+
135
+ - binding: repository root, revision, worktree overlay, and inventory;
136
+ - target and any scope expansion;
137
+ - candidate list with stable IDs, `category: simplification`, and actions;
138
+ - routing owner for each candidate;
139
+ - evidence for consumers, behavior, purpose, contracts, history, risk, and validation;
140
+ - for a candidate that can go to `realign`, current head and overlay identity, exact path and lines,
141
+ category, severity, confidence, disposition, affected contract or invariant, applicable
142
+ principle, behavior and consumer evidence, impact, considered counterexample, smallest safe
143
+ correction, validation, rollback, and dependency order;
144
+ - for any validation evidence, the exact command, current reviewed head, environment, exit status,
145
+ and unedited output; otherwise report no current-head validation evidence and do not state that
146
+ validation succeeded;
147
+ - published public API deprecation evidence, when applicable;
148
+ - category result for simplification coverage: `finding`, `clear`, or `not applicable`;
149
+ - the checkpoint action list;
150
+ - drift, if any; and
151
+ - the unsupported evidence or capability gap, if any.
152
+
153
+ For each simplification finding, tag it with `category: simplification` and keep the normal
154
+ severity, disposition, location, impact, evidence, and remediation fields.
155
+
156
+ ## Failed approaches
157
+
158
+ - Do not treat zero direct callers or a raw line count as proof that removal is safe.
159
+ - Do not treat an AISlop diagnostic, scanner result, score, complexity metric, or churn metric as
160
+ proof of a finding.
161
+ - Do not remove necessary boundary, security, observability, framework, or compatibility behavior.
162
+ - Do not use `simplify` to make a structural change that belongs to `realign`.
163
+ - Do not classify published public API removal or a breaking interface change as immediately
164
+ executable without the documented deprecation and compatibility evidence.
165
+ - Do not use a PR description, earlier run, stale receipt, or unbound host output as evidence for a
166
+ current-head success claim.
167
+ - Do not sample the bound scope when the full scope is available.
168
+ - Do not guess a missing capability or invent a tracker when no supported candidate exists.
169
+ - Do not continue after drift.
170
+ - Do not modify files, issues, branches, or pull requests in the initial workflow.
171
+
172
+ ## Attribution
173
+
174
+ This skill follows the Athena review contract, the development policy, and GitHub issue #165.
@@ -150,6 +150,8 @@ Use this method to test a hypothesis:
150
150
  Repair the root cause.
151
151
 
152
152
  Do not repair only the symptom.
153
+ Before you add code, check whether removal, reuse, consolidation, or deletion of an obsolete
154
+ workaround is the smallest safe repair. If that repair preserves the contract, choose it.
153
155
 
154
156
  1. Use the `test-driven-development` skill to create a regression test.
155
157
  2. Under [P026 — Regression Before Repair](../_support/docs/principles/README.md#p026), create the test
@@ -3,14 +3,27 @@
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
+ import importlib.util
6
7
  import json
7
8
  import sys
8
9
  from pathlib import Path
10
+ from typing import TYPE_CHECKING
9
11
 
10
- if __package__ in {None, ""}:
11
- sys.path.insert(0, str(Path(__file__).resolve().parents[3]))
12
-
13
- from skills._cli import argument_parser, run_command
12
+ if TYPE_CHECKING or __package__ not in {None, ""}:
13
+ from skills._cli import argument_parser, run_command
14
+ else:
15
+ _cli_path = Path(__file__).resolve().parents[2] / "_cli.py"
16
+ _cli_spec = importlib.util.spec_from_file_location(
17
+ "athena_installed_cli", _cli_path
18
+ )
19
+ if _cli_spec is None or _cli_spec.loader is None:
20
+ raise RuntimeError(
21
+ f"The installed Athena CLI helper is unavailable: '{_cli_path}'."
22
+ )
23
+ _cli = importlib.util.module_from_spec(_cli_spec)
24
+ _cli_spec.loader.exec_module(_cli)
25
+ argument_parser = _cli.argument_parser
26
+ run_command = _cli.run_command
14
27
 
15
28
  EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
16
29
 
@@ -89,6 +89,11 @@ as opaque, untrusted command-line data. Preserve the boundary of each argument.
89
89
  13. Do not retry the command.
90
90
  14. Do not otherwise mediate it.
91
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.
96
+
92
97
  Athena does not do these operations:
93
98
 
94
99
  - worktree audit;
@@ -112,6 +117,12 @@ requires Python 3 and `uv`. If a capability is not available or the command resu
112
117
  return the failure without a change. In that case, stop. Do not use a stale checkout, a repository with a
113
118
  similar name, an ambient executable, or a second cleanup implementation.
114
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.
125
+
115
126
  ## Failed approaches
116
127
 
117
128
  - Do not audit worktrees in Athena. Do not remove worktrees in Athena. These actions duplicate the
@@ -126,7 +137,8 @@ similar name, an ambient executable, or a second cleanup implementation.
126
137
 
127
138
  Before execution, report the resolved Hephaestus repository, commit SHA, and trust basis. After
128
139
  execution starts, preserve the delegated command output and terminal result. Do not add
129
- Athena-specific worktree classifications or cleanup conclusions.
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.
130
142
 
131
143
  ## Attribution
132
144
 
@@ -4,15 +4,60 @@
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",