Commit 8134808
authored
Add haiku explanation type with flexible prompt composition (#6)
## Summary
Adds haiku explanation type and flexible prompt composition system that
allows explanation types to override audience-specific guidance.
## Changes Made
### Core Implementation
- Added `ExplanationType.HAIKU` enum value
- Implemented explanation-type audience overrides in prompt system
- Created haiku-specific prompt configuration that bypasses assembly
guidance
### Testing & Evaluation
- Added `prompt_testing/test_cases/haiku_tests.yaml` with test scenarios
- Enhanced `claude_reviewer.py` with haiku-specific evaluation criteria
- Updated `prompt_advisor.py` to handle nested audience configurations
### Code Quality & Reuse
- Added structure-aware class methods to `Prompt` class:
- `get_audience_metadata_from_dict()` - Works with raw prompt
dictionaries
- `has_audience_override()` - Checks for explanation-specific overrides
- `get_all_audience_locations()` - Finds all audience guidance locations
- Prevents duplication between runtime and testing framework
### Debug Support
- Added configurable logging via `LOG_LEVEL` environment variable
- Debug logging shows actual prompts sent to Claude
### Documentation
- Updated `claude_explain.md` with flexible prompt system documentation
## Test Plan
- All existing tests pass
- Haiku test cases added covering simple to complex algorithms
- Prompt testing framework handles new structure
- Debug logging works for both assembly and haiku modesFile tree
11 files changed
+622
-128
lines changed- app
- prompt_testing
- evaluation
- test_cases
11 files changed
+622
-128
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
83 | 92 | | |
84 | | - | |
| 93 | + | |
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 24 | | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 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 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
28 | 65 | | |
29 | 66 | | |
30 | 67 | | |
| |||
37 | 74 | | |
38 | 75 | | |
39 | 76 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 77 | | |
48 | | - | |
49 | | - | |
| 78 | + | |
50 | 79 | | |
51 | | - | |
| 80 | + | |
52 | 81 | | |
53 | 82 | | |
54 | 83 | | |
| |||
70 | 99 | | |
71 | 100 | | |
72 | 101 | | |
73 | | - | |
| 102 | + | |
74 | 103 | | |
| 104 | + | |
75 | 105 | | |
76 | 106 | | |
77 | 107 | | |
| |||
93 | 123 | | |
94 | 124 | | |
95 | 125 | | |
96 | | - | |
| 126 | + | |
97 | 127 | | |
98 | 128 | | |
99 | | - | |
100 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
57 | 95 | | |
58 | 96 | | |
59 | 97 | | |
| |||
192 | 230 | | |
193 | 231 | | |
194 | 232 | | |
195 | | - | |
196 | 233 | | |
197 | | - | |
198 | | - | |
| 234 | + | |
199 | 235 | | |
200 | 236 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
223 | 250 | | |
224 | 251 | | |
225 | 252 | | |
| |||
0 commit comments