@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
@@ -0,0 +1,123 @@
1
+ # P085 — Explicit Is Better Than Implicit
2
+
3
+ ## Definition
4
+
5
+ **Explicit Is Better Than Implicit** makes important behavior clear in interfaces, types,
6
+ configuration, and local control flow. This behavior has an effect on correctness, security, or
7
+ maintenance. Hidden conventions must not set dependencies, defaults, conversions, state changes,
8
+ ownership, or side effects.
9
+
10
+ **Aliases:** explicitness principle and explicit over implicit.
11
+
12
+ ## Provenance
13
+
14
+ **Classification:** practitioner heuristic.
15
+
16
+ Tim Peters wrote the aphorism in a 1999 Python community post. PEP 20 then recorded the aphorism.
17
+ Other interface and language design guidance uses the same rule. Athena uses the rule for all
18
+ languages.
19
+
20
+ ## Decision rule
21
+
22
+ If a fact changes an operation, show that fact at the selection or call point.
23
+
24
+ ## How to apply
25
+
26
+ - Use specified interfaces to supply dependencies and request context.
27
+ - Give clear names to data-loss conversions, defaults, units, and fallback behavior.
28
+ - Use explicit state transitions and terminal states.
29
+ - Show external writes and transaction commits in control flow.
30
+ - Record configuration precedence and the source of each selected value.
31
+ - Use schemas and typed values. Do not use magic strings or positional conventions.
32
+
33
+ ## Diagram
34
+
35
+ The call site supplies each fact that can change the result.
36
+
37
+ ```mermaid
38
+ flowchart LR
39
+ A["Dependency with a name"] --> D["Operation"]
40
+ B["Explicit option"] --> D
41
+ C["Declared default"] --> D
42
+ D --> E["Clear result"]
43
+ ```
44
+
45
+ ## Language examples
46
+
47
+ The two examples accept the same wall-time and zone inputs, and return different errors for ambiguous
48
+ and nonexistent source times.
49
+
50
+ ### Python
51
+
52
+ ```python
53
+ def convert_time(local: datetime, source: ZoneInfo, target: ZoneInfo) -> datetime:
54
+ if local.tzinfo is not None:
55
+ raise ValueError("expected local wall time")
56
+ candidates = [local.replace(tzinfo=source, fold=fold) for fold in (0, 1)]
57
+ valid = [value for value in candidates if value.astimezone(timezone.utc)
58
+ .astimezone(source).replace(tzinfo=None) == local]
59
+ instants = {value.astimezone(timezone.utc) for value in valid}
60
+ if not instants:
61
+ raise ValueError("nonexistent local time")
62
+ if len(instants) > 1:
63
+ raise ValueError("ambiguous local time")
64
+ return instants.pop().astimezone(target)
65
+ ```
66
+
67
+ ### Rust
68
+
69
+ ```rust
70
+ fn convert_time(local: NaiveDateTime, source: Tz, target: Tz)
71
+ -> Result<DateTime<Tz>, &'static str> {
72
+ match source.from_local_datetime(&local) {
73
+ LocalResult::Single(value) => Ok(value.with_timezone(&target)),
74
+ LocalResult::Ambiguous(_, _) => Err("ambiguous local time"),
75
+ LocalResult::None => Err("nonexistent local time"),
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Boundaries and tensions
81
+
82
+ A large quantity of text is not necessary for explicitness. A stable language construct or known repository
83
+ convention can show the contract. Information hiding stays necessary. Show the contract, not each
84
+ internal detail. Do not make each implementation decision public configuration. Public configuration
85
+ increases the interface surface and complexity.
86
+
87
+ ## Examples
88
+
89
+ **Positive:** A timestamp conversion shows the source and destination time zones. The conversion does
90
+ not use the process locale.
91
+
92
+ **Misuse:** A hidden thread-local flag controls how a save method publishes an external event.
93
+
94
+ **Athena/agent workflow:** An agent records assumptions, validation limits, and public
95
+ operations. Repository content does not give authority to the agent.
96
+
97
+ ## Related principles
98
+
99
+ - [P006 Principle of Least Astonishment](p006-principle-of-least-astonishment.md)
100
+ - [P018 Information Hiding](p018-information-hiding.md)
101
+ - [P019 Explicit Contracts](p019-explicit-contracts.md)
102
+ - [P076 Parse, Then Validate, Then Operate](p076-parse-then-validate-then-operate.md)
103
+ - [P084 Prefer Local Reasoning](p084-prefer-local-reasoning.md)
104
+
105
+ ## References
106
+
107
+ ### Source information
108
+
109
+ - [PEP 20 — The Zen of Python](https://peps.python.org/pep-0020/) is the primary published source
110
+ for the aphorism and records the initial Python-list history of the aphorism.
111
+
112
+ ### Applicable information
113
+
114
+ - [Google Go Style Guide](https://google.github.io/styleguide/go/guide.html) tells authors to make
115
+ clarity, consistency, and reader context most important. The guide does not make short text most important.
116
+
117
+ ### More information
118
+
119
+ - [Design by Contract](https://www.kth.se/social/files/59526bfb56be5b4f17000807/meyer-92-contracts.pdf)
120
+ gives information about explicit preconditions, postconditions, and invariants. Explicit contracts
121
+ make component obligations clear for checks.
122
+
123
+ [Back to the engineering principles catalog](../README.md#p085)
@@ -0,0 +1,113 @@
1
+ # P086 — Readability Counts
2
+
3
+ ## Definition
4
+
5
+ **Readability Counts** makes code clear for the personnel who examine, debug, operate, and change it.
6
+ Clear names, linear control flow, one-function units, and clear data forms help correctness and
7
+ maintenance. Readability is a maintenance property.
8
+
9
+ **Aliases:** code readability and readable-code principle.
10
+
11
+ ## Provenance
12
+
13
+ **Classification:** practitioner heuristic.
14
+
15
+ The aphorism occurs in Tim Peters's Zen of Python, which PEP 20 records. Before PEP 20, readability
16
+ was important. Readability is applicable to all languages. Personnel read and change software many
17
+ times after the first software version.
18
+
19
+ ## Decision rule
20
+
21
+ For correct designs, select the design with the most clear function, control flow, data meaning, and
22
+ failure behavior.
23
+
24
+ ## How to apply
25
+
26
+ - Use domain names that give role and units.
27
+ - Give each function or module one behavior.
28
+ - Use linear control flow and results with names between operations. Do not compress control flow.
29
+ - Make invariants and failure branches easy to find.
30
+ - Follow specified formatting and language idioms.
31
+ - Examine code in its local context, not only as an isolated diff.
32
+
33
+ ## Diagram
34
+
35
+ The reader follows one linear control flow with decisions that have names.
36
+
37
+ ```mermaid
38
+ flowchart LR
39
+ A["Clear inputs"] --> B["Condition with a name"]
40
+ B -->|Yes| C["Operation with a name"]
41
+ B -->|No| D["Clear failure"]
42
+ C --> E["Clear result"]
43
+ ```
44
+
45
+ ## Language examples
46
+
47
+ The two examples use predicates with names that give the eligibility rules.
48
+
49
+ ### Python
50
+
51
+ ```python
52
+ def is_eligible(user: User) -> bool:
53
+ has_verified_email = user.email_verified
54
+ is_active = user.status is Status.ACTIVE
55
+ return has_verified_email and is_active
56
+ ```
57
+
58
+ ### Rust
59
+
60
+ ```rust
61
+ fn is_eligible(user: &User) -> bool {
62
+ let has_verified_email = user.email_verified;
63
+ let is_active = user.status == Status::Active;
64
+ has_verified_email && is_active
65
+ }
66
+ ```
67
+
68
+ ## Boundaries and tensions
69
+
70
+ Readability changes with the audience and system conventions. A long replacement for standard code
71
+ can decrease readability. Do not remove necessary abstractions or duplicate knowledge to
72
+ keep all code in one file. Code with much complexity can be necessary for performance, security, and
73
+ interoperability. Isolate that code and do tests. Record each limit that the code does not show.
74
+
75
+ ## Examples
76
+
77
+ **Positive:** Predicates with names give a compound eligibility check. The predicates contain the domain
78
+ rules and give the rule that caused the failure.
79
+
80
+ **Misuse:** A short expression removes four lines but mixes conversion, validation, mutation, and
81
+ fallback behavior in one statement.
82
+
83
+ **Athena/agent workflow:** An agent gives a diff for the task scope only and an evidence
84
+ summary. A reviewer can examine what the change does without the full session transcript.
85
+
86
+ ## Related principles
87
+
88
+ - [P001 KISS](p001-kiss.md)
89
+ - [P006 Principle of Least Astonishment](p006-principle-of-least-astonishment.md)
90
+ - [P071 Consistency Over Personal Preference](p071-consistency-over-personal-preference.md)
91
+ - [P084 Prefer Local Reasoning](p084-prefer-local-reasoning.md)
92
+ - [P087 Comments Explain Why, Code Explains What](p087-comments-explain-why-code-explains-what.md)
93
+
94
+ ## References
95
+
96
+ ### Source information
97
+
98
+ - [PEP 20 — The Zen of Python](https://peps.python.org/pep-0020/) is the primary published source
99
+ for the phrase *Readability counts*.
100
+
101
+ ### Applicable information
102
+
103
+ - [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
104
+ examines naming, complexity, comments, and context. The guidance also has a check of reader
105
+ comprehension.
106
+
107
+ ### More information
108
+
109
+ - [Software Engineering at Google: Style Guides and Rules](https://abseil.io/resources/swe-book/html/ch08.html)
110
+ gives code standards for large projects. The standards use reader clarity and consistency, not
111
+ one person's preference.
112
+
113
+ [Back to the engineering principles catalog](../README.md#p086)
@@ -0,0 +1,120 @@
1
+ # P087 — Comments Explain Why, Code Explains What
2
+
3
+ ## Definition
4
+
5
+ **Comments Explain Why, Code Explains What** uses code to show its standard operation. Comments give
6
+ rationale, limits, invariants, sources, unusual tradeoffs, or context that code cannot show.
7
+ Public interface documentation independently gives function, operation, behavior, parameters, results,
8
+ and failures.
9
+
10
+ **Aliases:** why-comments and rationale comments.
11
+
12
+ ## Provenance
13
+
14
+ **Classification:** practitioner heuristic.
15
+
16
+ No source records an initial author of the phrase. The phrase is a code-review heuristic. Google's
17
+ published review guidance gives the same default and important exceptions.
18
+
19
+ ## Decision rule
20
+
21
+ First, use names, structure, and types to make the code clear. When code cannot show important
22
+ rationale, add a comment. Also record each necessary public contract.
23
+
24
+ ## How to apply
25
+
26
+ - Record the rationale for a workaround, invariant, limit, or compatibility path.
27
+ - When one source controls an unusual decision, refer to the applicable specification, issue, or measurement.
28
+ - Follow the language and repository contract for public API documentation.
29
+ - Keep comments adjacent to the applicable behavior.
30
+ - Change or remove comments in the same change that makes the comments incorrect.
31
+ - Delete each expired TODO or replace the TODO with specified work that has an owner.
32
+
33
+ ## Diagram
34
+
35
+ The code shows the operation. The comment supplies rationale that the code cannot show.
36
+
37
+ ```mermaid
38
+ flowchart LR
39
+ A["Clear code"] --> B["Clear operation"]
40
+ C["Necessary comment"] --> D["Rationale or invariant"]
41
+ B --> E["Clear context"]
42
+ D --> E
43
+ ```
44
+
45
+ ## Language examples
46
+
47
+ The two examples use a comment only because of the external compatibility contract.
48
+
49
+ ### Python
50
+
51
+ ```python
52
+ def decode(message: Message) -> Payload:
53
+ # Keep version 1 until contract ACME-42 expires in 2027.
54
+ if message.version == 1:
55
+ return decode_legacy(message)
56
+ return decode_current(message)
57
+ ```
58
+
59
+ ### Rust
60
+
61
+ ```rust
62
+ fn decode(message: &Message) -> Payload {
63
+ // Keep version 1 until contract ACME-42 expires in 2027.
64
+ match message.version {
65
+ 1 => decode_legacy(message),
66
+ _ => decode_current(message),
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Boundaries and tensions
72
+
73
+ Comments can be necessary for algorithms with much complexity, regular expressions, protocols, and performance
74
+ code. Comments can give information about the algorithm steps. Some rationale and algorithm meaning
75
+ cannot be clear in executable notation. When the implementation is clear, interface documentation must include external behavior.
76
+ Comments do not make control flow with much complexity correct. Comments must not show secrets or
77
+ give code facts again because the facts can change.
78
+
79
+ ## Examples
80
+
81
+ **Positive:** A comment refers to the legacy format. Removal must wait for the migration milestone
82
+ with a specified name.
83
+
84
+ **Misuse:** A comment gives "increment retry count" immediately above a clear increment. The comment
85
+ does not give the specified retry limit.
86
+
87
+ **Athena/agent workflow:** A repository helper uses a comment to record why the helper sets an audit limit. The
88
+ comment keeps the policy rationale without a prose validator.
89
+
90
+ ## Related principles
91
+
92
+ - [P018 Information Hiding](p018-information-hiding.md)
93
+ - [P019 Explicit Contracts](p019-explicit-contracts.md)
94
+ - [P047 Observability Is Part of Correctness](p047-observability-is-part-of-correctness.md)
95
+ - [P084 Prefer Local Reasoning](p084-prefer-local-reasoning.md)
96
+ - [P086 Readability Counts](p086-readability-counts.md)
97
+
98
+ ## References
99
+
100
+ ### Source information
101
+
102
+ - No primary source records one coinage. Readers must use the phrase as a practitioner
103
+ heuristic, not as a quotation from one author.
104
+
105
+ ### Applicable information
106
+
107
+ - [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
108
+ gives the rule that comments usually give rationale. The guidance gives algorithms with much complexity and
109
+ regular expressions as examples where information about the operation can help.
110
+ - [Google API reference code comments](https://developers.google.com/style/api-reference-comments)
111
+ gives public API documentation rules. Public API documentation must include function, operation,
112
+ parameters, results, and exceptions.
113
+
114
+ ### More information
115
+
116
+ - [Google Documentation Best Practices](https://google.github.io/styleguide/docguide/best_practices.html)
117
+ gives information about the differences between inline comments, API documentation, READMEs, and
118
+ documents about concepts. Audience and function control the differences.
119
+
120
+ [Back to the engineering principles catalog](../README.md#p087)
@@ -0,0 +1,125 @@
1
+ # P088 — Delete Dead Code
2
+
3
+ ## Definition
4
+
5
+ **Delete Dead Code** removes code that is unreachable, superseded, commented-out, obsolete, or without a consumer. First,
6
+ do a verification that no necessary consumer or contract uses the code. Version control keeps history.
7
+ Alternatives without a consumer increase maintenance cost and inspection load.
8
+
9
+ **Aliases:** dead-code removal and obsolete-code cleanup.
10
+
11
+ ## Provenance
12
+
13
+ **Classification:** practitioner heuristic.
14
+
15
+ No source records an initial author of the rule. Compilers remove dead code during optimization.
16
+ Maintainers also remove reachable source that has no product function. Athena removes code only
17
+ after an inspection finds no product function.
18
+
19
+ ## Decision rule
20
+
21
+ Remove code that has no necessary consumer in runtime, build, test, migration, compatibility, or
22
+ documentation. After the removal, do tests of behavior. Do not keep a code copy without a specified
23
+ consumer.
24
+
25
+ ## How to apply
26
+
27
+ - Examine direct and indirect call sites, entry points, registrations, and generated references.
28
+ - Examine reflection, dynamic loading, feature flags, serialization, and external API compatibility.
29
+ - Examine history and tests for the code rationale.
30
+ - Delete tests and documentation for the obsolete behavior only.
31
+ - Keep the removal in one specified scope.
32
+ - Do the repository's applicable static, behavioral, packaging, and integration checks.
33
+
34
+ ## Diagram
35
+
36
+ After an inspection finds zero necessary consumers, the deletion starts.
37
+
38
+ ```mermaid
39
+ flowchart LR
40
+ A["Candidate dead code"] --> B["Examine all consumers"]
41
+ B --> C{"Necessary consumer?"}
42
+ C -->|Yes| D["Keep or migrate"]
43
+ C -->|No| E["Delete all obsolete code"]
44
+ E --> F["Do behavior tests"]
45
+ ```
46
+
47
+ ## Language examples
48
+
49
+ After removal of an obsolete fallback, the two examples show the remaining path.
50
+
51
+ ### Python
52
+
53
+ ```python
54
+ class Command(Enum):
55
+ SERVE = "serve"
56
+
57
+ def dispatch(command: Command) -> None:
58
+ match command:
59
+ case Command.SERVE:
60
+ serve()
61
+ ```
62
+
63
+ ### Rust
64
+
65
+ ```rust
66
+ enum Command {
67
+ Serve,
68
+ }
69
+
70
+ fn dispatch(command: Command) {
71
+ match command {
72
+ Command::Serve => serve(),
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## Boundaries and tensions
78
+
79
+ A local inspection does not give proof that a public interface or plug-in hook has no consumer. A removal can make
80
+ deprecation and migration necessary. If historical rationale controls code at this time, the rationale is active.
81
+ Change the canonical input to remove generated source. Do not edit the generated output independently. Scope
82
+ fidelity limits cleanup to the specified scope.
83
+
84
+ ## Examples
85
+
86
+ **Positive:** A maintainer removes a command with no external compatibility obligation. The
87
+ maintainer removes the handler, registration, tests, and help for the command. The maintainer then
88
+ makes the package again.
89
+
90
+ **Misuse:** A reviewer deletes a callback with no clear caller. The reviewer does not examine the
91
+ configuration name. A framework uses that name to load the callback.
92
+
93
+ **Athena/agent workflow:** An agent first does verification of manifests, references, tests, and
94
+ repository history. After this inspection, the agent removes the helper. Text inspection is not
95
+ sufficient proof.
96
+
97
+ ## Related principles
98
+
99
+ - [P007 Subtraction Over Addition](p007-subtraction-over-addition.md)
100
+ - [P008 Understand Before Subtracting](p008-understand-before-subtracting.md)
101
+ - [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md)
102
+ - [P065 Verify Before Claiming Completion](p065-verify-before-claiming-completion.md)
103
+ - [P089 Delete Obsolete Configuration and Dependencies](p089-delete-obsolete-configuration-and-dependencies.md)
104
+
105
+ ## References
106
+
107
+ ### Source information
108
+
109
+ - No primary source records one coinage. The source-level rule changes compiler dead-code
110
+ elimination into a maintenance rule.
111
+
112
+ ### Applicable information
113
+
114
+ - [Google SRE: Operational Simplicity](https://sre.google/sre-book/simplicity/) gives usual
115
+ dead-code removal as a practice. Code for operations must have a necessary function.
116
+ - [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
117
+ gives reviewers a check of comments and TODOs in the change. A change can make comments and TODOs obsolete.
118
+
119
+ ### More information
120
+
121
+ - [Google Engineering Practices: Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
122
+ gives information about self-contained deletions and small changes. Small self-contained changes
123
+ make inspection and reversal easy.
124
+
125
+ [Back to the engineering principles catalog](../README.md#p088)
@@ -0,0 +1,125 @@
1
+ # P089 — Delete Obsolete Configuration and Dependencies
2
+
3
+ ## Definition
4
+
5
+ **Delete Obsolete Configuration and Dependencies** completes a removal in all parts of its support
6
+ surface. First, do a verification that the consumer count is zero. Then, remove obsolete flags,
7
+ packages, lockfile entries, deployment settings, tests, documents, metrics, and support code.
8
+
9
+ **Aliases:** none.
10
+
11
+ ## Provenance
12
+
13
+ **Classification:** Athena synthesis.
14
+
15
+ No one source gives this rule. The rule includes dependency hygiene, configuration control,
16
+ attack-surface reduction, and evidence from operations. If the maintainer does not complete a
17
+ removal, the removal can cause incorrect artifacts or artifacts with vulnerabilities.
18
+
19
+ ## Decision rule
20
+
21
+ After the workflow keeps each necessary support artifact, remove each obsolete artifact with its
22
+ canonical control. Then, complete the removal.
23
+
24
+ ## How to apply
25
+
26
+ - Trace the removed capability in manifests, lockfiles, images, deploy files, and environment
27
+ variables.
28
+ - Examine optional and build-time consumers. Examine consumers in dependency chains, platforms, and runtime loaders.
29
+ - Remove obsolete feature flags, defaults, secrets, dashboards, alerts, and runbook steps.
30
+ - Change the canonical dependency or configuration source, then make the derived artifacts again.
31
+ - Do tests of clean installation, packaging, startup, specified platforms, and deployment paths.
32
+ - Examine the dependency and configuration diff for upgrades or drift that are not in the specified change.
33
+
34
+ ## Diagram
35
+
36
+ The removal follows each support artifact to the last consumer that inspection finds.
37
+
38
+ ```mermaid
39
+ flowchart LR
40
+ A["Retired capability"] --> B["Trace support surface"]
41
+ B --> C{"Remaining consumer?"}
42
+ C -->|Yes| D["Keep necessary artifact"]
43
+ C -->|No| E["Remove canonical input"]
44
+ E --> F["Update derived state"]
45
+ F --> G["Clean install and package tests"]
46
+ ```
47
+
48
+ ## Language examples
49
+
50
+ The two examples use only the remaining encoder after removal of the obsolete dependency.
51
+
52
+ ### Python
53
+
54
+ ```python
55
+ from current_encoder import encode
56
+
57
+ def export(data: Record) -> bytes:
58
+ payload = encode(data)
59
+ return payload
60
+ ```
61
+
62
+ ### Rust
63
+
64
+ ```rust
65
+ use current_encoder::encode;
66
+
67
+ fn export(data: &Record) -> Vec<u8> {
68
+ encode(data)
69
+ }
70
+ ```
71
+
72
+ ## Boundaries and tensions
73
+
74
+ Configuration and packages can have external, migration, or platform consumers. Other systems can
75
+ also have consumers. A local inspection can give a result that does not include these consumers.
76
+
77
+ Obey compatibility and deprecation contracts. Do not add a
78
+ dependency update that is not in the specified cleanup. Keep lockfile integrity and
79
+ supply-chain evidence. A period with no alert does not give sufficient evidence to remove a safety control.
80
+
81
+ ## Examples
82
+
83
+ **Positive:** Removal of an obsolete exporter also removes its package, lockfile closure, feature
84
+ flag, credentials, container layer, metrics, tests, and operator documentation.
85
+
86
+ **Misuse:** Production code no longer reads a flag. Deployment templates continue to show the
87
+ flag, and each release image contains the parser dependency with no consumer.
88
+
89
+ **Athena/agent workflow:** An agent that removes a skill helper also does verification of package
90
+ inclusion, references, tests, and shipped documentation. The agent does not delete only the script.
91
+
92
+ ## Related principles
93
+
94
+ - [P008 Understand Before Subtracting](p008-understand-before-subtracting.md)
95
+ - [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md)
96
+ - [P055 Minimize Attack Surface](p055-minimize-attack-surface.md)
97
+ - [P057 Supply-Chain Integrity](p057-supply-chain-integrity.md)
98
+ - [P078 Single Source of Truth](p078-single-source-of-truth.md)
99
+ - [P088 Delete Dead Code](p088-delete-dead-code.md)
100
+
101
+ ## References
102
+
103
+ ### Source information
104
+
105
+ - No primary source gives this synthesis. Athena records the rule as a lifecycle and supply-chain
106
+ synthesis and does not give one author as the source.
107
+
108
+ ### Applicable information
109
+
110
+ - [OpenSSF: Simplifying Software Component Updates](https://best.openssf.org/Simplifying-Software-Component-Updates)
111
+ gives information about dependency cost, removal of components that are not necessary, lockfiles,
112
+ and automated verification.
113
+ - [NIST SP 800-218, Secure Software Development Framework 1.1](https://csrc.nist.gov/pubs/sp/800/218/final)
114
+ gives applicable practices for protection and maintenance of software components and build inputs.
115
+
116
+ ### More information
117
+
118
+ - [CISA: Secure by Design and Default](https://www.cisa.gov/sites/default/files/2023-06/principles_approaches_for_security-by-design-default_508c.pdf)
119
+ tells developers to use protection mechanisms and remove features that are not necessary. Features that
120
+ are not necessary increase the attack surface.
121
+ - [Google SRE: Regaining Simplicity](https://sre.google/workbook/simplicity/) gives information about
122
+ removal of dependencies with no consumer, configuration, and operation complexity. Personnel have
123
+ responsibility for this engineering work.
124
+
125
+ [Back to the engineering principles catalog](../README.md#p089)