ADR-0024: Complete the slash-command surface — introspection, session control, per-thread overrides
- **Status:** Accepted - **Date:** 2026-09-01 - **Related:** #57 (this), #55 (ADR-0023 router shape), #56 (learning-loop lifecycle)
6 min read
This is a migrated reference document from the original Anvio source repo. Content is preserved as-is; canonical documentation lives in the sections above in the sidebar.
Original path: docs/adr/0024-complete-slash-command-surface.md
- Status: Accepted
- Date: 2026-09-01
- Related: #57 (this), #55 (ADR-0023 router shape), #56 (learning-loop lifecycle)
Context
ADR-0023 defined the SlashCommandRegistry port and v2.1.0–v2.1.2 filled in half the workspace nouns (/agents, /skills, /souls, /goals, /mcp, /sessions, /channels, /automations, plus the learning-loop lifecycle). Issue #57 enumerates the rest: the remaining introspection commands, session control (/status, /stop, /history, /checkpoint, /detach), per-thread runtime/provider/model overrides, and a uniform mutation surface (/new, /edit, /rm).
The most-requested piece is per-thread overrides: the model provider and runtime are fixed in spec.model / spec.runtime.provider per agent, so switching either for a single conversation means editing a YAML file. That is the flow this ADR makes safe from chat.
Decision
Three moves land together in v2.2.0:
session.metadatagains three overrides:providerOverride,modelOverride,runtimeOverride.RuntimeRoutingAgentRuntimeandModelRouterread the session-level values first and fall back to the agent'sspec.model/spec.runtime.provider. No schema change to agents — the override is per-session, not per-agent, so an override in thread A never leaks into thread B.- All remaining pure-read introspection commands register through
SlashCommandRegistry.register(). Ships in v2.2.0. - Session-control commands that only touch session state (
/status,/history,/stop,/detach,/checkpoint) ship./resumeand/branchare deferred — they need session-fork primitives (parent_session_idchain, resume-from-checkpoint mechanics) that ADR-0025 will design.
Deferred (ADR-0025)
- Uniform
/new,/edit,/rmmutation surface. The/editflow described in #57 (post current YAML, next message is an edit prompt scoped to a specialist agent, diff against the file) is a real UX design, not just a command handler. It reuses v2.1.1's diff-mode/promoteshape, but needs an approver gate for every mutation and a_trash/restore path. Big enough to warrant its own ADR. /resume,/branchsession forking.parent_session_idchain design./batch,/worktree,/connections,/setup-token. Each needs a chat-native UX (QR + polling for setup-token, streaming status for batch) that's out of scope for a router expansion./providers add|remove|test. Same mutation-surface argument.
Command surface (v2.2.0)
Introspection (read-only):
| Command | Backing |
|---|---|
/personas, /persona <slug> | PersonaService |
/workflows, /workflow <slug> | WorkflowRegistry |
/blueprints, /blueprint <slug> | BlueprintCatalogRegistry |
/kanban | KanbanEngine.listBoards() |
/tools [--enabled|--all] | ToolGateway.listTools() + MCP catalog |
/hooks | workspace/hooks/hooks.yaml |
/providers | workspace/providers/routing.yaml + session override marker |
/harness | harness.defaults + effective profile for this thread |
/audit [--last 24h|1000] | workspace/audit/tokens.jsonl tail |
/artifacts [--session <id>|--global] | FilesystemArtifactStore.list() |
/knowledge, /knowledge <slug> | KnowledgeBaseStore |
/skill <slug> | pair with existing /skills — frontmatter + first 2KB |
/session <id> | pair with existing /sessions — full status + last N turns |
/memory <query> | filesystem memory + FTS5 (workspace-scoped) |
Session control:
| Command | Effect |
|---|---|
/status | active agent, phase, tokens used, pending approvals, override state |
/history [n] | last N turns of this session |
/stop | publish AGENT_RUN_STOP_REQUESTED for the active run |
/detach | flip session.detached = true |
/checkpoint [label] | persist agentRunCheckpoint with an optional label |
Per-thread overrides (the point of this ADR):
| Command | Writes | Read by |
|---|---|---|
/provider <slug> | session.metadata.providerOverride | ModelRouter.resolveForSession() |
/model <id> | session.metadata.modelOverride | same |
/runtime <slug> | session.metadata.runtimeOverride | RuntimeRoutingAgentRuntime.resolve() |
/routing | (read) | dumps effective \{provider, model, runtime\} for the current session, agent's config × overrides |
Debug / feedback:
| Command | Effect |
|---|---|
/version | Anvio version, workspace name, git rev, node version |
/settings | effective config for this session (runtime, model, harness, evolution) |
/thumbsup, /thumbsdown [reason] | write to workspace/memory/feedback/<sessionId>.jsonl, tagged by turn |
Wiring
packages/core/src/types/session.ts— extendStoredSession.metadatatyping to advertise the three override fields as first-class (they wereRecord<string, unknown>all along; the fields are now documented and typed forRuntimeRoutingAgentRuntime+ModelRouterto pick up).packages/platform/src/runtime-routing-agent-runtime.ts— before consultingagent.spec.runtime.provider, checksession.metadata.runtimeOverrideand route the whole factory chain through it. Unknown override → clear error routed back to the user, not a silent fallback.packages/models/src/model-router.ts—resolveForSession(session, agent)returns the effective\{provider, model\}after applying overrides, and is what the local runtime calls.packages/platform/src/slash-commands-extras.tsgrows: every command above registers through the same file. Handlers that need late deps (workflow executor, blueprint catalog, kanban) receive them viaExtrasOptions.- Adapters (Telegram, Discord/Slack when their pickers come online) resync their client-side menu after the extras have registered — for Telegram,
setMyCommandsis idempotent, so calling it again with the fuller list is fine.
What we deliberately do NOT do
- No new agent schema fields. Overrides live on the session so the operator can experiment with a model without editing the file the whole team reads.
- No leak across sessions. Override in session A is invisible to session B; the merge happens inside
resolveForSession, not by mutating the loadedAgentDefinition. - No "always allow" for mutation. Every
/new//edit//rmwill require an inline approver in the eventual mutation ADR (0025). Skipping mutation from v2.2.0 rather than shipping it approver-less.
Consequences
-
Positive:
- Per-thread
/provider//model//runtimeis the difference between "edit a YAML file, restart the gateway, re-DM the bot" and "type one message." The wiring already exists inModelRouter; this makes it reachable. - The picker on every chat channel shows every read-only workspace noun. The user comparing against Hermes/openclaw sees Anvio at least at parity for discovery.
SlashCommandRegistry.register()from v2.1.2 is now exercised at scale — every extras command uses it, no factory-side sprawl.
- Per-thread
-
Costs:
slash-commands-extras.tsbecomes big (~15 handlers). If it exceeds ~500 LOC, split intoslash-commands-extras/*.tsby category (introspection.ts,session.ts,overrides.ts,debug.ts) — a mechanical follow-up.session.metadatagains three well-known fields; a stale session written before this ADR hasundefinedfor all three, which the runtime treats as "no override" (the intended default).
Alternatives considered
- Per-agent override fields in
spec.runtime/spec.model. Rejected — the whole point is thread-local experimentation. An agent-level field would need to be written back to the file and re-loaded, which is exactly the workflow this ADR removes. - Ship mutation in v2.2.0. Rejected — the approver flow +
/edit's specialist-agent-scoped rewrite needs its own design. See ADR-0025 (to be written). /resumeand/branchin v2.2.0. Rejected — session forking needs aparent_session_idchain that today doesn't exist. Design belongs in ADR-0025 alongside mutation.
Last updated on
ADR-0023: Workspace-scoped slash commands, cross-channel
- **Status:** Accepted - **Date:** 2026-08-31 - **Related:** #53 (Telegram `setMyCommands` gap), #55 (this — cross-channel router), #56 (skill promotion surface), ADR-0008 (Channel Hub)
ADR-0025: Mutation surface (`/new`, `/edit`, `/rm`), session forking, batch/worktree/connections/setup-token
- **Status:** Accepted — v2.3.0 tracks 1 + 2 shipped: session forking (`/branch`, `/resume`, `/history --branch`), the `_trash/` foundation (`anvio trash list|rm|restore|prune`), the uniform mutation