mova-whale-swarm
The groupant beside tools/whale/src/swarm.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | Forward approximant |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | Cost |
| descriptant | present | Descriptant |
| invariant | partial | Invariant |
| tests | finite evidence | tests.md |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
Model text
Descriptant
Durable multi-lane scheduling by measured worker milliseconds with pluggable discovery. Source: tools/whale/src/swarm.rs. Public, domain-agnostic: concrete prompts, schemas, gate parameters and deployments come from pinned configuration.
Forward approximant
Context validates lanes (labels, roles survey/agent, shares summing to one in ppm), workers 2..8, estimate, private dirs. drive: manager lease, identity pin, recover unresolved reservations to uncertain plus PAUSE, loop: reap children into receipts with measured elapsed ms; storage floor PAUSE; bounded discovery into pending rows with a durable cursor; reserve lanes by largest share deficit of effective time (estimates for in-flight/unmeasured), build child configs per role, spawn children inheriting the lifetime lease; write status. QueueFileDiscovery reads a pinned JSONL queue from the cursor skipping known keys. start: pinned config/executable binding, spawn manager once.
Invariant
Unresolved reservations become uncertain and are never replayed; discovery never exceeds pending capacity and advances the cursor only with inserted rows; lane choice equals the two-lane fraction rule when two lanes exist; changed config or executable needs a new root; survey payloads may override only listed keys.
Cost
SQLite queries per poll O(lanes) plus O(candidates) inserts; queue discovery O(queue bytes) per poll (bounded 128 MiB).
Composition
Uses whale::prepare for survey children and launches whale/whale-research; WhaleRoles exposes status/start to Crab.
behavior_complement
Excluded: lanes not summing to one, unknown lanes or roles, candidate keys that are not hex, payloads over bound, discovery beyond capacity, launches under PAUSE/STOP, restart after a recorded start. Counterexample: equal deficits keep configured lane order (two-lane oracle test). Evidence status: source-derived model with finite checks, not a proof.
reverse_reconstruction
From charged milliseconds per lane the order of completions is not recoverable; a lane state count admits many schedules. Manager receipts pin each child result so terminal outcomes are reconstructible per key. No unique inverse is claimed.
tests.md
16 tests: measured-time selection, deficit rule versus two-lane oracle, key/lane validation and cursor, pinned queue discovery with tamper, uncertain recovery, agent child run with branch prefix, override limits, STOP, short versus lifetime leases, pinned start, inherited lease, capacity, large history, unmeasured estimates, base rebinding, config gates.
Command: cargo test --manifest-path tools/whale/Cargo.toml --offline --locked (74 tests, fake teachers/executables; two identical runs on 2026-11-03). These are finite fixtures; no live run, model call or deployment was exercised.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/tools/whale/src/swarm.rs.groupant/