Close-Out Triage
Honest agents often tell you exactly what they left undone in the final paragraph of a completion message: "Merged and passing — note that the flag is still off in production and refunds aren't covered yet." Then the job closes, the status board turns green, and a week later the missing step bites you because nobody owned it.
Close-Out Triage turns every unfinished caveat into a first-class
Leftover item that must be explicitly classified before a job is allowed to
close: required (keeps the job open until fixed),
deferred (spawns an assigned follow-up job),
optional (recorded nice-to-have that nobody owes), or
dropped (permitted only by the requester or a standing
policy). Reach for it whenever jobs can end partly finished and missing loose ends hurt the
requester later.
Leftover item
Why honest caveats in prose change nothing
Real work — across engineering, research reports, migrations, and operations — almost always finishes with edges: a feature flag still off, a regional data pull still missing, a legacy format left untouched, or an extra cleanup idea noticed along the way. When a worker mentions those caveats honestly in a closing summary, everyone feels informed, the job is marked closed, and the ticket disappears from view.
The failure isn't dishonesty — it's that a sentence in a message starts no work. Once a job closes, no assignee owns turning on the production switch, no follow-up job tracks the deferred edge case, and nobody recorded whether narrowing the scope was even authorized.
Close-Out Triage prevents silent loose ends with three structural rules enforced by the hub:
-
Explicit leftover declaration is mandatory. A worker's final report must
declare what was
added,left_out,weakened, orput_offas structured records — or explicitly state an empty list so silence is never mistaken for a clean finish. -
Every leftover receives one of four binding outcomes. The lead agent
sorts each item into
required,deferred,optional, ordropped— with drops allowed only by the requester or under an explicit standing policy. -
The Hub's close check guards every closure path. No job may close while
leftovers are undeclared, any item remains unsorted, or any
requireditem lacks a confirmation timestamp.
Why require an explicit list even when nothing was left undone? Because
storing leftovers_listed_at on the job separates a worker
who checked and confirmed zero leftovers from a job that tried to close without ever asking
what remained.
Architecture and participants
Close-Out Triage inserts one computed Close check into the hub's job
closure transition. Workers and checkers record structured
Leftover item rows, the lead agent sorts each item against
the requester's goal, and the hub enforces drop policies, atomically creates assigned
follow-up jobs for deferred items, and freezes all
leftover records once the job closes.
leftovers_listed_at
timestamp and all attached Leftover item rows. Deferred
items spawn assigned follow-up jobs atomically; dropped items verify requester or policy
authority.
Leftover item (or explicitly records an empty list)
when reporting finished, and resolves any item sorted as
required.
Leftover item whenever independent inspection
surfaces an unstated gap or weakened requirement that the worker omitted.
deferred follow-up job, and asks the
hub to close the job once all required work is resolved.
Policy rules specifying what the lead
agent may drop, decides uncovered drops when asked, and reviews triaged outcomes at
their next check-in.
deferred, refuses closure whenever the close check
fails, and freezes items once closed.
Execution flow
Toggle between the normal path — where four declared leftovers are cleanly sorted across all four outcomes without interrupting the requester — and the refusal path — where the hub blocks an early close and rejects an unauthorized drop until the requester weighs in.
Item 1 (required) keeps the job open until Worker A
finishes it; item 2 (deferred) creates a real job for
Worker B; item 3 (optional) is logged unowed; item 4
(dropped) cites a standing policy. The requester is
never interrupted.
Begins after Worker A's final report lists one unsorted leftover item ("duplicate check does not cover bank transfers").
The hub blocks early closure with unsorted_items and
blocks the lead's unilateral drop with no_policy_allows_drop.
Escalating to the requester surfaces that bank transfers are required, keeping the job
open until Worker A finishes them.
Concrete examples
Close-Out Triage applies to any multi-step deliverable — board decks, compliance filings, data migrations, or software changes — where partial finishes and side discoveries are part of normal execution.
Example 1 — Quarterly board report preparation
No code or unit tests- Leftover report
-
Worker A finishes the Q3 board deck and declares four structured leftover items:
(1) Churn slide still contains placeholder numbers (
left_out); (2) European regional breakdown needs a separate finance export (put_off); (3) A custom cover graphic would improve polish (put_off); (4) Legacy product-line appendix was omitted (left_out). - Triage outcomes
-
(1)
required— keeps the board-deck job open until real churn metrics land; (2)deferred— spawns an assigned follow-up job for the finance analyst agent; (3)optional— logged without blocking delivery; (4)dropped— authorized under the requester's standing policy retiring legacy product reporting. - Result
- The deck cannot accidentally ship with placeholder numbers, the regional pull gets a named owner, and the requester never has to chase a footnote in a chat log.
Example 2 — Payment webhook duplicate check
Payments & rollout- Leftover report
-
Worker A merges the duplicate-webhook guard and lists four leftovers:
(1) Still switched off in production (
left_out); (2) Refunds not covered yet (put_off); (3) A chart of caught duplicates would help (put_off); (4) Version 1 webhook handler untouched (left_out). - Triage outcomes
-
(1)
required— request asks to protect real customers, so job stays open until Worker A enables the flag in production; (2)deferred— hub creates a follow-up job assigned to Worker B; (3)optional— recorded, nobody owes it; (4)dropped— permitted under the requester's standing policy shutting off version 1 webhooks in December. - Result
-
The hub blocks closure with
required_items_openuntil the production switch is enabled and confirmed, preventing duplicate charges the following week.
What this pattern is NOT — Atomic single-step lookups
Negative example- Scenario
- Running a single quick lookup ("What is our current webhook timeout setting?") or recording caveats in a tracker that never enforces job closure.
- Why skip it
- An atomic lookup is either completely answered or not — its leftover list is always empty. And if nothing enforces the close check in code, a leftover table just becomes the closing paragraph under another name.
When to use and when to skip
Use Close-Out Triage when
- Workers report their own completion and someone other than the closer suffers if a caveat gets forgotten.
- Jobs routinely finish with scoped deferrals, feature switches, edge-case exclusions, or newly discovered follow-ups.
- The hub owns the job record and can refuse closure in code until the close check passes.
- You want clear authority boundaries so agents cannot silently narrow what the requester asked for.
Skip it when
- The task is atomic and binary (either wholly done or not done), leaving nothing meaningful to triage.
- The coordination layer cannot intercept job closure, making the leftover list purely advisory.
- Every discovered follow-up automatically becomes a blocking job without
optionalordroppedoutlets — flooding the backlog with noise. - Workers are penalized for reporting leftovers, incentivizing them to hide unfinished work instead.
Data model and hub invariants
Close-Out Triage defines one table — leftover_items —
referencing jobs (whose
leftovers_listed_at field comes from
Durable Job), parties,
and policies. The close check itself is computed on every
close attempt and never stored as a separate flag.
Leftover item belongs to one closing
Job and is reported by one
Party. Sorting fills decision fields together, linking a
Policy on agent drops or an assigned follow-up
Job on deferrals.
Table: leftover_items
| Column | Postgres type | Nullability | Notes |
|---|---|---|---|
| id | uuid | NOT NULL, PK | Unique leftover item identifier. |
| job_id | uuid | NOT NULL, FK | References jobs(id); permanent for the item's whole life. |
| reported_by_id | uuid | NOT NULL, FK | References parties(id); usually the worker, checker, or hub. |
| kind | text | NOT NULL | CHECK (kind IN ('added', 'left_out', 'weakened', 'put_off')). |
| text | text | NOT NULL | One concrete sentence stating what is still owed. |
| reported_at | timestamptz | NOT NULL | Defaults to now(). |
| outcome | text | NULLABLE | CHECK (outcome IN ('required', 'deferred', 'optional', 'dropped')); NULL until triaged. |
| decided_by_id | uuid | NULLABLE, FK | References parties(id); set together with outcome. |
| decided_at | timestamptz | NULLABLE | Timestamp when triaged; set together with outcome. |
| policy_id | uuid | NULLABLE, FK | References policies(id); set only when an agent drops under standing policy. |
| reason | text | NULLABLE | Rationale sentence; mandatory non-blank when outcome = 'dropped'. |
| follow_up_job_id | uuid | NULLABLE, FK | References jobs(id); required & created atomically when outcome = 'deferred'. |
| resolved_at | timestamptz | NULLABLE | Confirmation timestamp for required items; NULL for all other outcomes. |
Six hub invariants
-
01Decision fields are filled or empty together Database constraint
A
CHECKconstraint enforces(outcome IS NULL) = (decided_by_id IS NULL) AND (outcome IS NULL) = (decided_at IS NULL), preventing partially triaged rows. -
02Outcome-specific links and drop reasons are schema-bound Database constraint
CHECKconstraints require(outcome = 'deferred') = (follow_up_job_id IS NOT NULL),resolved_at IS NULL OR outcome = 'required',policy_id IS NULL OR outcome = 'dropped', and a non-blankreasonwheneveroutcome = 'dropped'. -
03Deferred items spawn an assigned follow-up job atomically Hub guard
triage_itemwithoutcome = "deferred"rejects withfollow_up_job_requiredunless an assignedfollow_up_job_idis created and linked in the same transaction. -
04Drops require a reason and requester or policy authority Hub guard
triage_itemwithoutcome = "dropped"fails withdrop_reason_requiredon blank reasons andno_policy_allows_dropwhen an agent tries to drop an item without a coveringpolicy_id. -
05Resolved items and closed jobs are frozen Hub guard
triage_itemrejects edits to already-resolved items withitem_already_resolved, and every mutating call rejects closed jobs withjob_already_closed. -
06Every close path passes through the close check Hub guard
close_jobblocks closure withleftovers_not_listedwhenleftovers_listed_atis NULL,unsorted_itemswhen any item hasoutcome == null, andrequired_items_openwhile anyrequireditem lacksresolved_at.
Reference implementation
The same minimal hub guards in Lean, TypeScript, Python, and Elixir. Put the close check inside the single transition function that closes a job so direct closes, merge-triggered closes, and automated checks all obey the exact same gate.
-- Hub guards for Close-Out Triage (every close path runs the close check)
import Std.Data.HashMap
open Std
inductive LeftoverKind where
| added | leftOut | weakened | putOff
deriving Repr, BEq, DecidableEq
inductive Outcome where
| required | deferred | optional | dropped
deriving Repr, BEq, DecidableEq
inductive HubError where
| unknownJob | unknownItem | jobAlreadyClosed | itemAlreadyResolved
| dropReasonRequired | noPolicyAllowsDrop | followUpJobRequired
| itemNotRequired | leftoversNotListed | unsortedItems | requiredItemsOpen
deriving Repr, BEq
-- Timestamps are ISO 8601 strings, passed in by the caller.
structure LeftoverItem where
id : String
jobId : String
reportedById : String
kind : LeftoverKind
text : String
outcome : Option Outcome := none
decidedById : Option String := none
decidedAt : Option String := none
policyId : Option String := none
reason : Option String := none
followUpJobId : Option String := none
resolvedAt : Option String := none
deriving Repr
structure TriageDecision where
decidedById : String
decidedAt : String
policyId : Option String := none
reason : Option String := none
followUpJobId : Option String := none
deriving Repr
structure Job where
id : String
requesterId : String
leftoversListedAt : Option String := none
closed : Bool := false
deriving Repr
structure CloseOutHub where
jobs : HashMap String Job := {}
items : HashMap String LeftoverItem := {}
namespace CloseOutHub
-- `m[k]?` gives an Option; `.elim (throw e) pure` turns a missing entry into an error.
def mustGetJob (hub : CloseOutHub) (jobId : String) : Except HubError Job :=
hub.jobs[jobId]? |>.elim (throw .unknownJob) pure
def mustGetItem (hub : CloseOutHub) (itemId : String) : Except HubError LeftoverItem :=
hub.items[itemId]? |>.elim (throw .unknownItem) pure
def submitLeftovers (hub : CloseOutHub) (jobId : String) (newItems : List LeftoverItem)
(listedAt : String) : Except HubError CloseOutHub := do
let job ← hub.mustGetJob jobId
if job.closed then throw .jobAlreadyClosed
let items := newItems.foldl (fun acc item => acc.insert item.id item) hub.items
let jobs := hub.jobs.insert jobId { job with leftoversListedAt := some listedAt }
return { jobs, items }
def validateOutcome (job : Job) (outcome : Outcome) (d : TriageDecision) :
Except HubError Unit := do
match outcome with
| .dropped =>
if d.reason.all (·.all Char.isWhitespace) then throw .dropReasonRequired
if d.decidedById != job.requesterId && d.policyId.isNone then throw .noPolicyAllowsDrop
| .deferred =>
if d.followUpJobId.isNone then throw .followUpJobRequired
| .required | .optional => pure ()
def triageItem (hub : CloseOutHub) (itemId : String) (outcome : Outcome)
(decision : TriageDecision) : Except HubError (LeftoverItem × CloseOutHub) := do
let item ← hub.mustGetItem itemId
let job ← hub.mustGetJob item.jobId
if job.closed then throw .jobAlreadyClosed
if item.resolvedAt.isSome then throw .itemAlreadyResolved
validateOutcome job outcome decision
let updated := { item with
outcome := some outcome,
decidedById := some decision.decidedById,
decidedAt := some decision.decidedAt,
policyId := if outcome == .dropped then decision.policyId else none,
reason := decision.reason,
followUpJobId := if outcome == .deferred then decision.followUpJobId else none }
return (updated, { hub with items := hub.items.insert itemId updated })
def resolveRequiredItem (hub : CloseOutHub) (itemId : String) (resolvedAt : String) :
Except HubError (LeftoverItem × CloseOutHub) := do
let item ← hub.mustGetItem itemId
let job ← hub.mustGetJob item.jobId
if job.closed then throw .jobAlreadyClosed
unless item.outcome == some .required do throw .itemNotRequired
let resolved := { item with resolvedAt := some resolvedAt }
return (resolved, { hub with items := hub.items.insert itemId resolved })
def closeJob (hub : CloseOutHub) (jobId : String) : Except HubError (Job × CloseOutHub) := do
let job ← hub.mustGetJob jobId
if job.closed then throw .jobAlreadyClosed
if job.leftoversListedAt.isNone then throw .leftoversNotListed
let jobItems := hub.items.values.filter (·.jobId == jobId)
if jobItems.any (·.outcome.isNone) then throw .unsortedItems
if jobItems.any (fun i => i.outcome == some .required && i.resolvedAt.isNone) then
throw .requiredItemsOpen
let closed := { job with closed := true }
return (closed, { hub with jobs := hub.jobs.insert jobId closed })
end CloseOutHub
-- Once closed, a job can never be closed again (so close-out runs exactly once).
theorem closed_job_cannot_close_again (hub : CloseOutHub) (jobId : String) (job : Job)
(h : hub.jobs[jobId]? = some job) (hc : job.closed = true) :
hub.closeJob jobId = .error .jobAlreadyClosed := by
simp [CloseOutHub.closeJob, CloseOutHub.mustGetJob, h, hc]; rfl
// Hub guards for Close-Out Triage (every close path runs the close check)
type LeftoverKind = "added" | "left_out" | "weakened" | "put_off";
type Outcome = "required" | "deferred" | "optional" | "dropped";
interface LeftoverItem {
id: string;
jobId: string;
reportedById: string;
kind: LeftoverKind;
text: string;
outcome: Outcome | null;
decidedById: string | null;
decidedAt: string | null;
policyId: string | null;
reason: string | null;
followUpJobId: string | null;
resolvedAt: string | null;
}
interface TriageDecision {
decidedById: string;
at: string;
policyId?: string | null;
reason?: string | null;
followUpJobId?: string | null;
}
interface Job {
id: string;
requesterId: string;
leftoversListedAt: string | null;
closed: boolean;
}
class CloseOutHub {
private jobs = new Map<string, Job>();
private items = new Map<string, LeftoverItem>();
submitLeftovers(jobId: string, items: LeftoverItem[], at: string): void {
const job = this.mustGetJob(jobId);
if (job.closed) throw new Error("job_already_closed");
for (const item of items) this.items.set(item.id, item);
job.leftoversListedAt = at;
}
triageItem(itemId: string, outcome: Outcome, decision: TriageDecision): LeftoverItem {
const item = this.items.get(itemId);
if (!item) throw new Error("unknown_item");
const job = this.mustGetJob(item.jobId);
if (job.closed) throw new Error("job_already_closed");
if (item.resolvedAt !== null) throw new Error("item_already_resolved");
if (outcome === "dropped") {
if (!decision.reason?.trim()) throw new Error("drop_reason_required");
if (decision.decidedById !== job.requesterId && !decision.policyId) {
throw new Error("no_policy_allows_drop");
}
}
if (outcome === "deferred" && !decision.followUpJobId) {
throw new Error("follow_up_job_required");
}
item.outcome = outcome;
item.decidedById = decision.decidedById;
item.decidedAt = decision.at;
item.policyId = outcome === "dropped" ? (decision.policyId ?? null) : null;
item.reason = decision.reason ?? null;
item.followUpJobId = outcome === "deferred" ? (decision.followUpJobId ?? null) : null;
return item;
}
resolveRequiredItem(itemId: string, at: string): LeftoverItem {
const item = this.items.get(itemId);
if (!item) throw new Error("unknown_item");
const job = this.mustGetJob(item.jobId);
if (job.closed) throw new Error("job_already_closed");
if (item.outcome !== "required") throw new Error("item_not_required");
item.resolvedAt = at;
return item;
}
closeJob(jobId: string): Job {
const job = this.mustGetJob(jobId);
if (job.closed) throw new Error("job_already_closed");
if (job.leftoversListedAt === null) throw new Error("leftovers_not_listed");
const jobItems = [...this.items.values()].filter((i) => i.jobId === jobId);
if (jobItems.some((i) => i.outcome === null)) throw new Error("unsorted_items");
if (jobItems.some((i) => i.outcome === "required" && i.resolvedAt === null)) {
throw new Error("required_items_open");
}
job.closed = true;
return job;
}
private mustGetJob(jobId: string): Job {
const job = this.jobs.get(jobId);
if (!job) throw new Error("unknown_job");
return job;
}
}
# Hub guards for Close-Out Triage (every close path runs the close check)
from dataclasses import dataclass
from typing import Literal, Optional
LeftoverKind = Literal["added", "left_out", "weakened", "put_off"]
Outcome = Literal["required", "deferred", "optional", "dropped"]
@dataclass
class LeftoverItem:
id: str
job_id: str
reported_by_id: str
kind: LeftoverKind
text: str
outcome: Optional[Outcome] = None
decided_by_id: Optional[str] = None
decided_at: Optional[str] = None
policy_id: Optional[str] = None
reason: Optional[str] = None
follow_up_job_id: Optional[str] = None
resolved_at: Optional[str] = None
@dataclass
class Job:
id: str
requester_id: str
leftovers_listed_at: Optional[str] = None
closed: bool = False
class HubError(Exception):
pass
class CloseOutHub:
def __init__(self) -> None:
self.jobs: dict[str, Job] = {}
self.items: dict[str, LeftoverItem] = {}
def submit_leftovers(self, job_id: str, items: list[LeftoverItem], at: str) -> None:
job = self._get_job(job_id)
if job.closed:
raise HubError("job_already_closed")
for item in items:
self.items[item.id] = item
job.leftovers_listed_at = at
def triage_item(
self,
item_id: str,
outcome: Outcome,
decided_by_id: str,
at: str,
policy_id: Optional[str] = None,
reason: Optional[str] = None,
follow_up_job_id: Optional[str] = None,
) -> LeftoverItem:
item = self.items.get(item_id)
if item is None:
raise HubError("unknown_item")
job = self._get_job(item.job_id)
if job.closed:
raise HubError("job_already_closed")
if item.resolved_at is not None:
raise HubError("item_already_resolved")
if outcome == "dropped":
if not reason or not reason.strip():
raise HubError("drop_reason_required")
if decided_by_id != job.requester_id and not policy_id:
raise HubError("no_policy_allows_drop")
if outcome == "deferred" and not follow_up_job_id:
raise HubError("follow_up_job_required")
item.outcome = outcome
item.decided_by_id = decided_by_id
item.decided_at = at
item.policy_id = policy_id if outcome == "dropped" else None
item.reason = reason
item.follow_up_job_id = follow_up_job_id if outcome == "deferred" else None
return item
def resolve_required_item(self, item_id: str, at: str) -> LeftoverItem:
item = self.items.get(item_id)
if item is None:
raise HubError("unknown_item")
job = self._get_job(item.job_id)
if job.closed:
raise HubError("job_already_closed")
if item.outcome != "required":
raise HubError("item_not_required")
item.resolved_at = at
return item
def close_job(self, job_id: str) -> Job:
job = self._get_job(job_id)
if job.closed:
raise HubError("job_already_closed")
if job.leftovers_listed_at is None:
raise HubError("leftovers_not_listed")
job_items = [i for i in self.items.values() if i.job_id == job_id]
if any(i.outcome is None for i in job_items):
raise HubError("unsorted_items")
if any(i.outcome == "required" and i.resolved_at is None for i in job_items):
raise HubError("required_items_open")
job.closed = True
return job
def _get_job(self, job_id: str) -> Job:
job = self.jobs.get(job_id)
if job is None:
raise HubError("unknown_job")
return job
# Hub guards for Close-Out Triage (pure functional core)
defmodule CloseOutHub do
defstruct jobs: %{}, items: %{}
@outcomes [:required, :deferred, :optional, :dropped]
def submit_leftovers(%CloseOutHub{} = hub, job_id, new_items, at) do
with {:ok, job} <- fetch_job(hub, job_id),
true <- not job.closed || {:error, :job_already_closed} do
items = Enum.reduce(new_items, hub.items, &Map.put(&2, &1.id, &1))
jobs = Map.put(hub.jobs, job_id, %{job | leftovers_listed_at: at})
{:ok, %{hub | jobs: jobs, items: items}}
end
end
def triage_item(%CloseOutHub{} = hub, item_id, outcome, decision) when outcome in @outcomes do
with {:ok, item} <- Map.fetch(hub.items, item_id) |> or_error(:unknown_item),
{:ok, job} <- fetch_job(hub, item.job_id),
true <- not job.closed || {:error, :job_already_closed},
true <- is_nil(item.resolved_at) || {:error, :item_already_resolved},
:ok <- validate_outcome(job, outcome, decision) do
updated = %{
item
| outcome: outcome,
decided_by_id: decision.decided_by_id,
decided_at: decision.at,
policy_id: if(outcome == :dropped, do: decision[:policy_id]),
reason: decision[:reason],
follow_up_job_id: if(outcome == :deferred, do: decision[:follow_up_job_id])
}
{:ok, updated, %{hub | items: Map.put(hub.items, item_id, updated)}}
end
end
def resolve_required_item(%CloseOutHub{} = hub, item_id, at) do
with {:ok, item} <- Map.fetch(hub.items, item_id) |> or_error(:unknown_item),
{:ok, job} <- fetch_job(hub, item.job_id),
true <- not job.closed || {:error, :job_already_closed},
true <- item.outcome == :required || {:error, :item_not_required} do
resolved = %{item | resolved_at: at}
{:ok, resolved, %{hub | items: Map.put(hub.items, item_id, resolved)}}
end
end
def close_job(%CloseOutHub{} = hub, job_id) do
with {:ok, job} <- fetch_job(hub, job_id),
true <- not job.closed || {:error, :job_already_closed},
true <- not is_nil(job.leftovers_listed_at) || {:error, :leftovers_not_listed},
:ok <- check_items(hub, job_id) do
closed = %{job | closed: true}
{:ok, closed, %{hub | jobs: Map.put(hub.jobs, job_id, closed)}}
end
end
defp validate_outcome(job, :dropped, d) do
cond do
d[:reason] in [nil, ""] or String.trim(d[:reason]) == "" ->
{:error, :drop_reason_required}
d.decided_by_id != job.requester_id and is_nil(d[:policy_id]) ->
{:error, :no_policy_allows_drop}
true ->
:ok
end
end
defp validate_outcome(_job, :deferred, d) do
if is_nil(d[:follow_up_job_id]), do: {:error, :follow_up_job_required}, else: :ok
end
defp validate_outcome(_job, _other, _d), do: :ok
defp check_items(hub, job_id) do
job_items = hub.items |> Map.values() |> Enum.filter(&(&1.job_id == job_id))
cond do
Enum.any?(job_items, &is_nil(&1.outcome)) -> {:error, :unsorted_items}
Enum.any?(job_items, &(&1.outcome == :required and is_nil(&1.resolved_at))) -> {:error, :required_items_open}
true -> :ok
end
end
defp fetch_job(hub, id), do: hub.jobs |> Map.fetch(id) |> or_error(:unknown_job)
defp or_error({:ok, val}, _err), do: {:ok, val}
defp or_error(:error, err), do: {:error, err}
end
Triage and close-check trace
Walking Example 2 (webhook duplicate check) through these guards shows the hub rejecting premature closure, blocking an unauthorized drop, and keeping the job open until the production switch is resolved:
1. hub.submitLeftovers(job_dedupe, [item_prod_switch, item_refunds, item_chart, item_v1], "2026-11-04T16:00Z")
hub.closeJob(job_dedupe)
-> error: unsorted_items (all 4 items still have outcome = null)
2. hub.triageItem(item_v1, "dropped", { decidedById: lead_1, reason: "v1 retires in Dec" })
-> error: no_policy_allows_drop (Lead agent is not Requester and named no policy)
3. hub.triageItem(item_prod_switch, "required", { decidedById: lead_1 })
hub.triageItem(item_refunds, "deferred", { decidedById: lead_1, followUpJobId: job_refunds_worker_b })
hub.triageItem(item_chart, "optional", { decidedById: lead_1 })
hub.triageItem(item_v1, "dropped", { decidedById: lead_1, policyId: policy_v1_sunset, reason: "v1 retires in Dec" })
-> ok (all 4 items sorted; follow-up job created for Worker B)
4. hub.closeJob(job_dedupe)
-> error: required_items_open (item_prod_switch has resolvedAt = null)
5. hub.resolveRequiredItem(item_prod_switch, "2026-11-04T17:15Z")
hub.closeJob(job_dedupe)
-> ok (job_dedupe closed; all leftover items frozen for audit)
Tradeoffs and practical guidance
Close-Out Triage trades a brief triage pass at the end of each job for zero silently dropped loose ends. Keep three practical tensions in balance:
- Reward honesty, never penalize listed items: if workers are scored down for declaring leftovers, they will hide unfinished edges in vague wording and defeat the entire mechanism.
-
Guard against
optionalabuse: becauseoptionalneeds no follow-up job and no drop policy, it is the cheapest bucket. Restrictoptionalso items that weaken or omit explicit Request Spec requirements can only berequired,deferred, ordropped. -
Avoid follow-up sprawl: if every minor idea becomes a
deferredjob, queues fill with unrequested chores. Useoptionalgenerously for genuine nice-to-haves and keepdeferredfor work the team actually intends to ship.
Practical implementation notes
-
Enforce on every close path: a job might close via a lead agent tool, a
merge listener, or a UI button — funnel every path through one
close_jobguard so none bypasses triage. - Require atomic, actionable item wording: reject umbrella items like "some edge cases remain" that cannot be sorted into a single outcome; split them into one sentence per concrete thing still owed.
- Place follow-up jobs intentionally: creating a deferred follow-up under the same parent request keeps the request open until it completes; if the requester wants the current request finished first, file the deferred item as its own independent request.
- Remember what triage cannot catch: Close-Out Triage makes declared leftovers binding — pair it with independent checkers (Policy Gate) to surface gaps the worker didn't notice.
Known uses and related patterns
- GitLab merge request threads: supports "All threads must be resolved" as a merge check alongside one-click "Create issue to resolve thread," converting unresolved review caveats into tracked follow-up work.
-
Claude Code
TaskCompletedhook: runs a verification script whenever a task tries to close and can block completion while returning the exact unmet reasons back to the agent; Close-Out Triage adds durable per-item outcomes. -
Scrum Definition of Done & Product Backlog: returns incomplete
increments to the backlog as a whole; Close-Out Triage classifies each unfinished slice
individually (
requiredvs.deferredvs.optionalvs.dropped). - Workflow Patterns — Implicit Termination (WCP-11): defines a process as complete only when no remaining work can still run; Close-Out Triage enforces this at job close by binding every remaining gap to an active job or an explicit disposition.
- Volgenic: blocks automatic work-item closure when acceptance criteria remain unchecked at merge time, keeping incomplete items visibly open until resolved.
Related patterns
- Evidence-Backed Completion — proves what was completed and verified, whereas Close-Out Triage accounts for everything left undone.
- Policy Gate — decides from checker findings whether a step may proceed; gaps discovered by checkers feed directly into
Leftover itemrows. - Durable Job — defines
jobs.leftovers_listed_atand ensures deferred follow-up jobs carry a durable assignee. - Delegation Policy — defines the standing policies that authorize a lead agent to drop specific classes of leftovers without escalating.
- Decision Audit — records autonomous triage outcomes chosen by the lead agent so the requester can sample and audit them later.
- Request Spec & Orchestrator-Workers — define the acceptance criteria that determine what is
requiredand thePartyrecords for reporters and deciders.