Midnight Compact · milestone escrow UX

Agent Escrow — role theater + dual-state proofs

Walk a milestone escrow state machine as Client, Agent, or Approver. Proof submissions mint a public commitment hash while the work note stays in a private vault — Midnight dual-state UX, browser-local. Compact skeleton: contracts/agent-escrow (witness-derived roles · MPS-0029). Built by @kshot9000 / Kshot3000 (Midnight GrokBot Agent).

Role theater

Act as one party. Actions outside your role stay disabled — mirrors witness-bound circuits.

Acting as Client — fund / start / settle / dispute enabled when state allows.

Escrow timeline

Visual stepper for the escrow state (not ASCII). Branches for dispute are shown below the main path.

  1. Created
  2. Funded
  3. In progress
  4. Settled
Disputed from funded / in progress
Refunded dispute → refund

Milestone progress

Dual-state proofs simulated

Public pane = commitment the ledger would store. Private pane = agent work notes that never leave this browser until you reset.

Public ledger

Proof commitments

Visible

    No proofs yet — switch to Agent and submit m1 / m2.

    Private vault

    Agent work notes

    Shielded

      Vault empty. Agent notes appear here when you submit a proof.

      Local demo controls

      State: created Funded: 0 L Released: 0 L Refunded: 0 L Balance: 0 L

      Next: fund the escrow to leave created.

      localStorage schema v2 · BroadcastChannel sync · not Compact

      IDDescriptionAmountStatusProof

      Audit log (local)

      (empty)

      Local ZK prove metrics REAL vs :6300

      Optional bridge to real prove:escrow-local output — preimage size, proof bytes, prove ms. Browser cannot CORS to proof-server; load last-prove.json (CLI writes it) or use prove-bridge :6399. LOCAL prove ≠ on-chain.

      Status: empty No local prove loaded

      Run npm run prove:escrow-local then Load, or start npm run prove-bridge.

      local ZK prove against proof-server — NOT a Preprod deploy / NOT on-chain

      bridge: unknown

      CLI: npm run prove:escrow-local → writes apps/agent-escrow-stub/last-prove.json + /tmp/midnight-escrow-last-prove.json. Bridge: npm run prove-bridge (port 6399, CORS). Metrics helpers: shared @kshot/prove-metrics (synced).

      Next steps

      1. Read contracts/agent-escrow (Compact ~0.31.1 pin + MPS-0029).
      2. Install Compact from the official install guide.
      3. cd contracts/agent-escrow && npm run compact
      4. Follow example-bboard / create-mn-app for witnesses + UI wiring.