On this page

0291. Freeze Rust CLI surface and grow userland tools in Tenon

Context

ADR-0176 retains Rust as the canonical 1.0 bootstrap compiler, and ADR-0290 embeds all first-party plugins in edition = "2026" so the tenon binary is self-contained offline.

Before the "Freeze Rust, Grow in Tenon" campaign, each bundled Tenon tool (agentd, procman, forge, vc_launch, and tenon mcp) had grown its own bespoke Rust launcher module, argument forwarding shim, and duplicated include_str! tables of plugins/* files, alongside Rust-hosted .tn test harnesses and legacy Rust bridges (host_store.rs, crate::vc readers in registry_render.rs). Continuing to add userland services, daemons, or CLI wrappers in Rust bloats crates/tenon/src/, drifts against the bundled edition = "2026" catalog, and undermines dogfooding Tenon for real tools.

Track 1 of the campaign collapsed the 5 bespoke Rust launchers (agentd, procman, mcp_cmd, forge, vc_launch) into a single generic launcher (crates/tenon/src/app_launcher.rs, BundledAppSpec) backed by crate::editions, extracted inline tenon-mcp sources into examples/tools/tenon-mcp/, and migrated 7 pure in-memory .tn test harnesses to native *_tests.tn suites — removing 3,088 net Rust LOC (+784 / −3,872). Track 2/3 retired the Rust tenon host-store bridge (crates/tenon/src/host_store.rs, −485 LOC), decoupled registry render --vc from crate::vc via tvc export, and established the cutover boundary for tvc (with final Rust crates/tenon/src/vc/* deletion governed by ADR-0265).

Decision

Freeze the Rust CLI surface of crates/tenon/ to compiler and toolchain primitives, and grow all userland tools in native Tenon:

  1. What stays in Rust (crates/tenon/src/):
    • Core compiler phases and backends: check, build, IR, regions, C codegen/driver, interp, and the compact ~1 surface codec (fmt, decoder/encoder).
    • Core compiler-backed developer primitives: doc, edit, fix, doctor, new, editions, and the generic bundled-app launcher (crates/tenon/src/app_launcher.rs).
  2. What grows in Tenon (.tn):
    • All new non-compiler daemons, services, harnesses, and standalone tools (agentd, procman, mcp, forge, tvc, and all future tools) MUST be authored in native .tn.
    • When exposed as a tenon <tool> subcommand, the tool MUST attach solely through crates/tenon/src/app_launcher.rs (BundledAppSpec) backed by crate::editions:
      • Embed only the app's own root files (main.tn, tenon.toml, and app-local modules).
      • Never add bespoke Rust CLI re-parsers or argument-validation wrappers; forward raw OsString arguments verbatim via app_launcher::subcommand_args.
      • Never duplicate include_str! tables for plugins/*; resolve transitive edition = "2026" plugin dependencies exclusively through crate::editions (enforced by app_launcher::tests::all_bundled_apps_resolve_edition_plugins_and_cache_cleanly).
      • Write unit tests for .tn tool logic in native *_tests.tn files (tenon test), not as new Rust test harnesses in crates/tenon/src/.
  3. Transition boundaries:
    • host_store.rs is retired; forge and tvc operate natively without a Rust host-store bridge.
    • Package and registry tooling (registry_render, etc.) consumes tvc through exported directories rather than crate::vc, preparing for tvc cutover and Rust vc/* deletion per ADR-0265.
    • M14-frozen files (crates/tenon/src/interp*, plugins/cli/**, plugins/agent*) remain governed by their existing freeze rules.

Alternatives considered

Consequences