self-review 2026-05-21: fix curiosity seed splitting and awareness loop activation

Two fixes:

1. proactive_curiosity() was calling engram_activate_json with multi-word phrases
   ("memory knowledge context"). engram_activate finds seeds via istr_contains
   (substring match), so the phrase had to appear verbatim in a node's content.
   Almost no node contains the exact string "memory knowledge context", so only
   0-2 nodes activated per curiosity scan. Fixed by activating each word separately:
   "memory", "knowledge", "context" → 3 independent activate calls → hundreds of
   nodes promoted to WM per cycle.

2. dist/neuron.c called http_serve() (blocking accept loop) which made awareness_run()
   unreachable. soul.el correctly specifies http_serve_async but elc silently drops
   unknown builtins, leaving blocking http_serve in the compiled C. Patched neuron.c
   to call http_serve_async directly — HTTP server runs in a background pthread,
   awareness_run() runs on the main thread as intended.
This commit is contained in:
2026-05-21 08:47:00 -05:00
parent cc09c296a3
commit 5b8cb58da1
4 changed files with 64 additions and 16 deletions
+20 -6
View File
@@ -133,18 +133,32 @@ el_val_t emit_heartbeat(void) {
el_val_t proactive_curiosity(void) {
el_val_t ts = time_now();
el_val_t minute_block = ((ts / 60000) % 4);
el_val_t curiosity_seed = EL_STR("memory knowledge context");
el_val_t curiosity_term_a = EL_STR("memory");
el_val_t curiosity_term_b = EL_STR("knowledge");
el_val_t curiosity_term_c = EL_STR("context");
if (minute_block == 1) {
curiosity_seed = EL_STR("self identity values architecture");
curiosity_term_a = EL_STR("self");
curiosity_term_b = EL_STR("identity");
curiosity_term_c = EL_STR("values");
}
if (minute_block == 2) {
curiosity_seed = EL_STR("recent decision pattern lesson");
curiosity_term_a = EL_STR("decision");
curiosity_term_b = EL_STR("pattern");
curiosity_term_c = EL_STR("lesson");
}
if (minute_block == 3) {
curiosity_seed = EL_STR("working active project");
curiosity_term_a = EL_STR("working");
curiosity_term_b = EL_STR("project");
curiosity_term_c = EL_STR("active");
}
el_val_t results = engram_activate_json(curiosity_seed, 2);
el_val_t found = json_array_len(results);
el_val_t curiosity_seed = el_str_concat(el_str_concat(el_str_concat(el_str_concat(curiosity_term_a, EL_STR(" ")), curiosity_term_b), EL_STR(" ")), curiosity_term_c);
el_val_t results_a = engram_activate_json(curiosity_term_a, 2);
el_val_t results_b = engram_activate_json(curiosity_term_b, 2);
el_val_t results_c = engram_activate_json(curiosity_term_c, 2);
el_val_t found_a = json_array_len(results_a);
el_val_t found_b = json_array_len(results_b);
el_val_t found_c = json_array_len(results_c);
el_val_t found = ((found_a + found_b) + found_c);
el_val_t wmc = engram_wm_count();
el_val_t ise = el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"event\":\"curiosity_scan\",\"seed\":\""), curiosity_seed), EL_STR("\",\"activated\":")), int_to_str(found)), EL_STR(",\"wm_active\":")), int_to_str(wmc)), EL_STR(",\"ts\":")), int_to_str(ts)), EL_STR("}"));
ise_post(ise);
Vendored
BIN
View File
Binary file not shown.
+6 -1
View File
@@ -352,7 +352,12 @@ int main(int _argc, char** _argv) {
}
}
println(el_str_concat(EL_STR("[soul] serving on port "), int_to_str(port)));
http_serve(port, EL_STR("handle_request"));
/* Use http_serve_async (non-blocking) so awareness_run() executes on the main
* thread. http_serve would block here forever, making awareness_run unreachable.
* http_serve_async spawns the accept loop in a background pthread and returns
* immediately. awareness_run() then runs the idle-activation heartbeat loop.
* Self-review fix 2026-05-21. */
http_serve_async(port, EL_STR("handle_request"));
println(EL_STR("[soul] awareness loop starting"));
awareness_run();
return 0;