Ebook Library: Agent Instructions
Ebook Library: Agent Instructions
Context: This directory contains a collection of markdown-based ebooks. As an Agent, your job is to maintain, edit, and build these books using the established Standard Build System.
1. Directory Structure
- /scripts: Contains the shared logic for building EPUBs and PDFs. Do not modify these unless you are refactoring the global build engine.
- /[project_name]: Each folder represents a distinct ebook project (e.g.,
aura_story,poder_etico).
2. Project Anatomy
Every ebook project MUST follow this structure to work with the build scripts and maintain maintainability:
ebooks/project_name/
├── build.json # CRITICAL: The build configuration file.
├── ebook_specs.md # CRITICAL: Quality standards and style guide.
├── guion.md # STORYLINE: The master plot/outline of the book.
├── index.json # STRUCTURE: The Table of Contents mapping.
├── images/ # Local assets (cover.png, icons, diagrams).
├── parte_01/ # Content folder (Parts/Chapters).
│ ├── intro.md # Introduction for this part.
│ ├── 01_chapter.md # Detailed content.
│ └── ...
├── parte_02/
└── ...
Required Metadata Files
build.json: The engine config.ebook_specs.md: Defines the “Gold Standard” for content. Agents must read this before writing anything. Includes word counts, tone, and prohibited words.guion.md: The narrative backbone. Describes what happens in each chapter at a high level.index.json: A JSON mapping ofchapter_title->filename. Used by some legacy scripts or for validation.
The build.json Configuration
This file drives the generation process. It usually looks like this:
{
"title": "Book Title",
"author": "Author Name",
"epubFilename": "book_complete.epub",
"pdfFilename": "book_print.pdf",
"parts": [ "parte_01", "parte_02", ... ], // Order matters!
"iconMap": [ ... ] // Optional: For injecting decorative icons in PDF
}
3. How to Build (The Standard workflow)
From the root of the repository (or ebooks/ parent), you can run the generic scripts pointing to the project folder.
📘 Generating an EPUB
node ebooks/scripts/build_epub.js ebooks/[project_name]
- Input: Reads
[project_name]/build.json. - Output: Generates the
.epubfile defined inepubFilenameinside the project folder.
📄 Generating a PDF
node ebooks/scripts/build_pdf.js ebooks/[project_name]
- Input: Reads
[project_name]/build.json. - Description: Uses Puppeteer to render a print-ready A5 PDF.
- Output: Generates the
.pdffile defined inpdfFilenameinside the project folder.
4. Notable conventions
- Images: In markdown, refer to images using relatively standard paths:
. The build scripts automatically resolve these to absolute paths during generation. - CSS: Styling is defined inside
build.jsonproperties (epubCssandpdfCss). Edit the JSON to change the look of the book, not the scripts. - Blockquotes & Icons: The PDF engine supports injecting icons into specific blockquotes (e.g., “Truths”, “Rules”, “Challenges”) using the
iconMapinbuild.json.
5. Agent Protocol
- Edit Content: Modify the
.mdfiles in theparte_XXfolders. - Verify Structure: Ensure
build.jsonlists any new parts/folders. - Build: Run the generic scripts.
- Verify Output: Check that the output files (EPUB/PDF) are created/updated in the project folder.