Skip to main content

opam

Recommend AXM extensions from an opam (OCaml) package and target opam packages from an extension.

AXM reads OCaml extension metadata from the x-agent-extensions custom field in the package's .opam file. This is the two-way linking model applied to the opam ecosystem. opam reserves the x- prefix for extension fields, and AXM decodes each one against the package metadata schema.

Recommend extensions from a package

Section titled Recommend extensions from a package

Add an x-agent-extensions field to the .opam file. Its value is a JSON array of extension declarations, where each entry is an extension reference (@owner/<type>/<name>):

# agentxm-example-tinyflags.opam
x-agent-extensions: [{"ref":"@examples/packs/ocaml-opam-tinyflags"}]

The field contains the portable recommendation entries directly.

Keep recommendations identity-only — omit versionRange. AXM resolves the reference to the newest matching extension version and pins it in the user's axm.lock. Prefer recommending a single pack so you keep one stable reference while its contents evolve.

Add a semver versionRange only when your package genuinely pairs with a bounded major line of the extension:

x-agent-extensions: [{"ref":"@examples/packs/ocaml-opam-tinyflags","versionRange":"^1.0.0"}]

Target opam packages from an extension

Section titled Target opam packages from an extension

On the extension manifest (skill.json, pack.json, subagent.json, …), add a packages array with an opam purl. Use the package name as published to the opam repository as the purl name:

// pack.json
{
  "packages": [{ "purl": "pkg:opam/agentxm-example-tinyflags" }],
}

Default to identity-only. Add a VERS versionRange with the opam scheme only when the extension depends on package APIs introduced or removed in a known range:

{
  "packages": [
    {
      "purl": "pkg:opam/agentxm-example-tinyflags",
      "versionRange": "vers:opam/>=0.1.0|<1.0.0",
    },
  ],
}

When the opam package recommends an extension through the AgentXM Registry and that extension names the package as a companion via its purl, AXM derives official status for the pair — no extra flag. See Official extensions.

The ocaml-opam-lib and ocaml-opam-app directories in polyglot-examples are the working fixtures for everything above. The package publishes a TinyFlags companion pack and recommends it from the x-agent-extensions field in its .opam file; the pack and each skill declare the package's pkg:opam purl as an identity-only companion package.