Engineering

Why We Built a Bare-Minimum Agent Kernel

How we deleted heuristic scaffolding from Sikemux, cut MCP turn-1 overhead 97.9% vs Anthropic's baseline, saved 99.96% disk on warm worktrees, and enforced 0-token guardrails.

5 min readSikemux Engineering
agent-kernelai-coding-agentsmulti-agent-architecturemcp-performancegit-worktreessecurity

Every six months, a new frontier model turns half of a multi-agent framework into dead weight.

Auditing Sikemux exposed thousands of lines of Rust trying to out-think the model: an English cue-word memory engine, background LLM summarizers, compiled orchestrator prompts, fixed character caps slicing rules mid-word, and 70 upfront MCP tools.

We deleted that scaffolding and rebuilt around a bare-minimum agent kernel: deterministic OS primitives in Rust, with cognition left to plain Markdown and editable skills. Below are the measurements that actually moved the needle (Apple Silicon, macOS APFS, tiktoken o200k_base) and the traps they exposed.

Before and After: What Actually Moved the Needle

Subsystem Before After Impact
MCP turn-1 surface 70 direct tools (Anthropic baseline: 55K tok) 26 direct tools / 1,164 tok gateway -62.9% tools, 97.9% leaner than 55K baseline
Orchestrator prompt 1,009 compiled tokens 152 tokens (+ on-demand skills) -84.9% prompt tokens
Memory maintenance Background LLM summarizers + cue rules 0 tokens deterministic linter -100% LLM spend, runs in <10 ms
Warm isolated workspace 21.6 s / 1.18 GB cold clone ~2 s / ~103 MB (42.3 GB warmed) 99.96% disk saved on 40.8 GB Rust cache
Credential handling Prompt rules around secrets Host-side blind-fill vault 0 plaintext secret bytes in transcripts

Multi-Agent Coding Architecture: Why Heavy Frameworks Decay

The strongest signal in coding harnesses is what frontier teams deleted:

  • Memory heuristics: Anthropic showed prescriptive memory rules helped older models but degraded newer ones on CL-Bench.
  • Bloated tool surfaces: Vercel cut a data agent from 17 tools to 2 (bash and SQL), lifting pass rates from 80% to 100% and running 3.5x faster. Anthropic saw 58 upfront MCP schemas burn 55K to 134K tokens before turn 1.
  • Prompt walls and locks: Cursor deleted 66% of its system prompt and found flat locks collapsed parallel throughput, while isolated trees scaled cleanly.

One law unifies all three: cognitive scaffolding written in code depreciates every six months, while OS physics and security invariants appreciate with every model jump.

An agent kernel draws that OS boundary:

+----------------------------------------------------------+
|       MODEL-OWNED COGNITION (Plain Files & Skills)       |
|  Planning, Markdown notes, skills, swappable harnesses   |
+==========================================================+
|          DETERMINISTIC AGENT KERNEL (Rust)               |
|  1. Worktrees & Landing   APFS CoW, ports, linear queue  |
|  2. Shared State & Lint   CRDTs, SHA-256 blobs, 0-LLM    |
|  3. Signed Rooms & Specs  OS caller ID, 8-turn breaker   |
|  4. Verifiers & Sandbox   Receipts, blind-fill, taint    |
+----------------------------------------------------------+

Because the kernel owns thread logs and workspace state, Claude Code, Codex, and Gemini stay swappable drivers. See the agent kernel docs and chats guide.

MCP Tool Token Overhead and the 3.38x Always-Load Trap

Folding tool families into multiplexed tools cut our direct MCP catalog by 62.9% (70 down to 26 tools), exposing a trap that hits most MCP redesigns:

  1. Multiplexing alone barely shrinks schemas: Every sub-action’s parameter schema still lives inside its parent tool.
  2. The 3.38x alwaysLoad trap: Our eager alwaysLoad tier previously marked frequent flat tools at 979 tokens. Propagating alwaysLoad onto consolidated parent families dragged every cold sibling action onto turn 1, ballooning the eager tier to 3,306 tokens: 3.38x larger.
  3. Gateway indexing delivers the win: Exposing only guide and call plus a compact index brought turn-1 context to 1,164 tokens, 97.9% leaner than Anthropic’s 55,000-token baseline.

Takeaway: Never pair multiplexed families with eager loading. Keep cold actions behind a lazy index, and move role playbooks into on-demand Markdown skills, cutting our orchestrator prompt by 84.9% (1,009 to 152 tokens).

Why Heuristic Agent Memory Silently Rots

Our deleted memory stack paired background LLM summarizers with a heuristic contradiction detector using English stop-words, cue lists, and Jaccard similarity.

Auditing that engine showed how string heuristics rot silently. Putting "on" in the positive-cue list broke verbatim opposites:

  • Note A: "Always push commits directly on main"
  • Note B: "Never push commits directly on main"

Because Note B matched both "never" (negative) and "on" (positive), its polarity canceled out and the detector passed both rules as non-contradictory. Complementary tooling rules falsely tripped, differently worded opposites slipped through, and a fixed character cap sliced a project rules block mid-word ("...never bypass vault_r").

We deleted both systems. Memory now lives in plain Markdown under a bounded index, trimming respects complete lines on window-relative budgets, and a 0-token deterministic linter runs in under 10 ms to catch oversized indexes, broken links, dead wikilinks, leaked API keys (skipping fenced code), and stale code anchors via git diff. Salience stays with the model.

Parallel Coding Agents With Git Worktrees and APFS Copy-on-Write

Shared checkouts corrupt git indexes, clobber diffs, and clash on ports; cold clones trigger multi-minute rebuilds. Measuring on our live repo disproved our guess that recursive APFS cp -cR would make cloning instant:

Operation Wall Time Apparent Size Physical Disk Delta
Fresh git clone --no-hardlinks 21.6 s 1,165.5 MB 1,180.2 MB
Naive recursive cp -cR (full repo) 11.75 s 1,165.5 MB 86.5 MB
Warm Rust target/ (clonefile) 1.17 s 40.8 GB 17.6 MB (99.96% saved)
Combined warm isolated workspace ~2.0 s ~42.3 GB ~103 MB

Naive cp -cR spent almost twelve seconds walking .git objects file by file. Pairing git worktree add with directory-level clonefile on node_modules/ and target/ beats cp -cR by ~6x, warming a 42.3 GB workspace for ~103 MB of disk.

Finished commits land through line-level edit ownership and a serialized linear queue: disjoint edits merge cleanly alongside sibling work, while colliding lines refuse cleanly without mutating main. We dogfood this daily building Sikemux itself, with parallel Claude and Gemini agents landing signed commits onto a linear main without lock contention. See worktrees and handoffs.

Sub-Millisecond Deterministic Guardrails Outside Model Context

Thinning cognition only holds when verification and security run outside model context:

  1. Blind-fill vault: Agents use opaque vault:<id> handles while the kernel injects credentials directly into browser fields or proxies. 0 plaintext secret bytes enter transcripts; payments and first-time access require human approval. See vault and browser automation.
  2. SHA-256 MCP manifest pinning: External MCP schemas are hash-pinned on approval, with sub-millisecond drift checks halting execution if a remote server mutates a schema.
  3. Lethal-Trifecta taint: Sessions reading both private data and untrusted content have unapproved egress blocked in sub-millisecond time until cleared out of band.
  4. 8-turn loop breaker: Signed rooms stamp OS caller identity and pause agent-only loops at turn 8 without human input or verified progress.
  5. External verifiers, hash-chained logs, and OS kill: The kernel runs checks, SHA-256 chains transcripts, and kills runaway agents at the OS process tree.

Scope Boundaries and Two Regressions We Caught

These benchmarks prove structural token overhead, deterministic latency, and APFS disk economics. They are not controlled SWE-bench pass-rate or full-trajectory A/B evals (such as measuring how often lazy guide calls offset turn-1 gateway savings).

Shipping the kernel also caught two real regressions, now fixed and tested:

  • Folding flat tools into families broke packaging smoke checks still calling legacy flat names.
  • Our first egress-taint pass flagged zero-exposure blind-fill and memory-list calls as private reads, causing false-positive blocks until we narrowed taint to true secret reads and added clean-origin exceptions.

Betting With the Model Curve

Hardcoding orchestration graphs or cue heuristics bets against next quarter’s models. Keep cognition flat and model-owned while enforcing worktrees, shared state, external verification, and OS security in a thin kernel.

Inspect the code on GitHub, read the Agent Kernel docs, or compare approaches on sikemux.com/vs.

Frequently asked questions

What is an agent kernel in multi-agent coding architecture?

A thin, deterministic runtime owning OS primitives (worktree isolation, shared state, caller identity, blind-fill secrets, external verifiers) while leaving planning and memory layout to the model.

How do you cut MCP tool token overhead without breaking discovery?

Keep cold actions behind a compact gateway index (guide + call) instead of loading full schemas on turn 1. Folding flat tools into families without lazy loading can bloat eager tiers by 3.38x.

How do parallel coding agents share git without rebuild storms?

Isolate each agent in a git worktree warmed via APFS copy-on-write caches, enforce line-level edit ownership, and merge through a serialized linear queue. A 42.3 GB workspace warms in ~2 s and ~103 MB.

Why use deterministic guardrails instead of prompt safety rules?

Compaction drops prompt rules and prompt injection overrides them. Blind-fill secrets (0 plaintext bytes), sub-millisecond SHA-256 MCP pinning, taint checks, and an 8-turn loop breaker run outside model context.

Run your coding agents on one fast Rust kernel.

Free, MIT-licensed desktop workspace for macOS, Linux, and Windows. Use your own subscriptions with zero model resale.