Skip to main content

Go modules

Recommend AXM extensions from a Go module and target Go modules from an extension.

AXM reads Go extension metadata from an agent-extensions.json sidecar at the module root — next to go.mod. This is the two-way linking model applied to Go modules. Go has no package-manifest field for arbitrary metadata, so a sidecar file carries the recommendation.

Recommend extensions from a module

Section titled Recommend extensions from a module

Add an agent-extensions.json file at the module root with an agentExtensions array. Each entry is an extension reference (@owner/<type>/<name>):

// agent-extensions.json
{
  "$schema": "https://axm.sh/schemas/agent-extensions.schema.json",
  "agentExtensions": [{ "ref": "@examples/packs/go-gomod-tinyflags" }],
}

Because Go fetches modules by version-control contents, committing agent-extensions.json beside go.mod makes it available to consumers in the module cache.

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 module genuinely pairs with a bounded major line of the extension:

{
  "agentExtensions": [
    {
      "ref": "@examples/packs/go-gomod-tinyflags",
      "versionRange": "^1.0.0",
    },
  ],
}

Target Go modules from an extension

Section titled Target Go modules from an extension

On the extension manifest (skill.json, pack.json, subagent.json, …), add a packages array with a Go purl. The Go purl type is golang, and the module path becomes the namespace and name:

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

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

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

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

The go-gomod-lib and go-gomod-app directories in polyglot-examples are the working fixtures for everything above. The module publishes a TinyFlags companion pack and recommends it from the agent-extensions.json sidecar beside go.mod; the pack and each skill declare the module's pkg:golang purl as an identity-only companion package.