handoff-protocol / references /adapter-contracts.md
LucioLiu's picture
Initial release - mirrors github.com/LucioLiu/handoff-protocol
f24bcdf verified
|
Raw
History Blame Contribute Delete
4.62 kB

English | 简体中文

Adapter capability contracts

These are discovery contracts. No implementation is bundled.

Capability Required input Required receipt Honest absence behavior
agent.registry.read role/capability query, policy scope candidates plus source revision produce a packet for manual delivery; do not invent a recipient
agent.spawn recipient ID and validated bounded_subagent packet dispatch ID, recipient ID, timestamp, requested/effective mode mark packet undelivered
agent.task.create recipient ID and validated independent_task packet dispatch ID, separately resumable task/thread ID, recipient ID, timestamp, authoritative workspace receipt leave undelivered, or explicitly degrade only when the packet allows it and continuity is not required
agent.message live dispatch ID and follow-up packet message ID and timestamp state that no follow-up mechanism was available
workspace.authoritative.resolve stable root ID and task context resolved real path plus resolution evidence require a parent-supplied root and verify it from the parent filesystem; never substitute the current cwd
collaboration.log.append structured event with redacted refs exit code zero, event ID, append position/version omit shared append; do not claim atomic logging
agent.inbox.deliver recipient ID and directed message delivery ID and destination ref keep a copyable message and mark it undelivered

Adapters may map these contracts to a specific Harness, but must not:

  • promote optional capabilities to bundled features;
  • alter safety or routing policy;
  • expose secret values in packets or receipts;
  • report sent, spawned, followed_up, or appended without provider evidence.

Provider-specific metadata belongs under a namespaced receipt field and must not replace the required evidence. Validate neutral packet and receipt fields against ../contracts/.

For a v1.3 durable chain, the validated handoff packet supplies handoff_id and its persistence contract supplies contract_id. The dispatch adapter adds its real dispatch_id. Every downstream return, closure receipt, and parent verification repeats all three IDs. Reject a receipt when any ID belongs to a different task, even when its fields and artifact paths otherwise look valid. IDs are correlation labels, so each required target also carries a fresh dispatcher-issued evidence_nonce. The adapter or parent combines it with the real dispatch_id to produce the target's evidence_anchor. The file, provider event, or board proposal must carry that anchor; the parent derives it again from the saved dispatch receipt and contract instead of trusting child-supplied labels alone.

Represent honest non-delivery with the undelivered branch in dispatch-receipt.schema.json; it requires a reason and forbids invented dispatch/task IDs or provider receipts.

agent.task.create means an independently identifiable, resumable task or thread. A nested child that can only return to its parent does not satisfy this contract. An adapter may report a degradation receipt only when it contains both modes and a concrete reason.

Persistence does not choose the adapter. A bounded_subagent packet may carry a required persistence contract and complete all four durable targets through agent.spawn; that still remains bounded. Only a real, separately resumable task/thread receipt from agent.task.create establishes independent_task.

For independent_task, compare the adapter's workspace receipt with the persistence contract field by field: root ID, normalized resolved path, and resolution evidence. Also compare a v1.3 return's declared mode with the dispatch receipt's effective mode. A correct ID set does not excuse either mismatch.

The selected log provider owns its atomicity guarantee. A thrown error, timeout, missing receipt, malformed receipt, or nonzero exit means append failure. Do not manufacture an event ID after failure.

The central board is not an append adapter. Configure one writer (normally the parent/coordinator); children send proposals through their return packet. The single writer serializes updates and re-reads the board after every merge.


Both language editions are maintained in sync. If they ever diverge, the English edition is authoritative — please open an issue if you spot one.