An open-source environmental-law agent for India's National Green Tribunal, built as Claude Code skills.
It analyses a matter, reviews an Environmental Impact Assessment, and quantifies restoration-scaled damages with a method that shows its working, citing the exact section, rule or judgment behind every point.
Quick start · Sample output · Skills · Guardrails · Methodology · Coverage · Contribute
The National Green Tribunal can order relief, compensation and restitution of the environment (NGT Act 2010, s.15), and must apply the polluter pays principle (s.20). For breaches of consent conditions and directions it already has a formula: the CPCB's environmental compensation method, EC = PI x N x R x S x LF. The Supreme Court calls that method facilitative and indicative, not prescriptive, and confines the formula to limited categories of violation. Actual damage, such as effluent pumped into an aquifer or a wetland degraded for years, calls instead for "a detailed, site-specific and expert-driven assessment with emphasis on remediation and restitution" (Rhythm County, 2026 INSC 102, paras 40, 41 and 46.4). The CPCB method leaves that assessment to expert institutions case by case, and an award fixed on turnover with no nexus to the pollution was set aside (C.L. Gupta, 2025 INSC 1035).
Resource and Habitat Equivalency Analysis (REA/HEA) is the restoration-scaling method used in United States natural resource damage assessment. Aranya offers it for that damage track, as persuasive, not binding expert material inside powers the NGT already has, and never in place of the CPCB formula for a consent or direction breach. It measures the ecological service lost to an injury, measures what a restoration project would give back, and solves for the restoration the polluter should fund. Every number is a range an expert signs off, not a black box.
It will not tell you the Tribunal will accept it. It tells you exactly which section, judgment and assumption each step rests on, so a lawyer and an ecologist can check it.
Aranya grew out of my work on Evolution of Environmental Jurisprudence in India: The National Green Tribunal by Raghuveer Nath and Armin Rosencranz (Cambridge University Press, 2025). The book follows Indian environmental adjudication from the public interest litigation of the 1980s to the NGT, and it is where we discussed REA and HEA as a way to size environmental compensation. Equivalency analysis usually means hiring a consultant with a proprietary model, which puts it out of reach for many of the people who bring cases to the Tribunal: community groups, small NGOs, students, and lawyers with no budget for an expert. I built Aranya to make that calculation accessible. The calculator is free, it runs on your own machine without a model or a network connection, and every step from the injury to the restoration figure is open for anyone to read, re-run and challenge.
The repo ships with sample-estuary, a synthetic matter (a tannery cluster's effluent degrading a 25 ha estuarine wetland), so you can see the format before pointing Aranya at anything of yours. The calculator run is real output you can reproduce; the matter, flags and finding were written by hand:
matter.json: the matter header, forum set to the NGTflags.jsonl: two flagged sections, a statutory provision and an EC condition, append-onlyfindings/F-0001.json: a finding citing s.15(1)(c) and Schedule II, with its verification statecalc/run-1.json: a full REA/HEA run
The calculator's own summary of that run:
HEA equivalency analysis [novel_persuasive, pending_expert_review]
debit: 117.73 discounted service-hectare-years lost
restoration: 10.87 to 16.98 ha across the sensitivity range; 13.58 ha at the stated inputs (scaling ratio 0.54)
cost: INR 54,33,860 to INR 84,90,406; INR 67,92,325 at the stated inputs
Expert-witness input material, not a final compensation figure...
The figures are illustrative and synthetic. The point is the shape: a debit, a restoration scale, a cost, a range, and a status that stays pending_expert_review until a named expert validates the inputs.
Two synthetic NGT matters, each with planted issues and an answer key committed before the run:
- Morvali Creek, an EIA and clearance matter. The skills found all 14 planted issues, left all 6 should-not-flag items alone and invented no citation. Four of the 14 rested on law the catalog then lacked, which the run supplied from memory; the catalog has since added NGT Act s.15(3) and s.16, the EIA General Condition, para 8(vi) and Appendix IV. That session started outside the repo, so Aranya's own hooks and skill routing never ran. Score.
- Kanthari Nala, an effluent and groundwater matter that turns on the CPCB compensation method. A blind run in a fresh session on an exported copy, offline, scored by a separate session. It found all 14 planted issues, left all 6 should-not-flag items alone, sent every uncatalogued provision to a flag and relied on no unverified authority. All five skills were loaded, and a probe after the run showed the write hooks blocking. Score.
Read the scores before quoting them. The same model wrote both keys and ran both matters, the keys were built from the catalog's own text, and no lawyer has reviewed either. To run one yourself, follow the run sheet and tally the result with examples/score-check.mjs.
AI can make mistakes. Have a licensed attorney check every finding and citation before you rely on it.
| Ad hoc quantum | Consultant's damage report | Aranya | |
|---|---|---|---|
| Cites the statute or judgment per point | Sometimes | In a PDF | Every finding; validation rejects one that does not point at a catalog entry |
| Shows how the number was derived | Rarely | Proprietary model | A deterministic calculator you can read and re-run, with a sensitivity range |
| Honest about precedent | Varies | Varies | Stamps every result novel_persuasive; the result schema allows nothing else |
| Where your matter data goes | — | The firm's systems | Your machine and your model provider. No Aranya server. |
| Output | Prose | A report | Schema-valid JSON and Markdown, in a per-matter workspace |
| Cost | — | Fees | Free (Apache 2.0), plus model usage |
You need Node.js 22+ and Claude Code. There is nothing to npm install. On Windows, install Git for Windows too: the hooks run in Git Bash, and without it every write is blocked.
- Clone and check the workspace.
git clone https://github.com/prathikcannotcode/aranya.git cd aranya npm run validate -- --strict - See the calculator on the sample inputs.
npm run calc examples/sample-injury.json
- Open Claude Code in the repo.
claude
- Look at the demo. Ask "Walk me through the sample-estuary matter" or type
/env-catalog jurisdiction. - Start a matter. Say "Analyse this matter: untreated effluent degraded a mangrove stretch; the unit holds an EC." Aranya checks the forum, applies the statutes, and records findings and flags under
matters/. - Quantify. Give the injury and restoration parameters and run
/hea-rea-calculator; it returns the restoration scale with its range.
claude plugin marketplace add prathikcannotcode/aranyaclaude plugin install aranya@prathikcannotcode-aranyaThe plugin carries the five skills (namespaced, as in /aranya:env-catalog), the catalog and the calculator, and they work in any project. It carries no hooks. Outside an Aranya workspace nothing enforces the write guard, schema validation or append-only flags, and the calculator's result is saved by the agent, so clone the repo for work that will reach a court.
Every skill is a slash command. You can also describe the task in plain English and Claude picks the right one.
| Command | What it does | Anchored in |
|---|---|---|
/env-catalog |
Look up a provision, test NGT jurisdiction, resolve a flagged section, cite a clause with its verification state | catalog/provisions.json |
/env-case-analysis |
Triage a matter: forum and jurisdiction first, applicable statutes, issues, reliefs, findings | NGT Act s.14, Schedule I |
/eia-review |
Review an EIA or Environmental Clearance against the 2006 Notification checklist; flag breached conditions | EIA Notification 2006 |
/hea-rea-calculator |
Size restoration against injury in discounted service-years, with a sensitivity range | NGT Act s.15, s.17, Sch. II |
/ngt-compensation-argument |
Assemble the restoration-scaled argument: the power, polluter pays, the method, the quantum | NGT Act s.15, s.20; polluter pays |
Prompts to try, by role
Advocate
- Is this an NGT matter or a writ? The harm is under the Water Act.
- Draft the restitution-of-environment prayer and the quantum argument.
- Which authority establishes polluter pays in India, and what is the pinpoint?
Expert witness
- Run HEA for a 25 ha wetland at 70% service loss over a 10-year recovery.
- Show me the sensitivity of the restoration scale to the discount rate.
Researcher
- Summarise the NGT's compensation powers under the Act.
- What do Schedule II heads (g) and (k) cover, and where are they sourced?
flowchart LR
you([You]) -->|"/env-case-analysis"| cc["Claude Code"]
cc --> skills["5 skills<br/>catalog · analysis · EIA · calculator · argument"]
skills -->|"Write / Edit"| guard{{"write-guard<br/>PreToolUse hook"}}
guard -.->|"blocked: outside layout,<br/>flag-log rewrite, secret"| cc
guard -->|"allowed"| ws[("catalog/<br/>matters/")]
ws --> val{{"validate-on-write<br/>PostToolUse hook"}}
val -.->|"schema errors"| cc
calc["hea-rea.mjs"] -->|"deterministic"| ws
Skills are Markdown that tell Claude what the law provides and how to apply it. Everything Claude writes passes through two hooks, and structured files must match a JSON Schema. The agent can be wrong about the law. It cannot quietly save a finding that does not point at a catalog entry, edit the catalog, rewrite a flag log, mark a result expert-validated, or drop a file outside the workspace. Markdown drafts are not checked for what they claim, so a person has to read them. Hooks don't intercept shell commands; see SECURITY.md.
| Guard | Enforced by | What it stops |
|---|---|---|
| Workspace layout | write-guard.mjs reading layout.json |
Writes to any path the layout does not list, path traversal out of the repo, and edits to the hooks, schemas and settings themselves. A hook event it can't read is blocked too. |
| Append-only flags | write-guard.mjs |
Edits to a matter's flags.jsonl; a change is a new line |
| Schema validation | validate-on-write.mjs, npm run validate |
A finding with no clause, source or verification state; a result with no methodology_status |
| Calculator inputs | hea-rea.mjs reading injury-params.schema.json |
A discount rate of 3 instead of 0.03, a missing input, a mistyped field, injured service above baseline |
| Novel methodology | calc-result.schema.json |
methodology_status can only be novel_persuasive; never established. This covers results, not Markdown drafts. |
| Expert gate | write-guard.mjs, npm run validate |
An agent recording expert_validated, or anyone doing so without validated_by and validated_at. Nothing confirms the name is genuine, so review the diff. |
| Catalog-only citations | write-guard.mjs, npm run validate |
A finding whose catalog_id is not in the catalog or whose source or state differs from it, a finding that names a section the catalog holds only at Act level, and any agent edit to the catalog. It can't check that a catalog entry is itself correct, or what a Markdown draft cites. |
| Tests | npm test, GitHub Actions |
Regressions in all of the above. 30 tests, Node's built-in runner. |
The calculator sets the discounted ecological-service loss of an injury (the debit) against the discounted service gain of a restoration project (the credit), then solves for the restoration scale. HEA scales against habitat service; REA against a specific resource service. Every input is expert judgement, not a lookup, so the output is always a range. The equations, the worked example and the limits are in docs/METHODOLOGY.md.
Each entry records when it was last checked; the newest were checked in November 2026. Entries trace to the Gazette of India, India Code, environmentclearance.nic.in and the SCC/official reports; see catalog/provisions.json, where every entry records a source_url and a verification state.
| Layer | Covered |
|---|---|
| Instruments | NGT Act 2010, EPA 1986, EIA Notification 2006, Water 1974, Air 1981, Forest 1980, Biodiversity 2002, Wildlife 1972, CRZ 2019 |
| Key provisions | NGT ss.14, 15 (with the five-year limit in s.15(3)), 16, 17 and 20; Schedule I (seven enactments); Schedule II (all fourteen heads); EPA s.3; EIA 2006 para 7 stages, para 8(vi), para 10, Appendix IV and the General Condition |
| Doctrines | Polluter pays, precautionary, public trust, sustainable development |
| Leading cases | Vellore Citizens (1996) 5 SCC 647; Indian Council for Enviro-Legal Action (1996) 3 SCC 212; M.C. Mehta v. Kamal Nath (1997) 1 SCC 388; Goel Ganga (2018) 18 SCC 257; C.L. Gupta 2025 INSC 1035; Rhythm County 2026 INSC 102; Vanashakti 2026 INSC 761 |
| Methodology | HEA and REA, carried as novel persuasive, no Indian precedent; the CPCB environmental compensation method |
| Path | Purpose |
|---|---|
.claude/skills/<name>/SKILL.md |
The five skills |
.claude/schemas/ |
JSON Schemas and layout.json, the list of writable paths |
.claude/scripts/ |
The write-guard and validate hooks, lib.mjs, and hea-rea.mjs |
catalog/provisions.json |
The source-cited legal catalog |
matters/{id}/ |
Per-matter workspace: matter.json, flags.jsonl, findings/, calc/. Gitignored except the synthetic sample. |
examples/ |
Two synthetic matters with answer keys, run sheets and scored runs, and score-check.mjs |
docs/ |
METHODOLOGY.md and a handoff brief for a short paper |
Is this legal advice? No. It is tooling that shows its working: every point names its source so a lawyer can check it in minutes rather than rebuild it from scratch.
Does REA/HEA have Indian precedent? No documented NGT or Indian court has applied it. Aranya presents it only as persuasive comparative methodology, and the schema forbids claiming otherwise.
Where do the numbers come from? A deterministic calculator you can read. Every input is an expert judgement, so the output is a range, validated by an ecologist, never a single authoritative figure.
Does my matter data leave my machine? Aranya has no server and no telemetry. Claude Code sends the files it reads to your model provider, as it does on any repo. Your matters are gitignored by default, so a git add . in a public fork won't publish a client's file.
How is the catalog kept honest? Each entry carries its source, a verification state and when it was checked, and agents can't edit it. A citation marked verify or unverified is kept out of court-facing drafts. CONTRIBUTING.md explains how entries are checked.
Verified catalog entries, corrected pinpoints, and sector-specific checklists are the most useful contributions. Read CONTRIBUTING.md, then AGENTS.md, which binds human and AI contributors alike. Report vulnerabilities through SECURITY.md. Changes are listed in CHANGELOG.md.
AI can make mistakes. Aranya is tooling, not legal advice, and it does not produce environmental impact studies. Have a licensed attorney check everything before you rely on it, and a qualified ecological expert check any damage figure. REA/HEA is offered as persuasive comparative methodology; no NGT or Indian court has applied it yet.