Draft State and Lifecycle
Central object: structured draft
The parser should not just output a final transaction. It should output and maintain a draft.
Example:
{
"draft_id": "draft_123",
"action": "create_transaction",
"status": "incomplete",
"source_text": "Coffee yesterday",
"transaction": {
"type": "expense",
"amount": null,
"currency": "USD",
"date": "2026-06-22",
"category": {
"id": "coffee",
"label": "Coffee",
"confidence": 0.86,
"source": "inferred_from_text"
},
"account_id": {
"value": "default_cash",
"confidence": 0.62,
"source": "default"
},
"merchant": null,
"note": "coffee"
},
"missing_fields": ["amount"],
"warnings": [],
"next_step": {
"type": "ask_user",
"question": "How much was the coffee?"
}
}Then the user says:
4.50The system updates the same draft:
{
"draft_id": "draft_123",
"status": "ready_for_confirmation",
"transaction": {
"type": "expense",
"amount": 4.50,
"currency": "USD",
"date": "2026-06-22",
"category": {
"id": "coffee",
"label": "Coffee",
"confidence": 0.86
},
"account_id": {
"value": "default_cash",
"confidence": 0.62
},
"note": "coffee"
},
"missing_fields": [],
"warnings": [],
"next_step": {
"type": "show_confirmation"
}
}This lets the system behave as a stateful assistant, not a stateless parser.
Draft lifecycle
Define explicit draft states.
empty
→ initialized
→ partially_filled
→ enriched
→ validated
→ ready_for_confirmation
→ confirmed
→ executedAlso include failure/escape states:
needs_clarification
blocked
unsupported
cancelled
expiredA practical state model:
This is cleaner than treating every user message as a separate parse event.
Related: Draft patches and field provenance · Clarification as draft repair · Action policy, readiness, and execution gates.
Original text: 02-pipeline.md.