self-review 2026-07-25: break curiosity positive-feedback loop; observability for WM regime
proactive_curiosity strengthened its top result unconditionally every
scan — a positive-feedback fixed point that pinned auto_term on the same
node's first word for hours ('Fast-slow' era). Strengthen now fires only
when the top node changed since the last scan, and a 4-deep finst-style
tabu ring (ACT-R declarative finsts) hard-excludes recently used auto
terms (~2 min at the 30s cadence). Quoted-title guard stops '"The'
leaking through the >3-char stopword check and seeding lexical floods.
Heartbeat now pumps /api/embed-backfill?n=32 on the authoritative store
(its lazy backfill had no production trigger; coverage stalled at
93/12175) and emits wm_saturated, wm_top0_streak, embed_backfilled,
embed_count. Curiosity ISE emits auto_term_streak. The stuck-WM failure
mode is now a one-glance signal instead of manual ISE cross-referencing.
This commit is contained in:
+82
-3
@@ -180,7 +180,40 @@ fn emit_heartbeat() -> Void {
|
||||
// (2026-07-19 self-review)
|
||||
let sync_ok_raw: String = state_get("soul.last_sync_ok_ts")
|
||||
let sync_age: Int = if str_eq(sync_ok_raw, "") { 0 - 1 } else { ts - str_to_int(sync_ok_raw) }
|
||||
let payload: String = "{\"event\":\"heartbeat\",\"pulse\":" + pulse + ",\"tick\":" + pulse + ",\"boot\":" + boot + ",\"idle\":" + idle + ",\"node_count\":" + int_to_str(nc) + ",\"edge_count\":" + int_to_str(ec) + ",\"node_delta\":" + int_to_str(node_delta) + ",\"edge_delta\":" + int_to_str(edge_delta) + ",\"wm_active\":" + int_to_str(wmc) + ",\"wm_delta\":" + int_to_str(wm_delta) + ",\"sync_added_total\":" + sat_str + ",\"sync_age_ms\":" + int_to_str(sync_age) + ",\"wm_avg_weight\":" + wm_avg_str + ",\"wm_top\":" + wm_top + ",\"ts\":" + int_to_str(ts) + ",\"uptime_ms\":" + int_to_str(up_ms) + ",\"uptime\":\"" + up_human + "\",\"embed_ok\":" + int_to_str(emb_ok) + ",\"ise_fail\":" + fail_str + "}"
|
||||
// Embedding pump + real coverage (2026-07-25 self-review): the
|
||||
// authoritative :8742 store's lazy backfill only runs inside
|
||||
// engram_activate, and nothing calls /api/activate there in production —
|
||||
// embedded_count stalled at 93/12175 after a restart from a snapshot
|
||||
// without vectors. Pump up to 32 embeds per heartbeat via the new
|
||||
// /api/embed-backfill route (route persists the snapshot when it embeds
|
||||
// anything, so vectors survive the next restart; self-limiting once
|
||||
// coverage is full) and surface the store's true coverage here.
|
||||
// embed_ok alone is misleading — it pings the Ollama root, not the
|
||||
// embed pipeline. embed_count=-1 means the route was unreachable.
|
||||
// URL resolution mirrors ise_post: env -> state -> localhost constant.
|
||||
let hb_env_url: String = env("SOUL_ISE_URL")
|
||||
let hb_state_url: String = if str_eq(hb_env_url, "") { state_get("soul_engram_url") } else { hb_env_url }
|
||||
let hb_engram_url: String = if str_eq(hb_state_url, "") { "http://localhost:8742" } else { hb_state_url }
|
||||
let bf_resp: String = http_get(hb_engram_url + "/api/embed-backfill?n=32")
|
||||
let bf_done_raw: String = json_get(bf_resp, "embedded")
|
||||
let bf_done: String = if str_eq(bf_done_raw, "") { "-1" } else { bf_done_raw }
|
||||
let bf_total_raw: String = json_get(bf_resp, "embedded_count")
|
||||
let bf_total: String = if str_eq(bf_total_raw, "") { "-1" } else { bf_total_raw }
|
||||
// WM regime observability (2026-07-25 self-review): the "same 2 nodes
|
||||
// pinned at a saturated cap" failure took cross-referencing the ISE
|
||||
// stream by hand to spot. Make it one-glance: wm_saturated flags the
|
||||
// cap-pinned regime; wm_top0_streak counts consecutive heartbeats with
|
||||
// the same node in WM slot 0 (state-tracked, same mechanism as wm_delta).
|
||||
let wm_sat: Int = if wmc >= 24 { 1 } else { 0 }
|
||||
let wm_top0: String = json_array_get(wm_top, 0)
|
||||
let wm_top0_id: String = json_get(wm_top0, "id")
|
||||
let prev_top0: String = state_get("soul.prev_wm_top0")
|
||||
let t0streak_raw: String = state_get("soul.wm_top0_streak")
|
||||
let t0streak_prev: Int = if str_eq(t0streak_raw, "") { 0 } else { str_to_int(t0streak_raw) }
|
||||
let t0streak: Int = if str_eq(wm_top0_id, prev_top0) { t0streak_prev + 1 } else { 1 }
|
||||
state_set("soul.prev_wm_top0", wm_top0_id)
|
||||
state_set("soul.wm_top0_streak", int_to_str(t0streak))
|
||||
let payload: String = "{\"event\":\"heartbeat\",\"pulse\":" + pulse + ",\"tick\":" + pulse + ",\"boot\":" + boot + ",\"idle\":" + idle + ",\"node_count\":" + int_to_str(nc) + ",\"edge_count\":" + int_to_str(ec) + ",\"node_delta\":" + int_to_str(node_delta) + ",\"edge_delta\":" + int_to_str(edge_delta) + ",\"wm_active\":" + int_to_str(wmc) + ",\"wm_delta\":" + int_to_str(wm_delta) + ",\"wm_saturated\":" + int_to_str(wm_sat) + ",\"wm_top0_streak\":" + int_to_str(t0streak) + ",\"sync_added_total\":" + sat_str + ",\"sync_age_ms\":" + int_to_str(sync_age) + ",\"wm_avg_weight\":" + wm_avg_str + ",\"wm_top\":" + wm_top + ",\"ts\":" + int_to_str(ts) + ",\"uptime_ms\":" + int_to_str(up_ms) + ",\"uptime\":\"" + up_human + "\",\"embed_ok\":" + int_to_str(emb_ok) + ",\"embed_backfilled\":" + bf_done + ",\"embed_count\":" + bf_total + ",\"ise_fail\":" + fail_str + "}"
|
||||
ise_post(payload)
|
||||
}
|
||||
|
||||
@@ -251,6 +284,25 @@ fn auto_term_try_slot(slot_type: String, slot_lbl: String) -> Void {
|
||||
if str_eq(term, "Paper") { state_set("_ats_gw", "1") }
|
||||
if str_eq(term, "Knowledge") { state_set("_ats_gw", "1") }
|
||||
if str_eq(term, "Value") { state_set("_ats_gw", "1") }
|
||||
// QUOTED-TITLE GUARD (2026-07-25 self-review): labels that
|
||||
// open with a quote ('"The Algorithmic Caricature" ...')
|
||||
// defeat the >3-char stopword guard — the extracted term
|
||||
// '"The' is 4 chars and seeds a lexical flood on "The"
|
||||
// (observed live: activated jumped 48 → 87). Any term
|
||||
// carrying a quote character is not a topic word.
|
||||
if str_contains(term, "\"") { state_set("_ats_gw", "1") }
|
||||
if str_contains(term, "'") { state_set("_ats_gw", "1") }
|
||||
// AUTO-TERM TABU (2026-07-25 self-review): finst-style
|
||||
// inhibition-of-return (ACT-R declarative finsts: small
|
||||
// marker pool, hard exclusion). The last 4 selected auto
|
||||
// terms are ineligible (~2 min at the 30s scan cadence),
|
||||
// forcing rotation instead of "Fast-slow" every scan for
|
||||
// hours. Empty tabu slots return "" from state_get and can
|
||||
// never match — term is always > 3 chars here.
|
||||
if str_eq(term, state_get("soul.tabu_t0")) { state_set("_ats_gw", "1") }
|
||||
if str_eq(term, state_get("soul.tabu_t1")) { state_set("_ats_gw", "1") }
|
||||
if str_eq(term, state_get("soul.tabu_t2")) { state_set("_ats_gw", "1") }
|
||||
if str_eq(term, state_get("soul.tabu_t3")) { state_set("_ats_gw", "1") }
|
||||
if str_eq(state_get("_ats_gw"), "0") {
|
||||
state_set("cseed_auto", term)
|
||||
}
|
||||
@@ -323,8 +375,19 @@ fn proactive_curiosity() -> Bool {
|
||||
// pattern as attend(): json_array_get element 0, json_get its "id".
|
||||
let top_entry: String = json_array_get(results_all, 0)
|
||||
let top_id: String = json_get(top_entry, "id")
|
||||
// STREAK-GATED STRENGTHEN (2026-07-25 self-review): unconditionally
|
||||
// strengthening the top result every scan was a positive-feedback fixed
|
||||
// point — whatever led WM got its salience bumped again, kept leading,
|
||||
// and pinned the auto_term for hours ("Fast-slow" era). Strengthen only
|
||||
// when the top node CHANGED since the last scan: novelty is reinforced,
|
||||
// incumbency is not. Pairs with the runtime-side Lebiere-Best short-term
|
||||
// inhibition (el_runtime.c Pass 2), which handles score-level rotation.
|
||||
let prev_str_id: String = state_get("soul.last_strengthen_id")
|
||||
if !str_eq(top_id, "") {
|
||||
engram_strengthen(top_id)
|
||||
if !str_eq(top_id, prev_str_id) {
|
||||
engram_strengthen(top_id)
|
||||
}
|
||||
state_set("soul.last_strengthen_id", top_id)
|
||||
}
|
||||
|
||||
// WM-autobiographical 4th seed: scan top-10 WM nodes for the highest-ranked
|
||||
@@ -372,6 +435,21 @@ fn proactive_curiosity() -> Bool {
|
||||
let found_auto: Int = json_array_len(results_auto)
|
||||
let total_found: Int = found + found_auto
|
||||
let safe_auto: String = str_replace(auto_term, "\"", "'")
|
||||
// Push the selected term into the 4-deep tabu ring (see
|
||||
// auto_term_try_slot) and track the consecutive-same-term streak for
|
||||
// the ISE — the stuck-term failure becomes a one-glance signal.
|
||||
let prev_auto: String = state_get("soul.prev_auto_term")
|
||||
let atstreak_raw: String = state_get("soul.auto_term_streak")
|
||||
let atstreak_prev: Int = if str_eq(atstreak_raw, "") { 0 } else { str_to_int(atstreak_raw) }
|
||||
let atstreak: Int = if str_eq(auto_term, prev_auto) { atstreak_prev + 1 } else { 1 }
|
||||
state_set("soul.prev_auto_term", auto_term)
|
||||
state_set("soul.auto_term_streak", int_to_str(atstreak))
|
||||
if !str_eq(auto_term, "") {
|
||||
state_set("soul.tabu_t3", state_get("soul.tabu_t2"))
|
||||
state_set("soul.tabu_t2", state_get("soul.tabu_t1"))
|
||||
state_set("soul.tabu_t1", state_get("soul.tabu_t0"))
|
||||
state_set("soul.tabu_t0", auto_term)
|
||||
}
|
||||
|
||||
let wmc: Int = engram_wm_count()
|
||||
// wm_top snapshot in curiosity_scan ISE: top-3 WM nodes by weight.
|
||||
@@ -384,7 +462,8 @@ fn proactive_curiosity() -> Bool {
|
||||
let wm3: String = engram_wm_top_json(3)
|
||||
let ise: String = "{\"event\":\"curiosity_scan\",\"seed\":\"" + curiosity_seed
|
||||
+ "\",\"auto_term\":\"" + safe_auto
|
||||
+ "\",\"minute_block\":" + int_to_str(minute_block)
|
||||
+ "\",\"auto_term_streak\":" + int_to_str(atstreak)
|
||||
+ ",\"minute_block\":" + int_to_str(minute_block)
|
||||
+ ",\"activated\":" + int_to_str(total_found)
|
||||
+ ",\"wm_active\":" + int_to_str(wmc)
|
||||
+ ",\"wm_top\":" + wm3
|
||||
|
||||
Reference in New Issue
Block a user