Wrefs
A wref (WarmHub reference) is a human-readable address for any entity in WarmHub — shapes, things, and assertions.
Two Forms
Section titled “Two Forms”Local Wrefs
Section titled “Local Wrefs”Within the current repo, use the short form:
Location # shapeLocation/cave # thingBelief/cave-safe # assertionGameState/round-1/state # thing with hierarchical nameThe first segment is always the shape name. Everything after the first / is the thing name. Thing names can contain / for hierarchical organization.
Canonical Wrefs
Section titled “Canonical Wrefs”For cross-repo references, use the fully qualified form:
wh:org/repo/Location # shape in another repowh:org/repo/Location/cave # thing in another repoCanonical wrefs always start with wh: followed by org/repo/ and then the local wref.
Version Modifiers
Section titled “Version Modifiers”Append @ followed by a version modifier to target a specific version:
| Modifier | Meaning | Example |
|---|---|---|
@HEAD | Current (latest) version only | Location/cave@HEAD |
@vN | Pinned to version N | Location/cave@v3 |
@ALL | All versions | Location/cave@ALL |
When no modifier is specified (a “bare” wref), the default depends on the operation:
- Most reads resolve bare wrefs to the current version — equivalent to
@HEAD. - About queries (SDK
thing.about(), CLIwh assertion list --about, MCPwarmhub_thing_about) resolve bare wrefs to@ALL— returning assertions across all versions of the target. - Writes (commit operations) resolve bare wrefs to
@HEAD— the operation targets the current version.
The @ALL modifier is rejected on write paths.
Path Segment Rules
Section titled “Path Segment Rules”Wref path segments have the following constraints:
- Segments must be non-empty — no
//allowed - Names cannot start or end with
/ - Segments cannot contain:
?,#,@,:,$, or whitespace - The
+character is reserved for collection canonical names
Batch Tokens
Section titled “Batch Tokens”In commit operations, special tokens enable creating and referencing entities in a single commit:
$N — Allocate
Section titled “$N — Allocate”Used in the last segment of an ADD operation’s name. Generates an opaque commit-scoped identifier:
{ "operation": "add", "kind": "thing", "name": "Location/loc-$1", "data": { "x": 1 } }This might create something like Location/loc-a1b2c3d4e5f6a7b8.
#N — Reference
Section titled “#N — Reference”Used anywhere to reference the value allocated by the corresponding $N:
[ { "operation": "add", "kind": "thing", "name": "Location/loc-$1", "data": { "x": 1 } }, { "operation": "add", "kind": "assertion", "name": "Belief/b-$2", "about": "Location/loc-#1", "data": { "safe": true } }]The #1 resolves to the same generated value as $1, so the assertion targets the thing created in the same commit.
Token Rules
Section titled “Token Rules”$Ncan only appear in the last segment of an ADD name#Ncan appear anywhere — in names, about fields, and collection members- Tokens are resolved before version pinning and wref resolution
- Generated values are opaque identifiers; callers should not infer ordering from them
- Each
$Nmust have a unique N within the commit #Nmust reference a$Nthat appears earlier in the operations list
Resolving Wrefs
Section titled “Resolving Wrefs”To resolve a wref to its canonical identity:
wh thing resolve Location/caveVia MCP:
{ "name": "warmhub_wref_resolve", "arguments": { "wref": "Location/cave" } }This returns the thing’s wref, version, kind, and active state.
Examples
Section titled “Examples”# Shape-only wrefLocation
# Thing wrefLocation/cave
# Pinned to version 3Location/cave@v3
# Canonical (cross-repo)wh:acme/world/Location/cave
# Hierarchical thing nameGameState/round-1/turn-5/state
# Collection canonical namePair/Location/Av1+Bv1
# With token allocationLocation/loc-$1