PR: #334: [Story-1292] Send matter_type + forum into Atlas intake input (app sender half) by @ankitmaheshwari-com
View PR →
Story-1292 · Atlas grounding · pramaan-app half (the sender) · ADR-031 cross-repo

Atlas grounding: send matter_type + forum into the intake input — closing #1292 (app half)

The Add-Matter wizard collects a coarse matter type (Story-1281/1282) and a forum (Story-1289), but neither reached Atlas: buildWizardInput — the function that maps the wizard drafts onto the AtlasIntakeInput wire shape — sent neither. So every Step-5 run launched without its declared grounding priors, and Atlas inferred the dispute nature purely from counsel's free text. This is the follow-through on the deliberate descope in Story-1289 ("the Atlas grounding (forum + matter_type) is split into a separate coordinated functions+brain+app ticket"). This slice is the app sender half per ADR-031.

The contract reality (why this is safe to ship app-first)

The intake model is no longer the old prompt-DSL "frozen BAML soul" — under pramaan-docs ADR-117 it is a hand-owned Pydantic model, AtlasIntakeInput in pramaan-agents/agents/atlas/models.py. Two facts gate this work: This retires the Story-1289 fear ("injecting an unverified forum field could break every Step-5 run"): the risk was real for an extra="forbid" model; this model ignores extras.

What ships (pramaan-app only)

PieceWhat & why
Snapshot shapeatlas-rail.ts — WizardSnapshot gains optional matterType?: string | null and forum?: string | null (the selected names, not ids — Atlas grounds on counsel's words, e.g. "Domestic Arbitration" / "SIAC").
The sendbuildWizardInput spreads matter_type / forum into the wire object only when present: { ...(matterType ? { matter_type } : {}) }. Tolerant — a null/blank/whitespace pick is omitted, never sent empty, so Atlas falls back to inferring from free text (pramaan-docs ADR-115 D1).
Name resolutionadd-matter-wizard.tsx resolves the names from the live picker option lists by id (matterTypes.find(m => m.id === matterTypeId)?.name ?? null, same for forums/forumId) and threads them into the useAtlasRail snapshot. null when counsel hasn't picked — preset path may derive the type server-side.
Re-launch correctnessThe grounding fields are part of buildWizardInput, which is the inputSig Atlas re-launches on. Changing the matter type or forum in Step 2 and returning to Review now correctly re-grounds the run — for free, no extra wiring.
TestsTwo new buildWizardInput cases in atlas-rail.test.ts: (1) sends matter_type+forum when collected; (2) omits both when unset, and treats null/whitespace as unset.

i18n

None. matter_type and forum are wire data fields, not user-facing copy — no new strings, no en.json/hi.json change.

Cross-repo sequencing (ADR-031)

matter_type is complete end-to-end the moment this app half merges (contract-declared, broker passthrough confirmed in the functions half). forum only takes effect once the producer adds forum: str | None to AtlasIntakeInput (pramaan-agents) + broker passthrough (pramaan-functions). Until then the app's forum field is ignored by the brain — harmless. Because the app send is non-breaking, it does not need to wait; the producer halves can land independently. The OpenAPI mirror (openapi/app-api.json) is in sync and untouched — the intake model is a BAML/Pydantic agent contract, not part of the app HTTP contract, so no pnpm codegen was run.

Verification

pnpm tsc         clean
pnpm lint        clean (0 errors; 4 pre-existing warnings, none introduced by this diff)
pnpm build       green
vitest           full suite 514 passed (89 files) — incl. 2 new buildWizardInput grounding cases
openapi drift    diff -q against functions main: identical (no contract/codegen change)
No new components, no gateway/hook/proxy recreation, no UI surface change — this is a pure wire-payload slice inside src/lib/agents/ plus the snapshot wiring in the wizard.

Files changed

3 file(s), +82 / -1 lines

Path Role + -
src/components/add-matter/add-matter-wizard.tsxComponent+10-1
src/lib/agents/__tests__/atlas-rail.test.tsLibrary+50-0
src/lib/agents/atlas-rail.tsLibrary+22-0