ZeptoRT Spec Gap Analysis

April 11, 2026 · View on GitHub

Date: 2026-04-08 Source: docs/internal/ZEPTOVM-SPEC-v03-review.md (Codex design review) Compared against: Current implementation (781 tests with --features cli, ~17k LOC)


Critiques — Things to Fix

#CritiqueStatusDetails
C1Soften "deterministic shell" claimDONEReworded to "replay-safe shell" + HANDLER-CONVENTIONS.md
C2Turn atomicity — explicit commit protocolDONETurnExecutor::open_in_memory() uses shared SQLite connection for atomic journal+snapshot commits
C3Separate scheduling fairness from economic fairnessDONEReduction counter separate from BudgetGate
C4Single-threaded scheduler — handler disciplineDONEWatchdog: max_turn_wall_clock + turn_overrun_flag + tracing::warn on overrun
C5Collapse two behavior traits to oneDONEOnly StepBehavior exists

Things to Add Now

#AdditionStatusDetails
A1ObjectRef typeDONEObjectRef type + ArtifactBackend trait + SqliteArtifactStore + ObjectPut/ObjectFetch/ObjectDelete reactor handlers + TTL sweep
A2Behavior version in process metadataDONEBehaviorMeta struct + meta() trait method on StepBehavior
A3Effect state classification for recoveryDONEExplicit EffectState enum (Pending/Dispatched/Retrying/Streaming/Completed) + ReactorMessage state reporting + journal transitions + RecoveryCoordinator replays last_state
A4Watchdog for handler overrunsDONEImplemented with C4 — wall-clock timing in ProcessEntry::step()

Acknowledged Gaps (not yet needed per review)

#GapStatusNotes
G1Multi-node clusteringNOT DONEDesign doc exists, no implementation
G2Object/artifact planeDONEObjectRef + artifact plane implemented with trait-based backend (SQLite first)
G3Full policy engineDONEPolicyEngine with effect-kind rules, integrated into runtime
G4Behavior versioning + migrationDONEVersion in journal, migrate() callback, recovery-time check
G5OneForAll / RestForOne supervisionDONEAll three strategies implemented with shutdown coordination
G6Human approval UI/gatewayDONEApprovalStore + reactor handlers + HTTP endpoints + timeout enforcement

Additional Gaps (from implementation audit)

#GapStatusNotes
X1Name-based process registryDONENameRegistry + TurnIntent integration + auto-cleanup
X2Selective receiveDONETag-based selective receive: pop_matching() + WaitForTag StepResult + selective_tag field + scheduler wiring
X3Per-message TTLDONEexpires_at field + lazy TTL in pop() + reap_expired() + expired_count metrics path
X4Structured observability eventsDONERuntimeEvent enum + EventBus ring buffer with tracing dual-write
X5CliExec/SandboxExec/BrowserAutomation workersNOT DONEEnum variants only

Priority Tiers

Tier 1 — Fix now (review explicitly flagged)

  • C1: Soften deterministic claim (doc change)
  • C2: True atomic turn commit (SQLite transaction)
  • C4/A4: Watchdog for handler overruns
  • A2: Behavior version metadata

Tier 2 — High impact for real agent use

  • G3: Policy engine (safety layer)
  • G5: OneForAll/RestForOne supervision
  • X1: Name-based registry
  • X4: Structured observability

Tier 3 — Mailbox enhancements

  • X3: DONE — Per-message TTL (expiry field on messages, reap on receive)
  • X2: DONE — Selective receive (end-to-end tag-based with control-lane bypass)

Tier 4 — Phase 3+ (deferred from Tier 3 + multi-node)

  • A1/G2: DONE — ObjectRef + artifact plane (ObjectRef type, ArtifactBackend trait, SqliteArtifactStore, reactor handlers, TTL sweep)
  • A3: DONE — Effect state machine for recovery (EffectState enum + ReactorMessage + journal + recovery)
  • G6: DONE — Human approval gateway (ApprovalStore, reactor handlers, HTTP endpoints, timeout enforcement)
  • G1: Multi-node clustering

Tier 5 — AVM Parity (completed 2026-04-08)

#FeatureStatusDetails
AVM1Content inspection (zeptoshield)DONE39 patterns, RegexSet, block/redact/warn, Luhn validation
AVM2Hash-chained audit logDONESHA-256 chain, verify(), atomic commit path, migration
AVM3Context-aware scanningDONEPer-EffectKind field extraction, user-role filter, typed redaction, TOML field_policy, field-path audit in journal (commit c1003e5)
AVM4CLI dashboardDONEzeptort top (one-shot + JSON + live TUI), zeptort audit

Tier 6 — Agent VM Phase 1 (completed 2026-04-08)

The Agent VM lets zeptort wrap arbitrary external commands (e.g. zeptort run zeptoclaw) under daemon supervision — separate from the in-process StepBehavior actor model. Phase 1 is background-first: spawn, log capture, restart, halt/kill, recovery sweep, HTTP + CLI control.

#FeatureStatusDetails
AVM-P1.1Tokio process feature + libc depDONEcommit 12b6d8c
AVM-P1.2[external_agents] config sectionDONEcommit 2b7fea1
AVM-P1.3external_process.rs core typesDONEcommit 9de47fb (Spec, Record, State, RestartPolicy)
AVM-P1.4ExternalProcessRegistry (SQLite)DONEcommit 9f14f18 (open + CRUD + sweep)
AVM-P1.5Spawn primitive + log redirectionDONEcommit cf9c129 (per-agent log file under log_dir)
AVM-P1.6Halt + kill primitivesDONEcommit 0a243e3 (libc SIGTERM grace + SIGKILL fallback, kill_all)
AVM-P1.7Restart loop with exponential backoffDONEcommit bf69fba (100ms × 2ⁿ capped at 30s, max_restarts)
AVM-P1.8Journal integrationDONEcommit 25263fc (ProcessSpawned/Exited/ChildRestarted/MessageReceived via ExternalJournalSink)
AVM-P1.9Wire into Daemon lifecycleDONEcommit b1c0e93 (separate *_external.db, recovery sweep on startup)
AVM-P1.10HTTP endpointsDONEcommit 15f762f (POST/GET /agents/external, halt, kill, ping)
AVM-P1.11CLI subcommandsDONEcommit b425a59 (zeptort run/status/halt/kill/ping)
AVM-P1.12End-to-end integration testsDONEcommit 8deb049 (tests/external_process_lifecycle.rs, 5 tests)

Spec: docs/superpowers/specs/2026-04-08-zeptort-run-mvp-design.md (commit 46b8d1c)

Tier 7 — Next priorities

#FeatureStatusEffortNotes
N1Per-process budgetNOT DONEMediumRefactor global BudgetGate → per-Pid tracking, expose in dashboard
N2Multi-node clusteringNOT DONELargePhase 3 from original roadmap (G1)
N3/status/summary endpointNOT DONEMediumTier 2 dashboard: per-process turns/effects/restarts
N4Web dashboardNOT DONEMediumBrowser-based alternative to zeptort top --live
N5CliExec/SandboxExec workersNOT DONEMediumWire ZeptoCapsule into reactor for real sandbox execution (X5)
N6Agent VM Phase 2: streaming attachNOT DONEMediumPTY allocation, live stdout/stderr forwarding (zeptort attach <name>)
N7Agent VM Phase 2: per-agent gas budgetsNOT DONEMediumBudget tracking on external processes (CPU s, wall clock, mem-MB-s)
N8Agent VM Phase 2: privacy log per agentNOT DONESmallFilter shield audit by external agent name in zeptort status

Tier 8 — Strategic / Research (not yet needed)

#FeatureStatusNotes
R1ZK proofs of agent executionNOT DONEAVM claims 6 proof systems + 25 opcodes. No market demand yet — revisit when agent-to-agent trust is needed. Would use risc0/sp1.
R2External audit anchoringNOT DONEPeriodic hash publish to immutable store (S3, blockchain). Upgrades hash chain from self-consistency to true tamper-evidence.
R3Signed audit logsNOT DONEPublic key signatures on journal commits. Proves provenance, not just integrity.