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
| Command | Description |
|---|---|
/help | List available commands |
/compact | Manually trigger context compaction |
/cost | Show token usage and estimated cost |
/model | Show or switch the current model |
/clear | Clear conversation history |
/history | Show conversation turn count and token stats |
/tools | List registered tools |
/mcp | List 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§
- Command
Context - Context passed to every slash command execution.
- Command
Output - Result of a slash command execution.
- Command
Registry - Registry of slash commands.
Enums§
- Command
Action - Post-command actions that the session should perform.
Traits§
- Slash
Command - Trait for implementing slash commands.