Request Spec

When you hand a request to a team of AI agents, the conversation where you explained why you wanted it rarely reaches the workers that actually do the work. Worse, if your priorities change while jobs are already running, isolated workers keep building against yesterday's goal without ever knowing the target moved.

Request Spec gives every request one short, versioned record of what is wanted, why it matters, how anyone can tell it is done, and which open questions must be settled first. Every job pins the exact spec version it works from, so the hub can block premature guesses and catch stale work automatically whenever meaning changes.

Group Work structure
Also known as Spec-Driven Development, Versioned Intent
Core rule Never close a job against a spec version that is no longer current
Defines records Request spec

Why passing a chat message isn't enough

Across engineering, research, legal review, and operations, most agents join a request after the requester stated it. If a lead agent only copies a one-line task title into a job, the requester's underlying reason disappears. A worker faithfully executes the literal title — and misses the real problem completely.

Two second-order failures follow quickly. First, when an important fact is still unknown, eager workers guess instead of investigating, wasting an entire run on the wrong premise. Second, when the requester clarifies or narrows the goal mid-flight, a running worker has no structural way to know its work is now outdated — so an obsolete result slips cleanly through close-out.

Request Spec solves both problems with three rules enforced in hub code rather than left to memory or prompt reminders:

  1. One immutable versioned record holds meaning, never progress. Each revision stores the outcome, the reason, observable acceptance criteria, open points, and which parts were proposed by the lead versus confirmed by the requester. Ticking off finished steps lives outside the spec so a new version number always means intent changed.
  2. Blocking open points must be settled before main work starts. While a spec has a blocking open point, the hub refuses to assign ordinary execution jobs — only the time-boxed investigation (a spike) linked to that open point may run.
  3. Every job pins a spec version, and the hub checks it at close-out. A worker reports which version it built against; if a newer version has been published in the meantime, the hub rejects completion with job_spec_stale until the lead reconciles and updates the job.

Why mark lead-written parts as proposed instead of pausing for approval? Because asking the requester to approve every obvious criterion upfront wastes the exact human attention asynchronous agents are meant to save. Marking proposals lets low-risk work proceed while giving the requester a crisp checklist to confirm or correct at her next check-in — reserving hard stops only for blocking open points where guessing wrong would be expensive.

Unversioned prompt relay Requester states goal & reason Only a short job title reaches worker Worker guesses past unknowns No reason or criteria to check against Goal shifts mid-flight No version check catches stale work Done as titled, misses the goal Expensive rework discovered too late Request Spec Lead publishes spec v1 Outcome, reason, criteria & open points Spike settles blocking unknown Lead writes immutable spec v2 Job pins spec v2; Hub gates close Rejects stale close if v3 appears Result matches current meaning Checker verifies explicit criteria
Without a versioned spec, the requester's reason drops off at handoff and mid-flight changes go unnoticed. Pinning every job to an immutable spec version lets spikes settle unknowns early and lets the hub block stale close-outs automatically.

Architecture and participants

The Hub stores every version of a request's spec as an immutable row and derives the current version as the highest version number for that request. Every Job holds a required request_spec_id foreign key so workers and checkers always read the exact version the job was scoped against.

Requester States goal & confirms Hub Versions & version gate Lead agent Authors specs & spikes Hub durable records Request Requester & lead owner Request spec v1..vN Immutable; max = current Job Pins request_spec_id Worker 1 (Spike) Settles 1 open point Worker 2 (Execution) Builds from pinned spec Checker Verifies spec criteria
The lead agent writes immutable spec versions on the requester's behalf and pins each job to one version. Workers and checkers read that exact version, while the hub gates assignment on open points and gates close-out on version currency.
Requester
States the desired outcome and the reason behind it; confirms or corrects parts the lead agent proposed during periodic check-ins.
Hub
Stores immutable Request spec versions numbered from 1, blocks non-spike assignment while blocking open points remain, and refuses job completion when a job's pinned version is behind current.
Lead agent
Authors spec versions, flags its own additions in proposed_parts, records open points with spike budgets or questions, and repins jobs when meaning shifts.
Workers
Spike workers answer one time-boxed open question; execution workers build against their job's pinned request_spec_id and report that version ID when finishing.
Checker
Evaluates finished output directly against the numbered acceptance criteria and reason recorded in the job's spec version.

Execution flow

Toggle between the normal path — where a short spike resolves a blocking unknown before the main job starts — and the mid-flight change path — where the requester revises the goal while a worker is building and the hub blocks the stale completion report.

Requester Hub Lead agent Workers 1. State outcome & reason 2. Deliver request to lead 3. Save spec v1 + link spike 4. Start spike (Worker 1) on v1 5. Report spike findings 6. Forward findings to lead 7. Save spec v2 + assign main job 8. Start main job (Worker 2) on v2 9. Report finished from spec v2 10. Mark done (v2 current); confirm

Version 1 captures the requester's outcome and reason plus one blocking open point. The hub allows only the time-boxed spike to run; once findings arrive, version 2 closes the open point and unlocks the main job, which finishes cleanly while version 2 is still current.

Concrete examples

Request Spec applies anywhere work is handed across sessions and judged against a moving goal — whether the deliverable is a legal memo, an operations runbook, or production code.

Example 1 — Vendor data-residency audit brief

No code or unit tests
Request
"Summarize our top three cloud vendors' EU data-residency guarantees so legal counsel can clear our Q3 European launch."
Spec v1 & spike
The lead records the outcome, the EU launch reason, two proposed criteria, and one blocking open point: "Do any of the three vendors replicate backup snapshots or support logs outside the EU?" (20-minute spike). Worker 1 discovers Vendor B copies error logs to US-East.
Spec v2 & v3 shift
The lead publishes v2 adding a criterion covering backups and logs, then assigns the full brief to Worker 2. Mid-afternoon, counsel asks to include UK GDPR adequacy as well (v3). When Worker 2 reports finished from v2, the hub rejects closure (job_spec_stale), repins the job to v3, and delivers one audit brief covering both EU and UK requirements.

Example 2 — Customer bulk-import concurrency cap

Everyday engineering
Request
"Cap imports at five at a time so one customer's bulk upload cannot starve everyone else."
Spec v1 & spike
Without a spec, a worker only caps the web upload screen and misses bulk uploads entirely. With Request Spec, v1 records the starvation reason and one blocking open point: "Which code paths start an import?" (30-minute spike). Worker 1 reports that bulk uploads enter via a separate background queue.
Spec v2 & v3 shift
The lead writes v2 with criterion 3 ("The limit covers both the upload screen and the background queue") and assigns Worker 2 against v2. Mid-build, the requester adds: "Make it two at a time on the free plan" (v3). Worker 2 finishes from v2, hits job_spec_stale, receives the v3 diff, adds the free-plan cap, and closes cleanly against v3.

What this pattern is NOT — Quick single-session edit

Negative example
Request
Fix a typo on a landing page or adjust a chart's axis formatting while chatting live with one agent.
Why skip it
One person and one agent in a single thread already share full conversational context, and undoing a misreading takes seconds. Authoring and versioning a formal spec here costs more than any mistake it prevents.

When to use and when to skip

Use Request Spec when

  • Workers or checkers start after the requester stated the goal and never heard her underlying reason.
  • Someone other than the worker judges completion and needs explicit, observable criteria to check against.
  • Requirements may shift while jobs are in flight and stale output must not silently close the request.
  • A wrong assumption would be costly to uncover late, making a cheap upfront spike worthwhile.

Skip it when

  • One human collaborates directly with one agent inside a single live conversation that already holds the context.
  • The task is cheap and trivial to redo — let the agent act on its reading and show that reading alongside the result.
  • You are tempted to dump implementation plans or progress checkboxes into the spec (keep those on jobs).

Data model and hub invariants

Request Spec defines one table — request_specs — linked to requests and parties (defined by Orchestrator-Workers) and referenced by every row in jobs (defined by Durable Job) through request_spec_id. One row equals one version.

1 request_id (job belongs to same request) n Request PK id (Work structure) Party PK id (Requester or Lead) Request spec PK id FK request_id version outcome reason acceptance_criteria open_points proposed_parts confirmed_parts required_claims FK author_id created_at Job PK id FK request_id FK request_spec_id (Durable Job) 1 1+ 1 n 1 n
Each Request has one or more immutable RequestSpec rows numbered from 1. Every Job pins exactly one spec version via request_spec_id.

Table: request_specs

Column Postgres type Nullability Notes
id uuid NOT NULL, PK Unique identifier for this specific version.
request_id uuid NOT NULL, FK References requests(id).
version integer NOT NULL Starts at 1 per request, increments without gaps; highest number is current.
outcome text NOT NULL One or two sentences stating what must be true when finished.
reason text NOT NULL Why the requester wants the outcome; disambiguates edge cases.
acceptance_criteria jsonb NOT NULL Array of {number, text} conditions; numbers never reuse.
open_points jsonb NOT NULL Array of unsettled questions (see structured fields below); empty when all settled.
proposed_parts jsonb NOT NULL Names of unconfirmed lead proposals: outcome, reason, or criterion:<n>.
confirmed_parts jsonb NOT NULL Array of {part, confirmed_at} moved here as the requester confirms proposals.
required_claims jsonb NOT NULL Claim kinds required for completion (e.g. reported_finished, checked).
author_id uuid NOT NULL, FK References parties(id); must be the request's requester or lead.
created_at timestamptz NOT NULL Timestamp when this version was published.

Structured entry shape: open_points

Field Type Nullability Notes
key text NOT NULL Stable slug across versions (e.g. import-paths).
text text NOT NULL The unresolved point phrased as a concrete question.
blocking boolean NOT NULL When true, only a spike linked to an open point may be assigned.
settle_with text NOT NULL question (ask requester) or spike (time-boxed worker probe).
budget_minutes integer NULLABLE Required positive limit when settle_with = 'spike'; null for questions.
question_id uuid NULLABLE Linked Question ID once sent; null beforehand.
job_id uuid NULLABLE Linked spike Job ID once created; null beforehand.
linked_at timestamptz NULLABLE Timestamp when question_id or job_id was recorded.

Seven hub invariants

  1. 01
    Every request starts at version 1 with gap-free numbering Database constraint

    Version 1 is written in the same transaction that creates the request. UNIQUE (request_id, version) and CHECK (version >= 1) guarantee clean monotonic numbering.

  2. 02
    Current version is always derived as the highest version number Database constraint

    No mutable current_spec_id column exists on requests, so every pattern computes the current spec consistently via MAX(version) without pointer drift.

  3. 03
    Spec wording never mutates after publication Hub guard

    Outcome, reason, and criteria are append-only across versions. Only two timestamped metadata writes occur in place: moving a part from proposed_parts into confirmed_parts, and linking an open point's question_id or spike job_id.

  4. 04
    Only the requester or lead agent may publish a version Hub guard

    revise_spec rejects any other party with only_requester_or_lead_may_revise. Anything the lead adds without requester words goes into proposed_parts.

  5. 05
    Criteria or an open point must exist, and spikes require a budget Hub guard

    Publishing a version with neither criteria nor open points fails with criteria_or_open_point_required; any open point with settle_with = 'spike' and no positive budget_minutes fails with spike_budget_required.

  6. 06
    Blocking open points restrict assignment to linked spikes Hub guard

    Every job pins one spec of its own request. While the current spec contains a blocking open point, assign_job rejects any job not named by an open point's job_id with blocking_open_point.

  7. 07
    Jobs close only against the current spec version Hub guard

    finish_job rejects with report_names_wrong_version if the worker reports a different spec ID than its job pins, and with job_spec_stale if a higher spec version now exists.

Reference implementation

The same minimal spec versioning and gating logic in Lean, TypeScript, Python, and Elixir. Every invariant lives in deterministic hub functions rather than worker prompt reminders.

-- Hub guards for Request Spec (immutable versions + spike & staleness gates)
import Std.Data.HashMap
open Std (HashMap)

structure Criterion where
  number : Nat
  text : String
  deriving Repr

inductive SettleWith where
  | question | spike
  deriving Repr, BEq

structure OpenPoint where
  key : String
  text : String
  blocking : Bool
  settleWith : SettleWith
  budgetMinutes : Option Nat := none
  jobId : Option String := none
  deriving Repr

structure ConfirmedPart where
  part : String
  confirmedAt : String
  deriving Repr

structure RequestSpec where
  id : String
  requestId : String
  version : Nat
  outcome : String
  reason : String
  acceptanceCriteria : List Criterion := []
  openPoints : List OpenPoint := []
  proposedParts : List String := []
  confirmedParts : List ConfirmedPart := []
  authorId : String
  deriving Repr

-- The fields a revision may change; `none` keeps the previous version's value.
structure SpecChanges where
  outcome : Option String := none
  reason : Option String := none
  acceptanceCriteria : Option (List Criterion) := none
  openPoints : Option (List OpenPoint) := none
  proposedParts : Option (List String) := none

structure Request where
  id : String
  requesterId : String
  leadId : String
  deriving Repr

inductive JobStatus where
  | «open» | done  -- «» lets a keyword like `open` be used as a name
  deriving Repr, BEq

structure Job where
  id : String
  requestId : String
  requestSpecId : String
  status : JobStatus := .open
  deriving Repr

inductive HubError where
  | invalidInitialSpec | unknownRequest | onlyRequesterOrLeadMayRevise
  | jobSpecStale | blockingOpenPoint | unknownJob | onlyLeadMayRepin
  | reportNamesWrongVersion | criteriaOrOpenPointRequired | spikeBudgetRequired
  deriving Repr, BEq

-- The hub is plain data; every guard returns a new hub or an error.
structure SpecHub where
  requests : HashMap String Request := {}
  specs : HashMap String RequestSpec := {}
  jobs : HashMap String Job := {}

namespace SpecHub

def validateSpec (spec : RequestSpec) : Except HubError Unit := do
  if spec.acceptanceCriteria.isEmpty && spec.openPoints.isEmpty then
    throw .criteriaOrOpenPointRequired
  -- `Option.any`: false when there is no budget, else whether it is above zero.
  for p in spec.openPoints do
    if p.settleWith == .spike && !p.budgetMinutes.any (· > 0) then
      throw .spikeBudgetRequired

def createRequestWithV1 (hub : SpecHub) (req : Request) (specV1 : RequestSpec) :
    Except HubError (RequestSpec × SpecHub) := do
  unless specV1.requestId == req.id && specV1.version == 1 do throw .invalidInitialSpec
  validateSpec specV1
  pure (specV1, { hub with requests := hub.requests.insert req.id req,
                           specs := hub.specs.insert specV1.id specV1 })

def currentSpec (hub : SpecHub) (requestId : String) : Except HubError RequestSpec :=
  -- `(·.requestId == requestId)` is shorthand for `fun s => s.requestId == requestId`.
  match hub.specs.values.filter (·.requestId == requestId) with
  | [] => throw .unknownRequest
  | s :: rest => pure (rest.foldl (fun a b => if b.version > a.version then b else a) s)

def reviseSpec (hub : SpecHub) (requestId actorId specId : String) (changes : SpecChanges) :
    Except HubError (RequestSpec × SpecHub) := do
  let some req := hub.requests.get? requestId | throw .unknownRequest
  unless actorId == req.requesterId || actorId == req.leadId do
    throw .onlyRequesterOrLeadMayRevise

  let prev ← hub.currentSpec requestId
  -- A revision is a new record; earlier versions are never edited.
  let next := { prev with
    id := specId, version := prev.version + 1, authorId := actorId, confirmedParts := []
    outcome := changes.outcome.getD prev.outcome
    reason := changes.reason.getD prev.reason
    acceptanceCriteria := changes.acceptanceCriteria.getD prev.acceptanceCriteria
    openPoints := changes.openPoints.getD prev.openPoints
    proposedParts := changes.proposedParts.getD prev.proposedParts }
  validateSpec next
  pure (next, { hub with specs := hub.specs.insert specId next })

def assignJob (hub : SpecHub) (jobId requestId specId : String) :
    Except HubError (Job × SpecHub) := do
  let current ← hub.currentSpec requestId
  unless current.id == specId do throw .jobSpecStale

  let blocking := current.openPoints.filter (·.blocking)
  unless blocking.isEmpty || blocking.any (·.jobId == some jobId) do
    throw .blockingOpenPoint
  let job : Job := { id := jobId, requestId, requestSpecId := specId }
  pure (job, { hub with jobs := hub.jobs.insert jobId job })

def repinJob (hub : SpecHub) (jobId actorId specId : String) :
    Except HubError (Job × SpecHub) := do
  let some job := hub.jobs.get? jobId | throw .unknownJob
  let some req := hub.requests.get? job.requestId | throw .onlyLeadMayRepin
  unless req.leadId == actorId do throw .onlyLeadMayRepin
  let current ← hub.currentSpec job.requestId
  unless current.id == specId do throw .jobSpecStale

  let job := { job with requestSpecId := specId }
  pure (job, { hub with jobs := hub.jobs.insert jobId job })

def finishJob (hub : SpecHub) (jobId reportedSpecId : String) :
    Except HubError (Job × SpecHub) := do
  let some job := hub.jobs.get? jobId | throw .unknownJob
  unless reportedSpecId == job.requestSpecId do throw .reportNamesWrongVersion
  let current ← hub.currentSpec job.requestId
  unless job.requestSpecId == current.id do throw .jobSpecStale

  let job := { job with status := .done }
  pure (job, { hub with jobs := hub.jobs.insert jobId job })

end SpecHub

-- Invariant: a spec with neither acceptance criteria nor open points is always rejected.
theorem empty_spec_rejected (spec : RequestSpec) :
    SpecHub.validateSpec { spec with acceptanceCriteria := [], openPoints := [] }
      = throw .criteriaOrOpenPointRequired := by
  simp [SpecHub.validateSpec]

Spike and stale-version trace

Walking Example 2 (customer bulk-import concurrency cap) through these guards shows how the hub blocks premature building during an open point and rejects stale close-out with job_spec_stale after a mid-flight change:

Execution trace: Example 2 (customer bulk-import concurrency cap)
1. hub.createRequestWithV1(req_imports, spec_v1)
     // spec_v1 has 2 proposed criteria + 1 blocking open point (spike: job_spike_paths, 30m)
   -> ok (version = 1; current spec is spec_v1)

2. hub.assignJob(job_build_cap, req_imports.id, spec_v1.id)
   -> error: blocking_open_point (only linked spike job_spike_paths may run)

3. hub.assignJob(job_spike_paths, req_imports.id, spec_v1.id)
   hub.finishJob(job_spike_paths, spec_v1.id)
   -> ok (spike finds bulk uploads enter via background queue)

4. hub.reviseSpec(req_imports.id, lead_1, spec_v2.id,
     { acceptanceCriteria: [c1, c2, c3_upload_and_queue], openPoints: [], proposedParts: ["criterion:3"] })
   hub.assignJob(job_build_cap, req_imports.id, spec_v2.id)
   -> ok (version = 2; no blocking open points; job_build_cap pinned to spec_v2)

5. hub.reviseSpec(req_imports.id, lead_1, spec_v3.id,
     { outcome: "Max 5 imports per customer, or 2 on the free plan" })
   hub.finishJob(job_build_cap, spec_v2.id)
   -> error: job_spec_stale (job pins spec_v2; current version is 3)

6. hub.repinJob(job_build_cap, lead_1, spec_v3.id)
   hub.finishJob(job_build_cap, spec_v3.id)
   -> ok (worker_2 added free-plan cap; job closed against current version 3)

Tradeoffs and practical guidance

Request Spec trades a small upfront authoring cost for durable alignment across every downstream worker and checker. Weigh three practical tradeoffs before adopting it:

  • Authoring overhead on tiny tasks: writing and reading a versioned record adds latency that only pays back when work crosses sessions, needs independent checking, or carries real rework cost.
  • False confidence from weak criteria: a worker can satisfy every numbered criterion and still miss the spirit if the criteria were poorly written or if lead proposals went unread by the requester.
  • Reconciliation work on frequent edits: every change of meaning creates a new version that in-flight jobs must catch up to — which is honest friction, not a bug, because silent drift is far more expensive.

Practical implementation notes

  • Keep every spec to one screen: capture outcome, reason, observable criteria, and open points — leave design plans and task breakdowns on jobs.
  • Keep progress completely separate from meaning: never store checked boxes inside the spec row, or routine progress ticks will mask real requirement changes.
  • Store each version whole and immutable: a worker resuming against version 2 must read the exact words that were current when its job was scoped.
  • Time-box every spike with a clear decision: every spike needs one question, a hard minute budget, and a decision that depends on the answer ("do nothing" is a valid outcome).
  • Compare versions in the hub, not in the agent: a worker mid-task cannot reliably know whether a newer version was published; enforce version checks at assignment and close-out inside the hub.

Known uses and related patterns

  • Kubernetes object spec & generation: separates desired state (spec) from observed progress (status) and increments metadata.generation only when desired spec changes — Request Spec extends that separation with the requester's reason and explicit open points.
  • GitHub Spec Kit: provides structured feature specification templates that mark unresolved ambiguities and require measurable success criteria before coding agents implement.
  • Kiro specs: separates requirements from design and execution tasks for coding agents; Request Spec keeps the versioned intent record in the hub and pins each job to a specific version ID.
  • Volgenic: versions work-item intent separately from execution runs so downstream workers and reviewers can detect when requirements move mid-flight.
  • Unmesh Joshi's Versioned Value: from Patterns of Distributed Systems — stores every update under a new version number so historical values remain readable; Request Spec applies the same immutability to agent instructions.

Related patterns

  • Context Handoff — most easily confused with Request Spec; Request Spec is the versioned record of intent, while Context Handoff delivers that spec alongside facts, policies, and checkpoints into each worker's briefing.
  • Change Propagation — begins where Request Spec ends, proactively locating every in-flight job, wait, and review affected when a new version is published.
  • Orchestrator-Workers — supplies the lead agent that authors spec versions and decomposes work against them.
  • Durable Job — defines the Job record whose request_spec_id pins each job to one version.
  • Policy Gate & Evidence-Backed Completion — read the spec's criteria and required_claims to verify completion claims before closing work.