gutendex: add Project Gutenberg pack (find books, read full text)
This commit is contained in:
commit
9a41f66fd6
11 files changed
+885
No files matched your search
@@ -0,0 +1,72 @@
|
||||
# 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
|
||||
download its **full plain text**, saving it to a `.txt` file.
|
||||
|
||||
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
|
||||
`packs.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
|
||||
`<output_dir>/gutenberg-<id>-<slug>.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.
|
||||
Reference in new issue
Block a user