inbrainfun/inbrain/book-mirror
Claude Code and agent skill by inbrainfun/inbrain
- community
Checking that the SKILL.md file is still in the repository.
Take any book (EPUB/PDF), produce a personalized chapter-by-chapter analysis with two-column tables. Left column preserves the chapter content; right column maps every idea to the reader's actual life using brain context. Output is a single brain page at media/books/<slug>-personalized.md plus an optional PDF via brain-pdf.
Install
npx vskill@latest install inbrainfun/inbrain/book-mirrorSKILL.md
The same SKILL.md was published earlier as inbrainfun/inbrain/book-mirror.
book-mirror — Personalized Chapter-by-Chapter Book Analysis
Convention: see _brain-filing-rules.md for thesanctionedmedia/<format>/<slug>exception this skill files under.Convention: see conventions/quality.md forcitation rules, back-link enforcement, and output quality bars.Convention: see conventions/brain-first.mdfor the lookup chain (brain → search → external) the context-gatheringphase follows.
What this does
Given a book (EPUB or PDF), produce a brain page where every chapter is summarized in detail on the left and mirrored back to the reader's actual life on the right, using their own words, situations, people, and patterns from the brain. Output is a brain page at media/books/<slug>-personalized.md.
This is NOT a generic book summary. The right column is the value: it makes the book read like a therapist who knows the reader is leaving notes in the margins. If the user wants a flat summary instead, route them to a different skill.
Trust contract (read this before running)
book-mirror runs as a CLI command (inbrain book-mirror), NOT as a pure markdown skill that the agent dispatches via tools. The CLI is the trusted runtime; the skill is the orchestration prose around it.
What this means for the agent:
- The CLI submits N read-only subagent jobs (one per chapter). Each subagent
has allowed_tools: ['get_page', 'search'] only. They CANNOT call put_page or any mutating op. They produce markdown analysis via their final message.
- The CLI reads each child's
job.result, assembles the final
two-column page, and writes it via a single operator-trust put_page.
- This means untrusted EPUB/PDF content cannot prompt-inject any
people/* page. The trust narrowing happens at the tool allowlist, not at the slug-prefix layer.
The pipeline
1. Acquiring the book
book-acquisition (legal-grey-area downloader) was deliberately not shipped in this skill wave. The user drops the EPUB/PDF manually. Common paths the user might use:
Resolve $BRAIN_DIR from the inbrain config (inbrain config get sync.repo_path) or accept it from the user.
2. Text extraction
Goal: one .txt file per chapter under a temp directory. The agent has shell + python access; the CLI is downstream of this and takes the extracted directory as input.
EPUB
If bs4 is missing: pip3 install beautifulsoup4 lxml.
Inspect the chapter files to identify which are real chapters vs front matter (TOC, copyright, acknowledgments). Often the EPUB ships one file per chapter; sometimes multiple chapters per file. Use head -5 "$WORK/chapters/"*.txt to spot-check.
Then split by chapter heading (look for "Chapter N", "CHAPTER N", or all-caps title lines) using awk or python. If the PDF is a scan with no embedded text, fall back to OCR via skills/brain-pdf or another vision tool.
Quality check
For each chapter file:
- Word count > 1500 (typical chapter range 2k–8k words).
- No HTML tags.
- Paragraphs preserved with
\n\n.
Save a chapters/INDEX.md mapping chapter number → title → file → word count for reference.
3. Context gathering
This is the most critical step. The right column is only as good as the context fed to each chapter subagent.
What to pull
- Templates: USER.md and SOUL.md if the user maintains them
(inbrain ships templates at templates/USER.md and templates/SOUL.md; they live in the brain repo when populated). Read full.
- Recent daily memory — last 14 days of brain pages under
wiki/personal/reflections/ or wherever the user files daily notes.
- Topic-relevant brain searches tuned to the book's themes:
inbrain query "marriage",inbrain query "couples therapy"for a
marriage book.
inbrain query "founders",inbrain query "fundraising"for a
business book.
inbrain query "shame",inbrain query "anger"for a psychology book.
- Brain pages for relevant entities —
inbrain query "<name>"for
people who will likely come up.
- Standing patterns — anything in the user's reflections or
originals that's been recurring.
Assemble a context pack
Write everything to a single file the CLI can read:
Make this dense. It's read by every chapter subagent.
4. Analysis: invoke inbrain book-mirror
The CLI:
- Validates inputs and loads chapter files.
- Prints a cost estimate (~$0.30/chapter at Opus) and prompts to confirm.
- Submits N child subagent jobs with read-only
allowed_tools. - Waits for every child to complete.
- Reads each child's
job.result(the markdown analysis text). - Assembles all chapters into one page with frontmatter + intro + per-chapter
sections + closing.
- Writes ONE
put_pagetomedia/books/<slug>-personalized.md. - Reports a JSON envelope on stdout:
{"slug": "...", "chapters_total": N, "chapters_completed": N, "chapters_failed": 0}.
If any chapter failed, the CLI exits 1 and the user can re-run — idempotency keys (book-mirror:<slug>:ch-<N>) deduplicate completed chapters at the queue level, so retry is cheap.
Model: Opus by default
The default model is claude-opus-4-7. Sonnet works (use --model claude-sonnet-4-6) but the right-column quality drops noticeably — the texture that makes the analysis read like a therapist who knows the user needs Opus-grade reasoning.
Cost gate
The CLI refuses to spend in a non-TTY context without --yes. CI / scripted invocations must pass --yes explicitly. TTY users get a [y/N] prompt before submission.
5. PDF (optional)
After the brain page is written, render to PDF using skills/brain-pdf:
6. Fact-check and cross-link
After the page lands, run a fact-check pass on factual claims about the reader (parents, siblings, marriage history, jobs, heritage). Common error patterns to look for:
- Conflating the reader's parents' relationship with patterns in extended
family.
- Inventing therapy backstory ("after his parents' divorce…") when the
reader's parents are still together.
- Wrong number/age of children, wrong spouse / kid / sibling names.
If you can't verify a claim, remove it. Better to lose texture than to introduce a falsehood.
Cross-link entities mentioned in the analysis:
- For every person the right column references with a brain page, add a
back-link from people/<slug> to the new media/books/<slug>-personalized page (per conventions/quality.md Iron Law).
Quality bar (the bar)
The left column should:
- Preserve the author's actual stories, statistics, frameworks, examples.
- Quote memorable phrases verbatim.
- Be detailed enough that the reader could skip the book and not lose much.
The right column should:
- Use the reader's actual quoted words from the context pack.
- Reference specific dates, situations, people by name.
- Read like a therapist who knows the reader is leaving notes in the margins.
- Be plain about direct hits ("This is exactly the [name a real situation]").
- Be honest about misses ("This chapter is less directly relevant
because…"). Don't force connections.
The whole document should feel like one coherent voice, calibrated to the reader's actual life rather than a generic profile, and honest about where the book's framing breaks down for this specific reader.
Anti-patterns (do not do these)
- ❌ Skimming chapters. Standing instruction: preserve detail.
- ❌ Generic right column. "This might apply if you've ever felt…" →
kill on sight.
- ❌ Factual errors about the reader's life. Always fact-check after
assembly.
- ❌ Giving the subagent put_page access. Trust contract is read-only;
the CLI does the writing.
- ❌ Forcing connections. If a chapter doesn't apply, say so plainly.
- ❌ Sycophancy or moralizing in the right column. No "you should…",
no "consider…", no "perhaps it's time to…".
- ❌ Truncating the LEFT column. The book's actual content needs to
survive.
Output checklist
- [ ] Book file exists locally (path known).
- [ ] Chapter texts under
$WORK/chapters/*.txtwith sane word counts. - [ ] Context pack at
$WORK/context.mdis dense. - [ ]
inbrain book-mirror --chapters-dir … --context-file … --slug … --title …returned exit 0. - [ ]
media/books/<slug>-personalized.mdexists in the brain. - [ ] Fact-check pass complete (no errors against USER.md or other source-of-truth pages).
- [ ] Cross-links added from referenced people/companies.
- [ ] Optional: PDF rendered via brain-pdf and delivered.
Related skills
skills/brain-pdf/SKILL.md— render the personalized page to PDF.skills/strategic-reading/SKILL.md— read a book through a specific
problem-lens instead of personalizing to the whole reader.
skills/article-enrichment/SKILL.md— same shape applied to articles
rather than books.
Contract
This skill guarantees:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/book-mirror/SKILL.md
Popularity
- Repository stars
- 143
- Repository forks
- 126
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/inbrainfun/inbrain/book-mirror)