Topos Institute's CatColab for collaborative category theory - community model building, double theories, stock and flow epidemiology, and real-time collaborative diagramming via Automerge CRDT.
/plugin marketplace add plurigrid/asi/plugin install asi-skills@asi-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Trit: 0 (ERGODIC - coordinator) Color: Blue (#4A90D9)
CatColab is Topos Institute's platform for formal, interoperable, conceptual modeling using applied category theory. It enables:
┌─────────────────────────────────────────────────────────┐
│ CatColab Platform │
├─────────────────────────────────────────────────────────┤
│ Frontend (SolidJS) │
│ ├── ModelNotebookEditor → Object/Morphism declarations│
│ ├── DiagramNotebookEditor → Visual diagram authoring │
│ └── AnalysisNotebookEditor → ODE simulation, export │
├─────────────────────────────────────────────────────────┤
│ Automerge CRDT Sync Layer │
│ ├── DocHandle (document state) │
│ ├── WebSocket sync to server │
│ └── Reconcile → SolidJS reactivity │
├─────────────────────────────────────────────────────────┤
│ catlog (Rust Engine via WASM) │
│ ├── Double theories (DiscreteDblTheory, ModalDblTheory) │
│ ├── Model elaboration & validation │
│ └── ODE integration for stock-flow │
├─────────────────────────────────────────────────────────┤
│ Backend (Axum + PostgreSQL) │
│ └── Document persistence, auth, Julia interop │
└─────────────────────────────────────────────────────────┘
CatColab supports participatory modeling workshops:
// Model Building Session Pattern
interface ModelBuildingEvent {
theory: DblTheory; // Double theory framework
participants: User[]; // Concurrent editors
liveDoc: LiveModelDoc; // Automerge-backed document
validationState: 'Valid' | 'Invalid' | 'Illformed';
}
// Each participant can add:
type CellType =
| 'ObDecl' // Object declaration
| 'MorDecl' // Morphism declaration
| 'InstantiatedModel' // Compose from existing models
Diagrams Of Theories with double categorical semantics:
// From catlog: Double theory as VDC with structure
trait DblTheory: VDblCategory {
type ObType; // Object generators (stocks, states)
type MorType; // Morphism generators (flows, transitions)
type ObOp; // Object operations
type MorOp; // Morphism operations
}
// Example: Stock and Flow theory
pub fn th_stock_flow() -> DiscreteDblTheory {
let mut cat = FpCategory::new();
cat.add_ob_generator(name("Stock"));
cat.add_mor_generator(name("Flow"), name("Stock"), name("Stock"));
cat.add_mor_generator(name("Link"), name("Stock"), name("Stock"));
cat.into()
}
Categorical modeling for epidemic dynamics:
# SIR Model as Stock-Flow diagram
using Catlab
@present SchSIR(FreeSchema) begin
Stock::Ob
Flow::Hom(Stock, Stock)
Link::Hom(Stock, Stock)
end
# Instantiate: S → I → R with infection/recovery flows
sir_model = @acset SIR begin
Stock = [:S, :I, :R]
Flow = [(:S, :I), (:I, :R)] # infection, recovery
Link = [(:I, :S)] # I influences S→I rate
end
# CatColab generates mass-action ODEs:
# dS/dt = -β*S*I
# dI/dt = β*S*I - γ*I
# dR/dt = γ*I
Real-time multi-user diagram authoring:
// Automerge change flow
function editDiagram(cell: DiagramCell, edit: Edit) {
// 1. Local change via Automerge
liveDoc.changeDoc((doc) => {
applyEdit(doc.cells[cell.id], edit);
});
// 2. WebSocket broadcasts to server
// 3. Server broadcasts to all clients
// 4. reconcile() triggers SolidJS reactivity
// → All participants see change in real-time
}
~/worlds/T/CatColab/
├── packages/catlog/ # Core Rust engine
├── packages/frontend/ # SolidJS UI
├── packages/backend/ # Axum server
└── packages/algjulia-interop/ # Julia bridge
CatColab models are ACSets:
# Any CatColab model is a functor X: Theory → Set
# Schema = Theory, Instance = Model
# Export CatColab model to Catlab ACSet
function catcolab_to_acset(model_json::Dict)
theory = parse_theory(model_json["theory"])
schema = theory_to_schema(theory)
acset = instantiate(schema, model_json["cells"])
return acset
end
Multi-agent modeling coordination:
# Coordinate multiple modelers via sheaf diffusion
from catcolab import LiveModelDoc
from sheaf_laplacian import SheafLaplacian
def coordinate_modelers(docs: list[LiveModelDoc], topology):
"""Harmonize beliefs across modeling participants."""
sheaf = SheafLaplacian(
num_nodes=len(docs),
stalk_dim=embedding_dim,
edge_index=topology
)
embeddings = [embed_model(doc) for doc in docs]
consensus = sheaf.diffuse(torch.stack(embeddings))
return suggest_reconciliation(docs, consensus)
// Host a model building event for local epidemiology
const workshop = await catcolab.createEvent({
name: "Community Disease Modeling",
theory: "primitive-stock-flow",
participants: communityMembers,
});
// Facilitator seeds initial structure
await workshop.addCell({
type: "ObDecl",
name: "Population",
theory_type: "Stock"
});
// Participants collaboratively add:
// - Disease states (Susceptible, Infected, Recovered)
// - Flows (infection, recovery, vaccination)
// - Links (contact rate influences)
// Run mass-action ODE simulation
const simulation = await workshop.analyze({
type: "ode-simulation",
parameters: { beta: 0.3, gamma: 0.1 },
timespan: [0, 100]
});
# Export model for review
catcolab export --format=json sir-model.catcolab > sir.json
# Import into Catlab for analysis
julia -e 'using CatColabInterop; analyze(load("sir.json"))'
# Fork and modify
catcolab fork sir-model.catcolab --name "sir-with-vaccination"
# Merge improvements back
catcolab merge --base=sir-model --feature=sir-with-vaccination
// Define theory for supply chain modeling
pub fn th_supply_chain() -> DiscreteDblTheory {
let mut cat = FpCategory::new();
// Object types
cat.add_ob_generator(name("Warehouse"));
cat.add_ob_generator(name("Factory"));
cat.add_ob_generator(name("Retailer"));
// Morphism types (flows between locations)
cat.add_mor_generator(name("Ship"), name("Factory"), name("Warehouse"));
cat.add_mor_generator(name("Distribute"), name("Warehouse"), name("Retailer"));
cat.add_mor_generator(name("Reorder"), name("Retailer"), name("Factory"));
// Composition: Ship ; Distribute represents full supply chain
cat.into()
}
acsets-relational-thinking (-1) ⊗ topos-catcolab (0) ⊗ gay-mcp (+1) = 0 ✓
sheaf-laplacian-coordination (-1) ⊗ topos-catcolab (0) ⊗ open-games (+1) = 0 ✓
world-t (-1) ⊗ topos-catcolab (0) ⊗ discopy (+1) = 0 ✓
# Development
just catcolab-dev # Start local CatColab
just catcolab-build # Build frontend + WASM
# Model operations
just catcolab-new THEORY NAME # Create new model
just catcolab-export MODEL # Export to JSON
just catcolab-simulate MODEL # Run ODE analysis
# Collaboration
just catcolab-share MODEL USERS # Share with collaborators
just catcolab-event THEORY # Create model building event
just catcolab-sync # Force sync all docs
import { init_catlog, th_stock_flow, elaborate_model } from '@catcolab/catlog-wasm';
await init_catlog();
const theory = th_stock_flow();
const result = elaborate_model(theory, modelJson);
if (result.status === 'Valid') {
const odeSystem = result.equations;
}
GET /api/documents # List user documents
POST /api/documents # Create document
GET /api/documents/:id # Get document metadata
GET /api/documents/:id/sync # WebSocket upgrade for Automerge
POST /api/analyses/:type # Run analysis (ode, diagram-export)
world-t - CatColab directory structure and codebaseacsets-relational-thinking - ACSets as categorical databasessheaf-laplacian-coordination - Multi-agent consensusopen-games - Compositional game semanticsdiscopy - String diagram computationboneh-roughgarden-wev - WEV mechanism design via double theoriesCatColab double theories formalize the cognitive superposition of cryptographic (Boneh) and game-theoretic (Roughgarden) worlds:
┌─────────────────────────────────────────────────────────────────────┐
│ DOUBLE THEORY: CryptoGame │
├─────────────────────────────────────────────────────────────────────┤
│ Horizontal Category (Crypto): │
│ Objects: BLS, VDF, ZK-SNARK, Threshold │
│ Morphisms: commit, reveal, aggregate, verify │
│ │
│ Vertical Category (Games): │
│ Objects: Nash, PoA, Mechanism, Auction │
│ Morphisms: equilibrate, price, extract, prevent │
│ │
│ Squares (World Extractable Value): │
│ BLS ──commit──► Threshold │
│ │ │ │
│ equilibrate extract │
│ ▼ ▼ │
│ Nash ──price──► Auction │
└─────────────────────────────────────────────────────────────────────┘
// Double theory for Boneh-Roughgarden WEV
pub fn th_wev_mechanism() -> DiscreteDblTheory {
let mut cat = FpCategory::new();
// Crypto world (horizontal)
cat.add_ob_generator(name("BLS"));
cat.add_ob_generator(name("VDF"));
cat.add_ob_generator(name("ZK"));
cat.add_mor_generator(name("commit"), name("BLS"), name("VDF"));
cat.add_mor_generator(name("reveal"), name("VDF"), name("ZK"));
// Game world (vertical via fibration)
cat.add_ob_generator(name("Nash"));
cat.add_ob_generator(name("Mechanism"));
cat.add_mor_generator(name("equilibrate"), name("Nash"), name("Mechanism"));
cat.add_mor_generator(name("price"), name("Mechanism"), name("Nash"));
cat.into()
}
Each Boneh/Roughgarden/Wuollet subagent corresponds to a cell in the CatColab document:
| Cell Type | Persona | Colors Known | CatColab Element |
|---|---|---|---|
| ObDecl | Boneh | 1 | VDF object |
| ObDecl | Roughgarden | 2 | Nash object |
| ObDecl | Wuollet | 3 | MEV object |
| MorDecl | Mixed | - | extract: Nash → MEV |
Skill Name: topos-catcolab Type: Collaborative Applied Category Theory Trit: 0 (ERGODIC) GF(3): Conserved via triadic composition