strat:// URI Scheme
stratt beginner 4 min read
ELI5
A strat:// URI is an address label with four slots: which neighbourhood (domain), what kind of building (type), the street name (slug), and which renovation (version). Mail with a malformed label bounces at the post office.
Technical Deep Dive
Grammar
strat://{domain}/{type}/{slug}@{semver}
classDiagram class ParsedUri { +string domain +UnitType type +string slug +string version } class UriError { +string code +string message } class Domain { <<enum>> dev neuro finance nutrition legal film artist core shared } class UnitType { <<enum>> role rule task chain fragment } ParsedUri --> Domain ParsedUri --> UnitTypeValidation surface
@stratt/schema exposes parseUri(uri) → ParsedUri | UriError, formatUri(parts), isValidUri(uri), isUriError(x). The regex URI_REGEX is the single source of truth — both validation and formatting reuse it.
Coexistence with choco://
Per IC-02, the strat:// and choco:// schemes are deliberately distinct namespaces. Cross-scheme imports go through a BridgeResolver chain: each resolver declares canResolve(scheme); the first match wins. Unresolved imports raise FM-02.
Key Terms
- Domain → top-level partition (one of nine enums) that anchors a unit’s URI.
- Slug → the kebab-case identifier within
{domain}/{type}/. - BridgeResolver → the IC-02 plug-in that handles non-
strat://schemes.
Q&A
Q: Why is the version embedded in the URI rather than carried as a header?
A: Imports are content-addressed by URI; pinning the semver in the URI lets the DAG distinguish @1.2.0 from @1.3.0 as separate nodes.
Q: What does parseUri return on a malformed input?
A: A UriError object — never a thrown exception. Callers use isUriError() to discriminate.
Examples
strat://dev/chain/onboarding-flow@1.4.2 — chain unit, dev domain, semver pinned.
strat://core/rule/no-secrets@0.1.0 — a draft rule (0.x.x signals DRAFT lifecycle state).
neighbors on the map
- Canonical Serialisation Pipeline reproducing a fingerprint mismatch across languages