mova-whale-agent
The groupant beside tools/whale/src/agent.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
One bounded agent session in an isolated Git worktree with configured prompt, scopes and protected files. Source: tools/whale/src/agent.rs. Public, domain-agnostic: concrete prompts, schemas, gate parameters and deployments come from pinned configuration.
Forward approximant
parse: validate model/effort, absolute paths, full commit, branch under branch_prefix, pin counts, write directories (pinned source sidecars or pinned scope manifest directories), write files (pinned, matching write_file_rule). run: job operation lock, cached report or refuse unresolved reservation, render template (all slots once), verify pins at base, refuse non-new worktree/inside-repo/retention cap/storage floor, reserve, add worktree branch, run the transport (workspace-write sandbox, network off, credentials cleared, timeout/output limit -> uncertain), finalize (HEAD unchanged, pins, protected blob hashes, changed paths inside scopes, staged guard, patch and candidate commit), optionally archive the clean worktree, write report.
Invariant
At most one agent call per job identity; any report is final (cached); production files with protected suffixes outside scopes are byte-identical in admitted candidates; nothing is merged or pushed; completion is not test evidence.
Cost
One external agent session bounded by timeout and 8 MiB output; Git observations O(tree) for protected hashing.
Composition
Launched by swarm agent lanes as whale-research CONFIG; standalone via CLI.
behavior_complement
Excluded: writes outside scopes, symlinks, escaped or oversized files, protected byte changes (including assume-unchanged tricks), HEAD changes, guard rejection, altered template, forged scope pins, mismatched scope manifest fields, non-Codex models, branches outside the prefix. Counterexample: a hidden assume-unchanged edit to a protected file is detected by raw blob hashes. Evidence status: source-derived model with finite checks, not a proof.
reverse_reconstruction
From a candidate commit and patch one reconstructs the exact changed files on the pinned base; from a quarantine reason only the failing gate is known; uncertain sessions admit several partial edit histories and are never replayed. No unique inverse is claimed.
tests.md
14 tests with a fake agent executable and fixture Git repositories.
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/agent.rs.groupant/