ADR-0304:
One Action Catalog, Six Surfaces
(derive AppSurface)
- Status: Accepted (Wave 3, Rank 1, Idea #18)
- Date: 2026-11-28
- Depends on: ADR-0291 (Freeze Rust, Grow in
Tenon), ADR-0293 (
app_actions_gen), ADR-0295 (Implicit Cached Derive Materialization), ADR-0300 (app.actions/v1.2)
Context
Tenon applications routinely need to expose the same domain actions across multiple user and agent surfaces:
- A human-ergonomic CLI (subcommands, positional args, short
flags,
--help, shell completions, TTY-adaptive tables). - A direct automation CLI (
state,actions,actwith--expected-rev,--approval-token,--dry-run). - A dual-era MCP server (
2026-07-28+2025-11-25) supporting both the flat-token 3+1 surface (app_state,app_actions,app_act,app_wait) and--mcp-directper-action tool export. - An interactive TUI Command Palette (
Ctrl-Pfuzzy search viatui_complete, inline argument prompt specs, andCtrl-KCo-Pilot compact catalog). - A loopback HTTP/JSON & SSE control plane
(
GET /state,GET /actions,POST /act,GET /eventsdelta frames). - A compile-time type-checked Tenon client for inter-app orchestration and unit tests.
Previously, wiring all six surfaces required duplicating action metadata, CLI flags, schemas, palette entries, HTTP routes, and typed builders by hand.
Decision
Introduce a pure (capabilities = [])
GEN_ABI 2 generator and runtime adapter plugin
plugins/app_surface/:
derive AppSurface(app_surface.lib):- Consumes a single annotated Action catalog
structsupporting@prefix,@name,@doc/@action_doc,@risk,@approval,@key,@positional,@short,@min,@max, and@choices. - Emits
<Catalog>Cmd,<catalog>_specs(),<catalog>_decode(name, args_json),<catalog>_compact_catalog(),<catalog>_surface_catalog(), per-action typed client builders (<catalog>_call_<action>(...) -> ActionCall), and<catalog>_client_encode(cmd) -> ActionCall. - Fails closed (
E0966) on unsupported field types, invalid or duplicate@shortflags, duplicate action names or CLI subcommands, invalid@risk, inverted bounds, empty@choices, or schemas rejected bymcp.wire.schema_supported.
- Consumes a single annotated Action catalog
- Six Pure Runtime Adapters
(
capabilities = []):app_surface.cli: Human CLI + Direct Actions CLI (dispatch_cli,render_help,render_subcommand_help,emit_completionsforbash/zsh/fish,cli_ui-compatibleformat_actions_tableandformat_kv_output).app_surface.mcp_surface: Dual-era MCP server (SurfaceMcpMode.Flatdelegating toapp_actions_mcp.bridge, andSurfaceMcpMode.Directexporting per-action tools viamcp_server.lib).app_surface.tui_palette:Ctrl-Ptui_complete.palette.Palettebuilder, fuzzy filter (filter_palette), inlinearg_prompt_spec, andCtrl-Kcopilot_catalog.app_surface.http_router:web.route+web.api-compatible pure loopback router forGET /state,GET /actions,POST /act, andGET /events(SSEstate_deltaframes), rejecting non-loopbackHost/Originheaders with403.app_surface.client: Typed Tenon client (ActionClient<A>,client_call,client_dry_run,call_typed) executing generated compile-time checkedActionCallbuilders throughActionSession<A>.
Consequences
- Zero Rust changes: 100% pure
.tn(capabilities = []), obeying ADR-0291 and preserving dual-backend parity across native C (tenon test) andtenon interp. - Single source of truth: A
<= 30-line annotated Action catalog drives all six surfaces with zero hand-written glue, while preservingActionSessionpolicy, approval, optimistic-concurrency (expected_rev), and redaction guarantees across every surface. - Backward compatibility:
app_actions_gen,app_actions_client,app_actions_mcp, andargs_mcpremain intact and unchanged for existing callers.