Skip to main content

Module commands

Module commands 

Source
Expand description

Slash Commands — Interactive session commands

Provides a /command system for interactive sessions. Commands are dispatched before the LLM — if input starts with /, it’s handled by the command registry instead of being sent to the model.

§Built-in Commands

CommandDescription
/helpList available commands
/compactManually trigger context compaction
/costShow token usage and estimated cost
/modelShow or switch the current model
/clearClear conversation history
/historyShow conversation turn count and token stats
/toolsList registered tools
/mcpList connected MCP servers and their tools

§Custom Commands

use a3s_code_core::commands::{SlashCommand, CommandContext, CommandOutput};

struct MyCommand;

impl SlashCommand for MyCommand {
    fn name(&self) -> &str { "greet" }
    fn description(&self) -> &str { "Say hello" }
    fn execute(&self, _args: &str, _ctx: &CommandContext) -> CommandOutput {
        CommandOutput::text("Hello from custom command!")
    }
}

Structs§

CommandContext
Context passed to every slash command execution.
CommandOutput
Result of a slash command execution.
CommandRegistry
Registry of slash commands.

Enums§

CommandAction
Post-command actions that the session should perform.

Traits§

SlashCommand
Trait for implementing slash commands.