wiki-compile

wiki-compile is a command for Claude Code from Spark-To-Paper-Skills/paper-wiki. It costs 22 tokens per session (2,783 once invoked), scanned A, original, MIT.

A command that turns newly collected source material into a structured paper-wiki knowledge base. It compares the raw source folder with the existing wiki and follows the project's documented rules for adding or skipping material.

In plain words
What is it for?
Use it to compile new papers or OCR output into wiki notes while preserving the project's mappings, metadata, and existing compiled content.
Why use it?
It removes the need to manually track which papers have already been processed. It also adds checks for source paths and OCR files, where OCR means text extracted from scanned documents.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions CLAUDE.md; mentions subagents; mentions Claude Code.

Part of the paper-wiki plugin — 1 skill, 8 commands, 4 agents, 1 hook shipped together

Good fit Use it to compile new papers or OCR output into wiki notes while preserving the project's mappings, metadata, and existing compiled content.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/spark-to-paper-skills/paper-wiki/wiki-compile
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Spark-To-Paper-Skills/paper-wiki

Made for: Claude Code.

Or install paper-wiki, the plugin that ships this one along with the rest of its 1 skill, 8 commands, 4 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wiki-compile

README.md
[![agentmods](https://agentmods.dev/badge/commands/spark-to-paper-skills/paper-wiki/wiki-compile/github.svg)](https://agentmods.dev/commands/spark-to-paper-skills/paper-wiki/wiki-compile)
Your own site
<a href="https://agentmods.dev/commands/spark-to-paper-skills/paper-wiki/wiki-compile"><img src="https://agentmods.dev/badge/commands/spark-to-paper-skills/paper-wiki/wiki-compile/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wiki-compile

Your own site · 80×15
<a href="https://agentmods.dev/commands/spark-to-paper-skills/paper-wiki/wiki-compile"><img src="https://agentmods.dev/badge/commands/spark-to-paper-skills/paper-wiki/wiki-compile.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,783 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00022 $0.02783
Opus 5 $0.00011 $0.01392
Sonnet 5 $0.00004 $0.00557
Haiku 4.5 $0.00002 $0.00278

Measured 12d ago against content hash 764567980399, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

wiki-compile scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/wiki-compile.md · 183 lines

How it starts

The opening of the file, as written. The whole thing — 183 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Run the paper-wiki wiki-compile action. This file is a Claude Code slash-command adapter; the action itself is platform-neutral.

Load the canonical project context

Read, in order:

  1. WIKI.md — the only authoritative project rules, including variant, schemas, compilation rules, and prohibitions.
  2. research.md — current scope, lifecycle, seeds/material inventory, and progress.
  3. The existing wiki/ tree — current compiled state.

CLAUDE.md and AGENTS.md are runtime adapters. Never take schema or business rules from them, and never update them during compilation.

Diff raw/ against wiki/

List source material under raw/<topic>/, including OCR Markdown under raw/<topic>/mineru/. Match each source to its compiled note using the mapping in WIKI.md.

  • New source: queue it.
  • Already compiled: skip it unless the user requested recompile.
  • OCR-derived source: validate paths and control metadata before reading any OCR Markdown. The source directory must be a direct child with a safe basename under raw/<topic>/mineru/; lstat it, its manifest, every listed Markdown file, and every ancestor from the wiki root. Each must be a real directory or regular file as appropriate, never a symlink, junction, hard link with an unexpected link count, or other reparse point, and every realpath must remain inside the source directory (the marker remains inside mineru/). Do not follow links while discovering files. "Safe" uses the OCR scripts' portable-name rules: no empty/dot component, separator, absolute/drive prefix, control character, trailing dot/space, Windows-forbidden punctuation or device basename, and no NFC+casefold collision.
  • Only after those path checks, parse _paper-wiki-ocr-complete.json. Require schema: paper-wiki/ocr-completion/v2, state: requires-batch-commit, a 32-lowercase-hex batch_id, source exactly equal to the containing directory basename, and source_pdf to be a safe basename. Require content_fingerprint.schema: paper-wiki/ocr-content/v1, a nonempty files list covering every regular single-link file under the source except the completion manifest itself, and a tree_sha256. Each file record must contain exactly a safe relative POSIX path, nonnegative integer size, and lowercase SHA-256. Paths must be unique after NFC+casefold. markdown must be a nonempty, duplicate-free safe list exactly equal to the .md subset of files. Recompute the tree digest from UTF-8-byte-sorted file records using the canonical bytes paper-wiki/ocr-content/v1\n, then for each record path_utf8 + NUL + decimal_size + NUL + lowercase_sha256 + LF.
  • Treat batch_commit_marker only as a basename matching _paper-wiki-ocr-batch-[0-9a-f]{32}.committed.json. Its named sibling under raw/<topic>/mineru/ must pass the same regular/non-link/non-reparse/containment checks. Require schema: paper-wiki/ocr-batch/v2, resolution: committed, the same batch_id, and exactly one source record matching all manifest provenance fields: source, source_pdf, source_pdf_size, source_pdf_sha256, and source_pdf_project_path, plus the complete content_fingerprint. If the project path is non-null, it must be a safe project-relative path inside raw/<topic>/ but outside mineru/; re-open that regular non-link PDF, verify its basename, size, and SHA-256 against the manifest, and block on any change. A null path preserves external flat-staging compatibility but must be reported as "current PDF hash not revalidated".
  • Immediately before any OCR body is read, open each declared content file with no-follow semantics, bind its pre-open lstat, open-handle fstat, ancestor chain, and post-copy identity, and copy it into a new owner-only (0700 directory, regular private files) snapshot while hashing. From those snapshot bytes require the exact declared file set, every size/SHA-256, and the canonical tree_sha256. Read and compile only the verified private snapshot, never the original mutable path. Any legacy v1 manifest/batch or record missing the fingerprint is blocked; report that it needs re-OCR or an explicitly reviewed reseal operation.
  • Queue the source only after every check passes. An unsafe source tree, invalid manifest, malformed/linked/mismatched/missing marker, unresolved pending batch, or any aborted marker for that batch_id is blocked and must be reported; never read its OCR body or compile it.
  • Course source: apply WIKI.md and wiki/exam-scope.md; do not compile material that is out of scope.
  • PDF without OCR/HTML/Markdown content: report that it needs OCR or a no-OCR source fetch before compilation.

Read the full file on GitHub · 183 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 183 lines · 22 tokens per session scan A 764567980399

Subscribe to this mod's changes

wiki-compile is a command published in the GitHub repository Spark-To-Paper-Skills/paper-wiki (7 stars, last pushed 29d ago), licensed MIT. It adds 22 tokens to every session and 2,783 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.