home / skills / plurigrid / asi / skill-dispatch

skill-dispatch skill

/skills/skill-dispatch

This skill routes tasks to a triad of subagents using GF(3) conservation, balancing MINUS, ERGODIC, and PLUS roles for reliable orchestration.

npx playbooks add skill plurigrid/asi --skill skill-dispatch

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

Files (1)
SKILL.md
6.0 KB
---
name: skill-dispatch
description: ' GF(3) Triadic Task Routing for Subagent Orchestration'
---

# skill-dispatch

> GF(3) Triadic Task Routing for Subagent Orchestration

**Version**: 1.0.0  
**Trit**: 0 (Ergodic - coordinates routing)  
**Bundle**: core  

## Overview

Skill-dispatch routes tasks to appropriate skills based on GF(3) triadic conservation. Each task is assigned to a triad of skills (MINUS/ERGODIC/PLUS) that sum to 0 mod 3, ensuring balanced execution.

## Core Concept

```
Task → Infer Bundle → Select Triad → Dispatch to Subagents

Each triad: (-1) ⊗ (0) ⊗ (+1) = 0 mod 3
```

## Skill Registry

```ruby
SKILLS = {
  # MINUS (-1): Validators
  'sheaf-cohomology'    => { trit: -1, bundle: :cohomological, action: :verify },
  'three-match'         => { trit: -1, bundle: :core, action: :reduce },
  'clj-kondo-3color'    => { trit: -1, bundle: :database, action: :lint },
  'influence-propagation' => { trit: -1, bundle: :network, action: :validate },
  
  # ERGODIC (0): Coordinators
  'unworld'             => { trit: 0, bundle: :core, action: :derive },
  'acsets'              => { trit: 0, bundle: :database, action: :query },
  'cognitive-surrogate' => { trit: 0, bundle: :learning, action: :predict },
  'entropy-sequencer'   => { trit: 0, bundle: :core, action: :arrange },
  
  # PLUS (+1): Generators
  'gay-mcp'             => { trit: 1, bundle: :core, action: :color },
  'agent-o-rama'        => { trit: 1, bundle: :learning, action: :train },
  'atproto-ingest'      => { trit: 1, bundle: :acquisition, action: :fetch },
  'triad-interleave'    => { trit: 1, bundle: :core, action: :interleave }
}
```

## Canonical Triads

```ruby
TRIADS = {
  core:        %w[three-match unworld gay-mcp],
  database:    %w[clj-kondo-3color acsets rama-gay-clojure],
  learning:    %w[self-validation-loop cognitive-surrogate agent-o-rama],
  network:     %w[influence-propagation bisimulation-game atproto-ingest],
  repl:        %w[slime-lisp borkdude cider-clojure]
}
```

## Capabilities

### 1. dispatch

Route a task to the appropriate triad.

```python
from skill_dispatch import Dispatcher

dispatcher = Dispatcher(seed=0xf061ebbc2ca74d78)

assignment = dispatcher.dispatch(
    task="analyze interaction patterns",
    bundle="learning"  # optional, inferred if not provided
)

# Returns:
# {
#   task: "analyze interaction patterns",
#   bundle: "learning",
#   triad: ["self-validation-loop", "cognitive-surrogate", "agent-o-rama"],
#   assignments: [
#     {skill: "self-validation-loop", trit: -1, role: "validator"},
#     {skill: "cognitive-surrogate", trit: 0, role: "coordinator"},
#     {skill: "agent-o-rama", trit: 1, role: "generator"}
#   ],
#   gf3_sum: 0,
#   conserved: true
# }
```

### 2. execute-triad

Execute a full triad pipeline: MINUS → ERGODIC → PLUS.

```python
result = dispatcher.execute_triad(
    bundle="core",
    input_data=raw_interactions,
    executor=lambda skill, data, info: skill.run(data)
)

# Pipeline: three-match → unworld → gay-mcp
# Each step's output feeds into the next
```

### 3. cross-compose

Compose skills across different bundles while maintaining GF(3).

```python
hybrid = dispatcher.cross_compose(
    minus_bundle="database",    # clj-kondo-3color
    ergodic_bundle="learning",  # cognitive-surrogate
    plus_bundle="core"          # gay-mcp
)

# Still conserves: (-1) + (0) + (+1) = 0
```

### 4. infer-bundle

Automatically determine bundle from task description.

```python
bundle = dispatcher.infer_bundle("lint the clojure code")
# Returns: "database" (matches kondo pattern)

bundle = dispatcher.infer_bundle("train a predictor")
# Returns: "learning"
```

## Subagent Roles

```python
ROLES = {
    -1: {
        "name": "validator",
        "color": "#2626D8",  # Blue
        "verbs": ["verify", "constrain", "reduce", "filter", "lint"]
    },
    0: {
        "name": "coordinator", 
        "color": "#26D826",  # Green
        "verbs": ["transport", "derive", "navigate", "bridge", "arrange"]
    },
    1: {
        "name": "generator",
        "color": "#D82626",  # Red
        "verbs": ["create", "compose", "generate", "expand", "train"]
    }
}
```

## DuckDB Integration

```sql
CREATE TABLE dispatch_log (
    dispatch_id VARCHAR PRIMARY KEY,
    task VARCHAR,
    bundle VARCHAR,
    triad VARCHAR[],
    gf3_sum INT,
    conserved BOOLEAN,
    seed BIGINT,
    dispatched_at TIMESTAMP
);

-- Verify all dispatches conserve GF(3)
SELECT COUNT(*) as violations
FROM dispatch_log
WHERE NOT conserved;
-- Should always be 0
```

## Configuration

```yaml
# skill-dispatch.yaml
dispatcher:
  seed: 0xf061ebbc2ca74d78
  default_bundle: core
  strict_conservation: true

bundles:
  core: [three-match, unworld, gay-mcp]
  learning: [self-validation-loop, cognitive-surrogate, agent-o-rama]
  network: [influence-propagation, bisimulation-game, atproto-ingest]

inference:
  patterns:
    - pattern: "lint|kondo|clojure"
      bundle: database
    - pattern: "train|learn|predict"
      bundle: learning
    - pattern: "network|influence|propagat"
      bundle: network
```

## Justfile Recipes

```makefile
# Dispatch a task
dispatch task="analyze" bundle="core":
    ruby lib/skill_dispatch.rb dispatch "{{task}}" "{{bundle}}"

# Execute full triad
execute-triad bundle="learning" input="data.json":
    ruby lib/skill_dispatch.rb execute "{{bundle}}" "{{input}}"

# Verify all triads conserve GF(3)
verify-triads:
    ruby lib/skill_dispatch.rb verify
```

## Example Workflow

```bash
# 1. Dispatch a learning task
just dispatch "train cognitive model" learning

# 2. Execute the triad
just execute-triad learning interactions.json

# 3. Verify conservation
just verify-triads
# Output:
# core: three-match ⊗ unworld ⊗ gay-mcp = 0 ✓
# learning: self-validation-loop ⊗ cognitive-surrogate ⊗ agent-o-rama = 0 ✓
# network: influence-propagation ⊗ bisimulation-game ⊗ atproto-ingest = 0 ✓
```

## Related Skills

- `gay-mcp` - Provides deterministic seeding
- `triad-interleave` - Interleaves dispatched tasks
- `tripartite_dispatcher.rb` - Reference implementation

Overview

This skill implements GF(3) triadic task routing to orchestrate subagents into balanced triads. Tasks are mapped to a MINUS/ERGODIC/PLUS triad whose trits sum to 0 mod 3, guaranteeing conserved routing and predictable pipelines. It provides dispatch, triad execution, cross-composition, and bundle inference utilities.

How this skill works

The dispatcher infers a bundle from the task or accepts an explicit bundle, then selects the canonical triad for that bundle: a validator (-1), a coordinator (0), and a generator (+1). Dispatch returns the triad assignment and conservation metadata; execute-triad runs the pipeline MINUS → ERGODIC → PLUS, passing outputs between subagents. Cross-compose allows mixing bundles while preserving GF(3) conservation.

When to use it

  • Orchestrating multi-step pipelines where validation, coordination, and generation must be separated.
  • Routing tasks to conservative, deterministic triads to enforce balanced subagent roles.
  • Composing subagents from different domains while maintaining a conserved execution pattern.
  • Automating role assignment for heterogeneous agent fleets (validators/coordinators/generators).
  • Auditing and logging dispatches to verify conservation and reproducibility.

Best practices

  • Provide a bundle hint for ambiguous tasks to speed and stabilize triad selection.
  • Use deterministic seeding for reproducible triad assignments in distributed runs.
  • Keep validator logic idempotent and side-effect free so pipelines remain safe to retry.
  • Log triad assignments and gf3_sum to a central store for post hoc verification.
  • Chain minimal, well-defined interfaces between triad steps to simplify composition.

Example use cases

  • Lint and validate code before transformation: dispatch a 'lint' task to the database triad and run the pipeline.
  • Train a model with validation and orchestration: dispatch a training task to the learning triad and execute the full pipeline.
  • Create hybrid workflows: cross-compose a validator from database, a coordinator from learning, and a generator from core.
  • Audit dispatch consistency: run a verification job that queries the dispatch log to ensure no conservation violations.
  • Deterministic experiments: seed the dispatcher to reproduce triad assignments across runs.

FAQ

What guarantees does GF(3) conservation provide?

Conservation ensures each dispatched task is handled by a triad whose trits sum to 0 mod 3, enforcing one validator, one coordinator, and one generator for balanced execution and predictable role coverage.

How is bundle inferred from free-text tasks?

The inference engine matches task text against configured patterns (e.g., lint|kondo → database, train|predict → learning) and falls back to a default bundle when no pattern matches.

Can I mix skills from different bundles?

Yes. cross-compose constructs hybrid triads from specified bundles while preserving GF(3) conservation so mixed-domain pipelines remain valid.