Learn
Understand Niyam in ten minutes, with no background
What is Niyam, in one paragraph?
Governments in India publish their welfare rules as orders, often PDF files in Marathi or Hindi. Apps, helplines and field workers then have to copy those rules by hand, and they often fall behind. Niyam is an AI helper that reads each new order, works out exactly what changed, updates one open set of rules with tests, and has a second AI check the work. A person approves anything risky. Anyone can then check their eligibility, and every answer shows the sentence of the government order it comes from.
What is a welfare scheme?
A government programme that gives people money, food, services or support if they meet certain conditions, such as age, income or where they live. Those conditions are called eligibility rules. For example, the Ladki Bahin scheme in Maharashtra pays eligible women Rs 1,500 a month.
What is a GR?
A Government Resolution is an official order from a state government department. GRs create schemes and change their rules: raising an age limit, changing an income ceiling, adding or removing a condition. Maharashtra publishes them as PDF files, mostly in Marathi, on its GR portal. Each has an 18-digit code, for example 202407031335114330.
What does "rules as code" mean?
Writing the rules of a scheme as a small computer program instead of only as text. The program applies the rules the same way every time, can be tested with example people, and can be read by anyone. Governments in France, New Zealand, Canada and elsewhere have explored this. Niyam stores rules as readable YAML files, in the format of OpenFisca, an open-source project, with a start date and a source for every value.
What is an AI agent, and how is it different from a chatbot?
A chatbot answers a question. An agent is given a goal and works towards it on its own: it plans steps, uses tools (reading files, running tests, opening change requests), looks at the results, and decides what to do next, including how to recover when something fails. Niyam's goal is: keep the rulebook in line with every new government order.
What is a trace?
A step-by-step recording of everything an agent did in one run: every AI model call, every tool, every retry, how long each took and what it cost. Niyam uses neatlogs for this. Traces are how we found and fixed a costly loop in version 1.
What is a checkpoint?
When code changes, the change itself is saved in git, but the reasoning behind it usually is not. Entire saves the AI agent's whole working session (what it was asked, what it read, what it tried) and links it to the code change. In Niyam, that means every rule has a record of why it says what it says.
How does Niyam check its own work?
A second agent, which never sees the code change, reads the government order and writes its own test people: "a 65-year-old woman with an income of Rs 2 lakh should be eligible". Those people are run through the new rules. If the two agents disagree, a coordinator rereads the clause and either fixes the rules or asks a human.
When does Niyam ask a human?
Whenever a clause is unclear, the two agents still disagree, confidence is below 0.90, or a change would remove people from a scheme. Only simple changes, such as a new amount or date with every check agreeing, are merged automatically. See the trust policy.
Why does this matter? Lessons from Robodebt and Samagra Vedika
In Australia, the Robodebt scheme used code that did not match the law and sent unlawful debt notices to hundreds of thousands of people; it led to a Royal Commission. In Telangana, the Samagra Vedika system cancelled more than 1.8 million food cards, and officials often deferred to the machine. In both cases, the people affected could not see why the system decided as it did. Niyam is built the other way round: every rule is open, sourced, tested and explained.
Glossary
- Agent
- Software that takes a goal, plans steps, uses tools and checks its own work.
- API
- A way for other software to ask Niyam questions over the internet.
- API key
- A secret code that identifies an app using the API.
- Boundary case
- A test exactly at a limit, such as age 65 when the limit is 65.
- Checkpoint
- The saved reasoning behind a code change (Entire).
- Citation
- The exact words, page and clause of a government order that a rule comes from.
- Confidence
- Niyam's score from 0 to 1 for how sure it is that a change is correct.
- Eligibility
- Whether a person meets the conditions of a scheme.
- Encode
- Turn a rule written in words into rule code.
- Evaluation
- A test of the whole agent on documents with known correct answers.
- GR
- Government Resolution: an official order from a state department.
- MCP
- Model Context Protocol: a standard way for AI assistants to use tools.
- OCR or transcription
- Turning a scanned page (an image) into text.
- Parameter
- A number or list in a rule that can change over time, such as the maximum age.
- Pull request
- A proposed change to code that can be reviewed before it is accepted.
- Rulebook
- The collection of all encoded rules, with tests and sources.
- Trace
- A step-by-step record of an agent run (neatlogs).
- Triage
- Quickly deciding whether a document matters.
- Verifier
- The independent agent that checks new rules against the law.
- Webhook
- A message Niyam can send to your system when a rule changes.
References
- Merigoux, Chataing, Protzenko, Catala: A Programming Language for the Law, 2021: encoding French benefits found a bug in the official implementation.
- OECD OPSI, Cracking the Code: Rulemaking for humans and machines, 2020
- Executable Governance for AI: Translating Policies into Rules Using LLMs
- Al Jazeera and Pulitzer Center on Samagra Vedika, 2024
- Royal Commission into the Robodebt Scheme, 2023
- OpenFisca and PolicyEngine