I Got Tired of Digging Through Laws, So I Built a Bot

·11Vibe Coding

I Got Tired of Digging Through Laws, So I Built a Bot

When you do ISMS-P consulting, a surprising amount of time goes into looking up laws. The Personal Information Protection Act (PIPA), the Act on Promotion of Information and Communications Network Utilization and Information Protection, the Credit Information Act, plus various enforcement decrees and public notices. Open the Korea National Law Information Center website, find the relevant article, download the PDF, then hunt down guidelines on yet another website. Repeating this for every project, at some point I thought — why am I still doing this manually?

I already had my government notice monitoring bot running. Docker + OpenClaw + Telegram bot. I took that foundation, plugged in a legislation API, connected it to Obsidian, and built a consulting knowledge base. In one day.

The Architecture

I kept the existing notice bot infrastructure (OpenClaw Docker container + Telegram bot) as-is and spun up a separate container. Different purpose, so it made sense to keep them apart.

The new bot does three things:

  • Pulls full texts of laws, enforcement decrees, and public notices via the Korea National Law Information Center Open API and saves them as Markdown in Obsidian
  • Answers questions on Telegram using the materials stored in Obsidian
  • Lets me edit Obsidian notes or upload new topics directly from Telegram

If the notice bot is "a bot that brings in news from the outside," this one is "a bot that organizes and leverages what I already have."

Connecting the Legislation API

I applied for access to the Korea National Law Information Center Open API. Approval took about a day. The application itself is simple, but there's a waiting period so it's worth doing early.

Pulling full legal texts via the API wasn't hard. The challenge was converting them to Markdown for Obsidian. The JSON response structures for laws, enforcement decrees, and public notices are subtly different. Article numbering systems differ, and some include attached tables or forms. When I asked Claude to write a script, it would work fine for laws, break on enforcement decrees, and break differently on public notices.

I ended up splitting the parsing logic by format type and iterating through multiple revisions. This is where vibe coding hits its limits. AI writes the code for you, but it can't catch every edge case in one shot. You need to go through the "why doesn't this work?" loop, fixing things one at a time.

Obsidian Is Really Good

I had been using Notion, but I switched to Obsidian for this. For managing legal materials, Obsidian is vastly superior.

First, everything is local Markdown files, so it's fast. Notion being cloud-based means occasional lag — Obsidian has none of that. The difference is noticeable when searching through legal articles.

The inter-note linking is also incredibly convenient. In a PIPA Article 15 note, I can write [[PIPA Enforcement Decree Article 17]] and it links right away. During consulting, the time spent asking "what's the enforcement decree for this provision?" just disappears. The graph view that shows relationships between laws is great too. I can visually see which laws I reference most and which provisions are connected to each other.

Most importantly, being Markdown-based makes it a natural fit for automation. Data pulled from the API gets saved as .md files, and those instantly become Obsidian notes. Notion has an API too, but it's not this direct.

Telegram Integration

Here's what I can do from Telegram:

Ask a question based on what's in Obsidian and it gives me an answer. For example, if I send "summarize the exceptions to consent requirements for collecting personal data," it searches the legal texts stored in Obsidian and puts together a response. Super useful for quick article lookups in the field.

I can also edit notes or upload new topics. If something comes up during a meeting that I need to jot down, I send it via Telegram and it goes straight into Obsidian. Makes it much easier to organize later.

The Struggle Log

Honestly, the legislation API parsing took the longest. I probably spent more than half the total work time on it. Laws would work but enforcement decrees wouldn't, enforcement decrees would work but public notices wouldn't — I was stuck in that loop for a while.

I'd show Claude the error logs and say "fix this," but sometimes fixing one thing would break another. Eventually I set up clear conditional logic per format type and designated one test case each for laws, enforcement decrees, and public notices to validate against.

Everything else went fast since I'd done it before. Spinning up Docker containers, connecting the Telegram bot, setting up cron — I'd been through all of it building the notice bot. Once you've done something once, the second time is quick. That's the upside of vibe coding.

Current State

Auto-collection of legal texts + Obsidian storage + Telegram Q&A — it's all running. I haven't loaded every law yet, just the ones I use most frequently in consulting. I'll add more as they come up on future projects.

It feels like just yesterday I was bouncing between websites downloading PDFs. Now I ask a question on Telegram and get an answer. It took one day to build, and the time it'll save going forward is many times that.

Source: https://www.law.go.kr/LSW/openApi/main.html (Korea National Law Information Center Open API)