# Repository Briefing: chrisryugj/kordoc
> Source: https://repoforai.com/repo/chrisryugj/kordoc (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/chrisryugj/kordoc
- **Official Docs / Website**: https://pubax.org/kordoc/
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: A+ (96/100 · Maintenance 35/35 · Adoption 21/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v4.25.41 (2026-12-03) — https://github.com/chrisryugj/kordoc/releases
- **Review Snapshot**: 2026-12-01 (Note: v4.25.41 on 2026-12-03 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: MCP, CLI, Self-Hosted
- **Momentum**: 3,222 ★ total (+0 24h / +64 7d) · 561 forks
- **Topics**: `cli`, `document-conversion`, `document-parser`, `docx`, `hancom`, `hwp`, `hwp-parser`, `hwpx`, `korean`, `llm`, `markdown`, `mcp`
- **When to Use**: Best for: Public-sector and enterprise teams that need to ingest HWP/HWPX, PDF, and scans into an existing RAG stack while retaining table structure and supporting Korean form workflows. Skip if: You need a complete retrieval database, exact table reconstruction from every scan, or unattended document editing with a guarantee that every change preserves layout.

## Overview
```text
### Architecture & Core Mechanics
kordoc is a TypeScript document-processing engine that sits upstream of the RAG database: it parses and structures files but does not store, index, or retrieve them. Its Node library, `kordoc` CLI, and `kordoc-mcp` server expose the processing engine to applications, batch jobs, and agents. The `parse()` API returns Markdown, structured blocks, and metadata; `markdownToHwpx()` generates HWPX from Markdown.

The dependency stack includes `cfb` for compound files, `jszip` for ZIP packages, `@rhwp/core` for Hancom-format processing, `@hyzyla/pdfium` for WASM-based PDF processing, and `onnxruntime-node` for local model inference. The MCP entrypoint uses `@modelcontextprotocol/sdk`. Python and Java integrations call a persistent engine worker through the parse-worker protocol rather than requiring separate implementations of the parsers. `kordoc serve` provides an HTTP interface for individual parse requests and asynchronous jobs.

### Key Capabilities & Differentiators
kordoc reads HWP 3–5, HWPX, HWPML, PDF, DOCX, Excel, and scanned inputs. It can emit heading-aware chunks and standalone table chunks instead of a flat text stream, which helps downstream indexing preserve the context around a table. The write path covers Markdown-to-HWPX generation, form filling, institutional style packs, document comparison, and layout-preserving patches. It also includes official-document linting and redaction.

On the native HWPX corpus, the extracted structure matched all 10,344 visible tables across 2,424 files. The 200-document opendataloader-bench result was 0.965 with default settings on v4.24.50. These are distinct measurements: native table structure, aggregate PDF parsing, and scanned-table reconstruction should not be treated as interchangeable. In the 53-document OCR evaluation, the character error rate was 0.0237, but only 33 of 65 table structures matched exactly.

### Trade-offs & Limitations
Against a dedicated PDF parser or OCR pipeline, kordoc is most compelling when a single workflow must ingest legacy HWP, preserve HWPX table structure, and produce or edit Korean official documents. For PDF-only ingestion, the extra format coverage is less valuable; compare reading order and table fidelity on your own corpus. For final-form authoring, native editors remain the right verification tool when pixel-level layout or support for every edit is required. Layout-preserving patching is not an unconditional round trip: unsupported edits are skipped with reasons.

Local execution avoids a hosted OCR dependency but leaves installation, worker sizing, and isolation to the operator. `--jobs` parallelizes by file and increases memory demand; scanned PDFs and model-backed stages should be load-tested separately from text-layer documents. Redaction is useful in the ingestion path, but verify that sensitive content is gone from the actual deliverable, not just from extracted Markdown. The core is MIT-licensed; review third-party notices before bundling dependencies in a commercial distribution.

### Hardware & Deployment Guide
The library and CLI require Node.js 20+ on macOS, Linux, or Windows; the HTTP server requires Node.js 24.15+. Install with `npm install kordoc`, run the CLI with `npx kordoc`, or register supported MCP clients with `npx -y kordoc setup`. The packaged WASM PDF engine handles PDF text extraction. OCR, image conversion, and QR functionality are limited if optional dependencies are omitted, so validate the exact installation profile you plan to ship.

For offline operation, set `KORDOC_OFFLINE=1` and validate OCR assets and dependencies before disconnecting. Use `KORDOC_ROOT` to scope MCP file access, and consider the Linux gVisor path (`KORDOC_SANDBOX=gvisor`, `docker --runtime=runsc`) for untrusted documents. Pin the deployed version and test writes against representative fixtures: v4.25.35 fixed HWP 5.x patch cases that had produced damaged files, v4.25.36 extended redaction across table-cell boundaries, and v4.25.37 corrected exact-name form-field matching.
```

## Key Capabilities
```text
- Runtime: One TypeScript package exposes a Node library, `kordoc` CLI, and `kordoc-mcp` entrypoint.
- RAG ingestion: `--format chunks` preserves heading paths and emits standalone table chunks; `--table-format gfm` avoids HTML tables when needed.
- Native table extraction: Structural matches on all 10,344 visible tables in the 2,424-document HWPX corpus.
- Document authoring: Generate HWPX from Markdown, reuse institutional styles through `.kpack` bundles, and fill template fields.
- Patch semantics: Extract with `--keep-layout-tables` for layout-preserving edits and inspect the reasons for skipped changes.
- Self-hosting: Local CPU OCR, `KORDOC_OFFLINE=1`, MCP path scoping through `KORDOC_ROOT`, and an optional Linux gVisor deployment.
```

## Quick Start / Clone
```bash
npm install kordoc
```
