# Extensions An extension is a named bundle of plugins. The registry in [extensions.gleam](../src/albedo/harness/extensions.gleam) declares installed extensions and defaults. The [extension types](../src/albedo/harness/extension.gleam) define their contributions. See [plugins](plugins.md) 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](../src/albedo/harness/extension/selection.gleam). ## Session composition [`composition.compose`](../src/albedo/harness/extension/composition.gleam) 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](../src/albedo/harness/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](runtime.md#extension-reload-ownership) for rejection, worker death, and late-result cleanup. ## Extension settings `SettingsPlugin` registers an extension's settings declaration. [`settings/declared.gleam`](../src/albedo/harness/settings/declared.gleam) collects declarations and validates declared values. The daemon exposes them through its settings resources. See [persisted settings](settings.md) for conditional updates and recovery, and [plugins](plugins.md) 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](../src/albedo/harness/extension.gleam). Extensions can expose Python bindings, such as [MCP](mcp.md), [skills](skills.md), and [image generation](imagegen.md). 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](../tools/lint/src/albedo_lint/rules/table_ownership.gleam) checks that boundary. Use migration and cleanup plugins for extension-owned storage. Follow the [extension change rules](contributing.md#preserve-extension-lifecycle-boundaries) when changing selection, discovery, or resource lifetime. ## Related pages - [All topics](README.md) - [Change guidance](contributing.md) - [Plugins](plugins.md) - [Persisted settings](settings.md)