From Slip-Up to Solution: How AI Can Help Fix Lawmaking in Estonia

After a costly drafting error, a former Government CIO built a tool in one day that scans legislation for mistakes and sparks a new model for civic oversight

BY BEATRIZ REY

Recently, Estonia discovered just how fragile the machinery of lawmaking can be. A routine amendment to the gambling tax law — intended to raise taxes on all forms of remote gambling — contained a single missing word. The text referred only to osavusmängud (skill games) and accidentally left out õnnemängud (games of chance). The consequence was almost absurd: for 2026, online casinos would effectively become tax-free. The estimated cost of this drafting oversight was around €2 million per month. What began as an embarrassing technical mistake turned into a revealing test of how governments and citizens might respond to legislative failure in the age of artificial intelligence.

For Luukas Ilves, former Government CIO of Estonia, an advisor to Ukraine’s Digital Ministry, and founder of the initiative for an Agentic State, the episode immediately raised a practical question. “Like everyone else in Estonia, I saw the news about the slip-up,” he explained. “And my first instinct was to test whether AI would have caught this error.” He took the existing law and the newly passed amendment, fed them into Claude and Gemini, and asked a simple question: are there inconsistencies here? “Both of them immediately found the problem,” he recalled. The result was striking. Either no one involved in the legislative process had thought to use these tools, or they had used them without the right prompts. “Smart, well-meaning people were working under time pressure,” he said, “but the system had set them up to fail.”

The next morning, Ilves began thinking beyond this single incident. “What about next time?” he wondered. The bill in question had passed through multiple layers of scrutiny — ministry lawyers, parliamentary staff, committee members, even the President’s office. Yet a simple error had still slipped through. “Could I build something that would catch these errors systematically?” he asked himself. And, more provocatively: “Why wait for the state to do it?”

Estonia offered a crucial enabling condition. The Riigikogu, the national parliament, publishes draft bills as open data through an API. That openness made a civic solution plausible. “Maybe I could wire up something simple that runs every draft bill through AI analysis,” Ilves thought. Later that day, using the AI-assisted coding platform Lovable.dev, he began sketching out rough specifications. “A few minutes later, I had a working prototype,” he said with a laugh.

The rest of the tool came together in small bursts between meetings and family obligations. “I ended up spending like three, let’s say if I added up three or four hours, kind of tweaking it over the course of the day…tuning it over ten-minute sessions,” he explained. The biggest challenge was technical rather than conceptual: getting the system to pull full legislative texts reliably without the parliament’s API timing out. By the end of the day, however, the beta version was ready. At 7 AM the following morning, he posted the link online to a new application he called Apsakaleidjar.

The reaction was immediate. Within two hours, the Prime Minister had shared the tool on social media. Journalists began calling. By that evening, Ilves was on one of Estonia’s main nightly television programs, demonstrating the application live on air. The episode moved, in his words, “from prototype to national TV in about twelve hours.”

Apsakaleidja does something deceptively simple. It automatically analyzes every draft bill submitted to the Estonian parliament and looks for inconsistencies, missing references, ambiguous wording, and unintended legal consequences. The system generates structured reports that classify potential problems and present them through three lenses — logic, impact, and systematic coherence. Political interest in the tool was intense. Officials told Ilves that, inspired by the publicity, they had already used it to find and correct new slip-ups in bills they were working on. “That was exactly what I’d hoped for,” he wrote.

Yet he is quick to stress that the tool remains a rough beta. “There’s no implied human judgment yet,” he said. The risk ratings it produces are currently based on a very simple prompt instructing the model to assess severity. “Some of the ‘high risk’ things are very pedantic,” he admitted. At present, the platform analyzes only the text of draft bills themselves. For more meaningful comparisons, it would need to integrate the full corpus of existing law. “Draft bills don’t map one-to-one to existing laws,” he noted. He envisions improvements in the data pipeline, more sophisticated prompting logic, and the ability to analyze government drafts earlier in the process.

Still, even in its early form, the application points to new possibilities for lawmakers and for civil society. Ilves imagines two parallel futures. On one track, governments could build internal versions of similar tools, integrated directly into the software that ministries and parliaments already use. “I expect people in the Executive branch will develop more sophisticated versions that incorporate all the formal drafting guidance lawyers rely on,” he said. On the other track, independent civic tools like Apsakaleidja could provide an external quality check. “I like the idea of a tool that belongs to civil society,” he explained. Journalists, advocacy groups, and ordinary citizens could use it to monitor legislation and raise alarms when problems appear. One idea he has considered is automatically emailing committee chairs whenever the system flags a serious issue. “If the tool warns you and you ignore it,” he joked, “you have no excuse.”

The broader democratic implications go beyond error detection. For Ilves, the episode illustrates how radically the barriers to civic innovation have fallen. “I’m not a developer. I’m not a data scientist. I’m not a lawyer,” he reflected. “Yet vibe-coding tools and AI as an assistant enabled me to build Apsakaleidja in a couple of hours.” He sees this as part of a larger shift toward what he calls an “agentic society,” in which ordinary people can create software, analyze data, and intervene in public processes as easily as they now search the web. “Imagine what would happen if just one percent of the population could use tools like Claude Code or Lovable,” he said. “The collective impact could be enormous.”

Could similar systems be built elsewhere? Ilves believes so, but not through a single global platform. Legislative data structures, APIs, and legal traditions differ too much from country to country. “My hunch is that the actual implementation and prompting logic would be different in every jurisdiction,” he explained. Instead, he favors a federated model in which countries develop their own tools while sharing specifications and lessons learned. “The beauty of the AI era is that you don’t need a common code base anymore,” he said. “What matters is having a similar spec and understanding of the patterns.” Already, colleagues in Poland, the United States, and EU institutions have reached out with interest.

For now, Ilves is looking for partners to help maintain and refine the Estonian project. He hopes to find civic organizations willing to steward it in a neutral, nonpartisan manner over the long term. But he also sees the episode as proof of a more general principle. “There are a huge number of public functions where the barrier to building something useful is now incredibly low,” he said. “Civil society, journalists, neighbors, everyone should be experimenting with these tools.” The goal is not perfection but iteration. “What matters isn’t that we never make mistakes,” he concluded. “What matters is that we learn from them and iterate — fast.”

A single missing word in a bill revealed how easily lawmaking can falter. Within a day, it also revealed how quickly citizens equipped with AI can respond. Whether Apsakaleidja becomes a lasting institution or simply an inspiration, it offers a glimpse of a future in which better legislation is supported not only by governments, but by an increasingly capable and inventive public.


Modern Parliament (“ModParl”) is a newsletter from POPVOX Foundation that provides insights into the evolution of legislative institutions worldwide. Learn more and subscribe at modparl.substack.com.

Next
Next

Hang In There, Immigration Caseworkers