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

Extensions #

An extension is a named bundle of plugins. The registry in extensions.gleam declares installed extensions and defaults. The extension types define their contributions. See plugins for the host contracts.

Installed and enabled #

Installation makes an extension known to the daemon. Session selection combines global defaults with stored session overrides. selection.select preserves registry order and handles exclusive compaction strategies. selection.validate_selection checks requirements before the selection is used. A quarantined extension appears in summaries with its reason and no capabilities. See selection.gleam.

Session composition #

composition.compose loads static contributions and prepares managed contributions for each selected extension. A failed load, failed preparation, module clash, or duplicate tool, command, or route leaves that extension inactive and adds a warning. Dependents whose requirements are inactive are removed as well.

A composition is immutable. A refresh prepares a replacement, and the host closes the composition that loses. Managed resources close in reverse preparation order. Adoption failure closes the candidate. Owned callbacks return an optional opaque Owned value with explicitly attached adoption and close callbacks. None contributes nothing. The ownership contract is defined by PreparationOwner and OwnedManagedPlugin in extension.gleam.

During reload, application workers borrow the adopted candidate and previous session. The runtime settles their results and closes the losing resources. See reload ownership for rejection, worker death, and late-result cleanup.

Extension settings #

SettingsPlugin registers an extension's settings declaration. settings/declared.gleam collects declarations and validates declared values. The daemon exposes them through its settings resources. See persisted settings for conditional updates and recovery, and plugins for contribution types.

Boundaries to preserve #

extension.invoke catches a tool crash and returns a refusal that says its effects are unknown. A Fatal failure ends the turn when the host could not record what a call did. Inspect effects before retrying an interrupted or crashed operation. Tool output can contain text and images. Consumers must use the provider's image limits. See extension.gleam.

Extensions can expose Python bindings, such as MCP, skills, and image generation. A binding is an interface to its host routes, not a separate permission grant.

An extension owns the tables it creates. Keep SQL that names those tables inside the owning extension and expose operations through its interfaces. The albedo_table_ownership lint rule checks that boundary. Use migration and cleanup plugins for extension-owned storage. Follow the extension change rules when changing selection, discovery, or resource lifetime.