Wiki ingest
一套将 PDF/LaTeX 自动转化为 Obsidian 结构化 Markdown 知识图谱的 AI 智能体技能。
npx -y skills add Misaka16384/Wikify --skill wiki_ingestAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Ingest new academic papers, notes, or web articles into the raw/ folder of your active topic wiki.
SKILL.md
7.5 KB, ~1.9k tokens by cl100k_base, as published. Nobody here has run it
LLM Wiki — Ingest Skill (wiki_ingest)
Resolving script paths (read first): Commands below invoke scripts as
<BIN>/X.py(and a few as<SKILLS>/...). Resolve these to absolute paths once before running anything:
<SKILL_DIR>= the directory thisSKILL.mdlives in.<SKILLS>= theskills/folder containing this skill =<SKILL_DIR>/..<BIN>= thebin/folder beside it =<SKILL_DIR>/../../binDo not hardcode a fixed prefix like
.agents/binor../bin: shell relative paths resolve against the current working directory (usually the topic root), not this skill's location. Once resolved,<BIN>is typically.agents/binwhen invoked from the hub root, or.claude/binfrom inside a topic directory.
This skill handles converting external material (URLs, PDFs, local text files, and items inside inbox/) into raw sources.
Tooling (framework-agnostic): This skill is written tool-agnostic. Map each capability to your own agent's tool — read-file (
Readin Claude Code,view_filein Antigravity), sub-agent / parallel task (Task/Agentin Claude Code,invoke_subagentin Antigravity), shell (Bash/PowerShell). Use the closest equivalent your framework provides; if a parallel sub-agent tool is unavailable, transcribe PDF pages sequentially yourself (still verifying the full page count).
When the user asks to ingest documents (or runs the command without a path):
-
Resolve Ingestion Targets:
- If a specific file path or URL is provided, process that target.
- If NO target is provided, automatically scan the
inbox/directory. - If
inbox/contains multiple files, you MUST loop through all of them and process them one by one in a batch. - If
inbox/is empty, only then prompt the user to specify a file or source URL.
-
Identify Source Type: For each target file, academic papers go to
raw/papers/, web pages toraw/articles/, manually typed notes toraw/notes/. -
File Type Handling & Conversion:
- For
.pdffiles:- MinerU Cloud API (Primary): You MUST first check if
ocr.use_mineruistrueandocr.mineru_api_tokenis set inconfig.yaml. If so, use:python <BIN>/mineru_cloud_worker.py "<PDF_PATH>" -o "<TOPIC_DIR>\\raw\\<type>"Note: This script automatically generates YAML frontmatter, writes the file, and extracts referenced figures intoimages/prefixed with the doc slug. Skip Step 4. - Native Vision (Fallback/Secondary): If MinerU fails or is disabled, you MUST enforce strict pagination to prevent laziness and truncation. You MUST use your agent's sub-agent / parallel-task tool to spawn parallel sub-agents, assigning each sub-agent exactly ONE page of the PDF to transcribe using their native multimodal vision. (If no sub-agent tool exists, transcribe pages one at a time yourself — never skip or summarize pages.)
- MinerU Cloud API (Primary): You MUST first check if
- Page Count Verification (MANDATORY): If using Native Vision, before spawning subagents, extract the total page count using a deterministic Python script (e.g.,
pymupdforPyPDF2). After all subagents return, verify that the number of returned transcriptions equals the total page count. If any pages are missing, re-invoke subagents for the missing pages. Do NOT proceed with assembly until all pages are accounted for. - Concurrency Limit: If using Native Vision, do NOT invoke more than 10 subagents at the same time. If the PDF has more than 10 pages, you must orchestrate them in batches (e.g., launch pages 1-10, wait for them to finish, then launch 11-20). You may write/run a quick Python script (e.g., using
pymupdforPyPDF2) purely to get the total page count before batching. - Once all subagents return their page transcriptions, assemble them in order using:
python <BIN>/assemble_transcriptions.py --transcription-dir <PAGES_DIR> --output-file <FILE_PATH> --title <TITLE> --date <DATE> - Alternative (Local OCR): If the user explicitly requests high-performance local offline OCR or wants to save external API tokens for long documents, you MUST use the
wiki_ingest_ocrskill instead. Do not mix native multimodal with local Python OCR scripts inside this skill. - For
.mdfiles or general inbox files, call the ingest helper script:python <BIN>/ingest_helper.py --source-file \"<MD_FILE>\" --type \"<TYPE>\" --topic-dir \"<TOPIC_DIR>\" [--date \"<DATE>\"]This script handles parsing/injecting standard YAML frontmatter, slugifying, and moving/copying the file. - For
.texfiles (and arXiv.tar.gzsource bundles): You MUST use the Pandoc conversion script. Run:python <BIN>/tex2md.py "<TEX_OR_TARGZ_PATH>" -o "<TOPIC_DIR>\raw\<type>"Note: This script automatically generates YAML frontmatter, writes the file, and extracts referenced figures intoimages/(rasterising.pdf/.epsfigures to PNG, prefixed with the doc slug). Skip Step 4. Check the printedFigures: N embedded, M unresolvedline.
- For
-
Assign Slug & YAML: Write to
raw/<type>/YYYY-MM-DD-slug.mdwith standard frontmatter:--- title: "Original Title" source: "Original URL or path" type: articles|papers|repos|notes ingested: YYYY-MM-DD tags: [tag1, tag2] summary: "2-3 sentence overview of the source" ---Frontmatter Validation (MANDATORY): After writing, run
python <BIN>/llm-wiki.py lint <TOPIC_DIR>and check if the new file has any frontmatter-related critical or warning issues. Fix them before proceeding. -
Post-Processing Pipeline: Extract the exact path of the generated Markdown file from the conversion script's output. Then, trigger the pipeline to handle moving and formatting (skipping global lint for now):
python <BIN>/ingest_pipeline.py "<ORIGINAL_FILE_PATH>" --topic-dir "<TOPIC_DIR>" --md-file "<GENERATED_MD_FILE>" --skip-lint --log-msg "Ingested <DOC_TITLE>" -
Manual Math Error Correction (Agentic Fallback):
- CRITICAL: If
ingest_pipeline.pyoutputs any warnings like[WARNING] Math syntax errors in <FILE>:, you MUST immediately stop and fix them. - Do NOT guess the fix for semantic errors like
Double subscriptorUnexpected end of stream. - You MUST use your file reading, search, or multimodal vision tools to read the original source PDF at the corresponding location to see the actual formula.
- CRITICAL TOOL: If you cannot easily infer the formula structure, you MUST use the provided PDF cropping tool to extract the exact region around the error as an image for your multimodal vision:
python <BIN>/pdf_math_crop.py "<PDF_PATH>" --text "<search_text_near_error>" --out "<TOPIC_DIR>\scratch\crop.png" - View the generated
crop.png, then manually edit the Markdown file to correct the semantic math errors based on the ground truth in the original paper, and re-runpython <BIN>/validate_math_latex.py <FILE>to confirm all errors are gone.
- CRITICAL: If
-
Global Lint & Index (End of Batch):
- CRITICAL: Once ALL files in the
inbox/have been processed through steps 1-6, you MUST run the global lint and index operation ONCE outside the loop:
python <BIN>/ingest_pipeline.py "none" --topic-dir "<TOPIC_DIR>" --lint-only - CRITICAL: Once ALL files in the