Agent Skills: Superelastic Quotient

Superelastic skills with maximum quotienting resolution for spatial decomposition. Combines ordered locales, structured decompositions, and sheaf-theoretic gluing for finest-grained equivalence classes with spatial coherence.

UncategorizedID: plurigrid/asi/superelastic-quotient

Install this agent skill to your local

pnpm dlx add-skill https://github.com/plurigrid/asi/tree/HEAD/skills/superelastic-quotient

Skill Files

Browse the full folder contents for superelastic-quotient.

Download Skill

Loading file tree…

skills/superelastic-quotient/SKILL.md

Skill Metadata

Name
superelastic-quotient
Description
"Superelastic skills with maximum quotienting resolution for spatial decomposition. Combines ordered locales, structured decompositions, and sheaf-theoretic gluing for finest-grained equivalence classes with spatial coherence."

Superelastic Quotient

Trit: 0 (ERGODIC - coordinates elastic boundaries)
Foundation: StructuredDecompositions.jl + Ordered Locales + Sheaf Cohomology
Principle: Maximum resolution quotients that stretch without breaking

Core Insight

Superelasticity = ability to deform equivalence classes while preserving:

  1. Spatial coherence (open cone conditions from ordered locales)
  2. GF(3) conservation (triadic balance)
  3. Sheaf condition (local-to-global gluing)
                 FINE RESOLUTION
                      │
    ┌─────────────────┼─────────────────┐
    │                 │                 │
    ▼                 ▼                 ▼
 ┌──────┐        ┌──────┐        ┌──────┐
 │[-1]  │───────►│[ 0]  │───────►│[+1]  │
 │MINUS │◄───────│ERGODIC│◄───────│PLUS  │
 └──────┘        └──────┘        └──────┘
    │                 │                 │
    └─────────────────┼─────────────────┘
                      │
                COARSE QUOTIENT
                      
 Elasticity = bidirectional refinement/coarsening

Mathematical Structure

Ordered Locale for Spatial Direction

From ordered locales (Heunen-van der Schaaf 2024):

# Frame L with compatible preorder ≪
struct SpatialQuotient{L}
    locale::OrderedLocale{L}
    equivalence::Function        # x ~ y iff x ≪ y and y ≪ x
    resolution::Int              # Current quotient level
    max_resolution::Int          # Finest grain achievable
end

# Open cone condition: ↟U must be open for quotient consistency
function is_elastic(sq::SpatialQuotient)
    for U in opens(sq.locale)
        # Upper cone must be open
        if !is_open(upper_cone(sq.locale, U))
            return false
        end
    end
    return true
end

Resolution Spectrum

# Quotient tower: finest → coarsest
#
# Level 0: Individual points (maximum resolution)
# Level 1: Local neighborhoods  
# Level 2: Triadic clusters (GF(3) bags)
# Level 3: Skill categories
# Level N: Single equivalence class (minimum resolution)

struct QuotientTower
    levels::Vector{SpatialQuotient}
    morphisms::Vector{Functor}  # Level i → Level i+1
    
    function QuotientTower(base::SpatialQuotient)
        # Build tower via successive quotients
        levels = [base]
        while !is_trivial(last(levels))
            push!(levels, quotient_step(last(levels)))
            push!(morphisms, quotient_map(levels[end-1], levels[end]))
        end
        new(levels, morphisms)
    end
end

# Superelasticity: can jump any number of levels
function elastic_quotient(tower::QuotientTower, source_level::Int, target_level::Int)
    if target_level > source_level
        # Coarsening: compose quotient maps
        compose(tower.morphisms[source_level:target_level-1]...)
    else
        # Refinement: right adjoint (splitting)
        adjoint(compose(tower.morphisms[target_level:source_level-1]...))
    end
end

Spatial Decomposition Pattern

Tripartite Spatial Bags

@present SchSpatialTripartite(FreeSchema) begin
    (Region, Boundary, Point)::Ob
    
    # Spatial inclusion
    region_boundary::Hom(Boundary, Region)
    boundary_point::Hom(Point, Boundary)
    
    # GF(3) trit assignment
    trit::Attr(Region, Int)  # ∈ {-1, 0, +1}
    
    # Spatial coordinates
    coord::Attr(Point, Vector{Float64})
    
    # Quotient level
    level::Attr(Region, Int)
end

@acset_type SpatialDecomp(SchSpatialTripartite)

# Verify spatial + GF(3) coherence
function verify_superelastic(sd::SpatialDecomp)
    # 1. Check GF(3) conservation
    trits = sd[:, :trit]
    @assert sum(trits) % 3 == 0 "GF(3) violation"
    
    # 2. Check spatial coherence (open cone condition)
    for r in parts(sd, :Region)
        boundary = incident(sd, r, :region_boundary)
        @assert forms_open_cone(sd, boundary) "Spatial violation"
    end
    
    # 3. Check elasticity (can refine/coarsen)
    @assert has_refinement(sd) && has_quotient(sd) "Not elastic"
    
    return true
end

Resolution-Adaptive Navigation

# Specter-style navigators with resolution awareness
struct ResolutionNavigator
    base_path::Vector{Symbol}
    min_level::Int
    max_level::Int
end

# Navigate at current resolution
function select_at_level(nav::ResolutionNavigator, level::Int, target)
    if level < nav.min_level || level > nav.max_level
        # Elastic stretch to accommodate
        stretched_nav = stretch_navigator(nav, level)
        return select(stretched_nav.base_path, target)
    end
    return select(nav.base_path, target)
end

# Bidirectional resolution transform
function transform_elastic(nav::ResolutionNavigator, f::Function, target, 
                           source_level::Int, target_level::Int)
    # Get current view at source level
    view = select_at_level(nav, source_level, target)
    
    # Apply transform
    transformed = f(view)
    
    # Project to target level (quotient or refine)
    if target_level > source_level
        return quotient_to_level(transformed, target_level)
    else
        return refine_to_level(transformed, target_level)
    end
end

Skill Decomposition Example

# Decompose 524+ skills into spatial triads

function skill_spatial_decomposition(skills::Vector{Symbol}, resolution::Int)
    # Level 0: Individual skills
    base = SpatialDecomp()
    
    for skill in skills
        trit = skill_to_trit(skill)
        coord = skill_to_embedding(skill)  # From skill-embedding-vss
        add_point!(base, skill, trit, coord)
    end
    
    # Build quotient tower
    tower = QuotientTower(base)
    
    # Return view at requested resolution
    return elastic_quotient(tower, 0, resolution)
end

# Example usage:
# Level 0: 524 individual skills
# Level 1: ~175 triadic clusters (3 skills each, GF(3) balanced)
# Level 2: ~58 mega-triads (3 clusters each)
# Level 3: ~19 domains
# Level 4: 6 "worlds" (a-z mapped)
# Level 5: 2 hemispheres (generator/validator)
# Level 6: 1 unified skill space

Integration with Cat# Three Homes

# Each home operates at different resolution scales

HOME_RESOLUTIONS = Dict(
    1 => (  # Polynomial Comonads
        name = "State Dynamics",
        typical_level = 0..2,  # Fine-grained, individual behaviors
        skill = :gay-mcp,
        trit = +1
    ),
    2 => (  # Monads in Span
        name = "Schema Relations", 
        typical_level = 2..4,  # Medium, relational structure
        skill = :acsets,
        trit = 0
    ),
    3 => (  # Path Algebras
        name = "Equivalence Classes",
        typical_level = 3..6,  # Coarse, bisimulation quotients
        skill = :bisimulation-game,
        trit = -1
    )
)

# Superelastic: can operate across all levels
function dispatch_to_home_elastic(concept, resolution::Int)
    home = concept_to_home(concept)
    home_range = HOME_RESOLUTIONS[home].typical_level
    
    if resolution in home_range
        # Native resolution
        return (home, :native, resolution)
    else
        # Elastic stretch
        direction = resolution < first(home_range) ? :refine : :coarsen
        return (home, direction, resolution)
    end
end

Sheaf-Theoretic Gluing

# Superelastic quotients preserve the sheaf condition
# across all resolution levels

struct ElasticSheaf{C}
    presheaf::Functor{Op{C}, FinSet}
    tower::QuotientTower
end

# Sheaf condition at any resolution level
function sheaf_condition(es::ElasticSheaf, level::Int)
    projected = project_to_level(es.presheaf, es.tower, level)
    
    # For each covering family at this level
    for cover in coverings(es.tower.levels[level])
        # Sections must glue
        sections = [projected(U) for U in cover]
        if !unique_amalgamation(sections, overlaps(cover))
            return false
        end
    end
    return true
end

# Maximum resolution = finest quotient where sheaf condition holds
function max_elastic_resolution(es::ElasticSheaf)
    for level in 0:length(es.tower.levels)-1
        if !sheaf_condition(es, level)
            return level - 1  # Last valid level
        end
    end
    return length(es.tower.levels) - 1
end

DuckDB Integration

-- Schema for spatial quotient tracking
CREATE TABLE IF NOT EXISTS spatial_quotients (
    quotient_id UUID PRIMARY KEY,
    level INT NOT NULL,
    trit TINYINT NOT NULL,
    region_name VARCHAR,
    parent_quotient UUID,
    child_count INT,
    spatial_centroid DOUBLE[],
    is_elastic BOOLEAN DEFAULT true,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    
    CONSTRAINT gf3_check CHECK (trit IN (-1, 0, 1))
);

-- Quotient tower as recursive CTE
WITH RECURSIVE tower AS (
    -- Base: finest level
    SELECT quotient_id, level, trit, region_name, parent_quotient
    FROM spatial_quotients WHERE level = 0
    
    UNION ALL
    
    -- Recursive: coarser levels
    SELECT sq.quotient_id, sq.level, sq.trit, sq.region_name, sq.parent_quotient
    FROM spatial_quotients sq
    JOIN tower t ON sq.parent_quotient = t.quotient_id
)
SELECT level, COUNT(*) as regions, SUM(trit) % 3 as gf3_check
FROM tower
GROUP BY level
ORDER BY level;

GF(3) Balanced Triads

Superelastic Conservation Law:
─────────────────────────────
At EVERY resolution level, triadic decompositions sum to 0 mod 3

Level 0: skill₁(-1) ⊗ skill₂(0) ⊗ skill₃(+1) = 0 ✓
Level 1: cluster₁(-1) ⊗ cluster₂(0) ⊗ cluster₃(+1) = 0 ✓
Level 2: domain₁(-1) ⊗ domain₂(0) ⊗ domain₃(+1) = 0 ✓
...
Level N: unified(-1 + 0 + 1) = 0 ✓

Elasticity preserves this invariant under stretch!

GF(3) Triads for This Skill

structured-decomp (-1) ⊗ superelastic-quotient (0) ⊗ gay-mcp (+1) = 0 ✓
sheaf-cohomology (-1) ⊗ superelastic-quotient (0) ⊗ topos-generate (+1) = 0 ✓  
ordered-locale (-1) ⊗ superelastic-quotient (0) ⊗ tripartite-decompositions (+1) = 0 ✓

Babashka CLI

# Query at different resolution levels
bb superelastic-quotient.bb --level 0 --skill gay-mcp  # Individual
bb superelastic-quotient.bb --level 2 --skill gay-mcp  # Triadic cluster
bb superelastic-quotient.bb --level 4 --skill gay-mcp  # Domain

# Find maximum elastic resolution for concept
bb superelastic-quotient.bb --max-resolution "polynomial comonad"

# Stretch between levels
bb superelastic-quotient.bb --stretch 0 4 --skill acsets

References

  • Bumpus et al. "Compositional Algorithms on Compositional Data" (ACT 2023)
  • Heunen & van der Schaaf "Ordered Locales" (2024)
  • StructuredDecompositions.jl documentation
  • Ordered locale skill for spatial coherence

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.