# yifanfeng97/hyper-extract — AlpLab Radar Static Code Audit

- Ring: `trial`
- Category: `dev`
- Overall score: `4.0/5`
- Implementation check: `partial`
- Maturity: `active`
- Audited commit: `a85b4d13662a` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-02T05:51:29Z
- Repository: https://github.com/yifanfeng97/hyper-extract
- Radar entry: https://radar.alplab.co/#repo/yifanfeng97/hyper-extract
- License: `NOASSERTION`
- CI workflows: `.github/workflows`
- Tags: `knowledge-graph`, `rag`, `llm-extraction`, `cli`, `mcp`, `provenance`

## Summary

An LLM-powered knowledge-extraction framework and CLI (`he`) that turns text/PDF/DOCX documents into nine typed AutoType structures (model/list/set/document/graph/hypergraph/temporal/spatial/spatio-temporal) via LangChain structured output, with FAISS semantic search, per-source provenance and rollback, Obsidian/GraphML/CSV/JSON-LD/Cypher export, and a read-only MCP server.

## Implementation Check

Every advertised workflow (parse/feed/search/talk/remove --document/MCP/Obsidian export/provider system) is genuinely implemented, but README.md's '80+ YAML templates' and '11+ extraction engines' are inflated: hyperextract/templates/presets/ ships exactly 40 YAMLs (the 'Total 40' statistics table in hyperextract/templates/README.md agrees) and hyperextract/methods/registry.py `_init_registry` registers 10 methods.

## When to Use

Use when you want to turn document corpora into queryable knowledge graphs or typed extracts with source attribution, incremental feeds, and per-document rollback — via CLI, Python API, or MCP assistants. Not when you need guaranteed extraction fidelity (quality is entirely LLM-dependent), fully offline operation (an LLM + embeddings endpoint is mandatory), or when you must audit the merge/index core yourself — it lives in the external ontomem/ontosight dependencies.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.5/5 |
| usability | 4.0/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 4.5/5 |

## Code Evidence

hyperextract/types/base.py `BaseAutoType._extract_data` chunks text (RecursiveCharacterTextSplitter) and runs `llm_client.with_structured_output(schema, method="function_calling")` per chunk, tracking per-chunk failures via `_batch_safe`/`extraction_failures`; hyperextract/types/graph.py `AutoGraph` implements two-stage extraction (`_extract_data_by_two_stage`), dangling-edge pruning (`_prune_dangling_edges`), and a full provenance ledger (GraphEditMixin `_record_extraction_source`, `remove_source` with exact/touched re-merge, upsert in overridden `feed_text`, in-place index patching via `sync_index`); hyperextract/methods/registry.py registers 10 engines incl. chunk_rag, graph_rag, light_rag, hyper_rag, cog_rag, itext2kg(_star), kg_gen, atom (all concrete classes under hyperextract/methods/, e.g. graph_rag.py `Graph_RAG.build_communities` with graspologic Leiden); hyperextract/utils/client.py `PROVIDER_PRESETS` covers ~20 providers, `create_llm` auto-disables DeepSeek thinking mode, `CompatibleEmbeddings` sends string (not pre-tokenized) input to OpenAI-compatible endpoints with blank-text backfill; hyperextract/cli/cli.py implements the complete command surface (parse/feed/search/talk/show/info/tag/remove with --dry-run and --document rollback/clean/build-index/export obsidian|graphml|jsonld|cypher|csv); hyperextract/mcp_server.py `build_server` registers the 9 advertised read/export tools on FastMCP stdio; hyperextract/cli/config.py `ConfigManager._save`/`_restrict_config_permissions` persists API keys to ~/.he/config.toml at 0600 with Windows ACL lockdown via `_restrict_windows_acl`; hyperextract/utils/json_index.py `dump_index_json`/`load_index_json` provides pickle-free FAISS persistence and deletes stale index.pkl; hyperextract/utils/template_engine/gallery.py `_init_gallery` rglobs presets and hyperextract/templates/presets/ contains exactly 40 YAML files across 7 domains; tests/mocks.py `MockStructuredRunnable` plus tests/conftest.py give deterministic keyless unit runs while .github/workflows/test.yml runs pytest --cov on ubuntu/macos/windows x py3.11/3.12 (OPENAI_API_KEY empty) and .github/workflows/integration.yml runs real-API `pytest -m integration` nightly, with tests/integration/test_real_extraction.py and test_provenance_real.py covering the live path.

## Issues Found

README.md overstates the catalog: '80+ YAML templates' vs 40 actual presets in hyperextract/templates/presets/ (confirmed by the Total-40 statistics table in hyperextract/templates/README.md) and '11+ extraction engines' vs 10 registered methods in hyperextract/methods/registry.py; hyperextract/methods/rag/graph_rag.py `build_communities` silently no-ops when graspologic is missing (message only under verbose), so community-aware search degrades without a clear error; Gallery._load_config (hyperextract/utils/template_engine/gallery.py) swallows preset load errors with a print instead of surfacing them programmatically.

## Key Risks

Core merge/dedup/index/provenance semantics are delegated to external packages ontomem>=0.6.1 and ontosight>=0.1.8 (pyproject.toml) — OMem behavior behind remove_source/sync_index/edit is not auditable from this repo; nothing was executed, and unit tests validate plumbing against synthetic schema-driven mock data, so real extraction quality is only exercised by the nightly OpenAI-key integration runs; operation requires a function-calling LLM plus a separate embeddings endpoint for most providers (local vLLM/Ollama paths assume running services/GPUs); legacy (<=v0.10.0) KA directories still load pickle-based FAISS indexes (warned once in hyperextract/types/_faiss.py), so only self-created KA dirs should be loaded; GitHub Actions are tag-pinned (actions/checkout@v7 et al., 22 unpinned per maturity signals) rather than SHA-pinned, and the README suggests a curl|sh uv installer (docs only).

## Reviewed Files

- `README.md`
- `pyproject.toml`
- `LICENSE`
- `.env.example`
- `.github/workflows/test.yml`
- `.github/workflows/lint.yml`
- `.github/workflows/integration.yml`
- `hyperextract/__init__.py`
- `hyperextract/types/__init__.py`
- `hyperextract/types/base.py`
- `hyperextract/types/graph.py`
- `hyperextract/types/_faiss.py`
- `hyperextract/methods/registry.py`
- `hyperextract/methods/rag/light_rag.py`
- `hyperextract/methods/rag/graph_rag.py`
- `hyperextract/utils/__init__.py`
- `hyperextract/utils/client.py`
- `hyperextract/utils/readers.py`
- `hyperextract/utils/obsidian.py`
- `hyperextract/utils/json_index.py`
- `hyperextract/utils/document_store.py`
- `hyperextract/utils/template_engine/template.py`
- `hyperextract/utils/template_engine/factory.py`
- `hyperextract/utils/template_engine/gallery.py`
- `hyperextract/templates/__init__.py`
- `hyperextract/templates/README.md`
- `hyperextract/templates/presets/general/base_model.yaml`
- `hyperextract/cli/config.py`
- `hyperextract/cli/utils.py`
- `hyperextract/cli/cli.py`
- `hyperextract/cli/commands/config.py`
- `hyperextract/cli/commands/list.py`
- `hyperextract/mcp_server.py`
- `tests/conftest.py`
- `tests/mocks.py`
- `tests/types/test_graph_extraction.py`
- `tests/methods/test_registry_contracts.py`
