headcleaner
headcleaner
폴더를 탐색하여 모든 문서를 Markdown(프론트매터 포함), OKF v0.2(프론트매터 포함) 또는 둘 다로 변환합니다 — omp 스타일 애니메이션 TUI와 함께.
headcleaner convert ~/Documents/inbox --format both --output ~/Documents/inbox.cleanheadcleaner는 사용자가 지정한 디렉터리를 스캔하고, 확장자로 각 문서를 식별한 다음, 적절한 추출 엔진(Office 형식은 OfficeCLI, PDF는 pdfplumber, HTML은 BeautifulSoup 등)을 실행하여 깔끔하게 정규화된 출력을 생성합니다 — Markdown과 OKF를 나란히 생성하거나, 둘 중 하나만 생성합니다.
출력 형식:
--format md(Markdown),--format okf(OKF v0.2 번들),--format both(기본값)엔진 지원 범위: 기본 제공 7가지 형식(XLSX, DOCX, PPTX, PDF, HTML, HTM, TXT) — 16가지 형식의 v1.0 로드맵은 docs/FORMAT_MATRIX.md 참조
TUI: omp에서 영감을 받은 애니메이션 터미널(박스 드로잉 패널, 네온 팔레트, 파워라인 구분 기호)
린터:
headcleaner lint가 변환된 Markdown/OKF의 형식 문제를 검토합니다메시지별 PST: 이메일당 OKF 개념 하나(readpst 사용)로 파일 단위 검토/승인 가능
office_oxide 백엔드: Office 형식을 위한 순수 Rust Python 바인딩(OfficeCLI보다 약 100배 빠름)
휴리스틱 정리:
headcleaner convert --clean이 any2md에서 영감을 받은 12단계 정리 파이프라인을 실행합니다all2md 폴백: all2md가 설치된 경우 Jupyter, LaTeX, reST, 소스코드 등 38가지 추가 형식을 자동 처리합니다
headcleaner mcp: headcleaner를 MCP 서버로 실행하여 14개의okf_*도구를 모든 MCP 에이전트 호스트(Claude Code, Cursor 등)에 노출합니다 —uv pip install "headcleaner[mcp]"로 설치진단:
headcleaner doctor가 Python, PATH, OfficeCLI, 출력 권한,@slug레지스트리를 확인한 후 GO/NO-GO 판정을 출력합니다어댑터 플러그인: 타사 패키지가
headcleaner_plugin엔트리 포인트 그룹을 통해 형식을 등록합니다zsv CSV: PATH에
zsv가 있을 때 세계에서 가장 빠른 SIMD CSV 파서(표준 라이브러리보다 약 10-100배)신뢰 증명:
headcleaner attest가 Merkle 루트 + ed25519 서명을 생성하고,verify가 이를 확인합니다로컬 브라우징:
headcleaner serve <bundle>이 브라우징 + 검색을 위한 FastAPI UI를 노출합니다정직한 기본값: OKF 신뢰 필드는
unverified/human:pending으로 채워지며, 절대 임의로 생성되지 않습니다
설치
# 1. The Office engine — single binary, no Office install needed
npm install -g @officecli/officecli
# 2. The CLI itself (Python ≥3.12, uv-managed)
uv tool install headcleaner
# Or for development:
git clone <this repo>
cd headcleaner-cli
uv sync
uv run headcleaner --help다른 설치 방법(curl | bash, pip, brew, Windows PowerShell)은 docs/INSTALL.md를 참조하세요.
Related MCP server: okf-tools
빠른 시작
headcleaner ~/Documents/inbox --format both --output ./clean이 명령은 다음을 생성합니다:
clean/
├── manifest.json # run summary: per-file status, engine, sha256
├── REPORT.md # count, average time, and error rate by engine
├── _md/ # plain Markdown (one file per source)
│ ├── notes.docx.md
│ ├── q3.pdf.md
│ └── ...
└── okf/ # OKF v0.2 bundle (one concept per source)
├── index.md # auto-generated directory index
├── notes.md # OKF concept: type=Document
├── q3.pdf.md
└── ...CLI 참조
headcleaner convert <INPUT_DIR> [OPTIONS]
Options:
-f, --format {md,okf,both} Output format(s) [default: both]
-o, --output DIR Output directory [default: ./out]
--ocr Enable Tesseract OCR for scanned PDFs
--officecli-timeout <secs> Timeout per OfficeCLI subprocess call (default: 60)
--include, -i GLOB Include glob (may be repeated)
--exclude, -e GLOB Exclude glob (may be repeated)
--jobs, -j N Parallel worker processes (default: 1 = sequential)
--no-cache Re-convert every file (skip the SHA-256 cache)
--no-continue-on-error Stop on the first failure
--obsidian-compat Add Obsidian-friendly flat fields to OKF frontmatter
--clean Run the 12-stage heuristic cleanup pipeline (any2md-inspired) on each body
--tui / --no-tui Force / disable the animated TUI (default: auto-detect TTY)
--no-okf-index Skip OKF directory index.md generation기타 명령: headcleaner doctor [--output-dir DIR] 설치 및 권한 진단 실행 headcleaner templates 지원되는 형식 목록 표시 headcleaner agents 엔진 설치 상태 표시 headcleaner watch IN [--webhook-url URL] 파일 변경 시 재변환(Ctrl+C로 중지) headcleaner lint 변환된 Markdown/OKF 형식 문제 검토 headcleaner lint --fix 안전한 문제를 .fixed/로 자동 수리 headcleaner serve OKF 번들용 로컬 HTTP 브라우저 headcleaner notion-import <EXPORT.zip> Notion 워크스페이스 내보내기 역변환 headcleaner attest Merkle 루트 + 선택적 ed25519 서명 계산 headcleaner verify 번들에 대한 증명 확인
## Why OKF?
OKF (Open Knowledge Format, v0.2) is just **markdown + YAML frontmatter in a directory hierarchy**. That means:
- Every concept is a single `.md` file you can `cat`, `grep`, edit in any text editor
- Bundles live in git — pull requests, diffs, blame all work
- Obsidian, Notion, MkDocs, Hugo, Jekyll all consume OKF natively
- Required frontmatter key is just `type` — anything beyond that is producer freedom
See [docs/OKF_NOTES.md](docs/OKF_NOTES.md) for the OKF v0.2 specifics this CLI emits.
## Trust stance (honest defaults)
We never auto-claim review. Every emitted OKF concept gets:
- `status: unverified`
- `verified: human:pending`
- `generated: human:<user>@<host>` (OKF §7 actor convention)
- `stale_after: <today + 180d>`
- `sources: [{uri: file://..., sha256: ...}]`
A human can grep `human:pending` later to find concepts needing review. See [docs/OKF_NOTES.md](docs/OKF_NOTES.md) for the full contract.
## Supported formats
See [docs/FORMAT_MATRIX.md](docs/FORMAT_MATRIX.md) for the full engine × library table. At a glance:
| Format | Engine | Library |
|---|---|---|
| `.docx`, `.xlsx`, `.pptx` | OfficeCLI binary | (native DOM) |
| `.pdf` | pdfplumber (text-layer), pytesseract if `--ocr` | pdfplumber / pytesseract |
| `.html`, `.htm` | BeautifulSoup | beautifulsoup4 |
| `.txt` | chardet + read | chardet |
| `.md`, `.markdown` | pass-through + frontmatter inject | stdlib |
| `.csv`, `.tsv` | Sniffer dialect + GFM table (zsv SIMD when installed) | stdlib `csv` (or `zsv` binary) |
| `.json` | pretty-print + fenced block | stdlib `json` |
| `.eml` | headers + text/html body + attachments | stdlib `email` |
| `.epub` | per-chapter HTML → MD | ebooklib (+ bs4 fallback) |
| `.rtf` | control-word stripping | striprtf (+ regex fallback) |
| `.odt`, `.ods`, `.odp` | paragraph/row extraction + GFM tables | odfpy (+ raw-XML fallback) |
| `.msg` | Outlook headers + body + attachments | extract-msg |
| `.pst` | **per-message** (one OKF concept per email) | readpst (libpst) + libpff-python fallback |
| `.docx`, `.xlsx`, `.pptx` | **office_oxide** (primary, ~100x faster), OfficeCLI binary (fallback) | office_oxide 0.1.8 (PyO3) |
| `.ipynb`, `.latex`, `.rst`, sourcecode, `.enex`, `.chm`, etc. (38 formats) | all2md (when installed) | all2md 1.12 |
| `.doc`, `.xls`, `.ppt` | clear error path | needs `libreoffice --convert-to` first |
## Live mode
```bash
headcleaner watch ~/inbox --output ~/out --webhook-url https://hooks.slack.com/...~/inbox 아래의 파일이 변경되면 변환을 자동으로 다시 실행합니다.
각 재실행은 매니페스트를 웹훅 URL로 POST합니다(선택 사항).
Ctrl+C를 눌러 중지합니다.
Obsidian 볼트 동기화
headcleaner convert ~/inbox --format okf \
--output ~/Documents/MyVault/Concepts \
--obsidian-compatObsidian에서 개념이 속성 패널에 올바르게 표시되도록 OKF 프론트매터에 Obsidian 친화적인 플랫 필드(source, sha256, generated_by, verified_by, stale_on)를 추가합니다. 원래 OKF 필드는 왕복 변환을 위해 그대로 유지됩니다.
검토(인간 승인)
자동 변환은 verified: human:pending으로 설정합니다. headcleaner review TUI는 번들 내 모든 대기 중인 개념을 순회하며 사람이 각각 다음 상태로 전환할 수 있게 합니다:
승인됨 →
verified: human:reviewed,status: verified,reviewed_at,reviewed_by,reviewed_via거부됨 →
verified: human:rejected,status: rejected, 선택적rejection_reasons[]건너뜀 → 개념을
pending으로 유지
headcleaner review ./out/okf
# Textual TUI: a=approve, r=reject, s=skip, n=next, p=prev, q=quitTextual을 사용할 수 없는 경우(예: 헤드리스 CI), 일반 모드 REPL이 자동으로 대체됩니다.
배포
PyPI:
pip install headcleaner(uv로 빌드, 태그 푸시 시 OIDC 신뢰 퍼블리싱으로 게시)Homebrew:
brew install headcleaner(packaging/homebrew/에 포뮬러)Docker:
docker pull ghcr.io/local/headcleaner(tesseract가 포함된 멀티스테이지 이미지)Windows:
winget install headcleaner,scoop install headcleaner,choco install headcleaner정적 바이너리:
pip install pyinstaller && pyinstaller packaging/pyinstaller/headcleaner.spec
전체 릴리스 체크리스트는 RELEASE.md를 참조하세요.
CLI 개요
headcleaner view <bundle>(--tui를 추가하면 터미널에서 탐색)는 OKF 번들을 단일 독립형 HTML 그래프로 렌더링합니다(백엔드 없이 모든 브라우저에서 열림). 전체 옵션은 docs/VIEWER.md를 참조하세요.
headcleaner convert IN_DIR [flags] # walk + convert
headcleaner watch IN_DIR [flags] # live mode + webhooks
headcleaner review BUNDLE # human sign-off TUI/REPL
headcleaner attest BUNDLE [--private-key PEM] # Merkle root + optional ed25519 sig
headcleaner verify BUNDLE [--public-key PEM] # verify an attestation
headcleaner serve BUNDLE [--host] [--port] # local HTTP browser for the bundle
headcleaner glob DIR # interactive include REPL (Textual)
headcleaner notion-import EXPORT.zip OUT # reverse a Notion workspace export
headcleaner lint DIR [--fix] # OKF + MD rule checks
headcleaner doctor [--output-dir] # dependency and permission preflight
headcleaner agents [stdout] # emit AGENTS.md
headcleaner templates # list supported formats문서
문서 | 용도 |
이 파일 — 설치, 빠른 시작, CLI 참조 | |
모든 설치 경로(curl, pip, brew, PowerShell, uv, Docker) | |
실제 예제가 포함된 상세 사용 가이드 | |
파이프라인이 어떻게 구성되는지, 어디서 확장하는지 | |
지원되는 모든 형식 × 엔진 × 라이브러리 | |
이 CLI가 생성하는 OKF v0.2 계약 + 신뢰 정책 | |
OKF 프론트매터 JSON 스키마 및 편집기/CI 통합 | |
타사 어댑터 엔트리 포인트 프로토콜 | |
일반적인 오류와 해결 방법 | |
자주 묻는 질문 | |
새 형식/엔진/에미터를 추가하는 방법 | |
릴리스 이력 | |
44개 이상의 출시된 개선 사항 + 향후 아이디어 | |
HeadCleaner VS Code 확장(Concept Explorer + Trust Inspector) |
문제 해결
officecli not found — npm install -g @officecli/officecli로 설치하세요. 확인하려면 headcleaner agents를 실행하세요.
추출 가능한 텍스트가 없는 PDF — PDF가 이미지 전용입니다. --ocr를 사용하여 다시 실행하세요(pytesseract + PATH의 Tesseract 바이너리 필요).
숨김 파일 건너뜀 — 의도적입니다. .로 시작하는 파일은 워커가 제외합니다.
루트에 OKF index.md 없음 — 번들에 개념이 1개 이상이면 자동 생성됩니다. --no-okf-index로 제외할 수 있습니다.
더 보기 — docs/TROUBLESHOOTING.md 참조.
개발
git clone <this repo>
cd headcleaner-cli
uv sync
uv run pytest # 314 tests, ~14s
uv run headcleaner convert ./tests/fixtures --format both --output ./out아키텍처
src/headcleaner/
├── walk.py # recursive folder walker
├── router.py # extension → engine dispatch
├── normalize.py # CanonicalDoc + OKF/MD frontmatter builders
├── lint.py # post-conversion linter (OKF + Markdown)
├── run.py # pipeline orchestrator
├── cli.py # Click CLI (headcleaner command)
├── tui.py # Textual TUI (omp-style)
├── engines/
│ ├── base.py # Adapter ABC
│ ├── officecli.py
│ ├── pdf.py
│ ├── html.py
│ └── txt.py
└── emit/
├── markdown.py
├── okf.py
├── okf_index.py
└── manifest.py새 형식을 추가하려면 engines/에 모듈을 넣고, router.py에서 어댑터를 등록하고, docs/FORMAT_MATRIX.md에 행을 추가하세요. 전체 확장 가이드는 docs/CONTRIBUTING.md를 참조하세요.
라이선스
Apache-2.0
Available Tools
19 toolsget_chunkC
Return one cited chunk after root, policy, and index validation.
Inputs: chunk_id (required), bundle. Returns: object
get_diagnosticsB
Return a stable, content-free diagnostics envelope for a local bundle.
Inputs: bundle. Returns: object
get_readinessC
Return a stable, content-free readiness envelope for a local bundle.
Inputs: bundle. Returns: object
list_review_queueC
Return a stable, content-free review-queue envelope for a local bundle.
Inputs: limit, bundle. Returns: object
okf_context_toolC
Assemble legacy graph context and an additive indexed package when available.
Inputs: depth, start, bundle, max_tokens.
okf_diff_toolC
What changed on disk since the bundle was loaded.
Inputs: bundle.
okf_doctor_toolB
Health report for a bundle (score, errors, warnings, per-rule findings).
Inputs: bundle, stale_days.
okf_get_concept_toolA
Read one concept (frontmatter + body). Accepts id, title, or filename stem.
Inputs: target (required), bundle.
okf_impact_toolB
Report outbound / inbound / transitive links for a concept.
Inputs: concept (required), bundle.
okf_list_bundles_toolA
List the OKF bundles this server has loaded.
Inputs: no named parameters. Returns: result
okf_refresh_toolC
Re-ingest a bundle so the in-memory catalog reflects current files.
Inputs: bundle.
okf_registry_addB
Add a bundle under a slug alias. Then reference it as @/... .
Example:
okf_registry_add(slug="docs", bundle_path="C:/Users/me/Documents/okf")
okf_get_concept("@docs/readme")
Inputs: slug (required), bundle_path (required).
okf_registry_listA
List all bundles registered under @slug aliases.
Inputs: no named parameters. Returns: result
okf_registry_removeB
Remove a slug from the registry.
Inputs: slug (required).
okf_registry_resolveA
Resolve @slug/concept to the bundle path + concept id.
Inputs: target (required).
okf_search_toolB
Search one or all loaded bundles.
Set all_bundles=True to search across every bundle currently registered
with the server. Hits from other bundles include a `bundle` field.
Inputs: term (required), limit, bundle, all_bundles. Returns: result
okf_sql_toolA
Read-only SELECT over the in-memory catalog (concepts, links).
Inputs: query (required), bundle. Returns: result
search_chunksC
Return cited, policy-gated chunks from an existing local bundle index.
Inputs: query (required), limit, bundle. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Several tool groups are hard to distinguish: okf_related_tool vs okf_impact_tool both analyze links, search_chunks vs okf_search_tool both search, and okf_doctor_tool/get_diagnostics/get_readiness/list_review_queue all sound like status/health endpoints. The descriptions help only after close reading, but an agent could easily pick the wrong tool.
Naming conventions are mixed: some tools use okf_*_tool, some use bare get_*/list_* verbs, and registry tools use okf_registry_*. There is no consistent verb_noun or prefix/suffix rule across the set.
19 tools is on the heavy side; many are justified by the range of bundle, registry, search, SQL, and graph-analysis capabilities, but the status-envelope and search/link-analysis overlaps add bulk. It is not egregiously overpopulated, but it exceeds the comfortable 3-15 range.
The server covers the main read-side lifecycle: list/load bundles, search/read concepts and chunks, inspect health/diff, manage registry aliases, and run SQL. Missing mutation tools for bundle content and review actions are likely out of scope, forming only minor gaps agents can work around.
Maintenance
Related MCP Connectors
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Document conversion MCP server: PDF to Markdown, image OCR, spreadsheet parsing.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Convert scanned PDFs to Markdown or EPUB, and translate PDF and EPUB books via MCP.
Related MCP Servers
- AlicenseDqualityDmaintenanceEnables reading, writing, editing, and converting Office documents (ODT, DOCX, ODS, XLSX, PDF, etc.) using MCP tools, with no external dependencies.1121 npmMIT
- AlicenseAqualityDmaintenanceEnables local semantic search and management of OKF knowledge bundles via MCP tools, with hybrid BM25 and vector search.104Apache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides tools for AI agents to navigate and query OKF knowledge bundles through overview, read, search, and list operations.545 PyPIApache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables document conversion and processing through MCP, including Office/PDF/Markdown conversions, OCR, and PDF operations like split, rotate, encrypt, and extract.MIT