Skip to content
crdt-color logo

CRDT Color Skill

crdt-color

Color-aware CRDT operations with GF(3) conservation, Narya proofs, ACSet schemas, and Bumpus narrative sheaves.

plurigrid/asi0installs67starsOther

SKILL.md

Full skill instructions

CRDT Color Skill

Trit: 0 (ERGODIC) - Coordinates between verification (-1) and generation (+1)

Color-aware CRDT operations with GF(3) conservation, Narya proofs, ACSet schemas, and Bumpus narrative sheaves.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    CRDT Color Skill                              │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐       │
│  │ Narya/​Cat#   │    │  Eg-walker   │    │   Bumpus     │       │
│  │ Proofs (-1)  │◄──►│  DAG (0)     │◄──►│ Sheaves (+1) │       │
│  └──────────────┘    └──────────────┘    └──────────────┘       │
│         │                   │                   │                │
│         │            ┌──────┴──────┐            │                │
│         │            │   ACSet     │            │                │
│         └────────────│  Schema     │────────────┘                │
│                      └──────┬──────┘                             │
│                             ▼                                    │
│                    ┌──────────────┐                              │
│                    │  Gay.jl RNG  │                              │
│                    │  SplitMix64  │                              │
│                    └──────────────┘                              │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Eg-walker Integration (Gentle & Kleppmann, EuroSys 2025)

Core Innovation: Simple indices + DAG replay instead of complex CRDT metadata.

# Traditional CRDTs store complex position descriptors
# Eg-walker stores simple index at execution time
struct ColorOp
    index::Int          # Simple index (not CRDT metadata!)
    color_hex::String   # Gay.jl color
    trit::Int8          # GF(3) assignment
    parent_ids::Vector{UInt64}  # DAG edges
end

# Merge via replay: O(k log n) instead of O(n²)
merged = merge_branches(alice_state, bob_state)

Complexity Comparison

MetricTraditional CRDTOTEg-walker
Memory/​opO(n)O(1)O(1)
Doc loadO(n²)O(n)O(n log n)
MergeO(k log n)O(n²)O(k log n)
TombstonesUnboundedN/​ANone (replay)

GF(3) + Eg-walker

  • Each ColorOp carries trit: O(1) overhead
  • Merge verification: O(k) path traversal
  • Rebalancing: O(1) amortized (single compensating op)

GF(3) Conservation Law

All operations maintain: Σ trits ≡ 0 (mod 3)

OperationTritEffect
Restriction-1Shrink time window
Pullback (Merge)0Combine concurrent edits
Extension+1Expand time window

Triad balance: restriction(-1) ⊕ pullback(0) ⊕ extension(+1) = 0 ✓

Core Types

# ColorEdit: Atomic edit with GF(3) trit
struct ColorEdit
    seed::UInt64      # Gay.jl seed
    idx::Int          # Color index
    color::RGB        # Computed color
    trit::Int8        # GF(3) ∈ {-1, 0, +1}
    timestamp::Nat    # Lamport timestamp
end

# Observational Bridge: hex equality → trit equality
ColorBridge : e1.hex == e2.hex → e1.trit == e2.trit

# Merge: LWW with deterministic tiebreaker
merge(e1, e2) = e1.timestamp > e2.timestamp ? e1 : 
                e1.timestamp < e2.timestamp ? e2 :
                e1.hex < e2.hex ? e1 : e2

Proof Obligations (Narya)

  1. merge_comm: merge(e1, e2) = merge(e2, e1)
  2. merge_assoc: merge(merge(e1, e2), e3) = merge(e1, merge(e2, e3))
  3. merge_idem: merge(e, e) = e
  4. gf3_conserved: Winner-takes-all preserves trit
  5. replica_conservation: Merged logs maintain Σ trits ≡ 0 (mod 3)

ACSet Schema

@present SchColorDoc(FreeSchema) begin
    # Objects
    Document::Ob
    Paragraph::Ob  
    Span::Ob
    ColorEdit::Ob
    Author::Ob
    Timestamp::Ob
    
    # Morphisms
    parent::Hom(Paragraph, Document)
    in_para::Hom(Span, Paragraph)
    edit_of::Hom(ColorEdit, Span)
    authored_by::Hom(ColorEdit, Author)
    at_time::Hom(ColorEdit, Timestamp)
    
    # Attributes
    color::Attr(Span, RGB)
    seed::Attr(ColorEdit, UInt64)
    idx::Attr(ColorEdit, Int)
    trit::Attr(Span, GF3)
end

Bumpus Sheaf Operations

# Time category with intervals
struct TimeInterval
    start::Nat
    stop::Nat
end

# Narrative sheaf: intervals → document states
struct NarrativeSheaf
    sections::Dict{TimeInterval, ColorDocument}
end

# Sheaf condition via pullback
F([a,b]) = F([a,p]) ×_{F([p,p])} F([p,b])

# Pullback merge for concurrent edits
function pullback_merge(left::ColorDocument, right::ColorDocument, 
                        ancestor::ColorDocument)
    merged = fibered_product(left, right, ancestor)
    @assert gf3_sum(merged) % 3 == 0 "GF(3) violation"
    merged
end

Adhesion Filter (FPT)

Tree decomposition yields O(3^w · n) complexity:

  • w = treewidth of edit dependency graph
  • n = number of edits
  • Polynomial in n for bounded treewidth

Usage

using CRDTColor

# Create document with seed
doc = ColorDocument(seed=1069)

# Add colored span
span = add_span!(doc, "Hello", color_at(1069, 1))

# Concurrent edits
edit1 = recolor!(doc, span, color_at(1069, 2), author=:alice)
edit2 = recolor!(doc, span, color_at(1069, 3), author=:bob)

# Merge via pullback
merged = pullback_merge(edit1, edit2, ancestor=span)

# Verify GF(3) conservation
@assert gf3_balanced(merged)

Skill Composition

narya-proofs (-1) ⊗ crdt-color (0) ⊗ bumpus-narratives (+1) = 0 ✓
acsets (-1) ⊗ crdt-color (0) ⊗ gay-mcp (+1) = 0 ✓
structured-decomp (-1) ⊗ crdt-color (0) ⊗ world-hopping (+1) = 0 ✓

Files

References


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.

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View