---
name: ancrel
description: Find and use version-matched Ancrel components, design tokens and infrastructure contracts when implementing or migrating a consumer application.
---

1. Read `origin` (or `catalogBase`) and `release` from the consumer's `.ancrel.json`. Read the active importer's exact npm versions from `pnpm-lock.yaml`, or the Python package records for the active environment from `uv.lock`. Check any configured package pins against the lock. The catalog snapshot can contain packages with different versions. Never silently upgrade a dependency or switch releases.
2. GET `<catalogBase>/v/<release>/registry.json`. The snapshot's `llms.txt` also provides an overview. Use these machine endpoints exclusively for discovery. Never scrape HTML. Confirm the index's `release` and `baseUrl` match the requested snapshot. Select a listed item by layer, summary, package and stability.
3. Resolve its `href` (`registry/<id>.json`) against `baseUrl`. Compare the SHA-256 of the downloaded bytes with the index entry's lowercase hexadecimal `sha256` before parsing. Verify the item ID and compare `package.name` and `package.version` with the index entry and the lockfile. GET its `docs` (`raw/<section>/<slug>.md`) and the selected `examples[].entry` from the same base. Check the example against `examples[].code`.
4. For `layer: backend`, select a listed `be.*` ID and resolve `api.contractRef` inside the snapshot. For example, follow `registry/be.rsi-studio-template.json` to `raw/backend/rsi-studio-template.md` and `schemas/cli-envelope.v1.json`. Verify the Python distribution name and exact version in `uv.lock`, run `uv sync --locked`, then use the declared `api.entrypoint` and example command. For frontend items, implement through the public package exports named by the item. Use the example's imports and behavior, satisfy `constraints`, avoid `antiPatterns` and consult `tokenDependencies` and the snapshot's four token contexts when styling the consumer.
5. Run the consumer's typecheck, lint and relevant tests, including frontend token checks or Python contract tests as applicable. Record the item ID, pinned version and check results. If discovery fails, the digest differs or versions disagree, stop implementation and return the gap report below. For automated replay, return exit code 2 for a release/lockfile mismatch.

## CLI accelerator

On the hosted site, request any documentation page with `Accept: text/markdown` to retrieve its Markdown twin directly.

When available, use the version-matched `@ancrel/cli` for discovery and consumer checks. Direct HTTP GET remains the zero-install baseline above.

```sh
ancrel list --layer frontend --json
ancrel list --layer backend --json
ancrel show be.rsi-studio-template --json
ancrel show fe.button --json
ancrel tokens comp.drawer --theme light --json
ancrel check --project . --json
```

Read the `ancrel.cli.v1` envelope and its diagnostics. Exit 0 means success, 1 identifies usage, lookup or compliance errors, and 2 identifies a configuration, version, availability or integrity failure. For disconnected work, use `--release-dir` or prefetch the required item with `show` and replay it with `--offline`. Record the verified release and diagnostic codes.

## Gap report

```text
Ancrel gap report
Reason: <no matching item | release/lockfile mismatch | integrity mismatch | unavailable data>
Requested capability or item ID: <request>
Snapshot: <catalogBase>/v/<release>/
Installed versions: <package and exact lockfile version, or missing>
Evidence: <searched IDs, HTTP status, expected/actual digest or version>
Needed from maintainer: <missing contract or version decision>
```
