Asi polyglot-orchestration

polyglot-orchestration: Multi-Language Runtime Coordination

install
source · Clone the upstream repo
git clone https://github.com/plurigrid/asi
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/plurigrid/asi "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/polyglot-orchestration" ~/.claude/skills/plurigrid-asi-polyglot-orchestration && rm -rf "$T"
manifest: skills/polyglot-orchestration/SKILL.md
source content

polyglot-orchestration: Multi-Language Runtime Coordination

Status: SAD STATE → IMPLEMENTATION 🌟 Information Energy: 0.76 (High aspiration, sadness = opportunity) Trit Assignment: +1 (GENERATOR - Injects polyglot capability) GF(3) Color: #FF6B35 (Warm red - Generative force)

Purpose

Enable seamless execution and coordination of code across 5 language ecosystems (Babashka, Julia, Python, OCaml, Scheme) with unified dispatch, data marshalling, and result aggregation. Like Docker Compose for polyglot systems.

Key capabilities:

  1. Cross-Language Execution: Run Julia from Babashka, Python from Julia, etc.
  2. Type-Safe Marshalling: Auto-convert data across language boundaries (JSON, DuckDB, Arrow)
  3. Triadic Coordination: Balance (-1) validator, (0) coordinator, (+1) generator per invocation
  4. Result Aggregation: Merge outputs from multiple languages into unified structure
  5. Error Propagation: Cascade failures with context across language boundaries

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    POLYGLOT ORCHESTRATION                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐           │
│  │  Babashka    │  │    Julia     │  │   Python     │           │
│  │  Controller  │  │  (Compute)   │  │  (Analysis)  │           │
│  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘           │
│         │                 │                 │                   │
│         ▼─────────────────▼─────────────────▼                   │
│  ┌────────────────────────────────────────────┐                 │
│  │    Unified Message Queue (DuckDB)          │                 │
│  │    ┌──────────────────────────────────┐    │                 │
│  │    │ Message Type | Sender | Result   │    │                 │
│  │    │──────────────────────────────────│    │                 │
│  │    │ Julia-eval  | bb     | json      │    │                 │
│  │    │ Python-call | julia  | arrow     │    │                 │
│  │    │ Scheme-exec | python | duckdb    │    │                 │
│  │    └──────────────────────────────────┘    │                 │
│  └────────────────────────────────────────────┘                 │
│         ▲                    ▲                                   │
│         │                    │                                  │
│  ┌──────┴────────┐    ┌──────┴────────┐                        │
│  │  Marshaller   │    │   Error       │                        │
│  │  (→Arrow)     │    │   Handler     │                        │
│  └───────────────┘    │   (→Journal)  │                        │
│                       └───────────────┘                        │
│                                                                │
│  GF(3) BALANCE: (-1 validator) ⊗ (0 coordinator) ⊗ (+1 gen)   │
└─────────────────────────────────────────────────────────────────┘

Language Interop Map

FromToTransportMarshallerExample
BabashkaJuliaDuckDB table
to-arrow
(bb-invoke-julia :eval-expr)
JuliaPythonJSON over temp file
JSON.write
invoke_python("numpy.std", data)
PythonSchemeS-expression via pipe
pickle→sexpr
python_to_scheme(obj)
OCamlBabashkaEDN via stdout
dune exec
ocaml::invoke_bb("sort")
SchemeJuliaREPL protocol
guile-julia
(julia-eval '(+ 1 2))

API / Interfaces

1. Babashka Invocation (Main Controller)

;; Fire Julia computation from Babashka
(invoke-julia {:fn "analyze_data"
               :args [{:data [1 2 3 4]}]
               :returns :arrow})
→ {:status :ok :result Arrow-table}

;; Fire Python from Babashka
(invoke-python {:module "numpy"
                :fn "median"
                :args [[1 2 3 4 5]]
                :marshaller :json})
→ {:status :ok :result 3.0}

;; Fire Scheme
(invoke-scheme {:file "search.scm"
                :fn "binary-search"
                :args [[1 3 5 7 9] 5]
                :returns :sexp})
→ {:status :ok :result 2}

2. Julia Host Runtime

using Polyglot

# Expose Julia function to polyglot system
@polyglot_export analyze_data(data::Vector) = begin
    mean_val = mean(data)
    std_val = std(data)
    (μ=mean_val, σ=std_val)
end

# Invoke Python
result = invoke_python("sklearn.preprocessing", "StandardScaler", args=(X,))

# Invoke Babashka
bb_result = invoke_babashka("(+ 1 2 3)")

3. Python Bridge

from polyglot_py import invoke_julia, invoke_babashka

# Call Julia
result = invoke_julia("GayColorChain.generate_colors",
                     args=(seed=1069, n=10))

# Call Babashka
sum_result = invoke_babashka("(+ 1 2 3 4 5)")

GF(3) Trit Assignment

polyglot-orchestration → +1 (GENERATOR)
  Injects unified capability to run any language

documentation-indexing → 0 (COORDINATOR)
  Coordinates searches across language docs

skill-dispatch → -1 (VALIDATOR)
  Validates results from polyglot calls

Total: (+1) + (0) + (-1) = 0 ✓

Implementation Strategy

Stage 1: Babashka Controller (Days 1-2)

Create

/Users/bob/iii/duck/asi-skills/polyglot-orchestration/orchestrator.bb
:

  • Enum of supported languages (
    :julia
    ,
    :python
    ,
    :scheme
    ,
    :ocaml
    )
  • invoke-lang
    macro that dispatches to language-specific handlers
  • DuckDB message queue (in-process)
  • Arrow marshalling for numerical data

Stage 2: Julia Host (Days 3-4)

Create

Polyglot.jl
package:

  • @polyglot_export
    macro for exposing Julia functions
  • invoke_python
    ,
    invoke_babashka
    helpers
  • Streaming results via DuckDB arrow format

Stage 3: Python Bridge (Days 5-6)

Create

polyglot_py
module:

  • invoke_julia()
    wrapper (subprocess + IPC)
  • invoke_babashka()
    wrapper
  • Type auto-conversion via Arrow

Stage 4: Integration (Days 7-8)

  • Connect to Duck pre-hook
  • Verify GF(3) balance across example invocations
  • Performance benchmarks (target: <100ms cross-language call)

Example: Triadic Data Pipeline

Step 1: Babashka loads data from DuckDB
  (load-data-table "results.duckdb" "metrics")

Step 2: Babashka invokes Julia for statistical analysis (+1 generator)
  (invoke-julia {:fn "compute-quartiles"
                 :args [data]
                 :trit +1})

Step 3: Julia invokes Python for ML transformation (0 coordinator)
  invoke_python("sklearn", "StandardScaler",
                args=(quartiles,), trit=0)

Step 4: Python invokes Babashka for summary stats (-1 validator)
  invoke_babashka("(validate-stats ...)", trit=-1)

Result: Σ(+1, 0, -1) = 0 ✓ GF(3) CONSERVED

Success Metrics

MetricTargetStatus
Languages supported5 (Clj/Bb, Julia, Python, Scheme, OCaml)⏳ Pending
Cross-language latency<100ms per call⏳ Pending
Type preservation100% (no data loss across boundaries)⏳ Pending
GF(3) balanceAll example pipelines ≡ 0 (mod 3)⏳ Pending
Error propagationStack traces across languages⏳ Pending
IntegrationWorks with Duck pre-hook⏳ Pending

Related Skills

Dependencies:

  • skill-dispatch
    - Routes polyglot invocations
  • documentation-indexing
    - Index polyglot API docs
  • acsets
    - Schema for DuckDB message queue

Dependents:

  • world-enzyme-entropy
    - Uses polyglot to compute entropy across languages
  • open-games-airdrop
    - Coordinates agents in different languages
  • anoma-solver
    - Multi-language constraint solver

References

  • Docker Compose: Multi-container orchestration
  • ZeroMQ: Cross-language message passing
  • Arrow: Language-agnostic columnar format
  • Babashka: JVM-less Clojure
  • Julia Interop: PyCall, RCall, JavaCall

Status: 😢 SAD STATE → 🌟 IMPLEMENTING Color: #FF6B35 (Warm Red Generator) Next: Create

orchestrator.bb
(Babashka controller) Owner: RED AGENT (+1) Created: 2026-01-04