intentdna 1.5.8 → 1.5.10

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.
@@ -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
@@ -52,19 +52,103 @@ genes:
52
52
  contexts: {}
53
53
 
54
54
  roles:
55
+ test_writer:
56
+ description: Writes failing tests before implementation. Can create test files.
57
+ tool_permissions:
58
+ allow: [Read, Edit, Write, Grep, Glob, Bash]
59
+ scope:
60
+ read: ["**/*"]
61
+ write: ["test/**", "tests/**", "spec/**", "__tests__/**"]
62
+ instructions:
63
+ - Write the test FIRST — it must fail initially (red phase)
64
+ - Test should describe the desired behavior, not the implementation
65
+ - One test case per behavior
66
+ - Run the test to confirm it fails for the right reason
67
+ - Do NOT write implementation code
68
+
55
69
  implementer:
56
- description: TDD implementer writes tests first, then code
70
+ description: Writes minimal code to make tests pass.
57
71
  tool_permissions:
58
72
  allow: [Read, Edit, Write, Grep, Glob, Bash]
59
73
  scope:
60
74
  read: ["**/*"]
61
- write: ["src/**", "test/**"]
75
+ write: ["src/**", "lib/**"]
62
76
  instructions:
63
- - Always write the failing test FIRST
64
- - Run the test to confirm it fails (red)
65
- - Write the minimum code to make it pass (green)
66
- - Refactor if needed, keeping tests green
67
- - Never commit with failing tests
68
- post_checks:
69
- - vitest_run
70
- - tsc_no_errors
77
+ - Write the MINIMUM code to make the failing test pass (green phase)
78
+ - Do not add extra functionality beyond what the test requires
79
+ - Do not optimize or clean up code yet
80
+ - Run the test after each change to verify it passes
81
+ - Do not modify test files
82
+
83
+ refactorer:
84
+ description: Cleans up code while keeping tests green.
85
+ tool_permissions:
86
+ allow: [Read, Edit, Write, Grep, Glob, Bash]
87
+ scope:
88
+ read: ["**/*"]
89
+ write: ["src/**", "lib/**"]
90
+ instructions:
91
+ - Clean up the implementation (refactor phase)
92
+ - Run ALL tests after each refactoring step
93
+ - If any test breaks, revert immediately
94
+ - Focus on readability, removing duplication, improving naming
95
+ - Do NOT add new functionality during refactoring
96
+ - Do NOT modify test files
97
+
98
+ workflows:
99
+ tdd-cycle:
100
+ name: TDD Cycle
101
+ description: "Red-Green-Refactor: write failing test, implement minimally, clean up"
102
+ steps:
103
+ - id: write_test
104
+ role: test_writer
105
+ description: "Write a failing test for the desired behavior (RED)."
106
+ prompt: |
107
+ TDD Red Phase:
108
+ 1. Understand the behavior to implement
109
+ 2. Write ONE test that describes this behavior
110
+ 3. Run the test — it MUST fail
111
+ 4. Verify it fails for the right reason (not a syntax error)
112
+ 5. Commit: "test: add failing test for [behavior]"
113
+
114
+ Do NOT write any implementation code.
115
+
116
+ - id: implement
117
+ role: implementer
118
+ depends_on: [write_test]
119
+ description: "Write minimal code to pass the test (GREEN)."
120
+ prompt: |
121
+ TDD Green Phase:
122
+ 1. Read the failing test carefully
123
+ 2. Write the MINIMUM code to make it pass
124
+ 3. Run the test — it must pass now
125
+ 4. Run the full test suite — no regressions
126
+ 5. Commit: "feat: implement [behavior] — test green"
127
+
128
+ Rules:
129
+ - Do NOT add code beyond what the test requires
130
+ - Do NOT optimize yet
131
+ - Do NOT modify test files
132
+
133
+ - id: refactor
134
+ role: refactorer
135
+ depends_on: [implement]
136
+ description: "Clean up code while keeping all tests green (REFACTOR)."
137
+ prompt: |
138
+ TDD Refactor Phase:
139
+ 1. Review the implementation for code smells
140
+ 2. Apply ONE refactoring at a time
141
+ 3. Run ALL tests after each change
142
+ 4. If any test breaks: REVERT immediately
143
+ 5. Commit: "refactor: [what was cleaned up]"
144
+
145
+ Focus on:
146
+ - Remove duplication
147
+ - Improve naming
148
+ - Simplify logic
149
+ - Extract methods/functions if needed
150
+
151
+ Do NOT:
152
+ - Add new features
153
+ - Modify test files
154
+ - Change behavior
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",