legalize-kr · git:20261005.29a560b · 2026-10-05 · sha256 712077c8bb5d4fae

legalize-kr git:20261005.29a560bA

Immutable. This exact content never changes and is served at /api/v1/blob/712077c8bb5d4fae.

---
name: legalize-kr
description: Retrieve Korean laws, court precedents, administrative rules, and local ordinances through connected Legalize-KR MCP tools. Use it for document search, full text, article lookup, and revision comparison. It also guides CLI, local MCP, Git, and direct GitHub access when connected tools are unavailable.
---

# Legalize-KR Data

Use Legalize-KR as a public Markdown/Git mirror of Korean legal data. The core datasets are:

- Laws: `legalize-kr/legalize-kr`
- Court precedents: `legalize-kr/precedent-kr`
- Administrative rules: `legalize-kr/admrule-kr`
- Local ordinances: `legalize-kr/ordinance-kr`

Treat the data as legal source material, not legal advice. When answering a user, state the dataset, date basis, and access method used whenever those affect correctness.

## Workflow

1. Classify the request:
   - Dataset: laws, precedents, administrative rules, ordinances, or all.
   - Operation: list, search, fetch full text, fetch one law article, compare revisions, inspect history, bulk analyze, or configure agent access.
   - Freshness: current remote data, a specific date, a local clone, or cached/offline data.

2. Choose the access method:
   - Use Legalize-KR MCP tools already available in this conversation first. Read their input schemas. No local installation is necessary.
   - An installed plugin is not proof that its tools are available in this conversation. Do not describe missing tools as failed installation.
   - Prefer `legalize-cli` for shell-based one-off lookup, JSON output, and no-clone workflows.
   - Prefer local stdio MCP tools when the user is configuring or using an MCP-capable agent that can run local commands.
   - Prefer `git clone` for large grep/search, history/diff work, reproducible offline analysis, or direct Markdown inspection.
   - Use direct GitHub/raw URLs only when the target path is already known and installing tools or cloning would be excessive.

   If the best path is unclear, run:

   ```bash
   python3 skills/legalize-kr/scripts/select_access_mode.py --task search --scope all
   ```

3. Use the selected method with a narrow query first, then broaden only if needed. Avoid dumping whole repositories into context.

4. If docs conflict, prefer the current target repository README or current tree over compact summaries. `https://legalize.kr/llms.txt` is useful LLM context, but it may be a summary and may lag detailed repo docs or newer CLI/MCP support.

## Connected MCP workflow

Use the connected tools before offering shell commands or setup instructions.
Read `references/mcp-workflows.md` for tool arguments and search-to-document examples.
If you use the access helper, pass `--mcp-connected` only when the host exposes the tools in this conversation.

| User request | First tool | Next step |
|---|---|---|
| Known statute | `laws_get` | Read the returned body and source |
| Known law article | `laws_article` | Keep `law_name`, `article_no`, and `category` separate |
| Topic or uncertain document name | `search` | Retrieve the selected candidate before summarizing its content |
| Known case number | `precedents_get` | Use the case number or a returned repository path |
| Administrative rules from an agency | `admrules_list` | Filter by `agency` and `type_`, then use `admrules_get` |
| Local ordinances from a region | `ordinances_list` | Filter by `jurisdiction`, `subdivision`, and `type_`, then use `ordinances_get` |
| Same law on two dates | `laws_diff` | Report the date basis and comparison limits |

Use `semantic="시행일자"` when the user asks for current law or law in force on a date.
Use `semantic="공포일자"` when the user asks about promulgation.
Omitted dates use today in Korea. Report the returned date basis and file-level limits.

Search and list entries are candidates. Fetch the selected document before quoting or summarizing its contents.
Pass each returned `path` as `identifier` to `precedents_get`, `admrules_get`, or `ordinances_get`.
For law paths, use the statute name and category with `laws_get` or `laws_article`.
Do not pass a repository path as `law_name`.
Use the user's stated agency, region, or court to resolve candidates.
Ask for a choice only when the intended document remains unclear.

Start topic searches with a short keyword, one relevant `scope`, `strategy="auto"`, and a small `limit`.
Use `scope="all"` for requests across datasets. Follow `next_page` only when more list candidates are necessary.
Explain `PATH_SEARCH_ONLY`, `PARTIAL_SEARCH`, or truncation before drawing a negative conclusion.
Never describe a title match as verified body content.

Answer in the user's language. Give the requested text or summary first.
Cite `source.original_url` when available and `source.github_url` from the retrieved document.
Separate source text from interpretation. Include relevant date and search limits.
If a tool fails, state the failure. Do not invent a document or describe the error as an empty result.
For `RESPONSE_TOO_LARGE`, retrieve the requested law article or provide document links from `error.source`.
Ask which article is needed if the request does not identify one. Do not claim full retrieval or repeat the same oversized request.

## CLI Quick Reference

Install:

```bash
pipx install legalize-cli
pipx install 'legalize-cli[mcp]'
uvx legalize-cli laws list --json
uvx --from legalize-cli[mcp] legalize-mcp
```

Set a token for GitHub API rate limits when doing repeated or code-search work:

```bash
export GITHUB_TOKEN=$(gh auth token)
legalize auth status --json
```

Common commands:

```bash
legalize laws list --category 법률 --json
legalize laws get 민법 --date 2015-06-01 --json
legalize laws article 민법 제839조의2 --date 2015-06-01 --json
legalize laws diff 민법 민법 --date-a 2015-01-01 --date-b 2024-01-01 --mode article --json

legalize precedents list --court 대법원 --type 민사 --json
legalize precedents get "2022다12345" --json

legalize admrules list --agency 행정안전부 --type 고시 --json
legalize admrules get "공공데이터 관리지침" --agency 행정안전부 --type 고시 --json

legalize ordinances list --jurisdiction 서울특별시 --type 조례 --json
legalize ordinances get "서울특별시 테스트 조례" --jurisdiction 서울특별시 --type 조례 --json

legalize search "부동산 점유취득시효" --in all --json
```

Use `--json` for agent-readable output. Use `--offline` only when the needed data is already cached.

### Law date semantics

For a dated law request, ask whether the user means the promulgated version or
the file version in force on that date. Always pass the intended semantic
explicitly:

```bash
# Version promulgated by 2024-10-01. This is the compatibility default.
legalize laws get 민법 --date 2024-10-01 --semantic 공포일자 --json

# File version whose frontmatter enforcement date is on or before 2024-10-01.
legalize laws article 민법 제1조 --date 2024-10-01 --semantic 시행일자 --json
```

- `공포일자` is the default for CLI and MCP compatibility. A response can have
  a later enforcement date; inspect `warning` before describing it as in force.
- `시행일자` selects from each revision file's frontmatter. It is the appropriate
  choice for a request such as "what was in force on this date?"
- This is a file-level selection. `file_effective_date_only: true` means the
  tool does not decide article-specific commencement dates, supplementary-rule
  application cases, or transitional measures. An article's `status` is not an
  effective-date determination.
- For dates before 1970, the tool uses the actual frontmatter date because Git
  author dates for those historical revisions are epoch-clamped.
- For either semantic, use `semantic`, `requested_date`, and
  `resolved_version_date` in JSON output when reporting the basis used.

## MCP Quick Reference

If Legalize-KR tools are connected, use them directly. The setup below is a fallback for local MCP clients.
The Sites-hosted plugin uses OAuth and Sites access controls. It does not require `uvx`, Python, or a personal GitHub token.
Use the host's plugin connection UI. Do not request credentials in conversation.
See `references/access-options.md` for the separate Sites and Bearer connection methods.

Install MCP support:

```bash
pipx install 'legalize-cli[mcp]'
legalize-mcp
```

Register a local stdio server in MCP clients. Use `uvx` when the package should run without a permanent install:

```json
{
  "mcpServers": {
    "legalize-kr": {
      "command": "uvx",
      "args": ["--from", "legalize-cli[mcp]", "legalize-mcp"]
    }
  }
}
```

Use an already installed `legalize-mcp` command when `legalize-cli[mcp]` was installed with `pipx` or `pip`:

```json
{
  "mcpServers": {
    "legalize-kr": {
      "command": "legalize-mcp",
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

Current tool surface in `legalize-cli` includes:

- `laws_list`, `laws_get`, `laws_article`
- `precedents_list`, `precedents_get`
- `admrules_list`, `admrules_get`
- `ordinances_list`, `ordinances_get`
- `search`

`laws_get` and `laws_article` accept `semantic: "공포일자" | "시행일자"` with
`공포일자` as the default. Their responses identify the selected semantic and
date; `laws_article` also returns the file's promulgation date, enforcement
date, source, law ID, law MST, and `file_effective_date_only`.

Prefer MCP when a user asks an agent to answer legal-data questions conversationally and the host can run local stdio MCP servers. If the host cannot run tools, use the skill as guidance and cite the GitHub dataset paths or direct URLs used.

## Git Clone Quick Reference

Clone only the dataset needed:

```bash
git clone https://github.com/legalize-kr/legalize-kr.git
git clone https://github.com/legalize-kr/precedent-kr.git
git clone https://github.com/legalize-kr/admrule-kr.git
git clone https://github.com/legalize-kr/ordinance-kr.git
```

Examples:

```bash
cat legalize-kr/kr/민법/법률.md
git -C legalize-kr log -- kr/민법/
rg "개인정보" legalize-kr/kr

rg "사실혼" precedent-kr/가사
rg "공공데이터" admrule-kr/행정안전부
rg "공공시설" ordinance-kr/서울특별시
```

The data repositories may be force-pushed after pipeline improvements. Do not rely on commit SHA stability for durable citations; cite repository path plus frontmatter dates or domain identifiers where possible.

## References

- Read `references/mcp-workflows.md` for conversational retrieval with connected tools.
- Read `references/access-options.md` when choosing between CLI, MCP, git clone, and direct GitHub access.
- Read `references/data-layout.md` when constructing repository paths, interpreting frontmatter, or explaining data model details.