Product requirements document

NIYAM: Regulatory Circular to Live Rule Engine

Version 1.0 · November 2026 · Team Dragorithm. A product requirements document for the prototype at niyam-fall-2026.vercel.app/console.

1. Summary

When the Reserve Bank of India issues a circular, every bank it applies to must find it, work out what it means for its own rules and policies, change live systems safely, and prove it later. Today that takes weeks to months of hand-offs between compliance, risk, IT and testing. NIYAM is a team of seven AI agents that turns a circular into a tested, two-person-approved, monitored live rule, rolls it out safely, rolls it back on drift, and traces every alert to the sentence that caused it.

2. Problem

Constant change

In November 2025 RBI folded about 9,000 circulars into 244 Master Directions that now change by amendment.

Slow and manual

Fully implementing a regulatory change takes more than a year on average, by compliance officers' own account.

Costly when wrong

RBI imposed 353 penalties worth ₹54.78 crore in 2024-25; 264 fell on co-operative banks.

Tools stop early

Existing RegTech tells a bank what changed. None writes, tests, approves and deploys the rule itself.

3. Users

Maker

Chief Compliance Officer

Reviews and prepares each change; signs first.

Checker

Head of Risk and IT Change

Independently authorises the change for release.

Daily user

Compliance analyst

Reviews clauses, obligations and policy conflicts.

Daily user

Rule-engine engineer

Reviews rule diffs, tests and rollout.

Reader

Auditor or RBI inspector

Asks why an alert fired; reads the Golden Thread.

First segment: the 1,457 urban co-operative banks and larger NBFCs, which carry the same rules as large banks with very small teams. Next: large banks, as a layer over the engines they already run.

4. Goals and non-goals

Goals

  • Circular to signed approval pack in minutes, not months
  • Zero rules that do not match the regulation's number, operator and scope
  • No production change without two human signatures
  • Automatic, logged rollback on abnormal behaviour
  • Every alert traceable to its clause, 100% of the time

Non-goals

  • Replacing the bank's rule engines; NIYAM writes rules for them
  • Removing human judgement from approval
  • Legal interpretation of ambiguous regulation; those clauses become manual controls
  • Handling real customer data in this prototype

5. User flow

  1. Choose a bankor define your own
  2. Load the circularPDF, Word or text
  3. Runrule-based or Claude
  4. Watch 7 agentsread, extract, map, draft, test
  5. Two signaturesmaker and checker
  6. Releaseshadow, canary, live
  7. Bank sitelive rollout, Sentinel, Golden Thread

6. Functional requirements

IDRequirementHow NIYAM meets itStatus
FR-1Accept a regulatory circular as PDF, Word or textReader intake: PDF text layer, .docx and plain text, reflowed into numbered paragraphsBuilt
FR-2Read scanned or poor-quality PDFsOCR, with olmOCR for poor scans, in front of the same ReaderProduction design
FR-3Decide which clauses bind this bankReader scopes every clause against the bank's licence type, with a stated reasonBuilt
FR-4Extract each obligation with its number, operator and source wordsExtractor (rule-based or Claude); a quote must appear word for word in the clause or it is rejectedBuilt
FR-5Map obligations to the bank's live rules and internal policiesMapper walks the knowledge graph: modify, gap (new rule), policy conflict, manual controlBuilt
FR-6Draft executable rules, never raw SQLAuthor writes a typed rule file on a draft branch; schema and compiler check it; SQL is compiled by code and runs read-onlyBuilt
FR-7Test every draft against the regulation, not against itselfValidator generates boundary tests from the obligation and objects to the Author over A2A (at most 3 rounds)Built
FR-8Show the impact before anyone signs90-day backtest, old rule against new, alerts, customers flagged and analyst hours; what-if threshold explorerBuilt
FR-9Require two different people to approveMaker and checker sign with name, employee ID, reason and a four-point checklist; HMAC tokens bound to the exact file, valid 24 hoursBuilt
FR-10Never let AI change production directlyRelease verifies both signatures, then shadow (days 1-3), canary 10% (days 4-7), live; feature flags, not code pushesBuilt
FR-11Detect drift and roll back automaticallySentinel compares daily alerts with the backtest band (mean ± 3 sd); outside it, flag off and git revertBuilt
FR-12Explain any alert to an inspectorGolden Thread: alert, rule version, approvers, obligation, clause, circular, in one query; tamper-evident audit packBuilt
FR-13Work for any bank, not oneFour sample banks plus a bank the user defines; rules are written against a Bank Semantic Model, so onboarding is mappingBuilt
FR-14Connect to the bank's real rule enginesOne MCP adapter per engine (AML, fraud, limits); Neo4j and a warehouse inside the bank's boundaryProduction design

7. Non-functional requirements

Security

Agents reach tools only through MCP servers with per-agent allowlists, checked by client and server. Circular text is treated as untrusted data. SQL is read-only.

Integrity

Approval tokens and the approval pack are HMAC-signed over the SHA-256 of each rule file and the circular. Any edit after signing is refused.

Auditability

Every A2A message, MCP call, objection, approval and rollout day is recorded; every alert traces to its sentence.

Model independence

Rule-based mode runs the whole pipeline with no LLM. Claude mode is optional and checked by the same gates.

Cost

Rule-based runs cost nothing. A Claude run is about $0.03 to $0.05 (four calls), with a daily cap and per-address rate limits.

Privacy

The demo uses only synthetic data. In production, data stays in the bank; agents see schemas and aggregates, and a private model can be used.

Explainability

Plain-language captions for each step, rule diffs, generated tests and impact in words, for compliance staff, not only engineers.

8. Architecture

Seven agents over A2A

Conductor, Reader, Extractor, Mapper, Author, Validator, Release. Found by Agent Cards; JSON-RPC tasks.

Seven MCP tool servers

Knowledge graph, semantic model, rule compiler, backtest, git, approvals, deploy-monitor; allowlisted per agent.

Knowledge graph and semantic model

Circular to clause to obligation to rule to approval to alert; business terms mapped to the bank's columns.

Typed rule language

Strict schema, compiled to read-only SQL by code.

Stack

Next.js on Vercel, TypeScript, official MCP SDK, SQLite (WebAssembly) sandbox, isomorphic-git, Claude via the Anthropic API.

Bank sites

Each bank has its own rule-engine site that receives the rollout live from the console.

9. Success metrics

MetricTargetHow it is measured
Circular to signed approval packUnder 1 hour (today: weeks)Run timestamps in the console
Generated tests passing at approval100%Validator results in every pack
Obligations with a verified exact quote100%; unverified ones rejectedExtractor span check
Extraction precision on labelled clausesReported live, failures includedEvaluation endpoint /api/eval (30 hand-labelled clauses, 10 broken rules)
Unauthorised production changesZeroRelease refuses without two valid tokens
Time to roll back on driftSame day, automaticSentinel and rollback log
Alerts traceable to their clause100%Golden Thread for any alert
Pilot: analyst hours saved per changeTo be measuredRead-only pilot with one co-operative bank or NBFC

10. Risks and mitigations

The model misreads a clause or invents a number

Exact-quote check, typed schema, compiler, tests from the regulation, Validator objections, and two human signatures.

“Exceeding” versus “or more” is lost

Comparator rules map each phrase to an operator; boundary tests fail if the operator is wrong.

A signed rule is edited before release

Tokens cover the file's SHA-256; Release refuses (demonstrated by the tamper test).

Bad data after go-live

Shadow and canary first; the Sentinel rolls back automatically on drift (demonstrated with an injected duplicate feed).

Prompt injection hidden in a circular

The circular is handled as data; agents cannot call tools outside their allowlist.

Model outage or cost spike

Rule-based mode, daily cap, rate limits.

11. Release plan

Now: prototype

Everything marked Built above, on synthetic data, deployed.

0-3 months: read-only pilot

One co-operative bank or NBFC; obligation register and impact reports only.

3-6 months: connectors

MCP adapters for AML, fraud and limit engines; Neo4j in the bank; private model.

6-12 months: Master Directions

Track every amendment to the 244 Master Directions as a diff.

12-24 months: more regulators

SEBI and IRDAI; only the Reader and semantic model change.

12. How to evaluate the prototype in 3 minutes

  1. 1Open the console, pick ABC Bank (its circular PDF loads and is read automatically), or add your own bank.
  2. 2Press Run the pipeline. Watch the seven agents; each card says what it produced and how.
  3. 3In Two-person approval, sign as maker and checker (names, IDs, reasons, checklist).
  4. 4Press Release. The bank's own site opens and plays shadow, canary and live, the Sentinel's rollback, and the Golden Thread.
  5. 5Optional: switch to Claude live to see Claude's calls stream, with tokens and cost, checked by the same gates.