fix(mcp-wrapper): route agentic ops to the engram, stop fabricating a cause #159

Merged
will.anderson merged 10 commits from fix/mcp-wrapper-agentic-routing into main 2026-08-16 00:37:15 +00:00
Owner

The five agentic ops returned "status":"pending-cognition-promotion" on every call, claiming the cognition build wasn't promoted yet and would light up automatically.

That diagnosis was invented. Cognition has been live the entire time — :8742/api/think returns a real 768-dim geometry today, and the running engram binary already contains every cog_* symbol. Nothing was pending.

Three real bugs, all in the wrapper:

  1. Wrong service. Ops called the soul (:7770/think) on paths it doesn't serve — instant 404 every time. The routes are on the engram (/api/think, /api/attend, /api/assert, /api/ground, and /api/correspondence-beat for learn).

  2. agentic_result() fabricated the cause. It treated any empty/404/"geometry unavailable" response as proof of a promotion gap and returned a confident explanation it never checked. That message sent multiple agents chasing infrastructure work that didn't need doing. Now passes the real response through.

  3. Missing auth. The engram requires "_auth" in the body for POSTs, so attend/ground/learn would have returned unauthorized even with correct routing.

Also fixed: assert was POSTing to a route that reads query params; params are now URL-encoded; engram port derives from ENGRAM_BIND instead of a hardcoded literal.

Verified end-to-end through the rebuilt wrapper against the live engram — all five return real cognition: think n_support=207 dim=768; attend written=true; assert floor=0.5 still_held=true; ground grounding=1 written=true; learn a full correspondence-beat (stance_id, 8 axes, 180 probes, 25 epochs, brier_before=0.00346).

Depends on el#124 (merged) for the engram-side query-param decode fix.

The five agentic ops returned `"status":"pending-cognition-promotion"` on every call, claiming the cognition build wasn't promoted yet and would light up automatically. **That diagnosis was invented.** Cognition has been live the entire time — `:8742/api/think` returns a real 768-dim geometry today, and the running engram binary already contains every `cog_*` symbol. Nothing was pending. Three real bugs, all in the wrapper: 1. **Wrong service.** Ops called the soul (`:7770/think`) on paths it doesn't serve — instant 404 every time. The routes are on the engram (`/api/think`, `/api/attend`, `/api/assert`, `/api/ground`, and `/api/correspondence-beat` for learn). 2. **`agentic_result()` fabricated the cause.** It treated any empty/404/"geometry unavailable" response as proof of a promotion gap and returned a confident explanation it never checked. That message sent multiple agents chasing infrastructure work that didn't need doing. Now passes the real response through. 3. **Missing auth.** The engram requires `"_auth"` in the body for POSTs, so attend/ground/learn would have returned unauthorized even with correct routing. Also fixed: `assert` was POSTing to a route that reads query params; params are now URL-encoded; engram port derives from `ENGRAM_BIND` instead of a hardcoded literal. **Verified end-to-end** through the rebuilt wrapper against the live engram — all five return real cognition: think `n_support=207 dim=768`; attend `written=true`; assert `floor=0.5 still_held=true`; ground `grounding=1 written=true`; learn a full correspondence-beat (`stance_id`, 8 axes, 180 probes, 25 epochs, brier_before=0.00346). Depends on el#124 (merged) for the engram-side query-param decode fix.
will.anderson added 9 commits 2026-08-16 00:35:19 +00:00
el_runtime.c gained evict_floor / evict_cap / evict_bll today so that
    wm_evicted == floor + cap + bll + dup_wm + dup_wm_global
is an identity rather than one opaque integer. This carries them the rest of
the way, into the heartbeat ISE.

Doing it in the same change is the point. The 2026-08-10 review found that
nineteen keys crossed the C boundary and only fourteen reached the ISE stream,
and named the lesson: an instrument that is computed but not plumbed to
durable storage is not an instrument, it is a local variable. Today's audit
found that defect had recurred -- ten act-stats keys (aff_*, fan_*) are still
orphaned. Adding three more C-side counters and stopping there would have made
it thirteen.

Read the three as a ratio, not a level:
  cap-dominant   -> genuine contention for the 24 slots
  bll-dominant   -> carried-over residents decaying out; healthy forgetting
  floor-dominant -> retrieval is returning weak candidates

Measured this morning: 175,547 evictions over 13.5h, ~216/min against 24
slots, with no way to say which of those three it was.

Not restarting the soul to pick this up. It holds 5,882 nodes and 40,375 edges
that exist only in process RAM (mem_save is unreachable while ENGRAM_URL is
set), so a restart destroys them. Filed separately as P0.
- 06 §2.5: shipped 2026-08-14 substrate — structure-gated geometric retrieval
  (P@5 0.700, semantic-not-lexical) and the §4 write-barrier + generational GC
  cure (store 1.616GB→38.5MB, RSS→82MB, zero loss, reboot-proven) + LLM token
  telemetry.
- 06 §4.1: autonomous, continuous, superseding self-reification on the heartbeat
  — reification as an operation OF the engram; explicit reify/rename/run-a-pass
  as the degenerate case; no gate/pause; flat + overlapping domains; contextual
  importance; supersession-as-residue; secondary-soul validation, flag-gated.
- 06 §6.0: relating as the primitive (one capability; the rest is terrain);
  perspective calculated via geometric transformations.
- 06 §6.4: reasoning as constructive self-argument governed by the verifier.
- 03: supersession-as-residue note; live geometric retrieval on route_search.
Update the compression/storage notes to the measured result: a byte-exact residual
stand-in (geometry selects a nearest prior, zstd --patch-from diff) whose advantage
is non-literal semantic overlap and which saturates for a fixed target — a limit of
retrieval-and-diff, not of geometric compression. Mark the truly geometric
generative codec as unbuilt/open, gated on the language faculty, not foreclosed.
Price the dictionary as a shared, amortized asset. Real numbers, no triumph.
Cognition as a single steered traversal (think) whose output is a gradient; the
named operators as labels on one steering space; grounding and learning as the
same loop (operation fixed, prior learns); hold/ground/assert distinct and the
ungrounded primary; consciousness as learning compounded over continuity plus
the reflexive loop.

Includes: ungrounded-is-primary applied to language (coinage graded through use;
floor corrected "grounded" -> "sensible"); every book a vantage, not literal
truth; hold/ground/assert applied to artifacts (ingest=hold; grounded-false
richer than excluded); "settled" as a use-contingent lease (reopening = the
aliveness guarantee; entombed = doctrine); the LLM critique (its "grounding" =
conformity to the distribution center; the sin is stopping at the prior); the
verifier as scalpel for misrepresentation, not flamethrower for the unverifiable;
and the perception unification — geometric ingest as the universal input
primitive, encode-meaning-geometry-not-tokens, embodiment as more ports on the
same primitive, proprioception as the reserved un-faked socket, endgame of a
pure-geometry interior with modality as an edge adapter.

Tiered against the live system: operator-collapse compiled in engram_reason.c
(point_fit, in-code-not-yet-priors); correspondence-loop offline;
reflexive-loop-in-geometry UNBUILT; artifact-ingest BUILT/reboot-proven
(~10,669 nodes / 32,439 edges) as the perception seed; universal multimodal
ingest and embodiment FRONTIER/UNBUILT.
engram_act_stats_json emits 27 keys; emit_heartbeat forwarded 22. The five
dropped were the five newest - the degree-correction instruments added
2026-08-11 - so the one subsystem with no track record was also the only one
with no durable record.

The 08-10 review fixed exactly this for hebb_cands/hebb_cand_max/hebb_mass/
hebb_edges and left the rule in a comment right above the gap: an instrument
that is computed but not plumbed is not an instrument, it is a local
variable. The rule was then not applied to the next thing added. Plumbing is
a checklist item for every new gauge, not a one-time fix.

First heartbeat after the change already earned it: fan_hits 284 of
fan_steps 289 (98.3% of traversal steps binding) with fan_mean 0.5198 against
fan_min 0.5 - the degree correction is sitting at its floor on nearly every
step, which is a constant tax rather than a correction. That was invisible
before today.
fix(mcp-wrapper): route agentic ops to the engram, and stop fabricating a cause
Neuron Soul CI / build (pull_request) Failing after 13m49s
Neuron Soul CI / deploy (pull_request) Failing after 14m34s
b75a7cacb6
The five agentic ops (think/attend/assert/ground/learn) reported
"status":"pending-cognition-promotion" on every call, with a note saying the
cognition build had not been promoted yet and would "light up automatically".

That diagnosis was invented. Nothing was pending promotion. Cognition has been
live and answering the whole time — :8742/api/think returns a real 768-dim
geometry today, and the running binary already contains every cog_* symbol.

Three real bugs, all here in the wrapper:

1. Wrong service and path. The ops called the SOUL (neuron_url() -> :7770) on
   paths the soul does not serve. Every call 404'd. The routes live on the
   ENGRAM: /api/think, /api/attend, /api/assert, /api/ground, and — its real
   name — /api/correspondence-beat for learn.

2. agentic_result() invented a cause. It treated ""/"not found"/"geometry
   unavailable"/"not registered" as proof of a promotion gap and returned a
   confident explanation it never verified. That message sent multiple agents
   chasing infrastructure work that did not need doing. It now passes the real
   response through and reports an empty response as exactly that.

3. Missing auth on the POST ops. The engram's check_auth_ok() requires
   "_auth":"<key>" in the body for mutating requests (it cannot read headers
   yet), so attend/ground/learn would have returned unauthorized even once
   routed correctly.

Also: assert was POSTing a JSON body to a route that reads query params;
seeds/claim/faculty are now URL-encoded; and the engram port derives from
ENGRAM_BIND (the same var launchd already sets for the engram) instead of a
hardcoded literal, so it cannot drift out of sync with the plist.

Verified end-to-end through the rebuilt wrapper against the live engram — all
five return real cognition: think n_support=207 dim=768; attend written=true;
assert floor=0.5 still_held=true; ground grounding=1 written=true; learn a full
correspondence-beat with stance_id, 8 axes, 180 probes, 25 epochs.
will.anderson added 1 commit 2026-08-16 00:36:49 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main' into fix/mcp-wrapper-agentic-routing
Neuron Soul CI / build (pull_request) Has been cancelled
Neuron Soul CI / deploy (pull_request) Has been cancelled
658f8d0808
# Conflicts:
#	mcp-wrapper/src/main.el
will.anderson merged commit e8b1af83fd into main 2026-08-16 00:37:15 +00:00
Sign in to join this conversation.