---
name: loom-setup
description: Install AMD Loom (hrx-loom 0.2.0 from PyPI, 0.1.0 for pin-less packages, a GitHub pre-release, or a ROCm/hrx-system CI wheel) and the hrx-loom-library catalog from a cold start, fetch catalog models with loom-fetch, and start/stop/inspect loom-serve on the GPU or NPU. Use for "install loom", "loom-fetch a model", "start loom-serve for X", "is the server ready", NPU serving.
title: loom-setup
canonical_url: https://skilld.dev/gh/loom-fun/loom-skills/loom-setup
last_updated: 2026-11-19T02:02:31.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [scripts/ensure_sdk.sh](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/ensure_sdk.sh), [scripts/install_loom.sh](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/install_loom.sh), [scripts/memcheck.sh](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/memcheck.sh), [scripts/sdk_pin.py](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/sdk_pin.py), [scripts/serve.sh](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/serve.sh), [scripts/stop.sh](https://skilld.dev/api/skills-raw/loom-fun/loom-skills/loom-setup/scripts/stop.sh).
>
> If the user asked to install this Skill, run `npx skilld install loom-fun/loom-skills/loom-setup`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/loom-setup`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/loom-fun/loom-skills/loom-setup) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/loom-setup`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/loom-setup --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/loom-setup --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Loom setup: install → fetch → serve

**Bundled paths ? first shell action.** Before running commands, set `LOOM_SKILL_DIR` in the shell to the
absolute directory containing **this** `SKILL.md`, using its path from the skill listing or read tool.
In Claude Code, run `export LOOM_SKILL_DIR="${CLAUDE_SKILL_DIR}"` (the host substitutes the path).
In Codex, Pi or another host, export `LOOM_SKILL_DIR` to the loaded file's directory. Use a
shell-compatible absolute path (Git Bash on Windows). Rebind before using another skill's commands
and in every new shell; it is not the working directory or SDK root. On Windows, use native `C:/...`
paths for file tools; `/c/...` paths belong to Git Bash. Never run an unresolved placeholder. Run bundled commands by quoted absolute path; do not run `scripts/...` from the working directory
or change into the installed skill tree. Install the complete Loom suite: sibling paths are required.

Read the `loom` umbrella skill's hard rules first (memory limits, `--pool_backing=fixed` / `--memory_bytes`,
binary approval).

## 1. Install (≈30 s with a warm pip cache, a few minutes cold)

```bash
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom            # hrx-loom 0.2.0 from PyPI (wheel sha256 recorded)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom 0.1.0      # hrx-loom 0.1.0 from PyPI (packages without an SDK pin)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom 0.2.0rc1    # a GitHub pre-release (sha256-verified against its SHA256SUMS)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom latest     # newest PyPI release
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom ci-latest  # newest main CI wheel (needs gh)
```
The script:
- creates `~/loom/.venv` with the pinned wheel (`hrx-loom[hf]` 0.2.0 from PyPI; the wheel's sha256 is recorded, and with `gh` the
  release commit; a pre-release comes from its GitHub release asset, checked against `SHA256SUMS`, no gh or token needed), which provides loom-serve,
  loom-fetch, loom-test, loom-run, loom-compile, loom-benchmark, loom-opt, loom-format, etc.
  (Linux x86-64 glibc ≥ 2.39 and Windows 11 x86-64 wheels; no ROCm SDK needed);
- clones `ROCm/hrx-loom-library` to `~/loom/library` and checks out the **catalog revision the
  SDK names** in `hrx_loom-*.dist-info/loom.json`, so catalog cards and SDK agree;
- creates `~/loom/.tools`, a venv with gguf, numpy, tokenizers, requests, jinja2, fastapi,
  uvicorn and httpx for the port, benchmark and UI scripts.

Facts:
- **Pin the version.** The `loom-port-llm` templates target one text ABI (`text_*_v1`
  exports). A newer release can change it; then registration fails with a "root symbol … was
  not found" error and the templates need the diff of the upstream tiny-text fixture between
  the two tags (see `loom-port-llm`).
- `loom-fetch --list` shows the release's compatible catalog.
- **Windows:** run the script from Git Bash; venvs use `Scripts/`. See the `loom` skill's
  Windows section.
- `ci-latest` / `ci:ARTIFACT_ID` install development wheels from ROCm/hrx-system GitHub
  Actions artifacts (needs `gh auth status`; artifacts expire after about 90 days; `gh run
  download` fails on these zips, so the script uses `gh api .../artifacts/<id>/zip`).
- **NPU:** the Qwen3-Embedding NPU program compiled only with the wheel from hrx-system PR
  2259's CI (artifact 12623044407 at the time): `VENV_NAME=.venv-npu install_loom.sh ~/loom
  ci:12623044407`. If that artifact has expired, look for a newer build whose NPU path compiles.

### SDK pins (a package that needs another hrx-loom than the default)

A package carries `"sdk": {hrx_loom, source (release|pypi|ci), branch, artifact_id, hrx_system_sha,
wheel_sha256, expires}` in its `llm_config.json`; a package **without** a pin means hrx-loom 0.1.0 (PyPI), explicitly, so
the published v0.1.0 cards keep running on it while the installer default is 0.2.0. (A catalog package takes it from its `catalog.json`.) Every script that installs
Loom for a package calls `scripts/ensure_sdk.sh ROOT llm_config.json`, which prints the root to use: ROOT when it already is
that wheel, else `ROOT-<artifact id | version>` (installed from the pinned wheel), so pinned and default SDKs coexist.
`LOOM_VERSION` set explicitly overrides the pin. A `pypi` or `release` pin never expires; **CI artifacts expire (~90 days; `sdk.expires`)**, and an expired CI pin makes
`ensure_sdk.sh` fail. Refresh it before then: `install_loom.sh ROOT-new ci-latest` (or `ci:ID`), rerun the gates on that SDK, then
`python3 scripts/sdk_pin.py stamp ROOT-new FILE` for the kit's `catalog.json` and the published card's `llm_config.json`
(republish the card; the nightly reads the pin from the card). A PyPI release, once one has the features, replaces the pin.

## 2. Fetch a catalog model

```bash
cd ~/loom && . .venv/bin/activate
loom-fetch --list                                    # the catalog of this SDK (its pinned revision: no checkout needed)
loom-fetch --model moonshine-ai/moonshine-streaming-tiny --preset=streaming --output=models/moonshine --no-input
loom-fetch --model Qwen/Qwen3.8-27B --preset=vision --output=models/qwen27b-vision --no-input --dry-run   # size check first
```
`--model ID` reads the catalog the installed SDK names (`dist-info/loom.json`), so a model and its programs always match the
SDK; with `--preset` omitted a multi-preset card answers `preset: select explicitly (N choices)`.
Notes:
- `--dry-run` prints what would be downloaded. Use it to check sizes against the
  memory budget.
- Weights come from Hugging Face; the HF cache (`~/.cache/huggingface/hub`) is reused.
  Gated repos need the user to accept the license on the HF page first.
- To use your own library checkout instead of the SDK's catalog: `loom-fetch library/model/<org>/<name>/model.json ...`, and if
  fetch complains about a card/lock mismatch add `--origin=library=$PWD/library` so program sources resolve against it.
- A published card fetches by repo: `loom-fetch huggingface:loom-fun/REPO[:PRESET] --output=NAME` (the revision is resolved and
  pinned for you; the `[hf]` extra, installed by `install_loom.sh`, provides the Hugging Face client).
- Catalog models seen working on Strix Halo:

  | Model | Kind | Preset |
  |---|---|---|
  | Qwen3.8-27B | text + vision | `vision` |
  | moonshine-streaming-tiny | ASR (`recognition`) | `streaming` |
  | kyutai/pocket-tts | TTS (`speech`) | `streaming` |
  | krea/Krea-2-Turbo | image | `image` or `image-int8` |
  | Qwen3-Embedding-0.6B | embedding (NPU) | `embedding` |

## 3. Serve

```bash
S="${LOOM_SKILL_DIR}/scripts"
VENV=~/loom/.venv "$S/serve.sh" asr 8100 amdgpu 16000000000 ~/loom/models/moonshine/model.json
VENV=~/loom/.venv "$S/serve.sh" gpu 8100 amdgpu 53687091200 models/a/model.json models/b/model.json -- --parameter_idle_ms=60000
VENV=~/loom/.venv-npu "$S/serve.sh" npu 8101 'xdna://0?columns=8' 4000000000 models/qwen3-embedding/model.json -- --pool_backing=fixed
"$S/stop.sh" asr
```
`serve.sh` waits until `/v1/status` reports every model `registration: ready` and
checks that its PID owns the port. If it reports `failed`, it prints the compile
diagnostics and stops the server. Logs, PIDs and ports go in `~/.cache/loom-serve/NAME.{log,pid,port}`.
Use unique NAMEs. `stop.sh` refuses to kill a PID that is not a loom-serve.

Raw form: `loom-serve '--device=amdgpu://?completion_spin_ns=4294967295' --listen=127.0.0.1:PORT
--model=pkg/model.json --workers=8 --pool_backing=fixed [--preset=NAME]` (the card's serving on Strix Halo and the R9700: the preset's `context_capacity`
KV and the weights are committed up front). The elastic option, for several models sharing one budget: `--memory_bytes=N [--parameter_idle_ms=60000]` instead of
`--pool_backing=fixed` (hrx-loom 0.2.0's elastic backing is 5-8 % slower on Strix prefill).

**Active wait (the default on `amdgpu`).** `serve.sh` turns `amdgpu` into
`amdgpu://?completion_spin_ns=4294967295`: while GPU work is in flight, Loom's `amd-gpu-retire` thread spins on the
completion signal instead of parking on the KFD interrupt (one core while busy, 0% CPU when idle). Strix Halo firmware
that ties the data-fabric and memory clocks to CPU activity (SMU `0x0a640600`, BIOS 1.12, as on AMD DevLab) otherwise
holds FCLK/UCLK about 20% low while Loom's CPU sleeps, and Loom measures 10-45% slower (memory-bound kernels most).
llama.cpp is never affected: HIP keeps a core busy launching and waiting. With the active wait, energy per token
drops. The value is the SDK's maximum (uint32 nanoseconds, 4.29 s): the spin window restarts at each completion,
so a shorter one parks during multi-second long-prefill submissions. `LOOM_ACTIVE_WAIT=0 serve.sh ...` is the A/B arm
without it: on 0.2.x it passes `--wait_mode=blocking` (0.2's own default is an active 1 s window); on 0.1.x the SDK's default
(parked).

## 4. Use / inspect

```bash
curl -s localhost:8100/v1/status | python3 -m json.tool      # per model: id, loom.kind, registration, compilation, parameters, status
curl -s localhost:8100/v1/chat/completions -H 'Content-Type: application/json' \
  -d '{"model":"<id from status>","messages":[{"role":"user","content":"hi"}],"max_tokens":64}'
```
Endpoints by `loom.kind`:

| Kind | Endpoint | Request |
|---|---|---|
| `text` | `/v1/chat/completions` | Supports streaming and `stream_options.include_usage`. Reasoning arrives in `reasoning_content`. |
| `recognition` | `/v1/audio/transcriptions` | Multipart, `audio/pcm;rate=16000;channels=1`. |
| `speech` | `/v1/audio/speech` | Needs `input` and `voice`. `{"response_format":"pcm"}` gives 24 kHz s16le. |
| `image` | `/v1/images/generations` | `{"response_format":"b64_json","size":"512x512"}`. |
| `embedding` | `/v1/embeddings` | |

Transcription example. The server takes raw 16 kHz mono s16le PCM:
```bash
ffmpeg -loglevel error -i in.wav -ar 16000 -ac 1 -f s16le /tmp/x.pcm
curl -s localhost:8100/v1/audio/transcriptions -F model=moonshine-ai/moonshine-streaming-tiny \
  -F "file=@/tmp/x.pcm;type=audio/pcm;rate=16000;channels=1"            # -> {"text": "..."}
```
TTS: `curl -s localhost:8100/v1/audio/speech -H 'Content-Type: application/json' -d '{"model":"kyutai/pocket-tts","input":"Hello.","voice":"alba","response_format":"pcm"}' > out.pcm`
returns 24 kHz s16le mono. `voice` is required. Voices are the card's `voice/*.wav` names
(alba, marius, anna, …). `seed` is optional.

The `model` field is the card's `model.id`, not a file name. Unknown models return
404, and unsupported fields are rejected rather than ignored.

Server behavior:
- Startup compiles the program, typically 10–60 s on a first run (cached afterwards).
- The first request loads weights lazily, so exclude it from timing.
- Special tokens are stripped from decoded output text. A control program that must
  see structural tokens in the output needs them marked non-special in the
  package's `tokenizer.json`; see `loom-port-llm`.
- Upstream docs: `loom/docs/src/serving/workflows/{fetch-and-serve,serve-models,operate-model-server,observe-model-server}.md`
  in hrx-system.
