Skip to main content

When to Use

When working with prompt unit addresses anywhere in the STRATT stack — CLI commands, import declarations, SPUH headers, MERIDIAN links, or dependency graph edges.

URI Format

strat://{domain}/{type}/{slug}@{version}
Example: strat://dev/role/hostile-reviewer@1.2.0

Canonical Regex

^strat:\/\/(dev|neuro|finance|nutrition|legal|film|artist|core|shared)\/(role|rule|task|chain|fragment)\/[a-z0-9-]+@\d+\.\d+\.\d+$

Constraints

PartPatternNotes
domain9 allowed valuescore = global rules, shared = cross-domain fragments
type5 allowed valuesrole, rule, task, chain, fragment
slug^[a-z0-9-]+$kebab-case, max 64 chars, immutable once assigned
versionsemver \d+.\d+.\d+0.x.x = draft, 1.0.0+ = stable

Usage

import { parseUri, formatUri, isValidUri, isUriError } from "@stratt/schema";

// Parse — returns ParsedUri | UriError (does NOT throw)
const result = parseUri("strat://dev/task/review-pr@1.0.0");
if (isUriError(result)) {
  console.error(result.error);
} else {
  console.log(result.domain, result.type, result.slug, result.version);
}

// Format — throws on invalid input (programming error)
const uri = formatUri({ domain: "dev", type: "task", slug: "review-pr", version: "1.0.0" });

// Quick validate
if (isValidUri(someString)) { ... }

CON-010: Draft Isolation

Stable units (version >= 1.0.0) cannot import draft units (version 0.x.x). This is enforced by validateUnit() in the schema package. The URI parser alone does not enforce this — it’s a cross-unit constraint checked during validation.

Round-Trip Guarantee

formatUri(parseUri(uri)) === uri for all valid URIs. This is tested.