# gutendex — a semif-agent skill pack A self-contained [semif-agent](https://github.com/gabbymorgan/semif-agent) pack for the [Gutendex](https://gutendex.com/) catalog of [Project Gutenberg](https://www.gutenberg.org/) ebooks. It lets the agent: - **`gutendex.find_books`** — find public-domain books by **author**, **title**, or **genre** (author/title use Gutendex `search`; genre uses `topic`). - **`gutendex.read_book`** — resolve a book by name or Project Gutenberg id and read it. It checks the **local library first** (the books folder): a book already saved — matched by id, or by the name in the request — is read from disk with no network at all, and a book resolved from the catalog is reused from disk rather than downloaded again. A book not in the library is downloaded and saved as a `.txt` file. Over a **voice front end** (the local voice gateway, or an LXMF/Sideband voice chat) it instead **reads the book aloud**: the text is streamed through Piper one chunk at a time until the user says "stop", and the position is kept in a `bookmarks.json` beside the saved books so a later request **resumes** where the listener stopped. A book is far too long to speak as a chat reply, so over a text front end it is saved to a file and summarised. Gutendex is a free public JSON API. This pack needs **no account, no credentials, and no bridge** — the skill bodies make the HTTP requests directly with the standard library. ## Layout ``` gutendex/ pack.json # the pack manifest skills/gutendex/find_books/ skill.py manifest.json contract.json skill.test.py skills/gutendex/read_book/ skill.py manifest.json contract.json skill.test.py ``` ## Install Packs are loaded from the `skill_packs` root(s) in the agent's config. Either: - drop this `gutendex/` folder into the agent's `packs/` directory, or - keep it as its own checkout and point the config at the parent directory: ```json { "skill_packs": ["packs", "/path/to/agent-packs"] } ``` (a root directory is scanned for `*/pack.json`, so a folder of pack checkouts works directly). The pack is enabled by default (`enabled_by_default: true`); toggle it with `pack.gutendex.enabled` in the config. ## Configuration Both skills declare contract variables the runner resolves from the tiered config (`global → category → skill`) or asks for once on first fire. To avoid the one-time prompt, set them in the config: | Variable | Used by | Example | | -------------------- | ---------------------- | ---------------------- | | `gutendex_base_url` | both skills | `https://gutendex.com` | | `output_dir` | `gutendex.read_book` | `/home/me/books` | `read_book` writes the downloaded text to `/gutenberg--.txt` and returns the path. A book's full text is far longer than the agent's speakable result budget, so it is saved to a file and summarised rather than dumped into the reply. ## Tests Each leaf ships a hermetic mechanics test (stdlib `http.server` on loopback, no external network): ```sh cd skills/gutendex/find_books && python skill.test.py cd skills/gutendex/read_book && python skill.test.py ``` `PYTHONPATH` must include the agent checkout so `semif_agent` is importable. Passing these proves the mechanics only; a real run against Gutendex is the only proof of the live integration.