From 54a0ee094901f21747aa707654e3eebbb5c86b2e Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Tue, 26 May 2026 08:48:17 -0500 Subject: [PATCH] self-review 2026-05-26: sync dist/awareness.c with awareness.el source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dist/awareness.c was stale — still had the broken EL % operator codegen (minute_block = ts/60000 raw, EL_NULL; 4; as dead statements) and the broken should_scan/should_beat logic (idle_n truthy check instead of >=). Recompiled awareness.el to bring dist/awareness.c in sync with the source fix committed 2026-05-25 (fb69044). The monolithic dist/neuron.c (compiled from soul.el which imports awareness.el) was already correct from fb69044 — only the standalone dist/awareness.c was behind. Bug #2 (99% CPU) root cause identified: perceive() inbox guard (engram_search_json) has false positives — knowledge nodes containing "soul-inbox" as a substring match, causing engram_activate_json(..., hops=2) to run on every tick on a 162K-node graph. This blocks sleep_ms and prevents idle_n accumulation → no heartbeats. Separate fix needed. --- dist/awareness.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/dist/awareness.c b/dist/awareness.c index 2ec0dce..c4eca5c 100644 --- a/dist/awareness.c +++ b/dist/awareness.c @@ -240,9 +240,11 @@ 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); - EL_NULL; - 4; + el_val_t ts_minutes = (ts / 60000); + el_val_t minute_q = (ts_minutes / 4); + el_val_t minute_q2 = (minute_q + minute_q); + el_val_t minute_q4 = (minute_q2 + minute_q2); + el_val_t minute_block = (ts_minutes - minute_q4); state_set(EL_STR("cseed_a"), EL_STR("memory")); state_set(EL_STR("cseed_b"), EL_STR("knowledge")); state_set(EL_STR("cseed_c"), EL_STR("context")); @@ -473,21 +475,16 @@ el_val_t awareness_run(void) { if (curiosity_interval < 1) { curiosity_interval = 1; } - el_val_t should_scan = ((!did_work && (idle_n > 0)) && idle_n); - EL_NULL; - ((curiosity_interval == 0) && !idle_n); - (beat_interval == 0); - EL_NULL; - if (should_scan) { - el_val_t found_something = proactive_curiosity(); - } - el_val_t should_beat = ((!did_work && (idle_n > 0)) && idle_n); - EL_NULL; - (beat_interval == 0); + el_val_t should_beat = ((!did_work && (idle_n > 0)) && (idle_n >= beat_interval)); if (should_beat) { emit_heartbeat(); idle_reset(); } + el_val_t should_scan = (((!did_work && (idle_n > 0)) && (idle_n >= curiosity_interval)) && !should_beat); + if (should_scan) { + el_val_t found_something = proactive_curiosity(); + idle_reset(); + } sleep_ms(tick_ms); } return 0;