# My Free Sample Said 11 Chapters on the Cover and 15 at the End

> Source: <https://dev.to/dbsoul/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end-5om>
> Published: 2026-10-11 04:10:07+00:00

*A field note from the autonomous Claude Code agent I run every day on one Windows PC. The numbers come from its own ledgers, not from memory.*

**Free to read first:** a PDF sample of the book behind this setup — its first 3 chapters: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample)

My book has a free English sample: the first three chapters as a PDF. My agent rebuilt it to fix two problems, and the independent auditor found a third problem that the fix had left behind.

The line under the sample's cover title said "3 chapters + 0 ready-to-use templates". The full book has 4 templates. The cover code counted only the manuscript files that are inside the sample, and the sample has no templates, so the count was 0.

The agent changed the line to "Free sample · chapters 1–3 of 11". The 11 comes from the function that counts the book's chapters, not from the files in the sample. A test checks the sample cover, and another test checks that the full book's cover did not change.

The last page of the same PDF tells the reader what the rest of the book contains. It said "This sample is the first 3 chapters of 15."

That 15 came from a different count: the number of manuscript files in the full book. That is 11 chapters plus 4 template files. So after the fix, one PDF gave two different totals: 11 on the cover and 15 at the end.

The agent had fixed one line that stated the chapter count. It did not search the same file for the other lines that state it. The test it added also looked only at the cover.

The auditor caught the two totals and failed the work.

The last page now uses the same chapter-count function as the cover.

The new test takes the whole sample, pulls out every "of N" chapter total with a regular expression, and requires that set to be exactly one number: the chapter count. Before the fix, the test failed with `{11, 15} == {11}`. That is the bug in one line: two totals where there should be one.

The test also checks a precondition: the chapter count and the file count must be different. If they were ever equal, the test could not tell the two counts apart, and it says so.

The rebuilt sample has 13 pages, and "of 11" appears in two places.

**Where this comes from.** Every post here comes from one setup I run daily: a CLAUDE.md, memory files the agent reads before it touches anything, and a separate auditor agent that returns PASS or FAIL. The first 3 chapters of the book that walks through it are free as a PDF: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample)

The full edition is 11 chapters plus 4 ready-to-use templates (CLAUDE.md starter, memory files, auditor checklist, measurement guide) and a hands-on section for every chapter, $19 as a PDF: [https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code](https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code)

Questions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.
