commit f574313ad53d72d215d98e649e3f9494f79c4488 Author: Konrad Date: Sat Nov 7 05:13:15 2026 +0000 splinter: CHAOS.md — every idea from the three agent-harness attempts Collected on 2026-11-06 while planning an own harness: MikroAgent (92 items across transport, loop, persistence, tools, compaction, budget, limits, audit, endpoint policy, build/test), OpenITT (invariants, disk-backed streaming, compression with retrieval, session format, memory accounting, long-input + linecomp + notes loop) and agentk (context-engine vtable, LCM pipeline, summary DAG, structural pre-cleanup, ObservationPack, prompt cache, threaded reactor), plus the points where the three disagree and the tool-call robustness gap measured on the MacBook. diff --git a/CHAOS.md b/CHAOS.md new file mode 100644 index 0000000..6735b3c --- /dev/null +++ b/CHAOS.md @@ -0,0 +1,455 @@ +# CHAOS — every idea from the three harness attempts + +**Stand: 2026-11-06.** Collected while planning a new agent harness of our own. +Everything below was read out of the existing trees, not invented. Line counts +and file references are what the trees actually contain at this date. + +## Provenance — what was read + +| Tree | Location | Size / state | +|---|---|---| +| MikroAgent | `~/src/MikroAgent` (kitt) | 12,530 lines C99, 17 test binaries, `make check` green, 100,768 B binary, ~4 MB RSS, 0 CPU idle, 2 commits (`e21a11c` Phase 11, `b880a40` Phase 10) | +| OpenITT | `~/src/OpenITT` (kontron) | single binary + `libopenitt.a`, 381 tests / 0 failures, docs ≈3,000 lines, **not a git repo** | +| agentk | `~/src/agentk` (kitt) | **no code**: 852-line plan `refs/agentk-implementation-plan.md`, 15 skills under `.agents/skills/`, 26 research refs, 5 open tasks in `.tasks/` | + +Read in full: `MikroAgent/docs/{design.md,architecture.md,performance.md}`, +`MikroAgent/AGENTS.md`, `OpenITT/OPENITT-OVERVIEW.md`, +`OpenITT/specs/{compression-algorithm.md,long-input-design.md,notes-loop-pitch.md}`, +`OpenITT/TOOLS.md`, `agentk/refs/agentk-implementation-plan.md` (selected +sections), `agentk/.tasks/*.md`. + +--- + +# A. MikroAgent — the engine that already runs + +## Transport layer + +1. **Transport vtable**: `send() → {status, body}`, optional `send_stream()` + handing **raw bytes** to a callback. The transport never parses JSON or SSE, + so a mock, a libcurl adapter and any future provider share one seam. +2. **Deterministic mock transport**: replies queued FIFO; `send_stream()` + replays a queued body in **caller-chosen chunk sizes**; records the last + request body and a request count. This is how fragmented-argument handling + is tested with no network and no paid endpoint. +3. **SSE framer is the only module that knows `\n\n`**: buffers partial lines + across reads, ignores comments and non-`data` fields, strips an optional + `\r`, reports an unterminated final event. +4. **Wire isolation**: only `model/openai.c` knows the OpenAI shape; tool-call + fragments are merged by `index`, and **a fragment never yields a call until + the stream finishes**. +5. **Raw `arguments` kept as a JSON string**, never parsed into an object at + parse time — preserves exactly what the model sent for the audit trail and + defers parsing to execution, because the API states arguments may be invalid + JSON. + +## Agent loop + +6. Budget checked **before every request**; authorization callback before every + non-read tool; **never a call without its result**. +7. **Authorization as a callback with fail-closed default**: with no callback, + reads run and everything else is denied — the denial is delivered to the + model *as the tool's observation*. Enforcement lives in the tool-execution + layer, never in the system prompt (the prompt explains, it never decides). +8. **Three policies**: read-only, confirm-mutations (default), configured + autonomous. The prompt shows tool name, class and the **exact `arguments` + JSON**; anything but `y`/`yes` is denial; no stdin (`-p` plus a mutating + tool) fails closed. + +## Persistence + +9. **One directory per session**: `meta` as `key = value`, written atomically + (`meta.tmp` → `rename()`); `messages.jsonl` opened `O_APPEND`. +10. **Crash model**: a crash can only truncate the tail, so recovery replays + complete lines and discards one partial line, reporting a `recovered` flag. + A **complete** line that is not a valid message object is corruption and + fails the load. +11. Session ids default to `sess-