generate

A command that turns existing OCR text into organized Obsidian Markdown notes. Obsidian is a note-taking application that stores plain-text Markdown files, and OCR text must already have been created.

In plain words
What is it for?
Use it after OCR to organize a book into thematic notes, save structured metadata, and generate files in an Obsidian vault.
Why use it?
It saves the work of manually sorting a book’s extracted text into themes. It can gather book details, identify thematic categories, and place topic files in the chosen vault location.

Command

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.

agentmods
npx agentmods add commands/masterleopold/book-capture/generate
Clone the repo
git clone --depth 1 https://github.com/masterleopold/book-capture
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 531 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00016 $0.00531
Opus 5 $0.00008 $0.00266
Sonnet 5 $0.00003 $0.00106
Haiku 4.5 $0.00002 $0.00053

Measured 2d ago against content hash 04d3e3cd5385, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generate 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 2d 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/generate.md · 64 lines

What it actually says

Structured Markdown Generation

Generate thematic Obsidian Markdown documents from existing OCR text. Requires raw_text.json to already exist.

Setup

  • Resolve vault paths from .claude/book-capture.local.md or auto-detect
  • Parse $ARGUMENTS for BookID and metadata flags
  • OUTPUT_DIR = <CAPTURES_BASE>/<BookID>

Verify OCR data exists:

Read: <OUTPUT_DIR>/raw_text.json

If not found, tell the user to run /book-capture:ocr first.

Step 1: Gather Metadata

Parse from $ARGUMENTS or ask user:

  • Book Title (required)
  • Author (required)
  • Category (required)
  • Location — where topic files go (e.g., Knowledge/Marketing/BookTitle)
  • Language — JP (default) or EN
  • URL (optional)

Step 2: Plan Thematic Structure

Read raw_text.json, concatenate all page text. Check for existing structured.json — if found, offer to reuse or regenerate.

Analyze the full text to identify 8-14 thematic categories by information type (not original chapter order). Save to <OUTPUT_DIR>/structured.json.

Step 3: Generate Topic Files

Set LOCATION_DIR = <VAULT_ROOT>/<Location>

Dispatch 3-5 parallel agents (subagent_type: book-capture:content-writer), each handling 2-4 themes.

Each agent writes files to <LOCATION_DIR>/NN_ThemeName.md with:

  • YAML frontmatter (tags, parent wikilink)
  • Rich markdown content (300-600 lines per file)
  • Cross-references via [[wikilinks]] to sibling topics

Step 4: Generate Hub File

Write hub file to <ENTRIES_DIR>/<BookTitle>.md with:

  • Full frontmatter (tags, Category, Rating, author, Location, Chapters, Language, URL)
  • Book summary
  • Topic wikilinks with descriptions

Step 5: Report

  • Number of topic files generated
  • Hub file path
  • Topic files directory
  • Suggest user review in Obsidian
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. 2d ago First seen · 64 lines · 16 tokens per session scan A 04d3e3cd5385

Subscribe to this mod's changes

generate is a command published in the GitHub repository masterleopold/book-capture (10 stars, last pushed 1mo ago), licensed MIT. It adds 16 tokens to every session and 531 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.