Files
nanobot-runtime/skills/cook/SKILL.md

96 lines
3.9 KiB
Markdown

---
name: cook
description: >
Capture and search recipes and tea notes (brewing parameters, origins, tasting
notes) in the cook/ directory — one markdown file per item. Triggers on:
"cook: X", "zapiš recept X", "save recipe X", "co mám na X" (tea/food lookup),
"čaj X", tea temperature/time questions against stored notes. For growing
personal food & tea knowledge — not a one-off task or a durable user fact.
---
# Cook
Recipes and tea notes in `cook/`, one markdown file per item. No inbox, no
pipeline, no background compile — capture is inline in the same turn.
**All file mutations go through the safety script.** Frontmatter is generated
only by the script, never by hand — it cannot drift.
```bash
uv run skills/cook/scripts/cook.py <cmd> ...
```
## Layout
```
cook/
├── recepty/ ← recepty/<slug>.md (type: recept)
├── caj/ ← caj/<slug>.md (type: caj)
└── assets/ ← cook/assets/<slug>/ (only if a document/photo ever arrives)
```
Slugs: kebab-case, descriptive (`gulas-classic.md`, `sencha-japonsko.md`).
Subdirs are created by the script on first `add`.
## Frontmatter (script-generated)
```yaml
type: recept | caj # the only fixed value
category: volná hodnota # polévka, hlavní-chod / zelený, černý...
cuisine: volná # recepts only
origin: volná # caj only
tags: [chata, zima] # user hashtags, no '#'
added: 2026-09-08 # auto
```
Taxonomy is deliberately free-form — it settles over time, don't force enums.
## Capture (inline, same turn)
1. `add <slug> --type recept|caj [--category C] [--cuisine C] [--origin O] [--tags a,b]`
with the body on **stdin** (heredoc). The script creates the file with
frontmatter + body and prints the path. Exit 1 if the slug exists.
2. **Slug collision**`show` the existing item, ask the user: update it via
`edit`, or file as a new slug (`gulas-hrachova`). Never auto-suffix `-2`.
3. Commit: `git add cook/ && git commit -m "cook: add <slug>"`. Stage only
`cook/` — never `git add -A`.
4. Confirm the file path and quote what was filed.
Language: user's (Czech), verbatim where sensible. New content appends **at
the end** of a file; never insert into the middle.
### Body formats — conventions, not rigid schemas
Recipe: `# <název>`, **Ingredience**, **Postup**, **Zdroj**, **Poznámky**.
Tea: `# <název čaje>`, **Země/Typ/Teplota/Čas**, **Poznámky** (chuť, vůně,
odkud koupeno). Adapt to what the user sends; don't force empty fields.
## Search / answer
1. Narrow via script: `list [--type T] [--category C] [--tag X]` (frontmatter
filters) and/or `search <text>` (fulltext across bodies).
2. Read the shortlisted files (`show <slug>` or `read_file`), answer **from the
files only** — no confabulation. If not covered, say so.
3. Read-only: never modify files in a search turn.
## Edit / delete — hard-gated TWO-TURN flow
- **Turn 1 (no mutation):** `edit <slug>` prints the path + full text. Show the
user the exact verbatim text (or before → after), ask to confirm. STOP.
- **Turn 2 (explicit confirmation only):** apply body changes with a surgical
`edit_file` on the script-printed path (frontmatter stays untouched), or
`delete <slug>` / `rename <old> <new>`. Then commit:
`git add cook/ && git commit -m "cook: edit|delete|rename <slug>"`.
`rename` also moves `cook/assets/<old>/` if present. `delete` removes the
assets dir only when empty — non-empty assets block silent data loss.
## House rules
- Script guards: `add` on existing slug, `edit`/`delete`/`rename` on missing
slug → exit 1. Never bypass the script by `write_file`-ing into `cook/`
(except surgical body edits via `edit_file`/`apply_patch` after `add`).
- `validate` checks frontmatter integrity — run it if files were touched
by anything other than the script.
- Surgical edits only — never reformat or rewrite stored recipes/notes
unless asked.