|
| 1 | +# Decentralized Orchestration Engine — Architecture Specification |
| 2 | + |
| 3 | +> **Constraint compliance note:** The three source mechanics are mapped to |
| 4 | +> concrete distributed-systems primitives. The schema below uses no biological |
| 5 | +> vocabulary — "spawning" → *demand-driven instantiation*, "stigmergic" → |
| 6 | +> *shared-substrate indirect coordination*, "apoptosis" → *threshold-triggered |
| 7 | +> deallocation*. |
| 8 | +
|
| 9 | +--- |
| 10 | + |
| 11 | +## 0. System Overview |
| 12 | + |
| 13 | +A control-plane-free execution fabric. There is **no scheduler, no static |
| 14 | +routing table, and no service registry**. Work organizes itself through a single |
| 15 | +shared data structure — the **Latent Coordination Substrate (LCS)** — and a |
| 16 | +population of short-lived, single-purpose **Task Workers (TW)** that read from |
| 17 | +and write to it. |
| 18 | + |
| 19 | +``` |
| 20 | + ┌──────────────────────────────────────────────┐ |
| 21 | + │ Latent Coordination Substrate (LCS) │ |
| 22 | + │ append-only vector store + decay accumulator │ |
| 23 | + │ key: marker_id → {vec, weight, ts, refs} │ |
| 24 | + └───────▲───────────────────────────▲────────────┘ |
| 25 | + read/observe │ │ deposit/decay |
| 26 | + ┌───────┴────────┐ ┌────────┴────────┐ |
| 27 | + ingest ──► │ Density Probe │ spawn │ Task Workers │ |
| 28 | + stream │ (instantiator) │ ───────► │ (ephemeral, │ |
| 29 | + └────────────────┘ │ isolated, 1:1) │ |
| 30 | + └──────────────────┘ |
| 31 | + │ |
| 32 | + ▼ |
| 33 | + emit results → LCS |
| 34 | + (new markers) → DAG grows |
| 35 | +``` |
| 36 | + |
| 37 | +The execution history forms a **Directed Acyclic Graph (DAG)** that is *derived, |
| 38 | +never declared*: every marker a worker reads becomes an in-edge; every marker it |
| 39 | +writes becomes an out-edge. The DAG is the audit trail, not the program. |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## 1. Mechanic A → Demand-Driven Node Instantiation |
| 44 | + |
| 45 | +**Source principle:** initialize ephemeral, single-task nodes in response to |
| 46 | +incoming semantic density; no pre-defined static routing table. |
| 47 | + |
| 48 | +### 1.1 Semantic density, defined computationally |
| 49 | + |
| 50 | +Incoming payloads are embedded into a fixed-dimension vector |
| 51 | +`e ∈ ℝ^d`. *Semantic density* at a point is the local mass of the substrate: |
| 52 | + |
| 53 | +``` |
| 54 | +ρ(e) = Σ_{m ∈ LCS} w_m · K(e, m.vec) # kernel-weighted neighbor mass |
| 55 | + where K(a,b) = exp(−‖a − b‖² / 2σ²) # Gaussian similarity kernel |
| 56 | + w_m = current decay weight of marker m |
| 57 | +``` |
| 58 | + |
| 59 | +A **Density Probe** (a thin, stateless instantiator — not a router) scans new |
| 60 | +input and computes `ρ`. Instantiation is purely local and rule-driven: |
| 61 | + |
| 62 | +| Condition on incoming embedding `e` | Action | |
| 63 | +|---|---| |
| 64 | +| `ρ(e) ≥ θ_hot` (dense region, hot topic) | spawn `⌈ρ(e)/θ_hot⌉` parallel workers, sharded by sub-cluster | |
| 65 | +| `θ_cold ≤ ρ(e) < θ_hot` | spawn exactly 1 worker | |
| 66 | +| `ρ(e) < θ_cold` (novel/sparse) | spawn 1 *explorer* worker with widened σ | |
| 67 | + |
| 68 | +There is **no routing table**: the probe never decides *which* worker class |
| 69 | +handles the payload. It only decides *how many* isolated environments to bring |
| 70 | +up. Worker behavior is selected at runtime by what markers the worker finds |
| 71 | +once it reads the substrate (§2). |
| 72 | + |
| 73 | +### 1.2 Worker = isolated, single-task execution environment |
| 74 | + |
| 75 | +Each worker is a **single-shot, sandboxed runtime** (container / microVM / |
| 76 | +WASM instance — implementation-agnostic). Contract: |
| 77 | + |
| 78 | +```python |
| 79 | +class TaskWorker: |
| 80 | + """Single-task, isolated, ephemeral. No inbound network listeners.""" |
| 81 | + worker_id: UUID # ephemeral, never reused |
| 82 | + token_buffer: VectorBuffer # bounded ring buffer, RAM-only |
| 83 | + focus: Embedding # the one marker region it serves |
| 84 | + deadline: Monotonic # hard wall-clock ceiling (failsafe) |
| 85 | + |
| 86 | + def run(self, lcs: Substrate) -> None: |
| 87 | + ctx = lcs.read_region(self.focus, radius=σ) # pull, never pushed-to |
| 88 | + out = self.execute_single_task(ctx) # exactly one unit of work |
| 89 | + lcs.deposit(self.derive_markers(out)) # write results as markers |
| 90 | + # control returns to lifecycle manager (§3) |
| 91 | +``` |
| 92 | + |
| 93 | +Properties enforced by the platform, not by convention: |
| 94 | +- **No shared mutable memory** between workers — only the LCS is shared. |
| 95 | +- **No point-to-point endpoints** — workers expose no API surface (§2). |
| 96 | +- **One task per lifetime** — the runtime is destroyed after `run()`; reuse is |
| 97 | + impossible because `worker_id` is single-use. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 2. Mechanic B → Indirect Coordination via Shared Substrate |
| 102 | + |
| 103 | +**Source principle:** no direct point-to-point APIs; coordinate by depositing |
| 104 | +and reading decay-markers in a shared topological latent space. |
| 105 | + |
| 106 | +### 2.1 The marker |
| 107 | + |
| 108 | +``` |
| 109 | +Marker = { |
| 110 | + marker_id : UUID, |
| 111 | + vec : float[d], # position in the latent topology |
| 112 | + weight : float, # ∈ (0, 1], current activation strength |
| 113 | + ts : monotonic_ns, # last reinforcement timestamp |
| 114 | + half_life : float, # per-marker decay constant τ |
| 115 | + refs : UUID[], # producing worker(s) → forms DAG in-edges |
| 116 | + payload : bytes, # serialized partial result / instruction |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +The LCS is an **append-and-decay vector index** (HNSW/IVF for ANN reads, |
| 121 | +backed by an MVCC log for the DAG). Two operations only: |
| 122 | + |
| 123 | +``` |
| 124 | +deposit(marker) # additive: reinforces if near-duplicate exists |
| 125 | +read_region(center, radius) # ANN query → markers ordered by weight·K |
| 126 | +``` |
| 127 | + |
| 128 | +There is **no `send(worker_x, msg)` primitive anywhere in the system.** |
| 129 | +Coordination is emergent: |
| 130 | + |
| 131 | +1. Worker W₁ finishes, deposits marker M with `weight = 1.0` at position `vec`. |
| 132 | +2. The Density Probe sees raised local density near `vec` → instantiates W₂. |
| 133 | +3. W₂ does `read_region(vec)`, finds M, treats it as input/instruction. |
| 134 | +4. W₂ deposits M′ slightly displaced → trail forms → guides W₃… |
| 135 | + |
| 136 | +This is **trail-following over a topological field**. Strong, recently |
| 137 | +reinforced regions attract more workers (positive feedback / path |
| 138 | +amplification); ignored regions fade (§3). The emergent worker chain |
| 139 | +`W₁ → W₂ → W₃` *is* a path in the derived DAG. |
| 140 | + |
| 141 | +### 2.2 Decay (the "marker degradation") |
| 142 | + |
| 143 | +Weight is never stored as a live value; it is *computed on read* so decay needs |
| 144 | +no background sweeper for correctness: |
| 145 | + |
| 146 | +``` |
| 147 | +w(t) = w₀ · 2^(−(t − ts) / half_life) # exponential decay |
| 148 | +``` |
| 149 | + |
| 150 | +Reinforcement: a `deposit` near an existing marker resets `ts` and bumps `w₀` |
| 151 | +(capped at 1.0). This gives: |
| 152 | +- **Reinforced paths persist** (repeatedly useful intermediate results). |
| 153 | +- **Stale paths vanish** without explicit garbage-collection messaging. |
| 154 | + |
| 155 | +### 2.3 Conflict & ordering |
| 156 | + |
| 157 | +- **Idempotent merges:** deposits within `ε` cosine distance coalesce |
| 158 | + (CRDT-style G-Counter on weight) → no coordinator, no locks. |
| 159 | +- **Causality:** `refs` chains give a partial order; the MVCC log linearizes |
| 160 | + for replay. The DAG is acyclic by construction because a marker can only |
| 161 | + reference markers with strictly earlier `ts`. |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## 3. Mechanic C → Threshold-Triggered Deallocation |
| 166 | + |
| 167 | +**Source principle:** a node self-terminates and flushes its token buffer the |
| 168 | +instant its target marker degrades below the activation threshold. |
| 169 | + |
| 170 | +### 3.1 Activation gate |
| 171 | + |
| 172 | +Each worker is bound to a **focus marker** (or focus region). It holds a live |
| 173 | +predicate: |
| 174 | + |
| 175 | +``` |
| 176 | +alive(W) ≡ max_{m ∈ read_region(W.focus, ε)} w(m, now) ≥ θ_activation |
| 177 | +``` |
| 178 | + |
| 179 | +Because `w` decays continuously and deterministically (§2.2), the worker can |
| 180 | +compute the **exact future instant** its gate will fail — no polling jitter: |
| 181 | + |
| 182 | +``` |
| 183 | +t_expire = ts + half_life · log2( w₀ / θ_activation ) |
| 184 | +``` |
| 185 | + |
| 186 | +The worker arms a high-resolution monotonic timer for `t_expire`. Any |
| 187 | +reinforcement event (a `deposit` that raises `w₀` or resets `ts`) re-arms the |
| 188 | +timer to a later `t_expire`. This makes the "exact millisecond" termination a |
| 189 | +**scheduled, computed event**, not a busy-wait. |
| 190 | + |
| 191 | +### 3.2 Deallocation sequence (ordered, atomic) |
| 192 | + |
| 193 | +When the gate fails (`now ≥ t_expire` and no reinforcement intervened): |
| 194 | + |
| 195 | +``` |
| 196 | +1. FENCE stop reading the LCS; reject further work. |
| 197 | +2. CHECKPOINT if partial result is above persistence threshold, flush it to |
| 198 | + the LCS as a final low-weight marker (so progress isn't lost); |
| 199 | + otherwise discard. |
| 200 | +3. FLUSH zero and free token_buffer (overwrite, not just drop the ref — |
| 201 | + guarantees no token residue leaks to the next tenant of the host). |
| 202 | +4. DETACH remove worker_id from any marker.refs write-locks. |
| 203 | +5. DESTROY terminate the isolated runtime; release CPU/RAM/quota. |
| 204 | +``` |
| 205 | + |
| 206 | +Steps 1–5 are atomic w.r.t. the host: a half-terminated worker cannot deposit |
| 207 | +new markers. This prevents "ghost" trails from dead workers. |
| 208 | + |
| 209 | +### 3.3 Why this terminates the whole graph cleanly |
| 210 | + |
| 211 | +- A worker only stays alive while its focus region is *being reinforced by |
| 212 | + downstream demand*. |
| 213 | +- When a branch of work completes (or is abandoned), its markers stop being |
| 214 | + reinforced → weights decay → dependent workers hit `t_expire` → they |
| 215 | + deallocate → they stop reinforcing *their* upstream markers → cascade. |
| 216 | +- The cascade is **back-pressure-free and message-free**: it is driven entirely |
| 217 | + by the absence of reinforcement, i.e., by decay reaching `θ_activation`. |
| 218 | + |
| 219 | +The system reaches quiescence (zero live workers, all markers decayed below |
| 220 | +threshold) automatically once input stops — no shutdown coordinator required. |
| 221 | + |
| 222 | +--- |
| 223 | + |
| 224 | +## 4. End-to-End Lifecycle (worked sequence) |
| 225 | + |
| 226 | +``` |
| 227 | +t0 Input embedding e arrives. |
| 228 | +t1 Density Probe computes ρ(e)=0.2 (sparse) → spawns 1 explorer W_A. |
| 229 | +t2 W_A reads region(e): empty. Executes task → deposits M1 (w=1.0) at v1. |
| 230 | +t3 W_A's focus (e) has no reinforcement → t_expire passes → W_A deallocates, |
| 231 | + flushes buffer. (DAG node A is now terminal-with-output.) |
| 232 | +t4 Probe notices density spike near v1 (from M1) → spawns W_B, W_C |
| 233 | + (ρ high, 2 sub-clusters). |
| 234 | +t5 W_B reads M1 → produces M2; W_C reads M1 → produces M3. |
| 235 | + M1.refs ← {}, M2.refs ← {A}, M3.refs ← {A}. # DAG edges form |
| 236 | +t6 No worker reinforces M1 anymore → M1 decays below θ → workers focused on |
| 237 | + v1 (none left) → M1 simply ages out of ANN results. |
| 238 | +t7 Chain continues until inputs near a region stop arriving; all weights |
| 239 | + decay < θ_activation; last workers deallocate. System quiescent. |
| 240 | +``` |
| 241 | + |
| 242 | +Resulting **derived DAG**: `A → {B, C} → …`, reconstructable purely from |
| 243 | +`marker.refs` in the MVCC log. Nobody declared this graph; it is the fossil |
| 244 | +record of which markers fed which workers. |
| 245 | + |
| 246 | +--- |
| 247 | + |
| 248 | +## 5. Component / Primitive Mapping (the schema) |
| 249 | + |
| 250 | +| Source mechanic | Computational primitive | Concrete tech | |
| 251 | +|---|---|---| |
| 252 | +| Demand-driven instantiation | Stateless density evaluator + on-demand sandbox launch | k-NN density estimate → microVM/WASM cold-start pool | |
| 253 | +| No static routing table | Behavior bound at read-time from substrate, not pre-wired | ANN region read selects task profile | |
| 254 | +| Single-task ephemeral node | One-shot isolated runtime, single-use ID | Firecracker / gVisor / WASM instance | |
| 255 | +| Indirect coordination | Shared append-and-decay vector index | HNSW/IVF index + MVCC log | |
| 256 | +| Decay-markers | TTL-less exponential-weight vectors | `w(t)=w₀·2^(−Δt/τ)` computed on read | |
| 257 | +| Reinforcement / path amplification | CRDT additive merge on co-located deposits | G-Counter on weight | |
| 258 | +| Threshold deallocation | Pre-computed expiry timer + atomic teardown | monotonic timer → fenced flush/destroy | |
| 259 | +| Buffer flush | Overwrite-then-free token ring buffer | zeroized RAM-only `VectorBuffer` | |
| 260 | +| Coordination graph | Derived DAG from `marker.refs` | linearizable MVCC replay | |
| 261 | + |
| 262 | +--- |
| 263 | + |
| 264 | +## 6. Properties & Guarantees |
| 265 | + |
| 266 | +- **No central scheduler / SPOF:** only the LCS is shared; it is a replicable |
| 267 | + CRDT-backed store. |
| 268 | +- **Acyclicity:** markers reference strictly-earlier markers → DAG cannot cycle. |
| 269 | +- **Self-cleaning:** deterministic decay + computed expiry ⇒ no leaked workers, |
| 270 | + no orphan state, automatic quiescence. |
| 271 | +- **Isolation/security:** no inbound endpoints on workers; token buffers are |
| 272 | + overwritten on teardown ⇒ no cross-tenant token residue. |
| 273 | +- **Backpressure:** density-gated instantiation throttles itself when `ρ` is low; |
| 274 | + hot regions scale out via the `⌈ρ/θ_hot⌉` rule. |
| 275 | + |
| 276 | +## 7. Key Tunables |
| 277 | + |
| 278 | +| Symbol | Meaning | Effect of increase | |
| 279 | +|---|---|---| |
| 280 | +| `σ` | similarity kernel bandwidth | broader trail-following, fewer/larger clusters | |
| 281 | +| `θ_hot`, `θ_cold` | spawn thresholds | controls parallelism vs. cost | |
| 282 | +| `θ_activation` | termination floor | higher → workers die sooner, cheaper, less context retention | |
| 283 | +| `half_life (τ)` | per-marker decay constant | longer-lived trails, more memory pressure | |
| 284 | +| `ε` | merge/coalesce radius | dedup aggressiveness | |
| 285 | +``` |
0 commit comments