home / skills / plurigrid / asi / pre-agent-ontology

pre-agent-ontology skill

/skills/pre-agent-ontology

This skill analyzes and enforces trifurcation patterns across a three-way derivation, ensuring deterministic, cocycle-consistent agent emergence.

npx playbooks add skill plurigrid/asi --skill pre-agent-ontology

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

Files (1)
SKILL.md
6.1 KB
---
name: pre-agent-ontology
description: 'Pre-Agent Ontology Skill'
version: 1.0.0
---

# Pre-Agent Ontology Skill

**Trit**: 0 (ERGODIC - coordinates the ontology)

Foundational 5-layer ontology for agent-o-rama. Agents are not primitives—they emerge from derivations, stalks, and sections when gluing succeeds.

## Related Skills
- **unworld**: Derivational succession (Layer 1)
- **sheaf-cohomology**: Gluing verification (Layer 2)
- **bisimulation-game**: Observational equivalence (Layer 2)
- **acsets**: Categorical database structure (Layer 2)

---

## 5-Layer Hierarchy

```
Layer 4: EMERGENT        agent, skill, experiment
            ↑
Layer 3: OPERATIONAL     node, emit, aggregation, result
            ↑
Layer 2: SHEAF           stalk, section, cohomology
            ↑
Layer 1: DERIVATIONAL    derivation, chain
            ↑
Layer 0: PRE-ONTOLOGICAL seed, trit, γ (gamma)
```

### Layer 0: Pre-Ontological (Absolute Primitives)

| Term | Type | Definition |
|------|------|------------|
| seed | uint64 | Deterministic state replacing time |
| trit | {-1, 0, +1} | GF(3) charge element |
| γ | constant | 0x9E3779B97F4A7C15 (golden ratio bits) |

### Layer 1: Derivational

| Term | Type | Definition |
|------|------|------------|
| derivation | (Seed × Trit) → (Seed × Section) | Fundamental computation unit |
| chain | [Seed] | Sequence of derived seeds |

**Rule**: `seed_{n+1} = splitmix64(seed_n ⊕ (trit_n × γ))`

### Layer 2: Sheaf-Theoretic

| Term | Type | Definition |
|------|------|------------|
| stalk | Set(Section) | Collection of sections over one trit |
| section | local data | Output of derivation, can glue |
| cohomology | (H⁰, H¹) | Global sections and obstructions |

**Stalk Distribution (2-3-2)**:
```
MINUS:   2 elements, trit=-1, role=validator
ERGODIC: 3 elements, trit=0,  role=coordinator
PLUS:    2 elements, trit=+1, role=generator

Verification: 2(-1) + 3(0) + 2(+1) = 0 ✓
```

### Layer 3: Operational

| Term | Sheaf Correspondence |
|------|---------------------|
| node | section-producer |
| emit | stalk transition |
| aggregation | gluing (cocycle check) |
| result | global section (H⁰ element) |

### Layer 4: Emergent

| Term | Definition |
|------|------------|
| agent | Fiber bundle over trit poset {-1, 0, +1} |
| skill | Executable section (self-contained knowledge) |
| experiment | Derivation chain evaluation |

**Key**: `Agent = Observation(Bundle(Stalk₋₁, Stalk₀, Stalk₊₁))`

---

## 5 Stability Invariants

| ID | Invariant | Formula | Verified By |
|----|-----------|---------|-------------|
| I1 | GF(3) Conservation | `Σ trits ≡ 0 (mod 3)` | aggregation, trifurcate |
| I2 | Determinism | `derive(s,t) = derive(s,t)` | seed chaining |
| I3 | Order Independence (SPI) | `parallel(f) = sequential(f)` | spi-parallel-verify |
| I4 | Gluing (Cocycle) | `g_ij ∘ g_jk = g_ik` | cohomology check |
| I5 | Bisimulation | `A ~ B ⟺ ∀obs. obs(A) = obs(B)` | bisimulation-game |

---

## Key Primitives

### Seed
64-bit unsigned integer replacing temporal state. Same seed → identical derivation chains.

### Trit
GF(3) element in {-1, 0, +1}. Forms a field under modular arithmetic.

### Derivation
Fundamental computation: `(Seed × Trit) → (Seed × Section)`

Replaces temporal succession with seed-based chaining.

### Stalk
Collection of sections over a single trit value. Organized as fiber bundle.

### Section
Local data produced by derivation. Sections glue to form global sections when cocycle condition holds.

---

## Trifurcation Pattern (MANDATORY)

Every operation MUST split into three sub-derivations:

```
             intent
                │
       ┌────────┼────────┐
       ▼        ▼        ▼
    MINUS    ERGODIC   PLUS
    (-1)      (0)      (+1)
   validate  coordinate generate
       │        │        │
       └────────┼────────┘
                ▼
           aggregate
         (verify Σ=0)
```

| Sub-Agent | Trit | Role | Skills |
|-----------|------|------|--------|
| MINUS | -1 | Validator | spi-parallel-verify, bisimulation-game |
| ERGODIC | 0 | Coordinator | glass-bead-game, triad-interleave |
| PLUS | +1 | Generator | gflownet, self-evolving-agent |

---

## Clojure Implementation

### Constants
```clojure
(def GENESIS-SEED 0x42D)
(def GAMMA 0x9E3779B97F4A7C15)
(def MIX1 0xBF58476D1CE4E5B9)
(def MIX2 0x94D049BB133111EB)
```

### Derivation
```clojure
(defn derive-seed [seed trit]
  (let [adjusted (bit-xor seed (* trit GAMMA))]
    (splitmix64-next adjusted)))

(defn derivation-chain [genesis-seed trits]
  (reductions derive-seed genesis-seed trits))
```

### GF(3) Arithmetic
```clojure
(defn gf3-add [a b]
  (let [sum (+ a b)]
    (cond (> sum 1)  (- sum 3)
          (< sum -1) (+ sum 3)
          :else      sum)))

(defn gf3-conserved? [trits]
  (zero? (reduce gf3-add 0 trits)))
```

### Trifurcate Pattern
```clojure
;; Scatter: emit three roles
(aor/agg-start-node
 "scatter"
 "execute-role"
 (fn [agent-node {:keys [intent]}]
   (aor/emit! agent-node "execute-role" {:intent intent :role :minus})
   (aor/emit! agent-node "execute-role" {:intent intent :role :ergodic})
   (aor/emit! agent-node "execute-role" {:intent intent :role :plus})))

;; Gather: verify conservation
(aor/agg-node
 "execute-role"
 nil
 aggs/+vec-agg
 (fn [agent-node requests _]
   (let [results (mapv execute-role requests)
         trits (mapv :trit results)
         conserved? (gf3-conserved? trits)]
     (aor/result! agent-node {:conserved conserved? :trits trits}))))
```

---

## Verification Checklist

Before any operation completes:

- [ ] GF(3) sum ≡ 0 (mod 3)
- [ ] All three trits represented (trifurcation)
- [ ] Cocycle condition satisfied (sections glue)
- [ ] Deterministic (same seed → same result)
- [ ] Order-independent (SPI holds)

---

## Sources

- [ONTOLOGY.md](file:///Users/alice/agent-o-rama/agent-o-rama/dev/terms/ONTOLOGY.md)
- [derivation.md](file:///Users/alice/agent-o-rama/agent-o-rama/dev/terms/derivation.md)
- [CONTINUITY.md](file:///Users/alice/agent-o-rama/agent-o-rama/examples/clj/src/com/rpl/agent/CONTINUITY.md)

Overview

This skill defines a compact, 5-layer pre-agent ontology that turns derivations into emergent agents through a mandatory trifurcation pattern. It replaces time with deterministic 64-bit seeds and a GF(3) trit charge, and it frames local-to-global composition using stalks, sections, and cohomology. The outcome is a verifiable pipeline for producing agents, skills, and experiments from seed-based derivation chains.

How this skill works

The skill prescribes seed-based derivations: derive(seed, trit) → (seed, section) and chains of seeds replace temporal state. Each intent must split into three sub-derivations (minus, ergodic, plus) whose trits sum to zero mod 3; sections produced by derivations live in stalks and glue to global sections when the cocycle condition holds. Operational nodes emit and aggregate sections, running checks for GF(3) conservation, determinism, SPI order independence, and bisimulation equivalence to validate emergent agents.

When to use it

  • Designing deterministic agent emergence pipelines from stateless primitives
  • Implementing local-to-global composition where gluing/cohomology matters
  • Enforcing three-way validation/coordination patterns (trifurcation)
  • Verifying invariants like GF(3) conservation and cocycle conditions
  • Building experiments from derivation chains with reproducible seeds

Best practices

  • Always derive from a fixed genesis seed to ensure reproducibility
  • Enforce trifurcation: produce minus, ergodic, and plus sub-derivations for every intent
  • Verify GF(3) conservation early in aggregation to short-circuit invalid runs
  • Run cocycle (gluing) checks before accepting global sections
  • Use deterministic splitmix64-style mixing for seed transitions to preserve deterministic chaining

Example use cases

  • A coordinator node splits an intent into validator, coordinator, and generator roles and aggregates results only if trits sum to zero
  • A testing harness that feeds the same seed+trit sequences to validate determinism and order independence across implementations
  • A skill registry that treats executables as sections and accepts them as global skills only after cocycle verification
  • Experiment orchestration where an experiment is the evaluation of a derivation chain producing an emergent agent

FAQ

What is a trit and why use GF(3)?

A trit is an element in {-1,0,+1} operating under GF(3) arithmetic. It enforces a three-way conservation constraint that powers the trifurcation pattern and simple parity-like invariants.

How does determinism hold across derivations?

Determinism is achieved by using a fixed mixing function on 64-bit seeds (splitmix64-style) combined with deterministic trit adjustments; identical seed+trit sequences produce identical derivation chains.