lantern

loom-tools

Loom Tools

Composable fences for edge queries and diffs.

Edge Diff

Show transitions between generations for any slug.

from loom.edges.store import get_store

# Get params from context
slug = config.get('slug', 'demo-todos')
from_gen = config.get('from', 0)
to_gen = config.get('to', None)

store = get_store()
edges = store.get_edges(slug)

if not edges:
    print(f"*No edges for `{slug}`*")
else:
    # Filter by generation range if specified
    if to_gen is not None:
        edges = [e for e in edges if e.coordinate.generation is None or
                 (from_gen <= (e.coordinate.generation or 0) <= to_gen)]

    print(f"## Transitions for `{slug}`\n")
    print(f"*{len(edges)} edge(s)*\n")

    for i, edge in enumerate(edges):
        gen = edge.coordinate.generation or i
        print(f"### Gen {gen}: {edge.coordinate.operation}")
        print(f"*{edge.timestamp[:19]}*\n")

        if edge.snipped:
            print("**Before:**")
            print(f"```")
            print(edge.snipped[0].get('state', '')[:200])
            print(f"```\n")

        if edge.spliced:
            print("**After:**")
            print(f"```")
            print(edge.spliced[0].get('state', '')[:200])
            print(f"```\n")

        if edge.context.get('context'):
            print(f"*{edge.context.get('context')}*\n")

        print("---\n")

❌ Fence Execution Error: No module named 'loom' Traceback (most recent call last): File "/app/oculus/providers/python_provider.py", line 468, in execute exec(fence_content, exec_globals, exec_locals) File "", line 1, in ModuleNotFoundError: No module named 'loom'

Edge Table

Compact table view of edges.

from loom.edges.store import get_store

slug = config.get('slug', 'demo-todos')
store = get_store()
edges = store.get_edges(slug)

if not edges:
    print(f"*No edges for `{slug}`*")
else:
    print(f"## Edge Log: `{slug}`\n")
    print("| # | Operation | Time | Context |")
    print("|---|-----------|------|---------|")
    for i, e in enumerate(edges):
        ts = e.timestamp[11:19] if e.timestamp else ''
        ctx = e.context.get('context', '')[:30]
        print(f"| {i} | {e.coordinate.operation} | {ts} | {ctx} |")

❌ Fence Execution Error: No module named 'loom' Traceback (most recent call last): File "/app/oculus/providers/python_provider.py", line 468, in execute exec(fence_content, exec_globals, exec_locals) File "", line 1, in ModuleNotFoundError: No module named 'loom'

Store Stats

Overview of the edge store.

from loom.edges.store import get_store
from pathlib import Path

store = get_store()
stats = store.stats()
slugs = store.get_all_slugs()

print("## Edge Store\n")
print(f"**Root**: `{stats['root']}`\n")
print(f"| Metric | Value |")
print(f"|--------|-------|")
print(f"| Slugs | {stats['slugs']} |")
print(f"| Total Edges | {stats['total_edges']} |")
print(f"| Snapshots | {stats['total_snapshots']} |")
print(f"| Checkpoint Interval | {stats['checkpoint_interval']} |")

if slugs:
    print(f"\n### By Slug\n")
    print("| Slug | Edges | Snapshots |")
    print("|------|-------|-----------|")
    for slug in slugs:
        edges = store.get_edges(slug)
        snaps = store.list_snapshots(slug)
        print(f"| {slug} | {len(edges)} | {len(snaps)} |")

❌ Fence Execution Error: No module named 'loom' Traceback (most recent call last): File "/app/oculus/providers/python_provider.py", line 468, in execute exec(fence_content, exec_globals, exec_locals) File "", line 1, in ModuleNotFoundError: No module named 'loom'

Edge Files

Show files on disk.

from loom.edges.store import get_store
from pathlib import Path

store = get_store()
root = Path(store.root)

if not root.exists():
    print("*No edge store yet*")
else:
    print(f"## Files: `{root}`\n")
    for slug_dir in sorted(root.iterdir()):
        if slug_dir.is_dir():
            print(f"### {slug_dir.name}/")
            for f in sorted(slug_dir.rglob('*')):
                if f.is_file():
                    rel = f.relative_to(slug_dir)
                    size = f.stat().st_size
                    print(f"- `{rel}` ({size} bytes)")

❌ Fence Execution Error: No module named 'loom' Traceback (most recent call last): File "/app/oculus/providers/python_provider.py", line 468, in execute exec(fence_content, exec_globals, exec_locals) File "", line 1, in ModuleNotFoundError: No module named 'loom'

Single Edge

Show a single edge by ID.

from loom.edges.store import get_store

edge_id = config.get('edge_id')
slug = config.get('slug')

if not edge_id and not slug:
    print("*Provide `edge_id` or `slug` parameter*")
else:
    store = get_store()

    if edge_id:
        # Find edge by ID across all slugs
        for s in store.get_all_slugs():
            for e in store.get_edges(s):
                if e.edge_id.startswith(edge_id):
                    edge = e
                    break
    else:
        # Get latest edge for slug
        edges = store.get_edges(slug)
        edge = edges[-1] if edges else None

    if edge:
        print(f"## Edge: `{edge.edge_id[:12]}`\n")
        print(f"| Field | Value |")
        print(f"|-------|-------|")
        print(f"| Slug | {edge.coordinate.slug} |")
        print(f"| Operation | {edge.coordinate.operation} |")
        print(f"| Path | {edge.coordinate.path} |")
        print(f"| Time | {edge.timestamp[:19]} |")
        print(f"| Type | {edge.edge_type.value} |")

        print(f"\n### Before\n```\n{edge.snipped[0].get('content', '')[:500] if edge.snipped else 'N/A'}\n```")
        print(f"\n### After\n```\n{edge.spliced[0].get('content', '')[:500] if edge.spliced else 'N/A'}\n```")
    else:
        print(f"*Edge not found*")

❌ Fence Execution Error: No module named 'loom' Traceback (most recent call last): File "/app/oculus/providers/python_provider.py", line 468, in execute exec(fence_content, exec_globals, exec_locals) File "", line 1, in ModuleNotFoundError: No module named 'loom'

Provenance

Document

  • Status: 🔴 Unverified

Changelog

  • 2026-01-11 23:30: Node created by mcp - Creating loom edge tools as composable backing fences in the main Oculus graph

South

slots:
- context:
  - Linking AWS demo to loom-tools parent
  slug: aws-demo
- context:
  - Linking address grammar spec to loom-tools
  slug: loom-addressing
↓ southaws-demoloom-addressing