|
| 1 | +--- |
| 2 | +type: contract |
| 3 | +title: "CONTRACT — PRODUCT KEYSTONE-2: from organism to product" |
| 4 | +description: "The post-KEYSTONE product campaign (2026-07-07): unblock the prefill stall, expand the harness into a real coding/agentic system, tighten the tiered memory into MEM-OKF v2, and grow the personality + served UI into a product surface. Four tranches, each gated, each default-off = null floor." |
| 5 | +tags: [contract, campaign, product, harness, agency, memory, mem-okf, persona, ui, prefill] |
| 6 | +timestamp: 2026-07-07T00:00:00Z |
| 7 | +resource: shannon-prime-lattice |
| 8 | +sp_status: ACTIVE |
| 9 | +sp_gate: "G-PK2-* (per-tranche, §T1–§T4)" |
| 10 | +sp_commit: TBD |
| 11 | +sp_repro: "per-tranche DONE-WHEN commands, §T1–§T4" |
| 12 | +--- |
| 13 | + |
| 14 | +# CONTRACT — PRODUCT KEYSTONE-2 |
| 15 | + |
| 16 | +> Foundation: [PPT-LAT-KEYSTONE.md](PPT-LAT-KEYSTONE.md) (the organism, ~90% built, live). |
| 17 | +> This contract is the campaign that turns the organism into a **product**: robust under real |
| 18 | +> load, able to *do work* (code, tools, agency), with memory it can trust and a face worth using. |
| 19 | +> Discipline unchanged: receipts-first, pre-registered gates, default-off = byte-identical null |
| 20 | +> floor, no number without a command + a row. |
| 21 | +
|
| 22 | +## 0. Priorities (operator, 2026-07-07) |
| 23 | + |
| 24 | +1. Coding / agentic functionality |
| 25 | +2. Expand the harness system |
| 26 | +3. Expand the personality system |
| 27 | +4. Tighten + expand the memory system (MEM-OKF v2) |
| 28 | +5. Expand the UI |
| 29 | + |
| 30 | +Cross-cutting surfaces named: ADR-002..005, XBAR, NIGHTSHIFT, L5, decoder, execute, KAIROS, |
| 31 | +the Spine, the heads, Telepathy, SSE, the inject seam. |
| 32 | + |
| 33 | +## T1 — PREFILL STALL (the root blocker; do first) |
| 34 | + |
| 35 | +**Problem** (`project_daemon_prefill_stall`, engine `START-HERE-prefill-stall.md`): daemon |
| 36 | +prefill wedges forever at n≈1000–1700 tokens. max_tokens=1 also stalls ⇒ PREFILL. Blocks the |
| 37 | +agent gateway (persona+tools ≈ >1000-tok prompts) and long chats — i.e. blocks priorities 1–3. |
| 38 | + |
| 39 | +**Diagnosis targets** (recon 2026-07-07, `cuda_forward.cu`): |
| 40 | +- H1: kernel-launch error is *silent* until the `cudaStreamSynchronize` at the end of |
| 41 | + `gemma4_kv_prefill` (~:4630); the launch-check at ~:4364 reads `cudaGetLastError` too late. |
| 42 | +- H2: per-token prefill loop queues n×~48-layer kernel launches (~85k at n=1765) with **zero |
| 43 | + intermediate sync** — stream-queue exhaustion wedges the driver. |
| 44 | +- H3: `attn_shm = Pmax*4` shared-memory sizing / Pmax bound. |
| 45 | + |
| 46 | +**Fix shape:** periodic mini-sync (every 256 tokens) inside the prefill loop + pre-launch error |
| 47 | +check + Pmax/shm validation at open. All engine-local, no ABI change. |
| 48 | + |
| 49 | +**DONE-WHEN (G-PK2-PREFILL):** `SP_WORDS=1300 python tests\perf\_g_bigprompt_probe.py` → |
| 50 | +`got_DONE=True`; then n=299 regression still GREEN; then gateway `_g_memory_check.py` on :8800 |
| 51 | +completes. Receipt `tests/perf/G-PK2-PREFILL.log`. |
| 52 | + |
| 53 | +## T2 — CODING / AGENTIC + HARNESS EXPANSION |
| 54 | + |
| 55 | +The harness already has: ephemeral `<tool>` calling (`run_with_tools`), memory/conversation |
| 56 | +tools, system tools (shell/python/web/file), sandboxed coding tools, the agency round + |
| 57 | +KAIROS scheduler, the :8800 gateway (persona live-read). Expansion = **depth + robustness**: |
| 58 | + |
| 59 | +- **E1 Agentic task loop:** a `run_task(goal)` multi-step loop (plan → act → observe → check), |
| 60 | + bounded steps + budget, task state persisted to MEM-OKF (resumable), honest failure surface. |
| 61 | +- **E2 Coding campaign tools:** workspace-scoped edit (anchored find/replace, not whole-file), |
| 62 | + patch-apply + diff receipt, test-runner tool (`run_pytest`), git status/diff (read-only first). |
| 63 | +- **E3 Robustness:** malformed-tool-call recovery (re-prompt with the parse error, N retries), |
| 64 | + tool timeout + output truncation tiers (head+tail), loop/no-progress detector. |
| 65 | +- **E4 KAIROS agency growth:** the maintenance round gains a *work queue* (operator-posted tasks |
| 66 | + the organism advances on ticks), receipted per tick. |
| 67 | + |
| 68 | +**DONE-WHEN:** G-PK2-TASKLOOP (a 3-step coding task — write module + test, run tests, fix a |
| 69 | +seeded failure — completes E2E on the live 12B through the gateway); G-PK2-TOOLROBUST (seeded |
| 70 | +malformed/timeout/looping tool scenarios all recovered, receipts); existing H1–H7 stay GREEN. |
| 71 | + |
| 72 | +## T3 — MEMORY: MEM-OKF v2 |
| 73 | + |
| 74 | +- **M1 Provenance lane** (vision `emergent_provenance`): every registry fact + MEM-OKF record |
| 75 | + carries `src` (turn/episode/operator/consolidator + timestamp); recall recites provenance on |
| 76 | + demand ("where did I learn that?"). |
| 77 | +- **M2 Extraction hardening:** consolidator pulls convo facts into MID reliably (dedupe via |
| 78 | + token-overlap vs registry before append; the DECIDE/MERGE layer already handles conflicts). |
| 79 | +- **M3 Registry hygiene:** compaction pass (drop superseded/forgotten tombstones), integrity |
| 80 | + check tool (`okf_mem verify`), size/age telemetry in `/v1/metrics`. |
| 81 | +- **M4 Tier plumbing:** `recall_conversations` quality pass + capabilities corpus refresh; keep |
| 82 | + the Jaccard @0.6 verifier as the production gate (26B cascade stays retired). |
| 83 | + |
| 84 | +**DONE-WHEN:** G-PK2-PROVENANCE (fact stored → "where did you learn X?" → correct source |
| 85 | +recited); G-PK2-MEMHYGIENE (verify tool GREEN on live stores; compaction preserves recall on a |
| 86 | +before/after probe set); G-FORGET/G-DECIDE/G-MERGE regression GREEN. |
| 87 | + |
| 88 | +## T4 — PERSONALITY + UI |
| 89 | + |
| 90 | +- **P1 Persona:** structured `persona.md` v2 (identity / voice / values / self-knowledge |
| 91 | + sections), gateway hot-reload (exists) + a persona *editor* in the console; persona changes |
| 92 | + are memory events (provenance: operator-set). |
| 93 | +- **P2 Self-knowledge:** capabilities corpus refresh post-T2 (the organism can state its own |
| 94 | + new tools), seeded via `_seed_capabilities.py`. |
| 95 | +- **U1 Console v2 (`index.html`):** tool-call display (render `<tool>` calls + results as |
| 96 | + cards in the stream), memory browser pane (registry facts + MEM-OKF LUT, read-only first), |
| 97 | + persona editor textarea (POST to gateway), SSE robustness (reconnect, abort button wired). |
| 98 | +- **U2 Telemetry pane:** /v1/metrics poll (VRAM, tok/s, memory counts). |
| 99 | + |
| 100 | +**DONE-WHEN:** G-PK2-UI (chat + tool cards + memory pane + persona edit round-trip live on |
| 101 | +:8800/:3000); G-PK2-PERSONA (persona edit → next turn reflects it → provenance recorded). |
| 102 | + |
| 103 | +## Order & rules |
| 104 | + |
| 105 | +T1 → T2 → (T3 ∥ T4). Git ops native PowerShell only (mount CRLF-churns). Large-file reads on |
| 106 | +the mount truncate — verify via native tools. One daemon at a time (12B fills the 2060). |
| 107 | +Pre-flight `okf_mem lookup` before building any new capability. Every mechanism lands behind a |
| 108 | +default-off flag or additive endpoint; the null floor is byte-identical. |
0 commit comments