Creating new builtin plugins

From golemcloud/golem · View interactive version

Creating new builtin plugins is an AI agent skill from the GitHub repository golemcloud/golem. Adds a built-in WASM plugin that is externally released and provisioned by the registry service. Use when creating a plugin that ships with Golem and is granted to every environment.

How to use this skill

Skill file

Creating a New Built-in Plugin

Use plugins/otlp-exporter/, builtin-artifacts.json, and the registry plugin provisioner as the source of truth. Built-in plugins are standalone Golem applications. Development uses local WASMs; tagged releases publish immutable assets in golemcloud/golem-builtins and generate a checksum-pinned release manifest.

Workflow

  1. Create plugins/<plugin>/ as a standalone workspace and Golem application. Follow the OTLP exporter layout and its scoped AGENTS.md.
  2. Select dependencies from current workspace/plugin manifests rather than copying old versions. For an oplog processor, use the current golem-rust path and export_oplog_processor feature plus the exact async wit-bindgen setup used by the OTLP exporter.
  3. Implement the current async SDK interface. The essential shape is:
use golem_rust::bindings::golem::api::oplog::{OplogEntry, OplogIndex};
use golem_rust::oplog_processor::exports::golem::api::oplog_processor::Guest as OplogProcessorGuest;
use golem_rust::schema::wit::wire::{AgentId, ComponentId};

impl OplogProcessorGuest for MyPluginComponent {
    async fn process(
        _account_info: golem_rust::oplog_processor::exports::golem::api::oplog_processor::AccountInfo,
        config: Vec<(String, String)>,
        component_id: ComponentId,
        worker_id: AgentId,
        metadata: golem_rust::oplog_processor::host::AgentMetadata,
        _first_entry_index: OplogIndex,
        entries: Vec<OplogEntry>,
    ) -> Result<(), String> {
        todo!()
    }
}

golem_rust::oplog_processor::export_oplog_processor!(MyPluginComponent with_types_in golem_rust::oplog_processor);
  1. Add a copy custom command to a component template's release preset and apply that template to the component. Template variables are rendered only in component templates, not directly in components. Write plugins/<plugin>.wasm from the final artifact selected by componentWasm. Use {{ cargoTarget }}/wasm32-wasip2/release/<crate_name>.wasm as the source so the command follows the resolved compiler Cargo target directory. Resolve the destination with {{ appRootDir }} and quote both paths. Follow the template custom command pattern in builtin-tools/bash/golem.yaml.
  2. Extend build-plugins in Makefile.toml. Keep it as duckscript, resolve the local binary through CARGO_MAKE_CRATE_TARGET_DIRECTORY, and pass --yes to every golem build invocation. Never hardcode target/ or use cargo metadata in the task.
  3. Run cargo make build-plugins. Confirm the generated destination exists, is non-empty, changed when expected, and validates with wasm-tools validate --features all plugins/<plugin>.wasm. Do not commit it.
  4. Add one BuiltinPluginDescriptor entry with component name, artifact ID, plugin name, version, and description. Add the component name, output path, build task, and transitive source inputs under that artifact ID in builtin-artifacts.json.
  5. Run cargo make ensure-builtin-artifacts and verify local provisioning. Publication happens during tagged release preparation, not before merging development changes.

Do not add per-plugin fields, bytes, or paths to BuiltinPluginsConfig; it only selects Enabled or Disabled. Do not add include_bytes! or commit generated WASMs. Bootstrap calls the descriptor-driven provisioner once through the shared artifact cache.

Provisioning and Grants

The shared provisioner creates or finds the built-in owner's golem-system application and builtin-plugins environment, uploads or hash-updates every descriptor component, deploys once, and idempotently registers each plugin. Existing registration by the same name/version is accepted. Existing environments are not iterated during provisioning: EnvironmentService::create grants every plugin owned by the built-in-plugin owner transactionally to each new environment, and built-in grants cannot be deleted.

If changing this behavior, update focused service/integration tests. Tests that invoke Cargo,

Golem, or another compiler as a subprocess belong specifically in the CLI integration test suite;

unit, worker-executor, and non-CLI integration tests must not spawn them. Implement the current

contract directly; backward-compatibility paths remain prohibited until the repository-wide policy

is revised.

Verification

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.