The Lifecycle Contract
The clean developer surface over the MW engine. This is what external developers meet. Not the engine. Not the backend functions. This.
v1 Decision — Option B
v1 exposes 3 calls: mwWake() → mwRun() → mwSleep()
mwCommit() is internal to Run/Sleep for v1. Will be exposed in v2 once the pattern is proven.
mwWake()mwRun()mwSleep()The Three Calls
Loads the last known safe snapshot for this actor+tenant pair. Reconstructs working state deterministically — no inference, no guessing. Returns a session token the caller uses for all subsequent calls in this session.
Accepts
tenant_idstringrequiredDerived from Bearer token server-side. Never from payload.
actor_idstringrequiredWhich AI agent or actor is waking. e.g. 'arc', 'companion_id'
profilestringBoot profile: 'builder' | 'companion' | 'agent'. Default: 'builder'
context_hintstringOptional natural language hint to guide hydration. e.g. 'Focus on architecture decisions'
Returns
session_idThe only credential external developers need. Pass this to mwRun() and mwSleep().
snapshot_idID of the snapshot that was loaded. null if first session.
resumed_from_priorboolean — true if a prior state was found and reconstructed. This is the continuity proof.
boot_packetThe reconstructed working state. JSON object. What the AI reads to orient itself.
latency_msHow long wake took.
Maps to (internal engine)
mwBootstrapCreates ContinuitySession record, issues wake token, generates verifier challenges
mwHydrateLoads snapshot + working set memories, builds boot packet
mwCompose (optional)If additional context injection needed — e.g. specialist routing
Failure behaviour
If snapshot is corrupt or reconstruction fails, MW halts and returns a recoverable error with the last safe snapshot ID. Never silently continues with bad state.
mwCommit() — v1 Internal Only
mwCommit() — v1 internal onlyMid-session state commit. Validates and persists a delta without closing the session. Allows long-running sessions to checkpoint safely.
v1 Decision
NOT exposed in v1 public surface. Internal to mwRun/mwSleep for now. Will be exposed in v2 once the pattern is proven in the wild.
Why
External devs on v1 don't need mid-session commits — Wake → Run → Sleep is sufficient proof of continuity. Adding mwCommit() to v1 introduces complexity without adding first-integration value. Ship Option B.
Internal Engine Map
The wrapper does not rebuild the engine. It wraps what exists.
mwWake()mwBootstrap + mwHydrateCreates session, loads snapshot, builds boot packetmwRun()mwRunWithContinuityExecutes work through Guard-aware path, stages mutationsmwSleep()mwHandoverWrites delta, closes session, updates snapshot pointermwCommit() (internal)mwHandover (partial)Delta write without session close — v1 internal onlyWhat This Contract Does NOT Do
It does not rebuild the engine. The engine exists. This wraps it.
It does not expose internal engine functions to external developers.
It does not require new entities — ContinuitySession already exists.
It does not expose mwCommit() in v1 — internal only until pattern is proven.
It does not promise perfect symmetry with mwBootstrap/mwHandover naming.
For Sage — Pressure Test
This is the proposed wrapper contract. Before implementation begins, the questions we need answered:
Q1: Is the 3-call v1 surface sufficient to prove continuity?
Yes. Wake → Run → Sleep is exactly right. mwCommit() internal for now.
Q2: Is the proposed_mutations model correct for v1?
Conceptually yes, too explicit for v1 public surface. Expose intent (input), not mutation mechanics. REMOVED from public API.
Q3: Should wake_token be exposed externally?
No. External devs only see session_id. wake_token stays internal. REMOVED from public returns.
Q4: Does anything require rebuilding the engine?
No. Everything wraps existing engine functions. Do not modify engine unless wrapper makes it impossible.
Sage's verdict: Contract is correctly minimal. Design choices are good. Ready for Step 2 — implementation.
Contract locked. The golden path.
understand MW → run Hello World → see continuity proven → explore deeper APIs