Knowledge domains in Indonesia carry characteristics that frequently make off-the-shelf retrieval-augmented generation inadequate. Document corpora are often large, heterogeneous, OCR-extracted with noise, written in domain-specific Bahasa Indonesia terminology, and require citation traceability if outputs are to be usable by professionals who are accountable for their work.
Pengacara-ku is an AI Legal Research Engine built by PT Widigital Tri Buana for precisely this context. The corpus currently comprises 18,000+ Indonesian court decisions — from religious and district courts up to the Supreme Court — totaling hundreds of thousands of chunks indexed in parallel on Vectorize at 768 dimensions and SQLite FTS5. System outputs include explicit citation of decision numbers that users can independently verify.
This piece discusses Pengacara-ku's architecture at the pattern level — not as an implementation tutorial. The goal is to surface lessons that can be adapted to other domains sharing similar characteristics: corporate contracts, internal regulations, claims documents, and institutional knowledge bases.
The Domain Problem Being Addressed
Pengacara-ku's target users are lawyers, paralegals, and in-house counsel conducting legal research to prepare cases or draft opinions. Their core need is not a fluent narrative answer from a generative model. Their core need is:
First, rapid access to relevant decisions with accurate citations. A lawyer cannot bring AI output into court without valid and verifiable decision numbers. Hallucinated citations represent an intolerable failure mode.
Second, an understanding of the judicial reasoning in relevant decisions — not merely the operative holding, but the reasoning that leads to it. This demands chunks large enough to carry the reasoning context, yet not so large that retrieval loses precision.
Third, the ability to clearly return "not found." Many specific legal questions do not have an exact matching decision. The system must decline gracefully when there is no sufficiently confident match, rather than forcing an answer on the back of marginal retrieval.
The user profile and these requirements determine every architecture decision discussed below.

Ingestion Pipeline: From Heterogeneous PDFs to Consistent Chunks
Indonesian court decisions are available as PDFs with significant variation. Some are scanned from hard copies with varying OCR quality. Some were generated from word processors with inconsistent formatting across courts. Several contain watermarks, headers and footers, and wet-ink signatures that contaminate text extraction.
Pengacara-ku's ingestion pipeline consists of four main stages.
Stage one: text extraction with fallback. PDFs are extracted using a standard extraction library. For documents with empty or corrupted text layers, the pipeline falls back to an OCR engine adjusted for Indonesian document characteristics — punctuation, diacritics, Indonesian date formatting.
Stage two: heuristic cleanup. Extraction output is cleaned of consistently recurring noise: repeated court headers, page numbers, "ASLI" or "SALINAN" watermarks, separator lines, and common OCR artifacts such as Latin characters mis-recognized as unusual glyphs. Cleanup uses a rule-based approach that can be audited — not LLM-based cleanup, which risks altering the substance of the document.
Stage three: structural parsing. Indonesian court decisions follow a relatively consistent formal structure: identification of parties, case facts, legal considerations, and the operative holding. The parser identifies these section boundaries and surfaces them as metadata accompanying chunks.
Stage four: section-aware chunking. Chunking does not use a fixed-size window. Chunks follow section boundaries with contextual overlap to preserve continuous reasoning threads. Each chunk carries metadata: decision number, chamber type (criminal/civil/religious/military), year, section type, and position within the document.
Generalizable lesson: LLM-based cleanup of authoritative documents risks altering substance. In regulated domains, cleanup must be rule-based and auditable. Section-aware chunking outperforms fixed-size chunking on formally structured documents.
Dual Embedding and Indexing Strategy
Each chunk is embedded with a 768-dimension embedding model and stored in Vectorize. In parallel, the same chunks are indexed in SQLite FTS5 for lexical retrieval.
The decision to use dual indexing was driven by observation of how lawyers query. The majority of queries combine abstract concepts — "judicial reasoning for breach of contract" — with concrete tokens: "Article 1320 of the Civil Code," specific article numbers, statute names, or reference decision numbers. Semantic retrieval outperforms for abstract concepts. Lexical retrieval outperforms for concrete tokens that must match precisely.
Hybrid retrieval combines both signals. The implementation is straightforward yet effective: run both retrieval paths in parallel, take the top-K from each, and rerank using a normalized score combination.
Generalizable lesson: for domains with specific terminology that must match precisely — legal, regulatory, medical, technical specifications — semantic-only retrieval underperforms. Hybrid retrieval delivers material accuracy gains at manageable additional complexity.
Citation Traceability as a First-Class Requirement
Every chunk that enters the retrieval pipeline carries the decision number as a first-class identifier. When chunks are passed to the LLM as context, this identifier is included explicitly in the prompt structure.
Pengacara-ku's prompt construction instructs the LLM to include the decision number in every reference it makes within the output. Post-generation validation verifies that every decision number appearing in the output is actually present in the retrieved chunks — not a model hallucination.
Output presented to users includes a "source references" section displaying decision numbers, links to the original PDF in R2, and relevant snippets from the chunks. Users can verify every claim directly against the authoritative source.
Generalizable lesson: citation traceability is not post-processing. Citation must be a first-class requirement considered from the data modeling, ingestion, prompt construction, and output validation phases. Regulated domain deployments without citation traceability fail to meet the professional standards of their users.
Indonesian knowledge domains demand retrieval that understands context — not merely keyword matching.
Confidence Threshold and the "Not Found" Fallback
Not every query has an answer in the corpus. Users frequently ask about decisions that do not exist, or use terminology that does not align with what is in the corpus. A system that forces an answer in these scenarios risks presenting inaccurate information.
Pengacara-ku applies a dual confidence threshold. First, a threshold at the retrieval level — if the top-K retrieval results fall below the threshold, the system signals low confidence early. Second, a threshold at the LLM output level — the model is prompted to refuse explicitly when the provided context is insufficient to support an answer.
The fallback message for "not found" scenarios is designed with a professional tone and constructive guidance: query reformulation suggestions, an indication of relevant areas within the corpus, or a recommendation to consult primary sources outside Pengacara-ku. This fallback is the mechanism that preserves trust with professional users of the system.
Generalizable lesson: in authoritative knowledge domains, the "not found" fallback is a feature, not a bug. Professional users value a system that is honest about the limits of its knowledge over one that always answers with inaccurately calibrated confidence.
Performance Characteristics
In the production configuration at publication time, several performance characteristics are monitored routinely.
End-to-end latency for a typical query sits in the low hundreds of milliseconds for retrieval and a few seconds for LLM output. Latency distribution is monitored at P50, P95, and P99 to detect regression.
Citation accuracy — the proportion of citations in output that are valid (decision number present in the corpus, and the chunk genuinely relevant to the claim made) — is maintained above a threshold redesigned quarterly with manual sample audits.
Cost per query is monitored with a breakdown across retrieval, embedding, LLM inference, and storage. Cost governance ensures cost per query remains stable against variation in query length.
Fallback rate — the proportion of queries answered with "not found" — is monitored as an indicator of corpus coverage quality. A spike in the fallback rate signals a need for corpus expansion or retrieval threshold adjustment.
Actual metrics are not published as specific figures here because production characteristics evolve with scaling and optimization. What is relevant for the reader is the dimensions being monitored and the monitoring structure.
Adaptation to Other Sectors
Pengacara-ku's architecture patterns can be adapted to several domains sharing similar characteristics.
Corporate contracts. Large corporates maintain heterogeneous contract repositories — vendor agreements, employment agreements, NDAs, partnership agreements. Adapting Pengacara-ku's patterns to this domain: structural parsing aware of clause types (definitions, obligations, term, termination, dispute resolution), citation at the clause-ID level, and hybrid retrieval accommodating both conceptual queries (obligations of party one under scenario X) and precise lookups (clause 8.3 of contract Y).
Internal regulations. Banks, insurance companies, and state-owned enterprises hold large volumes of internal policies that operational staff must frequently reference. Adaptation pattern: section-aware ingestion for policy structure, embedding fine-tuned for internal terminology, and citation at the policy-section level for auditability.
Claims documents. The insurance sector processes claims documents with structure and heterogeneity similar to court decisions. Adaptation pattern: multi-format ingestion (PDF, scan, photograph), structural parsing for policy identifiers, and retrieval accommodating both analytical queries (claim patterns, fraud indicators) and lookup queries (status of claim for policy X).
Institutional knowledge bases. Research institutions, universities, and think tanks accumulate reports, working papers, and internal publications. Adaptation pattern: structural parsing for academic formats (abstract, methodology, findings, references), citation that preserves citation chains from paper to paper, and retrieval accommodating cross-reference queries.
Each adaptation carries domain-specific characteristics that must be tailored: terminology, document structure, citation requirements, and user profile. Pengacara-ku's architecture patterns provide a framework, not a template.

Closing
Regulated knowledge domains in Indonesia have specific requirements: citation traceability, honest fallback, hybrid retrieval for domain terminology, and auditable ingestion. Off-the-shelf RAG built for general-purpose use is frequently inadequate for the professional user profile accountable for the outputs they rely on.
Pengacara-ku is one reference implementation of this pattern in the Indonesian legal sector. The lessons derived can be adapted to other domains with similar characteristics. For decision-makers evaluating knowledge AI initiatives in regulated sectors, the discussion framework above can serve as a structure for requirements gathering and vendor evaluation.
The engineering and solution architecture team at PT Widigital Tri Buana implements production hybrid RAG architectures for Indonesian knowledge domains. To discuss adapting this pattern to your specific domain, contact our team at widigitaltribuana.com.
References
- Lewis, P. et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Advances in Neural Information Processing Systems, 2020.
- Anthropic. Contextual Retrieval. Anthropic Engineering, 2024.
- Pinecone. Hybrid Search: Combining Dense and Sparse Retrieval. Pinecone Technical Blog, 2024.
- Stanford HAI. Hallucinating Law: Legal Mistakes with Large Language Models are Pervasive. Stanford Institute for Human-Centered AI, 2024.
- Mahkamah Agung Republik Indonesia. Direktori Putusan. https://putusan3.mahkamahagung.go.id.
Topics