@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.
- package/README.md +30 -17
- package/package.json +2 -2
- package/plugin.js +20 -5
- package/skills/TECHNICAL_ENGLISH.md +78 -0
- package/skills/_cli.py +26 -18
- package/skills/_support/docs/dependency-resolution.md +192 -0
- package/skills/_support/docs/policies/development.md +117 -0
- package/skills/_support/docs/policies/evidence-integrity.md +40 -0
- package/skills/_support/docs/principles/README.md +542 -0
- package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
- package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
- package/skills/_support/docs/principles/details/p003-dry.md +126 -0
- package/skills/_support/docs/principles/details/p004-solid.md +165 -0
- package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
- package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
- package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
- package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
- package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
- package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
- package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
- package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
- package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
- package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
- package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
- package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
- package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
- package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
- package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
- package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
- package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
- package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
- package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
- package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
- package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
- package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
- package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
- package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
- package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
- package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
- package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
- package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
- package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
- package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
- package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
- package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
- package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
- package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
- package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
- package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
- package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
- package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
- package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
- package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
- package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
- package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
- package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
- package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
- package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
- package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
- package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
- package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
- package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
- package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
- package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
- package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
- package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
- package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
- package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
- package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
- package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
- package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
- package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
- package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
- package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +129 -0
- package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
- package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
- package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
- package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
- package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
- package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
- package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
- package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
- package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
- package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
- package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
- package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
- package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
- package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
- package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
- package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
- package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
- package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
- package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
- package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
- package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
- package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
- package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
- package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
- package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
- package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
- package/skills/_support/docs/review/README.md +59 -0
- package/skills/_support/docs/review/behavior-first-testing.md +73 -0
- package/skills/_support/docs/review/common.md +365 -0
- package/skills/_support/docs/review/design-docs.md +74 -0
- package/skills/_support/docs/review/issue-planning.md +220 -0
- package/skills/_support/docs/review/language-routing.md +141 -0
- package/skills/_support/docs/review/repository-scorecard.md +170 -0
- package/skills/advise/SKILL.md +93 -67
- package/skills/advise/scripts/list_retrievable_skills.py +3 -3
- package/skills/brainstorm/SKILL.md +160 -127
- package/skills/change-review/SKILL.md +91 -71
- package/skills/change-review/references/scope-resolution.md +69 -46
- package/skills/change-review/scripts/resolve_scope.py +119 -73
- package/skills/finalize-plan/SKILL.md +198 -139
- package/skills/git-worktrees/SKILL.md +100 -80
- package/skills/git-worktrees/scripts/prepare_worktree.py +16 -10
- package/skills/issue-review/SKILL.md +136 -79
- package/skills/learn/SKILL.md +276 -186
- package/skills/myrmidon-swarm/SKILL.md +126 -86
- package/skills/plan-issue/SKILL.md +122 -81
- package/skills/pr-review/SKILL.md +164 -114
- package/skills/pr-review/references/criteria.md +58 -37
- package/skills/pr-review/references/delivery.md +156 -98
- package/skills/pr-review/references/evidence.md +265 -148
- package/skills/pr-review/references/prevalidated.md +93 -61
- package/skills/pr-review/scripts/collect_evidence.py +211 -140
- package/skills/pr-review/scripts/diff_context.py +6 -4
- package/skills/pr-review/scripts/materialize_snapshot.py +112 -120
- package/skills/pr-review/scripts/pr_identity.py +27 -15
- package/skills/pr-review/scripts/resolve_pr.py +53 -31
- package/skills/repo-review/SKILL.md +202 -131
- package/skills/systematic-debugging/SKILL.md +210 -192
- package/skills/systematic-debugging/scripts/repository_evidence.py +9 -4
- package/skills/test-driven-development/SKILL.md +126 -96
- package/skills/tidy/SKILL.md +92 -59
- package/skills/tidy/scripts/run_tidy.py +3 -3
|
@@ -1,244 +1,262 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: systematic-debugging
|
|
3
3
|
license: BSD-3-Clause
|
|
4
|
-
description: Investigate root cause before
|
|
4
|
+
description: Investigate root cause before you repair a bug or unexpected behavior. This skill requires the Mnemosyne knowledge backend through advise. Stop if the backend cannot be prepared.
|
|
5
5
|
argument-hint: <description of the bug or failure>
|
|
6
6
|
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# Systematic
|
|
9
|
+
# Systematic debugging
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
A repair without evidence wastes time and can create a new bug. A repair of only the symptom can
|
|
14
|
+
hide the root cause.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Apply the [ASD-STE100 technical-English policy](../TECHNICAL_ENGLISH.md) to this skill and to
|
|
17
|
+
all prose that it produces.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## Working rules
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Find the root cause before you attempt a repair. Do not repair only the symptom. Follow each
|
|
22
|
+
required step in this process.
|
|
20
23
|
|
|
21
24
|
## Engineering principles
|
|
22
25
|
|
|
23
|
-
Use Athena's [canonical engineering-principles catalog](
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- [P012 — Evidence Before Modification](
|
|
27
|
-
changes, contracts, and repository guidance
|
|
28
|
-
- [P015 — Architecture Conformance](
|
|
29
|
-
|
|
30
|
-
- [P022 — Test Behavior, Not Implementation](
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
Use Athena's [canonical engineering-principles catalog](../_support/docs/principles/README.md) for the
|
|
27
|
+
principle definitions. Use these principles in this workflow:
|
|
28
|
+
|
|
29
|
+
- [P012 — Evidence Before Modification](../_support/docs/principles/README.md#p012): Before you select a
|
|
30
|
+
repair, examine symptoms, changes, contracts, and repository guidance.
|
|
31
|
+
- [P015 — Architecture Conformance](../_support/docs/principles/README.md#p015): Before you change the
|
|
32
|
+
architecture, compare the failure path with the repository boundaries.
|
|
33
|
+
- [P022 — Test Behavior, Not Implementation](../_support/docs/principles/README.md#p022): Reproduce the
|
|
34
|
+
observable contract. Add a test for this contract. Do not add a test for the private
|
|
35
|
+
implementation.
|
|
36
|
+
- [P029 — Generalize Error Policy; Preserve Specific Cause](../_support/docs/principles/README.md#p029):
|
|
37
|
+
Use a stable error policy at the boundary. Keep the initial cause.
|
|
38
|
+
- [P031 — Propagate Rather Than Swallow](../_support/docs/principles/README.md#p031): If this layer cannot
|
|
39
|
+
fully recover from the failure, propagate the failure.
|
|
40
|
+
- [P047 — Observability Is Part of Correctness](../_support/docs/principles/README.md#p047): Collect the
|
|
41
|
+
minimum evidence that is necessary to find the fault. Correlate the evidence. Use a structured
|
|
42
|
+
data format. Do not include sensitive data.
|
|
43
|
+
- [P065 — Verify Before Claiming Completion](../_support/docs/principles/README.md#p065): Before you tell the
|
|
44
|
+
user that you corrected the fault, do the initial reproduction again. Then, do the applicable
|
|
45
|
+
repository checks.
|
|
46
|
+
- [P072 — Technical Evidence Over Preference](../_support/docs/principles/README.md#p072): Use only collected
|
|
47
|
+
evidence to accept or reject a hypothesis.
|
|
48
|
+
|
|
49
|
+
## Before you start
|
|
50
|
+
|
|
51
|
+
Run `advise` with the error description. If you cannot prepare the required knowledge backend,
|
|
52
|
+
stop. Do not skip the prior-knowledge search.
|
|
53
|
+
|
|
54
|
+
## Required sequence
|
|
55
|
+
|
|
56
|
+
Complete phase 1 before you propose a repair.
|
|
57
|
+
|
|
58
|
+
## When to use
|
|
59
|
+
|
|
60
|
+
Use this skill for all technical issues, including:
|
|
61
|
+
|
|
62
|
+
- A test fails.
|
|
63
|
+
- A bug occurs in production.
|
|
64
|
+
- The product has unexpected behavior.
|
|
65
|
+
- The product has a performance problem.
|
|
66
|
+
- A build fails.
|
|
67
|
+
- An integration fails.
|
|
68
|
+
|
|
69
|
+
Use this skill especially in these conditions:
|
|
70
|
+
|
|
71
|
+
- You are under time pressure.
|
|
72
|
+
- A repair appears obvious before an investigation.
|
|
73
|
+
- You already attempted multiple repairs.
|
|
74
|
+
- A previous repair did not work.
|
|
75
|
+
- You do not fully understand the issue.
|
|
76
|
+
|
|
77
|
+
## Workflow
|
|
78
|
+
|
|
79
|
+
Complete each phase before you continue to the next phase.
|
|
80
|
+
|
|
81
|
+
### Phase 1: Root cause investigation
|
|
82
|
+
|
|
83
|
+
Before you attempt a repair, complete these steps:
|
|
84
|
+
|
|
85
|
+
1. Record these items from the complete failure output:
|
|
86
|
+
|
|
87
|
+
- each error and warning;
|
|
88
|
+
- the complete stack trace;
|
|
89
|
+
- line numbers;
|
|
90
|
+
- file paths;
|
|
91
|
+
- error codes.
|
|
92
|
+
|
|
93
|
+
2. Do not skip an error or warning. An error message can identify the cause.
|
|
94
|
+
3. Reproduce the failure consistently.
|
|
95
|
+
4. Record the exact conditions, steps, and frequency of the failure.
|
|
96
|
+
5. If you cannot reproduce the failure, collect more data.
|
|
97
|
+
6. Do not guess the cause.
|
|
98
|
+
7. Compare the failed state with recent repository history.
|
|
99
|
+
8. Inspect these possible sources of the failure:
|
|
100
|
+
|
|
101
|
+
- `git diff`;
|
|
102
|
+
- recent commits;
|
|
103
|
+
- new dependencies;
|
|
104
|
+
- configuration changes;
|
|
105
|
+
- environment differences.
|
|
106
|
+
|
|
107
|
+
9. If the system has multiple components, isolate the failed boundary.
|
|
108
|
+
10. Before you propose a repair, add only the minimum non-sensitive diagnostic instrumentation that
|
|
109
|
+
[P047 — Observability Is Part of Correctness](../_support/docs/principles/README.md#p047) requires.
|
|
110
|
+
11. At each component boundary:
|
|
111
|
+
|
|
112
|
+
- log the input data;
|
|
113
|
+
- log the output data;
|
|
114
|
+
- verify the transfer of environment and configuration data;
|
|
115
|
+
- examine the state at each layer.
|
|
116
|
+
|
|
117
|
+
12. Run the instrumented reproduction one time to collect evidence.
|
|
118
|
+
13. Use the evidence to identify the failed component.
|
|
119
|
+
14. Investigate that component.
|
|
120
|
+
15. If an incorrect value is deep in the call stack, trace the value back to its source.
|
|
121
|
+
16. Identify where the incorrect value starts and which caller supplied it.
|
|
122
|
+
17. Continue the trace until you find the source.
|
|
123
|
+
18. Identify the source as the repair location.
|
|
124
|
+
19. Do not repair only the symptom.
|
|
125
|
+
|
|
126
|
+
### Phase 2: Pattern analysis
|
|
127
|
+
|
|
128
|
+
Identify the pattern before you make a repair:
|
|
129
|
+
|
|
130
|
+
1. Find correct examples of similar code in the same repository.
|
|
131
|
+
2. Read each applicable reference implementation completely.
|
|
132
|
+
3. Do not read only a sample.
|
|
133
|
+
4. List each difference between the correct code and the code that fails.
|
|
134
|
+
5. Identify all dependencies and all configuration and environment assumptions.
|
|
135
|
+
|
|
136
|
+
### Phase 3: Hypothesis and test
|
|
57
137
|
|
|
58
|
-
Use
|
|
138
|
+
Use this method to test a hypothesis:
|
|
59
139
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
140
|
+
1. State one hypothesis: `The root cause is X because Y.`
|
|
141
|
+
2. Make the minimum possible change to test the hypothesis.
|
|
142
|
+
3. Change only one variable in each test.
|
|
143
|
+
4. If the result supports the hypothesis, continue to phase 4.
|
|
144
|
+
5. If the result does not support the hypothesis, state a new hypothesis.
|
|
145
|
+
6. If you do not understand X, state `I do not understand X.`
|
|
146
|
+
7. Do not claim that you understand X.
|
|
66
147
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- Under time pressure (emergencies make guessing tempting)
|
|
70
|
-
- "Just one quick fix" seems obvious
|
|
71
|
-
- You've already tried multiple fixes
|
|
72
|
-
- Previous fix didn't work
|
|
73
|
-
- You don't fully understand the issue
|
|
74
|
-
|
|
75
|
-
## The Four Phases
|
|
76
|
-
|
|
77
|
-
You MUST complete each phase before proceeding to the next.
|
|
78
|
-
|
|
79
|
-
### Phase 1: Root Cause Investigation
|
|
80
|
-
|
|
81
|
-
**BEFORE attempting ANY fix:**
|
|
82
|
-
|
|
83
|
-
1. **Read error messages carefully:** capture the complete failure output.
|
|
84
|
-
- Don't skip past errors or warnings
|
|
85
|
-
- They often contain the exact solution
|
|
86
|
-
- Read stack traces completely
|
|
87
|
-
- Note line numbers, file paths, error codes
|
|
148
|
+
### Phase 4: Implementation
|
|
88
149
|
|
|
89
|
-
|
|
90
|
-
- Can you trigger it reliably?
|
|
91
|
-
- What are the exact steps?
|
|
92
|
-
- Does it happen every time?
|
|
93
|
-
- If not reproducible → gather more data, don't guess
|
|
150
|
+
Repair the root cause.
|
|
94
151
|
|
|
95
|
-
|
|
96
|
-
- What changed that could cause this?
|
|
97
|
-
- `git diff`, recent commits
|
|
98
|
-
- New dependencies, config changes
|
|
99
|
-
- Environmental differences
|
|
152
|
+
Do not repair only the symptom.
|
|
100
153
|
|
|
101
|
-
|
|
154
|
+
1. Use the `test-driven-development` skill to create a regression test.
|
|
155
|
+
2. Under [P026 — Regression Before Repair](../_support/docs/principles/README.md#p026), create the test
|
|
156
|
+
before the repair.
|
|
157
|
+
3. Under [P022](../_support/docs/principles/README.md#p022), make the test assert observable behavior.
|
|
158
|
+
4. Under [P028](../_support/docs/principles/README.md#p028), make the test cover the applicable failure
|
|
159
|
+
path.
|
|
160
|
+
5. Implement one repair that corrects the root cause.
|
|
161
|
+
6. Under [P065](../_support/docs/principles/README.md#p065), run this validation:
|
|
102
162
|
|
|
103
|
-
|
|
163
|
+
- Rerun the reproduction.
|
|
164
|
+
- Run the applicable test suite.
|
|
165
|
+
7. Under [P027](../_support/docs/principles/README.md#p027), keep the test deterministic and isolated.
|
|
166
|
+
8. Under [P067](../_support/docs/principles/README.md#p067), do not weaken tests.
|
|
167
|
+
9. Under [P068](../_support/docs/principles/README.md#p068), do not bypass validation.
|
|
104
168
|
|
|
105
|
-
|
|
106
|
-
[P047 — Observability Is Part of Correctness](../../docs/principles/README.md#p047):**
|
|
169
|
+
If the repair changes failure behavior, complete these steps:
|
|
107
170
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
171
|
+
1. Under [P029](../_support/docs/principles/README.md#p029), generalize the policy.
|
|
172
|
+
2. Under [P029](../_support/docs/principles/README.md#p029), preserve the cause.
|
|
173
|
+
3. Handle the failure at the
|
|
174
|
+
[nearest responsible boundary](../_support/docs/principles/README.md#p030).
|
|
175
|
+
4. [Propagate unrecovered failures](../_support/docs/principles/README.md#p031).
|
|
176
|
+
5. [Handle the failure once without losing causality](../_support/docs/principles/README.md#p032).
|
|
177
|
+
6. Under [P033](../_support/docs/principles/README.md#p033), preserve valid state.
|
|
178
|
+
7. Select [fail-fast](../_support/docs/principles/README.md#p034),
|
|
179
|
+
[fail-closed](../_support/docs/principles/README.md#p035), or
|
|
180
|
+
[graceful degradation](../_support/docs/principles/README.md#p036).
|
|
181
|
+
8. Base this selection on the correctness and security importance of the failed capability.
|
|
114
182
|
|
|
115
|
-
|
|
116
|
-
THEN analyze evidence to identify failing component
|
|
117
|
-
THEN investigate that specific component
|
|
118
|
-
```
|
|
183
|
+
If the repair does not correct the issue, complete these steps:
|
|
119
184
|
|
|
120
|
-
|
|
185
|
+
1. Stop the current repair attempt.
|
|
186
|
+
2. Count the failed repair attempts.
|
|
187
|
+
3. If fewer than three repairs failed, return to phase 1 with the new information.
|
|
188
|
+
4. After three failed repairs, start an architecture review.
|
|
121
189
|
|
|
122
|
-
|
|
123
|
-
- Where does the bad value originate?
|
|
124
|
-
- What called this with the bad value?
|
|
125
|
-
- Keep tracing up until you find the source
|
|
126
|
-
- Fix at source, not at symptom
|
|
190
|
+
### After three failed repairs
|
|
127
191
|
|
|
128
|
-
|
|
192
|
+
Repeated failed repairs can show an incorrect model, a missing dependency, or an architecture
|
|
193
|
+
problem. They require a new assessment. They do not prove that the architecture is incorrect.
|
|
129
194
|
|
|
130
|
-
|
|
195
|
+
Review the evidence for these conditions:
|
|
131
196
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
4. Identify all dependencies, config, environment assumptions
|
|
197
|
+
- Each repair reveals new shared state, coupling, or a problem in another component.
|
|
198
|
+
- A repair requires a large refactor.
|
|
199
|
+
- Each repair creates a new symptom in another component.
|
|
136
200
|
|
|
137
|
-
|
|
201
|
+
Before another repair attempt, discuss the collected evidence with the user. If the evidence shows
|
|
202
|
+
an incorrect hypothesis, return to phase 1. Propose an architecture change only if the evidence
|
|
203
|
+
supports it.
|
|
138
204
|
|
|
139
|
-
|
|
205
|
+
## Stop conditions
|
|
140
206
|
|
|
141
|
-
|
|
142
|
-
2. **Test minimally**: Make the SMALLEST possible change to test the hypothesis
|
|
143
|
-
3. **One variable at a time**: Don't fix multiple things at once
|
|
144
|
-
4. **Verify before continuing**: If it worked → Phase 4. Didn't work → new hypothesis
|
|
145
|
-
5. **When stuck**: Say "I don't understand X" — don't pretend to know
|
|
207
|
+
Stop if one of these conditions applies:
|
|
146
208
|
|
|
147
|
-
|
|
209
|
+
- You plan a temporary repair before an investigation.
|
|
210
|
+
- You plan to change X only to see the result.
|
|
211
|
+
- You plan to make multiple changes before a test.
|
|
212
|
+
- You select a probable cause without evidence.
|
|
213
|
+
- You do not understand the issue but plan a repair.
|
|
214
|
+
- You plan another repair after two failed repairs.
|
|
215
|
+
- Each repair reveals a new problem in a different component.
|
|
148
216
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
1. **Create a regression test** using the `test-driven-development` skill. Follow
|
|
152
|
-
[P026 — Regression Before Repair](../../docs/principles/README.md#p026), assert observable behavior
|
|
153
|
-
under [P022](../../docs/principles/README.md#p022), and cover the relevant failure path under
|
|
154
|
-
[P028](../../docs/principles/README.md#p028).
|
|
155
|
-
2. **Implement single fix** addressing the root cause
|
|
156
|
-
3. **Verify the fix** under [P065](../../docs/principles/README.md#p065): rerun the reproduction and
|
|
157
|
-
relevant suite, preserve determinism and isolation under
|
|
158
|
-
[P027](../../docs/principles/README.md#p027), and do not weaken tests or bypass validation under
|
|
159
|
-
[P067](../../docs/principles/README.md#p067) and
|
|
160
|
-
[P068](../../docs/principles/README.md#p068).
|
|
161
|
-
|
|
162
|
-
When the repair changes failure behavior, choose the responsible boundary deliberately:
|
|
163
|
-
generalize policy while preserving cause under [P029](../../docs/principles/README.md#p029), handle
|
|
164
|
-
at the [nearest responsible boundary](../../docs/principles/README.md#p030),
|
|
165
|
-
[propagate unrecovered failures](../../docs/principles/README.md#p031), and
|
|
166
|
-
[handle once without losing causality](../../docs/principles/README.md#p032). Preserve valid state
|
|
167
|
-
under [P033](../../docs/principles/README.md#p033), then choose
|
|
168
|
-
[fail-fast](../../docs/principles/README.md#p034),
|
|
169
|
-
[fail-closed](../../docs/principles/README.md#p035), or
|
|
170
|
-
[graceful degradation](../../docs/principles/README.md#p036) according to the failed capability's
|
|
171
|
-
correctness and security criticality.
|
|
172
|
-
|
|
173
|
-
4. **If fix doesn't work:**
|
|
174
|
-
- STOP
|
|
175
|
-
- Count: How many fixes have you tried?
|
|
176
|
-
- If < 3: Return to Phase 1 with new information
|
|
177
|
-
- **If ≥ 3:** STOP and trigger an architecture review
|
|
178
|
-
|
|
179
|
-
5. **If 3+ fixes failed — Review Architecture:**
|
|
180
|
-
|
|
181
|
-
Repeated failed fixes can indicate a mistaken model, a missed dependency, or an architectural
|
|
182
|
-
problem. They trigger reassessment; they do not prove the architecture is wrong. Review:
|
|
183
|
-
- Each fix reveals new shared state/coupling/problem elsewhere
|
|
184
|
-
- Fixes require massive refactoring to implement
|
|
185
|
-
- Each fix creates new symptoms elsewhere
|
|
186
|
-
|
|
187
|
-
STOP and discuss the accumulated evidence with the user before another repair attempt. Revisit
|
|
188
|
-
Phase 1 when the evidence points to a bad hypothesis; propose an architectural change only when
|
|
189
|
-
the evidence supports it.
|
|
190
|
-
|
|
191
|
-
## Red Flags — STOP and Follow Process
|
|
192
|
-
|
|
193
|
-
- "Quick fix for now, investigate later"
|
|
194
|
-
- "Just try changing X and see if it works"
|
|
195
|
-
- "Add multiple changes, run tests"
|
|
196
|
-
- "It's probably X, let me fix that"
|
|
197
|
-
- "I don't fully understand but this might work"
|
|
198
|
-
- "One more fix attempt" (when already tried 2+)
|
|
199
|
-
- Each fix reveals a new problem in a different place
|
|
200
|
-
|
|
201
|
-
**ALL of these mean: STOP. Return to Phase 1.**
|
|
217
|
+
After you stop, return to phase 1.
|
|
202
218
|
|
|
203
219
|
## Failed approaches
|
|
204
220
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
221
|
+
- Do not omit this process for a simple issue. A simple issue also has a root cause.
|
|
222
|
+
- Do not omit this process during an emergency. Systematic debugging is faster than repairs without
|
|
223
|
+
evidence.
|
|
224
|
+
- Do not attempt a repair before the investigation. The first repair can affect the next evidence.
|
|
225
|
+
- Do not make multiple repairs at the same time. You cannot identify which repair changed the
|
|
226
|
+
result, and the repairs can cause new bugs.
|
|
227
|
+
- After three failed repairs, do not make another repair from a guess. Start an architecture review.
|
|
212
228
|
|
|
213
229
|
## Repository command discovery
|
|
214
230
|
|
|
215
|
-
Before
|
|
216
|
-
manifests, lockfiles, and CI. Prefer the command
|
|
217
|
-
|
|
231
|
+
Before you run a check, find the target repository commands. Inspect `AGENTS.md`, task runners,
|
|
232
|
+
manifests, lockfiles, and continuous integration (CI) configuration. Prefer the command that required
|
|
233
|
+
CI uses.
|
|
234
|
+
If the sources conflict or you cannot find a safe command, ask the user. Do not use Athena commands
|
|
235
|
+
as a substitute.
|
|
218
236
|
|
|
219
237
|
Keep the target repository as the current working directory. Resolve
|
|
220
|
-
`scripts/repository_evidence.py` against this installed skill directory
|
|
221
|
-
|
|
222
|
-
bounded to that revision window, and matching source locations as JSON. Run the
|
|
223
|
-
|
|
224
|
-
|
|
238
|
+
`scripts/repository_evidence.py` against this installed skill directory. Invoke that absolute helper
|
|
239
|
+
path with `PATTERN --source-root SOURCE_ROOT`. The helper collects the latest ten commits, a diff
|
|
240
|
+
bounded to that revision window, and matching source locations as JSON. Run the discovered
|
|
241
|
+
repository-focused test and type-check commands through the host execution tool. Keep their complete
|
|
242
|
+
output as evidence.
|
|
225
243
|
|
|
226
|
-
## After
|
|
244
|
+
## After resolution
|
|
227
245
|
|
|
228
|
-
|
|
229
|
-
[evidence-integrity policy](
|
|
230
|
-
|
|
246
|
+
Before you state that the bug is fixed, verify the result with fresh runnable evidence under the
|
|
247
|
+
[evidence-integrity policy](../_support/docs/policies/evidence-integrity.md). Rerun the original
|
|
248
|
+
reproduction. Run the repository-defined checks again.
|
|
231
249
|
|
|
232
|
-
|
|
233
|
-
invocation
|
|
234
|
-
|
|
250
|
+
If the session produces durable debugging knowledge, offer to invoke `learn`. An indirect `learn`
|
|
251
|
+
invocation is read-only and does not increase the requested scope. If the user requests durable
|
|
252
|
+
learning, use the delivery boundary of `learn`. Useful lessons include these items:
|
|
235
253
|
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
-
|
|
239
|
-
-
|
|
254
|
+
- the root-cause category and symptoms;
|
|
255
|
+
- the diagnostic steps that revealed the cause;
|
|
256
|
+
- the repair pattern; and
|
|
257
|
+
- each architecture issue that the investigation found.
|
|
240
258
|
|
|
241
|
-
This prevents
|
|
259
|
+
This record prevents another agent from repeating the same debugging session.
|
|
242
260
|
|
|
243
261
|
---
|
|
244
262
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""Collect reproducible recent
|
|
2
|
+
"""Collect reproducible evidence about recent changes and source patterns."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -18,7 +18,10 @@ EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
|
18
18
|
def run(*arguments: str, accepted_codes: tuple[int, ...] = (0,)) -> str:
|
|
19
19
|
result = run_command(arguments, capture_output=True, text=True, check=False)
|
|
20
20
|
if result.returncode not in accepted_codes:
|
|
21
|
-
raise RuntimeError(
|
|
21
|
+
raise RuntimeError(
|
|
22
|
+
result.stderr.strip()
|
|
23
|
+
or f"The command failed. Command: {' '.join(arguments)}"
|
|
24
|
+
)
|
|
22
25
|
return result.stdout
|
|
23
26
|
|
|
24
27
|
|
|
@@ -33,9 +36,11 @@ def main() -> int:
|
|
|
33
36
|
"git", "rev-list", "--max-count=10", "HEAD"
|
|
34
37
|
).splitlines()
|
|
35
38
|
except RuntimeError as error:
|
|
36
|
-
raise RuntimeError(f"cannot resolve HEAD: {error}") from error
|
|
39
|
+
raise RuntimeError(f"The tool cannot resolve HEAD: {error}") from error
|
|
37
40
|
if not recent_revisions:
|
|
38
|
-
raise RuntimeError(
|
|
41
|
+
raise RuntimeError(
|
|
42
|
+
"The tool cannot resolve HEAD because the repository has no commits."
|
|
43
|
+
)
|
|
39
44
|
recent_commits = run("git", "log", "--oneline", "-10")
|
|
40
45
|
oldest_parent = run(
|
|
41
46
|
"git",
|