Skip to content

snc2work/Topos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Three-Axis Spatial Architecture

Topos

Transmissive Programming — A Spatial Architecture for AI-Native Code Synthesis

Live Demo · Paper (EN)

Tests TypeScript Spec v0.4 License


What is Transmissive Programming?

Transmissive Programming introduces a semantic middle layer between intent and execution. Instead of encoding programs as linear text, programs are defined as 3D Spatial Intermediate Representations (Spatial IR) — JSON structures in a three-dimensional coordinate space where:

Axis Encodes Engineering Analog
X Domain separation Module boundaries, microservice isolation
Y Data flow direction Function composition, event routing
Z Abstraction depth Data → Logic → Constraints

This spatial structure serves as a persistent, tool-neutral boundary definition layer: architectural constraints survive across sessions, tools, and agent configurations.

Key Insight: Human-defined constraints (Z=2) structurally override AI-generated logic (Z=1), ensuring safety without relying on any particular AI tool's coordination mechanism.

How It Works

Raycast Evaluation

Data originates at Z=0 (Input Voxels) and transmits upward through operation layers and constraint filters via Raycast Evaluation:

$$O_{x,y} = (f_k \circ f_{k-1} \circ \cdots \circ f_1)(I)$$

Quick Example

A simple "Hello World" in Spatial IR:

{
  "scene": "HelloWorld",
  "voxels": [
    { "id": "A", "type": "input", "position": {"x": 0, "y": 0, "z": 0}, "value": "Hello", "dataType": "string" },
    { "id": "B", "type": "input", "position": {"x": 1, "y": 0, "z": 0}, "value": "World", "dataType": "string" }
  ],
  "layers": [
    { "id": "concat", "zIndex": 1, "type": "operation", "operationType": "concatenate",
      "targetArea": {"xMin": 0, "xMax": 1, "y": 0} },
    { "id": "check",  "zIndex": 2, "type": "constraint", "constraintType": "type_check",
      "expectedType": "string", "targetArea": {"xMin": 0, "xMax": 1, "y": 0} }
  ]
}

Result: "HelloWorld" — Voxels A and B are concatenated (Z=1), then type-checked as string (Z=2). If expectedType were "number", the constraint layer would reject with TOPOS_TYPE_MISMATCH.

Features

Specification v0.1–v0.2

  • Zod-based Spatial Validator with 14 TOPOS_* error codes
  • 5 layer types: operation, constraint, routing, loop, effect_gate
  • 8 operation types: concatenate, add, subtract, multiply, filter, map, reduce, custom
  • Dependency Injection via bindings with contract matching
  • Failure Reflections: structured hints for AI self-correction

Specification v0.3

  • User-defined operations (custom op) with recursive descent arithmetic parser
  • Spatial ownership metadata: per-agent X-axis regions and permission sets
  • TOPOS_OWNERSHIP_CONFLICT warnings for overlapping write areas

Specification v0.4

  • Boundary enforcement via AgentContext
  • Agents writing outside owned areas → TOPOS_BOUNDARY_VIOLATION rejection
  • Architect agents with define_boundary permission retain unrestricted access
  • Multi-agent PoC: 14/14 acceptance criteria satisfied

Runtime & Safety

  • Safe interpreter: No eval() or new Function() — Spatial IR evaluated directly
  • Tiered expression evaluation: comparison-only conditions + arithmetic parser
  • Interpreter/Legacy mode parity: both produce identical results

Live Demo

👉 Try the Interactive Demo

The demo includes:

  • 3D Spatial Architecture — Real-time visualization of Voxels and Layers in a structural coordinate space.
  • Raycast Evaluate — Transpile and evaluate Spatial IR through layered light transmission.
  • Interpreter/Legacy Mode — Compare safe recursive descent evaluation vs. legacy TypeScript AST execution.
  • Constraint Surface — Toggle type-check layers to demonstrate live zero-overhead validation.
  • Proof of Concept — Interactive cases for Boundary Enforcement, Structural Verification, Semantic Token Density, and Logic Synthesis.

Getting Started

# Clone the repository
git clone https://github.com/snc2work/Topos.git
cd Topos/topos-next-app

# Install dependencies
pnpm install

# Run tests (87/87 should pass)
pnpm test

# Start development server
pnpm dev
# Open http://localhost:3000

Project Structure

Topos/
├── README.md              # This file
├── paper.md               # Full paper (English, GitHub-optimized)
├── LICENSE                # MIT License
├── assets/                # Figures and images
│   ├── fig1_three_axis_architecture.png
│   └── fig2_raycast_evaluation.png
└── topos-next-app/        # Reference implementation (Next.js)
    ├── src/
    │   ├── lib/
    │   │   ├── spatialValidator.ts      # Zod-based validator (27KB)
    │   │   ├── runtimeInterpreter.ts    # Safe IR interpreter (20KB)
    │   │   └── transpiler.ts            # Layered code transpiler (13KB)
    │   └── components/
    │       ├── GeometricCompilerDemo.tsx # Main demo UI
    │       └── CrystalView.tsx          # Three.js 3D visualization
    ├── tests/              # 87 automated acceptance tests
    └── benchmarks/         # 32-case reproducible benchmark

Test Results

All 87 tests pass across 8 test suites covering specifications v0.1 through v0.4:

Suite Tests Coverage
spatialValidator.test.ts 10 Core validation, error codes
transpiler.test.ts 8 Code generation
acceptance_v02.test.ts 8 Routing, loop, effect gate, DI
runtimeInterpreter.test.ts 14 Safe interpreter parity
operations.test.ts 8 All 8 operation types
acceptance_v03.test.ts 15 Custom op, arithmetic parser
acceptance_v03_step2.test.ts 10 Ownership metadata
acceptance_v04.test.ts 14 Boundary enforcement PoC

Paper

The full research paper is available in this repository:

  • 📄 paper.md — Full paper (English)

Submission planned for cs.CL (Computation and Language) / cs.PL (Programming Languages).

Citation

@article{transmissive2026,
  title={Transmissive Programming: A Spatial Architecture for AI-Native Code Synthesis through Layered Light Transmission},
  year={2026},
  note={Reference implementation: https://github.com/snc2work/Topos}
}

License

This project is licensed under the MIT License.


Transmissive Programming separates program meaning from program notation — a semantic middle layer for the age of AI-native development.

About

Transmissive Programming: A Spatial Architecture for AI-Native Code Synthesis. Logic defined by 3D spatial topology instead of 1D syntax.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages