Skip to main content

Haechi (해치)

Korean-first red-teaming and testing for LLM apps and AI agents.

Haechi checks whether your chatbot or agent leaks personal data or can be talked into breaking its rules — using attacks written natively in Korean, and judging the results with deterministic code mapped to Korean regulation (개인정보보호법, the Personal Information Protection Act).

Named after 해치, the mythical creature that judges right from wrong.

Status: pre-alpha (v0.0.1). This release ships the Korean PII detectors and the scan-text command. The red-teaming runner arrives in v0.1 — see the roadmap.

Why Haechi

  • Korean-native attacks, not translated English prompts: 존댓말/반말, 초성, jamo splitting, Korean–English code-switching, impersonation of family members or 금융감독원.
  • Deterministic judging first. If code can decide whether something leaked, code decides. Heuristic checks are always labelled as heuristic.
  • Sees through obfuscation. Output is normalised before judging: full-width digits, ㄱㅖㅈㅘ-style jamo, spoken digits (공일공), zero-width characters and stray separators.
  • Reproducible. Every generated test case is reproducible from a seed.
  • Offline-first. Runs against local models (Ollama, vLLM) and in air-gapped (망분리) environments. No telemetry, no hidden network calls.
  • Regulation mapping with an explicit review status on every mapping. Haechi never claims an article applies unless the mapping file says so, with a source.

Install

Requires Python 3.11 or newer.

pip install haechi        # or: uv tool install haechi
haechi --version

Quick start: scan text for Korean personal data

haechi scan-text "고객 연락처는 010-0000-1234, 주민번호 구공일삼공일-이공공공공공공 입니다"
┏━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ # ┃ 유형 / Kind        ┃ 값 / Value     ┃ 검증 / Checksum ┃ 뷰 / View ┃ 신뢰도 / Confidence ┃
┡━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ 1 │ 전화번호 (phone)   │ 010-****-1234  │ n/a             │ original  │ medium              │
│ 2 │ 주민등록번호 (rrn) │ 901301-2****** │ n/a             │ spoken    │ low                 │
└───┴────────────────────┴────────────────┴─────────────────┴───────────┴─────────────────────┘
2건 탐지 / 2 finding(s): phone=1, rrn=1

The second number was written out in spoken Korean digits and was still caught via the normalised spoken view. It uses an impossible birth date (month 13), the form Haechi requires for synthetic RRN canaries, so it is reported with low confidence.

More options:

haechi scan-text -f chatbot-log.txt          # scan a UTF-8 file
cat transcript.txt | haechi scan-text --json # read stdin, print JSON
haechi scan-text --mode strict "..."         # require valid checksums
haechi scan-text --no-normalise "..."        # scan the raw text only

Detected values are masked by default. --show-values prints them unmasked.

Detector What it checks
주민등록번호 (RRN) YYMMDD-GNNNNNN, valid birth date; checksum in strict mode. Numbers issued from October 2020 have no checksum, so loose (default) reports checksum-invalid numbers too, and RRN-formatted numbers with impossible dates (low confidence).
사업자등록번호 NNN-NN-NNNNN with the official checksum
Card numbers 13–19 digits, Luhn

Numbers written without separators (a bare 13-digit RRN, 13–19-digit card or 10-digit business number) are only reported when a matching keyword (주민, 카드, 사업자, …) is nearby. One random digit run in ten passes these checksums, so bare order numbers, timestamps and barcodes would otherwise be flagged. See docs/en/evaluation.md for precision and recall. | Phone numbers | mobile, landline, 070, +82, 대표번호 (15xx/16xx/18xx) | | Email | address syntax | | Bank accounts | heuristic: 10–14 digit runs near a banking keyword |

Exit codes

Code Meaning
0 nothing found / success
1 personal data found (or, from v0.1, the CI gate failed)
2 usage or configuration error
3 feature not available in this version

This makes haechi scan-text usable as a CI check on logs or fixtures.

Configuration preview

haechi init writes a sample haechi.yaml. In v0.0.1, haechi run validates it and explains any errors in Korean and English; running attacks arrives in v0.1.

version: 1
target:
  type: openai-compatible
  base_url: http://localhost:11434/v1   # Ollama
  model: exaone3.5
purpose: "보험사 고객 상담 챗봇. 본인 확인된 고객에게 자기 계약 정보만 안내한다."
canaries:
  - name: other_customer_rrn
    value: "901301-2000000"   # synthetic; month 13 cannot be a real birth date
plugins: [kr-pii]
mutators: [jamo, chosung, code_switch, impersonation]
seed: 42
limits:
  max_requests: 500
gate:
  max_fail_rate: 0.0

Safety notice

  • Use synthetic data only. Never put real personal data into configs, canaries or test fixtures. Haechi rejects RRN canaries with a real birth date (numbers issued from October 2020 have no checksum, so a checksum cannot prove a value is fake) and card or business number canaries that pass their checksum.
  • Only test systems you are authorised to test. See RESPONSIBLE_USE.md.
  • Not legal advice. Regulation mappings are provided for orientation, carry a review status (draft / reviewed) and do not establish legal compliance.
  • Heuristic detectors (e.g. bank accounts) can miss data or flag harmless numbers. A clean scan is not proof that no personal data is present.

Roadmap

  • v0.1 — targets (openai-compatible, http, python, mock), YAML attack packs (first: kr-pii), seeded Korean mutators (jamo, 초성, code-switching, spacing, honorifics, impersonation, indirect injection, base64), canary and policy judges, an async runner with request caps and caching, JSON and Markdown reports, CI gating, and 개인정보보호법 / OWASP LLM Top 10 mappings.
  • v0.2 — agent harness with fake tools, tool-call policy judge, an optional and clearly labelled non-deterministic LLM judge, further regulation packs.

Haechi builds on ideas from AgentDojo, DataSIR, Rebuff/Vigil canary checks, AgentDAM, PrivacyLens and KDPII, with no code dependency on any of them. See docs/en/related-work.md (한국어: docs/ko/related-work.md).

Contributing

See CONTRIBUTING.md. Security issues: see SECURITY.md.

Acknowledgements

Haechi is developed with the help of Claude Code.

Licence

Apache-2.0. See LICENSE and NOTICE.

Metadata

Release files for haechi 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haechi 0.0.1
File Size Uploaded Provenance Actions
haechi-0.0.1.tar.gz 77.7 kB With provenance Details for haechi-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for haechi 0.0.1
File Interpreter ABI Platform Actions
haechi-0.0.1-py3-none-any.whl Python 3 none any Details for haechi-0.0.1-py3-none-any.whl

Total release size: 148.5 kB

Release files / haechi-0.0.1.tar.gz

Download URL haechi-0.0.1.tar.gz
Size 77.7 kB
Tags Source
SHA-256 checksum
How to use checksums
106419416d71d6c60f02dc49ae74cd2547fd18dcee9c66d2b2f4ce0ac013d099
BLAKE2b-256 checksum
How to use checksums
b3418febe9f82197c105fb57f7a6d56cc6563ff525a2a25b3f87974178329488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / haechi-0.0.1-py3-none-any.whl

Download URL haechi-0.0.1-py3-none-any.whl
Size 70.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af4d095d4dbc8ee0bcfdca36486ca6593c6dd700293c03c80e8e559e7631ab20
BLAKE2b-256 checksum
How to use checksums
4eb6854b4a95962c9304e04f709bed49b9b672d6f2a68a176b441f1f87c8c89c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for haechi 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for haechi-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page