Skip to content
Ask for a Budget
TechnologyOctober 22, 202616 min readUpdated on November 11, 2026

An open database of Brazil's laws: can it be used for legal AI?

The ctresb/leis database helps AI find the right law, but part of the text marked current is outdated. What it covers, where it fails, how to use it safely.

An open database of Brazil's laws: can it be used for legal AI?
Índice do artigo
faltam 15 min de leitura

On the night of October 14, 2026, a repository called "All the laws of Brazil" appeared on GitHub. Within a week, more than a thousand GitHub users had starred the project, and it reached 1.1 million documents converted into plain text, the format an AI reads effortlessly; by the October 28 report, it was already 1.2 million. The obvious reading is that there is finally one place with all of Brazilian law ready to plug into ChatGPT. That is not the case, and the reason fits in one example.

Ask an AI connected to this database what a special appeal (recurso especial) needs to include today to avoid being blocked at the STJ, Brazil's Superior Court of Justice. The relevance filter has been in the Constitution since Constitutional Amendment 125 of 2022, and the repository's Constitution includes that amendment. What regulated the filter was Law 15,484 of August 2026, which added art. 1,035-A to the Code of Civil Procedure (CPC): the appellant must demonstrate relevance in a specific, reasoned section, or the appeal is dismissed. The repository's CPC is marked as "compilada (texto vigente)", meaning consolidated, current text, and does not have that article, because it stopped at a March 2025 consolidation, even though Law 15,484 itself is in the database. If the search returns the CPC, and not the law that amended it, the AI may answer confidently from a code that lacks the rule that now requires that section, on pain of dismissal.

You can use the database, and for quite a lot. What it cannot be is the last word on the wording that applies today, and the rest of this text shows where that line runs.

What it is, without jargon

It is a public archive, ctresb/leis, with one legal norm per document: the Constitution, federal and state laws, decrees, acts of regulatory agencies, súmulas (summary precedent statements) and themes from the higher courts, and a fraction of municipal legislation. Each document has a header at the top with type, number, date (when the source provides it), the address the text came from and the date it was downloaded.

For an AI system, this is raw material, not a finished product. You cannot attach 1.2 million files to a ChatGPT conversation: someone needs to build the search that finds the right passage and hands it to the model, so it can answer citing where it came from. That build is where the precautions described further below come in.

It was made by one person: the ctresb account, whose license is in the name of developer João Davi, is the only one that has published content in the repository. The project's work log says the expansion of the collection after the first upload was done with coordinated AI agents. It is a large piece of work, assembled in days, and the project itself publishes the issues it has already found. The problems described below have different causes, and the most serious of them, the lag in the text marked as current, comes from the consolidation it copied from, not from whoever copied it.

Does it have every law? The project itself says no

The progress report generated on October 28, the most recent as of November 11, records 1,201,847 documents (there were 1,113,033 in the October 21 report). On the same page, the project measures how far it has come toward the target it set itself for each type of norm:

Federal laws, including decree-laws99.7%
State and Federal District laws85.0%
Súmulas, themes and constitutional review78.8%
State sub-statutory acts67.3%
Federal Executive decrees76.8%
Municipal legislation0.4%
Six of the areas in the October 28, 2026 report, as a percentage of the target the project itself set. Federal sub-statutory acts, which the report splits by theme, range from 37.3% (financial) to 82.3% (health). In the federal series the target comes from the source's index; in most other areas, it is the author's estimate.

Two cautions when reading this. The first: the targets are not an official census. The file that defines them says they start as an estimate "to size the bar, not to state an official number", and only become the real size once the source's index is downloaded, which happened in the federal series. Reaching 100% on a bar means the project met its own plan, not that that entire legal universe is there.

The second: the overall indicator at the top of the report, 9.3%, is misleadingly low. Almost the whole size of the target, 87.8%, is the estimate of 10.3 million municipal norms. Without the municipalities, by our math, the index would be 73.4%. The honest reading is the bars: federal laws are almost complete, state laws are above 80%, federal decrees reached 77% with the October 27 and 28 upload, and anyone who needs municipal law will find almost nothing there yet.

The 7,637 pending items the report lists are documents published in the repository whose full text the project itself has not yet validated, and which are therefore left out of the counts. More than 6,000 of them are federal decrees, most with an annex or supplement that did not come along or that the project has not yet checked.

Case law: súmulas, themes and constitutional review, without the rulings

For those who work in litigation, the next question is about precedents. The case law folder is much narrower than the name suggests:

  • STF súmulasThe 736 súmulas and 62 binding ones from Brazil's Supreme Federal Court; Binding Súmula 63, from 2025, is missing.
  • General repercussionSTF themes up to No. 1,494, some with empty fields.
  • STJ1,474 repetitive appeal themes, from the court's open data, and 649 súmulas, from a 2021 compilation.
  • TST and TNU1,157 súmulas and guidance statements from the TST (Superior Labor Court), from a compilation that runs to 2017, and 394 themes from the TNU (the federal small claims courts' national uniformization panel).
  • Constitutional review5,198 actions (ADI, ADC, ADPF and ADO), part of the 8,000 target.
  • TJ, TRF and TRT rulingsRulings from state courts of appeal, federal regional courts and regional labor courts: outside the project's plan.Not included
  • The theme's rulingThe theme includes the question and, when decided, the holding; it does not include the ruling.Not included
  • Single-judge decisionsAlso outside the plan.Not included

A catalogued theme is not a decided holding. STJ Theme 1474, the most recent of the repetitive appeals, asks whether it is enough for a bank contract to provide for daily compounding of interest or whether the daily rate must be stated explicitly. It is in the repository as "afetado" (admitted for repetitive judgment), with the question submitted and no holding, and that is exactly what the court's portal showed on October 22: admitted in September, judgment pending. The file is correct. The risk is in the reading: an AI that finds the theme may treat it as settled law if nobody looks at the status field, and fail to warn that admission suspended appeals on the same question.

There is lag here too, and not always for the same reason. TST Súmula 331 appears with item I unmarked, although the TST cancelled it in June 2025, as it had lost effect with Brazil's 2017 Labor Reform; another 26 súmulas cancelled in whole or in part by the same resolution also appear as current, because the TST compilation used runs to 2017. The STJ súmulas stop at 649 because they come from a 2021 compilation, and the court's official list goes at least to 676, from December 2024. For binding súmulas, the list stops at 62: Binding Súmula 63, from September 2025, is missing, and Binding Súmula 9, cancelled at the same plenary session, appears as approved.

Text marked as current is not always current

This is the point that matters most for anyone who will use the database in work someone signs. The project's own README warns that you need to check the source before citing; the cases below show why.

Two stacks of glass layers: the one on the left has five layers, with the most recent in orange; the one on the right is a copy with four layers and a dashed outline in place of the fifth

A heavily amended law has two forms: the original text and the consolidated text, which incorporates each change in the right place. It is the consolidated version that matters for knowing today's wording. For federal laws, the repository uses the consolidation maintained by the Chamber of Deputies and published on the normas.leg.br portal. When that consolidation stops at a date, the copy stops with it, and the header keeps saying "current text".

The CPC case, told from the beginning:

  1. March 13, 2025 normas.leg.br
    Last consolidation of the CPC in the Chamber's database

    This is the date that appears in the consolidation's identifier.

  2. August 4, 2026 Official Gazette
    Law 15,484 adds art. 1,035-A

    It regulates the relevance filter for special appeals, provided for in the Constitution since 2022, and starts requiring a specific section on relevance in the appeal. In force 30 days after publication.

  3. September 2026 in force
    The relevance filter takes effect

    The section requirement applies to appeals against rulings published after the law came into force (art. 4 of Law 15,484). Planalto's consolidated text includes the article, with the note "Added by Law No. 15,484, of 2026".

  4. October 13, 2026 repository
    The database downloads the March 2025 CPC and marks it as current

    The header shows the law's date and the download date, but not the consolidation date. Someone reading only the file has no way of noticing.

  5. Today in your AI
    The answer may come out without the new special appeal article

    And when it does, it comes with a source, which makes it more convincing, not more correct.

It is not an isolated case. The repository's Civil Code has arts. 757 to 802, the chapter on insurance contracts, as live text, with only a note "see Law No. 15,040". On Planalto, those 46 articles are repealed by that law, which came into force in December 2025, and the same applies to the clause that set a one-year limitation period between insured and insurer (art. 206, § 1, II), which the database also shows as live text. Today that period is in art. 126 of Law 15,040, which keeps one year for the insured, but counted from when they learn of the insurer's refusal. The old wording may still apply to earlier contracts, but the database does not warn that it was repealed. The LGPD (Brazil's data protection law) marked as current does not incorporate Law 15,352/2026, which converted into law the change from the National Data Protection Authority to the National Data Protection Agency, so an AI consulting that text may describe the ANPD with its old name and regime.

To find out whether this is the exception or the rule, we ran a test on the federal collection itself. We took the 2025 and 2026 laws whose summary says they amend another law, kept only the amendments that were not vetoed and were already in force on the download date, and checked whether the text of the amended law mentions the amending law.

35 of 292recent amendments missing
33 of 201consolidated laws outdated

Among the amendments made to laws marked as "compilada (texto vigente)", 35 of 292 (12%, about one in eight) do not appear in the text. Planalto has all 35. Counting by law, 33 of the 201 consolidated laws that received amendments in the period (16%) are missing at least one of them.

The defect is not spread evenly. Law 15,269/2025, on the electricity sector, alone accounts for 10 of the 35 failures, and the November 2025 amendments, counting those 10, for 19. For amendments from 2023 and 2024, the proportion drops to at most 14 of 295 (4.7%). The problem weighs more on 2025 amendments, but it also affects 2026 ones, as the CPC and the LGPD show.

There is another side, and it counts too. The Penal Code, the Code of Criminal Procedure, the CLT (Brazil's labor code) and the Consumer Protection Code were up to date on every amendment we checked, including a September 2026 provisional measure in the Consumer Protection Code. The lag does not come from the repository's author, who copied the source faithfully. It comes from the consolidation he copied from. For the user, it amounts to the same thing: the "current" label is no guarantee.

Two other points that matter for anyone who will build the system or hire someone to build it:

  • only 1,751 of the 16,784 federal ordinary laws are in consolidated form. Another 14,276 are in their original version, and 746 appear as a republication or correction. For a law that has never been amended, the original is today's wording, but the file does not say which laws were amended, and today's wording does not mean the law is in force, because the norm may have been repealed;
  • some large laws are in the collection without the text of the law. The file for Law 14,133/2021, the Public Procurement Law, is about one page long and contains only the promulgation of the parts whose veto Congress overturned. The same happens with Complementary Law 214/2025, the consumption tax reform law. About 300 of the 746 files marked as "republication/correction" do not contain art. 1 in any spelling, and almost all of them hold only the correction, the republication of annexes or the vetoed parts. A user opened an issue about this in the repository on October 21, and a contributor proposed a fix on October 27; as of November 11, it had not been merged.

Who maintains it, and under what license

The repository's license is MIT, which allows commercial use of the scripts with the copyright notice, plus an addendum saying that the texts of the norms are official acts without copyright protection. That is right in substance, with a detail a lawyer will notice: the addendum cites item I of art. 8 of Law 9,610/1998 (Brazil's copyright law), and what excludes laws and court decisions from protection is item IV. The license does not say under what terms the organization and metadata fall, and says nothing about use with AI.

On maintenance: there is no automatic update routine in the repository. The author kept publishing after the first week, in large batches between October 27 and 28: federal decrees, Official Gazette acts, laws from the states of Acre, Sergipe and Tocantins and municipal rules. The folder of federal ordinary laws, however, has not received a commit since the night of October 15 (Brasília time), and almost all of its texts were downloaded on October 13; that is where the CPC and the LGPD mentioned above come from. Since November 1, the README opens with a request for support via Pix (Brazil's instant payment system): the author says he is running out of storage space, with 133.8 GB in the project's local folder, and the R$ 5,000 (Brazilian reais) goal was at 7% at the last update, on November 2, which is also the last commit to the repository as of November 11. None of the third-party contributions had been merged by that date, and the author's account had not commented on users' issues and proposals, 27 of which remained open. It is a personal project that moves forward in bursts and asks for help to continue. For anyone who will depend on it, that means updating is the user's responsibility.

Where it works, and where it cannot be the last word

What decides the use is the cost of an error and how much the answer depends on the wording in force today.

Law at the date of the factsThe database finds the norm; the wording at that date is checked on Planalto
Filing, legal opinion and deadlineThe database finds it, the official source confirms it, the lawyer signs
Triage and studyStart here
Quick internal answerUse it with a link to the source and the date

In practice, the database works well for finding which norm deals with a subject, gathering the legislation of several states at once (checking first the per-state gaps the README itself lists), setting up case triage by theme, feeding an internal study assistant and finding the right number and date so you can then look up the official text. It does not work as the final source for the wording that goes into a court filing, a legal opinion or a deadline calculation. And it does not work for concluding that a norm does not exist because it did not appear in the search: the state and municipal collections are incomplete, and even recent federal law is missing.

How to use it with AI without taking outdated wording into a filing

The path that reduces the risk has five steps, and none of them is exotic:

Pin the version, recording which version of the database went into the system and on what date. The database changes, and tomorrow's answer needs to be explainable.
Filter the collection, keeping only the documents containing norms. The root of the federal folder alone holds about 590 MB of the project's own working files, which are not law, plus dozens of auxiliary folders; if they get into the search, the AI may answer from them instead of the norm.
Test simple search before paying for sophisticated search. In a public test with 692 real requests from members of Congress to the Chamber of Deputies' Legislative Consultancy, keyword search, the cheapest, came first on the main metric, ahead of models that search by similarity of meaning, which only pulled ahead on a secondary measure. Measure with your team's questions before buying the expensive option.
Resolve each citation at the official source: federal law on Planalto, state or municipal law in the official gazette, súmulas and themes on the court's portal, checking the wording, the status and the date. For federal laws, the address in the header leads to normas.leg.br, which is where the outdated text came from, and is not enough as a check. A citation that does not check out does not go out.
Deliver with source, date and review. The lawyer reviews the entire output before it goes into the case.
The last two steps are the ones no open database replaces.

These two steps are not excess caution on our part. Recommendation 001/2024 of the Federal Council of the OAB (the Brazilian Bar Association) on generative AI, approved in November 2024, asks lawyers to fully review AI outputs before presenting them in court, and to pay special attention to case law research with AI, recalling the duty of truthfulness in art. 77 of the CPC. The open database helps show where each citation came from, because each file includes the address the text was copied from. The checking remains the responsibility of whoever signs. We have already written about what happens when it is skipped in AI that makes up case law.

A technical detail that changes the budget: the 16,784 federal ordinary laws add up to about 119 MB of text, a small volume for an ordinary computer. Search over that volume can run on a machine in the firm itself, without a dedicated cloud server. If the AI model also runs there, in a design like the one in our guide to local LLMs for Brazilian law, no client question or document needs to leave the firm.

The other sources, and what each one delivers

The open database is one piece of a larger collection. Among the open sources we checked, none solves current text, case law and updates all at once on its own:

SourceWhat it deliversLimitation
ctresb/leis1.2 million documents as text, with header and source link, easy to indexno update routine; federal ordinary laws not updated since October 15, 2026 (texts mostly downloaded on October 13); part of the "current" text is outdated; case law limited to súmulas, themes and constitutional review
Planaltoconsolidated federal text, with a note for each amendmentpages for human reading, with no documented interface for systems; the site itself warns that the text does not replace what is published in the Official Gazette
normas.leg.brpublic interface with the text article by article and versions over time, CC BY 4.0 licensedeclares its own text as having no official value; consolidations with different dates per law
DataJud (CNJ, Brazil's National Council of Justice)basic case records and docket entries from 91 courtsno full text and no parties; the terms of use prohibit commercial exploitation
RepoJus (Hugging Face)4.1 million decisions with full text, from 15 courts and bodiesuneven coverage across courts; STJ only for 2025 and 2026
paid platforms (not evaluated here)whatever each contract provides for case law, updates and supportcontract, cost and their own rules for AI use; ask for the update date of the current text

Sources: documentation and queries to each service on October 22, 2026. DataJud: terms of use of the public API. RepoJus: dataset card.

What this changes for law firms and legal departments

The open database brought together in one place, as plain text ready to feed a search, legislation that previously had to be collected source by source. What it does not solve is what separates a demo from a system a partner trusts: knowing which wording applies today, proving where each citation came from and recording who reviewed it.

The requests we receive from law firms and legal departments do not start with the law database: they talk about an assistant that tracks case progress and court notices, that produces drafts from the firm's own archive and that records what the lawyer reviewed. The law database comes in as one layer of that design, not as the product. It is the kind of project our Artificial Intelligence practice handles.

The test you can run now, with no new project: if your team already uses AI to research legislation, pick a recent filing and check on Planalto or in the official gazette each article the AI cited. The question worth answering with this test is how many of the citations carried the wording applicable to the case, which is usually today's, but may be the one in force at the date of the facts or of the contract, and whether the filing made clear which one it was.

Frequently asked questions

Not without checking. Part of the texts marked as current do not include 2025 and 2026 amendments, and the project itself warns that they do not replace the Official Gazette (Diário Oficial). Use the database to find the law and confirm the wording on Planalto, the Brazilian presidency's official legislation site, if the law is federal, or in the official gazette. The address in the header is not enough: for federal laws, it leads to normas.leg.br, which is where the outdated text came from.

How we researched this

  • Repository: ctresb/leis on GitHub, version of October 21, 2026 (the most recent at the time of the query), read on October 22, 2026: README, progress report, targets file, collectors and license. The coverage, target and pending item numbers come from the project's own report. The number of stars changes throughout the day.
  • Text checking: a sample of documents compared with Planalto, normas.leg.br, the Senate, state legislative assemblies, the STF, STJ, TST and the Official Gazette, on October 22, 2026. A sample does not measure an error rate; it serves to describe what we saw.
  • Update test: our own count on the federal collection, done twice independently; the second used a more complete universe of pairs, agreed with the first on every pair the two had in common, and is the source of the published numbers. The method: pairs of amending law and amended law in which the summary of a 2025 or 2026 ordinary or complementary law announces the amendment, with a provision that was not vetoed and already in force on October 13, 2026, the download date. The test checks whether the amending law's number appears in the text of the amended law, does not check provision by provision, does not see provisional measures, state laws or agency acts, and applies to the October 21, 2026 version of the repository. For 2023 and 2024, some failures may be amendments later rewritten by a subsequent law, so, for what the test measures, 4.7% is a ceiling; a text that cites the amending law without applying the whole change passes the test.
  • Update of November 11, 2026: we queried the repository again through GitHub's public interface: commit history (the last content commit is from October 28 and the very last, to the README, from November 2; none in the federal ordinary laws folder since October 21), README, progress report generated on October 28, 2026, pending items log, open issues and the CPC file, which still lacks art. 1,035-A. The coverage and pending item numbers in this version come from the October 28 report. The update test and the text checking were not redone, because the federal law files did not change.
  • Our own calculations: 73.4% is the sum of what was counted in phases 1 and 2 of the project (federal legislation and state laws; sub-statutory acts and case law), 1,054,175, divided by the targets for those phases (1,436,086), in the October 28, 2026 report; 87.8% is the municipal target (10,332,713) over the total target (11,768,799).
  • Other sources: Law 9,610/1998, Law 15,040/2024 and Law 15,484/2026 on Planalto; Recommendation 001/2024 of the OAB Federal Council; the JUÁ benchmark (Ulysses-RF subset) and RepoJus on Hugging Face; DataJud terms of use; all consulted on October 22, 2026.
Previous post
Pentest-Tools.com: the scanner that flagged the PHP flaw at UNICEF
Next post
AI can now log in to sites without seeing the password, but outside IT's control
Newsletter

One email a month, no noise

What we learn shipping custom software and applied AI.

Related articles

AI agents or traditional systems: which should your company choose11 min · Technology
Public data collection: the part of a document that takes longest8 min · Technology
Not sending documents to AI: three objections and what each one costs7 min · Technology
Pentest-Tools.com: the scanner that flagged the PHP flaw at UNICEF9 min · Technology
AI in industrial maintenance: why it stalls at the work order7 min · Technology

Accelerate your business with X-Apps

Ask for a Budget
X-Apps is an IT provider partner and advised by
Gartner
Receive our e-mails
News on software and applied AI.
Follow X-Apps