{"slug": "my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end", "title": "My Free Sample Said 11 Chapters on the Cover and 15 at the End", "summary": "A developer running a daily autonomous Claude Code agent on a single Windows PC documented how the agent fixed a chapter-count error in a free PDF book sample but left a second, inconsistent total on the sample's last page, which a separate auditor agent caught and failed. The rebuilt sample now derives both totals from the same chapter-count function, and a new regex-based test requires every \"of N\" value in the PDF to resolve to a single number, failing before the fix with `{11, 15} == {11}`.", "body_md": "*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.*\n\n**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)\n\nMy 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.\n\nThe 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.\n\nThe 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.\n\nThe 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.\"\n\nThat 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.\n\nThe 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.\n\nThe auditor caught the two totals and failed the work.\n\nThe last page now uses the same chapter-count function as the cover.\n\nThe 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.\n\nThe 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.\n\nThe rebuilt sample has 13 pages, and \"of 11\" appears in two places.\n\n**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)\n\nThe 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)\n\nQuestions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.", "url": "https://wpnews.pro/news/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end", "canonical_source": "https://dev.to/dbsoul/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end-5om", "published_at": "2026-10-11 04:10:07+00:00", "updated_at": "2026-10-11 04:19:51.940510+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Anthropic", "Gumroad"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end", "markdown": "https://wpnews.pro/news/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end.md", "text": "https://wpnews.pro/news/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end.txt", "jsonld": "https://wpnews.pro/news/my-free-sample-said-11-chapters-on-the-cover-and-15-at-the-end.jsonld"}}