home / skills / plurigrid / asi / julia-gay

julia-gay skill

This skill deterministically generates colors from a seed and index using Gay.jl, enabling reproducible palettes and stable triad classifications.

npx playbooks add skill plurigrid/asi --skill julia-gay

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.9 KB
---
name: julia-gay
description: Gay.jl integration for deterministic color generation. SplitMix64 RNG, GF(3) trits, and SPI-compliant fingerprints in Julia.
version: 1.0.0
---


# Julia Gay Skill

**Trit**: +1 (PLUS - generative color computation)  
**Foundation**: Gay.jl + SplitMix64 + SPI  

## Core Concept

Gay.jl provides:
- Deterministic color from seed + index
- GF(3) trit classification
- SPI-compliant parallel fingerprints
- Wide-gamut color space support

## API

```julia
using Gay

# Color at index
color = color_at(seed, index)
# => (r=0.65, g=0.32, b=0.88)

# Palette generation
palette = Gay.palette(seed, 5)

# Trit classification
trit = Gay.trit(color)  # => -1, 0, or +1

# XOR fingerprint
fp = Gay.fingerprint(colors)
```

## SPI Guarantees

```julia
# Strong Parallelism Invariance
@assert fingerprint(colors_thread1) ⊻ fingerprint(colors_thread2) == 
        fingerprint(vcat(colors_thread1, colors_thread2))
```

## Ergodic Bridge

```julia
using Gay: ErgodicBridge

# Create time-color bridge
bridge = create_bridge(seed, n_colors)

# Verify bidirectionally
verify_bridge(bridge)

# Detect obstructions
obstructions = detect_obstructions(seed, n_samples)
```

## Canonical Triads

```
bisimulation-game (-1) ⊗ acsets (0) ⊗ julia-gay (+1) = 0 ✓
sheaf-cohomology (-1) ⊗ bumpus-narratives (0) ⊗ julia-gay (+1) = 0 ✓
spi-parallel-verify (-1) ⊗ triad-interleave (0) ⊗ julia-gay (+1) = 0 ✓
```

## Julia Scientific Package Integration

From `julia-scientific` skill - related Julia packages for color/visualization:

| Package | Use | julia-scientific Category |
|---------|-----|---------------------------|
| **Colors.jl** | Color types, conversions | Visualization |
| **ColorSchemes.jl** | Predefined palettes | Visualization |
| **Makie.jl** | GPU-accelerated vis with color | Visualization |
| **CairoMakie.jl** | Publication-quality with color | Visualization |
| **AlgebraOfGraphics.jl** | Grammar-of-graphics + color | Visualization |
| **Catlab.jl** | ACSets + color labeling | Data Science |
| **Gay.jl** | Core deterministic colors | Core |

### Bridge to Scientific Domains

```julia
# Molecular visualization with deterministic colors
using Gay, MolecularGraph, CairoMakie

mol = smilestomol("CCO")
atom_colors = [Gay.color_at(seed, i) for i in 1:natoms(mol)]
visualize_molecule(mol, colors=atom_colors)

# Single-cell UMAP with Gay.jl cluster colors
using Gay, SingleCellProjections, CairoMakie

clusters = cluster(adata)
cluster_colors = Gay.palette(seed, n_clusters)
scatter(umap_coords, color=cluster_colors[cluster_labels])
```

## See Also

- `gay-mcp` - MCP server for color generation
- `triad-interleave` - 3-stream scheduling
- `world-hopping` - Badiou possible world navigation
- `julia-scientific` - Full Julia package mapping (137 skills)



## Scientific Skill Interleaving

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

### Visualization
- **matplotlib** [○] via bicomodule
  - Hub for all visualization

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 7. Propagators

**Concepts**: propagator, cell, constraint, bidirectional, TMS

### GF(3) Balanced Triad

```
julia-gay (+) + SDF.Ch7 (○) + [balancer] (−) = 0
```

**Skill Trit**: 1 (PLUS - generation)

### Secondary Chapters

- Ch3: Variations on an Arithmetic Theme
- Ch10: Adventure Game Example

### Connection Pattern

Propagators flow constraints bidirectionally. This skill propagates information.
## 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.

Overview

This skill provides deterministic color generation and tooling based on Gay.jl, combining a SplitMix64 RNG, GF(3) trit classification, and SPI-compliant parallel fingerprints. It produces repeatable colors from a seed and index, constructs palettes, and supplies mechanisms for bidirectional time-color bridges and obstruction detection. The design targets scientific visualization, reproducible color labeling, and parallel-safe fingerprinting for large-scale or multi-threaded workflows.

How this skill works

The core uses SplitMix64 to derive deterministic pseudorandom streams from a seed, then maps outputs into wide-gamut color values and GF(3) trits (−1,0,+1) for categorical labeling. Palettes are generated by sampling the RNG at indexed offsets, and fingerprints are computed as XOR-like values that satisfy Strong Parallelism Invariance (SPI). The Ergodic Bridge creates reversible mappings between temporal indices and colors and provides verification and obstruction detection utilities for robustness.

When to use it

  • You need reproducible, seed-based colors for plots, GUIs, or molecular/cluster visualizations.
  • Generating compact, parallel-safe fingerprints of color sets for distributed systems or caching.
  • Assigning categorical labels via GF(3) trits for triadic logic or balanced partitioning.
  • Creating palettes with deterministic ordering for reproducible reports or publications.
  • Building bidirectional time-color mappings for animations, timelines, or ergodic analyses.

Best practices

  • Pick and fix a global seed for reproducibility across sessions and collaborators.
  • Use indexed calls (color_at(seed,index)) instead of ad-hoc RNG sampling to preserve determinism when inserting or reordering items.
  • Use fingerprinting for verification across threads or processes; rely on the SPI guarantee when merging results.
  • Map trits to semantic color roles consistently (e.g., negative/neutral/positive) to keep labels interpretable.
  • Validate bridges with verify_bridge and probe for obstructions in noisy or sparse sampling regimes.

Example use cases

  • Deterministic atom coloring in molecular visualizations so identical molecules share colors across runs.
  • Generating reproducible cluster palettes for single-cell UMAP/TSNE figures in publications.
  • Distributed rendering pipelines using fingerprints to detect missing or duplicated color segments across worker threads.
  • Animating time-series with an ergodic bridge that allows forward/backward navigation and obstruction detection.
  • Labeling mesh or graph regions with GF(3) triads for tri-state algorithms or balanced partitioning.

FAQ

Are colors reproducible across platforms?

Yes—colors are derived deterministically from the seed via SplitMix64. Use the same seed and indexing scheme to reproduce results across runs and platforms that implement the same numeric mapping.

What does SPI-compliant fingerprinting guarantee?

SPI guarantees that the XOR-like fingerprint of concatenated color streams equals the XOR of per-thread fingerprints, enabling safe parallel merging and verification.

julia-gay skill by plurigrid/asi