Exploratory notes by songoow on historical, partly interrupted EdgeBench/LHTB runs. The feedback-first option is withdrawn; these are not official LoopX results or current capability claims.
From an incremental migration proposal to complete transactions, shared authority, semantic checks, and retirement of old paths. How real callers and counterexamples changed the design.
Across 103 days and 2,126 core PRs: complete transactions, shared AuthorityStore, Zero-Any semantic vocabularies, composable task primitives (resume, monitor, replan, peer handoff), and a CLI built for long-horizon agents and agent teams.
LoopX 2.0: Two Months of TypeScript Control-Plane Engineering
An effect succeeds without a checkpoint. An expired executor returns with a valid receipt. An evidence correction restarts finished work. Two months of refactoring brought these problems under complete transactions and shared semantics.
Retrying an operation can execute its effect twice. Reading back a success receipt can revive execution rights that have already expired. These boundaries between execution, storage and recovery are central to LoopX’s TypeScript refactor.
LoopX’s TypeScript Semantic Control Plane: Transactions, Task Semantics, and an Agent-Native CLI
An effect succeeds without a checkpoint. A resumed Agent outlives its task lease. A truncated CLI view looks indistinguishable from finished work. Across 103 days and 2,126 core PRs, LoopX unified distributed state transactions, closed-set semantic vocabularies, composable long-horizon task primitives, and a CLI designed for Agents rather than shell prose.
Retrying an operation can execute its effect twice. Reading back a success receipt can revive execution rights that have already expired. And when long-horizon agents and agent teams run for hours or days across interrupted sessions, storage atomicity alone is not enough: task continuation (resume_when), background observation (continuous_monitor), lineage-preserving replanning, peer handoffs, and the CLI stdout bytes the model reads must obey one typed state machine.
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?
@@ -34,13 +34,13 @@
Why could correcting evidence restart finished work?
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: the migration plan changed too
-
The formal migration RFC merged on August 15. By the concentrated retirement of ordinary legacy writers in mid-October, the program had spanned roughly two months. Several tracks overlapped: transaction ownership, caller integration, shared authority, storage and history costs, Semantics, compatibility, and retirement.
-
The final relay by three developers and their agents in #6396 depended on that earlier work. Earlier choices determined what could be deleted and what still had to recover afterward.
-
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 and storage story.
-
LoopX retains goals, tasks, evidence, and execution boundaries for long-running agents. Models propose routes. The control plane protects versions, execution authority, and state commits, then finds a valid recovery position after interruption.
+
2. Reconstruct the history: from migration plan to Agent semantic kernel
+
The formal migration RFC merged on August 15. Over the first 62 days through mid-October, the program retired ordinary legacy Markdown writers in #6396. Over the next 41 days through November 27—103 elapsed days and 2,126 merged PRs touching loopx/control_plane/—a second convergence wave turned that transactional foundation into a complete semantic control plane for long-horizon agents and agent teams.
+
The final relay by three developers and their agents in #6396 depended on the earlier transaction and storage work, and unlocked everything that followed: unified C1 Turn sources, composable resume / monitor / replan / peer-handoff semantics, a Zero-AST-Any vocabulary ratchet, and an Agent-native CLI.
+
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.
+
LoopX retains goals, tasks, evidence, and execution boundaries for long-horizon agents and agent teams. Models propose routes. The control plane protects versions, execution authority, and state commits, then finds 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 history developed through overlapping stages.
+
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.
@@ -71,8 +71,8 @@
2. Reconstruct the history: the migration plan changed too
From mid-September
-
Song advances Semantics; storage work tackles checkpoints, deltas, writes, and replay cost
Migration history: overlapping transaction, authority/storage, and Semantics tracks Scroll on narrow screens; open the image for full size.
+
103-day history: converging transaction/task-loop, authority/storage, and Semantics/Agent-CLI tracks. 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
@@ -131,7 +141,7 @@
4. Migrate a complete transaction: two calls can be right
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: separate domain rules from storage primitives
+
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:
@@ -170,6 +180,14 @@
5. Shared authority: separate domain rules from storage primi
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
+
Once real multi-hour Agents ran continuously against AuthorityStore, keeping storage primitives separate from domain transitions paid off across four subtle boundaries:
+
+
Exact GoalRef historical ACK fencing (#8975): Recreated instances of a goal_id share one rollout log. Without binding historical autonomous_replan_ack ordering to the exact GoalRef (goal_id + goal_instance_id), a retired instance's earlier refresh or compacted ACK could clear writeback_follows_admission and silence the live instance's open replan review.
+
Preserving admitted Turn settlement across lease renewal (#9257): Renewing a hard_lease mid-Turn bumps the lease version without changing execution ownership. Turn settlement now admits the first combined writeback when current_proof.expected_version >= requested_proof.expected_version >= admitted_version under the same lease_epoch and idempotency_key, while standalone refresh-state retains strict current-version CAS.
+
3-hour task leases and deterministic lost-lease closeout (#9304, #9314, #9342, #9487): Default managed lease TTL moved from 45 minutes to 3 hours (10,800s) without mutating existing leases. Sub-second acquire-release-reclaim transitions retain millisecond causal clocks (admittedAt <= acquired <= updated <= now, #9314); spend-slot digest conflicts project original_turn_guard_command() (#9342); and when a worker's lease expires or is replaced (#9304, #9487), observeFencedExecution() grants control-writer proof only for administrative no-spend closeout (delivery_outcome: "outcome_gap", zero quota spend)—never advertising resumption of dead execution.
+
Shared delta invariants, >20k-commit checkpoints, and a clean Apache-2.0 SPI (#8747, #8759, #8765, #9380, #9223): In shared delta replay (authority_state_log.ts), JavaScript sparse-array holes persisted as JSON null were skipped by .map()/.slice(), breaking digest reconstruction across both File and SQLite until #9380 normalized index checks via Object.hasOwn. On the remote path, #8759 (historical postgresql_authority_store.ts) brought 64-commit checkpoints, incremental delta replay, and tenant-scoped RLS past 20,000 commits alongside hard-lease-fenced remote task settlement (#8747, #8765). Finally, #9223 extracted server-side PostgreSQL storage and RemoteAuthorityService into loopx-cloud while keeping local File/SQLite authority, the AuthorityStore SPI, and the fail-closed outbound RemoteAuthority gateway 100% Apache-2.0 in LoopX Core.
+
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.
@@ -179,7 +197,7 @@
6. After SQLite: retained history needs a cost model
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 sqlite_v0 to own archived Todo history (todo_archive): during todo complete and todo supersede transactions, terminal items beyond the bounded active window (N = 5) are atomically archived into SQLite, decoupling the active ACTIVE_GOAL_STATE.md projection size from total historical volume while preserving exact ID readback and receipt recovery.
-
7. Song's Semantics: connect definition, production, and interpretation
+
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.
@@ -191,8 +209,81 @@
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.
-
Generation and checking reduce synchronization mistakes. Their assumptions, coverage, and error direction still require review.
-
8. Callers and defaults determine whether migration reaches users
+
From registered vocabularies to the Zero-AST-Any ratchet
+
Through November, two commit-time verifiers turned typed semantics from a review guideline into an equality-anchored pre-merge ratchet across both Python and TypeScript:
+
+
Closed-set vocabulary convergence (loopx/semantics/vocabulary_v0.json): On-demand AST scanning across 2,020 tracked .py and .ts files (with 693 files verified under executable/AST producer-closedness witnesses) now governs 34/34 registered vocabularies and 62/62 owner symbols (up from 26 and 46), with 0 conflicting semantic values, 0 schema-version forks, and equality-anchored budgets (registry == code_anchor) that forbid silent upward drift. For example, #8184 removed a local HANDOFF_MODES fork in execution_preparation.ts and pinned the subset invariant that historical receipt decoding recognizes "legacy" while fresh execution admission accepts only EXECUTION_HANDOFF_MODES (soft_claim, hard_lease).
+
Zero-AST-Any maintainability ratchet (maintainability_ratchet.py): Every single one of the 43/43 tracked module ceilings in module_metric_baseline.json now pins dict_any_count: 0 (and 29/43 pin any_count: 0). Zero-Any Python modules in loopx/control_plane/ more than doubled from 67 (October 16) to 147 (November 27), while across all 430 TypeScript files (124,805 LOC) in loopx/control_plane/, explicit any appears only 8 times total.
+
+
Why eliminating dict[str, Any] uncovered real concurrency and replay bugs
Modularizing untyped monoliths into zero-Any carriers repeatedly exposed latent state corruption during the refactor itself: #9282 eliminated untyped frontier mutation in goal_frontier; #9418 split state_refresh.py into typed refresh_state/* records and caught stale entry-registry snapshots surviving replay across route switches; #9416 exposed a dropped extension-source scope bug in canary/planner.py; #9445 caught silent default reconstruction during quota source migration; #9451 and #9456 sealed Todo and subagent topology contracts; and #9433 replaced capability_hooks.py with zero-Anyhook_runtime/*, surfacing and fixing 7 real request-scope cache, symlink-ABA, and transaction-rollback bugs in the same PR.
+
+
8. Long-horizon task semantics: when resume, monitor, and replan compose
+
In runs that span hours or days, resume_when, continuous_monitor, autonomous replan, hard_lease, and quota settlement are not independent features. They execute as a coupled state machine over shared AuthorityStore revisions and append-only rollout receipts. Before TypeScript owned their composition, individual primitives passed happy-path checks while their pairwise and three-way interactions deadlocked Agents—producing heartbeat_receipt_identity_conflict, malformed_settlement_state, silent Vision-wait starvation, or session queue kills.
+
Even unifying the Turn baseline taught an operational lesson. Monolithic #7430 (C1: unify work sources and validate recovery, 215 files) was reverted seven minutes after merge in #8265 so main integration and cost boundaries could be qualified incrementally. Decomposing C1 into roughly 25 bounded slices—re-landing core work-source unification (#8211), quota source cutover (#8956), unified CLI settlement composition (#9004), and digest-pinned C1 replan reads (#9022)—allowed #9176 (Default to Complete Turn and retire legacy delivery selectors) and #9328 to flip the default cleanly.
+
Scoped continuation, non-starving background monitors, and lineage-preserving replans compose over one TypeScript kernel backed by AuthorityStore and the append-only rollout journal. Scroll on narrow screens; open the image for full size.
+
Scoped continuation: resume by todo
+
todos/resume_condition.ts evaluates the five closed-set TODO_RESUME_KINDS (todo_done, monitor_changed, pr_merged, capacity_available, resume_at) against timezone-aware microsecond clocks and strict generation fences inside a single todo.read transaction (#6874) paired with Goal Vision-wait coverage (#7298). Real runs forced precise boundaries:
+
+
Exact-scope monitor wakes (#8231): When one shared Monitor watched N pull requests or benchmarks, bumping a single global generation on PR A prematurely woke deferred Todos waiting on PR B. todos/monitor_scope.ts added monitor_changed:<id>@<scope> with per-scope SHA-256-keyed generations capped at 128 scopes—refusing a 129th scope rather than evicting baseline evidence for existing waiters.
+
Verified context across session resumes and epochs (#8559, #8942) and initial user-gate linking (#8618):native_context_lifecycle.ts retains byte-verified literal selected_resume sections even when candidate context_epoch rotates on compaction suspicion, while todo_update_admission.ts admits lease-free initial --unblocks-todo-id links on user_gate Todos only when decision_scope covers the blocked action and resume_when matches the gate.
+
Crossing lease boundaries (#8728, #9183, #9304, #9488): Once lifecycle writeback resolves a frontier gap, preserveReceiptBoundObligation (#8728) bypasses candidate reconstruction so the original receipt can settle. On --resume-turn-key, #9183 rebinds task leases lazily only when durable writeback is still owed. If another worker replaced the expired lease, #9304 routes to no-spend loss closeout; if the same Agent re-claims the open Todo in a higher lease_epoch, heartbeatLeaseTakeover (#9488) appends a fenced lease_takeover receipt under the maintenance lock, preserving turn_instance_id while recording takeover_todo_sha256 and takeover_acceptance_sha256 for re-validation.
+
+
Observation without starvation: continuous_monitor
+
Monitors observe external signals at zero routine quota spend through todos/monitor_metadata.ts, quota/monitor_poll_admission.ts, and scheduler/monitor_batch.ts. Keeping continuous watches alive without starving interactive or foreground work required closing six failure modes: separating quiet vs. Todo-bound poll effect IDs and recovering blocked unpolled Monitors (#5450); re-verifying evaluated resume_when readiness inside the AuthorityStore commit lock via assertMonitorWait (#8674); recovering transient external-signal failures and cleared-replan reports (#9093, #9143); bypassing live LLM adapter healthchecks on observation-only Monitor turns so an upstream model blip cannot kill the session queue (#9155); emitting explicit clear_fields when an unscoped poll clears prior material_change_scope metadata (#9249); and isolating watches onto dedicated steward.background.<binding_id> carrier sessions with scope-changed and zero-write follow-up recovery (#9320, #9364).
+
Lineage-preserving replan and succession
+
todos/succession.ts, work_items/replan_history.ts (#4902), and work_items/replan_semantics.ts govern how plans change without losing causal lineage. Atomic todo supersede (#5698) links replacement Todos, retires the predecessor, and releases its lease in one commit. Subsequent counterexamples hardened every boundary of a replan Turn: retaining bound Todo identity during semantic replan recovery (#8495); prioritizing replan_settlement_pending before derived Goal terminal stop so closing the frontier does not strand the unspent receipt (#8588); preserving distinct same-second work evidence digests (#8742) and verifying same-second whole-second run-index ACKs against microsecond rollout log indices (#8804); keeping monitor_no_change_streak as a scalar receipt source when the Agent retires the exhausted Monitor mid-replan (#8854); projecting exact pure-replan closeout commands (#8855, #9160); keeping bound yardstick reversals inline in captured C1 openings (#9022, #9165); normalizing null vs. omitted completion_turn_key (#9296); restoring autonomous replan when ordinary blocked tasks would otherwise park ongoing repeat_until_closed Visions (#9361); stripping stale guard companions on identity_upgrade via semantic_replan_guard.ts (#9411); and serializing background Monitor polls against foreground native replan turns (#9474).
+
+
+
+
Composed primitives
+
Multi-primitive failure before convergence
+
TypeScript kernel invariant
+
Verified PRs
+
+
+
+
monitor × resume_when × AuthorityStore
+
Global monitor generation woke unrelated waiters; stored Monitors lacked evaluated readiness; clearing material_change_scope to null tripped complete-replacement validation
+
Per-scope SHA-256 generation map (<=128), in-lock assertMonitorWait, and explicit clear_fields on todo_upsert
Retiring an exhausted Monitor inside its own streak replan erased the live trigger; background watch sessions raced foreground native replan turns on runs/
+
monitor_no_change_streak persisted in SCALAR_REVIEW_KINDS; steward.background isolated from chat and serialized against active foreground native replans
9. Peer collaboration: why “returned” is not “finished”
+
When an Agent delegates a slice to a peer or Steward worker, message delivery is only transport—not task completion and not requester adoption. LoopX separates transport delivery, unfinished remainder declarations, requester adoption, and Goal outcome custody across collaboration/result_publication.ts, inbox_receipts.ts, inbox_read.ts, and return_delivery.ts:
Outcome custody (#9308): immutable declaration_owner_agent_id + recorded_for_agent_id stay distinct from current owner_agent_id, fenced against concurrent roster changes.
+
+
+
Immutable partial returns (result_publication.ts, #8139): Conclusion updates form an immutable hash-verified chain (conclusion → conclusion-00000001 via previous_result_key). #8139 introduced return_format_version: 2 to enforce a 20,000-character budget across combined text + remaining_work while preserving legacy replay formatting so post-crash provider verification digests never drift.
+
Protecting one-shot work reservations during review (#8329) and isolating peer settlement (#8853): In conversation_binding.ts, planWorkAfterResultReview() (#8329) prevents a read-only interrupted-result review Turn from consuming the writable owner's work-1 reservation, re-verifying native-effect proof and grant snapshots before resuming remaining work. Meanwhile, #8853 filters projectSettledReplanHistory by explicit agent_id during lane settlement so an unrecorded or corrupt peer receipt cannot deadlock another Agent's Turn closeout, while unscoped status retains full multi-agent health reporting.
+
Explicit Goal outcome custody handoff (#9308): When a peer retires, goals/outcome_requirements.ts and outcome_records.ts separate immutable declaration_owner_agent_id and per-review recorded_for_agent_id from mutable owner_agent_id, allowing a local owner to adopt selected retired-Agent outcomes under a roster-fenced commit without rewriting provenance.
+
+
+
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:
@@ -230,7 +321,7 @@
8. Callers and defaults determine whether migration reaches u
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.
-
9. Recover the original result while protecting current authority
+
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 Scroll on narrow screens; open the image for full size.
@@ -239,25 +330,30 @@
9. Recover the original result while protecting current autho
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.
-
10. CLI output budgets: protect decision semantics before compression
-
CLI language participates in an agent's decisions. This engineering constraint predates the final writer retirement and remained a validation boundary during migration.
12. Designing a CLI for Agents, not just shell users
+
A human shell CLI assumes an interactive operator with persistent out-of-band working memory: someone who remembers passing --limit 5, visually discounts a stale cache, reads tracebacks, avoids mutating state while inspecting, and pays almost zero marginal cost per stdout byte. An LLM Agent is an amnesic, literalist, retry-prone, token-metered state-machine consumer. Every stdout byte enters prompt history; mid-history edits invalidate prefix KV caches; unlabeled truncation looks identical to “zero tasks left”; and impure previews or dropped responses trigger blind retry loops.
+
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 shared Turn decision owner and copy-runnable remediation
+
Split-brain entrypoints cause execution/settlement drift and flag-guessing loops. #4496 converged quota should-run, turn plan, turn run-once, and turn managed-step onto one shared decision owner (build_fresh_turn_decision_owner → loopx_turn_envelope_v1) carrying the exact status snapshot, scheduler context, and turn-start hooks into settlement. #7462 then moved primary-action instruction selection to TypeScript (work_items/interaction_contract.ts), composing recovery precedence before reading instruction facts and cutting RPC transport on a 22,000-row backlog from 2,354,852 bytes to 959 bytes with 182-case byte parity.
+
When a step cannot proceed, the CLI projects copy-runnable next commands instead of prose exceptions: #4595, #4893, and #6212 separated receipt_unbound from identity_mismatch and surfaced owed_prior_turn closeout commands; #8855 rendered exact pure-replan closeout flags and no-followup Vision arguments; #9136 preserved typed EffectRuntimeRemoteError.diagnostic_code alongside quota_spent: false journal proof; and #9293 separated non-isolatable logical write_scope_conflict waits from worktree-isolatable workspace_lease_conflict hints so Agents stop spawning futile worktrees.
+
Truthful read models via a sealed projection_envelope
+
After five freshness incidents in 47 days (#5087) where an advisory deployment answered from stale or partial sources while reporting ok: true, #5085 introduced projection_envelope.ts (sealProjectionEnvelope), extended to quota should-run in #6679 and single-transaction todo.read in #6874. Only the TypeScript kernel computes fresh, complete, and alert; cached responses restamp served_at without refreshing observed_at; and todo.read computes coverage (expected_count, included_count, omitted) over the complete matching population before --limit or thin slicing. Display caps set truncated: true without firing false alerts, whereas unreadable or omitted work sets complete: false, alert: true—preventing an Agent from ever mistaking top-N truncation for Goal completion.
+
Prefix-KV and context-window economics
+
The interface budget contract and its base/head differential verifier (#6123, #9103 exporting origin/main via a private Git index with zero path-length skew) check printed stdout characters, UTF-8 bytes, lines, per-Todo growth slopes, semantic JSON keys, and action-signature SHA-256 digests across small, 36-Todo crowded, and multi-agent fixtures. Natural-language obligations require clause-level review; removing JSON indentation on a 36-Todo / 12-run fixture cut output from 48,418 to 39,726 characters (~18%) with identical decoded semantics, while dropping an authority qualifier to pass a size check is forbidden.
+
Beyond single-command size, three mechanisms protect multi-turn KV cache and latency budgets:
-
Actually printed stdout, alongside the in-memory payload.
-
Distinct character, UTF-8 byte, line, and JSON-structure costs.
-
Base and head on the same fixture, plus growth as Todos and history accumulate.
-
Required fields, action signatures, semantic anchors, and explicit detail paths.
+
Progressive subtree deduplication and append-only note proofs (#7196, #8100, #8523): Immutable Turn captures pin native first reads, deduplicate unchanged >=1 KiB subtrees across turns via private journal SHA-256 digests, and emit append-only Todo note prefix proofs (<prefixBytes>:<sha256>, #8523) so progress updates transmit only the UTF-8 suffix while keeping live controls, claims, and revisions inline.
+
Stage-then-swap Todo semantic-unit folding preserving prefix KV (#9213): Sliding-window compaction mutates early tokens and destroys prefix KV caches. In quota/stage_then_swap.ts and todo-unit-fold.ts, LoopX snapshots prefixNodeCount and prefixDigest at Todo start; at a quiescent boundary, FoldToReceipt replaces only suffix [startSeq..endSeq] with a compact receipt μ preserving failureFacts and openObligations iff livePrefixDigest === anchor.prefixDigest, zero tool-call/result pairs straddle the anchor, completionReceipt verifies cleanly, optional read-only obsNextCmd passes strict argv allowlisting, and amortized net savings reach at least 64 tokens—rolling back atomically to KeepRaw on any violation.
+
Collapsing status RPC storms (#7755, #9392): Decision reads skip presentation-only rollout scans (#7755), and #9392 collapsed duplicate authority reads and O(N) deferred-Todo paging into 1 todo.read RPC and flat todo.context.page <= 5 (identical for 0 vs. 12 deferred Todos), guarded by pre/post rollout-stat and todo_authority_head_verify_v0 TOCTOU checks.
-
Presentation reduction belongs after complete planning. Information omitted from display differs from information never read. Projection envelopes likewise separate observation time, service time, source coverage, and completeness. Serving a cached result again must not make its facts newer.
-
Natural language requires clause-level review: obligations, ordering, evidence provenance, authority qualifiers, scope, continuation, and stop conditions. Removing a phrase such as “only when the original proof is valid” can change behavior even when every field remains.
-
One bounded example removed JSON indentation and separator whitespace. On the same historical fixture of 36 Todos and 12 runs, output fell from 48,418 to 39,726 characters, about 18%, with the complete decoded payload unchanged. This establishes a presentation-size change. Tokens, cost, and agent outcomes need separate measurements.
-
The budget protects an interface the consumer can use. Valuable guidance may justify increasing it with matched evidence. Dropping decision conditions to make a size test green damages the interface.
+
Strict read-vs-write purity and CAS/replay contracts
+
Agents routinely preview commands and retry after timeouts, so inspection and mutation must never blur. #8685 made quota should-run --dry-run strictly read-only, fencing turn-start dispatch hooks, rollout logs, poll receipts, and cache writes behind not preview. #8776 refuses run-once upfront (turn_execution_preparation_claim_not_consumed) at zero host invocation and zero quota spend when an advertised preparation claim was left unconsumed. Per-request ContextVar scopes (#4694, #6992, #9433) pin runtime revisions and stage decoded hook snapshots without wall-clock TTL staleness. And across mutating commands—handoff (#4094), goal-acceptance (#7088), task-lease (#8310, #9225 preserving explicit version 0), and todo mutations + read-only todo receipt (#9263)—--expected-revision CAS rejects concurrent stale bases while repeating the same --operation-id replays the original receipt without double-mutating.
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.
-
11. Final retirement: preserve credit and account for the deletions
+
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.
@@ -297,9 +393,9 @@
11. Final retirement: preserve credit and account for the de
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.
-
12. Core control-plane statistics across the full period
+
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 baseline is d1fe059, immediately before the formal TS RFC. The endpoint is the October 16 snapshot 488e443. The formal RFC to that endpoint spans roughly 62 days, covering 63 calendar dates; 62 of those dates contain a core mainline commit. The source comparison fixes both versions.
+
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
@@ -449,7 +545,105 @@
How the work continued over time
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.
-
13. Community contributions and the next step
+
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 C1, task-semantics, Agent-CLI, Zero-Any, and loopx-cloud SPI waves:
+
+
+
+
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 merged PRs (all-time at Nov 27)
+
—
+
—
+
—
+
8,476 (9,024 1st-parent commits)
+
+
+
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/ associated merged PRs (since Aug 15)
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 RemoteAuthorityService to loopx-cloud, core TypeScript stock stood at 435 files / 127,466 LOC (42.89%). Both endpoint_net_equals_first_parent_sum and source_stock_delta_equals_code_net 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.
到 11 月初的 #7834,sqlite_v0 进一步接管了已完成与已替代 Todo 的归档权威(todo_archive 表):在 todo complete 与 todo supersede 提交事务内自动将超出有界窗口(最近 N = 5 条终态项)的历史项迁入 SQLite 归档,使活跃 ACTIVE_GOAL_STATE.md 投影体积与完整历史解耦,同时保留按 ID 精确回读与恢复回执的能力。
Across 103 days and 2,126 core PRs: complete transactions, shared AuthorityStore, Zero-Any semantic vocabularies, composable task primitives (resume, monitor, replan, peer handoff), and a CLI built for long-horizon agents and agent teams.
LoopX is, at its core, a general-purpose long-horizon task semantics engine—unifying complete state transactions, shared AuthorityStore, zero-Any vocabularies, composable resume/monitor/replan/handoff primitives, and an Agent-native CLI.
LoopX’s TypeScript Semantic Control Plane: Transactions, Task Semantics, and an Agent-Native CLI
An effect succeeds without a checkpoint. A resumed Agent outlives its task lease. A truncated CLI view looks indistinguishable from finished work. Across 103 days and 2,126 core PRs, LoopX unified distributed state transactions, closed-set semantic vocabularies, composable long-horizon task primitives, and a CLI designed for Agents rather than shell prose.
Retrying an operation can execute its effect twice. Reading back a success receipt can revive execution rights that have already expired. And when long-horizon agents and agent teams run for hours or days across interrupted sessions, storage atomicity alone is not enough: task continuation (resume_when), background observation (continuous_monitor), lineage-preserving replanning, peer handoffs, and the CLI stdout bytes the model reads must obey one typed state machine.
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?
@@ -34,11 +34,11 @@
Why could correcting evidence restart finished work?
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 Agent semantic kernel
-
The formal migration RFC merged on August 15. Over the first 62 days through mid-October, the program retired ordinary legacy Markdown writers in #6396. Over the next 41 days through November 27—103 elapsed days and 2,126 merged PRs touching loopx/control_plane/—a second convergence wave turned that transactional foundation into a complete semantic control plane for long-horizon agents and agent teams.
-
The final relay by three developers and their agents in #6396 depended on the earlier transaction and storage work, and unlocked everything that followed: unified C1 Turn sources, composable resume / monitor / replan / peer-handoff semantics, a Zero-AST-Any vocabulary ratchet, and an Agent-native CLI.
+
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.
-
LoopX retains goals, tasks, evidence, and execution boundaries for long-horizon agents and agent teams. Models propose routes. The control plane protects versions, execution authority, and state commits, then finds a valid recovery position after interruption.
+
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.
@@ -86,21 +86,21 @@
2. Reconstruct the history: from migration plan to Agent sema
Mid-October
-
Concentrated legacy writer retirement (−17,935 lines), followed by single-transaction todo.read and progressive context
+
Concentrated legacy writer retirement, followed by single-transaction task reads and progressive context
103-day history: converging transaction/task-loop, authority/storage, and Semantics/Agent-CLI tracks. Scroll on narrow screens; open the image for full size.
+
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
@@ -181,12 +181,11 @@
5. Shared authority: connect distributed storage to Agent exe
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
-
Once real multi-hour Agents ran continuously against AuthorityStore, keeping storage primitives separate from domain transitions paid off across four subtle boundaries:
+
Keeping pure storage commits separate from domain transition rules paid off once multi-hour Agents ran continuously across interrupted sessions:
-
Exact GoalRef historical ACK fencing (#8975): Recreated instances of a goal_id share one rollout log. Without binding historical autonomous_replan_ack ordering to the exact GoalRef (goal_id + goal_instance_id), a retired instance's earlier refresh or compacted ACK could clear writeback_follows_admission and silence the live instance's open replan review.
-
Preserving admitted Turn settlement across lease renewal (#9257): Renewing a hard_lease mid-Turn bumps the lease version without changing execution ownership. Turn settlement now admits the first combined writeback when current_proof.expected_version >= requested_proof.expected_version >= admitted_version under the same lease_epoch and idempotency_key, while standalone refresh-state retains strict current-version CAS.
-
3-hour task leases and deterministic lost-lease closeout (#9304, #9314, #9342, #9487): Default managed lease TTL moved from 45 minutes to 3 hours (10,800s) without mutating existing leases. Sub-second acquire-release-reclaim transitions retain millisecond causal clocks (admittedAt <= acquired <= updated <= now, #9314); spend-slot digest conflicts project original_turn_guard_command() (#9342); and when a worker's lease expires or is replaced (#9304, #9487), observeFencedExecution() grants control-writer proof only for administrative no-spend closeout (delivery_outcome: "outcome_gap", zero quota spend)—never advertising resumption of dead execution.
-
Shared delta invariants, >20k-commit checkpoints, and a clean Apache-2.0 SPI (#8747, #8759, #8765, #9380, #9223): In shared delta replay (authority_state_log.ts), JavaScript sparse-array holes persisted as JSON null were skipped by .map()/.slice(), breaking digest reconstruction across both File and SQLite until #9380 normalized index checks via Object.hasOwn. On the remote path, #8759 (historical postgresql_authority_store.ts) brought 64-commit checkpoints, incremental delta replay, and tenant-scoped RLS past 20,000 commits alongside hard-lease-fenced remote task settlement (#8747, #8765). Finally, #9223 extracted server-side PostgreSQL storage and RemoteAuthorityService into loopx-cloud while keeping local File/SQLite authority, the AuthorityStore SPI, and the fail-closed outbound RemoteAuthority gateway 100% Apache-2.0 in LoopX Core.
+
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.
@@ -196,7 +195,7 @@
6. After SQLite: retained history needs a cost model
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 sqlite_v0 to own archived Todo history (todo_archive): during todo complete and todo supersede transactions, terminal items beyond the bounded active window (N = 5) are atomically archived into SQLite, decoupling the active ACTIVE_GOAL_STATE.md projection size from total historical volume while preserving exact ID readback and receipt recovery.
+
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.
@@ -210,77 +209,83 @@
Counterexamples for the checker itself
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
-
Through November, two commit-time verifiers turned typed semantics from a review guideline into an equality-anchored pre-merge ratchet across both Python and TypeScript:
+
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 convergence (loopx/semantics/vocabulary_v0.json): On-demand AST scanning across 2,020 tracked .py and .ts files (with 693 files verified under executable/AST producer-closedness witnesses) now governs 34/34 registered vocabularies and 62/62 owner symbols (up from 26 and 46), with 0 conflicting semantic values, 0 schema-version forks, and equality-anchored budgets (registry == code_anchor) that forbid silent upward drift. For example, #8184 removed a local HANDOFF_MODES fork in execution_preparation.ts and pinned the subset invariant that historical receipt decoding recognizes "legacy" while fresh execution admission accepts only EXECUTION_HANDOFF_MODES (soft_claim, hard_lease).
-
Zero-AST-Any maintainability ratchet (maintainability_ratchet.py): Every single one of the 43/43 tracked module ceilings in module_metric_baseline.json now pins dict_any_count: 0 (and 29/43 pin any_count: 0). Zero-Any Python modules in loopx/control_plane/ more than doubled from 67 (October 16) to 147 (November 27), while across all 430 TypeScript files (124,805 LOC) in loopx/control_plane/, explicit any appears only 8 times total.
+
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] uncovered real concurrency and replay bugs
Modularizing untyped monoliths into zero-Any carriers repeatedly exposed latent state corruption during the refactor itself: #9282 eliminated untyped frontier mutation in goal_frontier; #9418 split state_refresh.py into typed refresh_state/* records and caught stale entry-registry snapshots surviving replay across route switches; #9416 exposed a dropped extension-source scope bug in canary/planner.py; #9445 caught silent default reconstruction during quota source migration; #9451 and #9456 sealed Todo and subagent topology contracts; and #9433 replaced capability_hooks.py with zero-Anyhook_runtime/*, surfacing and fixing 7 real request-scope cache, symlink-ABA, and transaction-rollback bugs in the same PR.
+
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: when resume, monitor, and replan compose
-
In runs that span hours or days, resume_when, continuous_monitor, autonomous replan, hard_lease, and quota settlement are not independent features. They execute as a coupled state machine over shared AuthorityStore revisions and append-only rollout receipts. Before TypeScript owned their composition, individual primitives passed happy-path checks while their pairwise and three-way interactions deadlocked Agents—producing heartbeat_receipt_identity_conflict, malformed_settlement_state, silent Vision-wait starvation, or session queue kills.
-
Even unifying the Turn baseline taught an operational lesson. Monolithic #7430 (C1: unify work sources and validate recovery, 215 files) was reverted seven minutes after merge in #8265 so main integration and cost boundaries could be qualified incrementally. Decomposing C1 into roughly 25 bounded slices—re-landing core work-source unification (#8211), quota source cutover (#8956), unified CLI settlement composition (#9004), and digest-pinned C1 replan reads (#9022)—allowed #9176 (Default to Complete Turn and retire legacy delivery selectors) and #9328 to flip the default cleanly.
-
Scoped continuation, non-starving background monitors, and lineage-preserving replans compose over one TypeScript kernel backed by AuthorityStore and the append-only rollout journal. Scroll on narrow screens; open the image for full size.
-
Scoped continuation: resume by todo
-
todos/resume_condition.ts evaluates the five closed-set TODO_RESUME_KINDS (todo_done, monitor_changed, pr_merged, capacity_available, resume_at) against timezone-aware microsecond clocks and strict generation fences inside a single todo.read transaction (#6874) paired with Goal Vision-wait coverage (#7298). Real runs forced precise boundaries:
+
A general-purpose long-horizon task semantics engine proves its worth when primitives compose across hours or days. Conditional continuation, continuous observation, and evidence-driven replanning are not independent feature flags—they execute as a coupled state machine over shared state revisions and execution leases. When separate adapters evaluated them piecemeal via dictionary overlays and second-level clocks, each primitive passed isolated happy-path checks while their pairwise and three-way interactions deadlocked Agents: waking unrelated waiters, stranding unspent turn receipts, or starving replanning when routine tasks blocked. Moving task readiness (#6874), goal-level wait coverage (#7298), and unified turn execution (#8211, #9176) into one TypeScript kernel made cross-primitive invariants enforceable in a single transaction.
+
Per-target continuation, non-blocking background watches, and self-consistent replanning compose over one TypeScript kernel backed by AuthorityStore and an append-only execution journal. Scroll on narrow screens; open the image for full size.
+
Per-target continuation and cross-lease handoffs
+
Resuming deferred work safely requires evaluating the full dependency graph in one atomic read (#6874, #7298) and scoping both wakeup signals and lease lifetimes to the exact target:
-
Exact-scope monitor wakes (#8231): When one shared Monitor watched N pull requests or benchmarks, bumping a single global generation on PR A prematurely woke deferred Todos waiting on PR B. todos/monitor_scope.ts added monitor_changed:<id>@<scope> with per-scope SHA-256-keyed generations capped at 128 scopes—refusing a 129th scope rather than evicting baseline evidence for existing waiters.
-
Verified context across session resumes and epochs (#8559, #8942) and initial user-gate linking (#8618):native_context_lifecycle.ts retains byte-verified literal selected_resume sections even when candidate context_epoch rotates on compaction suspicion, while todo_update_admission.ts admits lease-free initial --unblocks-todo-id links on user_gate Todos only when decision_scope covers the blocked action and resume_when matches the gate.
-
Crossing lease boundaries (#8728, #9183, #9304, #9488): Once lifecycle writeback resolves a frontier gap, preserveReceiptBoundObligation (#8728) bypasses candidate reconstruction so the original receipt can settle. On --resume-turn-key, #9183 rebinds task leases lazily only when durable writeback is still owed. If another worker replaced the expired lease, #9304 routes to no-spend loss closeout; if the same Agent re-claims the open Todo in a higher lease_epoch, heartbeatLeaseTakeover (#9488) appends a fenced lease_takeover receipt under the maintenance lock, preserving turn_instance_id while recording takeover_todo_sha256 and takeover_acceptance_sha256 for re-validation.
+
Per-target wakeup generations (#8231): When one shared monitor watches dozens of pull requests or experiments, advancing a single global counter on target A prematurely wakes tasks parked on target B. Tracking independent SHA-256-keyed generations per target—capped at 128 targets per monitor and refusing overflow rather than evicting existing waiters' baselines—isolates wakeups without losing state.
+
Separating foreign lease loss from same-agent continuation (#4094, #9304, #9488): Multi-hour turns routinely outlive a single lease TTL. Rather than treating every expired lease identically, the kernel checks who holds the successor grant: if another worker claimed the task, the interrupted turn closes out administratively at zero quota spend (#9304); if the same Agent re-claimed the open task in a higher lease epoch, a fenced takeover receipt preserves the turn identity while requiring fresh verification against current task and acceptance digests (#4094, #9488).
+
+
Non-blocking background observation
+
Continuous watches must observe external signals at zero routine quota cost without accidentally re-arming finished work or blocking interactive turns:
+
+
Partial edits vs. explicit clearing (#4178, #4335, #9249): Rebuilding task objects from defaults during an evidence edit can silently re-arm an already-satisfied monitor (#4178), while deleting an optional scope key without recording an explicit field-clear list breaks full-replacement storage validation (#9249). Pure observation-to-state reduction (#4335) keeps counter updates, omission, and explicit clearing distinct.
+
Isolating watches from foreground queues and model blips (#5450, #9155, #9320): Early polls shared receipt namespaces and session queues with foreground work, so a quiet heartbeat colliding with a due watch wedged recovery (#5450), human chats delayed due polls, and an upstream LLM blip during an adapter healthcheck could kill deterministic observation turns that never call a model. Dedicated background watch sessions (#9320) and model-free observation health paths (#9155) decouple routine watching from active execution.
+
+
Self-referential replanning and causal lineage
+
Replanning is uniquely hazardous because a replan turn mutates—or retires—the very tasks and triggers that authorized it:
+
+
Atomic task supersession and trigger survival (#4902, #5698, #8854): Replacing a stalled plan links successor tasks, retires the predecessor, and releases its execution lease in one commit (#5698) over a unified replan history reducer (#4902). When a monitor triggers a replan after repeated no-change polls and the Agent retires that exhausted monitor inside the replan turn, the live task trigger vanishes mid-turn—so the kernel persists the trigger reason as an immutable scalar fact on the turn receipt itself (#8854).
+
Settling the turn before derived goal stop (#7298, #8588, #9411): When a replan writeback closes the last open gap on a goal, naive state evaluation immediately declares the goal finished and halts execution—stranding the replan turn's own unspent receipt (#8588). Prioritizing pending turn settlement ahead of derived terminal stop, alongside strict schema stripping when upgrading preflight guards (#9411), ensures every replan closes cleanly.
-
Observation without starvation: continuous_monitor
-
Monitors observe external signals at zero routine quota spend through todos/monitor_metadata.ts, quota/monitor_poll_admission.ts, and scheduler/monitor_batch.ts. Keeping continuous watches alive without starving interactive or foreground work required closing six failure modes: separating quiet vs. Todo-bound poll effect IDs and recovering blocked unpolled Monitors (#5450); re-verifying evaluated resume_when readiness inside the AuthorityStore commit lock via assertMonitorWait (#8674); recovering transient external-signal failures and cleared-replan reports (#9093, #9143); bypassing live LLM adapter healthchecks on observation-only Monitor turns so an upstream model blip cannot kill the session queue (#9155); emitting explicit clear_fields when an unscoped poll clears prior material_change_scope metadata (#9249); and isolating watches onto dedicated steward.background.<binding_id> carrier sessions with scope-changed and zero-write follow-up recovery (#9320, #9364).
-
Lineage-preserving replan and succession
-
todos/succession.ts, work_items/replan_history.ts (#4902), and work_items/replan_semantics.ts govern how plans change without losing causal lineage. Atomic todo supersede (#5698) links replacement Todos, retires the predecessor, and releases its lease in one commit. Subsequent counterexamples hardened every boundary of a replan Turn: retaining bound Todo identity during semantic replan recovery (#8495); prioritizing replan_settlement_pending before derived Goal terminal stop so closing the frontier does not strand the unspent receipt (#8588); preserving distinct same-second work evidence digests (#8742) and verifying same-second whole-second run-index ACKs against microsecond rollout log indices (#8804); keeping monitor_no_change_streak as a scalar receipt source when the Agent retires the exhausted Monitor mid-replan (#8854); projecting exact pure-replan closeout commands (#8855, #9160); keeping bound yardstick reversals inline in captured C1 openings (#9022, #9165); normalizing null vs. omitted completion_turn_key (#9296); restoring autonomous replan when ordinary blocked tasks would otherwise park ongoing repeat_until_closed Visions (#9361); stripping stale guard companions on identity_upgrade via semantic_replan_guard.ts (#9411); and serializing background Monitor polls against foreground native replan turns (#9474).
Composed primitives
-
Multi-primitive failure before convergence
+
Failure mode before convergence
TypeScript kernel invariant
Verified PRs
-
monitor × resume_when × AuthorityStore
-
Global monitor generation woke unrelated waiters; stored Monitors lacked evaluated readiness; clearing material_change_scope to null tripped complete-replacement validation
-
Per-scope SHA-256 generation map (<=128), in-lock assertMonitorWait, and explicit clear_fields on todo_upsert
Retiring an exhausted Monitor inside its own streak replan erased the live trigger; background watch sessions raced foreground native replan turns on runs/
-
monitor_no_change_streak persisted in SCALAR_REVIEW_KINDS; steward.background isolated from chat and serialized against active foreground native replans
9. Peer collaboration: why “returned” is not “finished”
-
When an Agent delegates a slice to a peer or Steward worker, message delivery is only transport—not task completion and not requester adoption. LoopX separates transport delivery, unfinished remainder declarations, requester adoption, and Goal outcome custody across collaboration/result_publication.ts, inbox_receipts.ts, inbox_read.ts, and return_delivery.ts:
+
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 separates transport delivery, unfinished remainder declarations, requester adoption, and outcome custody:
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. Semantic completion & adoptionAny conclusion declaring unfinished remaining work stays open in the inbox until the requester explicitly records a turn-bound adoption or rejection receipt.Semantic state: awaiting adoption
-
Outcome custody (#9308): immutable declaration_owner_agent_id + recorded_for_agent_id stay distinct from current owner_agent_id, fenced against concurrent roster changes.
+
Custody handoff (#4094, #9308): original authorship and historical review provenance remain immutable when active ownership transfers under a roster-fenced commit.
-
Immutable partial returns (result_publication.ts, #8139): Conclusion updates form an immutable hash-verified chain (conclusion → conclusion-00000001 via previous_result_key). #8139 introduced return_format_version: 2 to enforce a 20,000-character budget across combined text + remaining_work while preserving legacy replay formatting so post-crash provider verification digests never drift.
-
Protecting one-shot work reservations during review (#8329) and isolating peer settlement (#8853): In conversation_binding.ts, planWorkAfterResultReview() (#8329) prevents a read-only interrupted-result review Turn from consuming the writable owner's work-1 reservation, re-verifying native-effect proof and grant snapshots before resuming remaining work. Meanwhile, #8853 filters projectSettledReplanHistory by explicit agent_id during lane settlement so an unrecorded or corrupt peer receipt cannot deadlock another Agent's Turn closeout, while unscoped status retains full multi-agent health reporting.
-
Explicit Goal outcome custody handoff (#9308): When a peer retires, goals/outcome_requirements.ts and outcome_records.ts separate immutable declaration_owner_agent_id and per-review recorded_for_agent_id from mutable owner_agent_id, allowing a local owner to adopt selected retired-Agent outcomes under a roster-fenced commit without rewriting provenance.
+
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
@@ -331,23 +336,22 @@
11. Recover the original result while protecting current auth
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 interactive operator with persistent out-of-band working memory: someone who remembers passing --limit 5, visually discounts a stale cache, reads tracebacks, avoids mutating state while inspecting, and pays almost zero marginal cost per stdout byte. An LLM Agent is an amnesic, literalist, retry-prone, token-metered state-machine consumer. Every stdout byte enters prompt history; mid-history edits invalidate prefix KV caches; unlabeled truncation looks identical to “zero tasks left”; and impure previews or dropped responses trigger blind retry loops.
-
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 shared Turn decision owner and copy-runnable remediation
-
Split-brain entrypoints cause execution/settlement drift and flag-guessing loops. #4496 converged quota should-run, turn plan, turn run-once, and turn managed-step onto one shared decision owner (build_fresh_turn_decision_owner → loopx_turn_envelope_v1) carrying the exact status snapshot, scheduler context, and turn-start hooks into settlement. #7462 then moved primary-action instruction selection to TypeScript (work_items/interaction_contract.ts), composing recovery precedence before reading instruction facts and cutting RPC transport on a 22,000-row backlog from 2,354,852 bytes to 959 bytes with 182-case byte parity.
-
When a step cannot proceed, the CLI projects copy-runnable next commands instead of prose exceptions: #4595, #4893, and #6212 separated receipt_unbound from identity_mismatch and surfaced owed_prior_turn closeout commands; #8855 rendered exact pure-replan closeout flags and no-followup Vision arguments; #9136 preserved typed EffectRuntimeRemoteError.diagnostic_code alongside quota_spent: false journal proof; and #9293 separated non-isolatable logical write_scope_conflict waits from worktree-isolatable workspace_lease_conflict hints so Agents stop spawning futile worktrees.
-
Truthful read models via a sealed projection_envelope
-
After five freshness incidents in 47 days (#5087) where an advisory deployment answered from stale or partial sources while reporting ok: true, #5085 introduced projection_envelope.ts (sealProjectionEnvelope), extended to quota should-run in #6679 and single-transaction todo.read in #6874. Only the TypeScript kernel computes fresh, complete, and alert; cached responses restamp served_at without refreshing observed_at; and todo.read computes coverage (expected_count, included_count, omitted) over the complete matching population before --limit or thin slicing. Display caps set truncated: true without firing false alerts, whereas unreadable or omitted work sets complete: false, alert: true—preventing an Agent from ever mistaking top-N truncation for Goal completion.
-
Prefix-KV and context-window economics
-
The interface budget contract and its base/head differential verifier (#6123, #9103 exporting origin/main via a private Git index with zero path-length skew) check printed stdout characters, UTF-8 bytes, lines, per-Todo growth slopes, semantic JSON keys, and action-signature SHA-256 digests across small, 36-Todo crowded, and multi-agent fixtures. Natural-language obligations require clause-level review; removing JSON indentation on a 36-Todo / 12-run fixture cut output from 48,418 to 39,726 characters (~18%) with identical decoded semantics, while dropping an authority qualifier to pass a size check is forbidden.
-
Beyond single-command size, three mechanisms protect multi-turn KV cache and latency budgets:
+
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’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:
-
Progressive subtree deduplication and append-only note proofs (#7196, #8100, #8523): Immutable Turn captures pin native first reads, deduplicate unchanged >=1 KiB subtrees across turns via private journal SHA-256 digests, and emit append-only Todo note prefix proofs (<prefixBytes>:<sha256>, #8523) so progress updates transmit only the UTF-8 suffix while keeping live controls, claims, and revisions inline.
-
Stage-then-swap Todo semantic-unit folding preserving prefix KV (#9213): Sliding-window compaction mutates early tokens and destroys prefix KV caches. In quota/stage_then_swap.ts and todo-unit-fold.ts, LoopX snapshots prefixNodeCount and prefixDigest at Todo start; at a quiescent boundary, FoldToReceipt replaces only suffix [startSeq..endSeq] with a compact receipt μ preserving failureFacts and openObligations iff livePrefixDigest === anchor.prefixDigest, zero tool-call/result pairs straddle the anchor, completionReceipt verifies cleanly, optional read-only obsNextCmd passes strict argv allowlisting, and amortized net savings reach at least 64 tokens—rolling back atomically to KeepRaw on any violation.
-
Collapsing status RPC storms (#7755, #9392): Decision reads skip presentation-only rollout scans (#7755), and #9392 collapsed duplicate authority reads and O(N) deferred-Todo paging into 1 todo.read RPC and flat todo.context.page <= 5 (identical for 0 vs. 12 deferred Todos), guarded by pre/post rollout-stat and todo_authority_head_verify_v0 TOCTOU checks.
+
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).
-
Strict read-vs-write purity and CAS/replay contracts
-
Agents routinely preview commands and retry after timeouts, so inspection and mutation must never blur. #8685 made quota should-run --dry-run strictly read-only, fencing turn-start dispatch hooks, rollout logs, poll receipts, and cache writes behind not preview. #8776 refuses run-once upfront (turn_execution_preparation_claim_not_consumed) at zero host invocation and zero quota spend when an advertised preparation claim was left unconsumed. Per-request ContextVar scopes (#4694, #6992, #9433) pin runtime revisions and stage decoded hook snapshots without wall-clock TTL staleness. And across mutating commands—handoff (#4094), goal-acceptance (#7088), task-lease (#8310, #9225 preserving explicit version 0), and todo mutations + read-only todo receipt (#9263)—--expected-revision CAS rejects concurrent stale bases while repeating the same --operation-id replays the original receipt without double-mutating.
+
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—task handoffs (#4094), single-attempt command receipts (#4286), goal acceptance (#7088), and task leases (#8310)—--expected-revision CAS rejects concurrent stale bases while repeating the same --operation-id replays the original 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.
@@ -546,7 +550,7 @@
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 C1, task-semantics, Agent-CLI, Zero-Any, and loopx-cloud SPI waves:
+
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:
@@ -642,7 +646,7 @@
103-day convergence snapshot (August 15 – November 27, 2026)
+188,960 / −99,801 (net +89,159)
-
Immediately before #9223 extracted server-side PostgreSQL storage and RemoteAuthorityService to loopx-cloud, core TypeScript stock stood at 435 files / 127,466 LOC (42.89%). Both endpoint_net_equals_first_parent_sum and source_stock_delta_equals_code_net hold identically across the 103-day span.
+
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.
到 11 月初的 #7834,sqlite_v0 进一步接管了已完成与已替代 Todo 的归档权威(todo_archive 表):在 todo complete 与 todo supersede 提交事务内自动将超出有界窗口(最近 N = 5 条终态项)的历史项迁入 SQLite 归档,使活跃 ACTIVE_GOAL_STATE.md 投影体积与完整历史解耦,同时保留按 ID 精确回读与恢复回执的能力。
+
到 11 月初的 #7834,SQLite 存储进一步接管了终态任务的归档权威:当任务完成或被单事务替代(#5698)时,超出活跃窗口(最近 N = 5 条终态项)的历史记录在同一次事务内迁入归档表,使实时状态视图体积与总历史解耦,同时保留按 ID 精确回读与回执重放。