intentdna 1.5.7 → 1.5.9
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/dist/cli/commands/templates.d.ts +10 -0
- package/dist/cli/commands/templates.js +85 -0
- package/dist/cli/index.js +12 -0
- package/dist/compiler/activate.d.ts +1 -0
- package/dist/compiler/activate.js +1 -0
- package/dist/compiler/compile.js +13 -3
- package/dist/schema/types.d.ts +1 -0
- package/dist/templates/code-cleanup.dna.yaml +152 -0
- package/dist/templates/flutter-rewrite.dna.yaml +24 -8
- package/dist/templates/persistent-executor.dna.yaml +144 -0
- package/dist/templates/qa-loop.dna.yaml +147 -0
- package/dist/templates/requirements-gate.dna.yaml +116 -0
- package/dist/templates/research-orchestration.dna.yaml +145 -0
- package/dist/templates/root-cause-analysis.dna.yaml +140 -0
- package/dist/templates/systematic-debugging.dna.yaml +94 -0
- package/dist/templates/tdd-strict.dna.yaml +94 -10
- package/package.json +1 -1
- package/spec/flutter-rewrite-template-optimization.md +40 -9
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
version: "0.1.0"
|
|
2
|
+
id: template_qa_loop
|
|
3
|
+
name: QA Loop (Test-Fix Cycle)
|
|
4
|
+
type: project
|
|
5
|
+
namespace: ql
|
|
6
|
+
|
|
7
|
+
cascade:
|
|
8
|
+
inherits: ["species:default"]
|
|
9
|
+
priority: 100
|
|
10
|
+
|
|
11
|
+
genes:
|
|
12
|
+
convergence_protection:
|
|
13
|
+
description: Stop if no progress after 2 consecutive rounds
|
|
14
|
+
codons:
|
|
15
|
+
- type: threshold
|
|
16
|
+
condition: "consecutive_no_progress_rounds <= 2"
|
|
17
|
+
action: block
|
|
18
|
+
- type: attract
|
|
19
|
+
target: track_test_progress_per_round
|
|
20
|
+
- type: repel
|
|
21
|
+
target: infinite_retry_loop
|
|
22
|
+
|
|
23
|
+
separate_test_fix:
|
|
24
|
+
description: Tester and fixer must be separate roles
|
|
25
|
+
codons:
|
|
26
|
+
- type: threshold
|
|
27
|
+
condition: "tester_is_not_fixer == true"
|
|
28
|
+
action: block
|
|
29
|
+
- type: repel
|
|
30
|
+
target: self_test_own_fix
|
|
31
|
+
|
|
32
|
+
evidence_based_diagnosis:
|
|
33
|
+
description: Diagnose from test output, not guessing
|
|
34
|
+
role: workflow_hint
|
|
35
|
+
codons:
|
|
36
|
+
- type: attract
|
|
37
|
+
target: read_error_output_first
|
|
38
|
+
- type: repel
|
|
39
|
+
target: guess_without_running_tests
|
|
40
|
+
- type: attract
|
|
41
|
+
target: categorize_failures_by_type
|
|
42
|
+
|
|
43
|
+
regression_awareness:
|
|
44
|
+
description: Fixes must not introduce new failures
|
|
45
|
+
codons:
|
|
46
|
+
- type: threshold
|
|
47
|
+
condition: "new_failures_introduced == 0"
|
|
48
|
+
action: escalate
|
|
49
|
+
- type: attract
|
|
50
|
+
target: run_full_suite_after_fix
|
|
51
|
+
|
|
52
|
+
contexts: {}
|
|
53
|
+
|
|
54
|
+
roles:
|
|
55
|
+
tester:
|
|
56
|
+
description: Runs tests, diagnoses failures, categorizes issues. Read-only.
|
|
57
|
+
tool_permissions:
|
|
58
|
+
allow: [Read, Grep, Glob, Bash]
|
|
59
|
+
deny: [Edit, Write, NotebookEdit]
|
|
60
|
+
scope:
|
|
61
|
+
read: ["**/*"]
|
|
62
|
+
write: []
|
|
63
|
+
instructions:
|
|
64
|
+
- Run the full test suite
|
|
65
|
+
- Categorize failures by type (compile, logic, integration, flaky)
|
|
66
|
+
- For each failure trace the root cause
|
|
67
|
+
- Prioritize by severity
|
|
68
|
+
- Compare results with previous round — track progress
|
|
69
|
+
- Do NOT suggest code changes
|
|
70
|
+
|
|
71
|
+
fixer:
|
|
72
|
+
description: Fixes issues identified by tester. Can modify code.
|
|
73
|
+
tool_permissions:
|
|
74
|
+
allow: [Read, Edit, Write, Grep, Glob, Bash]
|
|
75
|
+
scope:
|
|
76
|
+
read: ["**/*"]
|
|
77
|
+
write: ["src/**", "lib/**", "test/**"]
|
|
78
|
+
instructions:
|
|
79
|
+
- Fix issues in priority order (compile first, then logic, then integration)
|
|
80
|
+
- One fix at a time, run tests after each
|
|
81
|
+
- If a fix introduces new failures, revert immediately
|
|
82
|
+
- Maximum 5 files per round
|
|
83
|
+
- "Same issue failing 3 times → STOP, report as blocked"
|
|
84
|
+
- Commit after each successful fix batch
|
|
85
|
+
|
|
86
|
+
workflows:
|
|
87
|
+
qa-cycle:
|
|
88
|
+
name: QA Cycle
|
|
89
|
+
description: "Test-fix loop: test, diagnose, fix, retest. Max 5 rounds with convergence protection."
|
|
90
|
+
max_rounds: 5
|
|
91
|
+
convergence_rule: "2 consecutive rounds with 0 test progress → STOP"
|
|
92
|
+
steps:
|
|
93
|
+
- id: test
|
|
94
|
+
role: tester
|
|
95
|
+
description: "Run tests and categorize failures."
|
|
96
|
+
prompt: |
|
|
97
|
+
Run the test suite. Record results:
|
|
98
|
+
- Total tests, passing, failing, skipped
|
|
99
|
+
- If round > 1: compare with previous round results
|
|
100
|
+
- Categorize each failure:
|
|
101
|
+
COMPILE: syntax/import errors — fix first
|
|
102
|
+
LOGIC: assertion failures — fix after compile
|
|
103
|
+
INTEGRATION: cross-module issues — fix after logic
|
|
104
|
+
FLAKY: intermittent failures — deprioritize
|
|
105
|
+
- If 0 failures: "All tests passing. QA complete."
|
|
106
|
+
- If round > 1 and no progress: warn "no improvement"
|
|
107
|
+
|
|
108
|
+
- id: diagnose
|
|
109
|
+
role: tester
|
|
110
|
+
depends_on: [test]
|
|
111
|
+
description: "Root cause analysis for top failures."
|
|
112
|
+
prompt: |
|
|
113
|
+
For the top 3 failures (by severity):
|
|
114
|
+
1. Read the error output carefully
|
|
115
|
+
2. Trace to the root cause in source code
|
|
116
|
+
3. Identify the minimal fix needed
|
|
117
|
+
4. Check if failures are related (shared root cause)
|
|
118
|
+
Output: prioritized fix list with file paths and line numbers.
|
|
119
|
+
|
|
120
|
+
- id: fix
|
|
121
|
+
role: fixer
|
|
122
|
+
depends_on: [diagnose]
|
|
123
|
+
description: "Apply fixes for diagnosed issues."
|
|
124
|
+
prompt: |
|
|
125
|
+
Fix the diagnosed issues. Rules:
|
|
126
|
+
- Follow the priority order from diagnosis
|
|
127
|
+
- One fix at a time → run tests → verify
|
|
128
|
+
- If fix causes new failures: revert and try different approach
|
|
129
|
+
- Maximum 5 files per round
|
|
130
|
+
- Same issue failed 3 times → STOP and report as blocked
|
|
131
|
+
- Commit: "fix($TYPE): description of what was fixed"
|
|
132
|
+
|
|
133
|
+
- id: retest
|
|
134
|
+
role: tester
|
|
135
|
+
depends_on: [fix]
|
|
136
|
+
description: "Verify fixes and check for regressions."
|
|
137
|
+
prompt: |
|
|
138
|
+
Run the full test suite again:
|
|
139
|
+
1. Are the targeted failures fixed?
|
|
140
|
+
2. Any new regressions introduced?
|
|
141
|
+
3. Test delta: +N fixed, -M new failures
|
|
142
|
+
|
|
143
|
+
Progress check:
|
|
144
|
+
- If all tests pass: "QA complete. All green."
|
|
145
|
+
- If progress made (fewer failures): "Round N: +X fixed. Continue."
|
|
146
|
+
- If no progress (same or more failures): "No progress. [2 rounds → STOP]"
|
|
147
|
+
- If blocked items exist: "Blocked on: [list]. Human intervention needed."
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# requirements-gate: 需求清晰度门控
|
|
2
|
+
# 在需求明确(>=80%)之前阻止实现,每轮只问一个问题
|
|
3
|
+
# 适用: 任何需要"先澄清需求再动手"的项目
|
|
4
|
+
|
|
5
|
+
version: "0.1.0"
|
|
6
|
+
id: template_requirements_gate
|
|
7
|
+
name: Requirements Clarity Gate
|
|
8
|
+
type: project
|
|
9
|
+
namespace: rg
|
|
10
|
+
|
|
11
|
+
cascade:
|
|
12
|
+
inherits: ["species:default"]
|
|
13
|
+
priority: 100
|
|
14
|
+
|
|
15
|
+
genes:
|
|
16
|
+
clarity_threshold:
|
|
17
|
+
description: Block implementation until requirements are sufficiently clear (>=80%)
|
|
18
|
+
codons:
|
|
19
|
+
- type: threshold
|
|
20
|
+
condition: "requirements_clarity_score >= 80"
|
|
21
|
+
action: block
|
|
22
|
+
- type: attract
|
|
23
|
+
target: clarify_before_building
|
|
24
|
+
- type: repel
|
|
25
|
+
target: implement_with_ambiguity
|
|
26
|
+
|
|
27
|
+
one_question_per_round:
|
|
28
|
+
description: Ask one focused question at a time to reduce cognitive load
|
|
29
|
+
role: workflow_hint
|
|
30
|
+
codons:
|
|
31
|
+
- type: attract
|
|
32
|
+
target: single_focused_question
|
|
33
|
+
- type: repel
|
|
34
|
+
target: question_dump
|
|
35
|
+
|
|
36
|
+
target_weakest_dimension:
|
|
37
|
+
description: Always probe the least clear dimension first
|
|
38
|
+
role: workflow_hint
|
|
39
|
+
codons:
|
|
40
|
+
- type: attract
|
|
41
|
+
target: identify_weakest_area
|
|
42
|
+
- type: repel
|
|
43
|
+
target: redundant_clarification
|
|
44
|
+
|
|
45
|
+
structured_output:
|
|
46
|
+
description: Requirements must be structured and actionable
|
|
47
|
+
codons:
|
|
48
|
+
- type: attract
|
|
49
|
+
target: testable_acceptance_criteria
|
|
50
|
+
- type: repel
|
|
51
|
+
target: vague_requirements
|
|
52
|
+
- type: attract
|
|
53
|
+
target: explicit_constraints
|
|
54
|
+
|
|
55
|
+
contexts: {}
|
|
56
|
+
|
|
57
|
+
roles:
|
|
58
|
+
interviewer:
|
|
59
|
+
description: Evaluates requirements clarity and asks clarifying questions. Read-only.
|
|
60
|
+
tool_permissions:
|
|
61
|
+
allow: [Read, Grep, Glob, Bash]
|
|
62
|
+
deny: [Edit, Write, NotebookEdit]
|
|
63
|
+
scope:
|
|
64
|
+
read: ["**/*"]
|
|
65
|
+
write: []
|
|
66
|
+
instructions:
|
|
67
|
+
- Evaluate requirements across 4 dimensions (Goal, Constraints, Criteria, Context)
|
|
68
|
+
- Score each dimension 0-100
|
|
69
|
+
- If average < 80 output the most critical question targeting the weakest dimension
|
|
70
|
+
- If average >= 80 output structured requirements document
|
|
71
|
+
- One question per round — do not dump multiple questions
|
|
72
|
+
- "80% threshold rationale: below this, >1/5 dimensions are underspecified"
|
|
73
|
+
|
|
74
|
+
workflows:
|
|
75
|
+
requirements-gate:
|
|
76
|
+
name: Requirements Gate
|
|
77
|
+
description: "Evaluate requirements clarity, block if ambiguous, proceed if clear"
|
|
78
|
+
steps:
|
|
79
|
+
- id: clarity_check
|
|
80
|
+
role: interviewer
|
|
81
|
+
description: "Score requirements across 4 dimensions."
|
|
82
|
+
prompt: |
|
|
83
|
+
Evaluate the given requirements across 4 dimensions:
|
|
84
|
+
|
|
85
|
+
1. Goal (0-100): Is the desired outcome clear and measurable?
|
|
86
|
+
2. Constraints (0-100): Are boundaries, limitations, and non-goals defined?
|
|
87
|
+
3. Criteria (0-100): Are acceptance criteria specific and testable?
|
|
88
|
+
4. Context (0-100): Is the technical/business context sufficient?
|
|
89
|
+
|
|
90
|
+
Calculate average score.
|
|
91
|
+
|
|
92
|
+
If average >= 80:
|
|
93
|
+
Output: structured requirements document with all 4 dimensions filled.
|
|
94
|
+
Status: PROCEED
|
|
95
|
+
|
|
96
|
+
If average < 80:
|
|
97
|
+
Identify the weakest dimension.
|
|
98
|
+
Output: one specific clarifying question targeting that dimension.
|
|
99
|
+
Status: BLOCK — "Requirements clarity at N%. Need clarification on: [dimension]"
|
|
100
|
+
|
|
101
|
+
- id: proceed_or_block
|
|
102
|
+
role: interviewer
|
|
103
|
+
depends_on: [clarity_check]
|
|
104
|
+
description: "Gate decision based on clarity score."
|
|
105
|
+
prompt: |
|
|
106
|
+
Based on clarity check results:
|
|
107
|
+
|
|
108
|
+
If PROCEED: Format the requirements as a structured spec:
|
|
109
|
+
- Goal: [what]
|
|
110
|
+
- Constraints: [boundaries]
|
|
111
|
+
- Acceptance Criteria: [testable conditions]
|
|
112
|
+
- Context: [technical/business background]
|
|
113
|
+
- Out of Scope: [explicit exclusions]
|
|
114
|
+
|
|
115
|
+
If BLOCK: Summarize what's missing and the question to ask.
|
|
116
|
+
Do NOT proceed with implementation planning until clarity >= 80%.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# research-orchestration: 并行假设驱动研究
|
|
2
|
+
# 适用: 需要结构化调研、多角度验证、有据可查结论的研究任务
|
|
3
|
+
|
|
4
|
+
version: "0.1.0"
|
|
5
|
+
id: template_research_orchestration
|
|
6
|
+
name: Research Orchestration (Parallel Hypotheses)
|
|
7
|
+
type: project
|
|
8
|
+
namespace: ro
|
|
9
|
+
|
|
10
|
+
cascade:
|
|
11
|
+
inherits: ["species:default"]
|
|
12
|
+
priority: 100
|
|
13
|
+
|
|
14
|
+
genes:
|
|
15
|
+
hypothesis_driven:
|
|
16
|
+
description: Research must start with explicit hypotheses before investigation
|
|
17
|
+
codons:
|
|
18
|
+
- type: threshold
|
|
19
|
+
condition: "hypotheses_defined == true"
|
|
20
|
+
action: block
|
|
21
|
+
- type: attract
|
|
22
|
+
target: state_hypothesis_before_investigating
|
|
23
|
+
- type: repel
|
|
24
|
+
target: undirected_exploration
|
|
25
|
+
|
|
26
|
+
cross_verify:
|
|
27
|
+
description: Findings must be cross-verified by independent researchers
|
|
28
|
+
role: workflow_hint
|
|
29
|
+
codons:
|
|
30
|
+
- type: attract
|
|
31
|
+
target: independent_verification
|
|
32
|
+
- type: repel
|
|
33
|
+
target: single_source_conclusion
|
|
34
|
+
|
|
35
|
+
evidence_graded:
|
|
36
|
+
description: Grade evidence quality and distinguish fact from inference
|
|
37
|
+
role: workflow_hint
|
|
38
|
+
codons:
|
|
39
|
+
- type: attract
|
|
40
|
+
target: grade_source_reliability
|
|
41
|
+
- type: attract
|
|
42
|
+
target: separate_fact_from_interpretation
|
|
43
|
+
- type: repel
|
|
44
|
+
target: treat_all_evidence_equally
|
|
45
|
+
|
|
46
|
+
structured_synthesis:
|
|
47
|
+
description: Synthesis must address all hypotheses with evidence
|
|
48
|
+
codons:
|
|
49
|
+
- type: threshold
|
|
50
|
+
condition: "all_hypotheses_addressed == true"
|
|
51
|
+
action: escalate
|
|
52
|
+
- type: attract
|
|
53
|
+
target: evidence_based_conclusions
|
|
54
|
+
|
|
55
|
+
contexts: {}
|
|
56
|
+
|
|
57
|
+
roles:
|
|
58
|
+
lead_researcher:
|
|
59
|
+
description: Decomposes questions, synthesizes findings. Read-only.
|
|
60
|
+
tool_permissions:
|
|
61
|
+
allow: [Read, Grep, Glob, Bash]
|
|
62
|
+
deny: [Edit, Write, NotebookEdit]
|
|
63
|
+
scope:
|
|
64
|
+
read: ["**/*"]
|
|
65
|
+
write: []
|
|
66
|
+
instructions:
|
|
67
|
+
- Decompose the research question into sub-questions
|
|
68
|
+
- Formulate hypotheses for each sub-question
|
|
69
|
+
- After investigation synthesize findings across all researchers
|
|
70
|
+
- Grade overall confidence in conclusions
|
|
71
|
+
- Identify remaining unknowns and next steps
|
|
72
|
+
|
|
73
|
+
researcher:
|
|
74
|
+
description: Investigates specific sub-questions. Read-only with analysis tools.
|
|
75
|
+
tool_permissions:
|
|
76
|
+
allow: [Read, Grep, Glob, Bash]
|
|
77
|
+
deny: [Edit, Write, NotebookEdit]
|
|
78
|
+
scope:
|
|
79
|
+
read: ["**/*"]
|
|
80
|
+
write: []
|
|
81
|
+
instructions:
|
|
82
|
+
- Focus on assigned sub-question only
|
|
83
|
+
- State hypothesis before investigating
|
|
84
|
+
- Gather evidence from code, docs, logs, tests
|
|
85
|
+
- Grade each piece of evidence (strong/moderate/weak)
|
|
86
|
+
- Report findings with evidence quality ratings
|
|
87
|
+
- Flag uncertainties and assumptions explicitly
|
|
88
|
+
|
|
89
|
+
workflows:
|
|
90
|
+
research:
|
|
91
|
+
name: Research
|
|
92
|
+
description: "Parallel hypothesis research: decompose, investigate, verify, synthesize"
|
|
93
|
+
steps:
|
|
94
|
+
- id: decompose
|
|
95
|
+
role: lead_researcher
|
|
96
|
+
description: "Break research question into sub-questions with hypotheses."
|
|
97
|
+
prompt: |
|
|
98
|
+
Analyze the research question:
|
|
99
|
+
1. Break into 2-4 independent sub-questions
|
|
100
|
+
2. For each sub-question:
|
|
101
|
+
- Hypothesis: what do we expect to find?
|
|
102
|
+
- Key sources: where to look (code, docs, logs, external)
|
|
103
|
+
- Success criteria: what constitutes a sufficient answer?
|
|
104
|
+
3. Identify dependencies between sub-questions
|
|
105
|
+
4. Assign investigation priority
|
|
106
|
+
|
|
107
|
+
- id: investigate
|
|
108
|
+
role: researcher
|
|
109
|
+
depends_on: [decompose]
|
|
110
|
+
description: "Investigate sub-questions in parallel."
|
|
111
|
+
prompt: |
|
|
112
|
+
Investigate assigned sub-question:
|
|
113
|
+
1. State the hypothesis clearly
|
|
114
|
+
2. Gather evidence from identified sources
|
|
115
|
+
3. For each evidence item:
|
|
116
|
+
- Source: where found
|
|
117
|
+
- Quality: strong / moderate / weak
|
|
118
|
+
- Supports or contradicts hypothesis?
|
|
119
|
+
4. Preliminary conclusion with confidence level
|
|
120
|
+
5. List remaining unknowns
|
|
121
|
+
|
|
122
|
+
- id: verify
|
|
123
|
+
role: lead_researcher
|
|
124
|
+
depends_on: [investigate]
|
|
125
|
+
description: "Cross-verify findings across researchers."
|
|
126
|
+
prompt: |
|
|
127
|
+
Cross-verification:
|
|
128
|
+
1. Do different researchers' findings contradict?
|
|
129
|
+
2. Are there gaps — sub-questions not fully answered?
|
|
130
|
+
3. Check: is the evidence quality sufficient for conclusions?
|
|
131
|
+
4. If contradictions exist: identify the most reliable source
|
|
132
|
+
5. If gaps exist: note what additional investigation is needed
|
|
133
|
+
|
|
134
|
+
- id: synthesize
|
|
135
|
+
role: lead_researcher
|
|
136
|
+
depends_on: [verify]
|
|
137
|
+
description: "Synthesize all findings into conclusions."
|
|
138
|
+
prompt: |
|
|
139
|
+
Final synthesis:
|
|
140
|
+
1. For each original sub-question: answer with evidence
|
|
141
|
+
2. For each hypothesis: confirmed / refuted / inconclusive
|
|
142
|
+
3. Overall conclusion with confidence level (high/medium/low)
|
|
143
|
+
4. Key findings (bullet points)
|
|
144
|
+
5. Remaining unknowns
|
|
145
|
+
6. Recommended next steps (if any)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
version: "0.1.0"
|
|
2
|
+
id: template_root_cause_analysis
|
|
3
|
+
name: Root Cause Analysis (Competing Hypotheses)
|
|
4
|
+
type: project
|
|
5
|
+
namespace: rca
|
|
6
|
+
|
|
7
|
+
cascade:
|
|
8
|
+
inherits: ["species:default"]
|
|
9
|
+
priority: 100
|
|
10
|
+
|
|
11
|
+
genes:
|
|
12
|
+
multiple_hypotheses:
|
|
13
|
+
description: Always generate multiple competing hypotheses before investigating
|
|
14
|
+
codons:
|
|
15
|
+
- type: threshold
|
|
16
|
+
condition: "hypotheses_count >= 3"
|
|
17
|
+
action: block
|
|
18
|
+
- type: attract
|
|
19
|
+
target: generate_alternatives
|
|
20
|
+
- type: repel
|
|
21
|
+
target: single_theory_bias
|
|
22
|
+
|
|
23
|
+
falsify_own:
|
|
24
|
+
description: Actively try to disprove your own hypotheses
|
|
25
|
+
codons:
|
|
26
|
+
- type: attract
|
|
27
|
+
target: seek_disconfirming_evidence
|
|
28
|
+
- type: repel
|
|
29
|
+
target: confirmation_bias
|
|
30
|
+
- type: threshold
|
|
31
|
+
condition: "each_hypothesis_has_counter_evidence == true"
|
|
32
|
+
action: escalate
|
|
33
|
+
|
|
34
|
+
evidence_ranked:
|
|
35
|
+
description: Rank evidence by strength and reliability
|
|
36
|
+
role: workflow_hint
|
|
37
|
+
codons:
|
|
38
|
+
- type: attract
|
|
39
|
+
target: grade_evidence_quality
|
|
40
|
+
- type: attract
|
|
41
|
+
target: distinguish_correlation_causation
|
|
42
|
+
|
|
43
|
+
minimal_reproduction:
|
|
44
|
+
description: Create minimal reproduction before investigating
|
|
45
|
+
codons:
|
|
46
|
+
- type: attract
|
|
47
|
+
target: reproduce_before_hypothesizing
|
|
48
|
+
- type: repel
|
|
49
|
+
target: guess_without_evidence
|
|
50
|
+
|
|
51
|
+
contexts: {}
|
|
52
|
+
|
|
53
|
+
roles:
|
|
54
|
+
hypothesis_generator:
|
|
55
|
+
description: Generates competing hypotheses from symptoms. Read-only.
|
|
56
|
+
tool_permissions:
|
|
57
|
+
allow: [Read, Grep, Glob, Bash]
|
|
58
|
+
deny: [Edit, Write, NotebookEdit]
|
|
59
|
+
scope:
|
|
60
|
+
read: ["**/*"]
|
|
61
|
+
write: []
|
|
62
|
+
instructions:
|
|
63
|
+
- Read error messages, logs, and stack traces
|
|
64
|
+
- Generate at least 3 competing hypotheses
|
|
65
|
+
- For each hypothesis state what evidence would confirm AND refute it
|
|
66
|
+
- Rank by prior probability (most likely first)
|
|
67
|
+
- Do NOT suggest fixes yet
|
|
68
|
+
|
|
69
|
+
investigator:
|
|
70
|
+
description: Gathers evidence for/against each hypothesis. Read-only.
|
|
71
|
+
tool_permissions:
|
|
72
|
+
allow: [Read, Grep, Glob, Bash]
|
|
73
|
+
deny: [Edit, Write, NotebookEdit]
|
|
74
|
+
scope:
|
|
75
|
+
read: ["**/*"]
|
|
76
|
+
write: []
|
|
77
|
+
instructions:
|
|
78
|
+
- Test each hypothesis by gathering specific evidence
|
|
79
|
+
- For each hypothesis record evidence FOR and AGAINST
|
|
80
|
+
- Try to DISPROVE the leading hypothesis first
|
|
81
|
+
- Use git blame, logs, test output as evidence
|
|
82
|
+
- Grade evidence strength (strong/moderate/weak)
|
|
83
|
+
- After investigation rank hypotheses by evidence weight
|
|
84
|
+
|
|
85
|
+
workflows:
|
|
86
|
+
root-cause:
|
|
87
|
+
name: Root Cause Analysis
|
|
88
|
+
description: "Competing hypotheses debugging: hypothesize, investigate, rank, synthesize"
|
|
89
|
+
steps:
|
|
90
|
+
- id: reproduce
|
|
91
|
+
role: investigator
|
|
92
|
+
description: "Reproduce the issue and collect symptoms."
|
|
93
|
+
prompt: |
|
|
94
|
+
Reproduce the reported issue:
|
|
95
|
+
1. Run the failing test or trigger the bug
|
|
96
|
+
2. Collect all symptoms: error messages, stack traces, logs
|
|
97
|
+
3. Note: when did it start? What changed recently? (git log)
|
|
98
|
+
4. Output: symptom summary + reproduction steps
|
|
99
|
+
|
|
100
|
+
- id: hypothesize
|
|
101
|
+
role: hypothesis_generator
|
|
102
|
+
depends_on: [reproduce]
|
|
103
|
+
description: "Generate 3+ competing hypotheses."
|
|
104
|
+
prompt: |
|
|
105
|
+
Based on the symptoms, generate at least 3 competing hypotheses:
|
|
106
|
+
For each hypothesis:
|
|
107
|
+
- Statement: what is the root cause?
|
|
108
|
+
- Prior probability: how likely (high/medium/low)?
|
|
109
|
+
- Confirming evidence: what would prove this?
|
|
110
|
+
- Refuting evidence: what would disprove this?
|
|
111
|
+
- Quick test: what's the fastest way to check?
|
|
112
|
+
|
|
113
|
+
Order by prior probability. Do NOT investigate yet.
|
|
114
|
+
|
|
115
|
+
- id: investigate
|
|
116
|
+
role: investigator
|
|
117
|
+
depends_on: [hypothesize]
|
|
118
|
+
description: "Gather evidence for/against each hypothesis."
|
|
119
|
+
prompt: |
|
|
120
|
+
For each hypothesis, gather evidence:
|
|
121
|
+
1. Run the quick test suggested
|
|
122
|
+
2. Check code paths, git blame, recent changes
|
|
123
|
+
3. Record evidence FOR and AGAINST each hypothesis
|
|
124
|
+
4. Grade evidence strength: strong / moderate / weak
|
|
125
|
+
5. Try hardest to DISPROVE the leading hypothesis
|
|
126
|
+
|
|
127
|
+
After all evidence gathered, rank hypotheses by total evidence weight.
|
|
128
|
+
|
|
129
|
+
- id: synthesize
|
|
130
|
+
role: hypothesis_generator
|
|
131
|
+
depends_on: [investigate]
|
|
132
|
+
description: "Determine root cause and recommend fix."
|
|
133
|
+
prompt: |
|
|
134
|
+
Based on evidence:
|
|
135
|
+
1. Which hypothesis has the strongest evidence?
|
|
136
|
+
2. Which hypotheses were refuted?
|
|
137
|
+
3. Are there any remaining unknowns?
|
|
138
|
+
4. Root cause determination (with confidence level)
|
|
139
|
+
5. Recommended fix approach
|
|
140
|
+
6. What regression test would prevent recurrence?
|
|
@@ -53,4 +53,98 @@ genes:
|
|
|
53
53
|
condition: "bugfix_without_test == false"
|
|
54
54
|
action: block
|
|
55
55
|
|
|
56
|
+
competing_hypotheses:
|
|
57
|
+
description: Always consider multiple possible causes
|
|
58
|
+
codons:
|
|
59
|
+
- type: threshold
|
|
60
|
+
condition: "hypotheses_count >= 2"
|
|
61
|
+
action: escalate
|
|
62
|
+
- type: attract
|
|
63
|
+
target: consider_alternative_explanations
|
|
64
|
+
- type: repel
|
|
65
|
+
target: jump_to_first_theory
|
|
66
|
+
|
|
56
67
|
contexts: {}
|
|
68
|
+
|
|
69
|
+
roles:
|
|
70
|
+
hypothesis_generator:
|
|
71
|
+
description: Generates competing debugging hypotheses. Read-only.
|
|
72
|
+
tool_permissions:
|
|
73
|
+
allow: [Read, Grep, Glob, Bash]
|
|
74
|
+
deny: [Edit, Write, NotebookEdit]
|
|
75
|
+
scope:
|
|
76
|
+
read: ["**/*"]
|
|
77
|
+
write: []
|
|
78
|
+
instructions:
|
|
79
|
+
- Read error messages, logs, stack traces
|
|
80
|
+
- Generate at least 2 competing hypotheses
|
|
81
|
+
- For each hypothesis state confirming and refuting evidence
|
|
82
|
+
- Rank by likelihood
|
|
83
|
+
- Do NOT suggest fixes
|
|
84
|
+
|
|
85
|
+
debugger:
|
|
86
|
+
description: Investigates hypotheses and applies fixes.
|
|
87
|
+
tool_permissions:
|
|
88
|
+
allow: [Read, Edit, Write, Grep, Glob, Bash]
|
|
89
|
+
scope:
|
|
90
|
+
read: ["**/*"]
|
|
91
|
+
write: ["src/**", "lib/**", "test/**"]
|
|
92
|
+
instructions:
|
|
93
|
+
- Test each hypothesis systematically
|
|
94
|
+
- Start with the most likely hypothesis
|
|
95
|
+
- Use git bisect, logging, and targeted tests
|
|
96
|
+
- When root cause found apply minimal fix
|
|
97
|
+
- Write regression test before fixing
|
|
98
|
+
- Run tests after fix
|
|
99
|
+
|
|
100
|
+
workflows:
|
|
101
|
+
debug-with-hypotheses:
|
|
102
|
+
name: Debug with Hypotheses
|
|
103
|
+
description: "Hypothesis-driven debugging: hypothesize, investigate, fix, verify"
|
|
104
|
+
steps:
|
|
105
|
+
- id: hypothesize
|
|
106
|
+
role: hypothesis_generator
|
|
107
|
+
description: "Generate competing hypotheses from symptoms."
|
|
108
|
+
prompt: |
|
|
109
|
+
Analyze the bug symptoms:
|
|
110
|
+
1. Reproduce the issue
|
|
111
|
+
2. Collect error messages, logs, stack traces
|
|
112
|
+
3. Check recent git changes
|
|
113
|
+
4. Generate at least 2 competing hypotheses
|
|
114
|
+
5. For each: what evidence would confirm? What would refute?
|
|
115
|
+
6. Rank by likelihood
|
|
116
|
+
|
|
117
|
+
- id: investigate
|
|
118
|
+
role: debugger
|
|
119
|
+
depends_on: [hypothesize]
|
|
120
|
+
description: "Test hypotheses and find root cause."
|
|
121
|
+
prompt: |
|
|
122
|
+
Test each hypothesis:
|
|
123
|
+
1. Start with most likely
|
|
124
|
+
2. Gather targeted evidence (add logging, run specific tests)
|
|
125
|
+
3. If confirmed → proceed to fix
|
|
126
|
+
4. If refuted → move to next hypothesis
|
|
127
|
+
5. Record evidence for each hypothesis tested
|
|
128
|
+
|
|
129
|
+
- id: fix
|
|
130
|
+
role: debugger
|
|
131
|
+
depends_on: [investigate]
|
|
132
|
+
description: "Apply minimal fix and write regression test."
|
|
133
|
+
prompt: |
|
|
134
|
+
Fix the confirmed root cause:
|
|
135
|
+
1. Write a regression test that reproduces the bug FIRST
|
|
136
|
+
2. Apply the minimal fix
|
|
137
|
+
3. Verify the regression test passes
|
|
138
|
+
4. Run full test suite for regressions
|
|
139
|
+
5. Commit: "fix: [description] — root cause: [what and why]"
|
|
140
|
+
|
|
141
|
+
- id: verify
|
|
142
|
+
role: hypothesis_generator
|
|
143
|
+
depends_on: [fix]
|
|
144
|
+
description: "Verify fix is correct and complete."
|
|
145
|
+
prompt: |
|
|
146
|
+
Verify the fix:
|
|
147
|
+
1. Is the root cause actually addressed (not just symptoms)?
|
|
148
|
+
2. Does the regression test cover the exact failure mode?
|
|
149
|
+
3. Any related code paths that might have the same issue?
|
|
150
|
+
4. Verdict: VERIFIED or INCOMPLETE
|