RFD0023 - Riot Package Index
- Feature Name:
riot_package_index - Start Date:
2026-03-27 - Status:
implemented
Summary
Section titled “Summary”Riot’s sparse package index is a Cargo-style sharded JSON index rooted at:
https://cdn.pkgs.ml/index/v1/The sparse index is written by services/api.pkgs.ml and served publicly by
the services/cdn.pkgs.ml worker at cdn.pkgs.ml.
That split is intentional: publish blocks until the index has been updated, and
reads still happen through the CDN hostname clients expect.
The index only contains explicitly published packages with unique public names. Direct source dependencies do not appear in the index unless an author later publishes them.
Motivation
Section titled “Motivation”The registry solves publication and provenance, but package installation by name needs a much cheaper hot path.
The install fast path for:
riot add kernelshould be:
- fetch sparse index config once
- compute one package shard path
- fetch one small package document
- solve locally in
riot - download immutable artifacts by SHA
That means the index must be:
- static
- sharded
- cache-friendly
- independent from GitHub at read time
Final design
Section titled “Final design”Ownership
Section titled “Ownership”The index does not own:
- source materialization
- authentication
- package-name claims
- publish authorization
- search
- docs
Those are registry concerns or downstream concerns.
The index owns only the install read model for named packages.
What gets indexed
Section titled “What gets indexed”A release is indexable when:
- it was explicitly published
- its package name is claimed
- its version is valid semver
- the package is public
The index does not include:
- unpublished source materializations
- mutable refs like
main - raw SHAs without a named release
Sparse layout
Section titled “Sparse layout”The implemented shard layout matches the Cargo sparse index strategy with JSON files:
index/v1/ config.json 1/x.json 2/io.json 3/m/mcp.json ke/rn/kernel.json mi/nt/minttea.jsonPackage document model
Section titled “Package document model”Each package shard contains one package document with:
- package name
- latest release version
- updated timestamp
- all published releases for that package
Each release entry includes:
- version
- published timestamp
- artifact SHA-256
- description
- license
- homepage
- repository
- optional provenance metadata
- repository
- root module
- categories
- keywords
- manifest key
- source key
- dependency metadata
This lets riot solve locally without consulting the registry Worker on the
install hot path.
Publish-time behavior
Section titled “Publish-time behavior”On successful publish, the registry now performs index work synchronously:
- read the current package document from R2, if any
- upsert the release into the package document
- semver-sort releases
- recompute
latest - write the package shard back to R2 if it changed
- emit
package.searchable - emit
package.indexed
Because this work happens inline with publish, the user-visible behavior is:
- publish succeeds
- the package is already visible in the sparse index
riot add <package>can use it immediately
Root config
Section titled “Root config”The root config document at v1/index/config.json tells clients:
- index kind
- shard strategy
- index base URL
- artifact base URL
This gives riot a single bootstrap file to cache and use for all future
named-package installs.
Client contract for future riot add
Section titled “Client contract for future riot add”The index is the main contract for named installs.
riot add <package> should:
- fetch
config.json - compute the shard path for the package name
- fetch the package document
- select a compatible version locally
- fetch the immutable package artifact referenced by the chosen release
The index deliberately does not choose versions for the client. That belongs in Riot’s package-management layer.