How heryinassociation/doclab works
doclab is a local literature-processing workbench: it ingests or adopts books, builds a calibrated hierarchical outline, and exports depth-based Markdown and indexes for knowledge extraction. The main workflow is orchestrated through the CLI and reused by the local HTTP interface and MCP wrapper. EPUB also has a standalone chapter-oriented converter. Several module responsibilities are documented in the CLI and README, but their implementation was not sampled; the graph omits uncertain internal wiring.
Main entry points: doclab.py Command workflow · project.py Book workspaces · ingest.py Parsed blocks · server.py Local workbench
Components 21
Interfaces
- Command workflow
doclab.py - Local workbench
core/server.py - MCP tools
mcp_server.cjs
Book Intake
- MinerU client
core/mineru_api.py - Ingest and adopt
core/ingest.py - EPUB parsing
core/epub.py - Chapter converter
epub-to-markdown/epub2md.py
Structure Analysis
- Page calibration
core/pagecal.py - Outline builder
core/outline.py - Manual corrections
core/manual.py - TOC exchange
core/tocio.py - Outline audit
core/audit.py
Export and Checks
- Markdown export
core/exporter.py - Export verification
core/verify.py
Project State
- Project registry
core/project.py - Book workspaces
core/project.py - Parsed blocks
core/ingest.py
Other components
- Book operator
- PDF or EPUB
- MinerU API
- Markdown and indexes
Connections 35
- Book operator → Command workflow: runs commands
- Book operator → Local workbench: uses interface
- Book operator → MCP tools: calls tools
- MCP tools → Command workflow: spawns CLI
- Local workbench → Command workflow: dispatches commands
- Command workflow → Ingest and adopt: ingests or adopts
- Command workflow → EPUB parsing: parses EPUB
- Command workflow → Page calibration: calibrates pages
- Command workflow → Outline builder: builds outline
- Command workflow → Outline audit: audits outline
- Command workflow → Markdown export: exports depth
- Command workflow → Export verification: checks export
- Ingest and adopt → MinerU client: requests OCR
- MinerU client → MinerU API: uploads and polls
- MinerU API → MinerU client: returns OCR results
- Ingest and adopt → Book workspaces: records project
- Ingest and adopt → Parsed blocks: produces blocks
- EPUB parsing → Book workspaces: records project
- Chapter converter → PDF or EPUB: reads EPUB
- Chapter converter → Markdown and indexes: writes chapters
- Project registry → Book workspaces: resolves projects
- Page calibration → Parsed blocks: uses page blocks
- Page calibration → Book workspaces: stores calibration
- Outline builder → Parsed blocks: builds from blocks
- Outline builder → Book workspaces: stores tree
- Manual corrections → Book workspaces: stores edits
- TOC exchange → Book workspaces: exchanges outline
- Outline audit → Book workspaces: reads project data
- Markdown export → Parsed blocks: uses content
- Markdown export → Book workspaces: reads outline and calibration
- Markdown export → Markdown and indexes: writes documents
- Export verification → Book workspaces: checks export state
- Export verification → Markdown and indexes: validates output
- Local workbench → Manual corrections: edits outline
- Local workbench → Parsed blocks: browses blocks