Self-Contained Question

Nothing burns a returning human's time faster than a vague ping like "The new version is friendlier and clearer — can we send it?" — no preview attached, no alternatives spelled out, and three follow-up messages after the agent restarted. Answering it forces you to excavate half an hour of logs just to learn what is actually being asked.

Self-Contained Question makes every ask a structured record that the hub checks for completeness before anyone ever sees it. One card carries the question, plain context, concrete options with outcomes, a reasoned recommendation, what work is waiting, a safe fallback if no answer arrives — and the actual artifact itself whenever looks or behavior decide.

Group Human in the loop
Also known as User Task, Human Task, Approval Request
Core rule Enforce completeness and deduplication in the hub; show the work itself
Defines records Question

Why chat-style questions fail an asynchronous human

An agent writes a question from deep inside its own context window, surrounded by the files, drafts, and assumptions it just read. The human arrives hours later with zero of that context — often after the question was escalated through a lead agent who never saw the original thread either.

When a worker writes "The new payment-failed email is friendlier — OK to ship?" and repeats it twice after restarting, three failures stack up. First, the human has to scroll through history just to reconstruct the choice. Second, one missing decision arrives as three separate pings. Third, describing copy or layout in adjectives instead of showing the actual email invites a hurried "OK" — followed days later by a customer complaint and a reopened job.

Self-Contained Question eliminates all three failures inside the hub rather than hoping agents write better prose:

  1. Completeness is enforced at admission. Every question passes through a deterministic completeness check in the hub. A vague ask is refused immediately with the exact list of missing parts; the answerer never sees a half-baked prompt.
  2. When looks or behavior decide, exhibits are mandatory. Setting needs_exhibit = true requires concrete attachments (rendered images, videos, live links, diffs, or verbatim text) for every option so the human judges the thing itself.
  3. One missing decision equals one versioned card. The asker tags the decision with a stable decision_key. If the worker restarts and asks again, the hub folds the repeat into a revision of the existing open question (version + 1), never creating a duplicate card.

Why force the asker to commit to a recommendation and a safe fallback? Thinking through the outcomes and writing a concrete recommendation often reveals that the agent can settle the matter itself — preventing unnecessary questions altogether. And naming a safe if_unanswered default ensures a missed deadline never leaves work hanging or ships an unapproved risky change.

Vague chat pings "New email is friendlier — send?" No preview, no options, no fallback Repeats 3x after restarts One decision spawns 3 separate pings Requester guesses "OK" Too busy to dig through agent logs Flaw ships; job reopens Missing subject amount spotted too late Self-Contained Question Hub completeness gate Refuses vague asks; dedupes by key One card with both exhibits Options, recommendation, effort, fallback Requester inspects actual copy Answers cold in 2 min without logs Better call before shipping "Use new email + add $49 in subject"
Vague, repeated chat pings force the requester either to dig through logs or rubber-stamp blindly. A Self-Contained Question verified by the hub renders one complete decision card with exhibits so the requester gives an informed answer in minutes.

Architecture and participants

The pattern centers on one durable record — Question — and one hub admission gate — the Completeness Check. Workers never message answerers directly: every draft question passes through the hub, which refuses incomplete drafts, folds repeats by decision_key, and draws the answerer's Question Card exclusively from the stored record.

Worker (Asker) Asks, revises, withdraws Lead agent Answers or passes on Requester Reads card & answers refused Hub admission gate & durable store Completeness Check Checks parts + exhibits Dedupes decision_key Question (v1, v2...) Context, options, exhibits Effort, blocked, fallback Job Work held up Rendered Question Card (drawn solely from Question) Side-by-side exhibits · recommendation · blocked work · fallback Solid arrow = submit or store · Red dashed = refused draft · Dashed = derived card rendered to answerer
Every ask goes through the hub's Completeness Check before storage. Incomplete drafts bounce back to the asker with explicit missing-part codes; complete asks store or revise a single Question record from which the card is drawn.
Asker (Worker)
Authors the structured question with options, recommendation, exhibits, effort estimate, and fallback; revises it if facts change; withdraws it when the need disappears.
Hub & Completeness Check
Validates required fields by kind and needs_exhibit, deduplicates retries via decision_key, rejects answers against stale versions, draws the card from the record alone, and expires overdue questions at answer_by.
Lead agent
Receives worker questions first, answers within its delegated authority, escalates the same record to the requester when needed, and withdraws obsolete questions if scope changes.
Answerer (Requester)
Reads one self-contained card at check-in (or on interrupt) and picks an option or writes a custom reply without opening the underlying conversation.
Question Card (derived)
Rendered strictly from the stored Question row — showing effort time, rendered exhibits side by side, recommendation, blocked work, and fallback behavior.

Execution flow

Toggle between the normal path — where a complete question passes the gate and lets the requester answer from one card — and the failure path — where the hub refuses a vague draft, folds a post-crash retry into version 2, and removes the card cleanly when a scope change causes the lead agent to withdraw it.

Requester Hub Lead agent Workers 1. Submit complete Q (options + both exhibits) 2. Completeness check passes No open decision_key match -> store v1 3. Deliver Question v1 to Lead agent 4. Pass same Q on (answerer_id = Requester) 5. Render card at check-in with both emails 6. Inspects exhibits directly Spots missing $49 in subject line 7. Answer v1: New email + $49 in subject 8. Deliver answer; Worker 1 updates email

Because the question carries both rendered emails, options, recommendation, and effort estimate, the lead agent can pass it untouched to the requester — who sees the exact copy on one card and requests a subject-line tweak before anything ships.

Version guard on replies: Every answer names the version of the card the human read. If the question was revised while the human was typing, the hub rejects the reply with stale_question_version and shows the updated card first.

Concrete examples

Self-Contained Question applies whenever a human must make a judgment call asynchronously — from customer copy and pricing choices to API design tradeoffs.

Example 1 — Payment-failed customer email wording

No code or unit tests
Ask & exhibits
Worker 1 rewrites Acme's failed-payment notice. Because customer wording is judged by reading it, needs_exhibit is true and both the current email and new email are attached as rendered exhibits side by side.
Card contents
Effort: 2 minutes. Recommendation: New email — explains the $49.00 decline on card 4242 and gives a direct "Update your card" button. Blocked work: Only the email job waits; the rest of Thursday's release proceeds. Fallback (if_unanswered): On Thursday at 9:00 a.m., ship with the current email and close this question.
Outcome
At her Tuesday check-in, Dana reads the rendered email directly on the card — without opening any chat thread — and replies: "Use the new email, and put the dollar amount in the subject line." Seeing the real artifact prevented a post-release reopen.

Example 2 — Public API pagination default decision

Simple API change
Ask & exhibits
Worker 1 needs a call on decision_key = "orders-page-size": lower /v2/orders default page size from 100 to 50, or keep 100 while adding a hard limit <= 200 cap. Each option attaches a verbatim JSON response diff exhibit.
Crash retry
Worker 1's container restarts overnight and re-asks the same decision_key under a new generated ID. The hub folds it into version = 2 of the existing open card, keeping its original id and opened_at so Dana still sees one card.
Fallback
Effort: 3 minutes. Recommendation: Keep default 100 with a 200 cap to preserve backward compatibility. Fallback: Keep default 100 at Friday's 5:00 p.m. release freeze.

What this pattern is NOT — Live chat back-and-forth or policy-settled rules

Negative example
Scenario
Asking a quick clarifying question during an active live chat session with one agent, or asking a human to re-approve a choice already covered by a standing rule.
Why skip it
In a live turn-by-turn conversation, the human already holds full context — requiring effort estimates and fallback clauses adds needless friction. And if a stored record or Delegation Policy already decides the choice, nobody should be asked at all.

When to use and when to skip

Use Self-Contained Question when

  • The answerer is away when the question is written and reads it cold later among other work.
  • Questions can be escalated across agents, so the final answerer never saw the originating thread.
  • Agents restart or lose context and risk asking the same missing decision multiple times.
  • Decisions depend on how copy, layouts, visuals, diffs, or live behavior actually look.

Skip it when

  • One person is pairing synchronously with one agent in a live conversation.
  • A standing Delegation Policy or existing hub record already settles the question.
  • You only need to control notification timing — pair with Question Inbox for check-in batching and interrupt rules.

Data model and hub invariants

Self-Contained Question defines the canonical questions table used across the catalog. It references requests and parties (from Orchestrator-Workers), jobs (from Durable Job), and interrupt_rules (from Question Inbox). The human's reply is stored separately in answers (defined by Tracked Answer).

Request PK id title Job PK id FK request_id Question (25 fields) PK id · version · state FK request_id FK asker_id? · answerer_id kind · decision_key decision_class? FK job_id? FK interrupt_rule_id? text · context options[] · recommended_* needs_exhibit · exhibits[] effort_min · blocked_work if_unanswered · answer_by? opened_at · closed_at? closed_reason? Party PK id kind · name InterruptRule PK id name · kind 1 n 1? n 1 n 1? n Unique open (req, job, key)
Every Question belongs to one Request, optionally blocks one Job, names one current answerer_id (and optional asker_id when not hub-opened), and optionally cites the InterruptRule that paged the requester.

Table: questions

Column Postgres type Nullability Notes
id uuid NOT NULL, PK Stable question identifier preserved across revisions and escalations.
request_id uuid NOT NULL, FK References requests(id).
job_id uuid NULLABLE, FK References jobs(id); empty only for pre-split request-level questions.
kind text NOT NULL CHECK (kind IN ('decision', 'fact', 'action', 'review', 'reassignment')); drives required parts.
asker_id uuid NULLABLE, FK References parties(id); NULL when opened by the hub itself.
answerer_id uuid NOT NULL, FK References parties(id); mutated in place when escalated.
text text NOT NULL What is needed from the answerer in one clear sentence.
context text NOT NULL Plain-English background referring to nothing outside this card.
options jsonb NOT NULL Array of {id, label, outcome}; empty list allowed for non-choice kinds, >= 2 for decision/review.
recommended_option text NULLABLE Must match an option.id whenever options is non-empty.
recommendation_reason text NULLABLE One-sentence rationale for recommended_option; required whenever options exist.
needs_exhibit boolean NOT NULL true when the decision depends on how an artifact looks, sounds, or behaves.
exhibits jsonb NOT NULL Array of {kind, location, caption, option?} where kind is image | video | live_link | diff | text.
effort_minutes integer NOT NULL Positive integer estimating how many minutes answering takes.
blocked_work text NOT NULL Names what is blocked on this answer and what continues without it.
if_unanswered text NOT NULL Safe default action taken if no answer arrives by answer_by.
answer_by timestamptz NULLABLE Deadline when the hub expires the question and the fallback runs; NULL means wait indefinitely.
decision_key text NOT NULL Asker-chosen slug (e.g., payment-email-wording) used to fold retries into revisions.
decision_class text NULLABLE Policy action code (e.g., merge_pull_request) matched by Escalation Chain.
version integer NOT NULL Starts at 1; increments by 1 on every revision.
interrupt_rule_id uuid NULLABLE, FK References interrupt_rules(id) when the question interrupted between check-ins.
state text NOT NULL CHECK (state IN ('open', 'answered', 'withdrawn', 'expired')).
opened_at timestamptz NOT NULL First stored timestamp; preserved across revisions and escalations.
closed_at timestamptz NULLABLE Set when state transitions to withdrawn or expired.
closed_reason text NULLABLE One-sentence explanation required when withdrawn or expired.

Seven hub invariants

  1. 01
    Every question names its request, same-request job, and one answerer Database constraint

    request_id and answerer_id are NOT NULL foreign keys, and a composite foreign key (request_id, job_id) references jobs(request_id, id) whenever job_id is present.

  2. 02
    At most one open question per decision key Database constraint

    A partial unique index on (request_id, COALESCE(job_id, '00000000-0000-0000-0000-000000000000'::uuid), decision_key) WHERE state = 'open' structurally prevents duplicate open cards for the same missing decision.

  3. 03
    Closing timestamp and reason match withdrawn or expired state Database constraint

    A row-level CHECK ((state IN ('withdrawn', 'expired')) = (closed_at IS NOT NULL AND closed_reason IS NOT NULL)) ensures every closed-without-answer card records why and when it closed.

  4. 04
    Completeness gate refuses drafts lacking required parts Hub guard

    ask validates context, positive effort_minutes, blocked_work, if_unanswered, at least two options for decision/review (and never exactly one option), plus a valid recommended_option and recommendation_reason whenever options are present — refusing gaps with incomplete_question and the exact missing part list.

  5. 05
    Visual or behavioral choices require exhibits per option Hub guard

    When needs_exhibit is true, every option must have an exhibit naming its option id (or at least one exhibit when optionless); otherwise exhibits is reported in the incomplete_question refusal.

  6. 06
    Retries revise in place, and answers bind to the exact version Hub guard

    A complete ask matching an open decision_key keeps the original id, answerer_id, and opened_at while bumping version. Submitting an answer against an older revision is rejected with stale_question_version.

  7. 07
    Terminal states never reopen; expiry waits for answer_by Hub guard

    Once a question leaves open, further mutations fail with question_not_open. Only the hub may call expire, and calling it before answer_by (or when answer_by is empty) fails with deadline_not_reached.

Reference implementation

The same hub completeness check, decision_key revision upsert, version-checked answer guard, withdrawal, and deadline expiry in TypeScript, Python, and Elixir.

-- Completeness check, decision_key revision upsert, and lifecycle guards

inductive QuestionKind where
  | decision | fact | action | review | reassignment
  deriving Repr, BEq

-- «open» escapes the keyword `open`; elsewhere it is written `.open`
inductive QuestionState where
  | «open» | answered | withdrawn | expired
  deriving Repr, BEq

inductive ExhibitKind where
  | image | video | liveLink | diff | text
  deriving Repr, BEq

structure QuestionOption where
  id : String
  label : String
  outcome : String
  deriving Repr

structure Exhibit where
  kind : ExhibitKind
  location : String
  caption : String
  option : Option String := none
  deriving Repr

structure Question where
  id : String
  requestId : String
  jobId : Option String := none
  kind : QuestionKind
  answererId : String
  text : String
  context : String := ""
  options : List QuestionOption := []
  recommendedOption : Option String := none
  recommendationReason : Option String := none
  needsExhibit : Bool := false
  exhibits : List Exhibit := []
  effortMinutes : Int := 0
  blockedWork : String := ""
  ifUnanswered : String := ""
  answerBy : Option Nat := none
  decisionKey : String
  version : Nat := 1
  state : QuestionState := .open
  openedAt : Nat
  closedAt : Option Nat := none
  closedReason : Option String := none
  deriving Repr

inductive HubError where
  | incompleteQuestion (missing : List String)
  | staleQuestionVersion | deadlineNotReached | unknownQuestion | questionNotOpen
  deriving Repr, BEq

def blank (v : Option String) : Bool :=
  match v with
  | some s => s.trimAscii.isEmpty
  | none => true

def missingParts (q : Question) : List String :=
  let needsChoices := q.kind == .decision || q.kind == .review
  let n := q.options.length
  let validRec := q.options.any (some ·.id == q.recommendedOption) && !blank q.recommendationReason
  let shown :=
    if q.options.isEmpty then !q.exhibits.isEmpty
    else q.options.all fun o => q.exhibits.any (·.option == some o.id)
  -- Each part paired with "is it missing?"; keep the names of the missing ones
  [ ("context", blank q.context),
    ("effort_minutes", decide (q.effortMinutes ≤ 0)),
    ("blocked_work", blank q.blockedWork),
    ("if_unanswered", blank q.ifUnanswered),
    ("options", (needsChoices && n < 2) || (!needsChoices && n == 1)),
    ("recommendation", !q.options.isEmpty && !validRec),
    ("exhibits", q.needsExhibit && !shown) ].filterMap fun (part, missing) =>
    if missing then some part else none

structure QuestionStore where
  items : List Question := []
  deriving Repr

namespace QuestionStore

abbrev Result := Except HubError (Question × QuestionStore)

private def mustFindOpen (store : QuestionStore) (id : String) : Except HubError Question := do
  let some q := store.items.find? (·.id == id) | throw .unknownQuestion
  unless q.state == .open do throw .questionNotOpen
  return q

-- Writes the changed question back over the stored one with the same id.
private def put (store : QuestionStore) (q : Question) : Question × QuestionStore :=
  (q, { store with items := store.items.map fun item => if item.id == q.id then q else item })

def ask (store : QuestionStore) (draft : Question) : Result := do
  let missing := missingParts draft
  unless missing.isEmpty do throw (.incompleteQuestion missing)

  let existing := store.items.find? fun q =>
    q.state == .open && q.requestId == draft.requestId &&
    q.jobId == draft.jobId && q.decisionKey == draft.decisionKey
  match existing with
  | none =>
    let created := { draft with version := 1, state := .open }
    return (created, { store with items := store.items ++ [created] })
  | some existing =>
    -- Fold repeat into a revision, preserving identity and original openedAt
    return store.put { draft with id := existing.id, answererId := existing.answererId,
                                  openedAt := existing.openedAt,
                                  version := existing.version + 1, state := .open }

def checkAnswerVersion (store : QuestionStore) (id : String) (expectedVersion : Nat) :
    Except HubError Question := do
  let q ← store.mustFindOpen id
  unless q.version == expectedVersion do throw .staleQuestionVersion
  return q

def withdraw (store : QuestionStore) (id reason : String) (now : Nat) : Result := do
  let q ← store.mustFindOpen id
  return store.put { q with state := .withdrawn, closedAt := some now,
                            closedReason := some reason }

def expire (store : QuestionStore) (id : String) (now : Nat) : Result := do
  let q ← store.mustFindOpen id
  match q.answerBy with
  | some deadline => if now < deadline then throw .deadlineNotReached
  | none => throw .deadlineNotReached
  let reason := s!"Deadline reached; applied fallback: {q.ifUnanswered}"
  return store.put { q with state := .expired, closedAt := some now,
                            closedReason := some reason }

-- Checked by Lean: an incomplete draft is refused, naming exactly the missing parts.
theorem ask_incomplete (store : QuestionStore) (draft : Question)
    (h : missingParts draft ≠ []) :
    store.ask draft = .error (.incompleteQuestion (missingParts draft)) := by
  simp [ask, h]
  rfl

end QuestionStore

Refusal, crash-retry deduplication, and withdrawal trace

Walking Example 1 (payment-failed email) through the failure path shows how the hub blocks a vague draft with incomplete_question, folds a worker crash retry into version = 2, guards against stale_question_version, and withdraws the card cleanly when scope changes:

Execution trace: Example 1 (vague refusal, crash-retry deduplication, and withdrawal)
1. Worker 1 submits vague ask (only text filled in; needsExhibit=true)
   store.ask(q_vague)
   -> refused: incomplete_question [context, effort_minutes, blocked_work, if_unanswered, options, exhibits]

2. Worker 1 fills all parts & attaches rendered current + new email exhibits:
   store.ask(q_email_v1)  // id="q_email_1", decisionKey="payment-email-wording"
   -> ok (stored: id="q_email_1", version=1, state="open")

3. Worker 1 crashes, restarts, and asks same decisionKey under new id "q_email_retry":
   store.ask({ ...q_email_v1, id: "q_email_retry", text: "Which failed-payment email?" })
   -> ok (revised in place: id="q_email_1", version=2, same openedAt — still 1 card!)

4. Stale client tries to submit an answer targeting version 1:
   store.checkAnswerVersion("q_email_1", expectedVersion: 1)
   -> error: stale_question_version (client refreshes to show version 2 first)

5. Scope changes elsewhere (email dropped); Lead withdraws before check-in:
   store.withdraw("q_email_1", reason: "Email replaced by in-app notice", now: Tue 08:15)
   -> ok (state="withdrawn", closedReason recorded; card leaves inbox before 09:00)

Tradeoffs and practical guidance

Shifting effort from the returning human back onto the asking agent makes check-ins calm and sharp, with three real tradeoffs to keep in view:

  • Asking costs the agent more upfront: rendering exhibits, writing per-option outcomes, and committing to a recommendation takes extra tokens and time — which is often a feature (agents realize they don't need to ask) but pure drag for trivial live clarifications.
  • Structural completeness is not semantic truth: the hub can verify that context and recommendation_reason are non-empty, yet an agent can still omit a subtle edge case or anchor the human toward a flawed recommendation.
  • Exhibit storage lifecycle matters: exhibits must be copied into durable hub storage rather than linking into an ephemeral worker sandbox that disappears before the human opens the card.

Practical implementation notes

  • Keep required parts minimal and vary them by kind: a decision or review needs >= 2 options and a recommendation, whereas a simple fact or sign-in action needs neither. Unnecessary required fields train agents to emit boilerplate that humans learn to ignore.
  • Let the asker pick decision_key: free-text fuzzy matching misses restarts because agents rarely word a question identically twice; a short slug like payment-email-wording catches repeats deterministically.
  • Require conservative fallbacks: whatever if_unanswered says will happen without human approval, so default to the option that changes the least (for example, keeping the current email).
  • Tie withdrawal to lifecycle events: hook job cancellation, request scope edits, and PR merges to auto-withdraw obsolete open questions so dead asks vanish before check-in.

Known uses and related patterns

  • Camunda BPMN User Tasks: models human steps as durable records with structured forms, due dates, and explicit assignment — pre-authored by a process designer in BPMN, whereas here an agent authors the card dynamically when hitting an unknown.
  • Anthropic Claude Agent SDK (AskUserQuestion): structures agent asks with finite options and optional visual previews, though it targets in-session interaction without mandatory fallback clauses or decision_key revision folding.
  • Model Context Protocol (MCP) Elicitation & LangGraph interrupt: provide structured JSON-schema user input requests and paused execution payloads; this pattern adds the hub-enforced recommendation, exhibits, effort estimate, and safe fallback needed for asynchronous review.
  • Hohpe & Woolf's Request-Reply, Correlation Identifier, and Message Expiration: classic messaging patterns supply the reply linkage and answer_by deadline; Self-Contained Question specifies what the payload must contain when the receiver is a human arriving cold.
  • Volgenic: structures every owner ask as a versioned record with context, concrete options, outcomes, one reasoned recommendation, and visual exhibits before surfacing it in the Needs Attention queue.

Related patterns

  • Question Inbox — decides when and where questions notify the requester; Self-Contained Question decides what each question must contain.
  • Tracked Answer — starts where this pattern ends, storing the Answer record tied to question_version and verifying that work applies it.
  • Escalation Chain — routes the question using decision_class; because the card is self-contained, escalating it never loses context.
  • Delegation Policy — eliminates recurring questions by turning repeated answers into standing rules.
  • Derived Status Board — displays open Question records directly on each blocked request line.
  • Orchestrator-Workers & Durable Job — define the Request, Party, and Job records that every question links to.