Skip to content

Praxis human controls and handoffs

Praxis naming: This page documents Praxis, the AIWS workflow engine. Existing engine/* source paths, /engine/... routes, aiws-engine/* protocol identifiers, and existing script names remain unchanged for compatibility.

Implementation status: M5 source implementation. These engine APIs are not part of the released SDK package surface.

The M5 engine now has durable human controls and engine-owned handoffs layered on top of the scheduler, supervised dispatch, controlled worker execution, and validation/correction pipeline.

Each work order may have one durable control state:

  • RUNNING — new material dispatch is allowed when every other admission check passes.
  • PAUSED — new material dispatch is blocked, but existing responsibility remains.
  • CANCEL_PENDING — new material dispatch is blocked while live/unknown responsibility is settled.
  • CANCELED — cancellation is final. A running engine reaches it only through the cancel of a run awaiting approval, described next.

A cancel of a run awaiting approval (never approved, or back there after its approval window lapsed) with no attempt DISPATCH_AUTHORIZED or UNKNOWN and no active claim is final at once: nothing was released, so the run goes straight to CANCELED. Any other cancel stays CANCEL_PENDING; see Finishing a pending cancellation. Cancellation withdraws a pending approval: an approval of a run whose cancellation is pending or final is refused CONTROL_STATE_CONFLICT, so a cancel request is never overtaken by an approval.

Pause and cancellation never imply that an external action stopped. A previously committed DISPATCH_AUTHORIZED or UNKNOWN attempt remains accountable until it is settled or reconciled.

The control subsystem installs a SQLite trigger at the authoritative dispatch table. If a work order becomes paused or cancel-pending while admission is racing toward commit, insertion of the material dispatch attempt is rejected.

This means a pre-check is not the final safety mechanism. The durable database boundary remains authoritative.

Through the control API, the implementation records authenticated human evidence for:

  • pause;
  • resume;
  • cancel request.

Three more actions exist only as repository methods. No production path calls them, and they authenticate nobody: each refuses a caller whose stated actor kind is not HUMAN and trusts that statement.

  • cancel finalization;
  • the human reconciliation decision record;
  • a generic agent assignment.

So a rule or agent cannot use these to change human control state or its own agent assignment: the control API refuses a session that is not HUMAN, and the repository methods refuse a stated rule or agent actor kind. A running engine replaces an agent through agent replacement, which does not reset budgets, attempts, approvals, or evidence.

A running engine cannot open or close a manual dispatch hold. No control route, host path, runner method, CLI command or storage operation does either. A human who wants work stopped uses pause, which stops the whole work order until resume.

DispatchRepository openHold and closeHold are the steps themselves. openHold records an open hold on a dispatch scope, and admission then refuses work in that scope with HOLD_BLOCKED until closeHold closes it. They exist only as repository methods that tests call on a connection of their own. They are not a coding run’s hold exits, which take the hold exits route. The only dispatch holds a running engine opens and closes are replacement holds: HOLD_REPLACEMENT opens one and RECONCILE_CODING closes it.

A hold a test opens this way is listed by inspect, but it has no hold card, so there is no exit to take. pause and resume leave it open, and reconciliation refuses while it is open.

The two steps fail the test for an entry point differently:

  • Opening only restricts work, so a human-verified route could carry it safely. Nothing requires one: HC-12 lists pause and resume and listing and resolving holds, the wire Command union has no command that opens a hold, and CT-11 and M4-49 require only that a hold survives.
  • Closing lets work resume. HC-12’s resolving is met by the hold exits and by reconciliation, for holds that exist. closeHold is not a safe way to do it: it takes a hold id and a time, with no actor, no decision record and no recheck of what blocked the work, and it closes any open hold, including a replacement hold still waiting for reconciliation. The wire Command union does carry resolveHold, which names a hold, but it does not require a manual close. The engine does not implement it: the commands route refuses it with UNSUPPORTED_CAPABILITY, and no challenge is issued for it. No resolution closes a hold outright either: RETRY and CONTINUE recheck blockers, which a manual hold does not record, ABANDON cancels, and RECONCILE needs a verified human and evidence, then reevaluates the hold.

Adding an entry point would take:

  • a normative requirement in HC-12, a new command in the wire Command union to open a hold, and a new command or a defined resolveHold meaning to close one, under the codec’s versioning rules;
  • a way to tell a manual hold from a replacement hold, since dispatch_holds records no kind or owner, and a close that refuses any other hold;
  • control routes that make narrow service calls, require recent human verification and a permission of their own, and refuse a rule, an agent or a CLI session;
  • a scope reference resolved through the work order, so the caller’s permission on that work order covers the hold, since the methods take a bare scope or hold id;
  • a durable decision record for the close, naming who closed the hold and why, in place of the bare time;
  • storage operations with their operationClock rows, in place of the direct repository calls;
  • a hold card with its exit, and the same actions in the CLI and the web view.

A running engine cannot record a generic agent assignment on a work order. No control route, host path, runner method, CLI command or storage operation does it. A human who wants a different agent on a coding run uses agent replacement: ACTIVATE_REPLACEMENT, or the replacement stepper that codingStartReplacement starts. Those write different records and never reach this one.

ControlHandoffRepository replaceAgent exists only as a repository method tests call. It refuses a caller whose stated actor kind is not HUMAN, refuses a bound work order with BOUND_CONTROL_REQUIRED, raises the revision in agent_assignments and appends a REPLACE_AGENT decision. Dispatch never reads that record, so no agent runs differently for it. Coding insertion and execution binding only refuse a work order that has one.

Nothing requires an entry point: HC-12 and the wire Command union name no such command, no conformance case or scenario asks for one, and STANDARD.md X-02 is met by the governed route’s handoff. The method also could not be exposed as it stands. Replacing an agent changes that agent’s authority, and this method verifies no capability, transfers no context, takes no acknowledgment and needs no fresh approval. It does not check for unsettled or UNKNOWN attempts, and it accepts any old agent on the first record.

Adding an entry point would take:

  • a normative requirement in HC-12 and a new command in the wire Command union, under the codec’s versioning rules;
  • a dispatch path that runs the assigned agent, since no dispatch path reads the record today;
  • the checks ACTIVATE_REPLACEMENT makes: exact human approval, independent capability verification, a settled boundary with no unresolved attempt, a handoff the successor acknowledges, and a fresh approval before dispatch;
  • a comparison of the old agent with the agent really assigned, including on the first record;
  • a control route that makes a narrow service call, requires recent human verification and a permission of its own, takes the actor from the verified session, and refuses a rule, an agent or a CLI session;
  • a storage operation with its operationClock row, in place of the direct repository call;
  • the same action in the CLI and the web view.

Cancellation may enter CANCEL_PENDING immediately, but it cannot become final while the work order still owns DISPATCH_AUTHORIZED or UNKNOWN material responsibility.

This keeps cancellation truthful: “cancel requested” is different from “all material work is safely settled.”

A running engine cannot finish a pending cancellation. A CANCEL_PENDING work order stays CANCEL_PENDING after its work has settled: no control route, host path, runner method or storage operation moves it to CANCELED. The operator view keeps listing CANCELLATION_SETTLEMENT, the run stays in the active run list, and praxis follow says the cancellation stays pending. New dispatch stays blocked throughout, so the limit costs closure, not safety.

ControlHandoffRepository finalizeCancel is the step itself: it requires a human actor, refuses UNRESOLVED_RESPONSIBILITY while an attempt is DISPATCH_AUTHORIZED or UNKNOWN, and records the decision. It exists only as a repository method that tests call on a connection of their own.

WO-07 and HC-04 limit when closure may happen; neither requires a host to offer a way to close. HC-12’s command list and the wire Command union name none. Adding an entry point would take:

  • a normative requirement in HC-12 and a new command in the wire Command union, under the codec’s versioning rules;
  • a control route that makes a narrow service call, requires recent human verification and the inspect permission beside its own, and takes an expected revision and a durable receipt like cancel;
  • a storage operation with its operationClock row, in place of the direct repository call;
  • a settlement check as wide as WO-07, since finalizeCancel reads only dispatch attempts: active claims, owned runs, child work orders and a recorded reconciliation owner are unchecked;
  • the same command in the CLI and the web view.

An UNKNOWN attempt is resolved only by reconciliation or a human decision, and a running engine does that through RECONCILE_CODING. It takes a verified human, an approval for the exact review and the host’s independent proof, then settles the attempt and returns the run to approval. A host offers it through the opt-in dynamic control profile with its own verifier, and it works only on a run bound with BIND_CODING before its first dispatch. BIND_CODING refuses a run that has attempts, so a run that reached UNKNOWN unbound cannot be reconciled this way: RECONCILE_CODING answers it BINDING_REQUIRED. Until all of this holds, the attempt stays UNKNOWN and the run stays held.

A running engine cannot record a separate human reconciliation decision. No control route, host path, runner method, CLI command or storage operation does it.

ControlHandoffRepository recordReconciliationDecision exists only as a repository method tests call. It refuses a caller whose stated actor kind is not HUMAN and appends a RETRY_AFTER_RECONCILIATION row to human_decisions. Nothing acts on that row, and the only read that returns it is ControlHandoffRepository snapshot, which no running engine calls. So it resolves nothing: the hold stays open, the attempt stays UNKNOWN, its reservation stays whole, and RECONCILE_CODING still needs everything it needed before.

Nothing requires an entry point: HC-07 limits how UNKNOWN is resolved and RECONCILE_CODING meets it, HC-12 and the wire Command union name no such command, and no conformance case or scenario asks for one. The method also could not be exposed as it stands. It takes no proof, and it checks for no UNKNOWN attempt, no hold and no work order, so a route would report a decision that retries nothing.

Adding an entry point would take:

  • a normative requirement in HC-07 or HC-12 and a new command in the wire Command union, under the codec’s versioning rules, or a defined resolveHold with RECONCILE, which this engine refuses today;
  • a defined effect: what the decision resolves, and a reader that acts on it, since nothing acts on the record today;
  • the checks RECONCILE_CODING makes: an open hold and an unresolved attempt on the named run, exact human approval of a review, and the host’s proof of cessation and effects, because human approval alone does not establish effect safety;
  • a control route that makes a narrow service call, requires recent human verification, the inspect permission and a permission of its own, takes the actor from the verified session, and refuses a rule, an agent or a CLI session;
  • a storage operation with its operationClock row, in place of the direct repository call;
  • the same action in the CLI and the web view.

M5 handoffs connect the major coding stages:

planning -> implementation -> validation -> correction

A handoff records:

  • work-order and run identity;
  • producer task and consumer task;
  • stage;
  • immutable artifact reference;
  • artifact digest;
  • a non-authoritative summary;
  • acknowledgement and consumption state.

The durable lifecycle of a coding run’s stage handoff is:

PENDING -> ACKNOWLEDGED -> CONSUMED

Acknowledgement means the intended consumer has durably received the handoff. It does not mean the consumer’s work succeeded or was accepted. One write acknowledges a handoff and records its consumer, so it never sits CLAIMED. Dispatch checks the status, consumer task and digest, and consumes the handoff in its own transaction. A superseded or abandoned handoff becomes CANCELED.

A running engine cannot create, claim, acknowledge or consume a generic handoff: no control route, host path, runner method, CLI command or storage operation does it. ControlHandoffRepository createHandoff, claimHandoff, acknowledgeHandoff and consumeHandoff are repository methods that only tests call, and they release no work. Nothing requires an entry point, and the methods could not be exposed as they stand. The conformance review gives the reasoning and what an entry point would take.

What survives pause, resume, or replacement

Section titled “What survives pause, resume, or replacement”

Control changes do not reset:

  • cost or active-time usage;
  • attempt counts;
  • protected handoff usage;
  • approval expiry/history;
  • dispatch responsibility;
  • validation evidence;
  • correction history;
  • consumed handoffs.

This is critical for resumability: a new worker or agent continues the same governed mission rather than receiving a fresh budget or authority window.

The control and handoff tests verify durable pause/resume, the database-level pause-vs-dispatch race, cancellation blocked by unresolved responsibility, a revisioned agent assignment at the repository that refuses a stated non-human actor kind, a restart-safe generic handoff lifecycle at the repository, and a human reconciliation decision record at the repository that refuses a stated non-human actor kind, is append-only and resolves nothing.

The next step is to compose the implemented primitives into the first complete coding workflow:

plan
-> human approval
-> implementation
-> handoff
-> validation
-> correction when needed
-> revalidation
-> acceptance

After that workflow works end to end, M5 still requires a restart/conformance closure pass that interrupts it at critical boundaries and proves recovery without duplicate material effects, lost responsibility, or stale approvals.

The governed coding workflow now connects these primitives into real approval, implementation, validation, correction and acceptance. Its source suite includes a real coordinator-termination/restart test. Earlier counts and next-step descriptions on this page record the original component delivery; M5 still needs broader interface and conformance integration.