lantern

wanderland-isa

Wanderland ISA

The Universal Instruction Set Architecture for Markdown Content

Vision

A three-operation interface that provides uniform access to all content types within markdown documents:

What Actually Executes

A clarification on the structural isomorphism:

The prose itself doesn't execute. What does the work:

Layer What It Is What It Does
Prose Serialization format Human-readable representation that maps 1:1 to executable structure
Graph The program Nodes, edges, topology - the actual structure that gets traversed
Navigation Execution flow Moving through the graph IS running the program
Fences Functions The code blocks that actually compute
Peek/Poke I/O primitives Reading and writing values at paths
What you write:     Markdown with headings, fences, links
What it becomes:    Graph with nodes, executable blocks, edges
What executes:      The graph, via navigation and fence invocation

The insight isn't "prose runs."

The insight is: prose structure and graph structure are isomorphic, so you can use prose as source code for a graph runtime.

  • The prose is the source
  • The graph is the program
  • Navigation is the interpreter

The structural isomorphism thesis holds not because prose magically executes, but because the mapping between prose topology and graph topology is direct enough that writing prose IS writing the graph.

See: [[structural-isomorphism-thesis]], [[anas-pattern-engine]]

peek(path)                    → Read state/data
poke(path, value, mode)       → Write with operation mode
execute(path, method, args)   → Invoke behavior

This ISA works across YAML configs, JSON data, prose sections, code fences, and virtual fences (detected patterns like TODO lists).

Fence Types

Data Fences (YAML, JSON)

Capabilities: peek, poke

# Example YAML fence
config:
  service: test-service
  version: 1.0.0
  settings:
    debug: true
    timeout: 30

Operations:

  • peek("config.service")"test-service"
  • poke("config.version", "2.0.0", mode="set") → Updates version
  • poke("config.settings.max_retries", 3, mode="set") → Adds new field

Prose as First-Class Virtual Fence

Capabilities: peek, poke

Key Insight: Prose is the "anonymous object" in graph nodes - all text outside of fences. The prose provider makes it addressable and manipulable with the same poke semantics as any other fence type.

## Results

Test execution completed successfully.

Virtual Fence Pattern: When the poke engine can't find a matching fence in a section, it treats the section's prose content as a virtual fence with type='prose' and routes to the prose provider.

Operations:

  • peek("Results") → Returns prose content (direct children only)
  • poke("Results", "New content", mode="set") → Replaces entire prose section
  • poke("Results", "\n### Additional Notes", mode="append") → Appends content before next heading/fence
  • poke("Results", "> **Important**: ...", mode="prepend") → Prepends content right after section heading
  • poke("Results", "Content", mode="insert_after:subsection") → Insert after specific subsection
  • poke("Results", "Content", mode="insert_before:subsection") → Insert before specific subsection

Note:

  • peek returns direct prose only, not nested subsections
  • Prose operations are markdown-aware and preserve document structure
  • Provider implementation: /Users/graemefawcett/org/services/oculus-api/oculus/prose_provider.py
## Results

Test execution completed successfully.

Operations:

  • peek("Results") → Returns prose content (direct children only)
  • poke("Results", "New content", mode="set") → Replaces section
  • poke("Results", "\\n### Additional Notes", mode="append") → Appends subsection
  • poke("Results", "> **Important**: ...", mode="prepend") → Prepends content

Note: peek returns direct prose only, not nested subsections.

Code Fences

Capabilities: peek, poke, execute

#!/usr/bin/env python3
def hello_world():
    print("Hello from poke-peek-test!")
    return True

Operations:

  • peek("test-script.py") → Returns code as string
  • poke("test-script.py", new_code, mode="set") → Replaces code
  • execute("test-script.py", "run") → Executes the script
  • execute("test-script.py::hello_world", "call") → Calls specific function

Virtual Fences

Capabilities: peek, poke, execute

Detected patterns treated as stateful objects:

- [ ] Task one
- [x] Task two [priority:high]

Operations:

  • peek() → Returns structured state (items, counts, metadata)
  • poke("items[0].content", "New text") → Updates task content
  • execute("add", {content: "Task three"}) → Invokes fence behavior

Key Insight: Virtual fences are detected from AST patterns, not declared. They expose state and behavior beyond the markdown syntax.

API Endpoints

HTTP API

GET    /api/oculus/peek/{slug}?path=...
POST   /api/oculus/poke/{slug}
  body: {path, value, mode}
POST   /api/oculus/execute/{slug}
  body: {path, method, args}

CLI

oculus peek poke-peek-test config.version
oculus poke poke-peek-test config.version "2.0.0" --mode=set
oculus execute daily-scratchpad --fence-index=9 --action=add --params='{"content":"New task"}'

MCP Tools

mcp__wanderland__oculus_peek({slug, path})
mcp__wanderland__oculus_poke({slug, path, value, mode})
// Virtual fence execute via separate endpoint

Implementation Architecture

AST Token Manipulation

All operations work through markdown-it AST:

  • Parse markdown → tokens
  • Detect fences via pattern matching
  • Manipulate tokens (insert, update, remove)
  • Serialize tokens → markdown
  • Write to file

This preserves markdown structure while enabling structured operations.

Fence Registry

Each fence type implements:

class FenceBase:
    @classmethod
    def detect(cls, tokens, index) -> Optional[Dict]
    
    def render(self) -> Dict  # For peek
    def execute(self, action, params) -> Dict
    def emit(self) -> str  # Serialize back to markdown

Virtual fences add state extraction from detected patterns.

References

  • Detective Case: task-0ad4c2bf-d87e-4972-85ca-a5695e977f74 - ISA design documentation
  • Implementation: /Users/graemefawcett/org/services/oculus-api/oculus/
  • Web Component: /Users/graemefawcett/org/stuffy-poc/public/vendor/components/wonderland/wonderland-todo-list.js

Slots

North

slots: []

South

slots: []

East

slots:
- slug: workflow-compiler-architecture-proposal
  context: []

West

slots:
- slug: virtual-fences
  context: []