Skip to content

The automatic safety net

What book-studio handles for you automatically splits in two: the verification gate that runs at each chapter, and the three hooks that run outside your work flow. You don’t need to memorize commands, but knowing what gets blocked and why makes a block less alarming.

For a chapter to be marked finished, it has to clear two verifications.

It scores whether the chapter reads “like a human wrote it” on a 0–100 scale. It catches spots like template phrases (“to summarize,” “the key is”), list patterns, an opening that throws the result first, and a missing experience signature such as concrete numbers or a failure story. A score above 61 blocks the chapter and it gets rewritten. The longer the book, the more the tone tends to waver, and this gate grabs the tone at each chapter.

It looks at whether the chapter contradicts the setup in consistency_index.json. It cross-checks character appearance, world rules, and the timeline against earlier chapters. The detailed spot is in continuity.

A hook is a script that runs automatically at a certain moment without you calling a command. They’re planted in .claude/hooks/.

ScriptWhenWhat
session-start.shsession startpulls the previous work, the active book’s progress, and memory into context automatically
stop-reminder.shresponse endalerts you to update the next-session note (active.md) if it’s empty
pre-commit-check.shright before git commitblocks secrets and outputs from getting committed by mistake

session-start.sh — coming back from where you left off

Section titled “session-start.sh — coming back from where you left off”

When you start a new session, this hook pulls active.md (the previous session’s next task), the active book slug, the last 40 lines of that book’s progress.md, and MEMORY.md into context automatically. Whether you reopen days later or forgot which book is active while running several, these spots attach to the front automatically.

stop-reminder.sh — the note for the next session

Section titled “stop-reminder.sh — the note for the next session”

When the AI finishes a response, if active.md is empty, it gives one alert. It’s guidance to write down what you just did, the next starting point, and any deferred decisions. This note is what gives the next session’s session-start.sh something to pull.

pre-commit-check.sh — preventing output and secret accidents

Section titled “pre-commit-check.sh — preventing output and secret accidents”

This check runs automatically right before git commit. It blocks files that contain an API-key pattern (OPENAI_API_KEY, ANTHROPIC_API_KEY, AWS keys), and blocks a _workspace/ book output from getting committed wholesale. Chapters and outlines are in .gitignore and drop out of git tracking, so if one gets committed by mistake, this hook blocks it. It also blocks a *.local/ backup folder from getting committed (the base-untouched principle).

The rules these gates and hooks enforce are summarized in the eight lines of the security baseline in AI_AUTOMATION.md. Spots like not putting secrets in git (S1, S7), not carelessly touching outside _workspace/ (S2), per-chapter commit (S5), and no auto-publishing (S8). From a beginner’s standpoint, you don’t need to memorize these lines; when a gate blocks, read the reason and fix it.

If a gate or workflow blocks and you’re unsure how to get out, go to when-ai-gets-stuck.