lantern

loom-addressing

Loom Addressing

Coordinate grammar for the 4-dimensional address space.

Grammar v0.4

address     = slug [ ":" path ] [ "^" level ] [ "~" version ]

slug        = identifier
path        = section [ "." fence_loc ] [ anchor ]
section     = identifier
fence_loc   = fence_type [ selector ] [ "." key_path ]
fence_type  = identifier
selector    = "#" label | "[" index_expr "]"
label       = identifier
index_expr  = integer | key "=" value
key_path    = identifier { "." identifier }
anchor      = "@" anchor_type [ ":" anchor_arg ]
anchor_type = "start" | "end" | "after" | "before" | integer
anchor_arg  = quoted_string | integer

level       = "L"? digit          ; L0-L5 or 0-5
version     = "HEAD" | hash | relative
hash        = hex{8,12}           ; version hash prefix
relative    = "-"? digit+         ; ~-1 = previous, ~0 = HEAD

identifier  = [a-zA-Z_][a-zA-Z0-9_-]*
integer     = "-"? digit+
digit       = [0-9]
hex         = [0-9a-f]
quoted_string = '"' [^"]* '"' | "'" [^']* "'"

Dimensions

Symbol Dimension Description Default
(bare) slug Document identity required
: path Location in document root
^ level Transformation level L5
~ version Temporal version HEAD

Level Stack

Level Name Description
L0 File Raw markdown string
L1 Tokens Tokenized stream
L2 Evolved Viruses resolved
L3 Rendered Includes spliced (composition complete)
L4 Executed Fences run (code → data)
L5 Presented Final output (data → document)

Version References

Syntax Meaning
~HEAD Current version
~abc123 Specific version by hash prefix
~0 Current (same as HEAD)
~-1 Previous version
~-2 Two versions back

Examples

# Basic addresses
aws-demo                              # slug only, L5, HEAD
aws-demo:ecs-clusters                 # slug + section
aws-demo:ecs-clusters.yaml            # slug + section + fence type
aws-demo:ecs-clusters.yaml.clusterArns # slug + path into data

# With level
aws-demo^3                            # L3 (rendered, pre-execution)
aws-demo^L4                           # L4 (executed)
aws-demo:ecs-clusters.yaml^5          # full path at L5

# With version
aws-demo~HEAD                         # explicit HEAD
aws-demo~-1                           # previous version
aws-demo~abc123                       # specific version hash

# Combined (full coordinate)
aws-demo:ecs-clusters.yaml^4~-1       # path + level + version
aws-demo^3~abc123                     # level + version (no path)

# With selectors
ana:traits.yaml#config.name^5~HEAD    # labeled fence + key
ana:traits.yaml[0].value^4            # indexed fence + key

# With anchors (for poke)
ana:traits@start                      # section start
ana:traits@after:"marker"^5           # after pattern at L5

Coordinate Space

Every address maps to a coordinate tuple:

(slug, path, level, version) → value | None

Cache semantics:

  • HEAD + miss → compute (lazy materialization)
  • Historical + miss → None (checkpoint or nothing)

Address Resolution

  • Parse address into components
  • Build Coordinate from components
  • Check cache at coordinate
  • On miss at HEAD: materialize through stack
  • On miss at historical: return None (no computation)

Composition Edges

When holes are filled, edges record the coordinate:

(template_hash, value_hash) → result_hash
at coordinate: slug:path^level~version

This enables:

  • Reproducible builds (same inputs → same outputs)
  • Provenance tracking (where did this value come from?)
  • Cache invalidation (what depends on this?)

Slots

North

slots:
- context:
  - Linking address grammar spec to loom-tools
  slug: loom-tools

North

↑ northloom-tools