Goal
As a person filling out a digitized form, I want pages that don't apply to me to be skipped automatically, so I don't waste time on irrelevant questions.
Context
Story #121 improved FormSpec layout quality by +19.8pp through a layout-aware extraction prompt. However, conditional page use (scoring pages as skippable based on user answers) improved only modestly (37.5% → 43.8%) despite explicit prompt instructions and worked examples.
The core difficulty: the LLM must derive page-level conditions from field-level conditions in the DataCollectionSpec. This requires:
- Identifying groups where most/all requirements share a common condition
- Separating the "gate" question (the field that triggers the condition) to a prior page
- Adding the correct condition JSON to the page
This inference is unreliable via prompt alone. A deterministic post-processing step would be more robust.
Scope
Implement a post-processing function that runs after FormSpec generation (Step 2) and adds condition properties to pages where appropriate:
- Scan each page's groups for fields with shared conditions
- If ≥80% of a group's non-gate fields share the same condition, lift it to the page level
- Ensure the gate field is on a prior page (reorder if needed)
- Validate the resulting FormSpec still passes schema checks
Acceptance Criteria
Related
Goal
As a person filling out a digitized form, I want pages that don't apply to me to be skipped automatically, so I don't waste time on irrelevant questions.
Context
Story #121 improved FormSpec layout quality by +19.8pp through a layout-aware extraction prompt. However, conditional page use (scoring pages as skippable based on user answers) improved only modestly (37.5% → 43.8%) despite explicit prompt instructions and worked examples.
The core difficulty: the LLM must derive page-level conditions from field-level conditions in the DataCollectionSpec. This requires:
This inference is unreliable via prompt alone. A deterministic post-processing step would be more robust.
Scope
Implement a post-processing function that runs after FormSpec generation (Step 2) and adds
conditionproperties to pages where appropriate:Acceptance Criteria
addPageConditions(spec: DataCollectionSpec, formSpec: FormSpec) => FormSpecfunction existsRelated
catalog/experiments/layout-quality/findings.md— documents the prompt-only ceilingsrc/services/form-documents/layout-prompt.ts— current prompt with conditional guidance