← All articles

LoopX Control Plane · Engineering

LoopX’s TypeScript Semantic Control Plane: Transactions, Task Semantics, and an Agent-Native CLI

LoopX is, at its core, a general-purpose long-horizon task semantics engine—not a prompt wrapper, static DAG, or generic microservice queue. When an effect succeeds before its checkpoint lands, a resumed Agent outlives its task lease, or a truncated CLI view looks identical to finished work, conditional continuation, continuous observation, evidence-driven replanning, peer handoffs, and Agent-native CLI output must compose inside one TypeScript state machine.

Retrying an operation can execute its effect twice; reading back a success receipt can revive execution rights that have already expired. Across runs spanning hours or days, a general-purpose long-horizon task semantics engine must make conditional continuation, background observation, evidence-driven replanning, peer handoffs, prefix-KV-safe CLI interactions, and transactional state across local SQLite and cloud PostgreSQL composable and verifiable for long-horizon agents and agent teams.

1. The semantic questions we put stronger models to work on

We use stronger models in design, implementation and review, especially to trace assumptions across files and runtimes. The difficult cases often combine individually reasonable checks into an unsafe execution order. Core PRs in August and September already dealt with these problems; they were part of the migration itself.

The effect happened, but its checkpoint did not. Is retry safe?

A provider succeeds, then the process crashes before writing the checkpoint. The journal says unfinished; a blind retry may execute twice. Treating every uncertain result as success would instead lose work that never happened. A try/catch cannot settle that distinction.

On August 22, #3485 introduced a durable prepared attempt and stable effect identity before execution. Recovery asks the provider: confirmed committed means checkpoint the original result; confirmed absent permits execution with the same identity; unknown remains pending recovery. Effect order, receipt prefixes and identity checks remain part of the contract. This is not arbitrary external exactly-once execution: confirming the result depends on provider recovery support.

This complements the preflight in #3464. Before execution, determine whether the effect is allowed; after interruption, determine whether it already happened. Moving Python functions to TS one at a time does not protect both boundaries.

On September 13, #4286 converged receipt recovery for seven Todo operations on one owner while retaining a finer distinction. Suppose two agents update a task: A commits first; B receives a definite version-conflict rejection, then loses its connection while reading the receipt. The later read failure must not erase the earlier rejection. If the connection drops before the commit response arrives, the result remains uncertain and recovery must use the original operation identity.

Both paths can encounter a network error, but they require different next steps. The shared implementation attempts the write once, then reads the original receipt. Its regressions distinguish conclusive rejection, commit uncertainty and exact-receipt recovery. Shared error handling must retain the phase of failure and facts already established.

Claiming work and acquiring execution rights must commit together

Two agents see an unclaimed task. If the claim is written before the lease is acquired, who owns the intermediate state? If an earlier claimant returns with a receipt after its lease expires, may it keep writing?

From the coordination foundations in #3529 and #3669 to the September 6 transaction in #4032, claim, lease and operation receipt converge on one conditional commit. The #3798 store owns atomic persistence; the domain owner checks identity, scope and legal transitions. A receipt proves a past claim succeeded. The current lease and epoch determine permission now. Replay must recover the original result without reviving expired execution rights. Storage revision, domain revision and lease epoch remain different identities.

Idempotency therefore requires more than returning an old success. Recovery must remember history and respect present authority. Foundation, shadow and production qualification arrived in stages; the first interface merge did not establish deployment of every backend.

Why could correcting evidence restart finished work?

A planning update corrects evidence without changing monitor state. Rebuilding the object from defaults can accidentally rearm an already satisfied monitor. Conversely, an explicitly empty list or false cannot be interpreted as an omitted input.

On September 10, #4178 converged planning updates on one authority snapshot and a complete TS transaction: omission retains intent, explicit clearing follows field and authority rules, and evidence correction does not rearm a satisfied monitor. It also removed Python’s serialize-to-Markdown-and-parse-back route. This repaired behavior as well as consolidating ownership; describing it as a mechanically equivalent language translation would miss the point.

Song’s #4433 and #4494 extended this discipline to vocabulary definitions, actual producers and consumers. A compiling enum does not establish that all callers mean the same thing. The skip / quota_skip example in the Semantics section and separation of action from decision belong to this same thread.

Making a plausible model answer face a counterexample

Ask for the mistaken assumption, then an execution sequence that refutes it: disconnect after commit, replay an expired lease, correct only evidence, explicitly clear a value. Check the real owner, provider and caller.

Stronger models help connect scattered conditions; counterexamples, real storage and refusal paths constrain their answers. There is no per-PR model comparison here, so these examples cannot quantify a particular model’s independent contribution. They show the mechanisms and reasons for changing them. Later runtime routing in #7145 and original-Turn closeout in #7269 continue this work rather than defining its whole history.

2. Reconstruct the history: from migration plan to task semantics engine

The formal migration RFC merged on August 15 (#3226). Over the first two months through mid-October, the program migrated core transactions to TypeScript and retired ordinary legacy Markdown writers in #6396. Through late November, a second convergence wave built directly on that transactional kernel: composable task continuation, background monitoring, and replanning; peer delegation handoffs; closed-set vocabulary ratchets; and an Agent-native CLI.

The three-developer-and-agent relay in #6396 closed the dual-writer transition so later task, collaboration, and CLI state machines could rely on a single authority owner.

Our new maintainer, Song (@songoow), has also been advancing the Semantics RFC, vocabulary convergence, production evidence, and checker fixes since mid-September. That track belongs alongside the transaction, task-semantics, and CLI story.

At its core, LoopX is a domain-neutral, general-purpose long-horizon task semantics engine for long-horizon agents and agent teams. Models propose routes; the engine protects versions, execution leases, composable task transitions, and state commits, then locates a valid recovery position after interruption.

Much of the original implementation was Python. TypeScript hosts, Pi integration, and the dashboard already existed. A Python call to make a decision, followed by a TS host consuming the result, was a natural starting point. As the system grew, defaults, state interpretation, ordering, and persistence could become distributed across both runtimes.

We wanted clear typed ownership of control-plane rules and contracts shared by the CLI, hosts, and App. The 103-day history developed through overlapping stages.

Period Main change Representative evidence
August 15 Formal proposal for incremental migration over a process boundary; initially favors reads and projections #3226
August 21–22 Effect Program cutover, followed by a pivot from leaf rules to complete transactions #3416, #3447
Late August–early September Settlement, Todo, quota, lease, Vision, and monitor transactions migrate; shared authority develops in parallel #3464, #3798
Early–mid September Integrate real callers, converge planning/read/provider-open rules, add optional SQLite #4178, #4317, #4121
From mid-September Song advances Semantics; storage work tackles checkpoints, deltas, writes, and replay cost; sealed projection envelopes #4433, #4408, #5085
Late September Retire an unused Python authority prototype and experimental Todo event overlay, preserving real compatibility boundaries #5105, #5054
Early–mid October Update new-Goal defaults, isolate ordinary old writers, converge production consumer routes #5805, #6104, #6280
Mid-October Concentrated legacy writer retirement, followed by single-transaction task reads and progressive context #6396, #6874, #7196
Late October–mid-November Unify per-turn decision and settlement sources; per-target monitor wakeups, partial peer returns, and 20k+ commit PostgreSQL checkpoints #7462, #8139, #8211, #8231, #8759
Mid–late November Unified turn loop by default; suffix-only context folding preserving prefix KV cache; 3-hour task leases and cross-lease continuation; zero-Any ratchet; Apache-2.0 storage SPI #9176, #9213, #9223, #9433, #9488
Converging transaction, authority/storage, and Semantics and Agent-CLI tracks
Converging transaction/task-loop, authority/storage, and Semantics/Agent-CLI tracks across the migration. Scroll on narrow screens; open the image for full size.

The original August proposal considered a read-first sequence and staged dual reads and writes. The accepted approach evolved toward Effect Programs first, then replacing complete transactions and deleting the old rules, with one production semantic owner. An early proposal's staging ideas should not be presented as the runtime architecture of 2.0.

Plans can change usefully. The important record is why the route changed, which slices cut over, and which remained references or candidates. The maintained TS RFC retains those checkpoints.

3. Start with the Effect Program: agree on what happened

The first bounded cutover was #3416 on August 21. TypeScript took ownership of the Effect Program, settlement algebra, Turn-journal interpretation, and a durable checkpoint effect.

These boundaries fit together because recovery asks one connected question: which effects belong to this operation, which have committed, and what may happen next?

A checkpoint involves more than writing JSON to a file. Operation identity, same-key exclusion, matching the previous content, atomic replacement, and durability ordering determine whether a retry can recognize the original result. Splitting the rules across runtimes makes the next recovery fix harder to locate.

The cutover therefore moved internal effects and their rules into TS. Python retained compatibility calls and callback/provider boundaries. A managed local runtime starts on demand and exits when idle, with a private token and source fingerprint for lifecycle handling. Callers do not need to manage a separate daemon manually.

The design also had a cost. The PR reported these measurements for the same historical checkpoint workload:

Path p50 p95
Previous checkpoint 0.755 ms 2.020 ms
New durable checkpoint path 12.597 ms 18.610 ms

The new path added RPC and durability work. This records the cost of that first slice. It does not isolate language performance or describe today's complete CLI latency. Acknowledging the cost made it possible to assess whether later complete transactions removed more round trips and repeated interpretation.

4. Migrate a complete transaction: two calls can be right

On August 22, #3447 explicitly stopped flat leaf-helper migration. Adding a facade, DTO, and parity scaffolding for each function could make the production path longer while Python still owned composition.

The new unit was an observable transaction. Turn settlement connects decoding, identity, the journal, pending effects, reduction, and closeout. Todo completion similarly connects admission, state, leases, continuation, and a commit receipt.

The responsibility boundary between a complete transaction and named external providers
The responsibility boundary between a complete transaction and named external providers Scroll on narrow screens; open the image for full size.

#3464 replaced seven leaf runtime calls with the coarse turn.settlement.reduce contract. In that delivered slice:

New provider work: TS preflight → Python provider / checkpoint → TS final reduction
Existing replay:   TS reduction / original-result recovery

Two calls and one call describe new provider work and replay respectively. The responsibility diagram does not count every call in the complete CLI.

Review caught an attractive but unsafe optimization: retaining only the final reduction. That saved a call, but malformed identity or journal state could be rejected only after an external provider had executed. The final design kept preflight. TS authorizes the exact pending effects; Python executes and checkpoints those effects before final reduction.

A correct check in the wrong position can fail to protect the user. Its order relative to an effect matters.

Later lease, Vision, monitor-poll, spend, and void slices followed the complete-transaction approach. Their migration economics must name the old rules removed, bridges added, happy and recovery crossings, scaffolding exit conditions, and correctness and latency through the full entrypoint. A net increase in code can be justified, but the extra code needs a purpose.

5. Shared authority: connect distributed storage to Agent execution

In parallel, shared-authority work progressed from wchwawa's coordination core, aggregate/provider foundations, and recoverable references to the TS AuthorityStore in #3798.

Two responsibilities need distinct owners:

  1. The domain owner decides whether a transition is legal and who may execute it.
  2. The store provides conditional commit, durability, and proof readback.

The current AuthorityStore exposes operations including storeIdentity, loadAuthority, commitAuthority, readReceipt, and scanCommitted. The store atomically protects the head, events, and receipts. A database adapter must not quietly become an independent owner of domain transitions.

Several identities protect different boundaries:

Identity Boundary it protects
provider_revision A conditional provider commit; its representation can be opaque to domain callers
authority_revision A version of domain authority state
lease_epoch The generation of an execution grant, fencing an old executor
Store identity / lineage Whether a read still belongs to the same authority history
Operation identity / receipt Whether this is the same committed operation and what it originally returned

For example, a PostgreSQL connection may fail after COMMIT. The write may already be durable. A provider must distinguish missing, unavailable, failed, and ambiguous durability. A missing success response does not establish a missing commit. Reading the original operation's receipt is part of recovery. The PostgreSQL candidate also retained its separate deployment and adoption boundaries.

An earlier Python executor served reference and coverage purposes. The unused prototype was later deleted, while actual native File and SQLite paths became the corresponding qualification targets. Transitional references need an exit condition; they must not become a second production authority by accident.

When storage commits meet multi-hour Agent execution

Keeping pure storage commits separate from domain transition rules paid off once multi-hour Agents ran continuously across interrupted sessions:

  • Incarnation-scoped history fencing (#3464, #8975): When a recreated goal reuses a logical identifier on one append-only log, un-scoped acknowledgments from a retired incarnation can falsely satisfy an open review gate; binding commit proofs to an immutable (goal_id, instance_id) pair isolates incarnations cleanly.
  • Separating lease renewal from concurrent mutation (#5805, #9257, #9487): Multi-hour tasks routinely renew execution leases mid-turn (now defaulting to 3 hours). Renewing a lease under the same epoch and idempotency key advances the lease version without invalidating an already-admitted turn settlement (#9257), whereas an expired or replaced lease grants authority only for zero-spend administrative closeout—never for continuing stale execution (#9487).
  • One state contract from local SQLite to cloud checkpoints (#4121, #4408, #9380, #8759, #9223): Periodic 64-commit snapshots and index-exact delta replay scaled from local files and SQLite (#4121, #4408, #9380) to tenant-isolated PostgreSQL recovery past 20,000 commits (historical adapter, #8759), before #9223 extracted server-side cloud storage behind a clean Apache-2.0 AuthorityStore SPI.

6. After SQLite: retained history needs a cost model

LIHUA919's #4121 connected an optional SQLite provider to the existing TS authority contract. A transaction atomically commits the head, receipts, events, and outbox. Domain claim and lease semantics stay with their owner.

Adding the database left three distinct engineering problems.

First, reading the current head should not scale with total retained history. #4408 replaced a full retained projection per transaction with verified periodic checkpoints and committed deltas. It converged codec ownership and added transactional, idempotent migration of the old format. Current reads, continuity recovery, and a full audit have different read scopes.

Second, measure writes correctly. #4778 separately observed logical write volume, cumulative WAL traffic within a window, and application-observed lock wait. Final database size cannot substitute for write-amplification measurement. A rehearsal also does not establish formal capacity or sustained-operation acceptance.

Third, object ownership during replay affects correctness. #4931 reduced copying, sorting, and encoding of unchanged subtrees, and stopped materializing unused full projections for receipt lookup. It also prevented a caller's mutation of a returned projection from poisoning the next replay basis. Persisted proof bytes remained unchanged.

Some paths improved substantially. Large-state latency, scan cost, and memory still had gaps, and the PR retained the unmet targets. Those distinctions are more useful than a single performance-improvement label for every path.

In October, #5805 changed unconfigured new-Goal defaults to canonical SQLite and hard leases. Existing Goals, explicit choices, and old operation retries retained their own contracts. A new default, migration of existing data, and retirement of old writers happened at different stages.

In early November, #7834 extended the SQLite store to own archived task history: when tasks complete or are atomically superseded (#5698), terminal items beyond a small active window (N = 5) move into SQLite archive tables, decoupling live status-view size from total historical volume while preserving exact ID lookup and receipt replay.

7. Song's Semantics and the Zero-Any kernel

Our new maintainer, Song (@songoow), initiated and implemented the Semantics RFC, registry, and commit-path checks in #4433, merged on September 15. He continued advancing convergence afterward. This track governs how concepts grow as the software changes.

Cross-language migration readily creates duplicate knowledge. The same state can appear in a Python Enum, Literal, TS as const, a presentation layer, and a conditional branch. Even if the strings match today, one location may gain a value or change its interpretation tomorrow.

The Semantics RFC checks traceable relationships: definition owner, value set, generated binding, producer, and interpreter or projection. Runtime rules remain with typed owners. The registry constrains and checks them without becoming another production rule source.

Four kinds of information in one field

#4494 addressed a mixed effective_action field containing quota decisions, frontier actions, replay verdicts, and diagnostic error codes. Callers could not clearly identify the domain to interpret.

The converged contract puts verdicts in decision, diagnostics in error_code, and restricts the root action to the registered, disjoint union of quota and frontier domains. Cross-runtime bindings are generated from an owner. Old v0 signed plans retain their historical meaning and representation, rather than being rewritten in a way that breaks original identity verification.

The same work caught skip versus quota_skip. A consumer branch is not evidence that a producer emits the value. Checks must trace actual assignments and returns at supported sites, rather than counting string comparisons as production.

Counterexamples for the checker itself

#4687 retained useful review counterexamples and fixed three confidently wrong answers: missed global rebinding, mutation after dictionary spread treated as the old initializer, and a shadowed String mistaken for the built-in conversion.

False alarms and missed values have different consequences. A conservative candidate set may report an extra problem. Missing a real produced value can let an unregistered output through. Unsupported dynamic forms must preserve an unknown.

The checks also need scan-coverage floors, so scanning fewer files cannot make the result green. Retiring an expanding committed inventory in favor of on-demand full-tree computation did not remove that obligation. Gaps outside supported forms remain explicit, and the tracking issue remains part of the work.

From registered vocabularies to the Zero-AST-Any ratchet

Two commit-time AST verifiers turned Song's vocabulary design (#4433, #4494, #4687) from a review guideline into an equality-anchored pre-merge ratchet across Python and TypeScript:

  • Closed-set vocabulary verification (#4494, #8184): Full-tree AST scanning verifies all 34 registered vocabularies and 62 owner symbols with zero conflicting semantic values, pinning coverage floors by strict equality so constraints cannot silently loosen. For example, #8184 removed a local handoff-mode copy and enforced a typed subset rule: historical receipt decoding still recognizes "legacy" records, while fresh execution admission accepts only active claim and lease modes.
  • Zero-Any structural ratchets (#4178, #6396, #9282, #9433): Every one of the 43 tracked control-plane module baselines now pins dict[str, Any] counts to zero, preventing untyped dictionary merges from silently re-applying defaults or dropping fields across runtime boundaries.
Why eliminating dict[str, Any] surfaced latent concurrency and replay bugs

Replacing untyped dictionary carriers with explicit record types repeatedly exposed hidden state corruption during the refactor itself. Earlier in #4178, retiring serialize-and-reparse planning updates stopped partial edits from re-arming finished monitors; later, typing state-refresh records (#9418) exposed stale registry snapshots surviving replay across route switches, and replacing untyped hook dispatchers (#9433) uncovered and fixed seven real request-scope cache, symlink-ABA, and rollback-invalidation bugs in the same PR.

8. Long-horizon task semantics: orthogonal primitives composing beyond static DAGs

Traditional workflow DAGs collapse execution into a single node status (running → done). A general-purpose long-horizon task semantics engine cannot, because four commit truths are fundamentally distinct: Todo completion ≠ Turn settlement ≠ Peer delivery ≠ Goal acceptance. An in-flight progress writeback settles a Turn while the Todo stays open; a routine monitor observation closes at zero quota spend; a delivered peer message stays open while remaining work > 0; and Agent-declared "done" never satisfies Goal acceptance until external acceptance oracles validate cumulative outcome requirements.

Grounded in the Effect Interpreter formulation (#2905, GoalState => F[Decision]), LoopX models F not as one giant global enum, but as orthogonal product state machines (×)—Todo / Lineage × Claim / Lease × Scoped User Gate × Resume / Monitor × Vision / Replan × Quota / Scheduler Cadence—that compose in a single TypeScript transaction (#6874, #7298, #8211, #9176) without collapsing into global boolean locks or cross-turn deadlocks.

Orthogonal task primitives composing over one TypeScript Effect and Task Semantics Kernel
Six orthogonal primitive domains compose as product state machines over one TypeScript Effect & Task Semantics Kernel (GoalState => F[Decision]), backed by AuthorityStore and an append-only execution journal. Scroll on narrow screens; open the image for full size.

User Gate × Todo Fallback × Quota / Cadence

Naive agent frameworks treat human approval as a global boolean stop sign—either freezing the entire multi-hour run on a routine question or silently burying the gate. LoopX attaches a typed decision scope to each user gate (#4292), allowing the user channel and agent channel to intentionally diverge: the user channel surfaces the concrete owner decision at zero quota spend (paired with human-gate backoff), while the agent channel proves scope independence and executes safe scoped fallback work or settled monitor projections concurrently (#5277, #6327). Once answered, approval consumes only the covered decision scopes (#8844), while a causal reset token snaps the 8-tier adaptive scheduler cadence—spanning active work, peer-handoff wait, monitor watch, human-gate backoff, and derived terminal stop (#3058, #9459)—immediately back to active cadence whenever gate state or deadline buckets shift (#6787).

Blocker / Handoff Clearance × Atomic Supersede × Successor Replan

Long-horizon plans evolve mid-flight instead of following a frozen upfront DAG. Over a unified replan history reducer (#4902), atomic supersede links replacement tasks, retires predecessors, preserves decision and continuation lineage across archived history, and releases active leases in one commit (#4184, #5698). Crucially, when a blocking gate or peer handoff clears with neither an explicit successor nor a no-follow-up declaration, the kernel refuses to jump into blind execution or premature stop—routing into mandatory successor replan (#5831, #8896), while rollbacks append compensating events and spawn successors without erasing history.

Monitor × Scoped Resume × Vision / Self-Referential Replan

Deferred work resumes from a single atomic full-graph readiness read (#6874) keyed by per-target SHA-256 wakeup generations (capped at <=128 targets per monitor and refusing overflow rather than evicting waiter baselines, #8231). Pure observation reducers keep counter updates, omission, and explicit clearing distinct (#4178, #4335, #9249), while dedicated non-LLM background watch lanes stay isolated from foreground chat queues, live LLM healthcheck blips, and concurrent replans at zero routine spend (#5450, #9155, #9320, #9474). Above local waits, goal-level Vision and non-scalar Yardstick reversal cues (#7298, #8385, #9165) evaluate strictly ahead of quiet states—rejecting delta-free acknowledgements as replan no-ops (#5633, #5646), persisting trigger facts on turn receipts so retiring a stalled monitor mid-replan never deadlocks (#8854), reconciling whole-second vs. microsecond ACK clocks (#8804), stripping stale preflight companions (#9411), and settling the active turn before derived goal stop (#8588).

Turn Settlement × Lease Epoch × Live Goal Amendment & Acceptance Oracle

Closure binds to external acceptance oracles and cumulative outcome requirements shared across every turn view (#6473, #6784, #9328), while mid-flight user corrections and live conversation steering reconcile directly with Goal direction without invalidating active leases (#6357, #8270). When multi-hour execution crosses a 3-hour lease TTL, lazy rebinding avoids premature faults (#9183) and settlement splits cleanly by successor authority: foreign takeover triggers administrative zero-spend closeout (#9304), whereas same-Agent higher-epoch continuation executes a fenced lease takeover verified against fresh task and acceptance digests (#4094, #9488).

Orthogonal composition (×) Failure mode before convergence TypeScript kernel invariant Verified PRs
User Gate × Scoped Fallback × Quota Global boolean locks froze entire multi-hour runs on local questions or over-cleared unrelated open gates Zero-spend user channel ask diverges cleanly from parallel scoped fallback; approval consumes covered decision scopes only #4292, #5277, #6327, #8844
Quota Gate × 8-Tier Cadence × Reset Token Idle polls burned model tokens, or exponential backoff slept past shortened deadlines and fresh owner replies Spend compute only after validated writeback; 8-class backoff snaps to initial cadence on causal reset token shift #3058, #6787, #9459
Blocker Clearance × Supersede × Successor Replan Static upfront DAGs broke mid-run; cleared blockers halted work without a pre-wired next step; rollbacks erased history Atomic supersede + lease release; cleared blockers without no-follow-up force successor replan; compensating lineage #4184, #4902, #5698, #5831, #8896
Background Monitor × Scoped Resume × Storage Global counters woke unrelated waiters; partial edits re-armed watches; LLM healthcheck blips killed non-LLM polls Atomic readiness & per-target wakes (<=128); omission-vs-clear reducer; model-free watch lanes serialized against replans #4178, #4335, #5450, #6874, #8231, #9155, #9249, #9320, #9474
Goal-First Vision × Yardstick × Self-Replan Local quiet states masked drift; scalar proxies hid regressions; retiring a stalled watch erased its trigger; stop stranded receipts Vision & Yardstick cues precede quiet/wait and reject no-op ACKs; receipt-persisted triggers; settle active turn pre-stop #5633, #5646, #7298, #8385, #8588, #8804, #8854, #9165, #9411
Turn Settlement × Lease Epoch × Acceptance Oracle Self-reported "done" closed unfinished goals; live chat edits clashed with leases; expired 3h leases either wrote stale or lost work External acceptance oracles & lease-safe live steering; zero-spend foreign closeout vs. digest-verified fenced lease takeover #4094, #6357, #6473, #6784, #8270, #9183, #9304, #9328, #9488

9. Peer collaboration: why “returned” is not “finished”

When an Agent delegates a slice to a peer worker, message delivery is only transport—neither proof that the delegated work is finished nor proof that the requester has adopted it. Building on revision-guarded claims and handoffs (#3529, #3669, #4032, #4094), LoopX keeps transport delivery, inbox reply completion, per-update requester consumption, and goal acceptance separate:

Peer return & custody contract · transport delivery ≠ reply completion ≠ requester adoption

1. Transport deliveryA locked four-phase send state machine confirms the message reached the inbox, ordered strictly so newer updates cannot overtake unverified sends.Transport status: delivered
2. Reply completion, consumption & acceptanceA request whose latest conclusion declares remaining work stays open in the inbox until the peer publishes a final conclusion with zero remaining work; turn-bound requester consumption only acknowledges an individual update so it stops re-alerting, while goal acceptance remains separate.Semantic state: open until final conclusion

Custody handoff (#4094, #9308): original authorship and historical review provenance remain immutable when active ownership transfers under a roster-fenced commit.

  • Hash-chained partial returns (#3669, #8139): Workers frequently return an interim milestone alongside explicit remaining work and its wakeup condition. Conclusion updates form an immutable hash-linked chain under a 20,000-character combined budget, while replay preserves historical wire formatting so post-crash digest verification never drifts (#8139).
  • Read-only review isolation and per-Agent fault isolation (#8329, #8853): Inspecting an interrupted peer return does not consume the writable owner's execution reservation before native effect proofs are re-verified (#8329). Likewise, per-Agent turn closeout filters settlement history by explicit Agent identity so a peer's unrecorded or malformed receipt cannot deadlock another Agent's turn, while global status views still surface cross-Agent health (#8853).
  • Provenance-preserving custody transfer (#4032, #9308): When a collaborating peer retires, separating immutable authorship and per-review attribution from active ownership lets a local owner adopt open outcome responsibilities under a roster-version fence without rewriting who produced earlier evidence (#9308).

10. Callers and defaults determine whether migration reaches users

Complete transactions also need callers to express intent accurately. In #4178, a blank note means no update; an explicit empty list or false is interpreted by its field’s contract. These values cannot all be discarded as absent, or all treated as clearing. Dry-run must model that intent accurately. An unavailable selected provider must not trigger fallback elsewhere. #4279 later converged read classification and projection-delivery semantics. Some Python read ownership was deliberately retained. Clear ownership matters more than creating a second interpretation to pursue language purity.

Defaults expose similar distinctions. Current priority regressions protect these cases:

Input or operation Expected behavior
Create a new task, omit priority Apply the new-task P1 default
Read an old task with no historical priority Preserve its historical meaning
Replay the original creation operation Return the original result
Edit only the text Preserve the existing priority
Explicitly clear priority Clear it
Structured declaration conflicts with an old text prefix Refuse with actionable context

The File and SQLite regressions protect these cases. Applying new defaults after original-receipt recovery prevents an upgrade from making new decisions for history.

The closing review found another caller gap. The TS core passed direct tests for metadata-only completion repair. The normal Python producer automatically attached defaults such as completion policy and auto-acquire. The core interpreted them as fresh work mixed into a historical repair. The actual File and SQLite entrypoints failed in both dry-run and execution. The public counterexample records this.

That recovery gap also existed in the baseline, so it cannot all be attributed to the final contributor. The repair had to reach the normal producer while continuing to reject real changes to text, continuation, ownership, or validation. A correctly constructed typed request proves only that the inner boundary can handle it.

11. Recover the original result while protecting current authority

Recovery can confuse two points in time: whether the original operation was valid, and whether today's executor may continue changing state.

Suppose a team-plan committed but its response was lost. After an upgrade, the caller retries the same operation ID under stricter admission rules. Rejecting it as fresh work first can hide the original success. A closing recovery review caught that problem.

Separating original-receipt recovery from current execution authority
Separating original-receipt recovery from current execution authority Scroll on narrow screens; open the image for full size.

The current path decodes and locates the correct authority, then checks original identity, intent, and receipt. If it is the same committed operation, it recovers the original result. Work without a matching original result proceeds through current admission. The selected provider must still be available and its proof valid; failure cannot quietly redirect writes to Markdown.

Returning the original result does not renew a lease, overwrite later commits, or revive a retired writer. Lease transfers, epoch changes, and subsequent state have their own protections.

Types express the distinction too. Historical decoding still recognizes legacy; current fresh-execution handoff configuration accepts soft_claim and hard_lease. Reading an old record, recovering an original operation, and authorizing current execution each have independent conditions.

Atomic CLI self-claim in 2.2.0 (#7510, #7793) follows the same rule: one command atomically claims the task and acquires a hard_lease grant, returning progress and completion commands bound to the active lease_epoch, while replaying an old claim recovers only its original receipt without extending an expired generation.

An internal receipt also has a limited scope. If a remote external effect lacks a verifiable idempotent identity and readback, settling once in the control plane cannot establish that the remote effect executed exactly once. Uncertainty belongs at the boundary where it actually occurs.

12. Designing a CLI for Agents, not just shell users

A human shell CLI assumes an operator with out-of-band working memory: someone who remembers passing --limit 5, visually discounts a stale cache, avoids mutating state while inspecting, and pays almost nothing per printed byte. An LLM Agent has no implicit memory across compaction boundaries, interprets output literally, retries aggressively after timeouts, and pays in both context window and prefix KV cache for every stdout byte.

LoopX CLI for Agents: one decision source, honest read completeness, prefix-KV budgets, and CAS plus idempotent replay
LoopX’s Agent-facing CLI turns shell invocations into a bounded, prefix-KV-preserving, CAS-fenced state-machine loop. Scroll on narrow screens; open the image for full size.

One decision source and runnable recovery commands

When check, plan, and execution commands assemble state independently, an Agent gets admitted at the start of a turn only to be rejected at settlement—triggering flag-guessing retry loops. Converging every turn entrypoint onto one shared decision snapshot (#4496) and moving primary-action selection into TypeScript (#7462, shrinking a 22,000-row backlog RPC payload from 2.35 MB to 959 bytes with 182-case byte parity) eliminated decision-to-settlement drift.

When an operation cannot proceed, the CLI returns copy-runnable recovery commands instead of prose tracebacks: separating an unbound turn receipt from a true version conflict and emitting exact prior-turn closeout commands (#4595, #4893, #6212), and distinguishing logical write-scope waits from directory collisions that an isolated git worktree can actually resolve (#9293).

Separating display truncation from task completion

After five incidents in 47 days (#5087) where an advisory Agent answered from stale or partial sources while health checks reported ok: true, #5085 introduced a kernel-sealed read envelope, extended to turn admission (#6679) and single-transaction task reads (#6874). Cached responses advance serving time without forging observation time, and task completeness is computed over the entire matching population before --limit slicing. Display caps set truncated: true without false alarms, whereas unreadable or omitted work forces complete: false with an explicit alert—preventing an Agent from ever mistaking top-N truncation for finished work.

Output budgets and prefix-KV cache economics

Since #2144, an interface budget contract and base/head differential verifiers (#6123, #9103) gate stdout bytes, line counts, per-task growth slopes, JSON key sets, and action digests across crowded multi-agent fixtures—for instance, stripping JSON indentation cut a 36-task output by ~18% (48,418 to 39,726 chars) with identical decoded semantics, while dropping an authority clause to pass a byte cap is forbidden. Three mechanisms extend that budget across multi-turn sessions:

  • Cross-turn subtree deduplication (#7196, #8100, #8523): Unchanged >=1 KiB context subtrees deduplicate across turns via SHA-256 digests, and appended task notes transmit only new UTF-8 suffixes (#8523) while keeping live revisions and execution controls inline.
  • Suffix-only receipt folding that preserves prefix KV (#9213): Sliding-window or mid-history summarization rewrites early tokens and invalidates the model's prefix KV cache across the entire suffix. Instead, LoopX anchors the prefix digest when a task starts; once the task settles cleanly, it folds only the completed suffix into a compact receipt preserving failure facts and open obligations—verifying untouched prefix bytes, intact tool-call pairing, and a net token savings floor before swapping, or keeping raw history atomically.
  • Single-read status convergence (#7755, #9392): Decision paths skip UI-only log scans (#7755) and collapse N+1 deferred-task paging into one atomic task read with pre/post revision checks against mid-read races (#9392).

Side-effect-free previews and CAS + idempotent replay

Because Agents preview guards before acting and retry after dropped connections, inspection and mutation must never blur. Read-only --dry-run previews fence off all notification hooks, rollout logs, and cache writes (#8685), while request-scoped snapshots avoid wall-clock TTL staleness (#4694, #6992, #9433). Across mutating commands—single-attempt command receipts (#4286), task handoffs (--expected-revision + --operation-id, #4094), goal acceptance (--expected-provider-revision + --operation-id, #7088), and task leases (--expected-version + --idempotency-key, where the key identifies the lease generation across renewals, #8310)—explicit CAS flags reject concurrent stale bases while resending the exact original request (including its original CAS version and parameters) replays the committed receipt without executing twice.

A recoverable file is not the model’s memory

The same recovery distinction appears in context delivery: an old receipt cannot renew a lease, and a complete baseline on disk cannot prove that the model has read and understood its constraints.

The native file-delta path in 2.2.0 separates those facts. The codec verifies complete files, versions and scope within a valid cycle and reconstructs the current structure exactly. The Agent progressively reads the current full view for the intent, requirements and evidence its decision needs. Even a delta permits direct selection of current facts without first draining the old baseline. Compaction during unfinished work requires recovering missing facts while preserving the original task and settlement identity.

This makes file reconstruction and model knowledge separately inspectable. The worked voice-task example explains JSON Pointers and the default file path. A working file/reader mechanism still needs evaluation against actual research outcomes.

13. Final retirement: preserve credit and account for the deletions

Late-September work had already removed an unused authority prototype and the experimental Todo event overlay, dual-writer, and backfill. Old sources containing data received explicit preservation or refusal handling. This did not remove all event logging or the new authority's atomic events and receipts.

October work further isolated ordinary Markdown writers and validated real subsequent writes without the old modules. Concentrated deletion became possible after consumer routes and replacement paths were connected.

Duang777 led #6396. Song and maintainer-side agents continued recovery, producer, and integration work along the original branch, preserving contribution history. This three-developer-and-agent relay was the closing phase of the two-month program.

The final merge against its first parent gives the following diff, for this PR alone, including implementation and tests:

File group Added Deleted Net change
Python 10,938 25,235 −14,297
TypeScript 2,547 5,116 −2,569
Other 1,944 3,013 −1,069
Total 15,429 33,364 −17,935

Many removed lines were old tests. Deleted test lines do not establish product capability; the important question is whether current entrypoints and independent counterexamples still protect the intended invariants. These counts describe the closing scope. They do not validate the whole migration.

14. Core control-plane statistics: 62-day cutover and 103-day convergence

The reproducible scope here is loopx/control_plane/**. App, benchmark, documentation, and test-suite directories outside it do not enter the core code counts. Internal testing/support tools inside this directory remain included.

The initial 2.0 cutover baseline is d1fe059, immediately before the formal TS RFC, and its first endpoint is the October 16 snapshot 488e443 (~62 days, covering 63 calendar dates; 62 of those dates contain a core mainline commit; 62-day source comparison). The tables and charts directly below preserve that frozen October 16 snapshot unchanged, followed by the reproducible 103-day convergence snapshot through November 27 (953377fd7b).

Engineering activity over the whole period

Metric Core-directory cohort
Mainline landing commits touching the directory, first-parent chain 1,144
Verifiably associated merged PRs, deduplicated by PR number 1,121
PR-author accounts in that cohort 56
Review records in the API snapshot 2,329
Conversation comments in the API snapshot, excluding inline review comments 1,631
Associated PRs with review records 1,031 / 1,121
Median PR creation-to-merge elapsed time 5.0 hours
P90 / P95 creation-to-merge elapsed time 25.4 / 45.0 hours

The scope includes migration, new capabilities, fixes, and maintenance during the period. The 56 accounts include automation and shared accounts; they do not establish 56 people or agents. Review totals can include self-review, repeated reviews, and post-merge discussion. Merge elapsed time includes waiting and is not active engineering time.

New maintainer Song is associated with 53 PRs in this narrow directory cohort. His work in loopx/semantics/ and other directories is not fully counted here. Concrete attribution still follows the contribution explanations and original PRs.

Source structure and cumulative churn

Physical line counts include comments and blank lines. File counts below include source files in the named language.

Core-directory source Baseline Evidence snapshot Cumulative additions / deletions
Python 256 files; 80,473 lines 471 files; 142,371 lines +120,899 / −59,001 lines
TypeScript 0 files; 0 lines 323 files; 87,268 lines +104,769 / −17,501 lines
Python + TypeScript 80,473 lines 229,639 lines +225,668 / −76,502 lines

TS represents 38.0% of the endpoint's Python-plus-TS physical lines. That describes the directory's language structure. It does not establish that 38% of migration is complete: some old entrypoints were outside this directory, and the period includes code moving in, new capabilities, and testing support.

Python and TypeScript source stocks in the core control-plane directory
Python and TypeScript source stocks in the core control-plane directory Scroll on narrow screens; open the image for full size.

Cumulative churn sums each mainline landing diff, so repeatedly editing a line counts repeatedly. Endpoint stocks describe only the two snapshots. The cumulative net, endpoint diff, and source-stock change were reconciled by language. The roughly 302,000 line edits record engineering activity; they do not measure unique output, quality, or model productivity.

How the work continued over time

Beijing dates, weekly buckets Core mainline commits Associated merged PRs PR-author accounts that week
08-15—08-21 52 48 10
08-22—08-28 87 86 14
08-29—09-04 61 61 16
09-05—09-11 92 92 14
09-12—09-18 133 133 14
09-19—09-25 150 147 10
09-26—10-02 161 161 17
10-03—10-09 216 214 12
10-10—10-16 192 179 14
Weekly associated merged PRs touching the core directory throughout the refactor period
Weekly associated merged PRs touching the core directory throughout the refactor period Scroll on narrow screens; open the image for full size.

The first and last weeks cover only time inside the selected endpoints. PRs use merge time; mainline commits use commit time. These can differ, so the two columns need not correspond one-for-one within a week.

By title prefix, the cohort contains 658 fix, 208 feat, 137 refactor, and 28 perf PRs. The rest include validation, documentation, and titles without those prefixes. These are title categories, not a partition of pure migration effort.

PR title categories in the same core-directory cohort
PR title categories in the same core-directory cohort Scroll on narrow screens; open the image for full size.

These numbers support explaining the mechanisms by stage. Moving a rule was followed by caller integration, semantic fixes, recovery validation, and retirement. The final #6396 is one concentrated slice within that process.

Reproduce the inventory

Public-safe PR records, core mainline commits, and metric JSON accompany the draft. The PR cohort joins mainline commits touching the directory to GitHub merge metadata, counting each PR once. Two mainline commits have no verifiable merged-PR association; their commits and churn remain included.

The research enumerated public PRs, then checked against mainline Git history. Direct reads supplemented 14 PR metadata records missed by search indexing. Source snapshots and processing scripts remain in the research materials. This inventory does not estimate tokens, model cost, CI compute, engineer-hours, or benchmark gains.

103-day convergence snapshot (August 15 – November 27, 2026)

Re-running the exact method_version: 1 Git stock and first-parent --no-renames churn formulas from d1fe05932a through 953377fd7b (103-day source comparison) captures the post-cutover unified turn loop, task-semantics, Agent-CLI, zero-Any, and cloud storage SPI waves using strictly Git-reproducible counts (the committed core-pr-cohort.csv and core-statistics.json artifacts remain frozen at the October 16 API snapshot):

Metric Baseline (d1fe05932a, Aug 15) 2.0 Snapshot (488e4438e0, Oct 16) Post-2.0 Delta (Oct 16–Nov 27) Current Snapshot (953377fd7b, Nov 27)
Elapsed span (active / calendar dates) 0 days 62 days (62 / 63) +41.6 days (+42 active) 103 days (104 / 105)
Whole-repo 1st-parent mainline commits (at Nov 27) — — — 9,024 (7,741 with #N in subject)
Whole-repo 1st-parent commits since Aug 15 0 3,003 +2,613 5,616
loopx/control_plane/ 1st-parent landings (since Aug 15) 0 1,144 +1,051 2,195 (2,759 all-time)
loopx/control_plane/ unique #N PRs in Git subjects (since Aug 15) 0 1,058 (86 unnumbered; 1,121 in Oct 16 API CSV) +962 (90 unnumbered; 0 overlap) 2,020 (176 unnumbered; 2,575 all-time)
loopx/control_plane/ Python stock 256 files; 80,473 LOC 471 files; 142,371 LOC +68 files; +27,261 LOC 539 files; 169,632 LOC
loopx/control_plane/ TypeScript stock 0 files; 0 LOC 323 files; 87,268 LOC +107 files; +37,537 LOC 430 files; 124,805 LOC
loopx/control_plane/ Markdown + JSON contracts 0 files; 0 LOC 7 files; 929 LOC +5 files; +321 LOC 12 files; 1,250 LOC
loopx/control_plane/ Python + TS combined 256 files; 80,473 LOC 794 files; 229,639 LOC +175 files; +64,798 LOC 969 files; 294,437 LOC
TypeScript share of Py+TS in loopx/control_plane/ 0.00% 38.00% +4.39 pp 42.39% (42.89% pre-#9223)
Cumulative TS churn (--no-renames, Aug 15–end) — +104,769 / −17,501 +54,747 / −17,210 +159,516 / −34,711 (net +124,805)
Cumulative Python churn (--no-renames, Aug 15–end) — +120,899 / −59,001 +68,061 / −40,800 +188,960 / −99,801 (net +89,159)

Immediately before #9223 extracted server-side PostgreSQL storage and the remote authority service behind the cloud SPI, core TypeScript stock stood at 435 files / 127,466 LOC (42.89%). Both endpoint-net and source-stock accounting identities hold identically across the 103-day span.

15. Community contributions and the next step

Multiple contributors advanced this program. Representative work is listed by its concrete boundary so readers can follow the history.

These are representative contributions along the relevant tracks. Later Semantics convergence and the changed-diff advisory also include other community work; they should not all be attributed to one person.

The acceptance questions I care about are practical: can a rule change be located in a clear owner? Can a real caller express the intended operation? Do checks precede effects? Does recovery preserve the original result and subsequent state? Have replaced rules left production? Can costs be measured at the real entrypoint?

2.0 does not close every RFC goal. Retained Python transports and specialized providers have specific purposes. Broader native CLI coverage and sustained-operation qualification continue along their own validation paths. We also want capability and efficiency comparisons on harder general long-horizon benchmarks such as EdgeBench and LHTB, especially in a single session.

I hope this refactor leaves a system that is easier to change, validate, and revert—and a working practice that keeps responding to counterexamples.