0293.
Application Actions API v1.1 (app.actions/v1.1):
Compact Catalogs, Batching, Dry-Run, Undo &
derive Actions
- Status: Accepted (2026-11-27)
- Date: 2026-11-27
- Plan: Tenon Actions API v1.1, Live Co-Pilot Terminal Emulator
& Optional Local Action Model
(
plans/app-actions-copilot-and-model/README.md, Task C01; extends 0292; complements 0225, 0271, 0290, 0291)
Context
ADR-0292
established the pure-plugin app.actions/v1 control
plane (state_delta, app_actions_trace,
app_actions, app_actions_mcp,
app_actions_tui) and deferred ergonomics codegen and
specialized action-model work behind a Phase-3 Go/No-Go gate.
Measurements across three real applications
(examples/tui/todo, todo-actions, and
coding-harness-2) and the frozen 12-scenario
benchmark (bench/app-actions/RESULTS.md)
confirmed:
72.74%total wire-byte reduction (88.5%on 250-item lists) with100%apply_deltaround-trip accuracy and262combined MCP tool-schema tokens.50–60%of application action code was mechanical boilerplate: hand-escapedmcp.wireJSON Schema strings ({{/}}), manualmcp.wire.objectargument extraction, and repetitive dispatch branches.- Interactive human + AI co-piloting (and fast local
non-thinking Action Models targeting
< 150 msbatch translation) requires five capabilities absent fromv1: compact action catalogs for low-token prompts, zero-side-effectdry_rundelta previews for ADR-0225 approval overlays, transactional multi-step batching in one round-trip, built-in immutableundo/rollback_to_rev, and persisted-revsession initialization.
Decision
Extend app_actions and
app_actions_mcp (remaining strictly pure with
capabilities = [] and C/interp parity)
with app.actions/v1.1 additions while preserving
compatibility with existing app.actions/v1
callers:
Fluent Pure Schema Builder (
app_actions.schema) & Typed Argument Reader (app_actions.args):schema_obj()returns an immutableObjSchemabuilder (req_str,opt_str,req_i64,opt_i64,req_bool,opt_bool,req_enum,opt_enum,req_str_arr,opt_str_arr,to_json) guaranteed to emit"additionalProperties": falseand passmcp.wire.schema_supported(..., 0).parse_args(args_json)returns a typedArgsViewwrapper aroundmcp.wire.objectwithreq_str,opt_str,req_i64,opt_i64,req_bool,opt_bool,req_str_list, andopt_str_list.
Compact Action Naming & Catalog Grammar (
app_actions(format="compact")):- Recommend short 1–2 token dot-namespaced action names
(
<ns>.<verb>, e.g.,t.new,t.split,t.run,td.add) and concise arg keys (id,dir,cmd,txt,q). - Add
app_actions.contract.format_compact_catalog(specs, include_disabled) -> stremitting one deterministic line per action:name(arg1:str,arg2?:low|normal|high) [R|W|D|D!] — short descwith[OFF: reason]appended for disabled actions wheninclude_disabled == true. app_actions_mcpaccepts optional"format": "full" | "compact"(default"full").
- Recommend short 1–2 token dot-namespaced action names
(
Pure Immutability Superpowers in
ActionSession<A>(app_actions.session):- Persisted revision start:
new_session_at(app, initial_rev, cfg)starts a session at anyinitial_rev >= 1(clamping values< 1to1) so restarts preserve monotonicstate_rev. - Pure
dry_runpreview:execute_dry_run(s, call, presented_approval_id)validatesexpected_rev, action existence/enablement,mcp.wirearguments, andharness_policy(PolicyDeniedfails closed), then runs pureapp.apply, secret redaction, andstate_delta.choose_wire_updatewithout mutatings.app,s.rev, history, or metrics. For approval-gated actions (requires_approvalorEffect.Ask),execute_dry_runcomputes the redacted delta preview withrequires_approval: trueso ADR-0225 approval dialogs can render exact diffs before human confirmation. - Immutable undo ring & monotonic rollback:
ActionSession<A>retains a bounded ringrev_apps: vec<RevApp<A>>(capped atmin(history_cap, 32)).undo(s)androllback_to_rev(s, target_rev)restore the exact prior immutable app valueA, compute the transitionWireUpdate, and increments.revmonotonically (never reusing prior revision numbers). - Transactional
execute_batch: Executes1..=16calls sequentially against evolving immutablecur_app, checkingexpected_revonce up front and failing closed on empty or> 16-step batches. Returns a single coalescedWireUpdatefrom pre-batch to post-batch state and advancess.revby1on commit:- On
ApprovalRequired: returnsBatchStatus.PausedForApproval(completed_count, pending_index, err)— committing prior safe steps whenatomic == false(with a coalesced delta and updatedcurrent_rev), or rolling back cleanly whenatomic == true. - On
UnknownAction,DisabledAction,InvalidArgs,PolicyDenied, orExecutionFailed: rolls back cleanly (revandappunchanged,rolled_back: true) whenatomic == true, or commits earlier completed steps whenatomic == false, returningBatchStatus.Failed(completed_count, failed_index, err).
- On
- Persisted revision start:
Flat-Token 3-Tool MCP Extension (
app_actions_mcp):- Retain the exact 3-tool surface (
app_state,app_actions,app_act) and strict<= 900combined schema token budget. - Extend
app_actionswith optionalformat("full" | "compact"). - Extend
app_actwith optionaldry_run: boolean,batch: [{ name, args? }, ...], andatomic: boolean(defaulttrue), while preserving single-callname+args. Dry-run calls never mutate session state or emit executable hostActionEffects (McpServeReply.effects = [],state_changed = false).
- Retain the exact 3-tool surface (
derive ActionsGenerator Boundary (Task C02):- Authorize a
GEN_ABI 2generator plugin (plugins/app_actions_gen) to generatemcp.wire-validatedinput_schema_json, typed decoders, baseActionSpecs, and compact catalogs from a single annotated enum. - Preserve ADR-0292
D1 and D4 by keeping curated
project_stateprojections/windows and live state-dependentenabled/disabled_reasonpredicates as explicit pure.tnfunctions rather than raw struct reflection.
- Authorize a
Alternatives Considered
- Breaking
ActionCallstruct layout by addingdry_run: booldirectly: Rejected for Wave 1 because it forces simultaneous edits to downstream callers (plugins/app_actions_tui,examples/tui/todo) across disjoint task boundaries. Exposingexecute_dry_runalongsideexecute(anddry_run: truein MCPapp_act) gives full functionality with zero caller breakage. - Reusing old
revnumbers onundo/rollback_to_rev: Rejected because non-monotonic revisions break optimistic concurrency (expected_rev) andstate_sincecatch-up semantics for concurrent agents. - Adding separate MCP tools (
app_batch,app_dry_run,app_undo): Rejected to keep the 3-tool flat-token MCP contract (<= 900schema tokens) intact.
Consequences
- Application authors can construct fail-closed schemas and
parse typed args without manual JSON escaping, and Task C02
(
derive Actions) can target the same pureapp_actionscontracts. - Co-pilot hosts and local Action Models gain single-round-trip
batched execution, exact redacted
dry_runapproval previews, compact low-token action catalogs, persistedrevrecovery, and instant immutable undo — all withcapabilities = []and identical C/tenon interpbehavior. - Existing
app.actions/v1callers (plugins/app_actions_tui,examples/tui/todo,bench/app-actions/) continue to compile and pass without modification.