
Code as Law: How AI Will Let Governments Compile Their Statutes
For most of legal history, the gap between a statute and its enforcement was a feature, not a bug. Laws were written in natural language because natural language is the medium humans use to argue, interpret, and forgive. The slack between the rule on the page and the rule in the world was where judges, juries, and prosecutors did their work -- and where the rest of us found room to live.
That gap is starting to close. Not because lawyers are getting more efficient, and not because legislatures are becoming more precise, but because for the first time in history we can begin to compile statutes the way we compile software. Large language models have made it economically feasible to translate legal text into structured logic, and the surrounding stack -- programmable money, verifiable identity, cryptographic settlement, agentic systems -- is maturing in parallel. Over the next fifteen years, the question will not really be whether governments can implement parts of their law as code. It will be where the line falls, how fast it moves, and what we lose where it crosses.
The Argument We Started in 2018
When Primavera De Filippi and I wrote Blockchain and the Law in 2018, we were extending an argument Lawrence Lessig had made twenty years earlier. Lessig's claim, in Code and Other Laws of Cyberspace, was that code is one of four modalities of regulation -- alongside law, social norms, and markets -- and that as more of life moved online, the architecture of our software would do more of the regulatory work that statutes used to do.
Our extension was that blockchain-based systems don't just regulate behavior the way Lessig described. They establish a parallel normative order -- what we called lex cryptographia -- in which rules are not enforced after the fact by courts but executed automatically by infrastructure. A smart contract does not contemplate breach. It executes, or it does not execute. The remedy is collapsed into the rule. The court is collapsed into the runtime.
We argued this was profound, but we were also careful about its limits. Smart contracts, in 2018, were brittle. They could only handle the kinds of rules that fit cleanly into Boolean logic over on-chain state. Anything requiring judgment about the messy world -- was the goods conforming, was the consent meaningful, was the action reasonable -- had to be punted to an oracle, an arbitrator, or a court. Lex cryptographia could govern transfers and escrows and corporate structures. It could not govern the substance of most law, because most law is a continuous negotiation with ambiguity.
That limit is what AI begins to dissolve.
What the Models Change
The thing the legal academy has been slow to internalize about modern foundation models is that they are not better search engines or better drafting tools. They are the first systems we have ever built that can read a paragraph of statutory text, an evolving fact pattern, and a precedent, and produce a structured output that is good enough most of the time to act on. They turn natural language into a programmable interface.
Three capabilities matter for the trajectory.
The first is statute compilation. A model can take a body of law -- a tax title, a zoning code, a benefits program -- and produce, for any given fact pattern, a structured determination: applicable provisions, computed obligations, required disclosures, ranked ambiguities. Intuit and the IRS already do crude versions of this. The trend line points toward this becoming routine across much of the administrative state, with the structured output gradually treated as a first-class artifact alongside the natural-language text rather than a downstream summary of it.
The second is continuous adjudication. Models can evaluate ongoing conduct against a rule in something close to real time, the way a fraud-detection system evaluates transactions. As agent-readable APIs spread across financial, identity, and physical-world systems, the substrate exists for compliance to be checked at the moment of action rather than reconstructed years later in discovery. Not for everything. But for more and more of what regulators currently police through after-the-fact filings.
The third -- and this is the one most people miss -- is negotiated specificity. Earlier code-as-law systems failed at the boundary where rules met facts that hadn't been anticipated. Models handle that boundary the way a junior associate handles it: by reasoning, by analogy, by asking. They do not eliminate the ambiguity in legal text. They make the ambiguity tractable at machine speed, which is a different and more interesting thing.
Put these three together and you have the missing ingredient for the regime De Filippi and I described. Lex cryptographia without AI was a regime for a narrow set of formal transactions. Lex cryptographia with AI is a regime that can plausibly absorb a meaningful fraction of administrative law over the next decade, and rather more than that over the next two.
Where This Probably Goes
It helps to stop asking whether law is "automatable" and start asking a narrower question: which parts of the state can be turned into runtime without breaking their claim to legitimacy. That is the real sorting mechanism. The first domains to compile are not simply the most repetitive ones. They are the ones where rules are already dense, facts are already digitized, delay is mostly experienced as waste, and discretion is doing less moral work than institutional or cartel work.
This is why the early frontier is likely to be the administrative middle layer of the state. Not constitutional law. Not the hardest edges of criminal punishment. Not the most politically charged forms of adjudication. The first serious wave lands in the machinery that already runs on thresholds, forms, checklists, deadlines, and standard evidentiary packets: formation, tax, permitting, compliance, standardized contracting, benefits administration, and parts of procedure. AI does not create structure in these domains. It reveals how much structure was already there, then makes it executable.
The right way to picture the shift is not that law becomes code all at once. It is that the state acquires a second operating system. Natural-language law remains the canonical layer of legitimacy: the text people debate, amend, litigate, and appeal to. But underneath it, a compiled layer begins to emerge -- first as guidance, then as workflow, then as default decision engine, and finally, in some domains, as the thing that effectively governs because no one can afford to operate outside it. Once that layer exists, politics starts moving around it rather than through it.
Entity formation and licensing. Small-business formation is already a mostly compiled process pretending to be bespoke legal work. Entity choice, tax election, registered agent, local permits, and baseline reporting obligations are rule-bound enough to collapse into a single agent-mediated flow. The real disruption is not that founders save time. It is that an entire stratum of fragmented compliance intermediation begins to disappear. Formation becomes less an event than the opening move in a persistent legal operating system that keeps the firm in bounds.
Licensing is more revealing. Technically, a meaningful share of occupational and business licensing could be compiled quickly. Politically, it is harder because licensing regimes often protect incumbents as much as the public. So this domain will not move as one block. It will split. Some jurisdictions will compile aggressively and advertise themselves as low-friction places to build and work. Others will preserve discretionary review, long queues, and local gatekeepers, then describe that friction as consumer protection. The result is not convergence but competition over legal runtime.
Tax administration. Tax is where compiled law becomes easiest to imagine because we already tolerate primitive versions of it. Wage withholding is a crude form of continuous compliance. The deeper version is a world in which transaction classification, withholding, reporting, and reconciliation happen at the moment of payment, with annual filing receding into a cleanup mechanism for edge cases. For large parts of the population, "doing taxes" becomes less a civic ritual than a periodic audit of a system that has already computed most of the answer.
That matters because it changes the informational structure of the tax state. The state becomes less dependent on taxpayers narrating themselves back to the government after the fact. That weakens some of the rents of the tax-preparation industry, narrows certain forms of jurisdictional arbitrage, and puts pressure on agencies to harmonize definitions they currently tolerate being inconsistent. But tax is also where the incumbents are strongest and the politics are least innocent. The pace of compilation will depend less on technical feasibility than on procurement, lobbying, and whether governments are willing to simplify the rules they currently outsource citizens to navigate.
Permitting, zoning, and land use. This is where the gains from compilation will feel most concrete, because so much of the current system is delay without judgment. Sign permits, conforming renovations, accessory dwelling units, sidewalk closures, curb cuts, basic code checks: these are the obvious candidates for collapsing from months to minutes once parcel data, agency rules, and local code live in the same machine-readable environment. The near-term effect is not abstract efficiency. It is lower carrying cost, fewer clerical choke points, and a material reduction in the discretionary friction that makes small-scale building irrational.
But land use also exposes the hard boundary. The easy cases compile; the contested city does not. Variances, historic review, environmental overlays, discretionary site-plan review, and the large class of approvals that are formally administrative but substantively political will remain sites of conflict. If anything, successful compilation of routine approvals may intensify politics at the edge, because opponents who can no longer weaponize paperwork will demand thicker public process where discretion still survives. The likely result is not depoliticization. It is a cleaner separation between ministerial decisions and genuinely political ones -- which may itself be destabilizing, because it makes naked veto power easier to see.
Financial regulation. Finance is already closer to compiled law than most legal fields because the underlying substrate is digital and the relevant facts are timestamped, machine-readable, and economically legible. KYC, sanctions screening, suspicious-activity monitoring, suitability, and trade surveillance are all partial examples of law already running inside infrastructure. What changes next is not concept but architecture: compliance becomes less episodic and more ambient, attached to the transaction itself rather than reconstructed later from logs and attestations.
The larger shift is in disclosure. A great deal of twentieth-century securities law assumed that standardized disclosure was expensive, periodic, and tightly linked to the public markets. If AI collapses the cost of generating, updating, and checking disclosures, that settlement starts to wobble. The distinction between public and private markets becomes harder to defend on information-production grounds alone. Over time, that should put pressure on the structure of fundraising, on the IPO as a singular legal event, and on the inherited boundary between banking law, securities law, derivatives regulation, and whatever regime ultimately governs tokenized financial assets. The categories were built for paper. The runtime will not respect them.
Contract law. Routine contracts are likely to become the first large domain of genuinely hybrid law: natural-language terms on top, compiled execution underneath. The familiar consumer and SME stack -- procurement terms, payment terms, service-level clauses, employment onboarding, recurring vendor obligations, insurance conditions, financing covenants -- is full of provisions that are too contingent for classic smart contracts but structured enough for AI-mediated enforcement. In practice, many agreements will become living compliance objects. They will not just describe obligations. They will monitor them, interpret them, and trigger downstream actions when thresholds are met.
That does not mean contracts stop being legal texts. It means performance moves closer to infrastructure while dispute resolution retreats to the margin. The practical legal question becomes less "what did the contract mean?" and more "which parts of this relationship are allowed to execute automatically, and where do we insist on human interruption?" Classical contract law is organized around breach and remedy. Compiled contract law is organized around prevention, gating, and selective reversibility.
Benefits administration. Public benefits sit at the intersection of rules-heavy eligibility systems and chronic administrative capacity constraints. Programs for unemployment insurance, disability, housing support, and healthcare subsidies are already governed by formal criteria, document collection, recertification windows, and appeal channels. Much of the cruelty of these systems comes not from legal complexity in the abstract but from the mismatch between dense rules and weak administrative throughput. Compilation promises faster determinations, fewer clerical errors, and more continuous matching between a claimant's situation and the relevant rule.
But this is also where the normative stakes become hardest to ignore. In benefits, friction is often policy by another name. Delay, confusing notices, evidentiary burdens, and periodic redeterminations do not just reflect state incapacity; they function as hidden rationing mechanisms. Compiling the system could make it more humane. It could also make exclusion more scalable. A state that can instantly determine eligibility can also instantly terminate it. Which way this cuts will depend less on the quality of the models than on whether the political system wants a legible welfare state or merely a more efficient denial engine.
Criminal procedure and public enforcement. People sometimes jump too quickly from "AI can parse rules" to fantasies of automated criminal justice. That is mostly the wrong frame. The early movement is more likely in procedure than in punishment: charging guidance, bail recommendations, evidentiary triage, warrant applications, discovery management, probation monitoring. In other words, the machinery around coercion gets compiled before the morally most visible decision points do.
That may still be where the deepest legitimacy crisis arrives. Administrative friction in tax or permitting mostly wastes time and money. Administrative friction in criminal procedure is often one of the last remaining buffers between a person and the full force of the state. Once those buffers are optimized away, coercion becomes more efficient and therefore more visible. This is where the distinction between can and should will matter most, and where courts may end up defending ambiguity not because it is elegant but because it is one of the few remaining sites where mercy can enter the system.
The broader pattern, across all these domains, is the same. Compilation moves fastest where the state can plausibly describe what it is doing as convenience, accuracy, or anti-bureaucratic modernization. It moves slowest where what is really being compiled is coercion, hierarchy, or contested moral judgment. But slow is not the same as safe. It means the hard domains arrive later, after the softer ones have already normalized the premise that law should execute at machine speed.
And once that normalization takes hold -- once permits clear in minutes, taxes reconcile automatically, contracts monitor themselves -- the political burden of justification flips. The old, deliberate, textual state starts to look less like wisdom and more like failure. That is when the compiled layer stops being an experiment and starts becoming the baseline against which all institutions are judged. What we choose to keep outside the runtime, at that point, will not be the residue of inertia. It will have to be a deliberate argument for why some things should remain slow.
The Redistribution of Judgment
The easy way to read this argument is as a story about lawyers. It is not. The legal profession is simply the leading indicator. What is happening to administrative law is what is going to happen to most cognitive work over the next two decades, because most cognitive work, like most law, is structured rule-application punctuated by occasional acts of real judgment. Once a system can read text, hold context, reason over rules, and produce structured outputs that are good enough to act on, the distinctions between "legal work," "compliance work," "consulting work," "advisory work," and a great deal of what passes for analysis inside firms and governments start to collapse. They were always different industries doing the same underlying thing.
The first-order effect is the one people already talk about: the middle of the professional services distribution thins out. Junior associates, paralegals, junior consultants, mid-level analysts, claims adjusters, underwriters, compliance officers, benefits caseworkers -- the people whose job is to apply known rules to incoming facts -- find themselves doing work the runtime now does faster, cheaper, and at more uniform quality. This has been forecast often enough that it no longer counts as a prediction. It is a description of conditions already underway.
The second-order effect is more interesting. When the compiled layer absorbs routine application, it does not eliminate human cognition. It relocates it. Expertise stops being defined as knowing the rules and becomes defined as knowing where the rules fail: the edge cases the model misclassifies, the situations where the rule itself is wrong, the moments when a sympathetic exception is the morally correct answer, the new fact patterns no statute anticipated. The high end of every cognitive profession becomes more important, not less, because every system needs someone who can authoritatively interpret what it cannot. The work that survives is the work the runtime cannot complete on its own.
That redistribution is not symmetrical. It rewards people who can sit with ambiguity, argue from principle, and exercise judgment that holds up under scrutiny. It punishes people whose competence was procedural -- who knew which form to file, which precedent to cite, which clause to copy. The skill premium does not disappear. It moves up the ladder, and the ladder gets steeper. This is the labor-market consequence most professions have not yet absorbed: the floor falls out faster than the ceiling rises.
The deeper question is what this does to intelligence itself, as a public category. For most of modernity we treated intelligence as a property of individuals and measured it by the ability to retain, retrieve, and apply structured information. Schools, professions, civil-service exams, and credentialing systems were all built on that premise. When the application of structured information becomes infrastructure, the meaning of intelligence has to shift. It becomes less about what a person knows and more about what a person can do at the boundary of what is known: notice that something has changed, frame a problem the system has not been trained to recognize, hold contested values in tension, decide when to override an answer that is technically correct but humanly wrong.
There is a real risk in this transition, and it is not the cartoon risk of mass unemployment. It is that we mistake the runtime for the thing itself. A society that comes to experience law primarily as automated execution may forget that the text was supposed to be a public commitment, not a pipeline. A profession that defines competence as deference to the model loses the capacity to push back when the model is confidently wrong. A democracy that lets compiled systems make the small decisions may discover, too late, that the small decisions were where the large values lived.
This is why the argument matters beyond law. The legal system is the most visible case of a broader pattern: as more of the world's structured cognition migrates into infrastructure, the question of what humans are uniquely for becomes practical rather than philosophical. The answer cannot be "everything we used to do," because much of what we used to do is going to be done by the runtime. It will have to be something narrower and more deliberate -- the parts of thought that require accountability, judgment under uncertainty, moral responsibility, and the willingness to be wrong in public.
If compiled law is coming, then so is a redefinition of what professional intelligence means. The work that remains will be smaller in volume and higher in stakes. It will involve fewer people doing more consequential things. It will demand more of those people: more nerve, more taste, more capacity to disagree with a machine that is usually right. And it will require institutions to remember, against the pull of efficiency, that some things are not problems waiting to be solved. They are conditions of being governed by other humans rather than by a system. The point of keeping anything outside the runtime is not nostalgia for slow law. It is preserving the possibility that we are still, in some meaningful sense, the ones deciding.