Skip to content
Back to search

pasal

Pasal.id - The first open, AI-native Indonesian legal platform. MCP server + REST API + web app giving AI grounded access Indonesian laws.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/ilhamfp--pasal/badge.svg)](/listings/ilhamfp--pasal)

HTML

<a href="/listings/ilhamfp--pasal"><img src="/api/listings/ilhamfp--pasal/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 208 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <p align="center">
  2. <picture>
  3. <source media="(prefers-color-scheme: dark)" srcset="logo/lockup-dark-bg.svg" />
  4. <img src="logo/lockup-primary.svg" alt="Pasal.id" height="64" />
  5. </picture>
  6. </p>
  7. <h3 align="center">The First Open, AI-Native Platform for Indonesian Law</h3>
  8. <p align="center">
  9. <a href="https://www.loom.com/share/da211318bbe14c4396840b97f5ab8603">Demo Video</a> ·
  10. <a href="https://pasal.id">Website</a> ·
  11. <a href="https://pasal.id/connect">Connect to Claude</a> ·
  12. <a href="https://pasal.id/api">REST API</a> ·
  13. <a href="LICENSE">AGPL-3.0 License</a>
  14. </p>
  15. <p align="center">
  16. <a href="https://pasal.id"><img src="https://img.shields.io/badge/Legal_Data-Pasal.id-2B6150?style=flat" alt="Legal Data by Pasal.id" /></a>
  17. <a href="https://pasal.id/connect"><img src="https://img.shields.io/badge/MCP-Server-blue?style=flat" alt="MCP Server" /></a>
  18. <img src="https://img.shields.io/badge/Built_with-Opus_4.6-cc785c?style=flat&logo=anthropic&logoColor=white" alt="Built with Opus 4.6" />
  19. <img src="https://img.shields.io/badge/Next.js-16-black?logo=nextdotjs" alt="Next.js" />
  20. <img src="https://img.shields.io/badge/Supabase-PostgreSQL-3ECF8E?logo=supabase" alt="Supabase" />
  21. <a href="LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat" alt="License: AGPL-3.0" /></a>
  22. </p>
  23. ---
  24. ## The Problem
  25. **280 million Indonesians** have no practical way to read their own laws. The official legal database ([peraturan.go.id](https://peraturan.go.id)) offers **only PDF downloads**: no search, no structure, no API. When you ask AI about Indonesian law, you get **hallucinated articles and wrong citations** because no grounded data source exists.
  26. ## Try It Now
  27. Connect Claude to real Indonesian legal data in one command:
  28. ```bash
  29. claude mcp add --transport http pasal-id https://pasal-mcp-server-production.up.railway.app/mcp
  30. ```
  31. Then ask:
  32. > *"Apa saja hak pekerja kontrak menurut UU Ketenagakerjaan?"* (What are contract worker rights under the Labor Law?)
  33. > *"Jelaskan pasal tentang perlindungan data pribadi"* (Explain articles on personal data protection)
  34. > *"Apakah UU Perkawinan 1974 masih berlaku?"* (Is the 1974 Marriage Law still in force?)
  35. Claude searches **40,000+ regulations and 937,000+ structured articles**, cites specific Pasal (articles), and gives grounded answers. No hallucination.
  36. Or browse the web app at **[pasal.id](https://pasal.id)**.
  37. ## What We Built
  38. | | Feature | Description |
  39. |---|---|---|
  40. | **Search** | Full-Text Legal Search | Indonesian stemmer + 3-tier fallback across 937,000+ articles |
  41. | **Read** | Structured Reader | Three-column law reader with TOC, amendment timeline, and verification badges |
  42. | **AI** | MCP Server | 4 grounded tools giving Claude access to actual legislation with exact citations |
  43. | **API** | REST API | Public JSON endpoints for search, browsing, and article retrieval |
  44. | **Correct** | Crowd-Sourced Corrections | Anyone can submit corrections; AI verifies before applying |
  45. | **Verify** | AI Verification Agent | Opus 4.6 vision compares parsed text against original PDF images |
  46. | **Track** | Amendment Chains | Full relationship tracking: amendments, revocations, cross-references |
  47. | **Globe** | Bilingual UI | Indonesian + English interface via next-intl (legal content stays Indonesian) |
  48. ## How Opus 4.6 Powers the Platform
  49. The entire codebase, from the Next.js frontend to the MCP server to the data pipeline, was built with Claude Opus 4.6 via Claude Code during the hackathon period. But Opus 4.6 isn't just the development tool. It's embedded in the product itself, running a **self-improving correction flywheel** that makes the platform more accurate over time:
  50. ```
  51. ┌───────────────────────────────┐
  52. │ Users submit corrections │
  53. │ via pasal.id web app │
  54. └──────────────┬────────────────┘
  55. ▼
  56. ┌───────────────────────────────┐
  57. │ Opus 4.6 Verification Agent │
  58. │ Uses VISION to compare text │
  59. │ against original PDF images │
  60. │ → accept / reject / correct │
  61. └──────┬───────────────┬────────┘
  62. │ │
  63. ≥85% conf │ │ parser_feedback
  64. auto-apply │ │ from each review
  65. ▼ ▼
  66. ┌──────────┐ ┌───────────────────────┐
  67. │ Database │ │ Opus 4.6 reads the │
  68. │ updated │ │ parser source code │
  69. │ via safe │ │ + aggregated feedback │
  70. │ revision │ │ → creates GitHub │
  71. │ function │ │ issues with fixes │
  72. └──────────┘ └───────────────────────┘
  73. ```
  74. ### 1. MCP Server: Grounded Legal Access
  75. Claude gets 4 tools to search real legislation, retrieve specific articles, check amendment status, and browse regulations. All returning real data with exact citations, not generated text.
  76. ### 2. Multimodal Verification Agent
  77. When users submit corrections, Opus 4.6 uses **vision** to compare the parsed text against the **original PDF page image**. It reads the actual PDF, character by character, and makes accept/reject/correct decisions with confidence scores. ([`scripts/agent/opus_verify.py`](scripts/agent/opus_verify.py))
  78. ### 3. Self-Improving Feedback Loop
  79. Every verification produces `parser_feedback`: notes on *why* the parser got it wrong. Opus 4.6 **aggregates this feedback**, **fetches the parser source code from GitHub**, analyzes systematic bugs, and **creates GitHub issues with specific code fixes**. The AI improves the pipeline that feeds it. ([`scripts/agent/parser_improver.py`](scripts/agent/parser_improver.py))
  80. ### 4. Human-in-the-Loop Safety
  81. High-confidence corrections (≥85%) are auto-applied through a transaction-safe revision function. Below that threshold, corrections are queued for admin review. Every mutation is logged in an append-only audit trail. Nothing is silently overwritten.
  82. ### 5. Claude Code as Development Tool
  83. The entire platform was built with Claude Code guided by **489 lines of CLAUDE.md specifications** across 4 directories (root, web app, MCP server, and data pipeline), encoding architecture decisions, coding conventions, database invariants, and domain knowledge.
  84. ## Architecture
  85. ```
  86. ┌──────────────────────────────────────┐
  87. │ Supabase (PostgreSQL) │
  88. │ 40,143 regulations · 937,155 Pasal │
  89. │ 49 migrations · FTS · RLS │
  90. └─────────┬──────────────┬─────────────┘
  91. │ │
  92. ┌────────────────┘ └────────────────┐
  93. ▼ ▼
  94. ┌─────────────────────┐ ┌───────────────────────┐
  95. │ MCP Server (Py) │ │ Next.js 16 Web App │
  96. │ FastMCP · Railway │ │ Vercel · pasal.id │
  97. │ │ │ │
  98. │ · search_laws │ │ · /search │
  99. │ · get_pasal │ │ · /jelajahi │
  100. │ · get_law_status │ │ · /peraturan/[type] │
  101. │ · list_laws │ │ · /connect · /api │
  102. └─────────┬───────────┘ └───────────────────────┘
  103. │
  104. ▼ ┌───────────────────────┐
  105. ┌─────────────────────┐ │ Opus 4.6 Correction │
  106. │ Claude / AI │ │ Agent · Railway │
  107. │ Grounded answers │ │ │
  108. │ with citations │ │ Verify · Auto-apply │
  109. └─────────────────────┘ │ Parser improvement │
  110. └───────────────────────┘
  111. ```
  112. ## Built to Last: Technical Depth
  113. This isn't a weekend hack. Key engineering decisions:
  114. - **49 SQL migrations** with iterative schema evolution, not a single dump
  115. - **3-layer search with identity fast-path**: regex-detected regulation IDs (score 1000) → works FTS (score 1-15) → content FTS with 3-tier fallback (`websearch_to_tsquery` → `plainto_tsquery` → `ILIKE`), capped candidate CTEs to prevent O(N) snippet generation
  116. - **Append-only revision audit trail**: content is never directly UPDATE'd; all mutations go through `apply_revision()` SQL function in a single transaction (revision insert + node update + suggestion update)
  117. - **Transaction-safe content mutations**: if any step fails, everything rolls back
  118. - **Row-Level Security** on all tables with public read policies for legal data
  119. - **Input sanitization**: `[^a-zA-Z0-9 ]` stripped before tsquery to prevent injection
  120. - **ISR with on-demand revalidation** for static generation + instant updates when content changes
  121. - **Atomic job claiming**: `FOR UPDATE SKIP LOCKED` prevents duplicate processing in the scraper pipeline
  122. - **11 regulation types** covering laws from 1945 to 2026, from official government sources
  123. ## MCP Tools
  124. | Tool | Description |
  125. |------|-------------|
  126. | `search_laws` | Full-text keyword search across all legal provisions with Indonesian stemming |
  127. | `get_pasal` | Get the exact text of a specific article (Pasal) by law and number |
  128. | `get_law_status` | Check if a law is in force, amended, or revoked with full amendment chain |
  129. | `list_laws` | Browse available regulations with type, year, and status filters |
  130. ## Tech Stack
  131. | Layer | Technology |
  132. |-------|-----------|
  133. | Frontend | Next.js 16 (App Router), React 19, TypeScript, Tailwind v4, shadcn/ui |
  134. | Database | Supabase (PostgreSQL FTS with `indonesian` stemmer + pg_trgm) |
  135. | MCP Server | Python + FastMCP, deployed on Railway |
  136. | Correction Agent | Claude Opus 4.6 (vision + code analysis), deployed on Railway |
  137. | Data Pipeline | Python, httpx, PyMuPDF, BeautifulSoup |
  138. | Search | 3-layer: identity fast-path → works FTS → content FTS with ILIKE fallback |
  139. | i18n | next-intl with Indonesian (default) + English |
  140. ## Legal Coverage
  141. Currently covers **40,143 regulations** across 11 types including:
  142. - **UU** (Undang-Undang) · Primary laws from parliament
  143. - **PP** (Peraturan Pemerintah) · Government regulations
  144. - **Perpres** (Peraturan Presiden) · Presidential regulations
  145. - **UUD** · The 1945 Constitution
  146. - **Permen**, **Perda**, and more from official government sources
  147. ## Development
  148. ```bash
  149. # Frontend
  150. cd apps/web && npm install && npm run dev
  151. # MCP Server
  152. cd apps/mcp-server && pip install -r requirements.txt && python server.py
  153. # Correction Agent
  154. cd scripts && pip install -r requirements.txt
  155. python -m scripts.agent.run_correction_agent
  156. ```
  157. ---
  158. <p align="center">
  159. Built with <a href="https://anthropic.com">Claude Opus 4.6</a> for the <a href="https://cerebralvalley.ai/e/claude-code-hackathon">Claude Code Hackathon</a>
  160. <br />
  161. <a href="LICENSE">AGPL-3.0</a>
  162. </p>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.