0291. Freeze Rust CLI surface and grow userland tools in Tenon
- Status: Accepted (2026-11-26)
- Date: 2026-11-26
- Plan: Freeze Rust, Grow in Tenon (Tracks 1–3; complements 0176, 0265, 0290)
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:
- What stays in Rust
(
crates/tenon/src/):- Core compiler phases and backends:
check,build, IR, regions, C codegen/driver,interp, and the compact~1surface 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).
- Core compiler phases and backends:
- 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 throughcrates/tenon/src/app_launcher.rs(BundledAppSpec) backed bycrate::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
OsStringarguments verbatim viaapp_launcher::subcommand_args. - Never duplicate
include_str!tables forplugins/*; resolve transitiveedition = "2026"plugin dependencies exclusively throughcrate::editions(enforced byapp_launcher::tests::all_bundled_apps_resolve_edition_plugins_and_cache_cleanly). - Write unit tests for
.tntool logic in native*_tests.tnfiles (tenon test), not as new Rust test harnesses incrates/tenon/src/.
- Embed only the app's own root files (
- All new non-compiler daemons, services, harnesses, and
standalone tools (
- Transition boundaries:
host_store.rsis retired;forgeandtvcoperate natively without a Rust host-store bridge.- Package and registry tooling (
registry_render, etc.) consumestvcthrough exported directories rather thancrate::vc, preparing fortvccutover and Rustvc/*deletion per ADR-0265. - M14-frozen files (
crates/tenon/src/interp*,plugins/cli/**,plugins/agent*) remain governed by their existing freeze rules.
Alternatives considered
- Keep writing bundled tools and CLI wrappers in
Rust: Faster for one-off subcommands, but duplicates
edition = "2026"plugin bundling, grows Rust maintenance surface, and fails to dogfood Tenon's CLI/daemon/plugin stack. - Self-host the compiler now: Out of scope; ADR-0176 keeps Rust as the canonical 1.0 compiler.
- Allow per-tool Rust argument parsers in front of
app_launcher.rs: Splits CLI grammar and help/error behavior across Rust and Tenon; nativeplugins/argsin.tnkeeps each tool self-contained.
Consequences
- Adding a new bundled userland tool requires only a small
declarative
BundledAppSpecregistration and subcommand dispatch incrates/tenon/src/, with zero duplicated plugin embeds or Rust CLI parsing. crates/tenon/src/stops growing for userland features and shrinks as legacy Rust tools (host_store.rs, andvc/*at cutover) are retired.- Any missing runtime capability needed by a userland tool is addressed by a clean Tenon plugin (pure or trusted-tier FFI) rather than ad-hoc Rust code in the CLI binary.
- Enforced by
app_launcher.rsunit tests,AGENTS.mdlane rules, anddocs/extension-points.md.