Commit cf06eee
PR4: LLM roles + multi-round loop + history injection + cost guard + README rewrite
* feat(pr4): LLM roles + multi-round loop + history injection + cost guard
Four deliverables:
- config: add llm/coding_agent/history sections; add max_total_usd and
max_total_tokens to hard_stops for configurable cost guard
- hard_stops: accumulate total_usd/total_tokens in state; precheck and
record_outcome enforce cost limits alongside iteration limits
- governor: inject history[] into planner_input each round (last N
reflections from ledger); history_max_entries is configurable
- cli: add --loop flag; _run_loop drives multi-round evolution until any
hard stop triggers; _make_governor helper deduplicates setup
- roles/planner.py: LLM planner (anthropic/openai, configurable via
config.json in run dir)
- roles/executor.sh: coding-agent wrapper (aider/claude-code, configurable)
- roles/evaluator.py: LLM evaluator; reports cost_usd + tokens_used so
kernel can enforce cost guard
All choices (LLM provider/model/key, coding tool) are config-driven, nothing
hardcoded. 39/39 tests pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address 8 Copilot review issues in PR4
- executor.sh: use jq to encode output JSON (was unsafe shell interpolation)
- planner.py: wrap json.loads in try/except JSONDecodeError; fall back to
plain-text plan instead of crashing on malformed LLM output
- config.py: explicit type check before float/int conversion in
_parse_hard_stops; raises ConfigError with clear message instead of raw
ValueError
- cli.py: add _safe_cost() helper with defensive float/int parsing for
cost_usd/tokens_used fields; fix exit codes to return 3 consistently on
halt in both single-run and --loop modes; call _record_halted() when
record_outcome triggers a halt in loop mode (was missing audit entry)
- governor.py: store plan_summary in reflection.json; use it in
_build_history() so planner sees actual attempt descriptions, not generic
decision reason strings; simplify unreachable else branch in slice
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: rewrite README for clarity and investor/practitioner audience
- Lead with value ("Give an LLM a goal") not architecture internals
- Add concrete coverage-improvement example with realistic output
including a rejection + recovery round showing history injection
- Add ledger directory tree with all artifacts annotated
- Add full configuration reference with all PR4 fields
- Add capabilities table: working vs coming-next (PR5/6/7)
- Fix CI badge URL: hitome0123 → Protocol-zero-0/evolution-kernel
- Remove Token-Ignition mentions from main README
- Remove legacy --goal CLI docs (code unchanged, just not advertised)
- Move architecture diagram after value sections, not before
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Jim <Protocol-zero-0@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 4658aa6 commit cf06eee
10 files changed
Lines changed: 1137 additions & 200 deletions
File tree
- evolution_kernel
- examples
- roles
- tests
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
9 | 7 | | |
10 | | - | |
| 8 | + | |
| 9 | + | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 11 | + | |
| 12 | + | |
16 | 13 | | |
17 | 14 | | |
18 | 15 | | |
| |||
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | | - | |
| 32 | + | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
| 43 | + | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
| |||
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | | - | |
| 76 | + | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
87 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
88 | 109 | | |
| 110 | + | |
89 | 111 | | |
90 | 112 | | |
91 | 113 | | |
92 | 114 | | |
93 | 115 | | |
| 116 | + | |
| 117 | + | |
94 | 118 | | |
95 | 119 | | |
96 | | - | |
97 | | - | |
98 | 120 | | |
99 | 121 | | |
100 | 122 | | |
101 | 123 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 124 | | |
| 125 | + | |
114 | 126 | | |
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
118 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
119 | 135 | | |
120 | 136 | | |
121 | 137 | | |
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
125 | 181 | | |
126 | 182 | | |
127 | 183 | | |
| |||
142 | 198 | | |
143 | 199 | | |
144 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
145 | 214 | | |
146 | 215 | | |
147 | 216 | | |
| |||
155 | 224 | | |
156 | 225 | | |
157 | 226 | | |
| 227 | + | |
| 228 | + | |
158 | 229 | | |
159 | | - | |
160 | 230 | | |
161 | 231 | | |
162 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
7 | 18 | | |
8 | 19 | | |
9 | 20 | | |
| |||
16 | 27 | | |
17 | 28 | | |
18 | 29 | | |
19 | | - | |
20 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
| |||
52 | 65 | | |
53 | 66 | | |
54 | 67 | | |
| 68 | + | |
| 69 | + | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
| |||
61 | 76 | | |
62 | 77 | | |
63 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
64 | 96 | | |
65 | 97 | | |
66 | 98 | | |
67 | 99 | | |
68 | 100 | | |
69 | 101 | | |
70 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
71 | 106 | | |
72 | 107 | | |
73 | 108 | | |
| |||
97 | 132 | | |
98 | 133 | | |
99 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
100 | 138 | | |
101 | 139 | | |
102 | 140 | | |
103 | 141 | | |
104 | 142 | | |
105 | 143 | | |
106 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
107 | 148 | | |
108 | 149 | | |
109 | 150 | | |
| |||
182 | 223 | | |
183 | 224 | | |
184 | 225 | | |
185 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
0 commit comments