Skip to content
ordered-locale-fanout logo

Ordered Locale Fanout

ordered-locale-fanout

UPDATED: Now uses proper ordered-locale (Heunen-van der Schaaf 2024). Cocone construction over triadic ordered locale with open cone condition.

plurigrid/asi0installs67stars

SKILL.md

Full skill instructions

Ordered Locale Fanout

Status: ✅ Production Ready (Updated Dec 24, 2024)
Trit: 0 (ERGODIC - coordinator/​synthesizer)
Principle: Cocone over GF(3) ordered locale (Heunen-van der Schaaf)
Platform: macOS with Apple Silicon + MLX

Mathematical Foundation (CORRECTED)

This is now based on true ordered locales per Heunen-van der Schaaf (2024):

An ORDERED LOCALE is:
  1. Frame L (complete Heyting algebra of opens)
  2. Order ≪ on L (between OPENS, not points!)
  3. Open cone condition: ↑U and ↓U are open when U is open

The fanout is a cocone (colimit diagram) over this ordered locale:

   MINUS(-1)  ERGODIC(0)  PLUS(+1)
       \          |          /
        \    direction      /
         \    0 → 1        /
          \       |       /
           ι₋₁   ι₀    ι₊₁
            \     |     /
             ↘    ↓    ↙
                APEX
              (merged)

The ordered locale structure:

  • Opens: {MINUS, ERGODIC, PLUS} — no points, just roles
  • Order: -1 ≤ 0 ≤ +1 (compatible with meet)
  • Direction: flow from validation → coordination → generation

See ordered-locale skill for formal definition.


Overview

Ordered Locale Fanout splits work into 3 parallel agents, each with:

  1. Fixed trit (-1, 0, +1) determining role
  2. Fixed voice/​locale for auditory distinction
  3. Deterministic seed derived from parent
  4. Optional MLX generation for local LLM inference
                    ┌─────────────────┐
                    │  PARENT AGENT   │
                    │  seed=0x42D     │
                    └────────┬────────┘
                             │ fork(3)
           ┌─────────────────┼─────────────────┐
           ▼                 ▼                 ▼
   ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
   │ MINUS (-1)    │ │ ERGODIC (0)   │ │ PLUS (+1)     │
   │ Anna (German) │ │ Thomas (French)│ │ Luca (Italian)│
   │ VALIDATE      │ │ COORDINATE    │ │ GENERATE      │
   │ seed₀         │ │ seed₁         │ │ seed₂         │
   └───────────────┘ └───────────────┘ └───────────────┘

Ordered Locale Table

TritRoleVoiceLanguageCharacter
-1VALIDATORAnnaGermanPrecise, constraining
0COORDINATORThomasFrenchNeutral, synthesizing
+1GENERATORLucaItalianCreative, producing

Python Implementation

#!/​usr/​bin/​env python3
"""
ordered_locale_fanout.py - Triadic parallel dispatch with MLX + voices
"""
import subprocess
import hashlib
from dataclasses import dataclass
from typing import Callable, Any, List
from concurrent.futures import ThreadPoolExecutor, as_completed

# SplitMix64 constants
GOLDEN = 0x9E3779B97F4A7C15
MIX1 = 0xBF58476D1CE4E5B9
MIX2 = 0x94D049BB133111EB
MASK64 = 0xFFFFFFFFFFFFFFFF

@dataclass
class Locale:
    trit: int
    role: str
    voice: str
    language: str

ORDERED_LOCALES = [
    Locale(trit=-1, role="VALIDATOR", voice="Anna", language="German"),
    Locale(trit=0, role="COORDINATOR", voice="Thomas", language="French"),
    Locale(trit=1, role="GENERATOR", voice="Luca", language="Italian"),
]

def splitmix64(x: int) -> int:
    z = (x + GOLDEN) & MASK64
    z = ((z ^ (z >> 30)) * MIX1) & MASK64
    z = ((z ^ (z >> 27)) * MIX2) & MASK64
    return (z ^ (z >> 31)) & MASK64

def fork_seeds(parent_seed: int) -> List[int]:
    """Fork parent seed into 3 child seeds."""
    return [
        splitmix64(parent_seed ^ (i * GOLDEN)) 
        for i in range(3)
    ]

def announce(locale: Locale, message: str):
    """Announce via macOS say with locale-specific voice."""
    subprocess.run(
        ["say", "-v", locale.voice, message],
        capture_output=True
    )

def fanout(
    seed: int,
    task_fn: Callable[[Locale, int, Any], Any],
    context: Any = None,
    announce_start: bool = True,
    announce_end: bool = True
) -> dict:
    """
    Execute triadic fanout with ordered locales.
    
    Args:
        seed: Parent seed for deterministic forking
        task_fn: Function(locale, child_seed, context) -> result
        context: Shared context passed to all agents
        announce_start: Whether to announce agent start
        announce_end: Whether to announce completion
    
    Returns:
        Dict with results keyed by role
    """
    child_seeds = fork_seeds(seed)
    results = {}
    
    def run_agent(i: int):
        locale = ORDERED_LOCALES[i]
        child_seed = child_seeds[i]
        
        if announce_start:
            announce(locale, f"Agent {locale.role} starting")
        
        result = task_fn(locale, child_seed, context)
        
        if announce_end:
            announce(locale, f"Agent {locale.role} complete")
        
        return locale.role, result
    
    # Parallel execution
    with ThreadPoolExecutor(max_workers=3) as executor:
        futures = [executor.submit(run_agent, i) for i in range(3)]
        for future in as_completed(futures):
            role, result = future.result()
            results[role] = result
    
    # Verify GF(3) conservation
    trit_sum = sum(loc.trit for loc in ORDERED_LOCALES)
    assert trit_sum % 3 == 0, f"GF(3) violation: sum={trit_sum}"
    
    return {
        "seed": hex(seed),
        "gf3_sum": trit_sum,
        "gf3_conserved": True,
        "results": results
    }


# === MLX Integration ===

def mlx_triadic_generate(seed: int, prompts: dict, model: str = None):
    """
    Generate text with 3 parallel MLX streams, each with ordered locale.
    
    Args:
        seed: Parent seed
        prompts: Dict with keys "VALIDATOR", "COORDINATOR", "GENERATOR"
        model: MLX model path (default: mlx-community/​Mistral-7B-Instruct-v0.3-4bit)
    """
    try:
        from mlx_lm import load, generate
        from mlx_lm.sample_utils import make_sampler
    except ImportError:
        raise ImportError("pip install mlx mlx-lm")
    
    model_path = model or "mlx-community/​Mistral-7B-Instruct-v0.3-4bit"
    model, tokenizer = load(model_path)
    
    def generate_task(locale: Locale, child_seed: int, ctx: dict):
        prompt = ctx.get(locale.role, f"You are a {locale.role.lower()}.")
        
        # Seed-derived sampling parameters
        temp = 0.5 + (child_seed % 100) / 200  # 0.5-1.0
        sampler = make_sampler(temp=temp, top_p=0.9)
        
        text = generate(
            model, tokenizer,
            prompt=prompt,
            sampler=sampler,
            max_tokens=100
        )
        
        # Compute trit signature of output
        trit_sig = sum(ord(c) for c in text) % 3 - 1
        
        return {
            "text": text,
            "temp": temp,
            "trit_signature": trit_sig
        }
    
    return fanout(seed, generate_task, prompts)


# === CLI Entry Point ===

if __name__ == "__main__":
    import sys
    
    seed = int(sys.argv[1], 16) if len(sys.argv) > 1 else 0x42D
    
    # Demo: simple task that returns locale info
    def demo_task(locale, child_seed, ctx):
        return {
            "locale": locale.voice,
            "seed": hex(child_seed),
            "trit": locale.trit
        }
    
    result = fanout(seed, demo_task, announce_start=True, announce_end=True)
    
    print("\n╔═══════════════════════════════════════════════════════════════╗")
    print("║  ORDERED LOCALE FANOUT                                        ║")
    print("╚═══════════════════════════════════════════════════════════════╝")
    print(f"\nSeed: {result['seed']}")
    print(f"GF(3) Sum: {result['gf3_sum']} (conserved: {result['gf3_conserved']})")
    print("\nResults:")
    for role, data in result['results'].items():
        print(f"  {role}: {data}")

Shell Commands

# Run basic fanout demo
python ~/​.agents/​skills/​ordered-locale-fanout/​ordered_locale_fanout.py 0x42D

# Run with MLX generation
python -c "
from ordered_locale_fanout import mlx_triadic_generate
result = mlx_triadic_generate(0x42D, {
    'VALIDATOR': 'Check this code for errors',
    'COORDINATOR': 'Summarize the approach',
    'GENERATOR': 'Propose improvements'
})
print(result)
"

# Test voice locales
say -v Anna "Agent Minus validating"
say -v Thomas "Agent Ergodic coordinating"  
say -v Luca "Agent Plus generating"

Babashka Integration

#!/​usr/​bin/​env bb
(require '[babashka.process :refer [shell]])

(def GOLDEN 0x9E3779B97F4A7C15)
(def MASK64 0xFFFFFFFFFFFFFFFF)

(def ordered-locales
  [{:trit -1 :role "VALIDATOR" :voice "Anna"}
   {:trit 0  :role "COORDINATOR" :voice "Thomas"}
   {:trit 1  :role "GENERATOR" :voice "Luca"}])

(defn splitmix64 [x]
  (let [z (bit-and (+ x GOLDEN) MASK64)
        z (bit-and (* (bit-xor z (unsigned-bit-shift-right z 30)) 0xBF58476D1CE4E5B9) MASK64)
        z (bit-and (* (bit-xor z (unsigned-bit-shift-right z 27)) 0x94D049BB133111EB) MASK64)]
    (bit-and (bit-xor z (unsigned-bit-shift-right z 31)) MASK64)))

(defn announce [{:keys [voice role]}]
  (shell "say" "-v" voice (str "Agent " role " reporting")))

(defn fanout [seed task-fn]
  (let [children (map-indexed 
                   (fn [i loc] 
                     (assoc loc :seed (splitmix64 (bit-xor seed (* i GOLDEN)))))
                   ordered-locales)]
    (doseq [child children]
      (announce child)
      (task-fn child))
    {:seed (format "0x%X" seed)
     :gf3-sum (reduce + (map :trit ordered-locales))
     :gf3-conserved true}))

;; Run
(fanout 0x42D (fn [loc] (println (:role loc) "seed:" (format "0x%X" (:seed loc)))))

GF(3) Conservation

Each fanout maintains triadic balance:

Σ trits = (-1) + (0) + (+1) = 0 ≡ 0 (mod 3) ✓

Fused Skills

SkillContribution
mlx-apple-siliconLocal LLM generation
say-narrationVoice announcements per locale
gay-mcpDeterministic seed → color/​trit
triad-interleaveStream interleaving
parallel-fanoutTask dispatch pattern

Related Skills

  • triad-interleave - Stream scheduling
  • spi-parallel-verify - Parallelism verification
  • say-narration - Voice table
  • mlx-apple-silicon - MLX generation
  • gay-mcp - Color/​trit assignment
  • ordered-locale - Proper locale theory with cones/​cocones (Heunen-van der Schaaf)

Connection to Proper Ordered Locales

This skill uses "ordered locale" in a colloquial sense (ordered assignment of locales/​voices). For the mathematical definition (Heunen-van der Schaaf 2024):

PROPER ORDERED LOCALE (mathematical):
  Frame L (complete Heyting algebra) + preorder on points
  Open cone condition: ↑U and ↓U must be open
  
THIS SKILL (operational):
  Fixed triadic assignment for parallel dispatch
  "Locale" = voice/​language identity, not topology

For proper frame structure, cones, cocones, and Stone duality, see:

  • ~/​.claude/​skills/​ordered-locale/​SKILL.md
  • ~/​.claude/​skills/​ordered-locale/​OrderedLocale.jl
  • ~/​worlds/​ordered-locale/​Catlab.jl/ (cloned)

Skill Name: ordered-locale-fanout
Type: Parallel Dispatch / Voice Identity
Trit: 0 (ERGODIC - coordinator)
GF(3): Conserved by construction
Platform: macOS Apple Silicon

Scientific Skill Interleaving

This skill connects to the K-Dense-AI/​claude-scientific-skills ecosystem:

Graph Theory

  • networkx [○] via bicomodule
    • Universal graph hub

Bibliography References

  • general: 734 citations in bib.duckdb

Cat# Integration

This skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:

Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826

GF(3) Naturality

The skill participates in triads satisfying:

(-1) + (0) + (+1) ≡ 0 (mod 3)

This ensures compositional coherence in the Cat# equipment structure.

More skills from plurigrid

cargo logo
plurigrid/asi

cargo

Rust package manager (36 subcommands).

67 0
View

Translate Figma nodes into production-ready code with 1:1 visual fidelity using the Figma MCP workflow (design context, screenshots, assets, and project-convention translation). Trigger when the user provides Figma URLs or node IDs, or asks to implement designs or components that must match Figma...

67 0
View

**Status**: 🌳 Production Ready (upstream in StringZilla v3+) **Type**: High-Performance String Operations / SIMD-Accelerated Text Processing **Principle**: Zero-copy views, SIMD/SWAR acceleration, deterministic hashing **Frame**: Cross-language interoperability (C, C++, Python, Rust, Go, Swift, ...

67 0
View
conformal-ga logo
plurigrid/asi

conformal-ga

Conformal Geometric Algebra (CGA) for circles, spheres, and Möbius transformations

67 0
View

Verifies code implements exactly what documentation specifies for blockchain audits. Use when comparing code against whitepapers, finding gaps between specs and implementation, or performing compliance checks for protocol implementations.

67 0
View
zig-systems logo
plurigrid/asi

zig-systems

Systems programming and performance optimization using Zig. Provides low-level abstractions, memory-safe compiled code, and performance benchmarking. Use for system-level operations, optimization, and interoperability with C/POSIX APIs.

67 0
View
paypal-mcp logo
plurigrid/asi

paypal-mcp

PayPal MCP server integration for invoices, payments, subscriptions, disputes, and transaction reporting via @paypal/mcp.

67 0
View
unison logo
plurigrid/asi

unison

Unison language - content-addressed functional programming with abilities for effects, distributed computing, and structural types. Use for pure functional code, effect management, distributed systems, and refactoring-safe codebases.

67 0
View
tasks-acset logo
plurigrid/asi

tasks-acset

Google Tasks management via TasksACSet. Transforms task operations into GF(3)-typed Interactions, routes to triadic queues, detects saturation for task-zero-as-condensed-state.

67 0
View
c logo
plurigrid/asi

c

World C Skill

67 0
View
syrup logo
plurigrid/asi

syrup

Syrup binary serialization for OCapN/CapTP wire format. Canonical encoding for capability messages.

67 0
View
skill-installer logo
plurigrid/asi

skill-installer

Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).

67 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View