reshape: decorator-as-seam — port @route codegen, prove decorate->serve, rewrite surface as decorated El

Ground-truth the three seams (route/telemetry+interoception/bus) with file:line
evidence. Port the tested @route codegen+parser from feat/el-route-decorators
into the worktree elc (decoration synthesizes el_route_dispatch — no hand-written
90-branch handle_request). Rebuild elc self-host; prove decorate->serve end-to-end
(route_proof.el on :8951). Rewrite surface.el as El-native decorated components:
@route + @accessor/@manager, in-process engram_* builtins (not http_get), @manager
ops emit on the real dharma_* bus (same transport as wt/swarm-ccr). Identity
keystones refused in write/relate/supersede. Gate-1 clone recipe (WAL-aside
cold-boot + ENGRAM_WAL=on) proves the FULL op set live on the clone. Boundary
auto-emit (telemetry/interoception/bus) staged as a reviewable cg_fn diff
(SEAM_STAGED.md) — needs the cognition-engram rebuild to verify link. Live :8742
untouched; no push, no cutover.
This commit is contained in:
bigmerge
2026-08-14 21:01:27 -05:00
parent f19040e484
commit d4f401de1c
7 changed files with 848 additions and 239 deletions
+36 -14
View File
@@ -10,6 +10,24 @@ Ground-truth: routes verified against the live cognition binary
`feat/cognitive-architecture`, `engram/src/server.el`). Built + validated on an
**isolated nsbx clone** (`:8900`); live `:8742` untouched.
**The decoration IS the API.** `surface.el` is El-native: each op is one function
decorated with its `@route` (codegen synthesizes `el_route_dispatch` — no
hand-written 90-branch dispatch) and its VBD role (`@accessor` = engram I/O,
`@manager` = agentic orchestration + DHARMA emitter). Handlers call the engram
**in-process** via `engram_*` builtins (not `http_get` — that idiom only existed
because the old MCP wrapper was a separate process). Decorate→serve is **proven**:
`route_proof.el` serves decorated handlers on :8951; `surface.el` compiles and the
dispatcher is generated for all 8 ops. See `SEAM_STAGED.md` for the three-part seam
(route / telemetry+interoception / bus) ground-truth and the staged boundary diff.
**Clone boot recipe (gate-1):** cold-boot from `neuron.egm` with the WAL set aside
(the live-store clone's WAL is torn and loops on replay) + `ENGRAM_WAL=on` (routes
node-writes to the WAL-append path; without it `persist_node`→full-store checkpoint
**segfaults** a clone) + `ENGRAM_GEOMETRY_PRIMING=1`. **Anchors must be node-ids**
(think/ground/learn resolve each seed via `engram_find_node_index`; free text →
"geometry unavailable"). With this recipe the **full op set is proven live on the
clone** (below).
## Layer 1 — geometry ops
| op | signature | engram route | replaces (~) |
@@ -31,13 +49,13 @@ The base verbs all agentic behavior composes from — grounded in the LIVE
cog-arch (`think` is the one operation; faculties are its steering-space labels;
the correspondence-beat is the reflexive learning loop).
| op | signature | engram route | status on clone |
|----|-----------|--------------|-----------------|
| `think` | `think({seeds, faculty})` faculty ∈ reason·abduce·induce·plan·analogize·recognize·discern·synthesize | GET `/api/think` | route wired; geometry-gated on HTTP daemon clone (validated via C harness: held-Brier 0.0286→0.0006 @ 10,994 nodes) |
| `attend` | `attend({node, observer, salience})` | POST `/api/attend` | **live** (returns `salient-to`) |
| `assert` | `assert({claim, for_whom, floor})` — realize, honesty-floored | GET `/api/assert` | **live** |
| `ground` | `ground({claim, evidence, for_whom})` | POST `/api/ground` | route wired; geometry-gated |
| `learn` | `learn({seeds, faculty, keystone})` — the correspondence-beat | POST `/api/correspondence-beat` | route wired; geometry-gated |
| op | signature | engram builtin | status on clone (gate-1 recipe) |
|----|-----------|----------------|---------------------------------|
| `think` | `think({seeds, faculty})` faculty ∈ reason·abduce·induce·plan·analogize·recognize·discern·synthesize | `engram_think_json` | **PROVEN** — all 8 faculties return real 768-dim gradients (n_support 30282) |
| `attend` | `attend({node, observer, salience})` | `engram_attend_json` | **PROVEN** (returns `salient-to`) |
| `assert` | `assert({claim, for_whom, floor})` — realize, honesty-floored | `engram_assert_json` | **PROVEN** |
| `ground` | `ground({claim, evidence, for_whom})` node-id anchors | `engram_ground_json` | **PROVEN** (grounded-by edge, grounding=0.912, written) |
| `learn` | `learn({seeds, faculty, keystone})` — the correspondence-beat | `engram_correspondence_beat_json` | **PROVEN** (real Stance: `stance-induce-…`, brier, reliability, written) |
`comprehend`/`realize`/`intend` are **compositions**, not separate live
primitives: comprehend = write+activate (world→geometry), realize = assert
@@ -67,11 +85,15 @@ and **Neuron does the agentic work over its own geometry** — the beginning of
running itself.
## Files
- `surface.el` — the reshaped surface (ops + agentic primitives + old-tool aliases), engram-HTTP idiom matching `neuron/mcp-wrapper/src/main.el`.
- `parity.sh` — proves it against the clone (`source ../../.nsbx-env && ./parity.sh`). Last run: **12 proven, 0 failed, 14 wired-but-gated/exec-skipped**.
- `surface.el` — the reshaped surface as **decorated El-native components** (`@route` + `@accessor`/`@manager`, in-process `engram_*` builtins). Compiles; dispatcher generated for all 8 ops.
- `route_proof.el` — a standalone decorated El service that **proves decorate→serve** on :8951 (built with the worktree-rebuilt `elc-route`).
- `SEAM_STAGED.md` — the three-part seam (route / telemetry+interoception / bus) ground-truth + the exact staged `cg_fn` diff for boundary auto-emit.
- `agentic_loop.el` — the four-call loop (think→attend→learn→read) as compilable El.
- `parity.sh` — API-level parity harness against the clone.
## Honest ledger (built vs stubbed)
- **Proven live on clone:** read (3 forms), attend, assert, aperture-boundedness, parity spines.
- **Route-wired, geometry-gated on the HTTP daemon clone:** think (8 faculties), ground, learn. (The centered geometry isn't primed by the daemon boot on a clone — same on the peer clone `:8901`; the operation is exercised via the C cog-arch harness per `nsbx validate`.)
- **Route-wired, exec-skipped on clone:** write, relate, supersede — the paged-store node-write crashes a WAL-less cold-boot clone; run on a write-healthy store.
- **Not done:** compiling `surface.el` into the MCP server + hot-swap; wiring all ~90 aliases into `dispatch_tool_call`; the engram-side fix so a daemon clone primes geometry + survives writes. No promote to live (per rails).
## Honest ledger (built vs staged)
- **Route seam — IMPLEMENTED + PROVEN:** ported the `@route` codegen (from `feat/el-route-decorators`) into the worktree, rebuilt `elc` self-host, proved decorate→serve (`route_proof.el` on :8951); `surface.el` compiles with `el_route_dispatch` generated for all 8 ops.
- **All ops PROVEN live on the clone** (gate-1 boot recipe, node-id anchors): read, write, relate, supersede (immutable), tombstone, think (8 faculties), ground, attend, learn — daemon alive through all mutations (node_count 13173→13176).
- **Aperture-boundedness PROVEN:** vantage-read `limit=3 → 15 KB` vs `limit=50 → 363 KB` (fixes the whole-self dump).
- **Bus:** `@manager` ops emit on the real `dharma_*` bus (explicit today, compiles) — same transport as the swarm (`wt/swarm-ccr`).
- **STAGED (not guessed — needs the cognition-engram rebuild to verify link):** auto-injecting telemetry/interoception + bus emission at the decorated boundary (`cg_fn` diff in `SEAM_STAGED.md`); building the cognition engram with `surface.el` compiled in. No promote to live, no cutover (per rails).