GOAL Build a personal audiobook generator on this computer, in this project folder. I upload an EPUB, PDF or text file, choose a voice, and get chapter-by-chapter MP3 files that sound natural and that I can play on my phone. All speech generation runs locally with the Kokoro text-to-speech model. DONE MEANS A 200-page document converts to audio without crashing, without skipped text, and without me watching it. The audio has no clicks between sentences, reads numbers and abbreviations sensibly, and resumes from the last finished chapter if the job stops. HOW TO WORK Work through every stage below without waiting for me. Verify each stage with a real test before you start the next. Stop only when you need something that only I can do: listen to audio, choose between options, or approve a change. Explain each handoff in plain English. Keep a TEST_LOG.md with every check, its result and the exact error if it failed. STAGE 1: INSPECT AND PREPARE Inspect my operating system, CPU, RAM, GPU (if any), free disk space and installed Python versions. Record them. Create an isolated Python environment for this project only. Leave other projects alone. Read the current Kokoro-82M model card and the kokoro package README on Hugging Face and GitHub. Install the package and its required system dependency, espeak-ng, using the method the README gives for my operating system. Install a CPU-only build of PyTorch unless I have a supported NVIDIA GPU. Record the package versions and model version. Prove the setup: generate a ten-second WAV of one test sentence with an American English voice. Confirm the file plays and has the expected sample rate. STAGE 2: GET CLEAN TEXT OUT OF DOCUMENTS Write a text extractor for TXT, PDF and EPUB. For EPUB, use the book's own chapter structure. For PDF, remove repeated headers, footers and page numbers, join words split by end-of-line hyphens, and keep paragraph breaks. Detect scanned PDFs that contain no extractable text and show a clear message instead of producing silence. Save the cleaned text for each chapter as a .txt file I can open and read before any audio is generated. Show me the first two pages of cleaned text from my long PDF so I can spot problems. STAGE 3: NORMALISE TEXT FOR SPEECH Add a normalisation step before speech. Expand numbers, dates, currency, percentages and common abbreviations (Dr, e.g., etc.) so they read naturally. Remove or shorten URLs and footnote markers. Add a pronunciation file (a simple word = spoken form list) that I can edit, and apply it before generation. STAGE 4: GENERATE ONE PAGE, THEN ONE CHAPTER Split text at sentence and paragraph boundaries into chunks the model handles well. Never cut a sentence in the middle. Generate audio chunk by chunk and join the chunks at the model's native sample rate. Add a short, consistent pause between paragraphs and a longer pause between chapters. Check the joins for clicks and silence gaps. Generate one page with three different voices and stop. HANDOFF: ask me to listen and pick a voice and a speed. Then generate one full chapter with my choices and ask me to listen to the first two minutes. STAGE 5: BUILD THE APP Create a simple local web page: upload a file, see the detected chapters, choose voice and speed, press Generate. Run generation in a background worker so the page stays responsive. Show progress per chapter, elapsed time and estimated time left. Save each finished chapter immediately as its own audio file. If the job stops, a restart skips finished chapters and continues from the next one. Add a Cancel button that stops cleanly. Export MP3 at a sensible speech bitrate, with the book title and chapter number in the file name and the tags. Keep the WAV only until the MP3 is verified. Store finished books in a visible Audiobooks folder outside the project's build files, and add an Open folder button. STAGE 6: PROVE IT ON A WHOLE BOOK Convert my long PDF and my EPUB from start to finish. Measure total time, audio duration and real-time factor (seconds of processing per second of audio). Compare the word count of the cleaned text with the text actually sent to the model, so no section is skipped. Run every acceptance test in this pack. Mark each PASS, FAIL or NOT RUN in TEST_LOG.md. Repair failures before you add any feature. DELIVER The command or launcher I use to start the app, the project folder, the Audiobooks folder, the pronunciation file, a requirements lock file, the Kokoro version, a short README and the test log. List which checks still need my ears. Keep all speech generation local; no cloud text-to-speech and no telemetry.