Skip to main content

Hackage

Recommend AXM extensions from a Hackage (Haskell) package and target Hackage packages from an extension.

AXM reads Haskell extension metadata from the x-agent-extensions custom field in the package's .cabal file. This is the two-way linking model applied to the Hackage ecosystem. Cabal allows arbitrary x- prefixed fields, and AXM JSON-decodes each one.

Recommend extensions from a package

Section titled Recommend extensions from a package

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

-- agentxm-example-tinyflags.cabal
x-agent-extensions: [{"ref":"@examples/packs/haskell-hackage-tinyflags"}]

The JSON must stay on one line per Cabal's field grammar.

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/haskell-hackage-tinyflags","versionRange":"^1.0.0"}]

Target Hackage packages from an extension

Section titled Target Hackage packages from an extension

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

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

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

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

When the Hackage 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 haskell-hackage-lib and haskell-hackage-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 .cabal file; the pack and each skill declare the package's pkg:hackage purl as an identity-only companion package.