Skip to content
parametrised-optics-cybernetics logo

Parametrised Optics for Cybernetic Systems

parametrised-optics-cybernetics

Parametrised optics model cybernetic systems - dynamical systems steered by agents. ⊛ represents agency exerted on systems. Connects Para(C), lenses, open games, and PCT.

plurigrid/asi0installs67stars

SKILL.md

Full skill instructions

Parametrised Optics for Cybernetic Systems

Status: Production Ready Trit: 0 (ERGODIC - mediates agent↔system) Color: #25D09C

"Parametrised optics model cybernetic systems, namely dynamical systems steered by one or more agents. Then ⊛ represents agency being exerted on systems." — Capucci, Gavranović et al.

Core Structure

The ⊛ Action (Agency)

        ┌─────────────────────────────────────┐
        │         CYBERNETIC SYSTEM           │
        │                                     │
   P ───┼──⊛──▶ S ────────▶ S'               │
(params)│      (state)    (next state)        │
        │        │                            │
        │        ▼                            │
        │    observation ◀── environment      │
        │        │                            │
        │        ▼                            │
        │   P' ◀─┘ (updated params)           │
        └─────────────────────────────────────┘

The actegory action ⊛ : P × S → S means:

  • P (parameters/​policy) = agent's controllable degrees of freedom
  • S (state) = system being controlled
  • ⊛ = agency exerted: parameters steer the system

Para Construction

-- Para(C) is the category of parametrised morphisms in C
data Para c a b where
  Para :: c p () -> c (p, a) b -> Para c a b

-- Composition via tensor product of parameters
(>>>) :: Para c a b -> Para c b d -> Para c a d
Para p f >>> Para q g = Para (p ⊗ q) (f ; (id ⊗ g))

In Poly (polynomial functors):

Para(Poly) ≅ Lens    -- parametrised polynomial = lens

Lens as Bidirectional Control

        get
    S ────────▶ A        (observation)
    │           │
    │    set    │
    ◀───────────┘        (action)
    S'    ◀── (S, B)

A lens Lens S A has:

  • get : S → A — observe part of state
  • set : S × A → S — update state with new value

A parametrised lens PLens P S A:

  • get : P × S → A — observation depends on parameters
  • set : P × S × A → S — action depends on parameters

Connection to Powers PCT

The hierarchical control from Powers maps directly:

PCT LevelPara/​OpticRole
Level 5: ProgramPara policyAgent's high-level goal
Level 4: TransitionLens trajectorySequence patterns
Level 3: ConfigurationLens relationshipsRelational state
Level 2: SensationLens perceptIndividual observations
Level 1: IntensityLens intensityRaw signal strength

PCT as Parametrised Optic

-- Perceptual Control Theory as Para
pctController :: Para C Reference Perception
pctController = Para policy controlLoop
  where
    controlLoop (ref, percept) =
      let error = ref - percept
          action = gain * error
      in applyAction action percept

Open Games Connection

Open games (Hedges) are parametrised optics for strategic interaction:

       ┌─────────────────┐
   X ──┤                 ├──▶ Y     (play)
       │   Open Game G   │
   R ◀─┤                 │◀── S     (coutility)
       └─────────────────┘

An open game G : (X, S) → (Y, R) has:

  • Play: X → Y (forward: strategy → outcome)
  • Coplay: X × S → R (backward: utility propagation)

This is exactly a parametrised optic where:

  • Parameters = strategies
  • ⊛ = strategic interaction
  • Backward pass = utility/​gradient flow

Nash Equilibria via Optics

-- Nash equilibrium = fixed point of best response
nashEquilibrium :: OpenGame X S Y R -> X -> Bool
nashEquilibrium game strategy =
  bestResponse game strategy == strategy

ALIEN Screenshot Interpretation

The ALIEN simulation shows this structure:

┌─────────────────────────────────────────────────────────┐
│  NEURAL TOPOLOGY (center)     │  MATRIX RAIN (right)    │
│  ════════════════════════     │  ═══════════════════    │
│                               │                         │
│  ●───●───●───●                │  Activity transcript    │
│  │ ╲ │ ╱ │ ╲ │                │  = feedback signals     │
│  ●───●───●───●   ◀──P (params)│  = utility gradients    │
│  │ ╱ │ ╲ │ ╱ │                │  = error propagation    │
│  ●───●───●───●                │                         │
│       │                       │                         │
│       ▼                       │                         │
│   S (state) ──⊛──▶ S'         │                         │
│                               │                         │
└─────────────────────────────────────────────────────────┘
  • Neural nodes = parametrised lenses into creature state
  • Connections = composition of optics
  • Matrix rain = backward pass (coplay/​utility/​gradients)
  • ⊛ action = creatures exerting agency on environment

Formal Definition

Parametrised Optic

Given a monoidal category (M, ⊗, I) acting on C via ⊛:

ParaOptic M C (S, S') (A, A') = ∫^P M(I, P) × C(P ⊛ S, A) × C(P ⊛ A', S')

This coend captures:

  • Parameters P from the monoidal category M
  • Forward map P ⊛ S → A (observation under parameters)
  • Backward map P ⊛ A' → S' (update under parameters)

Actegory

An actegory is a category C with an action ⊛ : M × C → C satisfying:

  • I ⊛ X ≅ X (identity acts trivially)
  • (P ⊗ Q) ⊛ X ≅ P ⊛ (Q ⊛ X) (associativity)

Agency = choosing P to steer X.

GF(3) Triads

open-games (-1) ⊗ parametrised-optics (0) ⊗ gay-mcp (+1) = 0 ✓
powers-pct (-1) ⊗ parametrised-optics (0) ⊗ alife (+1) = 0 ✓
lens-bidirectional (-1) ⊗ parametrised-optics (0) ⊗ active-inference (+1) = 0 ✓

Code Examples

Haskell (Optics)

{-# LANGUAGE GADTs #-}

-- Parametrised lens
data PLens p s a = PLens
  { pget :: p -> s -> a
  , pset :: p -> s -> a -> s
  }

-- Composition
(|.|) :: PLens p s a -> PLens p a b -> PLens p s b
(PLens g1 s1) |.| (PLens g2 s2) = PLens
  { pget = \p s -> g2 p (g1 p s)
  , pset = \p s b -> s1 p s (s2 p (g1 p s) b)
  }

-- Cybernetic control loop
controlLoop :: PLens Policy State Observation -> State -> State
controlLoop lens state =
  let obs = pget lens policy state
      err = reference - obs
      action = gain * err
  in pset lens policy state (obs + action)

Julia (ACSets)

using Catlab, Catlab.CategoricalAlgebra

# Schema for parametrised optic
@present SchParaOptic(FreeSchema) begin
  Param::Ob
  State::Ob
  Obs::Ob

  # Forward: P ⊛ S → A
  forward::Hom(Param ⊗ State, Obs)

  # Backward: P ⊛ A' → S'
  backward::Hom(Param ⊗ Obs, State)

  # Action composition
  compose::Hom(Param ⊗ Param, Param)
end

@acset_type ParaOptic(SchParaOptic)

Python (Open Games)

from dataclasses import dataclass
from typing import Callable, TypeVar

P, S, A, R = TypeVar('P'), TypeVar('S'), TypeVar('A'), TypeVar('R')

@dataclass
class OpenGame:
    """Parametrised optic for strategic interaction."""
    play: Callable[[P, S], A]      # Forward: strategy → outcome
    coplay: Callable[[P, S, R], R]  # Backward: utility propagation

    def compose(self, other: 'OpenGame') -> 'OpenGame':
        """Sequential composition via ⊛."""
        return OpenGame(
            play=lambda p, s: other.play(p, self.play(p, s)),
            coplay=lambda p, s, r: self.coplay(p, s, other.coplay(p, self.play(p, s), r))
        )

    def tensor(self, other: 'OpenGame') -> 'OpenGame':
        """Parallel composition via ⊗."""
        return OpenGame(
            play=lambda p, s: (self.play(p[0], s[0]), other.play(p[1], s[1])),
            coplay=lambda p, s, r: (self.coplay(p[0], s[0], r[0]),
                                     other.coplay(p[1], s[1], r[1]))
        )

Integration with Gay.jl

using Gay

# Seed for cybernetic color palette
gay_seed!(0xCYBER)

# Hierarchical control colors
CYBERNETIC_COLORS = Dict(
    :agent     => color_at(1),  # Parameters
    :system    => color_at(2),  # State
    :forward   => color_at(3),  # Observation
    :backward  => color_at(4),  # Utility/​gradient
)

# ⊛ action visualization
function visualize_agency(params, state, action)
    p_color = CYBERNETIC_COLORS[:agent]
    s_color = CYBERNETIC_COLORS[:system]
    # Blend represents ⊛ application
    result_color = blend(p_color, s_color, action.intensity)
    return result_color
end

References

  1. Capucci, M. - "Seeing Double Through Dependent Optics"
  2. Gavranović, B. - "Categorical Foundations of Gradient-Based Learning"
  3. Hedges, J. - "Compositionality and String Diagrams for Game Theory"
  4. Powers, W.T. - "Behavior: The Control of Perception" (1973)
  5. Riley, M. - "Categories of Optics"
  6. Spivak, D.I. - "Poly: An Abundant Categorical Setting"

Related Skills

SkillTritConnection
open-games-1Strategic optics
glass-hopping0Bridge navigation
cats-for-ai0CT for ML
powers-pct-1Hierarchical control
active-inference+1Free energy minimization
alife+1Agency in simulation

Skill Name: parametrised-optics-cybernetics Type: Categorical Framework / Cybernetics Trit: 0 (ERGODIC - bridges agent and system) Key Operator: ⊛ (actegory action = agency) Structure: Para(C) with lenses and open games


Autopoietic Marginalia

The interaction IS the skill improving itself.

Every use of this skill is an opportunity for worlding:

  • MEMORY (-1): Record what was learned
  • REMEMBERING (0): Connect patterns to other skills
  • WORLDING (+1): Evolve the skill based on use

Add Interaction Exemplars here as the skill is used.

Para(Optic) atlas

Part of: para-mensch-commons.

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