Prompt Details
Model
(claude-5-5-sonnet)
Token size
1,243
Example input
[WORKFLOW_AND_HANDOFF_EVIDENCE]: Research agent A owns tenant-a task T-18 at epoch 4. It offers the task to reviewer B, which sends acceptance. A result from A may arrive after B becomes owner. The coordinator persists ownership in one task record. No message may change production systems; the task produces a review artifact.
[OWNERSHIP_AND_AUTHORITY_CONSTRAINTS]: Only the coordinator can commit a transfer. A remains accountable until durable commit. Result acceptance must match the current owner and epoch. Pending external effects must be resolved before transfer. Numeric deadlines and storage transaction tests are not supplied. Cancellation is a request until a terminal cancellation outcome is committed.
Example output
# Handoff & Ownership Contract Pack: T-18
Labels: **SUPPLIED** (from W-1/P-1), **PROPOSED** (my design), **UNKNOWN**. "H-1" is a local alias for the handoff ID. The preferences text about LLM prompt modules is unrelated, so I did not use it.
## 1. Ownership decision
**Scope.** Task T-18 (tenant-a) produces a review artifact. No message may change production systems. SUPPLIED.
**Current ownership.** A is owner and accountable at epoch 4. B has accepted an offer. A may send a result after B becomes owner. The coordinator persists ownership in a single task record, and only it can commit a transfer. SUPPLIED.
**Proposed model.**
- One owner and one commit authority per task (the coordinator). A and B are workers or owners, not commit authorities.
- A remains accountable until the durable commit.
- Epoch advances only at commit (4→5).
- The record carries a version counter. Every transition is a conditional write on `(owner, epoch, state, version)`, assuming the store provides compare-and-set (CAS).
- The result/artifact intake boundary must check `(owner, epoch)` itself. An epoch inside a message does nothing unless the recipient enforces it.
**Unknowns that block final approval.**
- The "named accepting authority" for terminal completion is not supplied. It cannot default to the submitting owner.
- Storage CAS and atomicity guarantees are untested.
- The numeric deadlines (offer expiry, owner-silence reassignment) are not supplied.
- The inventory of "external effects" is not supplied. Production writes are excluded, but other effects (artifact writes, notifications) may exist.
- Who may request cancellation is not supplied.
- The cancel-versus-submitted-result policy needs sign-off (see section 3).
## 2. Handoff contract
**Boundaries.**
- Message content (artifact references, notes) is data. Authority comes only from the coordinator record.
- No secrets, no chain-of-thought, no inherited permissions. B receives only the listed scope.
- Transport receipt, offer delivery, acceptance, commit and business acceptance are five distinct facts.
- Only the commit transfers responsibility.
```json
{
"handoff_id": "H-1",
"id_note": "local alias; real ID not supplied",
"task_id": "T-18",
"tenant_id": "tenant-a",
"current_owner": "A",
"proposed_receiver": "B",
"expected_epoch": 4,
"epoch_on_commit": 5,
"purpose": "Reviewer B takes over review of the T-18 artifact",
"evidence_refs": ["W-1", "P-1", "artifact_ref: UNKNOWN"],
"unresolved_work": ["UNKNOWN: A to enumerate before offer"],
"pending_external_effects": "must be zero or RECONCILED before commit; inventory UNKNOWN",
"allowed_scope": ["read evidence_refs", "produce review artifact"],
"forbidden_scope": ["production writes", "re-delegation", "cancellation commit"],
"completion_predicate": "review artifact submitted at current (owner, epoch) and committed by the accepting authority",
"accepting_authority": "UNKNOWN",
"approval_ref": "not applicable (none supplied or required by P-1)",
"offer_expiry": "UNKNOWN: policy value required",
"commit_authority": "coordinator",
"record_version_at_offer": "set by coordinator"
}
```
## 3. Transition and recovery table
All transitions are serialized conditional writes on the task record. Arrival time never decides an outcome.
| State | Event | Actor | Preconditions | Result (state/owner/epoch) | Duplicate response |
|---|---|---|---|---|---|
| ACTIVE (A, 4) | offer H-1 | A | A is owner at epoch 4; no open offer; no cancel requested | OFFERED (A, 4) | Same H-1 returns the existing offer |
| OFFERED | reject | B | H-1 open | ACTIVE (A, 4); H-1 REJECTED | Return REJECTED |
| OFFERED | accept | B | H-1 open and not expired | ACCEPTED_UNCOMMITTED (A, 4) | Return the current handoff state |
| ACCEPTED_UNCOMMITTED | commit | coordinator | CAS matches (A, 4, H-1); effects reconciled; no cancel requested | ACTIVE (B, 5) | Return the committed result without re-incrementing |
| ACCEPTED_UNCOMMITTED | commit blocked | coordinator | Unresolved effect, or cancel requested | Remains (A, 4); `TRANSFER_BLOCKED(reason)` | Same reason |
| OFFERED / ACCEPTED_UNCOMMITTED | offer expiry | coordinator | Policy timeout exists and has elapsed | ACTIVE (A, 4); H-1 EXPIRED | Late accept returns EXPIRED |
| ACTIVE | result | current owner | (owner, epoch) matches the record | RESULT_SUBMITTED | Idempotent by result ID |
| any non-terminal | result | non-owner or old epoch | none | No state change; result stored as STALE_QUARANTINED, not committed | Same |
| RESULT_SUBMITTED | complete | accepting authority | (owner, epoch) match; no cancel committed | COMPLETED (terminal) | Return COMPLETED |
| non-terminal | cancel request | requester | Requester authorized (UNKNOWN) | `cancel_requested=true`; transfers frozen | Return the flag |
| cancel requested | cancel commit | coordinator | No terminal outcome; effects reconciled | CANCELLED (terminal) | Return CANCELLED |
| terminal | any | any | none | No change | Return the terminal state |
**Rules.**
- A cancel request is not cancellation success.
- A result or acceptance arriving while cancel is requested is recorded, not applied. The submitted result is kept as evidence.
- **PROPOSED, policy approval needed:** if cancel is recorded before a completion commit, the coordinator commits CANCELLED. If COMPLETED committed first, the cancel request is answered "too late." The first terminal commit wins.
- An unresolved external effect blocks CANCELLED or COMPLETED as a clean outcome and routes to reconciliation.
**Recovery.**
- If the commit acknowledgement is lost, A and B query the authoritative record by `handoff_id`. Agent self-reports are not evidence.
- A commit retry is idempotent.
- If A disappears before commit, A stays accountable. There is no automatic reassignment until a policy value exists.
- If B disappears after commit, the coordinator opens a new handoff (epoch 6) under the same effect-reconciliation guard.
- Reassignment policy needs two inputs before automation. The measurement is the distribution of acknowledgement and heartbeat latency. The approver is a named policy owner (UNKNOWN).
## 4. Scenario fixtures
**Status: DESIGNED — NOT EXECUTED.**
**F1 Normal transfer (successful work).**
- Initial: ACTIVE (A, 4).
- Events: offer; B accepts; coordinator commits; B submits a result at epoch 5; accepting authority completes.
- Expected: COMPLETED, owner B, epoch 5.
- Effects: the artifact is recorded; no production writes.
- Oracle: commit succeeded exactly once and the epoch-5 result was accepted. An always-reject build fails this.
**F2 Accepted but not committed.**
- Initial: ACCEPTED_UNCOMMITTED (A, 4).
- Events: B submits a result; A submits a result.
- Expected: B's result is not committed (B is not yet owner). A's result is recorded as submitted.
- Oracle: owner A, epoch 4, no epoch change.
**F3 Duplicate commit.**
- Initial: ACCEPTED_UNCOMMITTED.
- Events: commit; commit retry; duplicate B acceptance.
- Expected: owner B, epoch 5 (not 6).
- Oracle: one epoch increment and one transfer event in the audit log.
**F4 Late old-owner result (successful work).**
- Initial: ACTIVE (B, 5) after F1's commit.
- Events: A's epoch-4 result arrives; then B's epoch-5 result arrives; the accepting authority completes.
- Expected: A's result is STALE_QUARANTINED; B's result is accepted; COMPLETED.
- Oracle: the intake boundary rejects epoch 4, with the check enforced at the recipient.
**F5 Cancellation versus completion, both orders.**
- 5a: Cancel request recorded first, then result. Expected CANCELLED under the proposed policy. The result is retained as evidence and does not complete the task.
- 5b: COMPLETED committed first, then cancel request. Expected: the request returns "too late" and the terminal state is unchanged.
- Oracle: exactly one terminal state in each order, decided by record version.
**F6 Unsafe transfer with an unresolved effect.**
- Initial: ACCEPTED_UNCOMMITTED, A has a pending effect E1.
- Event: commit attempt.
- Expected: `TRANSFER_BLOCKED(unresolved_effect)`. Owner A, epoch 4. Never ownerless.
- Oracle: commit succeeds only after E1 is RECONCILED. A new epoch does not undo E1.
**Trace fields:** `trace_id, task_id, tenant_id, handoff_id, event_id, actor, record_version, epoch_before, epoch_after, approval_ref, effect_ledger_status, outcome, terminal_outcome`.
**Uncovered branches:** simultaneous cancel and transfer commit; coordinator crash mid-commit; multiple open offers; B rejecting after A's cancel.
## 5. Handoff & Ownership Contract Pack
- **Commit point:** the coordinator's successful CAS on (owner, epoch, handoff_id). It has not been tested.
- **Old-owner rejection:** the result intake compares (owner, epoch) with the current record and rejects any mismatch. A message-level epoch alone is ineffective.
- **Cancellation rule:** a request only sets a flag and freezes transfers. Only the coordinator's terminal commit cancels, and the first terminal commit wins.
- **Enforcement points:**
- Coordinator record: CAS.
- Result/artifact intake: epoch check.
- Effect ledger: reconcile before commit, if one exists.
- **First slice:** task record with version, offer/accept/commit CAS, epoch-checked result intake, and idempotent responses.
- **First test:** F4 (late old-owner result), followed by F1.
- **Unresolved policies:**
- Accepting authority.
- Cancel authorization and the cancel-versus-result policy.
- Offer-expiry and reassignment timeouts.
- Effect inventory.
- Storage CAS and atomicity evidence.
- **Race status:** no race is solved until storage, recipient enforcement and effect behavior have matching test evidence.
**Status: DRAFT FOR REVIEW.** Blockers: the accepting authority and the storage evidence.
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-5-SONNET
Turn an agent workflow into an explicit Handoff & Ownership Contract Pack. Define acceptance versus ownership transfer, required context, task-state transitions, stale-result handling, cancellation races and recovery. Get concrete scenario fixtures and implementation boundaries so your team can review who may act—and when responsibility actually changes.
...more
Added 6 hours ago
