Slash command management for the BeamAgent SDK.
This module provides global slash command registration -- listing, registering, unregistering, and querying slash commands that are shared across all sessions. Mutations notify the reload bus so live sessions react without restart.
When to use directly vs through BeamAgent
Most callers interact with slash commands through BeamAgent. Use this module
directly when you need focused access to slash command operations -- for example,
in a command palette UI, a command management dashboard, or a configuration
tool that bulk-enables/disables commands.
Quick example
# Register a slash command:
:ok = BeamAgent.SlashCommands.register("review", %{
name: "/review",
description: "Review code in the current file",
handler: :review_handler,
enabled: true
})
# List all commands:
commands = BeamAgent.SlashCommands.list()
for c <- commands, do: IO.puts(c.name)
# Unregister:
:ok = BeamAgent.SlashCommands.unregister("review")Architecture deep dive
This module is a thin Elixir facade that delegates every call to the
:beam_agent_catalog Erlang module's global registry functions. Zero
business logic, zero state, zero processes live here -- the Erlang module
owns the implementation. The underlying command data is stored in the
unified ETS table managed by :beam_agent_registry.
See also: BeamAgent, BeamAgent.Catalog, BeamAgent.Skills.
Summary
Types
A slash command definition stored in the global registry.
Functions
Remove all registered slash commands.
Create the global registry ETS table. Idempotent.
Fetch a single slash command by id.
List all registered slash commands.
Register a slash command globally (shared across all sessions).
Unregister a slash command by id. Idempotent.
Types
@type command_def() :: %{ :id => binary(), :name => binary(), :kind => :agent | :plugin | :slash, :enabled => boolean(), optional(:description) => binary(), optional(:handler) => (map() -> {:ok, map()} | {:error, term()}), optional(:config) => map() }
A slash command definition stored in the global registry.
Functions
@spec clear() :: :ok
Remove all registered slash commands.
@spec ensure_table() :: :ok
Create the global registry ETS table. Idempotent.
@spec get(binary()) :: {:ok, command_def()} | {:error, :not_found}
Fetch a single slash command by id.
@spec list() :: [command_def()]
List all registered slash commands.
Register a slash command globally (shared across all sessions).
Parameters
id-- unique binary identifier for the command.opts-- map of command options (:name,:description,:handler,:enabled,:config).
@spec unregister(binary()) :: :ok
Unregister a slash command by id. Idempotent.