Commands

A3S Code is primarily SDK-driven. Product CLIs and UIs usually map commands to session APIs rather than depending on a large public command protocol.

This page describes the session command registry. For the commands that the 9.0.0 terminal client handles itself, see A3S Code TUI.

The surfaces are intentionally different:

SurfaceOwnerPurpose
Built-in session commandsRuntime/help, /compact, /cost, /model, /clear, /history, /tools, and /mcp, available in every session through session.send.
Host command registryHost applicationProduct-defined commands registered with session.registerCommand(...) and invoked through session.send("/name args").
a3s-code-tui commandsTerminal client/help, /model, /clear, /exit, and /quit, handled by the TUI when the line is a single token; other lines go to the session.

SDK commands execute before the LLM sees the input. A handler receives the raw argument string plus session metadata, and returns display text. Use commands for thin control-plane actions; use normal SDK methods for workflows, tools, verification, and persistence.

User actionSession API
Send a promptsession.send(prompt)
Stream a promptsession.stream(prompt)
Redirect the active runsession.steer(text)
Stop the active runsession.interrupt()
Answer a pending confirmationsession.confirmToolUse(toolId, approved)
Ask a side questionCreate a separate session; explicit history on the same session is still recorded in its fact log.
Run a deterministic toolsession.tool(name, args)
Read historysession.history()
Save statesession.save()
Resume stateagent.resumeSession(id, options)
Inspect toolssession.toolNames() / session.toolDefinitions()
Verify worksession.verifyCommands(subject, commands)
Replay run statesession.runs() / session.runEvents(runId)
Inspect or cancel the current runsession.currentRun() / session.cancelRun(runId)

Building Slash Commands

If your app exposes slash commands, keep them thin. Register the handler, list the available commands, and invoke the command through session.send():

TypeScript
session.registerCommand(
'docs_status',
'Return docs command status',
(args, ctx) => {
return `status args=${args}; session=${ctx.sessionId}; workspace=${ctx.workspace}`;
},
);
console.log(session.listCommands());
const result = await session.send('/docs_status check');
console.log(result.text);

Command handlers should not hide long-running work. If a command needs to run tools, verify output, fan out to subagents, or schedule recurring automation, have the handler return a short acknowledgement and run that work through explicit host code. That keeps cancellation, audit, and permissions visible.