nyc-charter-laws-rules
This MCP server gives AI assistants offline, read-only access to New York City's Charter, Administrative Code, and Rules of the City of New York — with no API key or setup.
search— Keyword/phrase search across all three documents (phrase matched first, then a ranked term fallback), filterable by document with up to 50 results and snippets around the match.get_section— Retrieve a specific section by citation (§ 259,11-602.1,15 RCNY § 1-01,FC 102,NYC Charter § 1133) or heading; long text is paged in parts, match lists in pages of 25.list_titles— List a document's chapters (or Rules titles) in order, pageable.get_title— List the sections within a chapter, an Administrative Code/Rules title, or both (Title 15, Chapter 18).get_version— Report how current each document is (the publisher's "current through" line), so answers can be grounded in the right version.whats_changed— Show what changed in the server, data, or site, filterable by date and tag (Site, Data, MCP, Correction).about_betanyc— Who built the server, where the code lives, and how to report a bug or request a feature.about_data— Data provenance per document: publisher, official status, what BetaNYC changed, currency, known gaps, where to verify, and where to report errors.
All tools are read-only (readOnlyHint: true) and offline (openWorldHint: false); every response carries a legal disclaimer, and answers are keyword-based, not legal advice.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nyc-charter-laws-rules search the admin code for sidewalk shed rules"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
nyc-charter-laws-rules
The single place to access, process, and query New York City's three primary legal documents:
The New York City Charter
The New York City Administrative Code
The Rules of the City of New York
This repo includes:
A MCP (Model Context Protocol) server so AI assistants can query the documents directly
Scripts to fetch and parse the latest bulk XML from American Legal Publishing
A committed JSON index (
data/index/json/) for machine use. The MCP server reads it, and it is the only data in the npm package.A committed Markdown index (
data/index/markdown/) for human browsing — readable directly on GitHub. The server does not read it, and it is not in the npm package.A site structure (
data/structure/) for the law website: each section's subdivisions, cross-reference targets, and chapter and title names, built with the index (see Site structure). It is not in the npm package.A website, the BetaNYC Law Reader: the Charter and the Administrative Code, one page per section, with links between sections and search, built from the index by
npm run build-site(see The website)..github/workflows/deploy-site.ymlbuilds it and publishes it to law.beta.nyc on GitHub Pages; the HTML is never committed. It is not in the npm package.
Clone the repo and everything is ready to use. No setup required to browse or query the current index. Run npm run fetch-data && npm run build-index only when you want to refresh from AML.
Vibe coded with Claude by BetaNYC.
What's changed: new tools, corrections and other changes a reader would notice, newest first. Daily law text updates are in CHANGELOG.md.
API key
No API key is required. The Charter, Administrative Code, and Rules are served from an offline corpus bundled with the package, so this server works out of the box — no signup, no token, no environment variables to set.
The bundled text is as of the release. An npm install carries the law text from the day that version was published. When the daily refresh picks up new law text, it also publishes a new patch release automatically (see Releases), so the law text in npx -y @betanyc/nyc-charter-laws-rules is normally at most a day behind main's. Code changes ship with the next release. Automatic releases pause while a hand-bumped version is waiting to be published or a release run has failed. get_version reports the dates you are actually serving. To serve main's index directly, see Getting current law text.
Related MCP server: new-york-code
What it does
Exposes 8 tools over MCP:
Tool | Description |
| Keyword search across all three documents (short keyword queries work best) |
| Retrieve a specific section by citation (e.g. |
| List the chapters of a document, in order |
| List the sections in a chapter, or in an Administrative Code or Rules title (citation and heading of each) |
| Return the currency date for each document — so responses can be grounded in exactly how current the law is |
| What changed in this server, newest first, from WHATS-CHANGED.md: new tools and corrections |
| Who built this server, where its code is, and where to report a bug in this server or ask for a new feature |
| Where the law text comes from, from DATA-SOURCES.json: the publisher, whether it is the official text, when this server's index was built, where to check a section and how to report an error |
Tools reference
Every law-text answer (search, get_section, list_titles, get_title) ends, before the disclaimer, with a source line per document it came from. It says that BetaNYC converted the text and how, so it is not the official text; the date of this server's copy; and the official record, with its publisher and a link to the code library. search adds that snippets are cut at 400 characters. Under it is the publisher's own "current through" line from the same copy, exactly as the publisher gives it. An example, from a Charter answer on the November 14, 2026 copy (the date and the "current through" line change with every copy):
BetaNYC modified this data: converted by BetaNYC from the publisher's bulk XML files: line breaks are collapsed, so tables run together; the publisher's editing markers are removed and character codes decoded; math signs and Greek letters set in the old Symbol font are changed to the characters the font shows (³ to ≥) where BetaNYC has checked them; citations are worked out by BetaNYC from headings and can be wrong or cut short. This copy should not be considered the official record. As of 2026-11-14T11:05:40.153Z (the date of the copy this server answers from). Official record: New York City Charter, bulk XML download (American Legal Publishing), https://codelibrary.amlegal.com/codes/newyorkcity/latest/NYCcharter/0-0-0-1
The publisher's own "current through" line for it, as given: "Current through Local Law 2026/164, enacted November 10, 2026,"get_version reports dates and counts, not law text, so its lines start Source: … (American Legal Publishing). and end with Link:. The wording of both kinds comes from the shared module's provenance().
The copy date is indexedAt in versions.json. It moves only when the text changes, so a copy can be days old and still match the publisher's latest download. The index keeps no date for when the source was last checked, so none is shown. Answers that find nothing ("No results found", "Section not found", "No titles found", "No sections found") say which documents were searched and carry the same lines.
Anything an answer repeats from the request (a query, citation, title, parameter name or value, or tool name) is cut to one line of at most 100 characters, ending …. If an index file is missing or unreadable, the answer names the document and says the server's operator should reinstall the package or rebuild the index; the file path goes to the server's stderr, not to the answer.
Every list says how much of how many it shows when it does not show everything, and how to get the rest.
Every tool only reads, and answers from the index bundled with the package, never a live API. Each says so in its MCP annotations (readOnlyHint: true, openWorldHint: false).
search
Keyword search across the NYC Charter, Administrative Code, and Rules. It is keyword matching, not a question-answering engine, so short keyword queries work best: sidewalk shed rather than "How long can a sidewalk shed stay up?"
An empty query (nothing, only spaces, or only quote marks such as "") is an error that says to send a keyword or a phrase, or to call get_section for a citation. Through 0.7.x an empty query listed all 22,637 sections.
Short terms match whole words only. A query, or in step 2 a term, with 3 or fewer letters and digits matches only where no letter or digit touches it on either side: x is the word x, not the x in "wax", and tax is not the start of "taxes". A longer one matches as below: the phrase anywhere, a term at the start of a word. Only letters and digits count, so s ≥ 4t is short and matches as whole words at its ends. The answer says when a query or term matched whole words only. This is the rule, and the limit, that BetaNYC's nyc-budget-mcp uses for its text filters. Through 0.7.x a matched inside 22,150 sections. It fits this search because the phrase step already ranked whole-word matches first, so a short query's best results were already whole words; the rule drops the rest, which were noise. The step 2 rule for longer terms, start of a word with no check at the end, is unchanged, since a whole-word check there lost an eval question (below). The eval passes the same 15 of 17 questions with this rule.
Phrase first. The whole query is matched as typed (case-insensitive). Quotes around the whole query, straight or curly, are removed first, so
"open data"andopen datasearch the same phrase. If any section contains it, those results are returned, relevance-ranked: heading matches rank above citation matches, which rank above body-text matches, and whole-word matches rank above substring matches.Terms, if the phrase finds nothing. Question words and common words (
how,what,can,a,the,up,about, …) are dropped. The full list isSEARCH_STOPWORDSinsrc/corpus.ts. Each remaining term matches at the start of a word, with a trailing pluralsignored, sotanksfinds "tank" andsheddoes not find "established". There is no check at the end of a word, socaralso finds "carbon"; that is what letsappointsfind "appointed" (a whole-word check was tried and lost an eval question). Every section with at least one term gets one score, and results are sorted by it alone (termScoreinsrc/corpus.ts):a rare word counts more than a common one (its weight is the log of sections searched divided by sections that contain it);
a word in the heading or citation counts 3 times;
a long section is pushed down a little: the score is divided by 1 + log(1 + length / average length);
the score is multiplied by the share of the words' total weight the section covers, so a section with the rare words beats one with only the common ones;
sections under 100 characters (empty headings,
[Repealed]) count 0.3 times, and Local Law appendix records (heading likeL.L. 2016/002) half.
So a section with every word can rank below one with fewer, rarer words in its heading. Through 0.5.x, a section with more of the words always came first, before any weight applied, so long definitions sections that happen to hold every word won.
Said out loud. When step 2 runs, the first line of the response says so and lists the terms:
every result contains every term:
No section contains the exact query; showing sections containing all of: building, owners, required, drinking, water, tanks.some results lack a term, and no section anywhere has every term:
No section matched every term; showing sections matching some of: smoking, banned, nyc.some results lack a term, and at least one section has every term:
No section contains the exact query; showing the best matches for some or all of: long, sidewalk, shed, stay.
How many. For a phrase match, when more sections matched than
limit, a line after the results saysShowing 10 of 35 matching sections, best first.and how to see others. When step 2 ran, sections with every term and sections with only some are counted apart, for example1 section contains every term; it does not rank in this list. To see more of them, raise limit (max 50), …then1525 other sections contain only some of the terms; the 10 shown are the best-ranked of those.When no section has every term:619 sections contain some of the terms; the 10 shown are the best-ranked of those.The response never suggests raisinglimitto see sections that hold only some of the words.Snippets show the match. Each snippet is at most 400 characters of the section's text, around the first match of the phrase, or of any term in step 2: it starts up to 100 characters before the match, at the start of a word, with
…where text is left out at either end. A match only in the heading or citation shows the opening. A line after the results says so;get_sectionreturns the full text. Through 0.7.x a snippet was always the first 400 characters, so a hit ons ≥ 4tin Section BC 722 showed 722.1's opening.
This is still keyword matching: a question whose answer uses other words ("warm" and "winter" for a section about minimum temperatures) does not find it. See Evaluation set.
Parameter | Type | Required | Default | Description |
| string | yes | — | Search term or phrase |
| string | no |
|
|
| integer | no | 10 | Max results (1 to 50) |
search("open data")
search("landlord inspection", corpus="admin_code", limit=20)
search("board of health", corpus="rules")
search("How long can a sidewalk shed stay up?") # term fallback; first line says soget_section
Retrieve a specific section by citation or heading fragment. Input is normalized (with or without §, any case, extra whitespace, any kind of dash). If the same citation exists in more than one document (e.g. charter Chapter 3 vs a rules chapter, or a rules section number repeated across titles), a disambiguation list is returned. Its first line says what to add to get one: set 'corpus' (charter, admin_code or rules) only when corpus was not given and the matches are in more than one document, and the title when the citations name one (To get one, name its title in the citation, as each line below does: '1 RCNY § 2-01'.). The list comes in pages of 25: Showing 1 to 25 of 39. Call again with offset 25 for the next ones., and past the end, Nothing at offset 50: there are 39 in all., as the other lists say it.
Long text comes in parts. A section's text is at most max_chars characters per answer (default 20,000; 1,000 to 100,000). About 2% of records are longer, such as Section BC 722 and RS 18-1 (each about 80,000 to 110,000 characters), which clients that cap a tool's answer used to cut off. A longer text has a line before it, after the heading: Showing characters 1 to 20000 of 83475. Call again with offset 20000 for the next part. A part ends after a space when there is one in its last fifth, so no word is cut in two, and following each part's offset gives back the whole text. The last part's line ends at the count; an offset past the end says Nothing at offset N: the text has M characters. A text that fits whole has no such line, so short sections answer as before.
Each title of the Rules numbers its own chapters and sections, so in the July 2026 files 50 titles each have a § 1-01. Name the title the way the Rules are cited: 15 RCNY § 1-01 (also 15 RCNY 1-01, 15 R.C.N.Y. § 1-01, Title 15 § 1-01, Title 15, Chapter 18), and the Health Code as 24 RCNY Health Code § 81.08 (or Health Code § 81.08). A citation with RCNY is a Rules citation: asked of another document, it finds nothing and says so. "Health Code" counts as a citation only after 24 RCNY or Title 24, or when §, a section number, or Title, Article or Part and a number follow it; otherwise, as when a citation that names a title finds nothing, the words are looked up as typed, so Health code. still finds Charter § 558. A bare § 1-01 still lists every title's, sorted by title, each with its full citation and its title's name: [RULES] 15 RCNY § 1-01 — § 1-01 Scope and Application. (Title 15: Department of Environmental Protection). Where the publisher repeats a citation inside one title, the citation names the chapter too, and is accepted that way: each yearly Rent Guidelines Board order has its own "Notice" (Title 30, Apartment & Loft Order #49 (2017), Notice), and Title 62 numbers sections from § 6-01 in both Chapter 5 and Chapter 6 (Title 62, Chapter 5, § 6-01). An Administrative Code citation already names its title in its number (§ 24-163 is in Title 24), except in a lettered title, which shares its parent's numbers: Title 16-A § 16-501. Answers show the full citation ([RULES] 15 RCNY § 1-01 (matched in corpus: rules; in Title 15: Department of Environmental Protection)), and so do search results.
On the July 2026 files, 93 Rules records and 115 Administrative Code records still share their full citation with another record, because the publisher numbered two alike inside one chapter (Title 15 Chapter 42 has two runs of § 1 to § 8) or numbered two chapters of one title alike and marked both "*" (Rules Title 43 Chapter 19; Administrative Code Title 26 Chapters 21 and 37). get_section lists those together. Most can still be asked for alone by their heading; 17 Rules records and 14 Administrative Code records cannot be returned alone by any citation or heading, and search and get_title reach each one. Titles need an index built by 0.7.0 or later (see What the index holds); with an older index, a citation that names a title lists every record with the rest of the citation.
Citations copied from the Law Reader website (law.beta.nyc) work as they are. They name the book first, and so may you: NYC Charter § 1133, New York City Charter § 1133, Charter § 1133, NYC Administrative Code § 27-506, Administrative Code § 27-506, Admin. Code § 27-506. Then only that book is looked in, so NYC Charter § 1133 is never the Administrative Code's § 1133; with corpus set to the other book, it finds nothing and says so, as an RCNY citation does. The book's name counts only when a citation follows it (§, a number, Title, Chapter, a code's letters and number), and a book lookup that finds nothing falls back to the lookup as typed, so Charter revision commission is still a heading. What follows a book's name is matched by citation only; the heading search runs only on the text as typed, so Admin Code 1 is not every heading with a 1 in it. The website's local-law chapters, NYC Administrative Code Local laws, 1985, are the publisher's chapter 1985; a year with no chapter (Local laws, 2030) finds nothing. Building and fire code sections are cited by code: FC 102, Section FC 102, EC 80, BC 602, RS 18-1. A construction code may also be named in words: Building Code 722.2.1.1.4, NYC Fire Code § 102.4, Plumbing Code 305.1, and the Mechanical, Fuel Gas, Electrical and Existing Building codes. These are Administrative Code citations: asked of another document, they find nothing and say so. Words that merely start with a code's name (Building code requirements) are looked up as typed. The Energy Conservation Code is not in the index; the Health Code is in the Rules (Health Code § 81.08, above). When nothing else matches, a bare code number (722.2.1.1.4, 102.4) is looked for in every construction code by citation: if one code has it, that section; if several, a list. A trailing period or comma is ignored when the citation as typed finds nothing, so § 259. is § 259.
A citation of a part of a section, when no record has that citation, returns the whole section it is in: the index holds whole sections. The section must match by citation, never by heading, so Section FC 10.1 and Admin. Code § 27-50(b) find nothing rather than sections whose headings start with those numbers. The first line says so: You asked for (b)(1), a part of § 1133. The index holds whole sections, so the whole section follows. That covers a subdivision (§ 1133(b)(1), NYC Charter § 1133(b)(1), § 11-224.1(h-1)(ii)(I), and the -2 the website adds to a label's second use, § 3501(3)-2), a Construction Code or Fire Code subsection (Section FC 102.4(1) is item (1) of subsection 102.4 of FC 102; Section BC E104.2.2), and a Rules subsection named with RCNY (2 RCNY § 1-01.1 in § 1-01). Exact citations still win and answer as before: D302 Conversions to a multiple dwelling (MDL 9(2)) and 11-602.1 are records of their own, and a point in an Administrative Code number (§ 11-602.9) is never read as a subsection. Words in parentheses (Independent budget office (IBO)) are not a subdivision.
Parameter | Type | Required | Description |
| string | yes | Section citation or heading (e.g. |
| string | no |
|
| integer | no | Most characters of a section's text per answer (default 20,000; 1,000 to 100,000). A longer text comes in parts |
| integer | no | Where to start (default 0): characters into a section's text, for its next part, or matches into a list of matches, for its next page |
get_section("§ 259")
get_section("11-602.1")
get_section("Chapter 11", corpus="charter")
get_section("RS 18-1")
get_section("15 RCNY § 1-01")
get_section("NYC Administrative Code § 27-506")
get_section("Section FC 102.4(1)")
get_section("24 RCNY Health Code § 81.08")
get_section("Title 16-A § 16-501")
get_section("Title 19, Chapter 55, Schedule A", corpus="rules")
get_section("Building Code 722.2.1.1.4")
get_section("Section BC 722", offset=20000) # the next part of a long text
get_section("§ 2-01", corpus="rules", offset=25) # the next page of a listAppendices, schedules, reference standards and other text outside a section have records of their own (see What the index holds): RS 18-1 works like a section number, and the others are cited with the title and chapter they sit in.
list_titles
List the chapters of a document, in order, each with its heading. The first line says how many there are (84 chapters, in order.); lists longer than 200, such as the Administrative Code (350) and the Rules (over 700), come in pages, and the first line says, for example, Showing 1 to 200 of 731. Call again with offset 200 for the next ones.
Each title of the Administrative Code has its own Chapter 1, so Administrative Code chapters are shown with their section range: Chapter 1 (§ 3-101 to § 3-196) — Chapter 1: Mayor, sorted by first section. Each title of the Rules has its own Chapter 1 too, so Rules chapters are sorted by title and labeled with it (Title 15, Chapter 18 — Chapter 18: Protection from Contamination…), and each title's name is on a line of its own before its first chapter, after a blank line (Title 15: Department of Environmental Protection). A Rules chapter with no number is listed after its title's numbered chapters, by its name: the Health Code (Title 24, New York City Health Code), each of the Rent Guidelines Board's yearly orders (Title 30, Apartment & Loft Order #49 (2017)), and appendices such as Title 62, Appendix A to Title 62. Through 0.6.2 the index did not record Rules titles: the Rules came as one list sorted by chapter number, with every title's Chapter 1 together and only the headings to tell them apart. An index built before 0.7.0 still gives that list. Through 0.6.0 the list came in no order, and lettered chapters showed a cut number (Chapter 18- for Charter Chapters 18-A to 18-D).
Parameter | Type | Required | Description |
| string | yes |
|
| integer | no | Max titles to return (default 200, max 1000) |
| integer | no | How many to skip, for the next page (default 0) |
list_titles("charter")
list_titles("rules")get_title
List the sections in a chapter: the chapter's heading, then the citation and heading of each section, in order. Use get_section for a section's text. Numbers match whole: Chapter 1 is not Chapter 10 or Chapter 1-A. A number several chapters share (an Administrative Code or Rules Chapter 1) gives each of them. A bare number in the Charter, which has chapters and no titles, is a chapter, and the answer's first line says so: Read "11" as "Chapter 11": the Charter has chapters, not titles. In the Administrative Code and the Rules a bare number that finds nothing gets a hint to ask for Title 11 or Chapter 11.
In the Administrative Code and the Rules, Title 24 gives every record the index places in that title, chapter by chapter, in the order list_titles gives: the numbered chapters, then the chapters with no number (in Title 24, the Health Code). Sections in no chapter come first (the Administrative Code's Title 31 has no chapters). Title 15, Chapter 18 (or 15 RCNY Chapter 18) gives only that title's Chapter 18. A Rules answer names each title on a line before its first chapter, as list_titles does. Title 16 gives Title 16 alone. Titles 16-A and 16-B share its section numbers (16-A's sections are § 16-501 on), and are asked for as Title 16-A and Title 16-B. Through 0.6.2 the index recorded no titles, so Title 16 brought 16-A and 16-B too (an Administrative Code chapter's title was worked out from its section numbers), and a Rules title found nothing; an index built before 0.7.0 still behaves that way. The Charter has no titles.
The index is flat: each source file keeps its records in document order, and a chapter is its heading record plus the records after it, up to the next chapter record. Through 0.6.0 this tool returned only the chapter's heading record, and Title 6 found nothing. Through 0.6.2 a chapter ran on into the next file whenever that file's chapter had no number: the Health Code (a chapter headed "New York City Health Code") was listed in Rules Chapter 21, the Administrative Code's local laws by year in the chapters before them, and Title 31's sections in Title 28's Chapter 3. Now a chapter record with no number (Preamble, 2016, New York City Health Code), or a section in no chapter, ends the chapter before it; those records are in no chapter here, and search and get_section find them.
Parameter | Type | Required | Description |
| string | yes |
|
| string | yes | A chapter ( |
| integer | no | Max records to return (default 200, max 1000) |
| integer | no | How many to skip, for the next page (default 0) |
get_title("charter", "Chapter 11")
get_title("admin_code", "Title 6")
get_title("admin_code", "Title 3, Chapter 1")
get_title("rules", "Title 15, Chapter 18")get_version
Return the currency date for each document. Each corpus updates on its own schedule — the Charter and Administrative Code track enacted local laws, while the Rules update independently as agencies adopt new rules.
No parameters required.
get_version()Example response:
NYC Charter: Current through Local Law 2026/112, enacted June 19, 2026, (854 sections; indexed 2026-06-29T12:33:00.864Z)
Administrative Code: Current through Local Law 2026/112, enacted June 19, 2026, (12587 sections; indexed 2026-06-29T12:33:09.801Z)
Rules of NYC: Current through rules effective July 1, 2026. (8671 sections; indexed 2026-07-01T12:43:45.635Z)whats_changed
What changed in this server, newest first, from WHATS-CHANGED.md, which ships with the package. Covers new tools, corrections and other changes a reader would notice; daily law text updates are not listed (see CHANGELOG.md). Corrections say what to re-check if you used the old answer. Returns text plus structuredContent matching the tool's outputSchema.
Parameter | Type | Required | Description |
| string | no |
|
| string | no |
|
| integer | no | 1 to 50, default 10 |
whats_changed()
whats_changed(tag="Correction")about_betanyc
Who built the server (BetaNYC, a project of the Fund for the City of New York), its version and repository, where to report a bug in this server or ask for a new feature, and links to BetaNYC. No parameters.
about_data
Where the law text comes from, answered from DATA-SOURCES.json, which ships with the package. There is one source per document (charter, admin-code, rules), each from American Legal Publishing's bulk XML download, the code library the NYC Law Department contracted for. For each it gives the publisher and link, whether it is the official text (the source is; this server's text is not, because the build cleans it, so figures_official is false), how it reaches this server, what BetaNYC changed, when this server's index was built for that document (read from versions.json at run time; get_version gives the publisher's own "current through" line), where to check a section, how to report an error in the text or in this server, and the corrections that touched it. Questions about the data go to BetaNYC at lab@beta.nyc. Returns text plus structuredContent matching the tool's outputSchema.
Parameter | Type | Required | Description |
| string | no |
|
about_data()
about_data(topic="rules")data.json is a DCAT-US 3.0 catalog generated from DATA-SOURCES.json (python3 scripts/whats_changed.py about-data catalog DATA-SOURCES.json); never edit it by hand.
whats_changed, about_betanyc and about_data are the three tools BetaNYC adds to each of its MCP servers. src/betanyc-tools.ts is a copy of the canonical file in BetaNYC's workspace (shared module 1.5.2); never edit the copy. Their text ends with the one-line disclaimer (the full one with NYC_CLR_FOOTER=full), and they do not use up the full footer meant for the first law answer.
Testing and CI
Running tests
npm testnpm test builds the TypeScript source first (pretest script), then runs the full suite with node --test. Every test file in the table below runs together, except two sets for the website: the browser tests (npm run test:site; run npx playwright install chromium once first) and the layout checks on the committed data (npm run test:site-data, in test/site-data/). Those two stay out of npm test on purpose: the daily refresh runs npm test before it commits new law text, and a change in the data's shape should stop the website's deploy, not the refresh. On a laptop the whole run, build included, takes about 4 seconds (measured October 2026). npm run audit:coverage checks the index against the downloaded ZIPs in data/raw/ (see What the index holds); it needs npm run fetch-data first, so it is not part of any test run.
Test layers
File | What it covers |
| Unit tests for the |
| Regression tests for the content-leak fix (PR-A0): undecoded |
| Invariant assertions over the committed |
| In-process tests for the MCP handler functions ( |
| Plain-language questions (issue #30). Unit tests for stopword and question-word stripping ( |
| How the word fallback ranks (round 2 of #49): |
|
|
| A missing or unreadable index file (through a broken |
| The |
| What the npm package carries (issue #95), from |
| Disclaimer footer modes (issue #25). |
| Strict tool schemas (issue #19). Asserts every tool in |
| Every tool carries |
| The tools/list JSON plus the server instructions stay under a size budget ( |
| Every failure (bad parameter values, a missing parameter, an unknown parameter or tool) is |
|
|
| The checks in |
| The commit step of |
| Tool inputs at the edges (issue #95), on a hand-made index in a child process plus loose checks on the committed index: an empty, blank or quotes-only search is an error that names |
| Every law-text answer has a source line per document (publisher, the |
| Each bundled |
| Starts the built server with a bad |
| Build pipeline smoke test (Layer 5a). Feeds tiny hand-authored AML-shaped XML fixtures to the pure builder |
| The release guard (issue #95): the real build's inputs ( |
| Text set in the Symbol font (issue #88): the vendored Unicode table (the codes the publisher's files use, the rule for codes with two Unicode values, no private-use characters); the reviewed list (the only codes that change, each agreeing with the table) and the two codes kept as they are; real paragraphs from the July 2026 files, Building Code BC 722.2.1.1.4 ("For s ≥ 4t", "≤"), Rules § 2-08 ("ΔP ≥ H × (ΔDr/H)", with the real "×" outside the run left alone), a Symbol bullet kept as "·", 1 RCNY § 101-14's "§§" footnote marks kept (never "♣♣") and Mechanical Code units ("Btu·in/(ft2·h·°F)"); an unreviewed code kept and reported with its record; a reviewed code that is the same in Unicode ("(") counted as kept, not changed, so the build log's "characters changed" is exact (#95); character references skipped whole; a HEADING that copies its PARA without the font (BC 1609.7.1), with its character references written back as they were, never decoded twice; and the guards: the same characters in any other font or in no font are not changed, and every fixture file parses to the same tree with the mapping on. |
| The publisher's bold and italic (follow-up to #78), on a hand-made fixture ( |
| Text held outside sections (issue #78), on hand-made fixtures in the publisher's shape ( |
| The Construction Codes' subsections (issue #76), on a hand-made fixture in the publisher's shape ( |
| The site structure (issue #61), on American Legal's own XML: the 44 Charter fixtures in |
| Tables (issue #65), on two of American Legal's own Rules files ( |
| The website build (issue #62), from the 44 Charter fixtures, without the Pagefind index: a page for every record, matching |
| The website's deploy workflow (issue #64), read as text: it runs on a push to |
| The Administrative Code's site rules on small made-up data (issue #65), so the daily refresh, which runs |
| Run by |
| Run by |
| Citations the website gives and the MCP takes, both ways, on a hand-made index and a hand-made |
| The Rules on the site, from the hand-made Rules fixtures ( |
| Run by |
| Run by |
| Run by |
| Run by |
| Run by |
| Run by |
| Kinds of search result and the search page's filters (issue #65), from the Charter, Administrative Code ( |
| Run by |
| Run by |
| Run by |
| Run by |
| The picture inventory for the alt-text tool (issue #87), on a made-up source in American Legal's shape ( |
| The alt-text sidecar files ( |
| AI drafts ( |
| The review server ( |
| Run by |
| The inbox mode of the picture page ( |
| Run by |
|
|
| Run by |
| Run by |
| Rebuilds each committed |
| A rebuild with no source change must leave every tracked output byte-identical. Unit tests for |
| Unit tests for the pure helpers in |
|
|
|
|
| The What's changed release gate end to end, in a throwaway git repo with a stub |
| End-to-end runs of |
Evaluation set
eval/questions.json holds realistic questions with known answers in the law text (which section sets up the Independent Budget Office, where the Open Data Law is, how long a sidewalk shed can stay up), written on 2026-11-18 before the first scoring run. npm run eval runs them offline against the bundled index; npm run eval -- --save also writes the results to eval/runs/ (--save=NAME for a named run, --note=TEXT to say what it is for), and never overwrites an earlier run. It is not part of npm test: run it before a minor release and keep the result.
Results so far, all on 2026-11-18:
11 of 12 on the first set (eval/runs/2026-11-18.json). Q10, the plain-language sidewalk-shed question, missed Administrative Code § 28-220.1 in the top 10.
12 of 17 after five questions asked the way a person would ask, with no citation (Q13 to Q17), were added and Q09 was made to check the penalty amounts it asks about (review-fixes, and the same again in round2-before). Q10, Q13, Q14, Q15 and Q16 failed. The cause was not missing word weights, as first written: the word search ranked any section with more of the question's words first, before its weights applied, so long definitions sections won.
15 of 17 with the ranking described under
search(round2-after). Q10, Q13 and Q16 now pass, and no question that passed before fails. Two still fail, and keyword ranking cannot fix them: in Q14 ("How warm does my landlord have to keep my apartment in winter?") the right section, Administrative Code § 27-2029, "Minimum temperature to be maintained", contains none of the question's words. In Q15 ("Where is smoking banned in NYC?") § 17-503 does contain "smoking", but so do 127 other sections, and it lacks "banned", the rarest word, which 8 other sections have. With the rest of that round's fixes the result is the same, 15 of 17 (round2-final).
Differential test (Layer 4 — occasional cadence)
A cross-engine differential test compares our JS extraction against an independent Python reference over 44 committed charter XML fixtures. It is not part of npm test — it runs only when explicitly invoked:
npm run test:diffThe test shells out to python3 (stdlib xml.etree.ElementTree + itertext()) and asserts that both engines agree on normalized section text for all 393 sections across the fixture set. If python3 is not on PATH, the test skips gracefully rather than erroring.
The fixtures live in test/fixtures/diff/xml/ — 44 files selected deterministically (every 2nd file by sorted filename from data/raw/charter/XML/, always including 0-0-0-1277.xml). They are committed to the repo so the test runs in CI without downloading ZIPs.
Calibrated baseline (2026-06-02): 393/393 sections agree after the comparison normalizer. One intentional formatting difference is neutralized before comparing: the JS path appends a trailing space after standalone digit-dot enumeration markers ("1.") to restore a formatting separator that empty <TAB/> elements drop; Python's itertext() returns raw source text. Both are faithful to the source; the space is a readability aid. The comparison normalizer collapses "N. " → "N." on the JS side so the comparison tests token order and content only. No allowlist entries are required.
Continuous integration
.github/workflows/test.yml runs npm ci && npm run build && npm test on every pull request and push. Node matrix: 20.x and 22.x. The manifest declares engines.node ">=20" — a floor only; the server uses no APIs newer than Node 20, so newer Node releases are supported even though CI tests the 20.x/22.x pair. Node 18 was dropped because it reached End-of-Life on 2025-04-30; the manifest previously declared >= 18 but CI never tested it.
.github/workflows/test.yml also runs a What's changed job: node scripts/auto-release.js check-whats-changed --base-ref <merge base with main>. It validates WHATS-CHANGED.md with scripts/whats_changed.py (copied unchanged from BetaNYC's workspace; never edit it here), checks that old entries are only ever added to, that a version bump in a pull request has an entry, and that an ## Unreleased: entry comes with a hand-bumped, undated release in RELEASES.md.
It also runs an About data job: python3 scripts/whats_changed.py about-data check DATA-SOURCES.json --tools-file <the built server's tool list> (every tool has a source, the file has no errors), about-data catalog DATA-SOURCES.json --check (data.json is current), and the JSON Schema and DCAT-US 3.0 validators (scripts/tests/catalog_validate.py, with jsonschema==4.26.0, referencing==0.37.0 and rfc3987==1.3.8 pinned through uv). release.yml runs about-data check --release before npm publish.
It also runs an Index build record job: node scripts/check-index-build.js --warn. It says, as a warning only, when the committed index was not built by the build code being tested. That is normal on a pull request that changes the build code, and on main until the next daily refresh rebuilds the index, so it never fails the run. release.yml runs the same check without --warn (see Releases).
It also runs a Charter site job (the name is older than the Administrative Code): npm run test:site-data (the site's layout on the committed data), npm run test:site in Chromium, and, once the daily refresh has committed data/structure/, npm run build-site over the whole Charter and Administrative Code. That job deploys nothing; deploying is deploy-site.yml (see Deploy).
.github/workflows/differential.yml runs npm run test:diff on manual dispatch (workflow_dispatch) and nightly at 03:00 UTC. It is intentionally off the per-PR/per-push path. Python matrix: 3.11 and 3.12 (covers the team's 3.11–3.14 spread; harness uses stdlib-only APIs compatible with 3.8+).
.github/workflows/refresh-data.yml refreshes the corpus index from AML daily at 11:00 UTC (07:00 EDT / 06:00 EST) and on manual workflow_dispatch. It runs the full pipeline (fetch-data → build-index → alt:images → a report-only coverage audit → update-changelog → npm test) and commits the refreshed index back to main with the built-in GITHUB_TOKEN only when the corpus version actually advances — a no-op rebuild produces no commit. A commit with new law text also bumps the patch version and triggers an npm release (see Releases). The site structure, data/fetch-provenance.json (which ZIP bytes were downloaded; see Refreshing the index from AML) data/index-build.json (which build code made the index; see Releases) and data/pictures/ (the pictures for /describe-pictures/; see Picture descriptions) are committed with it; a change to those alone (a first build, a change to the build code that left the index as it was, or American Legal re-zipping text that did not change) is committed by itself, with no version bump and no release, since none of them is in the package. A change to the build code that does change the index is committed like new law text, the day after it merges. A download that fails a check stops the run red before build-index, so nothing is committed. Either commit also starts the website's deploy (see Deploy), except a commit of data/fetch-provenance.json or data/index-build.json alone, which changes nothing the site shows. npm run alt:images has continue-on-error: a picture it cannot read leaves data/pictures/ as it was, the law text is still committed, and the run goes red at the end. Because npm test runs after the fetch and rebuild, the tests see that day's new data. The refresh runs npm test only: the website's checks on the real data (npm run test:site-data, npm run test:site) are kept out of it, so a new title or a new year of local laws can stop a deploy but never the refresh. A test must never assume what data/index/json/ says today: pin the values it depends on inside the test, or the refresh goes red on exactly the days law text changes and the new text never gets committed. The coverage audit (npm run audit:coverage, see What the index holds) writes how much of each document reached the index, and any text that did not, to the run's summary page; it has continue-on-error and nothing reads its result, so it never blocks the tests, the commit, a release or a deploy. The "Last index update" block below is stamped by that job.
Releases
.github/workflows/release.yml is the only workflow that publishes to npm. It checks that the bundled index was built by the build code at the tag, runs the test suite, checks that the tag matches package.json, publishes with provenance, and creates a GitHub Release with generated notes. It starts in one of two ways.
The index-build check (issue #95). The package ships the committed index, and a pull request that changes the build code (scripts/build-index.js and what it imports) does not rebuild it: the next daily refresh does. Until then the index on main is older than its code. build-index writes data/index-build.json, a fingerprint of the build code (those files, the data files they read, and the locked versions of the npm packages they use) and the sha256 of each index file it wrote. node scripts/check-index-build.js recomputes the fingerprint at the current commit and compares. release.yml runs it first and refuses to publish when they differ, naming what changed. An automatic release always passes, because its tag is on the refresh's own commit. Run the check before you tag a manual release; if it fails, wait for the refresh (or start it: gh workflow run refresh-data.yml -R BetaNYC/nyc-charter-laws-rules) and tag a commit that includes the refresh's commit.
Automatic patch releases (law text changed). When the daily refresh commits new law text, the same commit bumps the patch version (package.json, package-lock.json and server.json) and adds a dated "Automatic data release" entry to RELEASES.md naming which corpora moved. The job then pushes the vX.Y.Z tag and starts release.yml on it with gh workflow run (a tag pushed by the built-in token does not trigger workflows by itself; workflow_dispatch is GitHub's documented exception). Days with no new text produce no release. An automatic release ships main as it stands, so code merged since the last release goes out in the next one; bump the minor version by hand first if that code warrants it.
If the current version is not on npm yet (for example you bumped it by hand and have not tagged it), the refresh still commits data but does not bump past your version. If the release cannot be prepared (for example the npm registry is unreachable), the new law text is still committed without a version bump and the refresh run goes red. If an automatic release fails, its Release run goes red and every following refresh run goes red too, naming the run to rerun, until the version is published. To recover, fix the cause and rerun the failed Release run (Actions → Release → Re-run, or gh run rerun <id> --failed). Never re-tag or bump to recover.
Manual releases (code changes).
In a pull request: bump the version in
package.json,package-lock.jsonandserver.json(bothversionfields), add a RELEASES.md entry headed## vX.Y.Z — Unreleased, and, for a change a reader would notice, a WHATS-CHANGED.md entry headed## Unreleased: Title, tagged MCP, whose MCP version line links toRELEASES.mdwith no anchor.release.ymlrefuses to publish ifserver.jsondiffers frompackage.json. Once merged, the refresh keeps committing law text but does not release automatically until this version is on npm, so npm users get no new law text meanwhile. After the hand release has been onmainfor more than two days (New York dates), each refresh run goes red to say so.On release day, one commit on
main, with the New York date (TZ=America/New_York date +%F):## Unreleased: Titlebecomes## YYYY-MM-DD: Titlein WHATS-CHANGED.md. The title must stay the same; the check rejects a changed one.## vX.Y.Z — Unreleasedbecomes## vX.Y.Z — YYYY-MM-DDin RELEASES.md.The entry's MCP version link gains the new RELEASES.md anchor. Compute it, never type it:
python3 -c "import sys; sys.path.insert(0, 'scripts'); import whats_changed as w; print(w.github_slug('vX.Y.Z — YYYY-MM-DD'))"(forv0.5.0 — 2026-11-13it printsv050--2026-11-13).If the entry is tagged Data and Correction, add its anchor (the dated heading as
github_sluggives it, such as2026-11-24-missing-building-and-fire-code-text-and-appendices-and-wrong-chapter-lists) tocorrectionsin DATA-SOURCES.json for each document it touched, newest first, and runpython3 scripts/whats_changed.py about-data catalog DATA-SOURCES.json.npm testfails while a released Data correction is in no document's list.Check:
node scripts/auto-release.js check-whats-changed --releasemust pass. It is the same gaterelease.ymlruns beforenpm publish.
Check that the bundled index was built by this code:
node scripts/check-index-build.js. If it fails, the build code changed after the last refresh: wait for the next one (or start it, as the message says), pull, and check again. The refresh commits on top of your release commit and keeps the version, so tagmainafter it.Tag that commit and push:
git tag vX.Y.Z && git push origin vX.Y.Z(the tag must matchpackage.json, or the workflow fails). Ifrelease.ymlstops at the index-build check anyway, nothing was published: delete the tag (git push origin :refs/tags/vX.Y.Zandgit tag -d vX.Y.Z), wait for the refresh, and tag again. This is the one case where re-tagging is right, because the version never reached npm.
Automatic data releases never get a WHATS-CHANGED.md entry and pass the gate. The refresh does not prepare one while WHATS-CHANGED.md has an Unreleased entry: in the normal flow that entry sits beside an unpublished hand bump, which already pauses automatic releases. If an Unreleased entry ever sits beside a version that is already on npm, the refresh commits the law text without a release and goes red, naming the fix, rather than ship the entry undated.
Authentication. release.yml is set up for npm trusted publishing (OIDC, no stored token). Until the trusted publisher is configured on npmjs.com it falls back to the NPM_TOKEN secret. One-time setup, by a package owner:
On npmjs.com, open
@betanyc/nyc-charter-laws-rules→ Settings → Trusted Publisher → GitHub Actions.Fill in exactly (case-sensitive): Organization or user
BetaNYC; Repositorynyc-charter-laws-rules; Workflow filenamerelease.yml(filename only, not the path); Environment name left blank. Under Allowed actions, also allow direct publishing withnpm publish: configurations created after September 3, 2026 allow onlynpm stage publishby default, and the workflow publishes directly, so without this box npm rejects the trusted-publishing publish. Save. npm does not validate these fields when you save them.Set Settings → Publishing access → "Require two-factor authentication and disallow tokens". npm's docs say trusted publishers keep working under that setting, so the next release can only succeed through trusted publishing: a green Release run after this point is the confirmation, provided its "Publish to npm" step actually ran (release.yml skips that step when the version is already on npm, for example on a rerun). (A success before this step does not prove it, because the workflow falls back to
NPM_TOKEN, and npm's docs give no way to tell from the run log which one was used.) If that release fails with an authentication error, the trusted publisher is misconfigured. Re-check step 2 and rerun it. If you re-allow tokens instead, repeat step 3 once trusted publishing is fixed.Once a release has succeeded with tokens disallowed, remove this repo's access to the
NPM_TOKENsecret.
MCP Registry. After each successful release, .github/workflows/publish-mcp.yml lists that version in the official MCP Registry as io.github.BetaNYC/nyc-charter-laws-rules, from server.json, using GitHub OIDC (no secret). glama.json claims the server on Glama.
Package release history lives in RELEASES.md; CHANGELOG.md is machine-generated and tracks corpus data updates only. WHATS-CHANGED.md is the plain-language record of what a reader would notice.
Legal disclaimer
This server is for research and informational purposes only. It does not provide legal advice.
Caveats are encoded at three levels so no response can be returned without one:
Server instructions — the full disclaimer below is sent once as the server's
instructionswhen a client connects, in every footer mode. Tool descriptions do not repeat it: it went out of them in issue #48, so it is not paid for on every turn. Some clients pass the instructions to the model and some do not, which is why level 2 never goes away.Response footer — every payload returned by the server ends with a disclaimer, regardless of which tool was called, what was found, or whether the call failed. By default the first response after the server starts carries the full footer below and every later response carries a one-line version (see
NYC_CLR_FOOTERunder Configuration).get_versioninstruction — theget_versiontool description explicitly instructs the AI to call it before answering legal questions, so every response is grounded in the correct version of the law.
Full footer (server instructions, and the first response)
⚠️ This information is for research and informational purposes only and does not constitute legal advice. NYC laws and rules are amended frequently — always verify the current text at codelibrary.amlegal.com before acting on any information. For the latest rules information, see rules.cityofnewyork.us. For legal matters, consult a licensed attorney.
Official disclaimer from American Legal Publishing: The Codes and other documents that appear on this site may not yet reflect the most current legislation or rules adopted by the City. In addition, certain textual errors and omissions may temporarily exist, resulting from problems in the source database provided to American Legal and from which this website was created. Although these errors and omissions are being corrected, any user discovering any such error is invited to contact the publisher at NYC.editor@amlegal.com or 800-445-5588 and/or the NYC Law Department at NYCCodeRulesCharter@law.nyc.gov.
Built by BetaNYC. Feedback and improvements welcome — file a GitHub issue.
One-line footer (every later response, by default)
⚠️ Not legal advice. Verify at https://codelibrary.amlegal.com/codes/newyorkcity/latest/overview.
Repository structure
nyc-charter-laws-rules/
├── WHATS-CHANGED.md ← what a reader would notice, newest first (ships in the package)
├── DATA-SOURCES.json ← where the data comes from, for about_data (ships in the package)
├── data.json ← DCAT-US 3.0 catalog, generated from DATA-SOURCES.json (ships in the package)
├── src/ ← MCP server (TypeScript); betanyc-tools.ts is a shared copy
├── scripts/
│ ├── whats_changed.py ← checks WHATS-CHANGED.md and DATA-SOURCES.json, writes data.json (shared copy; never edit here)
│ ├── tests/catalog_validate.py, mcp_shared/ ← CI validators for the two (shared copies)
│ ├── vendor/unicode-adobe-symbol/ ← the Unicode Consortium's Adobe Symbol table, unchanged (SOURCE.md)
│ ├── auto-release.js ← automatic releases and the What's changed release gate
│ ├── fetch-data.js ← thin CLI: downloads and checks the bulk XML ZIPs from AML (scripts/lib/fetch-zip.js)
│ ├── build-index.js ← thin CLI: reads ZIPs, writes JSON + Markdown indexes, the site structure and the build record
│ ├── check-index-build.js ← release guard: was the committed index built by this commit's build code? (issue #95)
│ ├── audit-coverage.js ← thin CLI: how much of the ZIPs' text reaches the index, and what does not
│ ├── build-site.js ← thin CLI: builds the website into _site/ (scripts/lib/site/)
│ ├── serve-site.js ← previews _site/ on 127.0.0.1
│ ├── alt-text.js ← thin CLI: picture descriptions, issue #87 (scripts/lib/alt-text/)
│ └── lib/
│ ├── fetch-zip.js ← https-only download, the checks on each ZIP, data/fetch-provenance.json
│ ├── fetch-retry.js ← politeFetch: User-Agent, timeout, retries on 429 and 5xx
│ ├── extract-text.js ← ordered-tree text-extraction helpers
│ ├── symbol-font.js ← Symbol-font text to Unicode while parsing (issue #88)
│ ├── index-build-record.js ← the build code's fingerprint and data/index-build.json (issue #95)
│ ├── build-corpus.js ← pure section builder (buildSectionsFromXml), unit-tested
│ ├── coverage.js ← where every word of one XML file ends up (audit-coverage.js, its tests)
│ ├── build-structure.js ← site structure: subdivisions, links, chapter and title names
│ ├── render-section.js ← renderSection: a section as ordered, typed blocks
│ ├── serialize-markdown.js ← the Markdown index, written from renderSection's blocks
│ ├── site/ ← the website: data model, pages, HTML writer, sitemaps, New York clock
│ └── alt-text/ ← picture inventory, sidecar store, AI drafts, review server and page, static build
├── site/
│ ├── template/ ← unchanged copies of BetaNYC's Pages template files
│ └── assets/ ← the site's own CSS and scripts (jump box, search, 404)
├── data/
│ ├── raw/ ← downloaded ZIPs (gitignored — build locally)
│ ├── fetch-provenance.json ← which ZIP bytes the index was built from (committed by the daily refresh; not in the npm package)
│ ├── index-build.json ← which build code made the index, checked by release.yml (committed by the daily refresh; not in the npm package)
│ ├── index/
│ │ ├── json/ ← committed: charter.json, admin_code.json, rules.json, versions.json (ships in the package)
│ │ └── markdown/ ← committed: charter.md, admin_code.md, rules.md (not in the npm package)
│ ├── structure/ ← site structure per document (committed by the daily refresh; not in the npm package)
│ ├── alt-text/ ← BetaNYC's picture descriptions, one JSON per book (not in the npm package)
│ ├── pictures/ ← the pictures /describe-pictures/ shows and their inventories (npm run alt:images; not in the npm package)
│ └── source-errors.json ← errors BetaNYC found in the publisher's text, for /source-errors/ (not in the npm package)
├── _site/ ← the built website (gitignored; npm run build-site)
└── dist/ ← compiled MCP server (built locally)The JSON and Markdown indexes are committed to the repo. Anyone who clones it gets every section of all three documents immediately, with no index build needed to browse them or run the server (npm run build compiles the server itself). The npm package carries only what the server reads at run time: dist/, data/index/json/, WHATS-CHANGED.md, DATA-SOURCES.json and data.json, plus package.json, README.md and LICENSE, which npm always includes.
Data source
All content is sourced from publicly available bulk XML downloads hosted by American Legal Publishing. No API key required. DATA-SOURCES.json describes each source (what BetaNYC changes, where to check a section, how to report an error), and the about_data tool answers from it.
Document | Sections | Current Through | Bulk XML source |
NYC Charter | 854 | LL 2026/094, amendments through May 17, 2026 |
|
NYC Administrative Code | 12,558 | LL 2026/094, amendments through May 17, 2026 |
|
Rules of the City of New York | 8,645 | Rules effective through May 20, 2026 |
|
AML publishes updated ZIPs as new local laws and rules are adopted. Re-run npm run fetch-data && npm run build-index to refresh the index and commit the updated files.
What the index holds
Each record has a citation, a heading, its text and American Legal's record id. Most records are sections and chapters. Since issue #78 the index also has a record for each part of the publisher's XML that holds text of its own outside a section:
the Administrative Code's Building Code Reference Standards (Title 27, the 1968 code's appendix):
RS 3,RS 18-1,RS 13-1, Chapter 1and the rest, about 700,000 characters;the Rules' appendices and schedules, such as the private sewer appendices (
Title 15, Chapter 23, Appendix A-1toA-8), the Water Board's rate schedule (Title 15, Chapter 42, Appendix A, and its…, Part I), penalty schedules (Title 19, Chapter 55, Schedule AandB), and the Personnel Rules'Title 55, Appendix A, Rule I;the Health Code's Board of Health resolutions, one record,
New York City Health Code, Resolutions, with each resolution under its own heading line (the publisher puts them in a section that has no heading of its own);editor's notes and amendment lines on a subchapter, article or part (
Title 3, Chapter 2, Subchapter 3).
A record's citation starts with the numbered levels it sits in, as a chapter's carries its title, then the number its heading starts with: "Subchapter 3: Domestic Partnerships" in Title 3, Chapter 2 is Title 3, Chapter 2, Subchapter 3. The publisher numbers subchapters, articles and appendices afresh in each chapter (ten chapters of the Administrative Code have a Subchapter 3), so the number alone would name many records. A reference standard is the exception: "REFERENCE STANDARD RS 18–1" is RS 18-1, with a plain hyphen so it can be typed, because the code's own name for it is unique, and the parts inside one are named from it (RS 13-1, Chapter 1). A heading with no number goes last, whole (Title 15, Chapter 20, Appendix). Two records share a citation only where the publisher gives two subchapters of one chapter the same number (three pairs in the July 2026 Administrative Code, each marked "*" by the publisher); their headings tell them apart. No such record shares a citation with a section or chapter, so get_section("Schedule A", corpus="rules") still finds the one section cited that way. When no citation matches, get_section looks in headings, so a distinctive piece of one finds its record without the long citation (Water and Wastewater Rate Schedule, Chapter D5).
Each Administrative Code and Rules record also carries titleNumber, the number of the title it is in, as the publisher's title heading writes it ("15", "16-A", "38-A"); a chapter record also carries titleHeading, that title's heading ("Title 15: Department of Environmental Protection") (issue #59). They come from, in order: the title around the record in its own file; its chapter's anchor name in the XML (T15C018 is Title 15, Chapter 18); or, for a chapter with neither, the last title before it in the publisher's record order (the number on each record). In the July 2026 Rules that last rule places 24 chapters: the Health Code (Title 24), the Rent Guidelines Board's yearly orders (Title 30), Appendix A to Title 62 and Title 3's Chapter 11; for every other record, record order gives the same title as the first two rules (build-index prints how many do not, which should be 0). The Charter has no titles, and neither do the Administrative Code's local laws by year, which sit in its "Appendix A: Unconsolidated Local Laws". A Rules citation is titleNumber, RCNY and the citation: 15 RCNY § 1-01. An index built before 0.7.0 has neither field.
Each record carries a level, the publisher's name for its level, except a section inside a chapter (nearly every record): Chapter for a chapter, Section for a section in no chapter (the Administrative Code's Title 31), and Appendix, Part, Subchapter and so on for these records. get_title reads it to know where a chapter ends (see get_title). An unnumbered part with no sections inside it, such as a reference standard's CONTENTS, is read into the record around it, under its heading line. A record never takes text that a section inside it has. The text a publisher puts on a whole title (front matter, and a few editor's notes) is left out: the index has no title records.
When a section's own heading is empty, or its first paragraph starts with the heading and says more, the paragraph is the heading. Two records in the July 2026 files: Building Code § BC 602, whose heading is empty ("Section BC 602: Construction Classification"), and § 21-905, whose heading was only its number.
Text the publisher sets in the old Symbol font (<CHARFORMAT font-name="Symbol">), which shows math signs and Greek letters in place of ordinary characters, is changed to the character the font shows while the XML is read (scripts/lib/symbol-font.js, issue #88): Building Code BC 722.2.1.1.4's "For s ³ 4t" reads "For s ≥ 4t". Only reviewed codes change (REVIEWED_SYMBOL_CODES: D S W a m q r s £ ³ ´ Ö ( to Δ Σ Ω α μ θ ρ σ ≤ ≥ × √ (), each checked at load against the Unicode Consortium's Adobe Symbol table in scripts/vendor/unicode-adobe-symbol/. The publisher does not always mean a Symbol character as the font draws it: 1 RCNY § 101-14 sets its "§§" footnote marks in Symbol, where the font draws "♣♣". So "§" and "·" (mostly list bullets, but "times" in Mechanical Code units such as "Btu·in") were reviewed and are kept as they are (KEPT_SYMBOL_CODES), and any other character in a Symbol run is left as it is and named by build-index as an "unreviewed Symbol code", with its book and record id, so it can be read in context before it is added to the list. Text in any other font is not changed. When a record's HEADING is the publisher's plain copy of its PARA, the same characters change in the HEADING. build-index prints, per document, how many Symbol runs it read, how many characters it changed and kept, and how many headings it matched. A reviewed code that is the same character in Unicode ("(") is counted as kept, not changed. Measured on a local build from the July 2026 files, not the later files the committed index is built from: 454 runs in the Administrative Code and 467 in the Rules (none in the Charter), changing the text of 48 and 14 records, with no unreviewed code. Other symbol fonts are not changed yet: "WP Greek Helve" in the Administrative Code (the Building Code's over-strength factor Ω0 reads "S 0" in Table 1613.5, and "μmol/J" reads ":mol/J" in §§ 28-1001.2.1 and 28-1001.2.2) and "Wingdings" in the Rules (check boxes read "o" in 28 RCNY § 25-101).
npm run audit:coverage checks this against the ZIPs in data/raw/. For each document it counts the characters in the XML, how many reach the index, and what is left out and why: a paragraph that repeats its heading, a heading of a part with no text of its own, title-level text. It then lists every piece of text the index does not have, with its file, record and where it sits. --check exits 1 when there is any, or when a piece of text is in two records' text. On the July 2026 files nothing is left unread: the index holds 99.99% of the Charter's text, 99.80% of the Administrative Code's and 99.78% of the Rules', once repeated headings are taken out. The rest is headings of parts with no text of their own, and title-level text.
Site structure (data/structure/)
The index's text is flat. Its subdivisions run together, and its cross-references are plain words. build-index also writes data/structure/<corpus>.json for the website (epic #68), from the same XML in the same run. The MCP server does not read it, and it is not in the npm package.
BetaNYC builds this file from American Legal Publishing's bulk XML. The anchors, link targets and titles taken from the publisher's chapter key are worked out by BetaNYC and can be wrong. It is not an official record.
Per section, in index order:
parents: the Title, Chapter, Subchapter, Article and so on that the section sits in, outermost first, each named ingroupswith its heading. A chapter file that has no Title record around it (the publisher puts a Title's record only in its first chapter's file) takes its title from the publisher's anchor name for the chapter (T03C007is Title 3, Chapter 7). When nothing matches, the chapter has no title rather than a guessed one;titleStatscounts each case.blocks: the paragraphs oftext, each astart/endslice of it. A subdivision has itslabelas printed (a.,(1)), itsdepth(the publisher's indentation) and ananchorbuilt from its labels ((b)(1)), with-2added when the law repeats a label in one section. Editor's notes arenoteblocks. A subsection's heading line ("102.4 Smoking.", seesubsectionsbelow) is asubheadingblock whoseanchoris the subsection's number (102.4), and the subdivisions under it start a new list anchored under that number: item (1) of 102.4 is102.4(1), whatever other subsections hold a (1). A citation for one of them puts the subsection's number in place of the section's: Section FC 102 and102.4(1)make "Section FC 102.4(1)" (citeWithAnchorinsite/assets/jump.js, used for search titles, link names and Copy citation). A subsection whose number does not start with the section's (a few publisher's typos, and the Rules' "3.1.1" under "SECTION I") follows a comma: "Section BC 428, 4285.3.3". A subsection line with no number ("Appendix A") has no anchor, and its subdivisions are anchored at the section as before.-2is still added when one list repeats a label inside one subsection or section, and when the publisher gives two subsections one number (3 in the July 2026 Administrative Code).links: each cross-reference as astart/endslice oftextand its target, one of:a section:
corpus, the publisher'snamefor the target, itsid, andanchorwhen it points into a subdivision;a Title or Chapter heading that is not a section:
corpus,name,idandgroup: true;a web address:
kind: "web"andurl;an attached file:
kind: "file"andfile;or, when the target is not found,
corpusandnamewithresolved: false. When the publisher put the target's anchor id or name on more than one record, the link is not pointed at either: it also hasambiguous: true.linkStatscounts these.
marks(only when there are any): the publisher's bold and italic runs, each[start, end, look], a slice oftext, withlookone of"b","i"or"bi". Read from its<CHARFORMAT bold="1">and<CHARFORMAT italic="1">elements, the nearest one deciding, so nothing is guessed from wording. Display only: the index'stextis the same with or without them, byte for byte. A paragraph whose marks would move its text in any way gets none (none in the July 2026 files).rows(on a table's block only; issue #65): the table's rows, each a list of cells, each cell[start, end]or[start, end, extra], a slice oftext.extraholdsh: 1for a header cell,csandrswhen the cell spans more than one column or row,al("r"or"c") when the publisher right-aligns or centers it, andbr, the offsets where a new line starts inside the cell. Read from the publisher's markup: a<TABLE>is the only content of its paragraph, its<ROW>s hold<COL>s (the cells), and a<CELL>inside a cell's first paragraph saysheader="true",cells-merged-rightandcells-merged-down(a row under a merged-down cell leaves that column out, as HTML does). A second paragraph or a<LINEBRK/>in a cell starts a new line. The cells cut the block's text in order, with a space or nothing between two of them (nothing where the publisher's markup runs two cells' words together, as the index does); if the marks would move the text at all, the block has norows. Display only: the index's text for a table is unchanged. July 2026: 2,324 tables in 767 Rules sections and 5,089 in 982 Administrative Code sections, none in the Charter; every one getsrows(196,424 cells), and the structure files grow by about 14% (Rules 11.9 to 13.6 MB, Administrative Code 14.8 to 16.8 MB).pictures(only when there are any): how many<PICTURE>elements the section holds, figures, equations and some tables drawn as images. A picture has no text, so the index cannot show it, and a paragraph holding only a picture adds no block at all.subsections(only when there are any): how many levels inside the section the index still does not read. The Construction Codes in the Administrative Code (Title 28), and some Rules sections, keep most of a section's text in "Subsection" levels under it (Section > Subsection > Normal Level). Since issue #76 the index reads them, in document order: each subsection's heading line, then its body, sotextreads "80.1 Title. This code shall be known … 80.2 Scope. …". The heading line is the publisher's HEADING when the subsection's own paragraph says the same characters (spaces aside), or only the start of them ("705.2" under "705.2 ABS plastic."), and holds no cross-reference; otherwise it is that paragraph, which keeps the words and the links (the HEADING is empty in 19 Administrative Code subsections and shorter than the paragraph in 2; 23 hold a cross-reference). If a paragraph ever says something other than its HEADING, both are kept, the HEADING first. On the July 2026 files this added text to 1,375 Administrative Code sections (1,356 had none before) and 90 Rules sections, and changed no other section's text by a byte; no level is left unread there, so the field is absent. It counts a level inside a subsection that is not its body, and any other level in a section that is not its body, a subsection or a record indexed on its own. The website says what it leaves out and links to the section at American Legal Publishing.
Known limits. Depth is the publisher's indentation. In the July 2026 build, 13 sections have labels with no indentation, and in 3 of them (Rules § 5000-02, § 5-08 and § 113-07) letters and numbers sit at one depth, so they get anchors like (1) and (1)-2 instead of (c)(1). History lines ("(Am. L.L. ...)") are ordinary text blocks, because the XML does not mark them.
The text is not repeated. Every offset points into text in data/index/json/<corpus>.json, and the file records that file's sha256 (indexSha256, the same as versions.json). A structure file built from other text fails test/structure.test.js. scripts/lib/render-section.js turns a section and its entry into blocks; the Markdown index is written from them, with the body joined back into one paragraph, so its bytes do not change.
The website (BetaNYC Law Reader)
npm run build-site builds a static website from the index and its structure: the BetaNYC Law Reader, at law.beta.nyc (epic #68). It builds the Charter, the Administrative Code and the Rules of the City of New York (DEFAULT_BOOKS in scripts/lib/site/config.js). The Rules need an index that names each record's title (titleNumber, since 0.7.0); with an older index the build leaves them out, says so on stderr and in metadata.json (skipped), and builds the other two (see The Rules). --charter-only builds the Charter alone, for a quick look. The build fetches nothing, and .github/workflows/deploy-site.yml publishes it (see Deploy).
What it builds, into _site/ (git-ignored, never committed):
Pages: a home page, the Charter's contents (one card per chapter, in the same grid as the other books' title cards: the chapter's number, its name, and how many sections it has; a repealed chapter keeps the publisher's "[Repealed]" and shows 0 sections), one page per chapter, one page per section at a path from its citation (
/charter/sections/259), a search page, an About page, a 404 page, Errors in the publisher's text (/source-errors/), and Picture descriptions (/describe-pictures/, built when the build has the Administrative Code or the Rules). Two sections that share a number (§ 20-t, § 530 and § 808) each get the number plus American Legal's id (/charter/sections/530-0-0-0-6575), and the plain path lists both. The Administrative Code's pages are described under The Administrative Code below, and the Rules' under The Rules.The contents tree, on every law page (section, chapter and shared-number pages), after American Legal Publishing's code library: the heading "Contents", the book's name, and every chapter in order as an underlined link, with the reader's chapter open to its sections and the reader's own page marked (
aria-current). Before each chapter that has sections is a disclosure button (a real button witharia-expandedandaria-controls, named "Sections in Chapter 2: Council"); only the reader's own chapter's sections are in the page, and opening another chapter loads its list from a small file,/charter/contents/<chapter>.json. On a wide screen (900px and wider) the tree is a column on the left that scrolls on its own to the reader's link, and a focused link never hides under its heading; "Hide" folds the column away (remembered on the next page) and "☰ Contents" brings it back. On a phone the tree sits behind "☰ Contents" above the breadcrumbs: a light-blue "you are here" bar naming the reader's chapter ("☰ Contents | Chapter 2: Council ▾", spoken "Contents, Chapter 2: Council"), so it does not look like the top bar's Menu button (Noel, 2026-11-23). Without JavaScript there are no buttons: the chapter links still work, a wide screen shows the tree, and a phone shows a closed "☰ Contents" fold, so the law text still starts near the top. The skip link jumps past the tree. It is the disclosure pattern (lists of links and buttons), not ARIArole="tree".On each section page: breadcrumbs, Copy link, Copy citation and Print as small chips (a soft fill and a thin border, NYSDS's ghost button recolored), previous and next links, each subdivision indented with its own link (
#(b)(1)), references to other sections as links, between the three books too (a book the build leaves out, such as the Rules on an index from before 0.7.0 or the other two in a--charter-onlybuild, gets plain text instead; links the structure marks unresolved or ambiguous stay plain text too), and one box at the bottom of the page (Noel, 2026-11-23: one warning, at the bottom, in two paragraphs): how current the text is, then how BetaNYC changed the text, a link to the section's own page at American Legal Publishing (https://codelibrary.amlegal.com/codes/newyorkcity/latest/NYCcharter/<id>; a chapter page links to the chapter's), and "BetaNYC modified this text. It is not legal advice." The footer's "The text comes from American Legal Publishing, and BetaNYC modified it" sentence is only on About, the one page without the box.On each chapter page: its own text, if it has any, then a jump list of its sections. On a wide screen the page then shows every section's full text in order, each under its own heading with an "Open this section" link to the section's page and a "Copy citation" button, and a "Back to contents" link that stays at the bottom of the window while the text scrolls and returns to the jump list (focused links are kept clear of it). There the jump list and the tree's links for this chapter jump within the page (
#s-4); a subdivision in that copy is#s-4(b)(1), and references to sections of the same chapter stay on the page. On a phone the full text is hidden, the jump list's links go to each section's own page, and a link to a copy (/charter/chapters/1#s-4(b)) goes on to the section (/charter/sections/4#(b)). Search does not index the copies, so each section is found once, on its own page.Notes, wherever law text appears: the amendment history line at the end of a section (a text block wholly in parentheses that starts with how the text was made or changed, such as "(Am. L.L. 2016/019, 2/19/2016, …)") is set in smaller type below a rule; an editor's note is in a gray box with "Editor's note:" in bold. The words are unchanged.
At the bottom of every page but About, in plain HTML: "American Legal Publishing's text is current through …" (the publisher's line from
versions.json), "BetaNYC's copy last changed on …" (indexedAt, in New York time; the index keeps no date for when the publisher's files were last checked), then, in one paragraph (Noel, 2026-11-23), the bold "BetaNYC modified this text. It is not legal advice." (on pages that are not law pages, "the law text on this site"), how BetaNYC changed the text, where the official text is (on a law page, that record's own page at American Legal Publishing), and a link to the full disclaimer on the About page. The About page (modeled on BetaNYC's Grounding AI with NY Open Data site) says why the site exists, how the law got online (BetaNYC's 2014 testimony in support of Intro 149, which became Local Law 37 of 2014, Administrative Code § 7-111), what BetaNYC changed, how current it is, who built it, how BetaNYC uses AI, the licenses, how to report a mistake (lab@beta.nyc or a GitHub issue) and how to support BetaNYC. It has no warning at the top and no bottom box; it ends with the Disclaimer section, which opens with the same bold line and then shows the full disclaimer, read fromFOOTERinsrc/tools.tswhen the site is built, so the site and the MCP server say the same thing, and says that the paragraph starting "Official disclaimer from American Legal Publishing" is the publisher's, written for its own site. Its last line, "Built by BetaNYC...", is left out, since the page footer says it; ifFOOTERstops ending with that line, the build stops.Search: one box, on the home page and the search page; every other page reaches it through the top bar's Search link. Its hint (
Try "§ 259", "259", or "budget office") is placeholder text inside the box. A citation (§ 259,259,charter 259,259(a),chapter 11) goes straight to its page, fromcitations.json; a number two sections share shows both. Words are searched with Pagefind, a static index the browser loads in pieces, with results by book, citation, heading and a highlighted snippet, links to the matching subdivisions, filters and paging. A Rules citation names its title:15 RCNY § 1-01,15 RCNY 1-01,Title 15 RCNY § 1-01,24 RCNY Health Code § 81.08andHealth Code § 81.08go to their page, and a bare§ 1-01lists every title's.Title 28, Chapter 1without "RCNY" is how the Administrative Code's pages cite its chapters too, so it goes straight only to the Administrative Code; when the Rules have one too, or only the Rules do, the search page lists them to pick from. A citation that names its book looks only in that book, so every citation Copy citation gives, and the MCP'sget_sectiontakes, comes back to its page:NYC Administrative Code § 27-506,Admin. Code § 27-506andNYC Charter § 1133(never the other book's section of that number),NYC Administrative Code Title 28, Chapter 1,NYC Administrative Code D302 Conversions to a multiple dwelling (MDL 9(2)),2 RCNY Appendix A,15 RCNY Chapter 19.1, Appendix. Building and fire code sections go by code:FC 102,§ FC 102,Section FC 102,fc102,RS 18-1,Reference Standard RS 18-1; a subsection with no page of its own goes to its section's page at the subsection (Section FC 102.4(1),BC E104.2.2,2 RCNY § 1-01.1). A subdivision's letters keep the case they were typed in (§ 11-1304(d)(2)(C)), and a page whose address names a part in another case (#(A)for(a)) goes to the part, when only one id matches. Each record's keys incitations.jsoninclude the one its own citation reads as (recordKeysinsite/assets/jump.js), andtest/site-data/citation-round-trip.test.jschecks every record of all three books. Without JavaScript, the box is replaced by a link to the contents, and there are no filters. Beside the results, two groups of checkboxes (NYSDS's, named by their labels, all checked to start) narrow them: Book (Charter, Administrative Code, Rules, in the site's order) and Kind of page (Sections, Chapters, Local laws). They are Pagefind filters (bookandkindon every law page, fromsite/assets/filters.js, which the build andsearch.jsshare); unchecking one keeps the choice in the address (?q=noise&book=Charter&book=Rules,&kind=Section&kind=Chapter), so a filtered search can be linked to, and Back and Forward bring back the results and the boxes together. The last checked box in a group stays checked, by keyboard or mouse (no box at all would mean no results, and the address has no way to say "none"); the status line keeps the results count and adds why, and says it again on a second try. The address keeps the book's short name (book=Admin+Code), as before. A search link from before the "Local laws" kind (2026-11, issue #65) that nameskind=Sectionnow leaves the local-law notes out: they were sections then. Each result says which book and which kind it is: Section, Chapter, Local law, or Local laws by year.Data files: each chapter's list of sections for the contents tree (
/charter/contents/<chapter>.json), each Administrative Code and Rules title's list of chapters (/admin-code/contents/titles/<title>.json,/rules/contents/titles/<title>.json), the Rules' numbers that are in one title only (/rules/numbers.json, for the 404 page),redirects.json(American Legal ids to our paths, for every book and the title records; the 404 page uses it, so/charter/0-0-0-1263lands on § 259,/NYCadmin/0-0-0-48176on the Building Code's chapter page and/NYCrules/<id>on that Rules record's page),index.json(the contents as one tree),metadata.json(build time in New York time, this repo's commit, each book's index sha256),citations.json, a sitemap per book undersitemap.xml, androbots.txt, which welcomes search engines, AI answer engines and AI training crawlers.Search engines and AI assistants: each page's title starts with its citation (
NYC Charter § 259: Independent budget office | BetaNYC Law Reader), with a description of at most 160 characters from the law's own words, a canonical link onhttps://law.beta.nyc(SITE_BASEinscripts/lib/site/config.js), andLegislationandBreadcrumbListstructured data that uses only properties schema.org defines. The search page isnoindex.
The frame (top bar, footer, colors, type) is BetaNYC's Pages template: site/template/ holds unchanged copies of its site.css, nav.js and logos, and site/template/README.md says which commit and how to update them. The breadcrumbs, the search box, buttons, filters, paging and the back-to-top button are parts from the New York State Design System (@nysds/components), colored from the template's variables in site/assets/law.css, which names no colors itself. The site does not use NYSDS's global header or footer, or the parts NYSDS reserves for official State sites. The contents tree is the site's own (plain HTML lists and buttons, in site/assets/law.js and law.css). The section text, the contents tree and the bottom box are plain HTML, and the law text uses the template's body font, so they read with JavaScript off, in a screen reader and in print. License notices for NYSDS (CC0, with Material Icons under Apache 2.0 and Lit under BSD 3-Clause) and Pagefind (MIT) ship with the site in licenses/; DOMPurify's notice, which NYSDS includes, is in assets/nysds/nysds.js.
The site's layout follows the DC Council's code site, code.dccouncil.gov. No DC code is used.
AI agents use the page too. Every control has a name, and no two share one; npm run test:site checks that in the browser's accessibility tree. The site does not offer WebMCP tools yet: those come in Phase 4a (#70). AI assistants that want the law directly should use this repo's MCP server.
Build and look at it locally:
npm run build-index # writes data/structure/ (or use the copy the daily refresh commits)
npm run build-site # writes _site/; --no-search skips the Pagefind index, --charter-only the Administrative Code
npm run serve-site # http://127.0.0.1:8080/, served the way GitHub Pages serves itserve-site takes --dir and --port (npm run serve-site -- --dir _site-other --port 8081).
build-site takes --index-dir, --structure-dir and --out to build from other copies of the data. It stops with a message if data/structure/ is missing or was built from other text than the index, or if versions.json disagrees with the index's count. It only ever clears a folder it made itself.
Measured on 2026-11-23 on a Mac (Apple silicon) with Node 26, from the committed index (both books current through Local Law 2026/165), with npm run build-site (Pagefind included), counting every file's bytes in the output folder, in decimal megabytes (1 MB = 1,000,000 bytes):
Pages | Files | On disk | HTML (gzipped) | Pagefind | |
Charter alone ( | 864 | 1,862 | 24.9 MB | 21.0 MB (5.4 MB) | 2.4 MB |
Charter and Administrative Code | 13,789 | 27,738 | 386.8 MB | 353.9 MB (83.5 MB) | 26.1 MB |
The Administrative Code adds 361.9 MB: 12,925 pages (1 front page, 39 title pages, 389 chapter pages, 177 part pages, 12,266 section pages and 53 shared-number pages), 332.7 MB of HTML (78.1 MB gzipped), about 23.7 MB of Pagefind index, and 4.3 MB more in citations.json, index.json and redirects.json. Its median page is 21.7 KB; its biggest is § 28-1001.2.1 at 331 KB, one long section, and its biggest part page 318 KB. The Charter's pages grow by 0.2 MB in the full build, because its references into the Administrative Code become links. The build took about 9.5 seconds (pages 3.4 s, Pagefind 5.8 s), and its peak resident memory was 2.2 GB (2,157 MB), most of it Pagefind's. A section page averages about 21 KB. The biggest Charter chapter page, Chapter 1 (50 sections), is 450 KB, 83 KB gzipped: a phone downloads all of it even though it shows only the jump list.
GitHub Pages allows a published site of 1 GB and a deployment of 10 minutes (GitHub Pages limits). The two books use 39% of the size.
All three books, measured on 2026-11-24 on the same Mac from a build of American Legal Publishing's July 2026 files (the committed index has no titles yet, so it builds no Rules), with npm run build-site and the same counting: 23,894 pages, 47,111 files, 718.3 MB on disk, of which the Pagefind index is 54.2 MB (23,020 files). The Rules add 9,784 pages (1 front page, 54 title pages, 758 chapter pages, 110 part pages, 7,963 section pages, 55 pages for a citation a title repeats and 843 for a number in several titles) and 269.3 MB in rules/. The build took 18.3 seconds (pages 6.8 s, Pagefind 11.5 s), and its peak resident memory was 4.1 GB. That is 72% of the 1 GB limit. The time to deploy that many files has not been measured. Before the titles-first menu, every page listed every chapter, which projected to about 900 MB for the Administrative Code alone.
All three books from the committed index (current through Local Law 2026/165 and rules effective November 14, 2026, with titles), measured on 2026-11-25 on the same Mac with npm run build-site and the same counting: 24,036 pages, 47,392 files, 723.8 MB (du says 822.6 MB, since most files are smaller than a disk block), of which the Pagefind index is 54.5 MB in 23,159 files. By folder: admin-code/ 13,359 files, rules/ 9,907, pagefind/ 23,159, charter/ 938. The largest files are citations.json (3.8 MB), index.json (3.3 MB), redirects.json (1.1 MB), nysds.js (1.0 MB) and the Administrative Code's sitemap (1.0 MB). 17 seconds, 3.9 GB peak memory. Tables (#65) add 8.9 MB to the July 2026 build (718.8 to 727.8 MB, +1.2%), almost all of it markup; compressed, 0.8 MB.
GitHub's limits (GitHub Pages limits, read 2026-11-25), against that build:
Limit, in GitHub's words | This site | Margin |
"Published GitHub Pages sites may be no larger than 1 GB." | 723.8 MB (733 MB once the structure carries tables) | about 270 MB; the page does not say whether it counts compressed bytes or disk blocks (822.6 MB by |
"GitHub Pages deployments will timeout if they take longer than 10 minutes." | the last deploy's Deploy step took 15 seconds (run 45547295846, 2026-11-25); the whole build job about 4 minutes | about 9 minutes 45 seconds |
"a soft bandwidth limit of 100 GB per month" | one full crawl of every file is 724 MB uncompressed | about 138 full crawls a month, fewer if crawlers ignore compression |
"a soft limit of 10 builds per hour", which "does not apply if you build and publish your site with a custom GitHub Actions workflow" | a custom workflow | not limited |
The artifact is "a compressed | tar 857.9 MB, 145.0 MB gzipped; GitHub stored the last deploy's artifact as 138.4 MB ( | about 9.1 GB |
What grows it: law text (each section is on its own page and again in its chapter's or part's copy), new sections and their Pagefind entries, the menu on every law page, and the site-wide citations.json, index.json and redirects.json. The 1 GB published size is the limit to watch.
The Administrative Code
Titles. A chapter's title comes from the publisher's own Title record in
data/structure/admin_code.json(38 of them, with their names).get_title's rule insrc/corpus.ts(the title most of a chapter's § sections are numbered in) is the check: the build stops when the two disagree, except that a lettered title may be numbered in its parent (§ 16-501 is in Title 16-A), since that rule alone cannot tell Title 16 from 16-A, 16-B, 20-A or 21-A.test/site-admin.test.jsruns both on the committed index. The 16 sections of Title 31 (§ 31-101 to § 31-116) sit in no chapter: Title 31's page shows them as a chapter page would.Local laws by year. 42 of the publisher's chapters are years ("2016", holding "L.L. 2016/002" and the rest), with no title and no § numbers. The site groups them under "Local laws by year", a name of BetaNYC's: its page says that American Legal Publishing files these local laws by year, outside the titles, and that the group's name is ours. It is the last title card and the last item in the menu, with no number.
Local laws in search. The local-law notes (1,884 in the November 2026 index, cited
L.L. 2016/002: enactment date, sponsors, the law's title and its unconsolidated provisions) are their own kind of search result, "Local law", and each year's page is "Local laws by year"; the "Local laws" box leaves them all out. At full weight, notes crowded the sections their laws wrote out of the first results, but a note is also the right answer when someone searches for a law's subject. So each paragraph of a note carries adata-pagefind-weight(Pagefind's weights work on a quadratic scale): the law's title paragraph ("A Local Law to amend ..., in relation to ...") 1.5 (LOCAL_LAW_TITLE_WEIGHTinscripts/lib/site/pages.js), the rest (sponsors, dates, the unconsolidated provisions) 0.1 (LOCAL_LAW_WEIGHT); the heading keeps Pagefind's own weight. Two measures, with the queries intest/fixtures/search-ranking/queries.jsonand run bytest/site/search-ranking.test.mjson the committed November 2026 data: notes in the first 10 results of 20 subject searches (lower is better) and, of 40 notes each searched by its own subject, how many are in the first 10 (higher is better). Every note at full weight: 24 and 21. A whole note at 0.25: 12 and 15. Title 1.5, rest 0.1: 13 and 21. The site tells a note by wheremodel.jsputs it (isLocalLaw: the "Local laws by year" group), andtest/site-data/search-kinds.test.jschecks that against the index's untitledL.L.records.Front page (
/admin-code/): one card per title and nothing else, as an ordered list of links: the title's number (a screen reader hears "Title 3"), its name, and how many chapters it has. The lede counts the titles, chapters and sections from the data. One column on a phone; on a wider screen as many columns of at least 300px as fit.Title pages (
/admin-code/titles/28): the title's chapters, with how many sections each has and how many parts a split chapter has. With JavaScript off, they are how the menu reaches a chapter.The menu (the contents tree) lists only the titles. The reader's title is open in the HTML with its chapters, the reader's chapter open to its sections, or, in a split chapter, to its parts, with the reader's part open.
law.jsputs a button before each title, named "Chapters in Title 28: New York City Construction Codes" (Title 31: "Sections in …"), witharia-expandedandaria-controls, that loads the title's chapters from/admin-code/contents/titles/<title>.json. While a list loads, "Loading…" is in the menu's onerole="status"line; if it fails, that line says so, the title stays closed, and pressing again tries again. Focus stays on the button. The button's name is not the title's own, because the title's link next to it has that name.Chapter parts. A chapter whose full text would pass 100 sections or 150,000 characters of law text (about 300 KB of HTML, a third less than the biggest Charter chapter page) is split, in order, into parts of at most that size; one section bigger than that gets a part to itself. 54 chapters split, into 177 parts; the Building Code (949 sections) into 11. The chapter's own page then shows its own text and the list of its parts. Each part is a page of its own (
/admin-code/titles/27/chapters/1/parts/2) with the heading "… Building Code, part 2 of 11", the list of parts with its own marked, its sections' jump list and full text, and previous and next part links. Nothing loads as you scroll.Text outside sections. The records for text held outside a section (see What the index holds), such as the Title 27 reference standards, are pages like any section's, in their chapter's list and its parts, in document order:
/admin-code/sections/rs-18-1,/admin-code/sections/title-3-chapter-2-subchapter-3. Their names leave out the number already in the citation: "RS 10-9. PLYWOOD CONSTRUCTION", "Title 3, Chapter 2, Subchapter 3. Domestic Partnerships", and "RS 18-1" alone when the heading says nothing more.Section paths follow the Charter's:
/admin-code/sections/28-101.1. Citations that are not "§ number" are lowercased with other characters made hyphens (L.L. 2016/002isll-2016-002,Section FC 101isfc-101). The 53 numbers two sections share get the Charter's treatment. A chapter is under its title, because each title has its own Chapter 1:/admin-code/titles/28/chapters/1.Subsections. The Construction Codes' subsections (issue #76; see
subsectionsunder Site structure) show in the section's text, each heading line as a real heading: an<h2 class="subhead">under the section page's<h1>, an<h3>under the section's<h2>in a chapter, part or title page's copy. So a screen reader's list of headings goes section, then its subsections, with no level skipped. Each numbered subheading's id is its number (/admin-code/sections/fc-102#102.4), and a link to a subsection goes there. In a chapter page's copy the ids keep the section's prefix with_before a subsection's number (#s-fc-102_102.4(1)), so a phone opening that link goes on to/admin-code/sections/fc-102#102.4(1).Bold and italic. The publisher's bold and italic (
marksin the structure) are<strong>and<em>: bold defined terms ("Related member."), bold lead-ins ("Modifications.—"), italic catchlines and notes. In a subheading only the italics show, since it is bold already. A paragraph wholly in bold, at most 100 characters, with text after it that is not wholly bold, and not a note ("NOTE:", "Exceptions:"), reads as a heading line ("Introduction–Section 3—Definitions:" in RS 18-1): it gets the subheading's look, the space and thin rule, but stays a paragraph, not a heading element. The XML does not mark these lines as levels, and in the July 2026 files they are also table captions, defined terms and lines said twice in one section, so a heading element would fill a screen reader's list of headings with guesses. A run of bold lines ("382.10 DELETED.", "382.15 DELETED.") stays plain bold. In July 2026, 4,797 Administrative Code paragraphs and 647 Rules paragraphs are wholly bold (none in the Charter); 17,534 and 6,825 open in bold; italics are in 278 Charter, 7,715 Administrative Code and 20,957 Rules paragraphs.Tables (issue #65; the Rules have them too). A table whose block carries
rowsis a real HTML<table>, wrapped in the New York State Design System'snys-table(1.23.2, the samenysds.jsas the site's other NYSDS parts), inside the template's.table-scrollbox. Header rows at the top are a<thead>, every header cell in itscope="col", spanning ones too: under the HTML table model a column header covers each column it spans, whilescope="colgroup"would apply only inside a<colgroup>, which these tables do not have. A header cell further down is a<th>; spans, right-aligned and centered cells, and line breaks inside a cell are the publisher's. The page always writes both<thead>and<tbody>, becausenys-tablerebuilds a table that lacks either and would move the first row holding a header cell to the top. The box scrolls a wide table sideways inside itself, never the page. While it does,law.js(wireTables, again on every resize) makes it a region named for its section ("Table, 1 RCNY § 101-06", or "Table 2 of 3, …" when a section has more than one; the name is indata-table-name, unique on the page, chapter copies included) and a tab stop, so the arrow keys scroll it. A box whose table fits is neither: a page can hold hundreds of small tables (323 on one Administrative Code part page), and most fit on a wide screen. With JavaScript off it is the same plain table with the same borders; the box then has no name and no tab stop of its own, and the keyboard reaches a box that scrolls only where the browser does that itself (Chromium does, checked intest/site/tables.test.mjs). In print a table is the page's width, in 8-point type with tight cells, its words kept whole; a table of 8 columns or more (data-many-columns,PRINT_DENSE_COLUMNSinrender-html.js) may break a word anywhere, which is what lets the 29-column tables fit the paper. Printed at 720px with words kept whole, 84 of the July build's 14,821 table boxes ran past the page, all of 8 columns or more; with the rule, none does. A box that stops scrolling while it has the focus (the window widened) keeps its tab stop and name until the focus leaves it. A structure from before #65, with norows, shows each table as one paragraph of its words, as before. With its tags removed, a table's HTML is the index's text for it (the block-order test reads it back). The committed structure was built before #65; the daily refresh rebuilds it withrowsonce this code is onmain(a structure-only commit, no release) and dispatches the deploy.What the copy leaves out. The index has no pictures (figures, equations and tables drawn as images: 306 in 66 Administrative Code records in the July 2026 files). A section with pictures, or with a level the index still does not read (none in the July 2026 files), says so above its text ("This section has 3 pictures … that BetaNYC's copy does not show") and links to its page at American Legal Publishing; a section with no text says "BetaNYC's copy has no text for this section" with the same link. The counts come from the structure's
picturesandsubsectionsfields.
The Rules
The Rules of the City of New York are laid out as the Administrative Code is, titles first (title cards, a page per title, chapters split into parts, a page per section, the same menu), with one difference: each title restarts its chapter and section numbers (50 titles have a § 1-01 in the July 2026 files), so everything is per title, from each record's titleNumber (issue #59). The title is the record's own, not the structure's Title parent: 24 chapters have none (the Health Code in Title 24, the Rent Guidelines Board's yearly orders in Title 30, Appendix A to Title 62, Title 3's Chapter 11).
Paths are under the title:
/rules/titles/15for a title,/rules/titles/15/chapters/18for a chapter (other chapter citations are lowercased with hyphens:/rules/titles/24/chapters/new-york-city-health-code,/rules/titles/30/chapters/apartment-loft-order-49-2017),/rules/titles/24/chapters/new-york-city-health-code/parts/5for a part, and/rules/titles/15/sections/1-01for a section. A group record keeps its chapter in its path (/rules/titles/19/sections/chapter-55-schedule-a). Chapters sort as the publisher numbers them: 19, 19A, 19.1, 20 (adminChapterKey, shared with the Administrative Code). Where a title repeats a citation (each yearly order'sNotice, Title 62's two § 6-01), each record gets American Legal's id after it (/rules/titles/30/sections/notice-<id>) and the plain path is a page to pick one. A chapter number a title uses twice (Title 43's two Chapter 15s; the Administrative Code's five starred pairs get the same) works the same way: each chapter gets its id (/rules/titles/43/chapters/15-<id>) and/rules/titles/43/chapters/15is a page to pick one. The plain path never goes away: if a later refresh gives a number to a second chapter, the old link reaches a page listing both, and an id path whose pair goes away lands on the chapter through the 404 page (its id is inredirects.json). Keeping the plain path for "the first one" was not chosen: which one is first depends on the sort, and a reader who cites Chapter 15 cannot know which they would get. A number in more than one title has a page to pick one at/rules/sections/1-01(headed "§ 1-01 is in N titles"), grouped by title; a number in one title only has no page there, and the 404 page sends/rules/sections/<number>on to it, from/rules/numbers.json.Citations are
fullCitation's (src/corpus.ts), written the way the Rules are cited:15 RCNY § 1-01,24 RCNY Health Code § 81.08,15 RCNY Chapter 18, and, where a title repeats a citation, with its chapter:30 RCNY Apartment & Loft Order #49 (2017), Notice,62 RCNY Chapter 5, § 6-01. A group record whose own citation already starts with its title keeps it (Title 6, Chapter 2, Subchapter B), because that is the formget_sectionfinds. The heading, Copy citation, the page title, the search result's title and links into the Rules all use it; never a bare§ 1-01.test/site-data/rules-layout.test.jschecks thatget_sectionfinds the same records with each page's citation as withfullCitation.Lists inside a title name records as the title does (
§ 1-01. Scope and Application); a group record drops the title and chapter already around it (Schedule A,Title III, Article 48in the Health Code).Phones. Fill-in blanks in the Rules' forms ("________" for a whole line) and long breadcrumbs break at the screen's edge (
overflow-wrap: anywhereon the law text and headings; NYSDS's breadcrumbs set nowrap, which law.css undoes).test/site/overflow.test.mjsopens, at 390px, every page with a run of 30 characters or more with no space, or a breadcrumb that long, and fails on any that scrolls sideways (732 pages on the July 2026 build, none). It also opens every page that shows a table, at 390px and 320px (2,137 pages with 14,821 table boxes on the July 2026 build withrows: none scrolls sideways, and at 320px 1,314 tables scroll inside their own box).The bottom box of a Rules page links the record's own page at American Legal Publishing and adds that the City posts the latest rules at rules.cityofnewyork.us (as the MCP server's disclaimer does).
Links from the Charter and the Administrative Code into the Rules, and from the Rules out, go to the record's page. A link to one of the publisher's groups that is not a record (a Health Code Article) goes to its first section.
Before 0.7.0. An index without
titleNumberbuilds no Rules pages at all, rather than pages whose paths would change once titles arrive; the deploy's check step notes it and the home page still says the Rules are coming. An index with titles on some records only stops the build.
Deploy
.github/workflows/deploy-site.yml builds the site, the Charter, the Administrative Code and the Rules, and publishes it to GitHub Pages at law.beta.nyc. It runs:
on a push to
mainthat changes the site's code or what it reads:data/index/,data/structure/,data/source-errors.json,data/source-errors/,data/pictures/,data/alt-text/,scripts/build-site.js,scripts/lib/site/,scripts/lib/render-section.js,scripts/lib/extract-text.js,scripts/lib/alt-text/,site/,src/tools.ts(the disclaimer),DATA-SOURCES.json,package.json, the lockfile, or the workflow itself;after the daily refresh, only when it committed new law text, a new site structure or new pictures. The refresh pushes with the built-in
GITHUB_TOKEN, and GitHub does not start other workflows from that push, so its last step starts this one withgh workflow run(GitHub's docs). No commit, no deploy;by hand: the Actions tab, Deploy Site, Run workflow on
main, orgh workflow run deploy-site.yml --ref main.
Each run installs with npm ci, runs npm test, then npm run test:site-data (the site's layout on the committed data; see below), and builds the whole site fresh with npm run build-site. The build stops the run, before anything is deployed, if data/structure/ is missing or was built from other text than the index. Nothing is committed: the HTML goes from _site/ straight to Pages with GitHub's own actions (configure-pages, upload-pages-artifact, deploy-pages). Only main deploys, one run at a time. The build step also checks that the contents pages, /describe-pictures/, the Administrative Code's sitemap and the Pagefind index are there, and, when metadata.json says the build has the Rules, their contents page, numbers.json and sitemap; when it does not, the step adds a notice saying why. On a Mac the build of all three books peaked at 4.1 GB of resident memory, most of it Pagefind's; nobody has measured it on GitHub's runner, so a red build step with no error message is worth checking for running out of memory. After the deploy, the run checks that the home page, /about, /admin-code/ and, when the build has them, /rules/ answer 200; if they do not, the run goes red, but the deployment stays up. The custom domain is set in the repository's Pages settings, so the site needs no CNAME file.
Picture descriptions (alt text, issue #87)
The Administrative Code and the Rules have 507 pictures (481 image files) and no text descriptions for any of them. scripts/alt-text.js is a tool for writing those descriptions: an AI model drafts each one, and a person reviews it in the browser. The descriptions are BetaNYC's, not American Legal Publishing's; they live in data/alt-text/, keyed by each image's sha256, so a replaced image loses its description until someone reviews it again. The MCP server does not read them. law.beta.nyc shows the pictures, and only the descriptions a person reviewed, on /describe-pictures/, where anyone can suggest a description; the law pages do not show pictures yet.
Every command reads American Legal's files: by default data/raw/admin_code.zip and data/raw/rules.zip (from npm run fetch-data), or a zip or an extracted folder (holding XML/ and IMAGES/) given with --admin-code and --rules. --book rules or --book admin_code limits a command to one book. None of them fetch anything from American Legal.
npm run alt:inventory # count the pictures and the descriptions; list stale ones
npm run alt:inventory -- --check-map map.csv # also compare with a picture map (book, picture_id, record_id, section_id, sha256)
npm run alt:draft -- --limit 5 # how many would be drafted, and a rough cost; sends nothing
npm run alt:draft -- --limit 5 --show-request # also print the first request (image data left out)
ANTHROPIC_API_KEY=… npm run alt:draft -- --limit 5 --yes # send them, storing each draft as it arrives
ANTHROPIC_API_KEY=… npm run alt:draft -- --retry-failed --yes # also try again the pictures whose draft failed
npm run alt:review # the review page, at http://127.0.0.1:8765/
npm run alt:build-static -- --out _alt-review # the same page as static files, for GitHub Pages
npm run alt:build-static -- --out _alt-inbox --mode inbox # the page that sends suggestions to BetaNYC's inbox
npm run alt:images # copy the pictures the site shows into data/pictures/ (commit them)alt:inventoryfinds every<PICTURE>tag, its image file (the tag id minus-img, inIMAGES/), the Law Reader section that holds it, and the text around it, including whether it sits inside a sentence (Rules § 81.49: "Warning: [icon] indicates that the sodium (salt) content…"). Files no tag uses are left out. On American Legal's July 2026 files: 306 Admin Code tags (285 files) and 201 Rules tags (196 files, 191 distinct images), 0 tags without a file.alt:draftsends each picture that has no draft yet, with its citation and the text around up to three of its uses, to Anthropic's Messages API (default modelclaude-fable-5-2;--modelorALT_TEXT_MODELto change,--effortfor the effort level, defaulthigh). The key comes fromANTHROPIC_API_KEYand is never printed; it is the only way to give one (anant auth loginprofile is not used, on purpose, so a run never spends on a profile you did not mean to use). It prints the count and a rough cost first, and sends nothing without--yes.--limit N,--book,--only <image id,…>,--force(redraft pictures that have a draft),--retry-failedand--concurrency N(default 2). A refusal or an answer that was cut off or not usable stores no text, but is recorded (reason, model, time), and later runs skip that picture until--retry-failed. An API error prints its status, the API's own error type and message, and the request id; the run stops at once on a refused key, an unknown model (404), or the same 400 for two pictures. The spend after a run is priced at the model that actually ran each attempt, a fallback model included. The prompt asks for alt text that reads as part of the sentence when the picture is inside one, a long description for maps, diagrams, charts and tables drawn as pictures, and never invented text; what the model could not read goes inunsure. A draft never changes a person's review. BMP files are sent as PNG, since the API takes JPEG, PNG, GIF and WebP only.alt:reviewstarts a page on 127.0.0.1 only (--portto change). For each picture it shows the image, where it appears and the text around it, the AI draft in read-only boxes, and editable boxes that start as a copy of the draft, with a status (reviewed, needs work, not reviewed; for a picture not yet reviewed no status is chosen, and Save asks for one, so an unread draft is never marked reviewed by one click), Save and "Save and go to next" (Control+Enter or Command+Enter saves), Previous and Next, filters by book and status, and a progress count. Save writes straight todata/alt-text/<book>.json; nothing is uploaded. Two saves of the same description from different tabs do not overwrite each other: the second is refused and shows the newer text beside yours, and nothing is saved until you choose "Use their version" or "Replace theirs with mine". Changing a filter keeps unsaved text when the picture is still in the list, and otherwise warns once, like Previous and Next; closing the tab with unsaved text asks first. A review field over 20,000 characters is refused with a message, not cut. The page answers only to its own address and token, so other websites open in the same browser cannot reach it.alt:build-staticwrites the page, its data and the images to a folder (it refuses a folder holding other files). There, Save becomes "Suggest a better description": a link that opens a new GitHub issue in this repository with the picture's ids, citation, sha256, the current text and the suggestion filled in, kept under 6,000 characters. Only reviewed text is included unless--include-draftsis given (the page then says AI drafts are not shown); reviewers' notes never are. This GitHub-issue page is not part ofdeploy-site.ymlor law.beta.nyc. To try it:npm run alt:build-static -- --out _alt-review && npm run serve-site -- --dir _alt-review --port 8081. To publish it on GitHub Pages, push the folder's contents to a branch or repository that Pages serves; every link in it is relative.alt:build-static -- --mode inboxbuilds the page with "Send suggestion" instead: it posts the suggestion as JSON to BetaNYC's data inbox on www.beta.nyc (https://www.beta.nyc/wp-json/betanyc-data/v1/report, toollaw-reader, kindalt-text-suggestion), which files it in a private place for BetaNYC staff, so no GitHub account is needed. Each description is labeled "Reviewed by a person at BetaNYC", "AI draft, not yet checked by a person", or as having none yet. A name and email are optional, with a link to BetaNYC's privacy policy, and the credit box starts unticked; "Show exactly what will be sent" shows the JSON. The page carries a content security policy that lets it connect only to the inbox's origin, and its data is written intoindex.html, so it fetches nothing else. The inbox accepts posts only fromhttps://law.beta.nyc, which is whybuild-sitebuilds this mode (below).--redirects <redirects.json>makes each use link to its section's page; without it, the link is the id address the site's 404 page sends on.alt:imagescopies every picture a<PICTURE>tag uses, once per distinct image, out ofdata/raw/<book>.zipintodata/pictures/images/<sha256>.<ext>(the two BMPs as PNG), and writesdata/pictures/admin_code.jsonandrules.json: each book's inventory (ids, size, every use with its citation, section and the text around it) and the stored file's name and sha256. Pictures no longer used are removed. It reads every picture before it writes any, and the same zips give byte-identical output. Both books always (--bookis refused). It fetches nothing; runnpm run fetch-datafirst ifdata/raw/is empty. The daily refresh runs it afterbuild-index, so the pictures follow American Legal's files.
The page on law.beta.nyc (/describe-pictures/)
The deploy builds without American Legal's zips, so the pictures are committed in data/pictures/ (476 distinct images, 44.3 MB, from the July 2026 zips until the first refresh after this lands), the same way data/source-errors/images/ holds the error pages' pictures. npm run build-site builds the inbox page at /describe-pictures/ from them whenever it builds the Administrative Code or the Rules: it checks every picture against the sha256 in its inventory first and stops, with the command to run, when one is missing or changed. Each use links to its section page from the build's own redirects.json. The page is in the site's own frame, like every other page (scripts/lib/site/pages-pictures.js): the top bar, breadcrumbs (Home > Picture descriptions), the bottom box and the footer. Its controls are the New York State Design System's elements the rest of the site uses (scripts/lib/alt-text/page/body-site.html): nys-select for the two filters, nys-button for Previous, Next, "Show exactly what will be sent", Send and each "Show the text around" button, nys-textarea for the current and suggested text and the note, and nys-checkbox for the credit box. Name and email are plain <input>s with real <label for>s and autocomplete="name" / autocomplete="email", so the browser can fill them in (WCAG 1.3.5; NYSDS 1.23.2's nys-textinput has no autocomplete attribute). describe-pictures.css draws them as nys-textinput draws its own input, from the same NYSDS tokens: label, border, radius, padding, height, focus ring and error state. A refused value sets aria-invalid and shows the message under the field, linked by aria-describedby. The hidden trap field stays a plain <input>, so it stays out of the tab order and the accessibility tree. Otherwise site/assets/describe-pictures.css only lays the parts out. Its content security policy comes first in <head>: everything it loads is on law.beta.nyc, it may connect only to the intake's origin, and the one inline style it allows is the display: none; that NYSDS 1.23.2's nys-select puts on its own <slot>, by that style's sha256 ('unsafe-hashes'; NYSDS_STYLE_HASH in static-build.js). Without it the browser blocks that style and the select's options show. The AI drafts are on the page (approved 2026-11-26): each picture's current text is its reviewed description, labeled "Reviewed by a person at BetaNYC", or else its AI draft, labeled "AI draft, not yet checked by a person", or else "No description yet". The model's name and the draft's notes of what the model was unsure of are in the page's data but never shown. Its opening lines count the pictures in each of those states, say that a description is BetaNYC's and not an official record, and say where a suggestion goes. The page is left out of the search index and the sitemaps; the footer of every page links to it. The pictures are not in the npm package.
Errors in the publisher's text (data/source-errors.json)
Sometimes American Legal Publishing's own files have a mistake: a picture that says something different from the text around it, one picture used for two different equations, garbled words. BetaNYC does not change the publisher's text. It keeps a running log of the errors it finds, checks each one, reports it upstream, and lists it at law.beta.nyc/source-errors/ ("Errors in the publisher's text"). BetaNYC's own bugs are not listed there; they go in WHATS-CHANGED.md.
The page has a short explanation, the two addresses the publisher's disclaimer gives for reports (NYC.editor@amlegal.com, the publisher, as in
DATA-SOURCES.jsonreport_errors; and NYCCodeRulesCharter@law.nyc.gov, the NYC Law Department), then one row per error: its id, the citation (a link to our page for the section), its status, its kind, a summary, Check at American Legal (a plain link to the section's own page athttps://codelibrary.amlegal.com/codes/newyorkcity/latest/<NYCcharter|NYCadmin|NYCrules>/<amlegal_id>, the same address a law page's bottom box links), the evidence (the text quoted from the XML, what the picture shows, the publisher's picture itself (each opens full size), the image files and their sha256, the XML record ids), the dates, and notes. The whole list is plain HTML and reads with JavaScript off;site/assets/source-errors.jsadds three filters (book, kind of error, status: native<select>s with labels), a live count, and keeps the choice in the address (?kind=typo-in-picture). With no entry to show, the page says there are no confirmed errors yet.A section page whose section has a shown error gets one short note at the top that links to its row (
/source-errors/#SE-0001). The footer of every page and the About page's "Found a mistake?" link to the list.What is public. A normal build (the deploy) shows only entries whose status is
confirmed,reportedorfixed-upstream.npm run build-site -- --include-unconfirmed-errorsmakes a preview that also shows the entries onlyfound, each marked "Found, not yet checked", with a banner saying it is a preview andnoindex. Never deploy a preview;deploy-site.ymlbuilds without the flag.not-an-errorentries are never shown.--source-errors <file>reads another file.The pictures. The deploy builds without American Legal's zips, so the pictures an entry names are committed in
data/source-errors/images/(a few, about 1.7 MB). After adding an entry with a picture, runnpm run source-errors:images: it copies each named picture out ofdata/raw/<book>.zipand checks it against the entry'ssha256. The build copies the shown entries' pictures to/source-errors/img/and stops, naming the entry, when a picture is missing or does not match itssha256, so the page always shows the very file the error was found in.The file is
{ "about", "format": 1, "errors": [...] }. Each entry:id(SE-0001, in order, never reused),book(charter,admin_codeorrules),citation(as the section's page writes it, its h1),amlegal_id(the publisher's id for the section),kind(picture-text-mismatch,same-picture-twice,typo-in-picture,missing-figure,garbled-text,misplaced-picture,picture-turned),summary(plain words),evidence(text: quoted from the XML, or null;records: the XML record ids;picture: what the picture shows, or null;images:image_id,fileand fullsha256for each picture),found(a date),found_in(which download),status,confirmed_at,reported_at,fixed_at(dates or null) andnotes. The schema isscripts/lib/site/source-errors.js(zod, strict: an unknown field fails). A file that does not match stops the build, and so the deploy.
To add an entry: append it with the next id and "status": "found", quote the text from the XML (data/raw/*.zip, not from notes or from this site's copy), and give the section's amlegal_id and citation. For a picture, npm run alt:inventory and the picture map give each image's id, file and sha256, and the section that holds it. Run npm test (the schema) and npm run test:site-data (each entry names a real section with that citation), and build a preview to look at it.
To move its status: a person checks the entry against the XML and the picture, then sets "status": "confirmed" and "confirmed_at". That makes it public on the next deploy. When it has been sent to both addresses, set "status": "reported" and "reported_at" (say in notes who sent it, to which address, and any reply). When the publisher's files no longer have it, set "status": "fixed-upstream" and "fixed_at". If it turns out not to be a mistake, set "status": "not-an-error" and say why in notes; the entry stays in the file so nobody flags it again. A status needs its dates, and a date never comes before the one before it (the build checks both). Because the file is in deploy-site.yml's push paths, a change to it on main redeploys the site.
Prerequisites
Node.js 20 or later (tested on 20.x and 22.x)
Installation
npx (recommended — no install required)
npx @betanyc/nyc-charter-laws-rulesThe corpus data is bundled in the package — no setup required.
Global install
npm install -g @betanyc/nyc-charter-laws-rules
nyc-charter-laws-rulesFrom source (for development or refreshing the index)
git clone https://github.com/BetaNYC/nyc-charter-laws-rules.git
cd nyc-charter-laws-rules
npm install
npm run buildnpm install does not compile the server: the build runs before npm pack and npm publish (the prepack script), and before npm test. Run npm run build yourself before npm start.
Claude Desktop configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": ["-y", "@betanyc/nyc-charter-laws-rules"]
}
}
}Or if installed globally:
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "nyc-charter-laws-rules"
}
}
}Setup
The index is already committed — no data download needed to run the server.
Step 1 — Build and start the server (from source only):
npm run build
npm startThat's it. The committed JSON index is loaded automatically.
Refreshing the index from AML
Run this when AML publishes a new version of the Charter, Admin Code, or Rules:
npm run fetch-data # downloads about 125 MB of bulk XML ZIPs into data/raw/
npm run build-index # parses XML, writes data/index/json/, data/index/markdown/, data/structure/ and data/index-build.jsonfetch-data sends a User-Agent naming this package and version, gives each download 120 seconds (the Administrative Code and Rules ZIPs are about 60 MB each), and retries a 429 or 5xx answer up to twice, honoring Retry-After (scripts/lib/fetch-retry.js).
It downloads over https only, and checks every ZIP before keeping it (scripts/lib/fetch-zip.js, issue #55):
A redirect is followed only to https on
files.amlegal.com(same port, no user name or password in the address), at most five times. There is no http fallback.The answer must be HTTP 200 with a ZIP Content-Type, and as long as its Content-Length says.
It must not be more than four times the size of the last good download. The body is read as a stream and stopped there, so a runaway answer cannot fill memory. A real growth that large can be accepted (see below).
The file must be a ZIP that opens, in American Legal's layout: XML files under
XML/, including the root fileXML/0-0-0-1.xmlwith its "Current through" line, each with a good CRC. No file in it may claim to be over 256 MB unpacked (the largest real one is 26 MB).It must have at least half the bytes and half the XML files of the last good download. Between July and November 2026 the three ZIPs grew by under 1%, so a drop by half means something went wrong (an error page, an empty or partial export).
If any check fails, fetch-data names the document and the check, exits with an error, and replaces no file in data/raw/ and no record, so no index is built from a document that is missing or not American Legal's.
When American Legal really does change a file's size. The floor (half) and the ceiling (four times) follow the last good download: whatever data/fetch-provenance.json on main records. A file can shrink for a real reason (American Legal stops bundling images) or grow (the Charter ZIP has no IMAGES/ folder today; the Administrative Code's does). To accept it, first look at the file and make sure the change is real. Then do one of these:
On GitHub, open Actions > Refresh Data > Run workflow and set
allow_size_changeto the document's name (charter,admin_codeorrules; several, comma-separated). The waiver covers that run and those documents only, in either direction; every other check still applies, and the download is still stopped at 1 GiB. The run commits the new record with the index, so the new file sets the floor and the ceiling from then on.Or, locally:
NYC_CLR_ALLOW_SIZE_CHANGE=rules npm run fetch-data, thennpm run build-index, and commitdata/fetch-provenance.jsontogether with the rebuilt index. The daily run reads the floor and ceiling from the committed record, so an uncommitted local run changes nothing for it.
The error message names these two steps for the document that failed. Because the limits follow the last accepted file, a change that is later undone (a small file accepted, then the full-size file back the next day) is refused again and needs the waiver again. When all three pass, it writes data/fetch-provenance.json: for each ZIP, the URL, bytes, sha256, Content-Type, Last-Modified and ETag, the number of XML files, the "Current through" line, and when those exact bytes were first downloaded. Downloading the same bytes again leaves the file unchanged. The daily refresh commits it with the index, so anyone can see which bytes a given index was built from. It is not in the npm package.
Then commit the updated index files and push. The get_version tool will reflect the new currency dates after the next server restart.
Placing ZIP files manually
If you prefer to download the ZIPs yourself rather than using npm run fetch-data, place them in data/raw/ with these exact filenames before running npm run build-index:
data/raw/charter.zip ← https://files.amlegal.com/pdffiles/NewYorkCity/Charter/XML.zip
data/raw/admin_code.zip ← https://files.amlegal.com/pdffiles/NewYorkCity/Admin/XML.zip
data/raw/rules.zip ← https://files.amlegal.com/pdffiles/NewYorkCity/Rules/XML.zipThe data/raw/ directory is gitignored — the ZIPs will not be committed. ZIPs placed by hand skip the checks above and do not update data/fetch-provenance.json.
Configuration
Claude Code
Add to your project's .mcp.json or .claude/settings.json:
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": ["-y", "@betanyc/nyc-charter-laws-rules"]
}
}
}Or if running from a local clone:
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "node",
"args": ["/path/to/nyc-charter-laws-rules/dist/index.js"]
}
}
}Getting current law text (NYC_LAWS_INDEX_DIR)
The Refresh Data workflow commits a refreshed index to main every morning when AML has published new text. To serve that text while running the pinned npm package, keep a sparse clone of just the index and point the server at it:
git clone --filter=blob:none --sparse https://github.com/BetaNYC/nyc-charter-laws-rules.git
cd nyc-charter-laws-rules
git sparse-checkout set data/index/json
# later, to update:
git pull{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": ["-y", "@betanyc/nyc-charter-laws-rules"],
"env": {
"NYC_LAWS_INDEX_DIR": "/path/to/nyc-charter-laws-rules/data/index/json"
}
}
}
}The directory must hold
versions.json,charter.json,admin_code.json, andrules.json, laid out likedata/index/json/. A leading~/expands to your home directory. Any other relative path resolves against the server process's working directory, which your MCP client chooses, so an absolute path is safest.If the variable is set and
versions.jsonis not there, the server refuses to start and says why. It never falls back to the bundled index silently. Unset or blank means the bundled index.The server notes the directory it is serving on stderr at startup. Restart it after a
git pull; the index is read once per process.get_versionreports the currency dates of whichever index is loaded.
Disclaimer footer (NYC_CLR_FOOTER)
Every tool response ends with a disclaimer. NYC_CLR_FOOTER sets how much of it:
Value | Behavior |
| The full footer on the first response after the server starts, then the one-line footer on every response after. |
| The full footer on every response, as through 0.3.x. |
"First response" means the first since this server process started. MCP does not tell a server when a new chat begins, so a client that keeps the server running across chats sends the full footer only once. The full text also goes out as the server's
instructionson every connection, in both modes.Unset or blank means the default. Any other value means
full(more disclaimer, never less), and the server prints a warning naming the variable to stderr at startup.
"env": { "NYC_CLR_FOOTER": "full" }Common workflows
Look up a specific section of the Charter
1. get_version() → confirm how current the law is
2. get_section("§ 259") → retrieve the section textFind everything the Admin Code says about a topic
1. search("sidewalk shed", corpus="admin_code", limit=20)
2. get_section("§ 28-3310.1") → pull a specific resultBrowse the Rules on a subject area
1. list_titles("rules") → find the agency's title and the chapter by its heading
2. get_title("rules", "Title 15, Chapter 18") → its sections
3. search("fire safety", corpus="rules") → keyword search within rules
4. get_section("15 RCNY § 18-11") → one section, cited with its titleGround a legal answer in the correct version
1. get_version() → note the effective date for each corpus
2. search("open meetings", corpus="all") → find relevant sections
3. get_section("§ 1-207") → retrieve full textChangelog
The complete, dated record of every index rebuild lives in CHANGELOG.md. Each entry records which corpus version was current at the time of the build and flags whenever a corpus's currentThrough version advanced.
The block below is stamped automatically with the most recent rebuild every time npm run update-changelog runs — see CHANGELOG.md for the full history.
Last index update: 2026-11-27 — ✓ No change
Corpus | Current through | Sections |
NYC Charter | Current through Local Law 2026/171, enacted November 21, 2026, | 856 |
NYC Administrative Code | Current through Local Law 2026/171, enacted November 21, 2026, | 12,995 |
Rules of the City of New York | Current through rules effective November 29, 2026. | 8,786 |
Release history
Package version history (distinct from the per-rebuild record in CHANGELOG.md):
0.1.2 — May 25, 2026: Charter and Admin Code current through LL 2026/094 (enacted May 16, 2026), up from LL 2026/086; Rules through May 20, 2026, up from May 15; Admin Code 12,551 → 12,558 sections.
0.1.1: Initial published release with full JSON and Markdown indexes committed to repo.
0.1.0: Initial release.
About BetaNYC
This project is built and maintained by BetaNYC, New York's civic technology and open-data community. We work to improve lives in New York through civic design, technology, data, and public-interest technology.
Come do civic tech with us. We run public events, meetups, and hands-on data classes throughout the year — including NYC School of Data and CityCamp NYC, and we host frequent civic-tech gatherings. See what's coming up on our events calendar.
Sustain this work. These MCP servers are free and open source. To help keep this work going and find BetaNYC's tools, please consider donating and becoming a Beta Builder.
Building on this? Tell us!
If you build something with this project, we'd love to hear about it. We can help other New Yorkers find it. BetaNYC publishes a weekly newsletter, This Week in NYC's Civic Technology and Open Data.
Subscribe to the newsletter to keep up with NYC civic tech, open data, and public-interest technology.
Built something, or found a story worth sharing? Submit a link for the newsletter and we'll consider it for an upcoming issue.
Related BetaNYC MCP servers
BetaNYC maintains a suite of open-source MCP servers for NYC and NYS civic data. See the full directory, with install details for each, at beta.nyc/ai-tools.
This server pairs directly with:
nyc-council-mcp: see the Council legislation, sponsors, votes, and hearings that create and amend the Code.
Contributing
Issues and pull requests welcome at github.com/BetaNYC/nyc-charter-laws-rules.
Support our work
Freedom isn't free. Support BetaNYC.
License
MIT License
Copyright (c) 2026 BetaNYC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Available Tools
8 toolsabout_betanycAbout BetaNYC and this serverARead-only
Who built this server and how to reach them: BetaNYC, a project of the Fund for the City of New York. Returns what BetaNYC is, links to its events, newsletter and donation page, where to report a bug in this server or ask for a new feature (this server's GitHub issues), and this server's name and version.
Inputs: no named parameters. Returns: about, links, server, history, +4 more
about_dataWhere this server's data comes fromARead-only
Where this server's data comes from and how far to trust it. For each kind of data: who publishes it and a link, whether it is an official record (only data its publisher published and BetaNYC did not modify is; data BetaNYC modified or produced is not), how it was gathered, what BetaNYC did to it (for example cleaned it, matched it to addresses, joined it with other data, or counted it), how current it is on this server, what it covers and what is missing, the terms of use and the credit line to print, where to check a figure at the official record, where to report an error (to BetaNYC when BetaNYC modified or produced the data, to the publisher for the original records, and to this server's issues for a bug), which tools use it, and corrections that touched it. Call it whenever someone asks where an answer comes from, how current or accurate it is, or how to check or cite it. topic narrows it to one kind of data, or to the data behind one tool (give the tool's name). For who built this server, use about_betanyc. Topics on this server: charter, admin-code, rules.
Inputs: topic. Returns: note, topic, server, topics, +6 more
get_sectionGet a sectionARead-only
Retrieve a specific section by its citation (e.g. '§ 259', 'Section 259', '11-602.1', 'Chapter 11'). Input is normalized (with or without '§', any case). Pass 'corpus' to disambiguate when the same citation exists in multiple documents (e.g. charter 'Chapter 3' vs a rules chapter); if multiple sections still match, a disambiguation list is returned. Each title of the Rules restarts its numbers, so name the title: '15 RCNY § 1-01' or 'Title 15 § 1-01' ('24 RCNY Health Code § 81.08'); a bare '§ 1-01' lists every title's, each labeled with its title. A citation may name its book ('NYC Charter § 1133', 'Admin. Code § 27-506'); then only that book is looked in. Code sections: 'FC 102', 'RS 18-1'. A code may be named in words ('Building Code 722.2.1.1.4'); a bare code number ('722.2.1.1.4') is looked for in every code. A part of a section ('§ 1133(b)(1)', 'Section FC 102.4(1)') returns the whole section; the first line names the part. Long text comes in parts, long lists in pages of 25; the answer gives the offset for the next.
Inputs: citation (required), corpus, offset, max_chars.
get_titleGet a chapter or titleARead-only
List a chapter's sections in order: its heading, then each section's citation and heading (get_section gives the text). 'Chapter 70' gives every chapter with that number. Administrative Code and Rules: 'Title 24' gives every record in that title, chapter by chapter, including chapters with no number such as the Health Code ('Title 16' is not 16-A); 'Title 15, Chapter 18' gives only its Chapter 18. Numbers match whole: 'Chapter 1' is not 'Chapter 10' or 'Chapter 1-A'.
Inputs: title (required), corpus (required), limit, offset.
get_versionHow current the text isARead-only
Return the currency date for each document — how current the Charter, Administrative Code, and Rules are. Each corpus updates on its own schedule. Always call this tool before answering legal questions so responses are grounded in the correct version of the law.
Inputs: no named parameters.
list_titlesList chapters or titlesARead-only
List a document's chapters in order, each with its heading. Administrative Code chapters show their section range, since several share a number: 'Chapter 1 (§ 3-101 to § 3-196)'. Rules chapters are listed by title, each title named before its chapters: 'Title 15, Chapter 18'; a chapter with no number, such as the Health Code, by its name: 'Title 24, New York City Health Code'.
Inputs: corpus (required), limit, offset.
searchSearch the law textARead-only
Keyword search across the NYC Charter, Administrative Code, and Rules of the City of New York. This is keyword matching, not a question-answering engine: short keyword queries work best (e.g. 'sidewalk shed', 'water tank inspection'), not full questions. An empty query is an error. A query or term of 3 or fewer letters and digits matches whole words only ('x' is not the x in 'wax'). The query is first matched as an exact phrase (quotes around the whole query are removed first); results are relevance-ranked, with heading matches above citation matches above body-text matches, and whole-word matches above substring matches. If the phrase matches nothing, question words and common words are dropped and sections containing the remaining terms are returned, ranked so rare words and words in a heading count most; the response's first line says when this happened and which terms were used. Each snippet is the text around the first match.
Inputs: query (required), limit, corpus.
whats_changedWhat's changedARead-only
What has changed in this server, its data and its website, newest first, from the project's WHATS-CHANGED.md: new tools and pages, new data, data fixes, and corrections when BetaNYC published something wrong. Each correction says what to re-check if you used the old numbers. Call this before relying on a figure you got from this server earlier, or when a user asks whether something was fixed. Filter with since (YYYY-MM-DD; also keeps older entries that have an update on or after that date) and tag (Site, Data, MCP or Correction).
Inputs: tag, limit, since. Returns: note, server, source, entries, +4 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
The retrieval tools form a clear hierarchy — list_titles (document→chapters), get_title (chapter→sections), get_section (citation→text), and search (keywords) — with descriptions that explicitly cross-reference each other, so misselection is unlikely. The only soft overlap is between get_version (how current the law is) and about_data (provenance and currency per data kind), plus the three meta tools about_betanyc/about_data/whats_changed, which are close in flavor though clearly scoped to different questions.
Half the surface follows a clean verb_noun pattern (get_version, get_section, get_title, list_titles), but the rest break it: bare verb 'search', the noun-prefix 'about_betanyc'/'about_data', and the contraction 'whats_changed'. Individually readable and mostly self-describing, but three distinct conventions coexist rather than one predictable pattern.
Eight tools is a sensible size for a legal-corpus server: four retrieval primitives plus version and three provenance/changelog helpers. The meta tools (about_betanyc, about_data, whats_changed) are half of nothing but occupy four of eight slots, which is slightly heavy for support functions, though each serves a distinct user question.
Search, browse (titles/chapters), section retrieval with citation normalization and pagination, plus currency and provenance reporting cover the core legal-research lifecycle well. Minor gaps remain: search appears to have no corpus scoping parameter even though get_section does, and there is no tool to enumerate available documents/corpora or named codes (FC, RS, Building Code) up front, forcing the agent to guess identifiers.
Maintenance
Related MCP Connectors
Read a CFR or eCFR section, or search US federal regulations and the Federal Register.
Search U.S. case law, fetch opinions, and ask matter-aware legal questions over your documents.
US Federal Register for AI agents: rules, notices, executive orders, agency lookup. No keys.
US Federal Register for AI agents: rules, notices, executive orders, agency lookup. No keys.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to retrieve, search, and track changes to US Code of Federal Regulations sections via the eCFR API, returning actual regulation text with citations and point-in-time date support.746 PyPI1MIT
- AlicenseNot gradedqualityBmaintenanceEnables retrieving New York Consolidated Laws by citation, including full statutory text, effective dates, and searchable law corpora.82 npmMIT
- AlicenseNot gradedqualityBmaintenanceLets AI assistants search and retrieve New York State legislative records — bills, laws, members, committees, floor calendars, agendas, transcripts, votes, and change feeds — through the NYS Open Legislation API or an optional local SQLite corpus. It supports full-text ElasticSearch queries and returns citation-ready links for law sections.357 npm5MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to query and analyze New York City spending, contracts, budget, payroll, and revenue data through the public Checkbook NYC API using structured search tools.13165 npm5MIT