{"id":49454862,"url":"https://github.com/ilhamfp/pasal","last_synced_at":"2026-06-10T14:01:21.163Z","repository":{"id":338849682,"uuid":"1155462526","full_name":"ilhamfp/pasal","owner":"ilhamfp","description":"Pasal.id - The first open, AI-native Indonesian legal platform. MCP server + REST API + web app giving AI grounded access Indonesian laws.","archived":false,"fork":false,"pushed_at":"2026-03-01T13:46:57.000Z","size":1425,"stargazers_count":236,"open_issues_count":21,"forks_count":39,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-16T17:29:10.944Z","etag":null,"topics":["ai-native","anthropic","claude","codex","full-text-search","hackathon","hukum","indonesia","indonesian-law","law","legal-tech","mcp","mcp-server","nextjs","open-data","supabase"],"latest_commit_sha":null,"homepage":"https://pasal.id","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilhamfp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-11T14:42:29.000Z","updated_at":"2026-05-15T16:01:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ilhamfp/pasal","commit_stats":null,"previous_names":["ilhamfp/pasal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ilhamfp/pasal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilhamfp%2Fpasal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilhamfp%2Fpasal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilhamfp%2Fpasal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilhamfp%2Fpasal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilhamfp","download_url":"https://codeload.github.com/ilhamfp/pasal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilhamfp%2Fpasal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34155422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-native","anthropic","claude","codex","full-text-search","hackathon","hukum","indonesia","indonesian-law","law","legal-tech","mcp","mcp-server","nextjs","open-data","supabase"],"created_at":"2026-04-30T05:00:30.916Z","updated_at":"2026-06-10T14:01:21.157Z","avatar_url":"https://github.com/ilhamfp.png","language":"TypeScript","funding_links":[],"categories":["Legal AI Models \u0026 Embeddings"],"sub_categories":["Large Language Models (LLMs)"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"logo/lockup-dark-bg.svg\" /\u003e\n    \u003cimg src=\"logo/lockup-primary.svg\" alt=\"Pasal.id\" height=\"64\" /\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003eThe First Open, AI-Native Platform for Indonesian Law\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.loom.com/share/da211318bbe14c4396840b97f5ab8603\"\u003eDemo Video\u003c/a\u003e ·\n  \u003ca href=\"https://pasal.id\"\u003eWebsite\u003c/a\u003e ·\n  \u003ca href=\"https://pasal.id/connect\"\u003eConnect to Claude\u003c/a\u003e ·\n  \u003ca href=\"https://pasal.id/api\"\u003eREST API\u003c/a\u003e ·\n  \u003ca href=\"LICENSE\"\u003eAGPL-3.0 License\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pasal.id\"\u003e\u003cimg src=\"https://img.shields.io/badge/Legal_Data-Pasal.id-2B6150?style=flat\" alt=\"Legal Data by Pasal.id\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pasal.id/connect\"\u003e\u003cimg src=\"https://img.shields.io/badge/MCP-Server-blue?style=flat\" alt=\"MCP Server\" /\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Built_with-Opus_4.6-cc785c?style=flat\u0026logo=anthropic\u0026logoColor=white\" alt=\"Built with Opus 4.6\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Next.js-16-black?logo=nextdotjs\" alt=\"Next.js\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Supabase-PostgreSQL-3ECF8E?logo=supabase\" alt=\"Supabase\" /\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat\" alt=\"License: AGPL-3.0\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## The Problem\n\n**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.\n\n## Try It Now\n\nConnect Claude to real Indonesian legal data in one command:\n\n```bash\nclaude mcp add --transport http pasal-id https://pasal-mcp-server-production.up.railway.app/mcp\n```\n\nThen ask:\n\n\u003e *\"Apa saja hak pekerja kontrak menurut UU Ketenagakerjaan?\"* (What are contract worker rights under the Labor Law?)\n\u003e *\"Jelaskan pasal tentang perlindungan data pribadi\"* (Explain articles on personal data protection)\n\u003e *\"Apakah UU Perkawinan 1974 masih berlaku?\"* (Is the 1974 Marriage Law still in force?)\n\nClaude searches **40,000+ regulations and 937,000+ structured articles**, cites specific Pasal (articles), and gives grounded answers. No hallucination.\n\nOr browse the web app at **[pasal.id](https://pasal.id)**.\n\n## What We Built\n\n| | Feature | Description |\n|---|---|---|\n| **Search** | Full-Text Legal Search | Indonesian stemmer + 3-tier fallback across 937,000+ articles |\n| **Read** | Structured Reader | Three-column law reader with TOC, amendment timeline, and verification badges |\n| **AI** | MCP Server | 4 grounded tools giving Claude access to actual legislation with exact citations |\n| **API** | REST API | Public JSON endpoints for search, browsing, and article retrieval |\n| **Correct** | Crowd-Sourced Corrections | Anyone can submit corrections; AI verifies before applying |\n| **Verify** | AI Verification Agent | Opus 4.6 vision compares parsed text against original PDF images |\n| **Track** | Amendment Chains | Full relationship tracking: amendments, revocations, cross-references |\n| **Globe** | Bilingual UI | Indonesian + English interface via next-intl (legal content stays Indonesian) |\n\n## How Opus 4.6 Powers the Platform\n\nThe 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:\n\n```\n                    ┌───────────────────────────────┐\n                    │     Users submit corrections   │\n                    │     via pasal.id web app       │\n                    └──────────────┬────────────────┘\n                                   ▼\n                    ┌───────────────────────────────┐\n                    │  Opus 4.6 Verification Agent   │\n                    │  Uses VISION to compare text   │\n                    │  against original PDF images   │\n                    │  → accept / reject / correct   │\n                    └──────┬───────────────┬────────┘\n                           │               │\n              ≥85% conf    │               │    parser_feedback\n              auto-apply   │               │    from each review\n                           ▼               ▼\n                    ┌──────────┐   ┌───────────────────────┐\n                    │ Database │   │  Opus 4.6 reads the   │\n                    │ updated  │   │  parser source code   │\n                    │ via safe │   │  + aggregated feedback │\n                    │ revision │   │  → creates GitHub     │\n                    │ function │   │    issues with fixes   │\n                    └──────────┘   └───────────────────────┘\n```\n\n### 1. MCP Server: Grounded Legal Access\n\nClaude 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.\n\n### 2. Multimodal Verification Agent\n\nWhen 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))\n\n### 3. Self-Improving Feedback Loop\n\nEvery 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))\n\n### 4. Human-in-the-Loop Safety\n\nHigh-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.\n\n### 5. Claude Code as Development Tool\n\nThe 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.\n\n## Architecture\n\n```\n                ┌──────────────────────────────────────┐\n                │          Supabase (PostgreSQL)        │\n                │   40,143 regulations · 937,155 Pasal  │\n                │   49 migrations · FTS · RLS            │\n                └─────────┬──────────────┬─────────────┘\n                          │              │\n         ┌────────────────┘              └────────────────┐\n         ▼                                                ▼\n┌─────────────────────┐                     ┌───────────────────────┐\n│   MCP Server (Py)   │                     │   Next.js 16 Web App  │\n│   FastMCP · Railway │                     │   Vercel · pasal.id   │\n│                     │                     │                       │\n│  · search_laws      │                     │  · /search            │\n│  · get_pasal        │                     │  · /jelajahi          │\n│  · get_law_status   │                     │  · /peraturan/[type]  │\n│  · list_laws        │                     │  · /connect · /api    │\n└─────────┬───────────┘                     └───────────────────────┘\n          │\n          ▼                                 ┌───────────────────────┐\n┌─────────────────────┐                     │  Opus 4.6 Correction  │\n│   Claude / AI       │                     │  Agent · Railway      │\n│   Grounded answers  │                     │                       │\n│   with citations    │                     │  Verify · Auto-apply  │\n└─────────────────────┘                     │  Parser improvement   │\n                                            └───────────────────────┘\n```\n\n## Built to Last: Technical Depth\n\nThis isn't a weekend hack. Key engineering decisions:\n\n- **49 SQL migrations** with iterative schema evolution, not a single dump\n- **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\n- **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)\n- **Transaction-safe content mutations**: if any step fails, everything rolls back\n- **Row-Level Security** on all tables with public read policies for legal data\n- **Input sanitization**: `[^a-zA-Z0-9 ]` stripped before tsquery to prevent injection\n- **ISR with on-demand revalidation** for static generation + instant updates when content changes\n- **Atomic job claiming**: `FOR UPDATE SKIP LOCKED` prevents duplicate processing in the scraper pipeline\n- **11 regulation types** covering laws from 1945 to 2026, from official government sources\n\n## MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `search_laws` | Full-text keyword search across all legal provisions with Indonesian stemming |\n| `get_pasal` | Get the exact text of a specific article (Pasal) by law and number |\n| `get_law_status` | Check if a law is in force, amended, or revoked with full amendment chain |\n| `list_laws` | Browse available regulations with type, year, and status filters |\n\n## Tech Stack\n\n| Layer | Technology |\n|-------|-----------|\n| Frontend | Next.js 16 (App Router), React 19, TypeScript, Tailwind v4, shadcn/ui |\n| Database | Supabase (PostgreSQL FTS with `indonesian` stemmer + pg_trgm) |\n| MCP Server | Python + FastMCP, deployed on Railway |\n| Correction Agent | Claude Opus 4.6 (vision + code analysis), deployed on Railway |\n| Data Pipeline | Python, httpx, PyMuPDF, BeautifulSoup |\n| Search | 3-layer: identity fast-path → works FTS → content FTS with ILIKE fallback |\n| i18n | next-intl with Indonesian (default) + English |\n\n## Legal Coverage\n\nCurrently covers **40,143 regulations** across 11 types including:\n\n- **UU** (Undang-Undang) · Primary laws from parliament\n- **PP** (Peraturan Pemerintah) · Government regulations\n- **Perpres** (Peraturan Presiden) · Presidential regulations\n- **UUD** · The 1945 Constitution\n- **Permen**, **Perda**, and more from official government sources\n\n## Development\n\n```bash\n# Frontend\ncd apps/web \u0026\u0026 npm install \u0026\u0026 npm run dev\n\n# MCP Server\ncd apps/mcp-server \u0026\u0026 pip install -r requirements.txt \u0026\u0026 python server.py\n\n# Correction Agent\ncd scripts \u0026\u0026 pip install -r requirements.txt\npython -m scripts.agent.run_correction_agent\n```\n\n---\n\n\u003cp align=\"center\"\u003e\n  Built with \u003ca href=\"https://anthropic.com\"\u003eClaude Opus 4.6\u003c/a\u003e for the \u003ca href=\"https://cerebralvalley.ai/e/claude-code-hackathon\"\u003eClaude Code Hackathon\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"LICENSE\"\u003eAGPL-3.0\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filhamfp%2Fpasal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filhamfp%2Fpasal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filhamfp%2Fpasal/lists"}