From 9fd15441e3cd50c284ae639d1729a963df3232ef Mon Sep 17 00:00:00 2001 From: vahid-ahmadi Date: Wed, 12 Aug 2026 14:47:59 +0100 Subject: [PATCH] Act on the fresh review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrong or misleading: - "They fall into one of five types" — plural subject, singular predicate. The Markdown had it right; the page had regressed. - "without switching tools" contradicted the section above it, which is about the model switching between 21 tools. The point is that the reader does not leave the conversation. - The worked-example chip omitted "Child Benefit" and the requested output, while stage 1 claimed to extract both from "the user's exact words" and stage 2 bound a Child Benefit parameter from wording that was not shown. - "gateway route" and "full lifecycle" rendered as code chips styled exactly like validate_reform, so they read as public tool names. They are not. - Tax revenue rising on a benefit increase reads as a sign error; say that the High Income Child Benefit Charge is why. - content/current-article.md had drifted badly: three sections missing and a different results table. Regenerated from the page, and the README no longer calls it canonical, because a hand-synced duplicate will drift again. Accessibility: - --text-light was #7a9494, 3.2:1 on white, below the 4.5:1 minimum, and it carried the results-table caveat and every card meta line. - The six stages were spans, so they could not be navigated by heading, and their sections had no accessible name. - The boundary diagram scaled its labels to about 3.5px on a phone because max-width: 100% stopped the container's overflow-x from ever engaging. - Keyboard focus on a tool chip looked identical to selection, so two chips read as active at once while tabbing. - The question panel's live region re-announced content the tab change had already announced. Also: capped the measure at 78ch (it ran to ~140 characters a line), added a publication date to a piece whose figures are version-pinned, dropped the timeline's hover affordances since it has no click handler, set lang="en-GB", and removed instructional filler and meta-commentary. Left alone deliberately: the CTA host, the absence of a UK Chat evaluation, and the gap between a deterministic gate and the model-generated plan it runs on. Those are editorial calls. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 6 +- content/current-article.md | 184 ++++++++++++++++++++++++++--------- index.html | 2 +- src/App.jsx | 73 ++++++++------ src/legacy-encode-policy.css | 2 +- src/uk-chat.css | 59 +++++++++++ 6 files changed, 243 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 1b2fa35..472470c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # PolicyEngine UK Chat interactive article -A standalone interactive version of “PolicyEngine UK Chat: a new conversational interface for understanding tax -and benefits”. +A standalone interactive version of “PolicyEngine UK Chat: an AI interface for tax and benefits”. The presentation structure is adapted from PolicyEngine's interactive “Automating Tax and Benefit Policy Modeling with Multi-Agent AI” article. Its original, editable React source is the @@ -12,7 +11,8 @@ with Multi-Agent AI” article. Its original, editable React source is the - adapts the original article's scrollytelling structure and committed production stylesheet; - keeps the new implementation as maintainable React source; - replaces the original narrative, interactive data, and diagrams with the current UK Chat article; -- keeps the current Markdown article in `content/current-article.md` as the canonical editorial reference. +- keeps a Markdown copy of the article prose in `content/current-article.md` for editorial review. The + page in `src/` is canonical; regenerate the Markdown when the prose changes rather than editing both. The exact production files committed for the older article are preserved byte-for-byte in `reference/encode-policy-original/`. They are reference artefacts, not the editable source of this app. diff --git a/content/current-article.md b/content/current-article.md index 32d9b44..6178c8b 100644 --- a/content/current-article.md +++ b/content/current-article.md @@ -1,68 +1,126 @@ # PolicyEngine UK Chat: an AI interface for tax and benefits -_Introducing PolicyEngine’s newest AI-powered tool to help users understand UK tax and benefit policy_ +_Introducing PolicyEngine's newest AI-powered tool to help users understand UK tax and benefit policy_ + +_11 August 2026_ People are increasingly turning to AI language models to answer complex questions about tax and benefit policy and reform because models can read loosely worded questions and answer them in plain language. This presents a problem: for many users, tax and benefit questions directly affect their lives and livelihoods, so they require correct, verifiable answers. Language models generate responses from learned statistical patterns, and an answer may be partly or wholly wrong. -PolicyEngine therefore built UK Chat, an AI interface to PolicyEngine’s deterministic rules and simulation engine. A language model interprets an open-ended request and proposes a structured plan. The gateway checks the proposed inputs and output against the current PolicyEngine catalogue; only then do deterministic tools compute quantitative policy results from actual tax and benefit rules. +PolicyEngine therefore built UK Chat, an AI interface to PolicyEngine's deterministic rules and simulation engine. A language model interprets an open-ended request and proposes a structured plan. The gateway checks the proposed inputs and output against the current PolicyEngine catalogue; only then do deterministic tools compute quantitative policy results from actual tax and benefit rules. ## Separating calculation -A language model generates text by [predicting continuations](https://en.wikipedia.org/wiki/Large_language_model), not by applying tax and benefit rules. Ask one what Universal Credit (UC) a lone parent receives and it may return a number without factoring in UC’s income-based taper rate, work allowance, or the rates that apply to the household’s circumstances. +A language model generates text by predicting continuations, not by applying tax and benefit rules. Ask one what Universal Credit (UC) a lone parent receives and it may return a number without factoring in UC's income-based taper rate, work allowance, or the rates that apply to the household's circumstances. + +Prompting does not make a model apply tax and benefit rules. Telling it to state only “real” figures changes the wording, not the source of the calculation. The answer reads the same whether it is right or wrong, so prose alone cannot verify it. The UK Parliament's Parliamentary Office of Science and Technology has noted that confidently presented AI output can make errors difficult to challenge. + +This matters when results inform decisions, as the National Audit Office's review of AI in government illustrates. Anyone comparing two reforms needs figures from a fixed model, not an AI's recollection of figures it has seen. The same applies to a household working out how a reform affects its income: the figure has to come from clear rules, with assumptions written down, so that it can be checked. + +We have measured this directly. In PolicyBench, an evaluation built on the US tax and benefit system, we scored how accurately AI models compute taxes and benefits from household prompts with no tools and no lookups, against deterministic PolicyEngine outputs. In the launch results the top model matched PolicyEngine exactly on 80.3% of its scored outputs. Computed amounts scored lowest: income tax before credits scored far below eligibility flags, because getting it right means sequencing income concepts, thresholds, exclusions, and credits in the correct order. + +## The boundary + +The central design decision is where the predictive layer stops and the deterministic layer starts. -Prompting does not make a model apply tax and benefit rules. Telling it to state only “real” figures changes the wording, not the source of the calculation. The answer reads the same whether it is right or wrong, so prose alone cannot verify it. The UK Parliament’s [Parliamentary Office of Science and Technology](https://post.parliament.uk/research-briefings/post-pn-0708/) has noted that confidently presented AI output can make errors difficult to challenge. +The predictive parts are interpreting wording, deciding which kind of analysis is being requested, drafting the explanation, and suggesting a follow-up. Those tasks are open-ended and language-heavy. -This matters when results inform decisions, as the [National Audit Office’s review of AI in government](https://www.nao.org.uk/reports/use-of-artificial-intelligence-in-government/) illustrates. Anyone comparing two reforms needs figures from a fixed model, not an AI’s recollection of figures it has seen. The same applies to a household working out how a reform affects its income: the figure has to come from clear rules, with assumptions written down, so that it can be checked. +The deterministic parts are the ones users need to be able to check: validating the request, looking up parameters, constructing household inputs, running simulations, computing weighted outputs, and producing chart data. None of these depends on model memory. The runtime enforces the boundary rather than asking the model to respect it in a prompt. + +When a question is ready for computation, the model receives the calculation tools plus a reference generated from the installed engine: the engine's capabilities and parameter schema. What the model can be asked to compute is therefore tied to the deployed version of PolicyEngine, not to a hand-written prompt that drifts out of date. + +The gateway sits on that line. It takes the plan the model proposes and decides whether it may cross into the deterministic side, which is why the system has three parts rather than two: the model, the gateway, and the tools a plan reaches once the gateway admits it. ## The model proposes a plan UK Chat breaks the user pathway into three segments: the AI model, the gateway, and supporting tools. -First, the AI language model does the predictive work it excels at. It takes the user’s open-ended natural-language prompt and develops a simulation or analysis plan. This plan has a required format and must use one or more deterministic tools that are directly connected to the PolicyEngine UK tax and benefit simulation engine. +First, the language model does the predictive work. It takes the user's open-ended prompt and develops a simulation or analysis plan. The plan has a required format and must use one or more of the deterministic tools connected to the PolicyEngine UK tax and benefit simulation engine. -Next, UK Chat’s gateway verifies and sometimes constrains that plan to ensure PolicyEngine provides the tools required to answer the question. The gateway may also ask the user for clarification before finalising a plan. +Next, UK Chat's gateway verifies and sometimes constrains that plan to ensure PolicyEngine provides the tools required to answer the question. The gateway may also ask the user for clarification before finalising a plan. ## Tools make the calculation deterministic -At this point, UK Chat has a gateway-verified plan. This plan relies on one or more deterministic tools so every figure displayed to a user is rooted in verifiable calculations rather than language-model predictions. +At this point, UK Chat has a gateway-verified plan, and every figure in the answer comes from the tools that plan calls rather than from the model. + +The tools UK Chat exposes to the model are limited in scope. They fall into five types, each keeping the model within supported operations while it creates, verifies, or executes a plan. + +### Discovery (9 tools) + +Find exact variables, parameters, entities, reform targets, and supported outputs. Discovery keeps the model from guessing the names of things in PolicyEngine. + +`list_entities`, `search_variables`, `get_variable`, `search_parameters`, `get_parameter`, `list_reform_targets`, `list_household_input_variables`, `list_society_output_variables`, `list_supported_outputs` + +### Validation (2 tools) + +Check reform JSON and synthetic household inputs before calculation. Validation turns malformed inputs into explicit errors rather than plausible-looking results. + +`validate_reform`, `validate_household` + +### Simulation (2 tools) + +Run one illustrative household or a reform across the modelled UK population. These tools apply the tax and benefit rules and return turn-local result handles. + +`run_household_simulation`, `run_society_simulation` + +### Analysis (7 tools) + +Turn a society simulation into specific, weighted policy results. Dedicated derivatives calculate budget, programme, decile, poverty, inequality, and gain-or-loss results. + +`compute_budgetary_impact`, `compute_program_breakdown`, `compute_decile_impacts`, `compute_winners_losers`, `compute_poverty_metrics`, `compute_inequality_metrics`, `aggregate_result` + +### Presentation (1 tool) + +Build a chart from a calculation result using a constrained chart schema. Charts are constructed from stored results, so the displayed artefact stays tied to the calculation. -UK Chat’s model-facing tools are narrow by design. The tools fall into five types, each used to keep the model within supported operations while creating, verifying, or executing a plan. The interactive article lets readers explore each category and select individual tools for a one-sentence description. +`generate_chart` ## Under the hood -Here’s what happens inside a single request. UK Chat’s core runtime is a FastAPI server-sent-events handler that calls the Anthropic SDK directly. There is no generic agent framework in the request path. The chat owns both the opening gateway and the tool loop, so the rules that matter can be enforced at the point where each decision is made. Each stage below is tagged with the segment that owns it. +Here's what happens inside a single request. UK Chat's core runtime is a FastAPI server-sent-events handler that calls the Anthropic SDK directly. There is no generic agent framework in the request path. The chat owns both the opening gateway and the tool loop, so the rules that matter can be enforced at the point where each decision is made. Each stage below is tagged with the segment that owns it. -### 1 Ground — A structured opening plan (AI model) +### 1. Ground — A structured opening plan -A fast model reads the user’s words and proposes a structured description of the request. It separates inputs the user actually supplied from the output they asked for and suggests which tools may be needed. This is an interpretation, not yet permission to calculate. +_AI model_ -### 2 Resolve — Current catalogue evidence (Gateway) +A fast model reads the user's words and proposes a structured description of the request. It separates inputs the user supplied from the output they asked for and suggests which tools may be needed. This is an interpretation, not yet permission to calculate. -The gateway checks named policies, variables, and requested outputs against PolicyEngine’s current catalogue. Exact and strong matches can support the plan; fuzzy matches remain suggestions rather than facts. +### 2. Resolve — Current catalogue evidence -It then refines the plan with the relevant tool inputs and declared defaults—for example, using the current year when the user does not name one. Any choice the system cannot resolve safely stays explicit instead of being silently invented. +_Gateway_ -### 3 Gate — Five deterministic outcomes (Gateway) +The gateway checks named policies, variables, and requested outputs against PolicyEngine's current catalogue. Exact and strong matches can support the plan; fuzzy matches remain suggestions rather than facts. -The gateway applies fixed policy to the grounded, catalogue-backed plan and assigns one of five outcomes. Only a **ready** request may enter the calculation loop. +It then refines the plan with the relevant tool inputs and declared defaults — for example, using the current year when the user does not name one. Any choice the system cannot resolve safely stays explicit instead of being silently invented. -- **Ready:** the request is complete and supported, so calculation can begin. -- **Needs plan:** a required choice is missing, so the chat asks a clarifying question. -- **Partial:** the request mixes supported and unsupported outputs, so the chat offers the supported part. -- **Out of scope:** the requested policy output cannot be modelled, so calculation tools stay closed. -- **Irrelevant:** the request is unrelated to UK tax and benefit policy and takes a lightweight response path. +### 3. Gate — Five deterministic outcomes -### 4 Verify — Exact reform construction (Gateway) +_Gateway_ -A society-wide reform receives a second bounded check. The resolver searches the rules engine’s current reform targets, binds the user’s wording to an exact parameter path and date, and constructs reform JSON. The validator must accept that construction before a simulation can run. +The gateway applies fixed policy to the grounded, catalogue-backed plan and assigns one of five outcomes. Only a ready request may enter the calculation loop. -### 5 Calculate — A bounded 21-tool runtime (Supporting tools) +- Ready: the request is complete and supported, so calculation can begin. +- Needs plan: a required choice is missing, so the chat asks a clarifying question. +- Partial: the request mixes supported and unsupported outputs, so the chat offers the supported part. +- Out of scope: the requested policy output cannot be modelled, so calculation tools stay closed. +- Irrelevant: the request is unrelated to UK tax and benefit policy and takes a lightweight response path. -A model selected for the request’s type and size executes the verified plan through one or more of 21 public tools. Simulation tools apply the tax and benefit rules; analysis tools derive budget, programme, distributional, poverty, inequality, or gain-and-loss results from a stored simulation. +### 4. Verify — Exact reform construction + +_Gateway_ + +A society-wide reform receives a second bounded check. The resolver searches the rules engine's current reform targets, binds the user's wording to an exact parameter path and date, and constructs reform JSON. The validator must accept that construction before a simulation can run. + +### 5. Calculate — A bounded 21-tool runtime + +_Supporting tools_ + +A model selected for the request's type and size executes the verified plan through one or more of 21 public tools. Simulation tools apply the tax and benefit rules; analysis tools derive budget, programme, distributional, poverty, inequality, or gain-and-loss results from a stored simulation. The model chooses and sequences tools, but it does not supply the figures. Each number comes back as tool data produced by the PolicyEngine UK model. -### 6 Stream — An inspectable response (Gateway) +### 6. Stream — An inspectable response + +_Gateway_ The gateway streams text chunks, tool starts, tool inputs, completion summaries, and the final answer as server-sent events. The interface can therefore show what the system tried and which computations completed while the answer is being produced. @@ -74,41 +132,75 @@ Consider: “For 2026, set the Child Benefit eldest-child rate to £30 a week an ### User request -For 2026, set the eldest-child rate to £30 a week +> For 2026, set the Child Benefit eldest-child rate to £30 a week and show the annual budgetary impact -1. **Ground (AI model)** — Extract £30 a week, 2026, and budgetary impact from the user’s exact words, while keeping the proposed plan separate from verified facts. -2. **Resolve (Gateway)** — Bind “eldest-child rate” to `gov.hmrc.child_benefit.amount.eldest` in the current catalogue and confirm that budgetary impact is supported. -3. **Gate (Gateway)** — Classify the plan as ready because its required policy, value, year, and output are present and supported. Only this outcome opens the calculation loop. -4. **Verify (Gateway)** — Construct an exact reform effective 1 January 2026 that sets the parameter to `30.0`, then validate it against the PolicyEngine UK rules engine. -5. **Calculate (Supporting tools)** — Run current law and the approved reform on the same population with `run_society_simulation`, then pass the stored result to `compute_budgetary_impact`. -6. **Stream (Gateway)** — Stream the calculation trace and final answer with the comparator, dataset, method, and sign convention attached so the result can be inspected. +1. **Ground** — _AI model_ — £30 a week, 2026, budgetary impact. Extract the requested value, policy year, and output from the user’s exact words, while keeping the proposed plan separate from verified facts. +2. **Resolve** — _Gateway_ — catalogue search, exact parameter. Bind “eldest-child rate” to gov.hmrc.child_benefit.amount.eldest in the current catalogue and confirm that budgetary impact is supported. +3. **Gate** — _Gateway_ — ready, all inputs explicit. Classify the plan as ready because its required policy, value, year, and output are present and supported. Only this outcome opens the calculation loop. +4. **Verify** — _Gateway_ — effective 1 January 2026, validate_reform. Construct an exact dated reform that sets the parameter to 30.0 pounds per week, then validate it against the PolicyEngine UK rules engine before simulation. +5. **Calculate** — _Supporting tools_ — run_society_simulation, compute_budgetary_impact. Run current law and the approved reform on the same population, store the result, and pass its handle to the budgetary-impact derivative. +6. **Stream** — _Gateway_ — tool events, method and result. Stream the calculation trace and final answer with the comparator, dataset, method, and sign convention attached so the result can be inspected. -### Computed result +### Computed result: About £0.9 billion a year in additional government cost -A production run compares the reform with 2026 current law using PolicyEngine’s Enhanced Family Resources Survey dataset for 2024–25, release 1.56.13. It is a direct static microsimulation estimate. +A production run compares the reform with 2026 current law using PolicyEngine's Enhanced Family Resources Survey dataset for 2024–25, release 1.56.13. It is a direct static microsimulation estimate. Tax revenue rises because a higher Child Benefit rate increases the High Income Child Benefit Charge paid by higher-income families. -| Annual change relative to current law | Change | -| ------------------------------------- | ------------------: | -| Tax revenue | +£181.0 million | -| Benefit spending | +£1.131 billion | -| **Net budgetary impact** | **−£949.7 million** | +| Measure | Change | +| -------------------- | ------------- | +| Tax revenue | +£0.2 billion | +| Benefit spending | +£1.1 billion | +| Net budgetary impact | −£0.9 billion | -A negative net budgetary impact means a cost to government: about £950 million a year in this run. Figures are rounded, so displayed components may not sum exactly. +A negative net budgetary impact means a cost to government. Figures are rounded to the nearest £0.1 billion. If the catalogue returned more than one materially plausible interpretation, or the reform resolver could not determine what year or reform the user was requesting, the calculation would pause before the tool loop and ask the user to confirm the intended construction. +## What you can ask + +The Child Benefit reform above is one of four kinds of question supported today. A single thread can move between them — from a household example, to a full reform analysis, to a chart — without the reader leaving the conversation. + +### Households — Illustrative calculations + +> A single parent, two children, earning £28,000 — what do they take home? + +The household is constructed as a synthetic input, validated, and run through the model to produce taxes, benefits, and net income under stated assumptions. One household containing one benefit unit per call; more complex arrangements need separate calls. + +`list_household_input_variables`, `validate_household`, `run_household_simulation` + +### Reforms — Population-wide impact + +> How much does raising the personal allowance by £2,000 cost, and who gains? + +Parametric reforms run across the modelled UK population: budgetary impact, programme-level changes, poverty measures, decile impacts, winners and losers, and weighted caseload counts, each from its own derivative tool. + +`validate_reform`, `run_society_simulation`, `compute_budgetary_impact` + +### Charts — Computed outputs, drawn + +> Show me that by decile. + +When a comparison reads better as a picture than as prose, the computed output is mapped onto a fixed chart preset. The chart is drawn from the same typed result as the text, so the two cannot disagree. + +`generate_chart` + +### Follow-ups — One continuous thread + +> And what if I made it £3,000 instead? + +Follow-ups stay in the same thread. The conversation carries the context; the simulation handles do not. Each turn re-runs what it needs, so a later answer never quietly rests on an earlier turn’s in-memory state. + ## Limitations -The chat is a modelling tool, not advice. It reports what the model calculates under stated assumptions, and it is not a substitute for professional guidance on an individual’s circumstances. +The chat is a modelling tool, not advice. It reports what the model calculates under stated assumptions, and it is not a substitute for professional guidance on an individual's circumstances. Society results are direct static microsimulation estimates. They do not estimate behavioural responses, employment effects, inflation, GDP, market reactions, or general-equilibrium effects. When a request mixes a supported policy result with one of those effects, the gateway notifies the user that it cannot calculate these effects, then proceeds with what it can. Results depend on the dataset, year, and modelling assumptions, and the chat states these dependencies rather than presenting figures as universal. They should still be checked against independent estimates from organisations such as the Institute for Fiscal Studies, Resolution Foundation, or Office for Budget Responsibility. -## What’s next +## What's next -We want to widen the range of reforms covered by typed tools, improve the speed and inspectability of more specialised analyses, and keep expanding the evidence the gateway can resolve before calculation. UK Chat also works alongside PolicyEngine’s wider Claude integration and plugin ecosystem for researchers building their own analyses. +We want to widen the range of reforms covered by typed tools, improve the speed and inspectability of more specialised analyses, and keep expanding the evidence the gateway can resolve before calculation. UK Chat also works alongside PolicyEngine's wider generative AI integrations and plugin ecosystem for researchers building their own analyses. ## Try it yourself -UK Chat’s answers can be cited and reproduced because the figures come from the same open engine that powers the rest of PolicyEngine. [Try it with a reform you care about](https://policyengine-uk-chat.vercel.app/uk/chat), then inspect the stated year, dataset, comparator, and method alongside the answer. +UK Chat's answers can be cited and reproduced because the figures come from the same open engine that powers the rest of PolicyEngine. Try it with a reform, then inspect the stated year, dataset, comparator, and method alongside the answer. diff --git a/index.html b/index.html index 404c23d..a2ad20b 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + diff --git a/src/App.jsx b/src/App.jsx index 2e51e85..1392a63 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -174,7 +174,7 @@ const questionKinds = [ question: 'And what if I made it £3,000 instead?', description: 'Follow-ups stay in the same thread. The conversation carries the context; the simulation handles do not. Each turn re-runs what it needs, so a later answer never quietly rests on an earlier turn’s in-memory state.', - tools: ['gateway route', 'full lifecycle'], + tools: [], }, ]; @@ -222,8 +222,8 @@ const requestSteps = [ rather than facts.

- It then refines the plan with the relevant tool inputs and declared defaults—for example, using the - current year when the user does not name one. Any choice the system cannot resolve safely stays + It then refines the plan with the relevant tool inputs and declared defaults — for example, using + the current year when the user does not name one. Any choice the system cannot resolve safely stays explicit instead of being silently invented.

@@ -343,6 +343,9 @@ function Hero() { Introducing PolicyEngine's newest AI-powered tool to help users understand UK tax and benefit policy

+

+ +

); } @@ -614,15 +617,14 @@ function Boundary() {

When a question is ready for computation, the model receives the calculation tools plus a reference - generated from the installed engine: its capabilities and its parameter schema. What the model - believes it can compute is therefore tied to the deployed version of PolicyEngine, not to a + generated from the installed engine: the engine's capabilities and parameter schema. What the model + can be asked to compute is therefore tied to the deployed version of PolicyEngine, not to a hand-written prompt that drifts out of date.

- The gateway is what sits on that line. It takes the plan the model proposes and decides whether it may - cross into the deterministic side. That is why the rest of this article describes the system in three - parts rather than two: the model, the gateway, and the tools a plan reaches once the gateway admits - it. + The gateway sits on that line. It takes the plan the model proposes and decides whether it may cross + into the deterministic side, which is why the system has three parts rather than two: the model, the + gateway, and the tools a plan reaches once the gateway admits it.

); @@ -729,9 +731,8 @@ function ToolExplorer() {

First, the language model does the predictive work. It takes the user's open-ended prompt and - develops a simulation or analysis plan. This plan has a required format and is required to use one or - more deterministic tools (more on those later) that are directly connected to the PolicyEngine UK tax - and benefit simulation engine. + develops a simulation or analysis plan. The plan has a required format and must use one or more of the + deterministic tools connected to the PolicyEngine UK tax and benefit simulation engine.

Next, UK Chat's gateway verifies and sometimes constrains that plan to ensure PolicyEngine @@ -741,14 +742,12 @@ function ToolExplorer() {

Tools make the calculation deterministic

- At this point, UK Chat has a gateway-verified plan. This plan relies on one or more deterministic - tools that UK Chat exposes to ensure that every figure displayed to a user is rooted in verifiable - calculations rather than language-model predictions. + At this point, UK Chat has a gateway-verified plan, and every figure in the answer comes from the + tools that plan calls rather than from the model.

- The tools UK Chat exposes to the model are limited in scope. They fall into one of five types, each - used to keep the model within supported operations while creating, verifying, or executing a plan. - Explore these categories in the interactive below. + The tools UK Chat exposes to the model are limited in scope. They fall into five types, each keeping + the model within supported operations while it creates, verifies, or executes a plan.

(
{step.number} - {step.title} +

+ {step.title} +

{step.subtitle}
{step.segment} @@ -1039,7 +1041,7 @@ function WorkedExample() { segment: 'Gateway', agents: ['effective 1 January 2026', 'validate_reform'], description: - 'Construct an exact dated reform that sets the parameter to 30.0, then validate it against the PolicyEngine UK rules engine before simulation.', + 'Construct an exact dated reform that sets the parameter to 30.0 pounds per week, then validate it against the PolicyEngine UK rules engine before simulation.', }, { number: 5, @@ -1070,7 +1072,10 @@ function WorkedExample() {
User request
-
For 2026, set the eldest-child rate to £30 a week
+
+ For 2026, set the Child Benefit eldest-child rate to £30 a week and show the annual budgetary + impact +
{phases.map((phase) => ( @@ -1105,7 +1110,8 @@ function WorkedExample() {

A production run compares the reform with 2026 current law using PolicyEngine's Enhanced Family Resources Survey dataset for 2024–25, release 1.56.13. It is a direct static microsimulation - estimate. + estimate. Tax revenue rises because a higher Child Benefit rate increases the High Income Child + Benefit Charge paid by higher-income families.

@@ -1155,8 +1161,9 @@ function WhatYouCanAsk() {

What you can ask

- The Child Benefit reform above is one of four kinds of question supported today, and they compose: a - thread can move from a household example to a full reform analysis to a chart without switching tools. + The Child Benefit reform above is one of four kinds of question supported today. A single thread can + move between them — from a household example, to a full reform analysis, to a chart — without the + reader leaving the conversation.

)} > -
+

“{activeKind.question}”

{activeKind.description}

-
- {activeKind.tools.map((tool) => ( - - {tool} - - ))} -
+ {activeKind.tools.length > 0 && ( +
+ {activeKind.tools.map((tool) => ( + + {tool} + + ))} +
+ )}
diff --git a/src/legacy-encode-policy.css b/src/legacy-encode-policy.css index b740517..e49c566 100644 --- a/src/legacy-encode-policy.css +++ b/src/legacy-encode-policy.css @@ -7,7 +7,7 @@ --accent-mid: rgba(13, 115, 119, 0.2); --text-dark: #1e3a3a; --text-mid: #4a6363; - --text-light: #7a9494; + --text-light: #5d7a7a; --border: #d4dede; --border-accent: rgba(13, 115, 119, 0.4); --warning: #b45309; diff --git a/src/uk-chat.css b/src/uk-chat.css index 73a6241..8c2de37 100644 --- a/src/uk-chat.css +++ b/src/uk-chat.css @@ -593,3 +593,62 @@ transition-duration: 0.01ms !important; } } + +/* #7a9494 measured 3.2:1 on white, below the 4.5:1 minimum, and it carried the + results-table caveat and every card meta line. Darkened at the token in + legacy-encode-policy.css; these are the knock-on fixes. */ + +/* 18px serif across a 1160px wrapper runs to ~140 characters a line. Cap the + measure without narrowing the diagrams, tables, and card grids. */ +.article-wrapper > div > p, +.article-wrapper > div > ul, +.article-wrapper > div > ol, +.article-wrapper .step-content p, +.article-wrapper .subtitle { + max-width: 78ch; +} + +.article-date { + color: var(--text-mid); + font-family: 'JetBrains Mono', monospace; + font-size: 0.78rem; + letter-spacing: 0.04em; + margin-top: -34px; + margin-bottom: 50px; + text-transform: uppercase; +} + +/* max-width: 100% stopped .agent-flow-container's overflow-x from ever + engaging, so on a phone the 900-unit diagram shrank its labels to ~3.5px. + A min-width lets the container scroll instead. */ +.boundary-flow-svg { + min-width: 620px; +} + +/* Keyboard focus looked identical to the selected tool, so two chips read as + active at once while tabbing. */ +.tool-name-button:focus-visible { + background: #fff; + border-color: var(--accent); + color: var(--accent); + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.tool-name-button.active:focus-visible { + background: var(--accent); + color: #fff; +} + +/* The worked-example timeline advertises clickability it does not have. */ +.timeline-phase-header:hover { + transform: none; +} + +.timeline-phase-header:hover .timeline-phase-num { + box-shadow: 0 4px 15px #0d73774d; +} + +.timeline-phase-card:hover { + border-color: var(--border); +}