Skip to content

Task Envelopes ​

A delegated task travels as a task envelope: a typed contract that states what is being asked, what would prove it was done, and which files the recipient owns while doing it. The envelope exists because a message body alone never says what "done" means — the sender knows, the recipient guesses, and nothing checks.

What an envelope must carry ​

A task is refused before a thread is opened unless every one of these is present:

FieldWhat it settles
objectiveWhat is being asked for.
outputFormatThe shape the result must arrive in.
toolAndSourceGuidanceWhich tools and sources the work should draw on.
boundariesWhat the recipient must not do.
filesAndInterfacesThe files and interfaces the recipient owns for this task.
acceptanceCheck.passFailCommandAn executable command whose exit decides pass or fail.
acceptanceCheck.endToEndVerificationThe step proving the result works in context.
contextIDThe context the task belongs to.

Each missing field is reported as its own named error — objective_required, acceptance_check_command_required, and so on — rather than one generic "malformed task", so a caller is told which part of the contract it left out.

Owned files are how two agents avoid editing the same thing ​

filesAndInterfaces names the set the recipient owns for the duration of the task. Two agents working the same file is resolved by declaring that ownership up front, in the task, rather than by arbitrating writes afterwards.

Requested tools are a request, never a grant ​

toolsAllowed is request-shaped. Before the task reaches the recipient, NEXUS checks it against what the recipient is already allowed to do, so an envelope can only ever narrow what the recipient already had — it can never widen it, and an empty request never acquires tools. An inter-agent message stays untrusted input.

Dependencies ​

dependsOn holds opaque task ids. A task is not claimable until they resolve. A task that depends on itself, or that repeats the same dependency twice, is refused.

Deliverables and proof are separate from the message ​

artifacts carries deliverables as named references — a name and a location — rather than folding them into the message text. evidence records what actually proved the work: the acceptance command that ran, its output and exit status, the end-to-end verification, and whether the verdict came from an executable script or an LLM judge. Where an independent second opinion ran in a fresh context, its result is recorded alongside.

The lifecycle has final states ​

A task starts at submitted and moves only along permitted edges:

  • submitted → working, failed, canceled, or rejected
  • working → input_required, auth_required, completed, failed, or canceled
  • input_required and auth_required → back to working, or to failed or canceled

completed, failed, canceled, and rejected are terminal: they have no outgoing edges, so a finished task cannot be quietly reopened. On the wire the states are written TASK_STATE_SUBMITTED, TASK_STATE_WORKING, TASK_STATE_INPUT_REQUIRED, and so on.

Answering, declining, and completion ​

The recipient reads the task with agent_inbox and answers with agent_reply on its threadId, optionally with a state of TASK_STATE_COMPLETED (the default), TASK_STATE_FAILED or TASK_STATE_CANCELED, and artifacts (each a name and a location). A recipient that cannot or will not do the work declines it with agent_reject and a mandatory reason; the sender gets a terminal rejected state on the same thread.

Completion is evidence-bearing. A task cannot enter completed on an assertion alone. When the recipient answers with TASK_STATE_COMPLETED, NEXUS asks for verification:

  • NEXUS runs the passFailCommand only when the person at the keyboard wrote the task. A command another agent wrote is never executed by NEXUS; verification reports peer_authored_acceptance_check, and the recipient may run its own checks in its own session.
  • An independent fresh-context check runs only when AI execution is available to your account.

When verification cannot pass, the answer is still delivered to the sender, the task stays in TASK_STATE_INPUT_REQUIRED, and the agent_reply result's verification field names the reason.

Where to go next ​

Built with purpose. chainabit.com