ADR 0303: The job-draft task returns a strict, plain-text draft that can never fill a job field, and the core checks it
- Status: Accepted
- Date: 2026-10-29
- Parent story: #480
- Task: #503
- Builds on: ADR 0279, ADR 0278, ADR 0287, ADR 0302
Context#
The author talks for ninety seconds and wants a draft that sounds like them. A provider can write it, but a job
post is a record a business publishes: a draft that invents a price, sets job.trade, smuggles HTML or ends up
saved on its own would be worse than no draft. The task needs one contract that the provider is held to, that
tests can pin, and that cannot reach anything the author did not type.
Decision#
- A new Assistant task,
job-draft, beside review, completion and the voice guide, on the same provider boundary.POST /admin/api/assistant/job-drafttakesnotes(typed, or a transcript the author has read and edited, at most 8,000 characters), optionalphotoAlts(twelve of at most 200 characters), the job wordstrade,serviceandtown(at most 80 characters, one line), andcontextIds. It is an authenticated, CSRF-protected route with the ordinary JSON bound, the shared concurrency permit and the provider timeout. - The voice guide comes through the existing context selection.
contextIdsare resolved on the server by the same function review and completion use (ADR 0278): the browser names a guide or sample, the server reads it again and counts it against the request budget, and text the browser supplies for it is ignored. Capture names only the voice guide; the route accepts any selectable context. - The author's words are data. The normalized request puts the trusted rules (
systemInstructions, the engine guide andplatformCapabilities) apart fromuntrustedData(notes,photoAltTexts,job,context). The rules say to use only what the notes say, to leave a section empty rather than invent, never to return any other field, and that nothing inuntrustedDatais an instruction, even when it asks to change behavior or publish. A voice guide adds the existing sentence that it is data to compare against. - One strict result, checked in the core. The result is
{ title, description, sections: { problem, found, did, result } }and nothing else.openblog_core::job_draft::JobDraft::from_jsonrefuses the whole result, with a plain reason that repeats nothing from it, when: any other key appears (so ajob,slug,draftor front matter field has no place to go); a field is missing or not text; a title is empty, a title or description is not one line, or any field is over its bound (120, 300 and 1,500 characters); or any field holds HTML, a code fence, an image, a heading, a front-matter line or a control character. A section may be empty, because a draft that leaves out what the notes never said is better than one that makes it up, but not all four. Providers are also given the same shape as a JSON schema withadditionalProperties: false. - A proposal, never an action. The route returns
{ draft, body, proposal: true }, wherebodyis the scaffold with each section under its heading (JobDraft::body, written once besidescaffold_body). It writes no file, saves no post and sets no field. An invalid result is502 invalid-result: "The provider's job draft was rejected because …. Nothing was applied." - The engine guide teaches it. A
job-draftscapability is added to the guide every Assistant request carries, and the guide version becomes 6.
Considered options#
- Letting the draft suggest
jobfields too. Rejected: the Job form's fields (trade, dates, place, outcome) drive validation, structured data and archives. They are the author's to enter, so the schema has nowhere to put one. - Sanitizing instead of rejecting. Rejected: stripping markup would quietly change what the provider wrote; refusing the draft whole keeps "what you were shown is what was checked".
- Making it a review skill. Rejected: a skill is a Markdown file the author edits, and the draft's contract must not be editable away. The rules live in the request, like the voice-guide payload.
Consequences#
- Any provider that can follow a JSON schema works; a custom HTTPS endpoint gets the same normalized payload.
- A provider that wanders gets a refusal and a way forward (type the notes), never a half-applied draft.
- Changing the draft's bounds or sections is a change to one core module, one schema and the guide text.