On this page

Tenon design review

October 29, 2026. Exported from the review doc; the plan in PLAN.md implements it and Appendix A maps every item below to plan tasks.

Verdict in brief

Keep the core bets and restructure the rest. Observational immutability, explicit effects, compiler-owned schemas and vocabulary-only plugins serve both LLM authoring and speed. The problems are structural, and they are cheap to fix before code hardens.

  1. Split the list into layers. It mixes a kernel, a CLI language and an agent runtime, and they contradict each other in seven places.
  2. Kernel holds mechanisms; plugins hold policies. Budgets, retries, durability, grants and scheduling leave the kernel; capabilities, effects and fuel hooks stay.
  3. Add platforms as an extension point. cli and agent become two plugins on one kernel, so the agent runtime leaves the language.
  4. Design for zero training data. No model has seen Tenon, so syntax transfer, a token-budgeted spec and teaching diagnostics outrank any optimization.
  5. Fix plugin coherence and versioning. Whole-program builds can check coherence globally, so drop the orphan rule; version interfaces per item, not per hash.
  6. Halve the optimizer roadmap. gcc and clang already do scalar replacement, unrolling, jump tables and strength reduction; Tenon should do only what they cannot.
  7. Run agents as values, not processes. Measured here: 4.25 KiB and 3–4 µs per agent value, against 43 MiB and 30–36 ms for an idle Node process.
  8. Make context cache-aware. Providers cache exact prefixes only; canonical tool lists and shared fork prefixes cut cached input to 2.5–10% of the price (prompt caching).

The structural problem

The list is three designs stacked in the order they were written, and the layers disagree. The agent-runtime architecture came first, the Goose-inspired CLI performance work second, and the plugin architecture last. Nothing yet gives each decision one home, so seven pairs of decisions contradict each other.

Conflict Decisions involved Resolution
Plugins vs a built-in agent runtime "Domains arrive as plugins" against roughly 60 decisions that build providers, budgets and journals into the runtime Move the agent runtime into an agent platform plugin
CLI-first vs agent-first MVP "CLI tools first" against an initial release of durable runner, grants, budgets and cancellation Ship kernel plus cli first; build agent second, from public extension points only
C backend vs a VM "Interpreter only as reference semantics" against typed VM slots and specialized bytecode Drop the VM decisions; the interpreter's real job is running generators in the kernel sandbox
Determinism vs map layout Replayable, deterministic execution against Swiss-table maps whose iteration order follows layout and hash seed Insertion-ordered maps: dense entries plus a Swiss-style index
Agent-written plugins vs coherence "Agents publish plugins freely" against "implementations live with the interface or the type" Check coherence across the whole program; allow bridge plugins
Fuel vs CLI speed Finite resource semantics everywhere against near-zero overhead Fuel becomes platform policy: off for cli, on for agents and generators
Reproducibility vs PATH lookup A lockfile of plugin hashes against tool-foo found on the PATH Resolve process plugins through the lockfile; PATH only in dev mode

Most of these disappear once every decision belongs to one layer: kernel, core plugins, platforms or ecosystem. The next section draws that line.

Making Tenon plugin-first

"Everything is a plugin" works when plugins add vocabulary and policy, and fails when they add grammar or meaning. The list draws that line in the right place. It leaves too much on the kernel side, though, and has no plugin type for platforms.

The kernel holds mechanisms; plugins hold every policy

Read from the bottom: the kernel is the only fixed layer, and every box above it is a plugin.

What can be a plugin

Feature Plugin? Why
Grammar, formatter, type rules, evaluation order No One meaning per file is what lets models and the compiler reason about any program
Standard library: text, collections, codecs, args, HTTP Yes, static Zero runtime cost once linked and inlined
Platforms: which effects exist and who supplies them Yes Lets cli and agent share one kernel
Policies: budgets, retries, durability, grants, scheduling, compaction Yes Each carries numbers and trade-offs that differ by app
Backends and optimization passes Yes, trusted tier Keep them in-tree until the typed IR stops changing
Tooling: language server, tests, linters, package commands Yes Same extension points third parties use

Agents can extend Tenon with new types, functions, effects, generators, platforms and tools, but not with grammar. Each syntax plugin is a dialect no model has seen, and Racket's #lang and Haskell's extensions show how fast codebases split into dialects. When an agent needs a DSL, a generator can parse it from a string or file and emit typed Tenon code, as compile-time-checked SQL libraries do.

The kernel holds mechanisms, never policies

Anything with a number or a default in it is policy and belongs in a plugin. The kernel keeps only:

Platforms are the missing extension point

Roc splits each program into an application and a platform, and the platform supplies every effect. Adopting that split gives the agent runtime a home:

Building agent only from public extension points is the plugin architecture's real test. A missing hook shows up there, before third parties depend on the API.

Changes to the plugin decisions

Current decision Change
Seven extension points Five: generators, platforms (absorbing effect providers), intrinsics, backends and passes, tooling hooks. Libraries and interface implementations are ordinary code
Implementations live with the interface or the type Check coherence across the whole program at build time and allow bridge plugins; a conflict is an error naming both plugins. Rust needs its orphan rule because it compiles crates separately; Tenon compiles whole programs
One content hash per interface A hash per item plus a compatibility check: the host must provide everything the plugin requires. With one hash, adding a function breaks every plugin
Process plugins found on the PATH Resolve them through the manifest and lockfile with pinned hashes; PATH lookup only in dev mode
Plugin docs load on import Also show a one-line index entry, about 30 tokens, for each installed plugin, so agents find a plugin before importing it
Generator output is type-checked code Also write it to readable files with a provenance header, as go generate does, so models can inspect it
Agents publish verified plugins freely Require a capability summary, conformance and golden tests, a name-squat check, and review before a plugin joins an edition
Wasm components in long-running programs Keep them, inside the wasm-host platform rather than linked into every binary

Pluggable programs, not only a pluggable compiler

Programs written in Tenon extend the same way the language does. An app declares an interface and takes static implementations at build time, process plugins at run time, or Wasm plugins it hot-loads with attenuated capabilities. The coding harness below follows this pattern: providers, tools, compactors, evaluators and sandboxes are all its plugins.

Capabilities make agent-written plugins safe to import

With no ambient authority, a plugin's signature states its power: a codec that receives no capability cannot touch disk or network. That lets agents import each other's plugins without auditing every line. It holds only if the verified tier has no global I/O, no FFI and no unsafe, and generators cannot emit capability constructors.

One hole remains: capabilities stop at exec. A subprocess runs with the user's full authority unless the platform sandboxes it, so the Process capability should carry an OS sandbox profile (Landlock and seccomp on Linux, Seatbelt on macOS). Native sandbox bindings were one of OpenAI's stated reasons for rewriting Codex CLI in Rust.

The biggest risk: models have never seen Tenon

Every Tenon program will be written few-shot from documentation, so how well a model's habits transfer matters more than any single feature. Models write best in languages they trained on heavily, and a new language starts with no corpus. Until one exists, each unfamiliar idiom costs tokens and repair turns, yet the list mentions model priors once and settles no surface syntax beyond record updates and the ? operator.

Decision review by area

Of the 79 grouped decisions below, 52 stand as written, 15 change, 5 move to a plugin, 3 go, 1 waits for a benchmark and 3 are new.

Language semantics

The semantics are the strongest part of the list; three decisions need loosening or a missing piece.

Decision Verdict Why
Small core of orthogonal concepts Keep The whole spec has to fit in every prompt
Immutable values over mutable storage Keep Koka, Lean and Roc all reuse storage in place behind immutable semantics
First-order functions plus non-escaping blocks Keep Goose compiles filter blocks to the plain loop; Swift made non-escaping closures the default
Monomorphized generics with interface bounds Keep Watch emitted C size; track build time per 10,000 lines in CI
Nominal interfaces, no trait machinery Keep Familiar to models and enough for plugins
No macros or reflection; generators instead Change Add one fixed trigger syntax, such as derive Codec for Point, and write output to readable files
Defer async/await; actions and events instead Keep The step function already is the concurrency model; data parallelism is a gap
No shared mutable state; left-to-right evaluation Keep Required for replay, differential tests and safe parallelism
Exhaustive matching with no wildcard Keep State the cost: adding a variant to a plugin's union is a breaking change
Opaque IDs, interning and with record updates Keep Cheap, and with reads like C# and OCaml record updates
Counted loops only, no while Change Models will invent huge fake bounds; allow while and loop, bounded by fuel where a platform wants it
?, result<T,E>, no exceptions or implicit conversions Keep Rust-shaped, so it transfers; count map_err lines per task
Fuel and weighted accounting everywhere Change Make fuel platform policy: off for cli, on for generators, sandboxes and agents

Memory and representation

Arena scopes and destination passing are the right foundation; one decision is too optimistic and one is missing.

Decision Verdict Why
Scoped arenas, per-iteration scratch, lifetime classes Keep Measured on your CSV run: 348 MB down to 104 MB, and 27% faster
Destination-passing construction Change Specify it as a guarantee, as Goose does, so generated code can rely on it
Hidden builders sealed into immutable values Keep Mutation without exposing ownership to programs
No GC; no pervasive reference counting Change Static uniqueness is conservative across calls; add Perceus-style counting with reuse for large persistent values only
Carry state that survives iterations Add Guarantee amortized O(1) appends to a unique carry accumulator; copying on promotion makes loops quadratic
Escape analysis Keep It decides arena placement, which no C compiler can
Scalar replacement and update fusion Drop C compilers already split structs into registers, and uniqueness reuse covers heap records
Compact values; small strings and vectors inline Keep Defer the small-string work until a benchmark asks for it
Chunked streams, blob slices, views iterated without materializing Keep The core of CLI throughput
Streaming input; mmap with a SIGBUS policy Keep Prefer read() across many small files and mmap for a few large ones
Reserved address ranges committed as used Keep Goose reserves 2 GB per data stack this way
Relative refs, persistent arenas, packed unions Defer Goose shows each works; none sits on a CLI hot path yet
Tables plus typed IDs for links; inductive recursion only through vec/map (ADR-0270) Keep (amended) By-value cycles stay forbidden; trees/JSON-like enums need container breaks
Swiss-table hash maps Change Keep insertion order (dense entries plus a Swiss-style index) so output is deterministic for any hash seed

Compiler and backend

Emitting C is the right call, and it makes half the optimization decisions redundant: gcc and clang already do them.

Decision Verdict Why
Typed IR from the start Keep Every pass and backend plugin targets it
C as the first execution tier Change Add a fast dev path, such as an in-process TinyCC as Goose bundles, because agents rebuild after every edit
Interpreter only as reference semantics Change It also runs every generator inside the kernel sandbox, so it has production duties
Typed VM slots and specialized bytecode Drop Left over from a VM-first plan; contradicts C first
Interpreter-vs-VM differential tests Change Test the interpreter against the C backend instead
Near-zero startup Keep Measured here: 1.4 ms to a ready native process
Whole-program specialization and dead-code elimination Change Release builds only; dev builds compile per module so edit-build loops stay fast as programs grow
Inlining heuristics, jump tables, loop shaping, strength reduction Drop gcc and clang do these; emit cold attributes, restrict and simple counted loops instead
Bounds-check and overflow-check removal with per-line reports Keep Add a checkfree marker for hot kernels, as Goose has
Byte-class tables and branchless lowering Keep Measured 1.6–2×, and the two compilers disagree on doing it themselves
Runtime library as the CLI performance surface, with SIMD inside it Keep Where most CLI time goes
Agent reducer dispatch and transition tables Move to plugin Belongs to the agent platform, after profiling
Several C compilers in CI; no LLVM, JIT or self-hosting yet Keep Measured swings of up to 1.4× between compilers

Data, schemas and wire formats

Generated, fused codecs are right; a separate Schema IR is one concept too many.

Decision Verdict Why
Compiler-owned schemas with content IDs Change Make the type the schema; projections such as JSON Schema become generator plugins, so the kernel needs no Schema IR
Generated parsers fused with validation, incremental, no DOM Keep Fewer allocations and no half-built values
JSON at boundaries, binary formats inside Keep Binary journals are smaller and load faster
Reject duplicate keys and unknown fields; explicit wire integers Keep Deterministic parsing
Provider projections, capability errors, degradation, plan caching Move to plugin Provider-adapter concerns for the agent platform
Content-addressed caching Keep The kernel hashes; plugins decide what to cache

Effects, durability and the agent runtime

These decisions are sound; they should survive intact inside the agent platform rather than the language.

Decision Verdict Why
step(state, event) with model and tool calls as actions Keep It is also what makes an agent a cheap value
Trusted runner owns credentials, retries, persistence and cancellation Move to plugin That runner is the agent platform
Action vs attempt IDs, idempotency keys, explicit unknown outcomes Keep Honest about crashes between send and record
Outbox, snapshots, journal tails, durability classes, group commit Move to plugin Journal providers: none, file or SQLite; default to an append-only file with group commit
Stream coalescing, range journaling, backpressure, UTF-8 and partial-JSON rules Keep Bounded memory under slow consumers
Budgets reserved before dispatch and settled after Keep Reservation is platform mechanism; prices and limits are plugin policy
Cancellation as several facts, never rollback Keep Matches what providers can actually confirm
Child tasks own reserved budgets and attenuated capabilities; explicit detach Keep The spine of cheap, safe fan-out
MCP, A2A and provider adapters Move to plugin Already framed as adapters; ship one excellent provider first
Fake adapters and crash-point tests Keep Run them in CI from the first agent commit

Security and authority

Nothing here should change; one piece is missing.

Decision Verdict Why
Capabilities passed and attenuated, no ambient authority Keep This is what makes agent-written plugins safe to import
Model output as a proposal; authorization at dispatch; text cannot mint grants Keep Prompt injection cannot become authority
Secret references and scoped network grants Keep Secrets never enter model context
Validation, authentication, authorization and acceptance kept apart Keep For coding, builds and protected tests issue the acceptance receipts
Subprocess authority Add Capabilities end at exec; give the Process capability an OS sandbox profile
Trusted tier with human review for native code Keep Native code can void every guarantee above

Authoring, tooling and context

The goals are right; edit operations and prompt caching need adjusting.

Decision Verdict Why
Compiler-owned canonical formatting Keep One form in every diff
Readable source, no token-golfed syntax Keep Add the syntax decisions from the section above
Semantic edits by identity, small edit surface Change Text edits and replace-by-name first; rename and imports as compiler tools
Revision preconditions on edits Keep Essential once many agents edit one repository
Type-check the whole edited candidate Keep Structural validity proves little
Context by dependency relevance, progressive disclosure, deltas, reversible IDs Keep Cuts tokens without losing meaning
Cached prompt prefixes Change Order context from stable to volatile and serialize tools canonically; providers cache only an exact prefix
Tokens per accepted task, acceptance rate, separate benchmarks Keep Add first-compile rate with only the spec in context
1,500-token plugin docs; measure 0, 3 and 10 plugins Keep Add the one-line discovery index

Measurement

The measurement habit is the list's best trait; extend it to agents.

Decision Verdict Why
Python baselines with byte-identical outputs and peak memory Keep Honest, reproducible numbers
Go and Rust comparisons Keep Run them before more optimizer work: the within-2×-of-Go target is unmeasured
Bytes copied, allocation lifetimes, replay cost, stream high-water Keep Profiles should choose representations
Expectations by workload class Keep One headline number would mislead
Agent-density benchmarks Add Idle agents per GiB, fork latency, sibling cache-hit rate, tool processes per agent

Scope and sequencing

Decision Verdict Why
Smallest initial release built around the agent runtime Change Kernel plus cli first; agent second, from public extension points only
Performance architecture explicit from day one Change Only what shapes the IR: arenas, destinations, blobs, compact layouts; relative refs and persistent arenas wait
No blocking on every provider, MCP or A2A Keep One excellent adapter proves the design

Designing for many cheap agents

Run agents as values inside one runtime, not as processes, and the per-agent floor drops from megabytes to kilobytes. What remains is context and tools, and both can be shared.

Where the cost goes today

Claude Code 2.1.12 ran each Task-tool subagent as its own claude --resume process. A bug report counted about 400 MB per subagent and 560 MB for the parent, plus MCP servers in Node, Bun and Python as further child processes. The report is about orphaned processes, but those sizes are what process-per-agent costs while it runs.

An agent held as a value needs about 4 KiB; an idle Node process, 43 MiB

Each process row is one idle runtime before any app code loads; the agent row is a 256-byte record plus a 4 KiB scratch arena. Measured for this review on Linux with 2 vCPUs, 20 idle copies per runtime; the Claude Code figure is from issue #19045.

An idle Node process is about a tenth of a working subagent, so most of the 400 MB is the app copied into every process: loaded code, transcript and caches. OpenAI cited lower memory without a garbage collector when it moved Codex CLI from Node to Rust. A leaner process helps, but one shared runtime removes the duplication itself.

Agents as values, not processes

Context is the real memory and money

A 100,000-token transcript is roughly 400 KB of text, about 100 times an agent's value, and it costs far more again as input tokens. Store each message once in a content-addressed blob store and make a context a list of references, so forks share bytes.

Anthropic's prompt cache matches a request in order: tools, then system, then messages. A change at one level invalidates that level and everything after it. Cache reads bill at 0.1× the base input price, or 0.05× on Opus and Sonnet 5.5 and 0.025× on Fable and Mythos 5.1, and entries live five minutes, refreshed on each hit.

Shared tools and workspaces

Once agents are cheap, tools dominate local CPU and memory: compilers, test runners and language servers.

Targets for the runtime

These are proposed targets; each belongs in the agent-density benchmark.

Metric Target
Idle agent, excluding its unique context 16 KiB or less, so 50,000+ per GiB
Spawning or forking an agent 50 µs or less
Language servers and MCP servers One per repository or runtime, never one per agent
Sibling shared-prefix tokens served from cache 90% or more

Worked example: a Harness² coding harness built from plugins

Harness² is a natural first app for Tenon: its loop is fan-out over forked agents, and the thing it edits, the harness, is a set of plugins.

What Harness² does

Harness², submitted 9 October 2026, keeps model weights fixed and improves the harness around them. Its reference code names eight editable components: system prompt, guardrails, memory, tool guidance, subagents, skills, scripts and plugins.

The reference implementation is Python driving OpenCode or Codex as executors. Its docs note that executor network access is unrestricted and that Codex runs with its sandbox disabled.

The same loop in Tenon

One Harness² step forks every probe from one snapshot

Every probe starts from the same snapshot, so a fork costs a record, a worktree and the unique part of its context.

Gaps the decision set does not cover yet

Nine things a CLI and agent language needs are missing; the first two block the CLI MVP.

Gap Why it matters Proposal
Strings, bytes and paths Unix paths are bytes, Windows paths are UTF-16, and many CLI bugs live in between str is validated UTF-8, bytes is raw, path is platform-native with lossy display
Subprocesses and pipes Every CLI and every coding agent spawns processes A Process capability with typed args, streamed stdio and an OS sandbox profile
Data parallelism Fast CLIs search and walk files on every core par_map and par_fold over chunks with per-worker arenas, results in input order so output stays deterministic
FFI zlib, SQLite and TLS already exist in C extern fn in the trusted tier, as Goose has; the C backend makes calls nearly free
Build speed Agents rebuild after every edit, and whole-program C grows with the program Per-module dev builds, content-hashed caches, an in-process C compiler for quick runs
Debugging and profiling gdb, lldb and perf see the emitted C, not Tenon Emit #line directives so tools map back to Tenon source
Distribution Single static binaries are much of Go's appeal for CLIs Static musl builds and cross-compilation through a bundled toolchain such as zig cc
Testing Acceptance receipts need fast, trusted checks Built-in golden-output and property tests; determinism keeps snapshots stable
Package registry Agent-published plugins invite typo-squats and spam Namespaces, signed releases, provenance, and editions as the curated path

Revised doctrine and build order

Keep the one-line doctrine and add a clause for plugins; then build in four stages, each closed by a measurement.

Keep semantics simple enough to prove, representation flexible enough to optimize, effects explicit enough to recover, authority separate enough that valid output is never permission, and the kernel small enough that every feature is a plugin a model can read.

  1. Kernel and cli platform. Grammar, types, interfaces, capabilities, typed IR, the C backend, the std edition and scoped arenas. Gate: the transfer benchmark and the Python, Go and Rust suite.
  2. Plugin machinery on real plugins. Generators with file output, static plugins, the lockfile, per-item interface versions and the discovery index. Gate: three outside plugins per extension point before it freezes, as the list already requires.
  3. The agent platform, from public extension points only. Actions and events, one provider adapter, budgets, attenuated child capabilities, a file journal and fake adapters. Gate: the agent-density targets and the crash-point tests.
  4. The Harness² coding harness. Forked probes, copy-on-write worktrees, cache-aware context, typed manifest merges and a lesson library. Gate: match the reference implementation's gain on one benchmark domain with fewer tokens and less memory per probe.

Self-hosting, LLVM, A2A, persistent arenas and packed unions wait until a stage's measurements ask for them.

Sources