small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo docs extensions.md

# Add an extension Use this guide to add capabilities through an extension. Read the [extension reference](../robot-docs/extensions.md), [plugin contracts](../robot-docs/plugins.md), and [shared contribution rules](../robot-docs/contributing.md) before choosing an owner. ## Choose the contributions Declare the extension's name, description, requirements, plugins, and initializer with [`extension.Extension`](../src/albedo/harness/extension.gleam). Keep declarations free of I/O and environment capture. A sealed build caches them. Choose plugin types from the current `Plugin` definition instead of copying an old inventory. Use `ToolPlugin` for static instructions, tools, Python modules, and host routes. Use `ManagedPlugin` when a contribution must be prepared before use. Use `OwnedManagedPlugin` when allocated resources must survive preparation handoff safely. If a route needs only the values on `host.Context`, keep the route in `ToolPlugin` and do not add a managed contribution that only returns routes. Keep schema, data migrations, deletion cleanup, and transfer behavior with the extension that owns the data. See [migrations](../robot-docs/migrations.md) and [extension lifecycle rules](../robot-docs/contributing.md#preserve-extension-lifecycle-boundaries). ## Connect host routes Use [`host.Route`](../src/albedo/harness/host.gleam) for Python-to-host calls. A route receives `host.Context`, a method string, and dynamically typed arguments. It returns JSON or an error pair. The context supplies the store, the session ID, the loaded workspace, and the providers from the active composition. Declare routes that need only context values in `ToolPlugin`. Follow the [work route](../src/albedo/harness/extensions/work/extension.gleam), which passes `context.store` and `context.workspace` to its handler. [Paperclips](../src/albedo/harness/extensions/paperclips/extension.gleam) also passes `context.session`. Use this loaded workspace instead of querying session settings or reading the process working directory. See the…