DecisionIntakescreener · walkthrough · openapi.json · source

Developer guide

DecisionIntake decides what to ask next in a US benefits screening, how far to trust each answer, and when it knows enough to recommend programs or should suggest a person review the case. Your product keeps the conversation; the engine keeps the decision. Engine 1.1.0 at https://decision-intake.vercel.app; every example below is a real response, generated from the code by experiments/build_docs.py.

1. The loop

One endpoint does the work. Send what you know, get back the next step, repeat until the step is finish or hand_off. The service keeps nothing between calls: every response carries a state string, and you send it back with the next call. No key, no account.

CallBodyReturns
POST /v1/step{"state"?, "facts"?}the new state, how each fact was read, and next: ask, finish or hand_off
POST /v1/assessment{"state"}every program's probability, tier and yearly value range; the facts so far; how well the data covers this household
POST /v1/explain{"state"}which single answer, one step different, would change each program's result (below)
POST /v1/plan{"state"}the programs worth applying for, in the order to apply, with the federal rules linking them (below)
POST /v1/batch{"records": [{"id", "facts"}]}a caseload: expected value and the question to ask first, per household, and the order to call them in (below)
POST /v1/cliff{"state", "question"?}every bracket of an amount question, the rest kept: a benefits-cliff view (below)
GET /v1/questions-the fifteen programs and all 18 questions with their options
POST /mcpJSON-RPCthe same engine as tools for AI assistants (section 5)
GET /healthz-liveness, version, and the commit and model and rules hashes deployed

Start

{
  "facts": []
}
{
  "state": "di1;#6a3a",
  "readings": [],
  "next": {
    "action": "ask",
    "question": {
      "id": "children",
      "text": "How many children under 18 live with you?",
      "kind": "choice",
      "options": [
        "none",
        "1",
        "2",
        "3",
        "4 or more"
      ]
    },
    "why": {
      "worth_per_year": 1691,
      "question_cost": 15.0,
      "mostly_settles": [
        {
          "id": "early_head_start",
          "programme": "Early Head Start",
          "share": 0.33
        },
        {
          "id": "eitc",
          "programme": "Earned income tax credit",
          "share": 0.18
        },
        {
          "id": "snap",
          "programme": "SNAP (food)",
          "share": 0.17
        }
      ]
    },
    "progress": {
      "facts_recorded": 0,
      "expected_mistake_cost": 6435,
      "similar_households": 7816,
      "support": {
        "households_like_this": 7815.9,
        "level": "supported",
        "conflicting_answers": 0
      }
    }
  }
}

why.worth_per_year is the expected cost of mistakes, in dollars a year, that the next question saves; it is asked because that is more than question_cost. mostly_settles says which programs it is about (with their ids), useful for telling the person why you ask.

2. Facts and readings

Record anything the person said, asked or not. Each fact is exactly one of three kinds:

KindExampleNotes
choice{"question": "children", "choice": "2"}the option's text; numbers map onto ranges like "4 or more"; true/false onto yes/no; on amount questions a range's text works too
amount{"question": "earned_income", "amount": {"value": 2400, "period": "month", "approximate": true}}as said: a value or low/high, a period (year, month, week, none). Don't convert it yourself: the engine does the arithmetic and spreads approximate amounts over neighbouring ranges
don't know{"question": "assets", "dont_know": true}no evidence; the belief is unchanged

Three facts at once

{
  "state": "di1;#6a3a",
  "facts": [
    {
      "question": "children",
      "choice": "2"
    },
    {
      "question": "state",
      "choice": "TX"
    },
    {
      "question": "earned_income",
      "amount": {
        "value": 2400,
        "period": "month",
        "approximate": true
      }
    }
  ]
}
{
  "state": "di1;children=2;state=TX;earned_income=~2400/month;#d883",
  "readings": [
    {
      "question": "children",
      "reading": "2"
    },
    {
      "question": "state",
      "reading": "TX"
    },
    {
      "question": "earned_income",
      "reading": "$2,400 a month -> $24,480-$33,120 a year -> \"$20,000 to $30,000\" 63%, \"$30,000 to $40,000\" 36%"
    }
  ],
  "next": {
    "action": "ask",
    "question": {
      "id": "household_size",
      "text": "How many people live in your household, including you?",
      "kind": "choice",
      "options": [
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7 or more"
      ]
    },
    "why": {
      "worth_per_year": 1349,
      "question_cost": 15.0,
      "mostly_settles": [
        {
          "id": "ssi",
          "programme": "SSI",
          "share": 0.47
        },
        {
          "id": "aca_ptc",
          "programme": "ACA premium tax credit",
          "share": 0.27
        },
        {
          "id": "housing",
          "programme": "Housing assistance",
          "share": 0.13
        }
      ]
    }
  }
}

Each fact gets a reading: what the engine understood, worth showing the person so they can correct it.

An amount question

Amount questions carry a unit and the ranges the engine reasons in. Ask for a number; offer the ranges for people who'd rather pick one.

{
  "id": "housing_cost",
  "text": "What do you pay for rent or mortgage each month?",
  "kind": "amount",
  "unit": "dollars a month",
  "ranges": [
    "none",
    "$1 to $500",
    "$500 to $1,000",
    "$1,000 to $1,500",
    "$1,500 to $2,000",
    "$2,000 to $3,000",
    "$3,000 or more"
  ]
}

Corrections, rejected facts and warnings

A fact for an answered question replaces it (replaces shows the old reading). A fact that can't be read is not recorded, its reading has an error saying how to fix it, and the other facts in the call still go in. A warning means no household on record fits this answer together with the others: check it with the person.

{
  "state": "…",
  "facts": [
    {
      "question": "children",
      "choice": "3"
    },
    {
      "question": "tenure",
      "choice": "a boat"
    },
    {
      "question": "household_size",
      "choice": "4"
    }
  ]
}
{
  "state": "di1;state=TX;earned_income=~2400/month;children=3;household_size=4;#2c25",
  "readings": [
    {
      "question": "children",
      "reading": "3",
      "replaces": "2"
    },
    {
      "question": "tenure",
      "error": "\"a boat\" is not an option for tenure; use one of: rent, own, neither"
    },
    {
      "question": "household_size",
      "reading": "4"
    }
  ],
  "next": {
    "action": "ask",
    "...": "..."
  }
}

3. Responses

When no remaining question is worth asking, next.action is finish, or hand_off when the doubt left is still costly enough that a person should go through it.

Finish

{
  "action": "hand_off",
  "recommend": [
    {
      "id": "school_meals",
      "programme": "Free or reduced-price school meals",
      "tier": "likely",
      "probability": 0.96,
      "value_if_eligible_per_year": [
        2170,
        2350
      ]
    },
    {
      "id": "eitc",
      "programme": "Earned income tax credit",
      "tier": "likely",
      "probability": 0.93,
      "value_if_eligible_per_year": [
        5250,
        7100
      ]
    }
  ],
  "unsure": [
    {
      "id": "chip",
      "programme": "CHIP",
      "tier": "can't tell",
      "probability": 0.08
    },
    {
      "id": "head_start",
      "programme": "Head Start",
      "tier": "can't tell",
      "probability": 0.06
    }
  ],
  "progress": {
    "facts_recorded": 11,
    "expected_mistake_cost": 3381,
    "similar_households": 10,
    "support": {
      "households_like_this": 5.1,
      "level": "thin",
      "conflicting_answers": 0
    }
  },
  "note": "A screening estimate from PolicyEngine's rules, not an eligibility decision. Apply through the official programme to get one. Immigration status is not asked and can change eligibility.",
  "recommend_more": "... 5 more"
}
FieldMeaning
recommendprograms worth applying for; tier is likely (probability at least 0.5) or worth checking (applying is worth it in expectation, but less likely than not); value_if_eligible_per_year is [low, high] in whole dollars (health coverage: its value, not cash)
unsureprograms the engine won't call from these answers: few training households look like this person and the program keeps a real chance. Show them as "we couldn't tell, you can still apply", never as unlikely
progress.support.households_like_thisthe effective number of training households (a weighted count, so it can be fractional) that fit these answers before the support floor; under 10 is thin. progress.similar_households is the same after the floor
progress.expected_mistake_costdollars a year the remaining doubt is expected to cost
notewhat this is and isn't; show it with every result

Hand off

Someone who answers "don't know" to most questions can't be called with confidence. hand_off_reason is advice to show, not a referral: nothing is sent anywhere.

{
  "action": "hand_off",
  "hand_off_reason": "No remaining question is worth asking, but the doubt that is left would still cost about $3,668 a year in mistakes. A benefits navigator or caseworker should go through it with the person.",
  "recommend": [
    {
      "id": "medicaid",
      "programme": "Medicaid",
      "tier": "worth checking",
      "probability": 0.37,
      "value_if_eligible_per_year": [
        17780,
        44070
      ]
    }
  ],
  "unsure": [],
  "progress": {
    "facts_recorded": 13,
    "expected_mistake_cost": 3668,
    "similar_households": 132,
    "support": {
      "households_like_this": 131.6,
      "level": "supported",
      "conflicting_answers": 0
    }
  }
}

What would change it

POST /v1/explain with a state moves each answer one step (one bracket of income or costs, the next count, the other yes/no; never the state) with every other answer kept, and lists each programme whose tier that changes. Useful for "check again if your income drops", and for spotting a benefits cliff. Each case reuses the belief instead of replaying the interview, so the whole list takes about a second. The note is part of the contract: it is a guide to re-checking, never advice on what to report. The screener shows only money answers that move a probability by 0.15 or more across "likely".

{
  "state": "…"
}
{
  "state": "di1;state=OH;household_size=1;children=none;earned_income=1900/month;tenure=rent;disabled=no;senior=no;#a650",
  "near_the_line": [
    {
      "id": "snap",
      "programme": "SNAP (food)",
      "tier": "likely",
      "probability": 0.57,
      "would_change": [
        {
          "question": "earned_income",
          "kind": "amount",
          "from": "$20,000 to $30,000",
          "to": "$30,000 to $40,000",
          "tier": "can't tell",
          "probability": 0.18,
          "probability_change": -0.39
        }
      ]
    },
    {
      "id": "medicaid",
      "programme": "Medicaid",
      "tier": "worth checking",
      "probability": 0.41,
      "would_change": [
        {
          "question": "earned_income",
          "kind": "amount",
          "from": "$20,000 to $30,000",
          "to": "$10,000 to $20,000",
          "tier": "likely",
          "probability": 0.65,
          "probability_change": 0.23
        }
      ]
    },
    {
      "id": "eitc",
      "programme": "Earned income tax credit",
      "tier": "unlikely",
      "probability": 0.04,
      "would_change": [
        {
          "question": "earned_income",
          "kind": "amount",
          "from": "$20,000 to $30,000",
          "to": "$10,000 to $20,000",
          "tier": "can't tell",
          "probability": 0.55,
          "probability_change": 0.51
        }
      ]
    }
  ],
  "answers_tried": 8,
  "note": "Each line changes one answer and keeps the others. It shows how close each result is to the line, so the person knows to check again if that part of their situation changes. It is not advice on what to report: answer as things are."
}

If pay changed: the cliff view

POST /v1/cliff with a state (and optionally "question", any amount question; earnings by default) gives every option of that question with the other answers kept: each program's tier, probability and typical yearly value, and the expected value by group (food and cash, tax credits, health coverage). Drops between neighbouring options are where help falls away as pay rises. Eleven options take about half a second. The screener shows food, cash and tax credits as bars and health coverage as the program that looks likely, since coverage is valued, not paid.

{
  "question": "earned_income",
  "unit": "dollars a year",
  "options": [
    {
      "option": "$10,000 to $20,000",
      "current": false,
      "expected_value": 9540,
      "by_group": {
        "food and cash": 1110,
        "tax credits": 370,
        "health coverage": 5140,
        "care and housing": 2920
      },
      "programmes": [
        "…"
      ]
    },
    {
      "option": "$20,000 to $30,000",
      "current": true,
      "expected_value": 13350,
      "by_group": {
        "food and cash": 740,
        "tax credits": 120,
        "health coverage": 4290,
        "care and housing": 8210
      },
      "programmes": [
        "…"
      ]
    },
    {
      "option": "$30,000 to $40,000",
      "current": false,
      "expected_value": 12580,
      "by_group": {
        "food and cash": 520,
        "tax credits": 60,
        "health coverage": 3330,
        "care and housing": 8670
      },
      "programmes": [
        "…"
      ]
    }
  ],
  "note": "Each bar keeps every other answer and changes only this one. Expected value is the chance of qualifying times the typical yearly amount if eligible (health coverage counted at its value, not cash). A screening estimate for planning, not a promise of any amount."
}

The order to apply in

POST /v1/plan with a state returns the programs worth applying for in three steps: apply now (SNAP, TANF, SSI, health coverage, housing), then (WIC, school meals, Head Start, Early Head Start), and at tax time (the federal and state credits). Where both programs are recommended, it names the federal rule by which one approval settles part of another's eligibility, with its citation: SNAP, Medicaid or TANF meets WIC's income test (7 CFR 246.7(d)(2)(vi)); SNAP or TANF makes children eligible for free school meals, often with no form (7 CFR 245.2 and 245.6a); TANF or SSI meets Head Start's income rule (45 CFR 1302.12(c)(1)(ii) and 1305.2); in most states SSI comes with Medicaid. The screener shows this as "Your plan" when there are three or more programs.

Put the screener on your site

One line where it should appear: <script src="https://decision-intake.vercel.app/embed.js" async></script>. Add data-lang="es" for Spanish and data-theme="light" or "dark" to match your page (by default it follows the visitor's browser). It inserts one sandboxed iframe of https://decision-intake.vercel.app/embed that grows with its content and opens every link in a new tab. Nothing is stored on your site or ours, and the embedded page sends your page only its height. Only /embed may be framed; the rest of the site refuses it.

What the household already gets

Send "already": ["snap", ...] with /v1/step, /v1/assessment or /v1/plan (or on the connector's record_facts). The list goes into the state as gets=snap+medicaid and replaces any earlier one; [] clears it. Programs on it are not recommended again in the plan, and getting SNAP is evidence: SNAP's income and asset tests say a lot about a household, so the engine weighs the households it learned from by whether the rules model makes them SNAP-eligible (DECISIONS D51). In a registered test on 991 held-out households that get SNAP, known by five fields, that cut decision mistakes on the other fourteen programs by $1,600 a household a year [95% CI 895 to 2,402]; with all eighteen answers it changed no decision. Other programs on the list are recorded and used by the plan's rules, not as evidence.

A caseload at once

POST /v1/batch takes up to 20 records, each {"id", "facts"} with what an organisation already knows, and returns for each the expected yearly value of the programs the engine would recommend now (chance times typical amount), the single best question to ask that household and its dollar worth, and a call_order, highest value first. Use your own ids, never names. In a development check on 2,000 simulated households known only by state, household size, children, an earnings bracket and rent or own, the top 20% of this order held 61% of the benefit dollars (73% without health coverage), against 20% at random and 53% for largest household first. Add "already": ["snap", ...] to a record for what the household gets now: those leave its expected value, and opened_by_rule lists the programs the federal rules open because of them, each with the rule (SNAP with a child under 5 meets WIC's income test; SNAP or TANF gives free school meals), the outreach gap a food bank can act on. The caseload page does this from a CSV in the browser, with an already column.

4. The state string

The facts so far, readable, with a checksum so a mangled copy is refused instead of misread:

di1;children=2;state=TX;earned_income=~2400/month;household_size=3;housing_cost=$1,000_to_$1,500;child_under5=no;infant_or_pregnant=no;tenure=rent;employer_insurance=no;other_income=none;social_security=none;#5034

Choices are option text (spaces as _), amounts are ~-prefixed when approximate with .. for ranges and /period, don't-know is ?, and # ends with four hex digits of a CRC-32 (a 16-bit check). It is not encrypted or signed: it holds what the person said, so treat it like the answers themselves. Send it in POST bodies, never in URLs, and don't log it. The service doesn't: its logs hold route, status and timing only. A damaged state is refused:

{
  "error": {
    "code": "bad_state",
    "message": "state is damaged (its check doesn't match); pass the exact state string from the most recent result"
  }
}

5. AI assistants (MCP)

The same engine speaks the Model Context Protocol over Streamable HTTP at https://decision-intake.vercel.app/mcp: the stateless 2026-07-28 revision, and the handshake revisions 2025-11-25, 2025-06-18 and 2025-03-26. JSON responses, no SSE stream, no sessions. The assistant does the talking and turns the person's words into facts; the engine decides what to ask and when to stop. In a registered test on 200 simulated households, Claude Haiku made 41% fewer costly mistakes with these tools than without them (unweighted; the model card has the caveats).

Claude Code

claude mcp add --transport http decisionintake https://decision-intake.vercel.app/mcp

Claude.ai and other clients

Add a custom connector with the URL https://decision-intake.vercel.app/mcp. The server's instructions tell the assistant how to run an intake. Tools (all read-only: each is a pure function of its arguments):

On the wire, 2026-07-28

No handshake. Every request names its revision in _meta and mirrors the method (and, for tools/call, the tool name) in headers that must match the body:

Content-Type: application/json
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: record_facts
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "record_facts",
    "arguments": {
      "state": "di1;#6a3a",
      "facts": [
        {
          "question": "children",
          "choice": "2"
        },
        {
          "question": "state",
          "choice": "TX"
        },
        {
          "question": "earned_income",
          "amount": {
            "value": 2400,
            "period": "month",
            "approximate": true
          }
        }
      ]
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}
{
  "result": {
    "resultType": "complete",
    "structuredContent": {
      "state": "di1;children=2;state=TX;earned_income=~2400/month;#d883",
      "readings": "...",
      "next": {
        "action": "ask",
        "...": "..."
      }
    },
    "isError": false,
    "_meta": {
      "io.modelcontextprotocol/serverInfo": {
        "name": "decisionintake",
        "version": "1.1.0"
      }
    }
  }
}

Start with server/discover for the supported revisions and instructions. Protocol errors: -32022 (unsupported revision, with the supported list), -32020 (header and body disagree), -32602 (missing _meta, arguments that aren't an object, unknown tool), -32601 with HTTP 404 (unknown method). A fact or state the engine can't use is not a protocol error: the tool result comes back with isError: true and a message saying how to fix it, so the assistant can correct itself.

On the wire, handshake revisions

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-11-25",
    "capabilities": {},
    "clientInfo": {
      "name": "my-agent",
      "version": "1.0"
    }
  }
}

Then tools/list and tools/call with an MCP-Protocol-Version header. No Mcp-Session-Id is issued: the state travels in the tool arguments.

6. Code

JavaScript

const BASE = "https://decision-intake.vercel.app";
async function step(state, facts) {
  const r = await fetch(BASE + "/v1/step", {
    method: "POST", headers: {"Content-Type": "application/json"},
    body: JSON.stringify({state, facts})
  });
  if (!r.ok) throw new Error((await r.json()).error.message);
  return r.json();
}

// askThePerson, explain and showResults are your UI (placeholders)
let {state, next} = await step(undefined, []);           // start
while (next.action === "ask") {
  const fact = await askThePerson(next.question, next.why); // a choice, an amount as said, or don't know
  const r = await step(state, [fact]);
  const problem = r.readings.find(x => x.error);
  if (problem) { explain(problem.error); continue; }      // nothing recorded: keep the state, ask again
  ({state, next} = r);
}
showResults(next);   // recommend, unsure, note; next.action === "hand_off" adds hand_off_reason

Python, standard library only

import json, urllib.request

BASE = "https://decision-intake.vercel.app"

def step(state=None, facts=()):
    body = {"facts": list(facts)}
    if state:
        body["state"] = state
    req = urllib.request.Request(BASE + "/v1/step", method="POST",
        data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json"})
    with urllib.request.urlopen(req) as r:
        return json.load(r)

r = step(facts=[{"question": "state", "choice": "TX"},
                {"question": "earned_income", "amount": {"value": 2400, "period": "month"}}])
print(r["next"]["action"], r["next"].get("question", {}).get("id"))

curl

curl -s https://decision-intake.vercel.app/v1/step -H 'Content-Type: application/json' \
  -d '{"facts":[{"question":"children","choice":"2"}]}'

7. Integration checklist

8. Errors, limits and versions

Errors are JSON: {"error": {"code", "message"}}. A fact that can't be read doesn't fail the call (section 2).

StatusWhen
200success; for the MCP handshake revisions also JSON-RPC errors such as -32601 and -32602, and tool results with isError
202MCP notification accepted
400bad_json, bad_request, bad_state (damaged state, or one written for another question set); on /mcp: unparseable JSON (-32700), an MCP-Protocol-Version this server doesn't speak (-32022), and the 2026-07-28 errors above
403MCP: a browser Origin this server doesn't accept; a server run on localhost also refuses requests whose Host isn't localhost (forbidden_host)
404, 405no such route, or on /mcp (2026-07-28) an unknown method; wrong method (MCP is POST only)
413, 415body over 64 KB; not application/json
429more than 120 requests a minute from one IP address to /v1/* or /mcp; wait a minute
500internal; nothing about the failure is returned, the server log keeps it
LimitValue
Request body64 KB
Facts in one call40
State string2,000 characters
Amountsnumbers from 0 to 1,000,000,000
Rate120 requests a minute per IP address on /v1/* and /mcp (a whole screening is about 10)
Latencyabout 300 ms of server time a step; the first call after a quiet spell adds about a second

Cross-origin use. The JSON API answers any origin (no credentials are involved). /mcp serves clients that send no Origin (server-side assistants and tools) and browsers from this site or localhost; ask in the repository if a browser client elsewhere needs it.

Versions. The engine is 1.1.0; /healthz reports it with the commit and the model and rules hashes. A state stays readable across deployments while the questions and their options are unchanged. A release that changes them makes older states bad_state: start again (the public screener does this for you). Breaking changes to the API move the major version. This is a free research service with no uptime guarantee; a monitor checks it after every deploy and on a 30-minute schedule.

Full schema: openapi.json. Evaluation, decisions and their tests: the repository.