Independent scholarship · Open accessThe monthly digest

Editorially reviewed

Executable Higher Semantics for Cloud-Portable Agent Swarms

A typed swarm specification compiles to a durable VM through explicit cloud contracts. Finite-trace safety, atomic decisions, guarded synthesis, and checkpoint migration are proved conditionally. A finite compiler/VM companion checks 54,241 request sequences and 813,615 restored continuations; three cloud profiles remain declarative.

Anonymous← All research

Executable Higher Semantics for Cloud-Portable Agent Swarms

Anonymous - 12 October 2026 - Submission manuscript, version 0.1

Submission synopsis. This journal body is a compact, self-contained synopsis. The attached PDF is the complete manuscript, with all 13 sections, definitions, written proofs, cloud contract mappings, and references. The accompanying source bundle contains editable Markdown and LaTeX, an offline MathML edition, the executable finite compiler/VM, and reproducibility evidence.

Abstract

We formalize an agent-swarm framework whose executable specifications can be lowered to a durable virtual machine and implemented through cloud execution, persistence, messaging, and model-generation interfaces. The semantic layer consists of typed state families, directed transition witnesses, finite interaction constraints, and admissibility predicates in an infinity-topos or another explicitly descent-compatible base. A computable presentation supplies serializable states, total guarded handlers, typed effect intents, and realization witnesses; abstract higher structure alone is not an executable representation. We define source and intermediate-language semantics, a version-conditional atomic commit protocol, persistent deduplication, and a provider contract. Written proofs establish finite-trace safety, guard-preserving lowering, at-most-once logical decisions, conditional target-to-source trace refinement, and checkpoint continuation. Model-generated code is admitted only through an explicitly scoped validator. Cloudflare, AWS, and Google Cloud are candidate implementations of the contract, with provider-specific obligations. An executable finite companion checks 54,241 bounded request sequences and 813,615 checkpoint continuations. The contribution is a conditional compilation architecture, not a verified production compiler or an automatic implementation of arbitrary higher semantic objects.

1. Semantic and executable layers

A semantic swarm consists of an architecture object, role and state families, a complete configuration object $Z$, a directed correspondence $Z\xleftarrow{s}E\xrightarrow{t}Z$, labels, and an admissibility monomorphism $V\hookrightarrow Z$. A finite-limit semantic base suffices for fixed finite wiring and paths. Contextual descent additionally requires specified covers with

$$ \mathcal X_{/T}\simeq\lim_{[n]\in\Delta}\mathcal X_{/U_n}. $$

Infinity-topoi provide this descent for effective epimorphisms [6]. Other semantic bases are supported only for the structure they actually supply. A safety certificate is a target lift $E\times_{s,Z}V\to V$. Finite induction proves that paths starting in $V$ remain in $V$.

An executable presentation supplies computable states, typed commands, total guarded decisions, exact wire codecs, and realization witnesses linking each reachable state and decision to the semantic diagram. Those witnesses must be coherent in the contexts where they are used. Arbitrary higher objects are not implicitly serializable. A graph of primitive events does not automatically supply a Segal composition law, and pointwise existence of realizations is not a global implementation choice.

The earlier swarm, temporal, numerical, optimizer, and runtime-gate papers [1-5] supply the research lineage. The complete manuscript uses their restricted contracts, without enlarging numerical or learning guarantees.

2. Source language, effects, and lowering

The source language, SwarmSpec, declares finite algebraic types, state, initial values, capabilities, handlers, invariants, codecs, and realization obligations. Every command variant has a unique handler or an explicitly ordered exhaustive decision tree. A handler evaluates a pure snapshot and returns business-state proposals, ordered typed effect intents, and an observation. External effects occur after durable commitment; responses become future guarded input commands.

The complete logical state retains business and optimizer memory, architecture epoch, revision, terminal inbox decisions, pending effect identities, accepted oracle records, and resource/capability ledgers. Keys are scoped by swarm, principal, and admission namespace. A fresh request's function $F_P$ stores its bound command and result, allocates ordered effect identities, appends the observation, and advances the revision. Fresh guard rejections preserve business state while still recording a terminal decision.

Type and effect checking establishes interface and authority compatibility. Semantic invariants require separate certificates:

$$ V_P(u)\Longrightarrow V_P(F_P(u,k,c)). $$

The source safety theorem proves preservation along finite decision sequences and realization of certified semantic paths. Conjunctive invariants compose when every written dependency has a preservation certificate and every other dependency has a sound frame rule.

SwarmIR uses pure typed instructions, guards, private stores, intent construction, and terminal rejection or commit. It contains no network operation inside a handler. Structural induction proves expression lowering for the reference first-order fragment. Handler lowering preserves proposals, observations, and ordered intents when it preserves guard values, assignment evaluation order, and intent bindings. Pure value equality alone does not justify eliminating or moving an observable effect.

A compiler returns IR, a target deployment plan, a capability/resource manifest, and checked or outstanding obligations. Unsupported targets or exceeded atomic bounds produce an error. The reference companion implements a finite fragment; the general proofs are written and not proof-assistant checked.

3. Durable decision protocol

The VM authenticates and decodes the request, reads its bound inbox entry, and either returns an existing identical result or reports a key conflict. For a fresh key, it reads a state and revision, evaluates the pure IR handler, and performs one atomic transaction that checks the revision and key absence and writes the complete next state, inbox decision, resource changes, and outbox intents. It acknowledges only after durable commitment. On an uncertain outcome it resolves the inbox key before attempting another decision. Transaction callbacks perform no external I/O.

Unique logical decision theorem (full manuscript, Theorem 6.2). If conflicting updates serialize atomically and inbox bindings remain retained during the accepted replay horizon, at most one logical decision commits per request key. Every subsequent identical retry returns its terminal result.

Proof. Order two hypothetical commits by serialization. The first inserts the key; the second requires its absence, contradicting retention. Retries consult the stored binding and append no new decision. Revision checks prevent stale proposals from bypassing that argument. $\square$

A crash before commit leaves no decision. A crash after commit but before acknowledgment retains the inbox and outbox. The result is at-most-once logical commitment, not unconditional eventual completion.

A correspondence gate may validate an individual candidate complete result by

$$ \Gamma_P(u,k,c,\widehat u)=\mathsf{accept} \Longleftrightarrow \widehat u=F_P(u,k,c). $$

Equality includes observations, payload identities, reservations, and intent arguments. A control-only comparison certifies only that projection. An equality gate is sound by substitution into the source invariant certificate; the gate, decoder, and primitive registry remain trust boundaries unless independently verified.

4. Conditional portability result

A backend realization supplies an abstraction to complete logical state, exact codecs, atomic revision/key-conditional commitment, conforming effect and response adapters, authority isolation, and explicit resource/retention bounds. Each physical step must either leave the abstract state and logical history unchanged or implement one source decision with the same observation and effect record.

The complete manuscript derives this step classification for an adapter following the atomic protocol: reads and pure evaluation are silent, failed transactions change no logical field, a successful transaction writes one source decision at its linearization point, cached replies add no decision, and recovery uses the durable inbox. Dispatch bookkeeping is silent only when confined to nonlogical fields.

Finite target-to-source trace refinement (full manuscript, Theorem 8.3). For a certified source module, guard-preserving lowering, and a conforming backend $B$,

$$ \mathsf{hide}_B\bigl(\operatorname{Tr}_{\mathrm{fin}} (\mathsf{run}_B(\mathsf{compile}_B(P)))\bigr) \subseteq \operatorname{Tr}_{\mathrm{fin}}(P). $$

Every reachable target logical state satisfies the source invariant, and its decisions realize certified finite semantic paths.

Proof. Induct on physical steps from the initial correspondence. A silent step preserves the existing source prefix. A committed step appends the matching source decision, by the backend classification and handler lowering. Its source certificate preserves the invariant and supplies the semantic witness. Finite induction proves trace inclusion and endpoint safety. $\square$

The theorem applies to any provider meeting the contract. It does not assert that every provider already meets it, that two providers generate identical model outputs, or that finite safety entails deadlines or liveness. Logical observations are first durable decisions, including normalized rejections and effect identities. Latency, billing, repeated physical invocations, and diagnostics are outside that history unless explicitly added to the source semantics.

5. Effects, synthesis, migration, and failure boundaries

Dispatchers may retry a committed intent. At most one external mutation requires a destination that durably binds identity and arguments to one result, or another proved transactional protocol. Without it, a lost reply after a counter increment is indistinguishable from a lost invocation; retrying can duplicate the mutation while declining to retry can lose it. A local outbox alone cannot decide which occurred.

Generation APIs need not provide exactly-once behavior. The source records an accepted candidate response; replay consumes that record. Physical attempts and charges require their own budget semantics. Epoch checks reject stale receipts at admission; external resources must enforce fencing at mutation time if old workers are to lose authority.

Generated programs are candidates until validation. An admission receipt binds exact artifact bytes, contract, dependencies, validator version, runtime ABI, effects, and evidence. A semantic assurance claim requires a soundness law

$$ \mathsf{Check}_C(p,w)=\mathsf{true} \Longrightarrow\mathsf{Meaning}(p)\models C. $$

Bounded tests certify only their declared test obligation. Signatures establish provenance or authorization, not semantic correctness. Execution adapters must enforce the admitted authority and ABI.

An exact checkpoint codec satisfies $\mathsf{dec}(\mathsf{enc}(u))=u$ on its declared domain. This implies encoding injectivity and equality of deterministic finite continuation under the same command and recorded-oracle stream. Artifact and authority availability are separate restore obligations.

Migration needs a continuation-complete checkpoint, equivalent pending external obligations, compatible realization witnesses, and a unique fenced admission authority. A coordinator-local epoch change does not create a cross-cloud atomic handoff. Under the migration and backend contracts, both providers refine the same source continuation; fixed completed deterministic streams agree.

Corrections preserve old sources, observation contracts, evidence, and counterexamples under immutable versions. They require explicit conversions or refinement relations for live migration. An incorrect assertion remains a documented historical result, not a theorem made true by versioning.

6. Cloud mappings and executable evidence

The baseline has one atomic coordinator domain per swarm, with distributed worker computation. Proposed mappings are Worker plus one SQLite-backed Durable Object and Queues; Lambda plus a same-Region DynamoDB transaction and SQS; and Cloud Run plus a Firestore server transaction and Pub/Sub. The complete manuscript cites current official documents and states their restrictions. It does not assume an atomic transaction spans the coordinator, object store, broker, and model API.

Generation adapters can call Workers AI, Bedrock Converse, Google's generate-content API, or an independently configured model service. Execution portability requires a declared ABI, dependencies, codec, imports, memory, and time bounds. Unsupported native programs cannot be silently treated as portable Worker/Wasm modules.

The executable companion uses a proposer/reviewer/executor workflow with five admissible business states and five commands. An abstract good/bad artifact classification stands for a validator result. Review requires a good proposed artifact; run requires reviewed state and emits a typed intent. An independent direct transition table supplies the test oracle.

It checks 75 source/bytecode transitions across three declarative target plans, 54,241 request words through length four, and 813,615 restored next-request continuations. It inspects 83,700 repeated or conflicting-key steps; checks crashes before commitment, after commitment before acknowledgment, and competing snapshots; and simulates four deliveries causing one idempotent logical effect. Four negative controls detect an omitted review guard, a non-atomic lost outbox intent, repeated nonidempotent mutation, and absent backend capabilities.

These are finite ordinary-model checks. The plans contain no provider SDK implementations, and no cloud deployment was performed. The written general proofs have not been checked by a proof assistant.

Automation disclosure. OpenAI ChatGPT/Codex assisted with formalization, written proofs, source development, bounded checks, reference checking, and typesetting. The paper is prepared for journal review under an Anonymous byline. No independent referee assessment or acceptance is asserted.

Selected references

1. Anonymous. Higher Semantics of Agent Swarms. Higher Categorical Semantics, 2026. 2. Anonymous. Higher Lenses and Temporal Descent for Certified Adaptive Systems. Higher Categorical Semantics, 2026. 3. Anonymous. LensIR: Compositional Reverse Semantics for a Typed Tensor Fragment. Higher Categorical Semantics, 2026. 4. Anonymous. Oracle and Jet Semantics of Stateful Optimization. Higher Categorical Semantics, 2026. 5. Anonymous. Observation-Preserving Runtime Gates and Checkpoint Semantics for Adaptive Learning. Higher Categorical Semantics, 2026. 6. Jacob Lurie. *Higher Topos Theory*. Princeton University Press, 2009. Author's edition.

The complete PDF includes 20 references, including compiler-correctness literature, compositional systems literature, and all provider documentation.

Reproducibility artifacts

cloud-portable-agent-swarms.pdf · 369,948 bytes · Download
SHA-256 15c6b413667a65fbb2d35da4c0bec89e48e23e3108ccba114e6bd866e4a5ae0c

cloud-portable-agent-swarms-v0.1.zip · 472,694 bytes · Download
SHA-256 c48bd1dc379a2c52f27c32ffa5bdf9fb2a997e3f8adfec44f1fd6e4b64148246

Discussion

Open a careful, constructive conversation about this note.

Comments appear after editorial approval.