@homericintelligence/athena-opencode 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +30 -17
  2. package/package.json +2 -2
  3. package/plugin.js +20 -5
  4. package/skills/TECHNICAL_ENGLISH.md +78 -0
  5. package/skills/_cli.py +26 -18
  6. package/skills/_support/docs/dependency-resolution.md +192 -0
  7. package/skills/_support/docs/policies/development.md +117 -0
  8. package/skills/_support/docs/policies/evidence-integrity.md +40 -0
  9. package/skills/_support/docs/principles/README.md +542 -0
  10. package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
  11. package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
  12. package/skills/_support/docs/principles/details/p003-dry.md +126 -0
  13. package/skills/_support/docs/principles/details/p004-solid.md +165 -0
  14. package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
  15. package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
  16. package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
  17. package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
  18. package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
  19. package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
  20. package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
  21. package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
  22. package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
  23. package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
  24. package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
  25. package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
  26. package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
  27. package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
  28. package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
  29. package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
  30. package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
  31. package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
  32. package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
  33. package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
  34. package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
  35. package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
  36. package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
  37. package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
  38. package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
  39. package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
  40. package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
  41. package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
  42. package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
  43. package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
  44. package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
  45. package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
  46. package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
  47. package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
  48. package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
  49. package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
  50. package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
  51. package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
  52. package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
  53. package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
  54. package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
  55. package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
  56. package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
  57. package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
  58. package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
  59. package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
  60. package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
  61. package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
  62. package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
  63. package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
  64. package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
  65. package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
  66. package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
  67. package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
  68. package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
  69. package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
  70. package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
  71. package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
  72. package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
  73. package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
  74. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +129 -0
  75. package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
  76. package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
  77. package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
  78. package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
  79. package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
  80. package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
  81. package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
  82. package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
  83. package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
  84. package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
  85. package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
  86. package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
  87. package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
  88. package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
  89. package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
  90. package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
  91. package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
  92. package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
  93. package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
  94. package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
  95. package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
  96. package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
  97. package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
  98. package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
  99. package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
  100. package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
  101. package/skills/_support/docs/review/README.md +59 -0
  102. package/skills/_support/docs/review/behavior-first-testing.md +73 -0
  103. package/skills/_support/docs/review/common.md +365 -0
  104. package/skills/_support/docs/review/design-docs.md +74 -0
  105. package/skills/_support/docs/review/issue-planning.md +220 -0
  106. package/skills/_support/docs/review/language-routing.md +141 -0
  107. package/skills/_support/docs/review/repository-scorecard.md +170 -0
  108. package/skills/advise/SKILL.md +93 -67
  109. package/skills/advise/scripts/list_retrievable_skills.py +3 -3
  110. package/skills/brainstorm/SKILL.md +160 -127
  111. package/skills/change-review/SKILL.md +91 -71
  112. package/skills/change-review/references/scope-resolution.md +69 -46
  113. package/skills/change-review/scripts/resolve_scope.py +119 -73
  114. package/skills/finalize-plan/SKILL.md +198 -139
  115. package/skills/git-worktrees/SKILL.md +100 -80
  116. package/skills/git-worktrees/scripts/prepare_worktree.py +16 -10
  117. package/skills/issue-review/SKILL.md +136 -79
  118. package/skills/learn/SKILL.md +276 -186
  119. package/skills/myrmidon-swarm/SKILL.md +126 -86
  120. package/skills/plan-issue/SKILL.md +122 -81
  121. package/skills/pr-review/SKILL.md +164 -114
  122. package/skills/pr-review/references/criteria.md +58 -37
  123. package/skills/pr-review/references/delivery.md +156 -98
  124. package/skills/pr-review/references/evidence.md +265 -148
  125. package/skills/pr-review/references/prevalidated.md +93 -61
  126. package/skills/pr-review/scripts/collect_evidence.py +211 -140
  127. package/skills/pr-review/scripts/diff_context.py +6 -4
  128. package/skills/pr-review/scripts/materialize_snapshot.py +112 -120
  129. package/skills/pr-review/scripts/pr_identity.py +27 -15
  130. package/skills/pr-review/scripts/resolve_pr.py +53 -31
  131. package/skills/repo-review/SKILL.md +202 -131
  132. package/skills/systematic-debugging/SKILL.md +210 -192
  133. package/skills/systematic-debugging/scripts/repository_evidence.py +9 -4
  134. package/skills/test-driven-development/SKILL.md +126 -96
  135. package/skills/tidy/SKILL.md +92 -59
  136. package/skills/tidy/scripts/run_tidy.py +3 -3
@@ -0,0 +1,113 @@
1
+ # P007 — Subtraction Over Addition
2
+
3
+ ## Definition
4
+
5
+ For **Subtraction Over Addition**, an author must examine removal, consolidation, or reuse
6
+ before an addition. Possible additions include code, state, dependencies, configuration, services, and
7
+ processes. When a current mechanism obeys the requirement, select that mechanism.
8
+
9
+ ## Provenance
10
+
11
+ **Classification:** Athena synthesis.
12
+
13
+ Athena gives this name to an idea from empirical research and established simplicity heuristics. Adams et al.
14
+ found that persons frequently do not examine subtractive changes that have value. The result
15
+ gives evidence for an explicit subtraction prompt. The research does not show that subtraction is always
16
+ the correct engineering decision.
17
+
18
+ ## Decision rule
19
+
20
+ Before you add a component, examine all applicable subtractive or reuse alternatives. When an
21
+ alternative keeps necessary behavior, safety, clarity, and compatibility, select that alternative.
22
+
23
+ ## How to apply
24
+
25
+ - Write the outcome without the proposed new mechanism.
26
+ - Find obsolete branches, redundant state, duplicate authorities, and current capabilities.
27
+ - Compare lifecycle, failure, security, and operation costs, not only implementation work.
28
+ - Before removal, record consumers and contracts.
29
+ - Only when the artifacts are not necessary for current product behavior, delete related tests or
30
+ documentation.
31
+
32
+ ## Diagram
33
+
34
+ ```mermaid
35
+ flowchart TD
36
+ A["Write the necessary outcome"] --> B["Find removal, consolidation, and reuse alternatives"]
37
+ B --> C{"Does an alternative keep all contracts?"}
38
+ C -->|No| D["Add the necessary mechanism"]
39
+ C -->|Yes| E["Select the subtractive alternative"]
40
+ D --> F["Record total system cost"]
41
+ E --> F
42
+ ```
43
+
44
+ ## Language examples
45
+
46
+ The two examples derive the count from records and do not use duplicate state.
47
+
48
+ ```python
49
+ def active_count(users: list[User]) -> int:
50
+ count = 0
51
+ for user in users:
52
+ count += int(user.active)
53
+ return count
54
+ ```
55
+
56
+ ```rust
57
+ fn active_count(users: &[User]) -> usize {
58
+ users
59
+ .iter()
60
+ .filter(|user| user.active)
61
+ .count()
62
+ }
63
+ ```
64
+
65
+ ## Boundaries and tensions
66
+
67
+ Subtraction is a prompt, not proof of safety. It must not remove an implicit requirement,
68
+ compatibility guarantee, security control, observability, or recovery path. First obey
69
+ [P008 Understand Before Subtracting](p008-understand-before-subtracting.md) and
70
+ [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md). A necessary new control
71
+ can increase code and decrease system risk.
72
+
73
+ ## Examples
74
+
75
+ **Positive:** A product requirement specifies a mode. A contributor keeps the mode but deletes its
76
+ duplicate configuration state. The command derives the mode from the repository's configuration authority.
77
+
78
+ **Misuse:** A contributor removes a security check because tests give correct results. The contributor
79
+ does not examine the trust boundary that the check gives protection to.
80
+
81
+ **Athena/agent workflow:** Before an agent adds a documentation generator, the agent examines the
82
+ runtime package for the canonical docs tree. The agent also does a test of standard links for discovery.
83
+
84
+ ## Related principles
85
+
86
+ - [P001 KISS](p001-kiss.md)
87
+ - [P008 Understand Before Subtracting](p008-understand-before-subtracting.md)
88
+ - [P074 Prefer Existing Mechanisms](p074-prefer-existing-mechanisms.md)
89
+ - [P088 Delete Dead Code](p088-delete-dead-code.md)
90
+ - [P089 Delete Obsolete Configuration and Dependencies](p089-delete-obsolete-configuration-and-dependencies.md)
91
+ - [P090 Prefer Negative Code](p090-prefer-negative-code.md)
92
+
93
+ ## References
94
+
95
+ ### Source information
96
+
97
+ - [Adams et al.: People systematically overlook subtractive changes](https://www.nature.com/articles/s41586-021-03380-y)
98
+ gives results from controlled studies about the human preference for additive solutions.
99
+ - [PEP 20 — The Zen of Python](https://peps.python.org/pep-0020/) records a related rule that shows
100
+ simple designs are better than complex designs.
101
+
102
+ ### Applicable information
103
+
104
+ - [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
105
+ tells reviewers to examine code complexity that is not necessary.
106
+
107
+ ### More information
108
+
109
+ - [Google Engineering Practices: Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
110
+ shows why small self-contained changes are easier to examine. It also shows why
111
+ change reversal becomes safer.
112
+
113
+ [Back to the engineering principles catalog](../README.md#p007)
@@ -0,0 +1,115 @@
1
+ # P008 — Understand Before Subtracting
2
+
3
+ ## Definition
4
+
5
+ For **Understand Before Subtracting**, evidence about the purpose of a mechanism is necessary before
6
+ its removal. History, callers, tests, contracts, deployment behavior, and architecture can show
7
+ requirements that the deletion site does not show.
8
+
9
+ ## Provenance
10
+
11
+ **Classification:** Athena synthesis.
12
+
13
+ No single historical source gives this rule. The rule includes software archaeology,
14
+ information hiding, compatibility practice, and Chesterton's fence. Chesterton's fence makes
15
+ it necessary to know the purpose of a boundary before removal.
16
+
17
+ ## Decision rule
18
+
19
+ Before deletion or consolidation, find the mechanism's consumers, observable behavior, owner, and
20
+ initial or current purpose. Then make sure that removal keeps each necessary contract.
21
+
22
+ ## How to apply
23
+
24
+ - Find all consumers. Also find consumers with connections from other components.
25
+ - Read the claims in tests and documentation. Make sure they agree with implementation and history.
26
+ - Examine version history and issue context for compatibility or failure lessons.
27
+ - Find security, migration, cleanup, and operation roles that calls with correct results do not always show.
28
+ - When coverage is not sufficient, add more behavioral evidence before deletion.
29
+
30
+ ## Diagram
31
+
32
+ ```mermaid
33
+ flowchart TD
34
+ A["Select a removal candidate"] --> B["Find consumers, contracts, and history"]
35
+ B --> C["Find the mechanism's current purpose"]
36
+ C --> D{"Does evidence show safe removal?"}
37
+ D -->|No| E["Keep the mechanism"]
38
+ D -->|Yes| F["Remove the mechanism"]
39
+ F --> G["Make sure behavior is correct"]
40
+ ```
41
+
42
+ ## Language examples
43
+
44
+ The two examples reject removal for an active consumer and make removal of a missing handler have no effect.
45
+
46
+ ```python
47
+ def remove_handler(name: str, routes: list[Route], handlers: dict[str, Handler]) -> None:
48
+ if any(route.handler == name for route in routes):
49
+ raise ValueError("handler has a route")
50
+ handlers.pop(name, None)
51
+ ```
52
+
53
+ ```rust
54
+ fn remove_handler(
55
+ name: &str, routes: &[Route], handlers: &mut HashMap<String, Handler>,
56
+ ) -> Result<(), &'static str> {
57
+ if routes.iter().any(|route| route.handler == name) {
58
+ return Err("handler has a route");
59
+ }
60
+ handlers.remove(name);
61
+ Ok(())
62
+ }
63
+ ```
64
+
65
+ ## Boundaries and tensions
66
+
67
+ The investigation must be sufficient for the risk. If evidence shows no consumers for an isolated
68
+ local mechanism, do not examine all history. History is evidence, not an instruction to
69
+ keep obsolete design. After analysis of purpose and consumers,
70
+ [P007 Subtraction Over Addition](p007-subtraction-over-addition.md) and
71
+ [P088 Delete Dead Code](p088-delete-dead-code.md) give evidence for safe removal. Repository policy and task
72
+ authority specify if deletion is in scope.
73
+
74
+ ## Examples
75
+
76
+ **Positive:** Before deletion of a compatibility parser, a maintainer examines callers, release
77
+ notes, fixtures, telemetry, and supported-version policy. The maintainer removes it after support
78
+ for the previous format stops.
79
+
80
+ **Misuse:** A contributor deletes a branch because the current unit test does not select it. The
81
+ contributor has no evidence about execution paths to the branch. Production configuration can select it.
82
+
83
+ **Athena/agent workflow:** An agent reads the package builder and archive tests before a new
84
+ manifest proposal. The agent also examines all consumers before documentation deletion.
85
+
86
+ ## Related principles
87
+
88
+ - [P007 Subtraction Over Addition](p007-subtraction-over-addition.md)
89
+ - [P012 Evidence Before Modification](p012-evidence-before-modification.md)
90
+ - [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md)
91
+ - [P018 Information Hiding](p018-information-hiding.md)
92
+ - [P066 Preserve Existing Work](p066-preserve-existing-work.md)
93
+ - [P088 Delete Dead Code](p088-delete-dead-code.md)
94
+
95
+ ## References
96
+
97
+ ### Source information
98
+
99
+ - [David Parnas: On the Criteria To Be Used in Decomposing Systems into Modules](https://doi.org/10.1145/361598.361623)
100
+ shows why local selections can hide decisions that are important to consumers. Athena gives Parnas
101
+ no source attribution for this rule.
102
+
103
+ ### Applicable information
104
+
105
+ - [Google Engineering Practices: Navigating a CL in review](https://google.github.io/eng-practices/review/reviewer/navigate.html)
106
+ recommends analysis of a change in its related files and system.
107
+ - [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) gives information about why
108
+ removal of public behavior can cause a change that is not compatible.
109
+
110
+ ### More information
111
+
112
+ - [Git documentation: git-log](https://git-scm.com/docs/git-log) is the primary tool to examine
113
+ change history and applicable context.
114
+
115
+ [Back to the engineering principles catalog](../README.md#p008)
@@ -0,0 +1,108 @@
1
+ # P009 — General Mechanisms Over Special Cases
2
+
3
+ ## Definition
4
+
5
+ For **General Mechanisms Over Special Cases**, use one rule, algorithm, data model, or error
6
+ path for the conditions in scope. When one invariant includes the conditions, do not use collections of
7
+ branches for each condition. A general mechanism encodes an invariant that evidence shows. It does not add
8
+ extensibility with no evidence.
9
+
10
+ ## Provenance
11
+
12
+ **Classification:** practitioner heuristic.
13
+
14
+ The idea occurs in mathematics, language design, and software engineering. No source supplies
15
+ sufficient evidence for the initial statement. PEP 20 gives a software statement of the idea. It shows that special cases
16
+ must obey correct rules.
17
+
18
+ ## Decision rule
19
+
20
+ When two or more conditions share one rule that evidence shows, encode that rule one time. When
21
+ variation does not change the rule, show it in data or a contract. When a special case is for a
22
+ different requirement, keep it.
23
+
24
+ ## How to apply
25
+
26
+ - Before you select an abstraction, record the invariant that the conditions share.
27
+ - Do not put necessary policy differences together with input differences that do not change policy.
28
+ - Select a table, normalized representation, or stable protocol. Do not use branches in many locations.
29
+ - Use the same rule to do a test of usual conditions, boundary conditions, unusual conditions, and errors.
30
+ - If a different contract is not clear in one mechanism, keep clear exceptions.
31
+
32
+ ## Diagram
33
+
34
+ ```mermaid
35
+ flowchart TD
36
+ A["Collect the conditions in scope"] --> B["Record the shared invariant"]
37
+ B --> C{"Do all conditions share one contract?"}
38
+ C -->|Yes| D["Encode one general mechanism"]
39
+ C -->|No| E["Keep explicit special cases"]
40
+ D --> F["Do a test of usual, boundary, unusual, and error conditions"]
41
+ E --> F
42
+ ```
43
+
44
+ ## Language examples
45
+
46
+ The two examples show mode variation in data with one lookup rule.
47
+
48
+ ```python
49
+ RATES = {"standard": 5, "express": 20}
50
+
51
+ def shipping_cost(mode: str) -> int | None:
52
+ cost = RATES.get(mode)
53
+ return cost
54
+ ```
55
+
56
+ ```rust
57
+ const RATES: [(&str, u32); 2] = [("standard", 5), ("express", 20)];
58
+
59
+ fn shipping_cost(mode: &str) -> Option<u32> {
60
+ RATES.iter().find(|(name, _)| *name == mode).map(|(_, cost)| *cost)
61
+ }
62
+ ```
63
+
64
+ ## Boundaries and tensions
65
+
66
+ Generalization has a maintenance cost. Two examples can have almost the same behavior without a
67
+ shared invariant. [P013 AHA](p013-avoid-hasty-abstractions.md) and
68
+ [P002 YAGNI](p002-yagni.md) give constraints for this principle. A clear explicit branch can have less
69
+ complexity than a general engine with hidden policy. General mechanisms must keep specified
70
+ failure causes and diagnostics that give value.
71
+
72
+ ## Examples
73
+
74
+ **Positive:** Command variants share one parser and validation pipeline. Data shows
75
+ their correct alternatives.
76
+
77
+ **Misuse:** A configurable state-machine framework puts unrelated deployment workflows together because
78
+ the two workflows have three steps.
79
+
80
+ **Athena/agent workflow:** Review skills use one shared finding contract and add criteria for each
81
+ surface. They do not make unrelated verdict formats for each review type.
82
+
83
+ ## Related principles
84
+
85
+ - [P002 YAGNI](p002-yagni.md)
86
+ - [P003 DRY](p003-dry.md)
87
+ - [P013 AHA](p013-avoid-hasty-abstractions.md)
88
+ - [P029 Generalize Error Policy; Preserve Specific Cause](p029-generalize-error-policy-preserve-specific-cause.md)
89
+ - [P075 Make Invalid States Hard to Represent](p075-make-invalid-states-hard-to-represent.md)
90
+
91
+ ## References
92
+
93
+ ### Source information
94
+
95
+ - [PEP 20 — The Zen of Python](https://peps.python.org/pep-0020/) is a primary language-design
96
+ statement about general rules, practicality, readability, and explicitness.
97
+
98
+ ### Applicable information
99
+
100
+ - [Google Engineering Practices: What to look for in a code review](https://google.github.io/eng-practices/review/reviewer/looking-for.html)
101
+ tells reviewers to examine design, functionality, complexity, and architecture that is not necessary.
102
+
103
+ ### More information
104
+
105
+ - [Sandi Metz: The Wrong Abstraction](https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction)
106
+ shows that correction of an incorrect generalization can cost more than duplication.
107
+
108
+ [Back to the engineering principles catalog](../README.md#p009)
@@ -0,0 +1,117 @@
1
+ # P010 — Scope Fidelity
2
+
3
+ ## Definition
4
+
5
+ **Scope Fidelity** keeps a change in the scope of the specified requirement and necessary work. Cleanup that changes
6
+ more code than necessary is not part of the change without authority for that work. This rule also
7
+ includes cleanup in a component that contains the necessary change. Adjacent features, dependency
8
+ upgrades, redesign, and improvements with no requirement are also out of scope without authority.
9
+
10
+ ## Provenance
11
+
12
+ **Classification:** Athena synthesis.
13
+
14
+ Athena gives this name to a rule from established change management, iterative development, and review
15
+ practices. Athena gives no single historical source for the rule.
16
+
17
+ ## Decision rule
18
+
19
+ Each artifact change must have a clear link to a requirement, acceptance criterion,
20
+ defect, invariant, or necessary implementation dependency. If a change has no trace, keep it out of
21
+ scope. With approved scope expansion, add the change to the scope.
22
+
23
+ ## How to apply
24
+
25
+ - Before an edit, write the requested outcome, constraints, and acceptance criteria.
26
+ - Keep necessary work isolated from cleanup that has no requirement.
27
+ - Keep a clear link from each artifact change to the task requirement.
28
+ - Give information about adjacent problems. Do not change them without authority.
29
+ - When possible, put work with a different purpose in a different issue or change.
30
+
31
+ ## Diagram
32
+
33
+ ```mermaid
34
+ flowchart TD
35
+ A["Write the accepted requirement"] --> B["Write each proposed change"]
36
+ B --> C{"Does the change have a link to the requirement?"}
37
+ C -->|No| D{"Does approved scope include the change?"}
38
+ D -->|No| G["Keep the change out of scope"]
39
+ D -->|Yes| E["Include necessary evidence and migration work"]
40
+ C -->|Yes| E
41
+ E --> F["Make sure the scope is correct"]
42
+ ```
43
+
44
+ ## Language examples
45
+
46
+ The two examples use timeout values from 1 to 18,446,744,073,709,551,615 and change only the requested field.
47
+
48
+ ```python
49
+ U64_MAX = 2**64 - 1
50
+
51
+ def with_timeout(config: dict, timeout: int) -> dict:
52
+ if type(timeout) is not int or not 1 <= timeout <= U64_MAX:
53
+ raise ValueError("timeout is not in the u64 range")
54
+ updated = config.copy()
55
+ updated["timeout"] = timeout
56
+ return updated
57
+ ```
58
+
59
+ ```rust
60
+ fn with_timeout(mut config: Config, timeout: u64) -> Result<Config, &'static str> {
61
+ if timeout == 0 {
62
+ return Err("timeout is not in the u64 range");
63
+ }
64
+ config.timeout = timeout;
65
+ Ok(config)
66
+ }
67
+ ```
68
+
69
+ ## Boundaries and tensions
70
+
71
+ All necessary parts must be in a scope-faithful patch. Necessary tests, documentation, migration,
72
+ security controls, and compatibility work are necessary for a solution that obeys all requirements. An unrelated refactor
73
+ is not necessary only because a person tells authors to do the refactor first. Repository safety and
74
+ quality rules are mandatory when the prompt does not include them. Use
75
+ [P011 Minimal Coherent Change](p011-minimal-coherent-change.md) to find the necessary boundary.
76
+
77
+ ## Examples
78
+
79
+ **Positive:** A parser defect correction changes the parser, adds a regression test, and changes its
80
+ public behavior note. It does not reformat adjacent modules.
81
+
82
+ **Misuse:** A contributor corrects one flag, renames all commands in the family, and upgrades
83
+ unrelated dependencies.
84
+
85
+ **Athena/agent workflow:** An agent records unrelated findings for future work. The current diff
86
+ contains only work for the user request and repository evidence requirements.
87
+
88
+ ## Related principles
89
+
90
+ - [P002 YAGNI](p002-yagni.md)
91
+ - [P011 Minimal Coherent Change](p011-minimal-coherent-change.md)
92
+ - [P012 Evidence Before Modification](p012-evidence-before-modification.md)
93
+ - [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md)
94
+ - [P063 Requirement-to-Code Traceability](p063-requirement-to-code-traceability.md)
95
+ - [P066 Preserve Existing Work](p066-preserve-existing-work.md)
96
+
97
+ ## References
98
+
99
+ ### Source information
100
+
101
+ - [Manifesto for Agile Software Development: Principles](https://agilemanifesto.org/principles.html)
102
+ gives historical primary statements about initial, continuous, and simple delivery. It does not
103
+ include Athena's term “scope fidelity.”
104
+
105
+ ### Applicable information
106
+
107
+ - [Athena development and delivery policy](../../policies/development.md) gives the repository's
108
+ mandatory scope, artifact, and validation rules.
109
+ - [Google Engineering Practices: Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
110
+ shows why one self-contained change is for one issue.
111
+
112
+ ### More information
113
+
114
+ - [Google Engineering Practices: The standard of code review](https://google.github.io/eng-practices/review/reviewer/standard.html)
115
+ connects review decisions to code health without a requirement to correct unrelated defects.
116
+
117
+ [Back to the engineering principles catalog](../README.md#p010)
@@ -0,0 +1,128 @@
1
+ # P011 — Minimal Coherent Change
2
+
3
+ ## Definition
4
+
5
+ A **Minimal Coherent Change** is the smallest self-contained change for one specified purpose.
6
+ It includes the necessary tests, documentation, migration, and safety work. Each part is
7
+ necessary for that purpose. The change keeps unrelated work out.
8
+
9
+ ## Provenance
10
+
11
+ **Classification:** Athena synthesis.
12
+
13
+ Athena gives this name to a rule from established incremental delivery and code review guidance. Small
14
+ changes are easier to examine. A change must also let a reviewer examine all parts and let the
15
+ system operate safely.
16
+
17
+ ## Decision rule
18
+
19
+ Select the narrowest boundary that keeps the specified behavior correct and that evidence shows is necessary.
20
+ Put parts with different purposes in different changes. If separation causes an incorrect state
21
+ after one step or prevents an applicable test, keep the parts together.
22
+
23
+ ## How to apply
24
+
25
+ - Write the change's single purpose.
26
+ - Include all necessary behavior, tests, contract updates, and migration handling.
27
+ - Put cleanup, formatting, dependency updates, and refactors that the requirement does not include
28
+ in a different change.
29
+ - Write commits that keep repository invariants and let a reviewer examine each commit.
30
+ - After the change, examine the diff for files or hunks that are not necessary for the specified purpose.
31
+
32
+ ## Diagram
33
+
34
+ ```mermaid
35
+ flowchart TD
36
+ A["Write one purpose"] --> B["Write necessary behavior and evidence"]
37
+ B --> C["Include all necessary parts"]
38
+ C --> D{"Is each part necessary for the purpose?"}
39
+ D -->|No| E["Move the unrelated part to a different change"]
40
+ E --> D
41
+ D -->|Yes| F["Make sure all parts of the change are correct"]
42
+ ```
43
+
44
+ ## Language examples
45
+
46
+ The two examples remove the same ASCII whitespace, accept ASCII digits from 1 to 4,294,967,295,
47
+ and give the `limit is not correct` error for all incorrect input.
48
+
49
+ ```python
50
+ MAX_LIMIT = 4_294_967_295
51
+ def parse_limit(text: str) -> int:
52
+ normalized = text.strip(" \t\r\n")
53
+ if not normalized.isascii() or not normalized.isdigit():
54
+ raise ValueError("limit is not correct")
55
+ try:
56
+ limit = int(normalized)
57
+ except ValueError as error:
58
+ raise ValueError("limit is not correct") from error
59
+ if not 1 <= limit <= MAX_LIMIT:
60
+ raise ValueError("limit is not correct")
61
+ return limit
62
+ ```
63
+
64
+ ```rust
65
+ fn parse_limit(text: &str) -> Result<u32, &'static str> {
66
+ let normalized = text.trim_matches(|ch| matches!(ch, ' ' | '\t' | '\r' | '\n'));
67
+ if normalized.is_empty() || !normalized.bytes().all(|byte| byte.is_ascii_digit()) {
68
+ return Err("limit is not correct");
69
+ }
70
+ let limit = normalized.parse::<u32>().map_err(|_| "limit is not correct")?;
71
+ if limit == 0 {
72
+ return Err("limit is not correct");
73
+ }
74
+ Ok(limit)
75
+ }
76
+ ```
77
+
78
+ ## Boundaries and tensions
79
+
80
+ Minimal does not mean the minimum number of lines or a patch without all necessary parts. A one-line
81
+ schema change without its migration and checks can be smaller but does not contain all necessary parts. Cleanup does
82
+ not become necessary only because it changes the same file.
83
+ [P010 Scope Fidelity](p010-scope-fidelity.md) gives the necessary purpose boundary.
84
+ [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md) and
85
+ [P021 Evolutionary and Reversible Design](p021-evolutionary-and-reversible-design.md) give constraints for
86
+ delivery of the change.
87
+
88
+ ## Examples
89
+
90
+ **Positive:** A configuration rename includes compatible parsing, migration documentation, and
91
+ tests in one change. Unrelated configuration cleanup is in a different change.
92
+
93
+ **Misuse:** A defect correction has two parts. The design of the first commit makes the build
94
+ incorrect. The second commit makes it correct again. A reviewer cannot examine each commit independently.
95
+
96
+ **Athena/agent workflow:** An agent edits only the canonical skills and shared docs for one issue.
97
+ The agent does repository validation and keeps unrelated files out of the diff.
98
+
99
+ ## Related principles
100
+
101
+ - [P001 KISS](p001-kiss.md)
102
+ - [P010 Scope Fidelity](p010-scope-fidelity.md)
103
+ - [P014 Preserve Unrequested Behavior](p014-preserve-unrequested-behavior.md)
104
+ - [P021 Evolutionary and Reversible Design](p021-evolutionary-and-reversible-design.md)
105
+ - [P063 Requirement-to-Code Traceability](p063-requirement-to-code-traceability.md)
106
+ - [P065 Verify Before Claiming Completion](p065-verify-before-claiming-completion.md)
107
+
108
+ ## References
109
+
110
+ ### Source information
111
+
112
+ - [Manifesto for Agile Software Development: Principles](https://agilemanifesto.org/principles.html)
113
+ is a primary historical source for incremental delivery and simplicity. It does not give
114
+ Athena's specified term.
115
+
116
+ ### Applicable information
117
+
118
+ - [Google Engineering Practices: Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
119
+ shows why a small, self-contained change is for one issue and includes its tests.
120
+ - [Athena development and delivery policy](../../policies/development.md) gives the repository's
121
+ mandatory rules for change scope and artifacts.
122
+
123
+ ### More information
124
+
125
+ - [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) gives a
126
+ convention for communication of commit purpose and compatibility effects.
127
+
128
+ [Back to the engineering principles catalog](../README.md#p011)