# CRAN

Recommend AXM extensions from a CRAN (R) package and target CRAN packages from an extension.

AXM reads R extension metadata from a `Config/agentExtensions` field in the
package `DESCRIPTION` file. This is the
[two-way linking](/docs/package-ecosystems/overview) model applied to the CRAN
ecosystem. CRAN reserves `Config/` fields for package-specific configuration, so
the value travels with your package untouched.

## Recommend extensions from a package

Add a `Config/agentExtensions` field to `DESCRIPTION`. Its value is the portable
recommendation array encoded as JSON on a single line. Each entry is an
extension reference (`@owner/<type>/<name>`):

```
Config/agentExtensions: [{"ref":"@examples/packs/r-cran-tinyflags"}]
```

The `DESCRIPTION` format is line-oriented, so the JSON must stay on one logical
line (continuation lines are indented).

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:

```
Config/agentExtensions: [{"ref":"@examples/packs/r-cran-tinyflags","versionRange":"^1.0.0"}]
```

## Target CRAN packages from an extension

On the extension manifest (`skill.json`, `pack.json`, `subagent.json`, …), add a
`packages` array with a CRAN [purl](https://github.com/package-url/purl-spec).
Use the package name from `DESCRIPTION` as the purl name:

```jsonc
// pack.json
{
  "packages": [{ "purl": "pkg:cran/tinyflags" }],
}
```

### Version ranges

Default to identity-only. Add a [VERS](https://github.com/package-url/vers-spec)
`versionRange` with the `cran` scheme only when the extension depends on package
APIs introduced or removed in a known range:

```jsonc
{
  "packages": [
    {
      "purl": "pkg:cran/tinyflags",
      "versionRange": "vers:cran/>=0.1.0|<1.0.0",
    },
  ],
}
```

## Official status

When the CRAN 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](/docs/package-ecosystems/overview#official-extensions).

## Reference fixture

The
[`r-cran-lib`](https://github.com/agentxm/polyglot-examples/tree/main/r-cran-lib)
and
[`r-cran-app`](https://github.com/agentxm/polyglot-examples/tree/main/r-cran-app)
directories in `polyglot-examples` are the working fixtures for everything
above. The package publishes a TinyFlags companion pack and recommends it from
the `Config/agentExtensions` field in `DESCRIPTION`; the pack and each skill
declare the package's `pkg:cran` purl as an identity-only companion package.