Dalsi kolo vylepesni /remind

This commit is contained in:
lachtan
2026-06-10 09:54:02 +02:00
parent abdfd8c67d
commit 10801da03e
5 changed files with 63 additions and 80 deletions

View File

@@ -7,83 +7,55 @@ description: >
# /remind
Reminders are stored in SQLite (`db/reminders.sqlite`) and delivered by the nanobot
user crontab, directly to Telegram, outside the agent. Reply to the user in their own language.
Reminders are stored in SQLite (`db/reminders.sqlite`) and delivered by `remind_send.py`,
which runs every minute from the nanobot user crontab, directly to Telegram, outside the agent.
Reply to the user in their own language.
## Commands
## Natural language → command mapping
### Create
```
/remind <text> every day at 9:00
/remind <text> every weekday at 9:30
/remind <text> at 2026-06-15T18:00
/remind <text> randomly 2 times between 08:00 and 20:00
/remind <text> once daily at random time between 8:00 and 21:00
| User says | Command |
|-----------|---------|
| "every day at 9" / "every weekday at 9:30" | `add --cron "0 9 * * *"` |
| "on 2026-06-15 at 18:00" / "once at …" | `add --at "2026-06-15T18:00:00"` |
| "randomly 2× between 08:00 and 20:00" | `add --random-times-per-day 2 --random-window 08:00-20:00` |
| "what reminders arrived today / since when" | `delivered [--since YYYY-MM-DD]` |
| list all reminders | `list` |
For the full flag reference of any command, run:
```sh
uv run skills/remind/scripts/remind_cli.py --help
uv run skills/remind/scripts/remind_cli.py <command> --help
```
Parse natural language, then call `remind_edit.py add` with flags:
- `--text "..."`
- `--cron "0 9 * * *"` (repeatable)
- `--at "2026-06-15T18:00:00"` (repeatable)
- `--random-times-per-day N --random-window HH:MM-HH:MM [--random-days DOW] [--random-from YYYY-MM-DD] [--random-until YYYY-MM-DD]`
## Behavioral contract
**`list`** returns readable text. Each reminder:
### List
```
/remind list
```
Call `remind_edit.py list`. Returns a readable text listing — each reminder is prefixed with
`#<id>` (that id is what `--id` selects), followed by indented schedule lines:
```
#3 drink water [enabled]
#<id> text [enabled|disabled]
cron: 0 9 * * *
#7 take meds [disabled]
at: 2026-06-15T18:00:00
random: 2× daily 09:0021:00 (1-5) from 2026-06-01
```
An empty store prints `(no active reminders)`.
### Edit
```
/remind edit <keyword> --text "new text"
/remind edit <keyword> --replace-schedules --cron "0 10 * * *"
```
Call `remind_edit.py edit --keyword <keyword>`. Keyword matches case-insensitively against reminder text. `--replace-schedules` requires at least one new `--cron`/`--at`/`--random-*`.
**Mutations** (`add`, `edit`, `remove`, `enable`, `disable`) return JSON: `{"added": …}`, `{"edited": …}`, etc. Errors go to stderr with a non-zero exit code.
### Enable / Disable
```
/remind disable <keyword>
/remind enable <keyword>
```
**Selecting a reminder:** `edit`, `remove`, `enable`, `disable` accept `--keyword` (case-insensitive substring) or `--id` (exact). An ambiguous keyword match returns `{"error": "ambiguous", "matches": […]}` — retry with `--id <n>`. Run `list` to see ids.
### Remove
```
/remind remove <keyword>
```
Soft delete. Hard delete only via direct DB access.
**`delivered`** reads the `reminder_fires` table (delivered rows only, Prague local time). Defaults to today; `--since YYYY-MM-DD` widens the window. The agent never sees deliveries happen — this is the only window into them.
### Selecting by keyword or id
`edit`, `remove`, `enable`, `disable` accept either `--keyword` (case-insensitive substring) or `--id` (exact). A keyword matching two or more reminders returns `ambiguous` with each id — retry with `--id <n>` to disambiguate duplicate texts. Run `list` to see ids.
**`remove`** is a soft delete.
### Delivered (history)
```
/remind delivered
/remind delivered --since 2026-06-01
```
Answers "what reminders arrived today / since when?". Calls `remind_edit.py delivered`, which reads the `reminder_fires` table (delivered rows only, Prague local time). The agent never sees deliveries happen, so this is the only window into them.
## Editing reminders
## Scripts
**To fix or change wording:** use `edit --id <n> --text "…"` (get the id from `list`),
or `edit --keyword <kw> --text "…"`.
**NEVER remove + re-add a reminder just to change its text** — that loses the delivery history and changes the id.
| Action | Command |
|--------|---------|
| list | `uv run skills/remind/scripts/remind_edit.py list` |
| add | `uv run skills/remind/scripts/remind_edit.py add --text "..." ...` |
| edit | `uv run skills/remind/scripts/remind_edit.py edit --keyword <kw> ...` |
| remove | `uv run skills/remind/scripts/remind_edit.py remove --keyword <kw>` |
| enable | `uv run skills/remind/scripts/remind_edit.py enable --keyword <kw>` |
| disable | `uv run skills/remind/scripts/remind_edit.py disable --keyword <kw>` |
| delivered | `uv run skills/remind/scripts/remind_edit.py delivered [--since YYYY-MM-DD]` |
Sender runs every minute from crontab: `uv run skills/remind/scripts/remind_send.py`
Use `--replace-schedules` (with at least one new `--cron`/`--at`/`--random-*`) only when you need to change the *schedule*, not the text.
## Environment