# Commands A command declaration describes its slash name, arguments, caller permissions, and result. [`command.gleam`](../src/albedo/harness/command.gleam) owns the declaration, dispatch, catalog projection, and host routes. Clients also have presentation-only commands that are not daemon command declarations. ## The catalog The session command catalog describes prepared commands. [`command.catalog_json`](../src/albedo/harness/command.gleam) projects their metadata. The [CLI catalog client](../cli/internal/daemon/command_catalog.go) reads it. Resource commands identify their HTTP operation rather than exposing an endpoint for arbitrary slash-command execution. ## Contributing commands Extensions can declare commands through `CommandPlugin`, while managed extensions can supply dynamic commands. A command handler receives a `Context` and uses its typed `StateOp` interface to reach session state. See [`Command`, `Context`, and `StateOp`](../src/albedo/harness/command.gleam) and the [extension types](../src/albedo/harness/extension.gleam). Command handlers run outside the session actor. A handler already running inside that actor must not call a command whose state operation waits on the actor, because that would deadlock. Model calls cannot invoke a command declared user-only or submit a user turn. `user_turn` controls delivery for a user invocation. See [`command.call`](../src/albedo/harness/command.gleam). ## Python bindings At kernel boot, the [Python commands plugin](../priv/python/albedo_plugins/commands.py) creates an async method for each eligible model-callable command. Its signature and docstring come from the declaration. `commands.catalog()` reads the current catalog, and `commands.invoke(name, arguments)` invokes a model-callable command by name with text or a dictionary. Reserved, invalid, or later-added method names remain available through `invoke`. Model calls return data rather than submitting a turn. ## Client commands The [CLI command handling](../cli/internal/tui/commands.go) combines catalog entries with client presentation. Session settings changed by commands have the same persistence owners described in [settings](settings.md). Workspace-related operations are described in [workspaces](workspaces.md), and kernel operations in [kernel](kernel.md). Title inference and `/retitle` are described under [generated titles](sessions.md#generated-titles). ## Related pages - [All topics](README.md) - [Change guidance](contributing.md) - [Persisted settings](settings.md) - [Plugins](plugins.md)