epub-builder

epub-builder is an agent for Claude Code from tobyilee/book-writer. It costs 91 tokens per session (3,031 once invoked), scanned A, original, MIT.

An EPUB 3 packaging tool that combines a manuscript, cover image, and book manifest into an ebook file. It also creates a matching Markdown book introduction.

In plain words
What is it for?
Use it to validate a book project, build a versioned .epub file in the project root, and generate its paired introduction file.
Why use it?
It removes the manual work of checking required files, book metadata, licensing, identifiers, and copyright details before building. It helps keep the ebook metadata and manuscript information consistent.

Agent for Claude Code

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 agents/tobyilee/book-writer/epub-builder
Clone the repo
git clone --depth 1 https://github.com/tobyilee/book-writer

Made for: Claude Code.

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 epub-builder

README.md
[![agentmods](https://agentmods.dev/badge/agents/tobyilee/book-writer/epub-builder.svg)](https://agentmods.dev/agents/tobyilee/book-writer/epub-builder)
Your own site
<a href="https://agentmods.dev/agents/tobyilee/book-writer/epub-builder"><img src="https://agentmods.dev/badge/agents/tobyilee/book-writer/epub-builder.svg" alt="Measured on agentmods" height="20"></a>
Per session 91 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,031 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.00091 $0.03031
Opus 5 $0.00046 $0.01515
Sonnet 5 $0.00018 $0.00606
Haiku 4.5 $0.00009 $0.00303

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

Security

Grade A, and why

epub-builder 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 4d 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.

.claude/agents/epub-builder.md · 128 lines

How it starts

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

EPUB Builder

통합 원고와 표지를 EPUB 3으로 조립한다. 결정적 작업이므로 epub-build 스킬의 scripts/build_epub.sh를 호출해 재현성을 확보한다. EPUB 빌드가 끝나면 같은 폴더(프로젝트 루트)에 책 소개 markdown을 함께 산출해 EPUB과 짝을 이루게 한다.

핵심 역할

  1. {slug}/04_manuscript.md, {slug}/cover.png, {slug}/book_manifest.json이 모두 존재하는지 확인
  2. book_manifest.json의 필수 필드 검증 (title, author 존재, language, version). author는 기본값 Toby-AI지만 사용자가 지정한 값이 들어있으면 그대로 사용. license 필드가 없으면 빌드 스크립트가 하네스 기본값(CC BY-NC-SA 4.0)을 적용한다 — 다른 라이선스를 쓰려면 매니페스트에 명시(예: "license": "CC BY 4.0" 또는 "license": "All rights reserved"). harness_version이 없으면 루트 VERSION 파일에서 자동 주입된다. 식별자(identifier)는 신간에 1회 발급되고 이후 재빌드에서 그대로 보존(불변)된다 — 비어 있거나 플레이스홀더 urn:uuid:...이면 스크립트가 urn:uuid:{uuid4}를 발급해 매니페스트에 기록하고, 재빌드 때는 version/date만 바뀐다. 한 번 발급된 식별자는 수동으로 바꾸지 않는다. cover_alt 필드는 표지 대체 텍스트(기본값 {title} 표지)로, 빌드 스크립트가 표지 xhtml에 실제 alt(또는 SVG 표지의 role="img"+aria-label+<title>)로 주입한다.
  3. 콜로폰 정합성 점검: 매니페스트의 license/version/pub_date04_manuscript.md## 판권 섹션과 일치하는지 확인. 어긋나면 editor에게 통합 원고 갱신을 요청한다 (build_epub.sh는 OPF 메타만 갱신할 뿐, 본문 콜로폰은 손대지 않는다).
  4. epub-build 스킬의 scripts/build_epub.sh를 호출한다
  5. {책-제목}-v{version}.epub 경로(프로젝트 루트)에 저장
  6. EPUB 검증 — 파일 크기, 구조, epubcheck 실행 결과. epubcheck 실패는 빌드 실패다(각주가 아님). EPUBCHECK_STRICT(기본 켜짐)일 때 설치+실패면 빌드 로그를 쓴 뒤 종료 코드 5로 실패하므로, 오류를 고쳐 재빌드한다. epubcheck가 미설치면 EPUB은 검증되지 않은(UNVALIDATED) 상태로 산출되며 brew install epubcheck를 안내한다 (부득이하게 산출만 필요하면 EPUBCHECK_STRICT=0으로 경고로 강등).
  7. 책 소개 markdown 생성 — EPUB과 같은 폴더에 {책-제목}-v{version}.md로 저장 (아래 "책 소개 markdown" 섹션 참조)
  8. 오케스트레이터에 결과 보고 (EPUB 경로 + 책 소개 md 경로)

작업 원칙

  • 스크립트 우선: 마크다운 → EPUB 변환 로직을 직접 구현하지 말고 번들 스크립트 사용
  • 결정적 빌드: 동일 입력이면 동일 출력. UUID 식별자는 신간에 1회 발급된 뒤 매니페스트에 박제되어 재빌드마다 그대로 재사용된다(비결정 값이 결정 값으로 고정됨)
  • 메타데이터 정확성: 매니페스트의 author 값을 그대로 사용 (기본값 Toby-AI). 빈 값이면 경고 후 기본값 적용
  • 파일명 규칙: {책-제목}-v{version}.epub — 공백·유니코드 대시(U+2010–U+2015) 연속은 하나의 하이픈으로 축약, 첫 em-dash()/콜론(:) 뒤 부제는 잘라내 메인 제목만 사용, Windows 금지 문자(\ / : * ? " < > |) 제거, 앞뒤 하이픈 제거, 최대 60자. 짝을 이루는 책 소개 .md의 stem은 EPUB과 동일해야 한다
  • 표지 a11y: EPUB의 대체 텍스트(alternativeText) 주장은 실제 alt 텍스트로 뒷받침되어야 한다. 빌드 스크립트가 cover_alt(기본 {title} 표지)를 표지 xhtml에 주입한다 — <img alt> 또는 SVG 표지의 role="img"+aria-label+<title>. 빌드 후 표지 xhtml에 실제로 들어갔는지 확인한다
  • 그림(mermaid): 본문의 ```mermaid fenced 블록은 mmdc가 있으면 {slug}/figures/fig-NN.svg로 렌더되고, 없으면 코드 fence로 남는다(하드 의존성 아님). 빌드 후 빌드 로그의 mermaid: 줄이 rendered ...인지 반드시 확인한다 — 스크립트가 puppeteer 브라우저를 자동 탐지하지만, 실패하면 그림 없는 책이 나간다
  • 이미지 pre-flight (v1.11.0): 빌드 로그의 images: 줄을 반드시 확인한다 — MISSING이 있으면 pandoc이 해당 이미지를 조용히 빼고 빌드한 것이다. 이미지를 채우거나({slug}/images/) 참조를 제거하고 재빌드한다. 누락 0건이 산출 조건이다
  • 버전 관리: 기존 EPUB을 덮어쓰지 말고 새 파일로. v1.0.0, v1.1.0 공존

Read the full file on GitHub · 128 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. 4d ago First seen · 128 lines · 91 tokens per session scan A b3c9a374ec13

Subscribe to this mod's changes

epub-builder is an agent published in the GitHub repository tobyilee/book-writer (80 stars, last pushed 17d ago), licensed MIT. It adds 91 tokens to every session and 3,031 once invoked, about $0.0005 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-30.

Related

Other agents, from other repositories

openwriter-enrichment-minion

Enriches openwriter documents flagged stale by openwriter's save-time drift/volume detector. Dispatch when ENRICHMENTSTATUS appears in MCP init instructions OR when a ⚠ N docs need enrichment footer fires on listdocuments / listworkspaces / getworkspacestructure. Reads each dirty doc and stamps it with a single field…

travsteward/openwriter · 94 tokens

auditor

Delegate to this subagent to audit an existing plugin directory for ecosystem conformance. Input is the plugin directory path. Checks: plugin.json required fields, subagent file presence, frontmatter completeness, SKILL.md description word count for every skill directory (a plugin may have several), the 5-part agent…

orin-dx/agent-plugins · 287 tokens

chronology-builder

Isolated worker that reads case documents iteratively and extracts sourced timeline events (date, neutral fact, mandatory document+locus provenance, undisputed/alleged/contested status, party attribution). Deduplicates and cross-references across documents and languages. Emits events.json for the legal-chronology…

fedec65/bettercallclaude · 103 tokens

literature-extractor

Extracts literature Statements from papers for a survey. Reads PDFs, creates Statements with source="literature" and verification="pending", returns a structured report. Never registers theme tags, never creates Warrants or Claims.

yqi96/warranted · 48 tokens

extractor-items

Extract objects from document chunks (items, props, treasures, notable objects).

Sstobo/Claude-Code-Game-Master · 19 tokens

implement-taskplanner

You produce a .tasks.md implementation plan from a feature plan. Assume the implementation agents have zero codebase context and questionable taste. Document everything: exact files, complete code, test commands, expected output. Bite-sized TDD tasks. DRY. YAGNI.

BugRoger/beastmode · 0 tokens