@aitne-sh/aitne 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -829
- package/agent-assets/agent-profiles/_safety.md +49 -17
- package/agent-assets/agent-profiles/profile-importer.md +1 -1
- package/agent-assets/agent-profiles/routine.md +4 -3
- package/agent-assets/docs/concepts/agent-day.md +6 -1
- package/agent-assets/docs/concepts/auth-health.md +10 -1
- package/agent-assets/docs/concepts/backends-and-tiers.md +74 -40
- package/agent-assets/docs/concepts/costs-and-quotas.md +25 -5
- package/agent-assets/docs/concepts/delegated-mode.md +147 -68
- package/agent-assets/docs/concepts/memory-model.md +9 -4
- package/agent-assets/docs/concepts/observations.md +13 -1
- package/agent-assets/docs/concepts/process-keys.md +20 -5
- package/agent-assets/docs/concepts/routines.md +38 -20
- package/agent-assets/docs/concepts/safety-model.md +30 -13
- package/agent-assets/docs/concepts/skills.md +12 -7
- package/agent-assets/docs/features/integrations/calendar.md +1 -1
- package/agent-assets/docs/features/integrations/git.md +2 -2
- package/agent-assets/docs/features/integrations/github.md +9 -2
- package/agent-assets/docs/features/integrations/mail.md +1 -1
- package/agent-assets/docs/features/integrations/notion.md +34 -6
- package/agent-assets/docs/features/integrations/obsidian.md +7 -2
- package/agent-assets/docs/features/lifestyle/git.md +4 -7
- package/agent-assets/docs/features/lifestyle/receipts.md +17 -2
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +15 -0
- package/agent-assets/docs/features/lifestyle/travel-time.md +7 -1
- package/agent-assets/docs/features/memory-files/agent-journal.md +2 -2
- package/agent-assets/docs/features/memory-files/projects.md +6 -0
- package/agent-assets/docs/features/memory-files/roadmap.md +5 -0
- package/agent-assets/docs/features/memory-files/today.md +1 -0
- package/agent-assets/docs/features/memory-files/user-profile.md +6 -0
- package/agent-assets/docs/features/messaging/bang-commands.md +20 -10
- package/agent-assets/docs/features/messaging/discord.md +12 -1
- package/agent-assets/docs/features/messaging/overview.md +10 -7
- package/agent-assets/docs/features/messaging/slack.md +13 -1
- package/agent-assets/docs/features/messaging/telegram.md +7 -1
- package/agent-assets/docs/features/messaging/whatsapp.md +12 -1
- package/agent-assets/docs/features/operations/activity-and-conversations.md +2 -2
- package/agent-assets/docs/features/operations/approvals.md +6 -0
- package/agent-assets/docs/features/operations/backend-routing.md +7 -0
- package/agent-assets/docs/features/operations/cost-tracking.md +6 -0
- package/agent-assets/docs/features/operations/notifications.md +6 -0
- package/agent-assets/docs/features/operations/schedule-approaching.md +22 -9
- package/agent-assets/docs/features/routines/custom-routines.md +10 -4
- package/agent-assets/docs/features/routines/evening-review.md +1 -1
- package/agent-assets/docs/features/routines/hourly-check.md +1 -1
- package/agent-assets/docs/features/routines/morning-routine.md +24 -15
- package/agent-assets/docs/features/routines/weekly-review.md +38 -12
- package/agent-assets/docs/features/wiki/commands.md +11 -0
- package/agent-assets/docs/features/wiki/overview.md +13 -3
- package/agent-assets/docs/getting-started/01-what-is-this.md +32 -11
- package/agent-assets/docs/getting-started/02-first-steps.md +17 -4
- package/agent-assets/docs/getting-started/03-what-can-this-do.md +21 -11
- package/agent-assets/docs/getting-started/04-first-day.md +14 -0
- package/agent-assets/docs/glossary.md +65 -12
- package/agent-assets/docs/guides/add-a-custom-routine.md +12 -0
- package/agent-assets/docs/guides/backup-and-restore.md +16 -2
- package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +6 -0
- package/agent-assets/docs/guides/build-your-wiki.md +14 -0
- package/agent-assets/docs/guides/change-which-model-handles-x.md +7 -0
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +16 -0
- package/agent-assets/docs/guides/explore-with-trace-and-connect.md +6 -0
- package/agent-assets/docs/guides/import-knowledge-file.md +11 -0
- package/agent-assets/docs/guides/install-and-run.md +20 -4
- package/agent-assets/docs/guides/maintain-wiki-health.md +6 -0
- package/agent-assets/docs/guides/migrate-machines.md +13 -1
- package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +9 -0
- package/agent-assets/docs/guides/pause-the-agent.md +12 -4
- package/agent-assets/docs/guides/reinstall-cleanly.md +19 -4
- package/agent-assets/docs/guides/setup-wizard.md +20 -9
- package/agent-assets/docs/guides/switch-default-backend.md +10 -1
- package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +5 -0
- package/agent-assets/docs/reference/api.md +29 -1
- package/agent-assets/docs/reference/cli-commands.md +22 -3
- package/agent-assets/docs/reference/config.md +37 -5
- package/agent-assets/docs/reference/disallowed-tools.md +13 -0
- package/agent-assets/docs/reference/keyboard-shortcuts.md +13 -0
- package/agent-assets/docs/reference/process-keys.md +70 -20
- package/agent-assets/docs/reference/skills.md +27 -9
- package/agent-assets/docs/troubleshooting/auth-failed.md +7 -2
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +13 -1
- package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +10 -0
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +11 -0
- package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +9 -4
- package/agent-assets/docs/troubleshooting/observation-not-detected.md +12 -0
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -1
- package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +5 -0
- package/agent-assets/docs/troubleshooting/wiki-write-failed.md +5 -0
- package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
- package/agent-assets/skills/agent-actions/SKILL.md +122 -0
- package/agent-assets/skills/attach/SKILL.md +1 -2
- package/agent-assets/skills/context/SKILL.md +36 -454
- package/agent-assets/skills/context/references/api.md +220 -0
- package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
- package/agent-assets/skills/context/references/snapshot-files.md +103 -0
- package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +1 -1
- package/agent-assets/skills/docs-search/SKILL.md +13 -13
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +5 -7
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +5 -7
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +5 -7
- package/agent-assets/skills/external-services/SKILL.md +6 -259
- package/agent-assets/skills/external-services/SKILL.native.claude.md +1 -2
- package/agent-assets/skills/external-services/SKILL.native.codex.md +1 -2
- package/agent-assets/skills/external-services/SKILL.native.gemini.md +1 -2
- package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
- package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
- package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
- package/agent-assets/skills/external-services/references/github.md +17 -0
- package/agent-assets/skills/external-services/references/obsidian.md +49 -0
- package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
- package/agent-assets/skills/gmail-lifestyle/SKILL.md +224 -0
- package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +59 -0
- package/agent-assets/skills/mail/SKILL.delegated.claude.md +1 -1
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +1 -1
- package/agent-assets/skills/mail/SKILL.md +9 -114
- package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
- package/agent-assets/skills/mail/references/api.md +108 -0
- package/agent-assets/skills/mail/references/examples.md +70 -0
- package/agent-assets/skills/mail/references/providers.md +8 -8
- package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
- package/agent-assets/skills/managed-tasks/references/errors.md +70 -0
- package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
- package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
- package/agent-assets/skills/management-policy/SKILL.md +33 -105
- package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
- package/agent-assets/skills/notify/SKILL.md +6 -78
- package/agent-assets/skills/notify/references/priority.md +60 -0
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
- package/agent-assets/skills/notion/SKILL.md +6 -10
- package/agent-assets/skills/notion/SKILL.native.claude.md +1 -2
- package/agent-assets/skills/notion/SKILL.native.codex.md +1 -2
- package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -2
- package/agent-assets/skills/observations/SKILL.md +1 -6
- package/agent-assets/skills/project-doc/SKILL.md +1 -5
- package/agent-assets/skills/reading/SKILL.md +2 -2
- package/agent-assets/skills/roadmap/SKILL.md +37 -135
- package/agent-assets/skills/roadmap/references/api.md +100 -0
- package/agent-assets/skills/roadmap/references/cross-check.md +73 -0
- package/agent-assets/skills/roadmap/references/migration.md +56 -0
- package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
- package/agent-assets/skills/schedule/SKILL.md +52 -88
- package/agent-assets/skills/schedule/references/batch.md +93 -0
- package/agent-assets/skills/schedule/references/errors.md +214 -0
- package/agent-assets/skills/schedule/references/model-selection.md +96 -0
- package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
- package/agent-assets/skills/schedule/references/recurring.md +185 -0
- package/agent-assets/skills/scheduled-managed-task/SKILL.md +13 -15
- package/agent-assets/skills/today/SKILL.md +27 -57
- package/agent-assets/skills/today/references/agent-plan-lifecycle.md +113 -0
- package/agent-assets/skills/user-interview/SKILL.md +12 -59
- package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
- package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
- package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
- package/agent-assets/skills/user-profile/SKILL.md +43 -63
- package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
- package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +28 -0
- package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-compile/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
- package/agent-assets/system-prompts/routine-fetch-window.md +68 -0
- package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
- package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +18 -11
- package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +16 -9
- package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
- package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
- package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
- package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
- package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
- package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +17 -9
- package/agent-assets/task-flows/_partials/notion-acquire.notion.md +18 -12
- package/agent-assets/task-flows/knowledge.import.md +1 -1
- package/agent-assets/task-flows/message.received.dm.md +13 -15
- package/agent-assets/task-flows/message.received.dm_first.md +10 -14
- package/agent-assets/task-flows/routine.custom.md +3 -1
- package/agent-assets/task-flows/routine.evening_review.md +39 -163
- package/agent-assets/task-flows/routine.fetch_window.md +17 -12
- package/agent-assets/task-flows/routine.hourly_check.md +16 -8
- package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
- package/agent-assets/task-flows/routine.monthly_review.md +46 -4
- package/agent-assets/task-flows/routine.morning_routine_journal.md +113 -0
- package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
- package/agent-assets/task-flows/routine.roadmap_refresh.md +60 -15
- package/agent-assets/task-flows/routine.user_profile_sweep.md +9 -10
- package/agent-assets/task-flows/routine.weekly_review.md +285 -70
- package/agent-assets/task-flows/scheduled.dm.md +8 -8
- package/agent-assets/task-flows/scheduled.task.md +5 -5
- package/agent-assets/task-flows/setup.initial.md +165 -245
- package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
- package/agent-assets/templates/_manifest.json +7 -7
- package/agent-assets/templates/dossiers/_index.md +1 -1
- package/agent-assets/templates/rules/journal-format.md +145 -38
- package/agent-assets/templates/user/expertise.md +4 -2
- package/agent-assets/templates/user/goals.md +4 -2
- package/agent-assets/templates/user/people.md +8 -2
- package/agent-assets/templates/user/personal.md +4 -2
- package/agent-assets/templates/user/work.md +4 -2
- package/bin/aitne.mjs +8 -1
- package/package.json +4 -4
- package/scripts/commands/doctor.mjs +52 -0
- package/scripts/commands/run-now.mjs +202 -0
- package/scripts/commands/verify.mjs +264 -0
- package/agent-assets/docs/features/routines/monthly-review.md +0 -65
- package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
- package/agent-assets/skills/management-task-register/SKILL.md +0 -330
- package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
- package/agent-assets/skills/receipts/SKILL.md +0 -134
- package/agent-assets/skills/travel/SKILL.md +0 -132
- package/agent-assets/skills/travel-time/SKILL.md +0 -158
- package/agent-assets/task-flows/routine.morning_routine.md +0 -322
- package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: reference
|
|
3
|
+
name: errors
|
|
4
|
+
description: /api/managed-tasks error envelope — POST / PATCH / DELETE codes (validation_error, duplicate, cap_reached, invalid_id, not_found, internal_error).
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /api/managed-tasks error envelope
|
|
8
|
+
|
|
9
|
+
Every endpoint returns the standard daemon error shape:
|
|
10
|
+
|
|
11
|
+
```jsonc
|
|
12
|
+
{
|
|
13
|
+
"error": "<machine code>",
|
|
14
|
+
"message": "<human text — surface verbatim to the user>",
|
|
15
|
+
"details": [ /* Zod issue list when error === "validation_error" */ ],
|
|
16
|
+
"item": { /* present on 409 duplicate — the existing row */ }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`body.message` is intended for the user — preserve it verbatim. The
|
|
21
|
+
daemon does NOT emit `cron_too_tight` (the recurrence schema only
|
|
22
|
+
accepts daily / weekly / monthly, so sub-daily asks never reach the
|
|
23
|
+
POST — refuse them client-side per the recurrence-rule reference) or
|
|
24
|
+
`cadence_partial` (the recurrence rule is one structured field, so
|
|
25
|
+
there is no partial-cadence shape to reject). A future schema gain
|
|
26
|
+
would surface those codes for the first time; surface verbatim.
|
|
27
|
+
|
|
28
|
+
## POST /api/managed-tasks
|
|
29
|
+
|
|
30
|
+
| HTTP | `error` | When | What to do |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| 400 | `validation_error` | Body fails Zod (frequency unknown, time malformed, etc.) | Pick the offending field from `details[].path` and ask the user to clarify. |
|
|
33
|
+
| 409 | `duplicate` | An existing row has the same `(app_normalized, cadence)` | DM `Already managed as <body.item.id>` and stop. The body's `item` is the existing row. |
|
|
34
|
+
| 409 | `cap_reached` | §B already at the active-task cap (default 100) | Surface `body.message` (carries the cap value); user must stop something first. |
|
|
35
|
+
| 5xx | `internal_error` | DB / cascade failure | DM "Couldn't register; daemon error. Try again, or check `aitne logs`." |
|
|
36
|
+
|
|
37
|
+
## PATCH /api/managed-tasks/:id
|
|
38
|
+
|
|
39
|
+
| HTTP | `error` | When | What to do |
|
|
40
|
+
|---|---|---|---|
|
|
41
|
+
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | User typed the id wrong — ask them to repeat. |
|
|
42
|
+
| 400 | `validation_error` | Body fails Zod (empty body, recurrenceRule.daysOfWeek on a `daily`, etc.) | Pin the failing path from `details[].path` and ask for a fix. |
|
|
43
|
+
| 404 | `not_found` | No row for `:id` | DM "I don't have an `mt_<id>` to modify"; offer to register one. |
|
|
44
|
+
| 5xx | `internal_error` | DB / cascade failure | Surface `body.message`; advise `aitne logs`. |
|
|
45
|
+
|
|
46
|
+
## DELETE /api/managed-tasks/:id
|
|
47
|
+
|
|
48
|
+
| HTTP | `error` | When | What to do |
|
|
49
|
+
|---|---|---|---|
|
|
50
|
+
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | Ask the user to repeat. |
|
|
51
|
+
| 404 | `not_found` | No row for `:id` | DM "No managed task with that id"; if you used a fuzzy match, re-list candidates. |
|
|
52
|
+
| 5xx | `internal_error` | DB / cascade failure | Surface `body.message`; advise `aitne logs`. |
|
|
53
|
+
|
|
54
|
+
## POST /api/managed-tasks/:id/run-now
|
|
55
|
+
|
|
56
|
+
| HTTP | `error` | When | What to do |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | Ask the user to repeat. |
|
|
59
|
+
| 404 | `not_found` | No row for `:id` | Cannot run a stopped task. |
|
|
60
|
+
| 409 | `already_running` | A previous fire is still in flight | Tell the user; do NOT loop. |
|
|
61
|
+
| 5xx | `internal_error` | Dispatcher / cascade failure | Surface `body.message`. |
|
|
62
|
+
|
|
63
|
+
## Idempotency on POST
|
|
64
|
+
|
|
65
|
+
Per-DM `Idempotency-Key` (recommended: SHA-256 of the inbound message
|
|
66
|
+
id + app). Concurrent retries collapse to the same `mt_<n>`. A
|
|
67
|
+
different key with the same `(app_normalized, cadence)` collides at
|
|
68
|
+
the uniqueness check and the second POST returns `409 duplicate`
|
|
69
|
+
with the existing `mt_id` — DM the user pointing at it rather than
|
|
70
|
+
registering twice.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: reference
|
|
3
|
+
name: output-path
|
|
4
|
+
description: output_path grammar — `<domain>/<type-plural>/` only, trailing slash mandatory, no `..`, no leading `context/`. Daemon CHECKs at INSERT/UPDATE.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# output_path grammar
|
|
8
|
+
|
|
9
|
+
The `output_path` field on `/api/managed-tasks` is the L2 directory
|
|
10
|
+
under the primary context vault where the recurring fetch will write
|
|
11
|
+
entity files. The daemon enforces the format with a CHECK constraint
|
|
12
|
+
at INSERT / UPDATE time.
|
|
13
|
+
|
|
14
|
+
## Format
|
|
15
|
+
|
|
16
|
+
`<domain>/<type-plural>/`
|
|
17
|
+
|
|
18
|
+
- Leading `context/` is **implicit** and must NOT be included; the
|
|
19
|
+
daemon prepends it.
|
|
20
|
+
- The trailing `/` is **mandatory**.
|
|
21
|
+
- No `..` segments. No absolute paths. No leading `/`.
|
|
22
|
+
|
|
23
|
+
## Allowed values
|
|
24
|
+
|
|
25
|
+
| Position | Allowed |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `<domain>` | `work`, `travel`, `finance`, `personal`, `health`, `learning` |
|
|
28
|
+
| `<type-plural>` | `meetings`, `trips`, `receipts`, `projects`, `books`, `notes` |
|
|
29
|
+
|
|
30
|
+
Not every domain × type combination is meaningful in practice — pick
|
|
31
|
+
the pair whose semantic prior best fits the fetch's data shape (see
|
|
32
|
+
the §"Decide output path" table in the Register section of the skill
|
|
33
|
+
body for the typical mapping).
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
| Valid | Invalid | Why invalid |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `work/meetings/` | `work/meetings` | Missing trailing `/` |
|
|
40
|
+
| `finance/receipts/` | `/finance/receipts/` | Leading `/` |
|
|
41
|
+
| `travel/trips/` | `context/travel/trips/` | Leading `context/` is implicit |
|
|
42
|
+
| `learning/books/` | `random/dir/` | `<domain>` not in allowed set |
|
|
43
|
+
| `personal/notes/` | `work/agendas/` | `<type-plural>` not in allowed set |
|
|
44
|
+
| (path omitted) | `work/../etc/` | `..` segments rejected |
|
|
45
|
+
|
|
46
|
+
## When to omit
|
|
47
|
+
|
|
48
|
+
`output_path` is **optional** on POST. Omit when the data shape is
|
|
49
|
+
genuinely ambiguous (e.g. the probe returned zero rows). The first
|
|
50
|
+
scheduled run populates it from real data, and a subsequent PATCH
|
|
51
|
+
back-fills the field if the user wants to pin it.
|
|
52
|
+
|
|
53
|
+
## When to relocate
|
|
54
|
+
|
|
55
|
+
A `PATCH /api/managed-tasks/:id` with a new `output_path` changes
|
|
56
|
+
only the *future* runs — existing entity files written under the old
|
|
57
|
+
path stay where they were. If the user wants reorganisation, stop
|
|
58
|
+
the task, move the files manually (or ask the user to), and
|
|
59
|
+
re-register.
|
|
60
|
+
|
|
61
|
+
To clear an existing `output_path` back to "first run decides", send
|
|
62
|
+
`{"output_path": null}` in the PATCH.
|
|
63
|
+
|
|
64
|
+
## 422 envelope on rejection
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"error": "validation_error",
|
|
69
|
+
"message": "output_path 'work/meetings' is missing the trailing slash",
|
|
70
|
+
"field": "output_path"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Surface the daemon's `message` verbatim — it names the exact rule
|
|
75
|
+
that failed. Do not retry the same value.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: reference
|
|
3
|
+
name: recurrence-rule
|
|
4
|
+
description: recurrenceRule grammar — hourly / daily / weekly / monthly. Engine accepts all four; the managed-tasks consumer specifically refuses sub-daily for app-fetch correctness (template below).
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# recurrenceRule grammar
|
|
8
|
+
|
|
9
|
+
The daemon's recurrence engine accepts four frequencies: `hourly`,
|
|
10
|
+
`daily`, `weekly`, `monthly`. Each frequency requires its own set of
|
|
11
|
+
fields and rejects fields that don't apply — the daemon's Zod
|
|
12
|
+
refinements return a `schedule.frequency_field_mismatch` issue (with
|
|
13
|
+
the offending field path) when the shape disagrees with the chosen
|
|
14
|
+
frequency. Pre-validate to save a round-trip.
|
|
15
|
+
|
|
16
|
+
Times are `HH:MM` 24-hour local; `timezone` is IANA (auto-fills from
|
|
17
|
+
daemon config when omitted, but explicit is safer so a roaming laptop
|
|
18
|
+
does not surprise the user).
|
|
19
|
+
|
|
20
|
+
## Engine — per-frequency field rules
|
|
21
|
+
|
|
22
|
+
| `frequency` | Required | Allowed | Forbidden |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| `hourly` | — | `intervalHours` (1..23, default 1), `minuteOfHour` (0..59, default 0), `timezone` | `time`, `daysOfWeek`, `daysOfMonth`, `onMissingDay` |
|
|
25
|
+
| `daily` | `time` | `timezone` | `intervalHours`, `minuteOfHour`, `daysOfWeek`, `daysOfMonth`, `onMissingDay` |
|
|
26
|
+
| `weekly` | `time`, `daysOfWeek` | `timezone` | `intervalHours`, `minuteOfHour`, `daysOfMonth`, `onMissingDay` |
|
|
27
|
+
| `monthly` | `time`, `daysOfMonth` | `timezone`, `onMissingDay` (default `lastDayOfMonth`) | `intervalHours`, `minuteOfHour`, `daysOfWeek` |
|
|
28
|
+
|
|
29
|
+
- `daysOfWeek` is `0=Sun..6=Sat`; 1..7 distinct entries, dupes rejected.
|
|
30
|
+
- `daysOfMonth` is `1..31`; 1..31 distinct entries, dupes rejected.
|
|
31
|
+
Days 29-31 may not exist in a given month — see `onMissingDay`.
|
|
32
|
+
- `onMissingDay`: `"skip"` (don't fire that month) or
|
|
33
|
+
`"lastDayOfMonth"` (fire on the actual last day, preserving the
|
|
34
|
+
pre-redesign clamp behavior). Default `"lastDayOfMonth"` for
|
|
35
|
+
back-compat. The engine also de-duplicates calendar dates that
|
|
36
|
+
collapse to the same fire (e.g. `[28,31]` in non-leap Feb with
|
|
37
|
+
`"lastDayOfMonth"` fires Feb 28 once, not twice).
|
|
38
|
+
- `intervalHours=N` fires when `(localHour % N) == 0` at
|
|
39
|
+
`minuteOfHour` local, anchored at midnight in the rule's
|
|
40
|
+
`timezone`.
|
|
41
|
+
|
|
42
|
+
## Mapping table
|
|
43
|
+
|
|
44
|
+
| User said | `cadence` | `recurrenceRule` |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| every hour | `hourly :00 (UTC)` | `{frequency:"hourly"}` |
|
|
47
|
+
| every 2 hours at :30 | `hourly /2 :30 (UTC)` | `{frequency:"hourly", intervalHours:2, minuteOfHour:30}` |
|
|
48
|
+
| every day at 10am (Asia/Tokyo) | `daily 10:00 (Asia/Tokyo)` | `{frequency:"daily", time:"10:00", timezone:"Asia/Tokyo"}` |
|
|
49
|
+
| every Monday 9am | `weekly Mon 09:00` | `{frequency:"weekly", time:"09:00", timezone:<user tz>, daysOfWeek:[1]}` |
|
|
50
|
+
| every weekday at 8am | `weekdays 08:00` | `{frequency:"weekly", time:"08:00", timezone:<user tz>, daysOfWeek:[1,2,3,4,5]}` |
|
|
51
|
+
| 1st of every month at noon | `monthly day 1 12:00` | `{frequency:"monthly", time:"12:00", timezone:<user tz>, daysOfMonth:[1]}` |
|
|
52
|
+
| 25th of every month at 21:00 | `monthly day 25 21:00` | `{frequency:"monthly", time:"21:00", timezone:<user tz>, daysOfMonth:[25]}` |
|
|
53
|
+
| last day of every month at 21:00 | `monthly last 21:00` | `{frequency:"monthly", time:"21:00", timezone:<user tz>, daysOfMonth:[31], onMissingDay:"lastDayOfMonth"}` |
|
|
54
|
+
| every 5 minutes | _not representable_ | _refuse — sub-hour cadences are not supported_ |
|
|
55
|
+
|
|
56
|
+
## Consumer-specific refusal — managed-tasks only
|
|
57
|
+
|
|
58
|
+
The managed-tasks skill (`mt_<n>` rows) refuses sub-daily cadences
|
|
59
|
+
because app-fetch correctness requires a daily-or-coarser window to
|
|
60
|
+
amortise rate limits and to map cleanly onto the entity-mirror's
|
|
61
|
+
daily granularity. Schedule callers (`/api/schedule`,
|
|
62
|
+
`/api/recurring-schedules`) have no such constraint and may use any
|
|
63
|
+
of the four frequencies the engine accepts.
|
|
64
|
+
|
|
65
|
+
### managed-tasks sub-daily refusal — DM template
|
|
66
|
+
|
|
67
|
+
> Managed tasks only support daily, weekly, or monthly cadences.
|
|
68
|
+
> "every hour" / "every 5 minutes" is too tight for a recurring app
|
|
69
|
+
> fetch — pick `daily` or coarser. (If you want a daemon-internal
|
|
70
|
+
> hourly check, use `/api/recurring-schedules` via the `schedule`
|
|
71
|
+
> skill.)
|
|
72
|
+
|
|
73
|
+
Same template applies to "every 5 minutes", "every 30 minutes",
|
|
74
|
+
"every 2 hours", etc. when the registering surface is managed-tasks.
|
|
75
|
+
|
|
76
|
+
## Cadence string vs structured rule
|
|
77
|
+
|
|
78
|
+
Always send both `cadence` (human-readable, rendered in
|
|
79
|
+
`rules/management.md` §B) and `recurrenceRule` (structured, what the
|
|
80
|
+
scheduler executes). They must agree — if they drift, the rendered
|
|
81
|
+
file misleads the user about what the scheduler will actually do.
|
|
82
|
+
|
|
83
|
+
When the user modifies just the time (`"9am instead of 10am"`),
|
|
84
|
+
send the new `cadence` and new `recurrenceRule` together in the same
|
|
85
|
+
PATCH so the §B label matches the executable schedule in one
|
|
86
|
+
transition.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: management-policy
|
|
3
|
-
description: Capture a durable management rule from a DM —
|
|
4
|
-
when_to_use: Wires policy file + linked routine + dossier together. SKIP for one-off `schedule`, tone preferences, or single user facts (`user-profile`).
|
|
3
|
+
description: Capture a durable management rule from a DM — 'every morning X', 'from now on when Y', pause/resume/remove. Wires policy file + linked routine + dossier together. SKIP for one-off `schedule`, tone/style (character), or single user facts (`user-profile`).
|
|
5
4
|
allowed-tools:
|
|
6
5
|
- Bash(curl *)
|
|
7
6
|
- Read
|
|
@@ -116,86 +115,12 @@ saved. The slug must:
|
|
|
116
115
|
|
|
117
116
|
### Step 5 — Wire the dependencies (strict order; on failure, roll back in reverse)
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
5.1 dossier → 5.2 routine → 5.3 policy file → 5.4 (auto-index — no
|
|
119
|
+
manual step). Each step gates the next. The full curl recipes,
|
|
120
|
+
when-to-skip rules, and rollback table are in the policy-workflow
|
|
121
|
+
reference below.
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Optional — only if the policy accumulates data into a new topic.
|
|
126
|
-
curl -sS -X PUT http://localhost:8321/api/context/dossiers/<topic> \
|
|
127
|
-
-H 'Content-Type: application/json' \
|
|
128
|
-
-d @- <<'JSON'
|
|
129
|
-
{"content":"---\ntype: dossier\nowner: agent\nupdated: 2026-04-24\n---\n# <Topic>\n\n## Daily Log\n"}
|
|
130
|
-
JSON
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Skip this step if `linked.dossier` is not set or the dossier already
|
|
134
|
-
exists. The dossier file is data only — no harm if it ends up empty
|
|
135
|
-
when the rest of the flow rolls back.
|
|
136
|
-
|
|
137
|
-
#### 5.2 Create the custom routine (if scheduling is needed)
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
curl -sS -X PUT http://localhost:8321/api/context/routines/custom/<slug> \
|
|
141
|
-
-H 'Content-Type: application/json' \
|
|
142
|
-
-d @- <<'JSON'
|
|
143
|
-
{"content":"---\ntype: rule\nslug: <slug>\nprocess_key: routine.custom.<slug>\ncron: \"0 7 * * *\"\nbackend_tier: light\nmax_budget_usd: 0.20\nenabled: true\n---\n# <Title>\n\n## Checks\n\n### <step label>\n**Action**: …\n"}
|
|
144
|
-
JSON
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The route's `onCustomRoutinesChanged` hook reloads the cron scheduler
|
|
148
|
-
automatically — no separate reload call.
|
|
149
|
-
|
|
150
|
-
Skip this step if the policy is purely passive (e.g. "from now on, when
|
|
151
|
-
the user mentions X in DM, also …"). In that case the policy file
|
|
152
|
-
itself documents the rule and the relevant DM/event task-flow picks it
|
|
153
|
-
up via the global injection.
|
|
154
|
-
|
|
155
|
-
#### 5.3 Create the policy file
|
|
156
|
-
|
|
157
|
-
`origin` MUST be a **single-line** YAML scalar. The frontmatter
|
|
158
|
-
extractor is line-scalar only — block scalars (`origin: |`, `origin: >`)
|
|
159
|
-
are silently truncated to the marker character and the validator
|
|
160
|
-
rejects them. If the user's message is too long for one line, write a
|
|
161
|
-
short summary in `origin` and put the verbatim quote in a body section
|
|
162
|
-
called `## Captured From`.
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
curl -sS -X PUT http://localhost:8321/api/context/rules/policies/<slug> \
|
|
166
|
-
-H 'Content-Type: application/json' \
|
|
167
|
-
-d @- <<'JSON'
|
|
168
|
-
{"content":"---\ntype: rule\nkind: policy\nowner: agent\nupdated: 2026-04-24\nslug: <slug>\nstatus: active\ncreated_at: 2026-04-24\ncreated_via: dm\norigin: \"User DM 2026-04-24T14:30Z: <one-line summary or short quote>\"\nlinked:\n routine: <slug>\n dossier: <topic>\ntemplate_version: 1\n---\n# <Title>\n\n## Why\n<one short paragraph>\n\n## How\n1. …\n\n## Source of Truth\n- Authoritative: …\n- Local cache: dossiers/<topic>.md\n\n## Captured From\n> <verbatim DM quote, only when too long for the origin line>\n\n## Notes\n- …\n"}
|
|
169
|
-
JSON
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
The global FS-watch reconciler picks this up within ~1s and the policy
|
|
173
|
-
appears in `context-index.md` automatically. The policy-index
|
|
174
|
-
reconciler also fires on the same FS event (chained off the same
|
|
175
|
-
debounce), so `rules/policies/_index.md` and `rules/management.md`'s
|
|
176
|
-
`## Active Policies` section refresh within ~10 s — no manual PATCH
|
|
177
|
-
needed.
|
|
178
|
-
|
|
179
|
-
The `linked:` mapping uses nested YAML for human/LLM readability. The
|
|
180
|
-
daemon's frontmatter validator does not parse nested keys, but the
|
|
181
|
-
**policy-index reconciler does** — it reads `linked.routine` to
|
|
182
|
-
populate the cadence column (by reading the routine file's `cron`
|
|
183
|
-
field) and `linked.dossier` for the dossier column. Keep the slug
|
|
184
|
-
values aligned with the filenames you created at 5.1 / 5.2 so the
|
|
185
|
-
reconciler can resolve them.
|
|
186
|
-
|
|
187
|
-
#### 5.4 _(no manual step required)_
|
|
188
|
-
|
|
189
|
-
`rules/policies/_index.md` is auto-maintained by the daemon's
|
|
190
|
-
policy-index reconciler — it re-renders within ~10 s of step 5.3's
|
|
191
|
-
write. Same for the `## Active Policies` section in
|
|
192
|
-
`rules/management.md`. Do not PATCH or PUT either path manually; doing
|
|
193
|
-
so just races the reconciler and creates snapshot churn.
|
|
194
|
-
|
|
195
|
-
If you need to confirm the index is up to date before replying to the
|
|
196
|
-
user, GET `rules/policies/_index` after a short wait. The reconciler's
|
|
197
|
-
last-run record lives at runtime_state key
|
|
198
|
-
`reconciler.policy_index.last_run` for diagnostics.
|
|
123
|
+
{{> ref:policy-workflow }}
|
|
199
124
|
|
|
200
125
|
### Step 6 — Confirm to the user (one DM)
|
|
201
126
|
|
|
@@ -273,34 +198,37 @@ is intentionally not whitelisted (see MANAGEMENT-POLICY-CAPTURE-PLAN
|
|
|
273
198
|
- **Need a one-off wake-up?** Use `schedule` (`/api/schedule` or
|
|
274
199
|
`/api/schedule/dm`) — no policy file needed.
|
|
275
200
|
- **Need a recurring DB-driven task with no recorded `## Why`?** Use
|
|
276
|
-
`schedule`'s `/api/recurring-schedules
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
201
|
+
`schedule`'s `/api/recurring-schedules` — supports hourly / daily /
|
|
202
|
+
weekly / monthly cadences. Default to `tier:"medium"`; pin a
|
|
203
|
+
specific model id (`claude-opus-4-7`, `gpt-5.4`, …) only when the
|
|
204
|
+
rule needs to outlive a `/settings/models` re-route.
|
|
205
|
+
- **Tone / voice / language preference?** Belongs in `user-profile`
|
|
206
|
+
(which routes to `PATCH /api/config/character`), NOT a policy file.
|
|
207
|
+
Full recipe in `user-profile/references/character-preferences.md`.
|
|
208
|
+
|
|
209
|
+
## API surface
|
|
210
|
+
|
|
211
|
+
All writes go through `/api/context/*` — see the **context** skill's
|
|
212
|
+
`references/api.md` for verb / mode / error envelope details. This
|
|
213
|
+
skill targets these paths:
|
|
214
|
+
|
|
215
|
+
- `GET /api/context/rules/policies/_index` (Step 1 summary)
|
|
216
|
+
- `GET /api/context/list/rules` (Step 1 authoritative — entries prefixed `policies/`)
|
|
217
|
+
- `GET /api/context/rules/policies/<slug>` (read before pause / resume / remove)
|
|
218
|
+
- `PUT /api/context/dossiers/<topic>` (Step 5.1 — if new)
|
|
219
|
+
- `PUT /api/context/routines/custom/<slug>` (Step 5.2 — if scheduling)
|
|
220
|
+
- `PUT /api/context/rules/policies/<slug>` (Step 5.3)
|
|
221
|
+
- `PATCH /api/context/rules/policies/<slug>` (pause / resume / remove; frontmatter via GET-merge-PUT only — line-scalar parser)
|
|
222
|
+
- `DELETE /api/context/routines/custom/<slug>` (remove only)
|
|
295
223
|
|
|
296
224
|
`rules/policies/_index.md` and the `## Active Policies` section in
|
|
297
225
|
`rules/management.md` are written by the daemon's policy-index
|
|
298
|
-
reconciler — they are NOT in the agent's write surface for this
|
|
299
|
-
skill.
|
|
226
|
+
reconciler — they are NOT in the agent's write surface for this skill.
|
|
300
227
|
|
|
301
|
-
Frontmatter validation enforces `kind: policy`, `owner: agent`, and
|
|
302
|
-
slug rules
|
|
303
|
-
surface that text to the user verbatim rather than retrying
|
|
228
|
+
Frontmatter validation enforces `kind: policy`, `owner: agent`, and
|
|
229
|
+
the slug rules in Step 4. Malformed writes return 422 with the failing
|
|
230
|
+
field — surface that text to the user verbatim rather than retrying
|
|
231
|
+
blindly.
|
|
304
232
|
|
|
305
233
|
## Policy file section shape (auto-curated)
|
|
306
234
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: reference
|
|
3
|
+
name: policy-workflow
|
|
4
|
+
description: Step 5.1-5.4 dossier → routine → policy file → auto-index fan-out, with curl recipes and rollback ordering.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 5 fan-out — dossier → routine → policy file → auto-index
|
|
8
|
+
|
|
9
|
+
Each step gates the next. If step `N` fails, attempt to roll back
|
|
10
|
+
steps `N-1 … 1` in reverse before reporting the failure to the user.
|
|
11
|
+
|
|
12
|
+
## 5.1 Create the dossier (only if it doesn't exist)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Optional — only if the policy accumulates data into a new topic.
|
|
16
|
+
curl -sS -X PUT http://localhost:8321/api/context/dossiers/<topic> \
|
|
17
|
+
-H 'Content-Type: application/json' \
|
|
18
|
+
-d @- <<'JSON'
|
|
19
|
+
{"content":"---\ntype: dossier\nowner: agent\nupdated: 2026-04-24\n---\n# <Topic>\n\n## Daily Log\n"}
|
|
20
|
+
JSON
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Skip this step if `linked.dossier` is not set or the dossier already
|
|
24
|
+
exists. The dossier file is data only — no harm if it ends up empty
|
|
25
|
+
when the rest of the flow rolls back.
|
|
26
|
+
|
|
27
|
+
## 5.2 Create the custom routine (only if scheduling is needed)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
curl -sS -X PUT http://localhost:8321/api/context/routines/custom/<slug> \
|
|
31
|
+
-H 'Content-Type: application/json' \
|
|
32
|
+
-d @- <<'JSON'
|
|
33
|
+
{"content":"---\ntype: rule\nslug: <slug>\nprocess_key: routine.custom.<slug>\ncron: \"0 7 * * *\"\nbackend_tier: light\nmax_budget_usd: 0.20\nenabled: true\n---\n# <Title>\n\n## Checks\n\n### <step label>\n**Action**: …\n"}
|
|
34
|
+
JSON
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The route's `onCustomRoutinesChanged` hook reloads the cron scheduler
|
|
38
|
+
automatically — no separate reload call.
|
|
39
|
+
|
|
40
|
+
Skip this step if the policy is purely passive (e.g. "from now on,
|
|
41
|
+
when the user mentions X in DM, also …"). The policy file itself
|
|
42
|
+
documents the rule and the relevant DM / event task-flow picks it up
|
|
43
|
+
via the global injection.
|
|
44
|
+
|
|
45
|
+
## 5.3 Create the policy file
|
|
46
|
+
|
|
47
|
+
`origin` MUST be a **single-line** YAML scalar. The frontmatter
|
|
48
|
+
extractor is line-scalar only — block scalars (`origin: |`,
|
|
49
|
+
`origin: >`) are silently truncated to the marker character and the
|
|
50
|
+
validator rejects them. If the user's message is too long for one
|
|
51
|
+
line, write a short summary in `origin` and put the verbatim quote in
|
|
52
|
+
a body section called `## Captured From`.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
curl -sS -X PUT http://localhost:8321/api/context/rules/policies/<slug> \
|
|
56
|
+
-H 'Content-Type: application/json' \
|
|
57
|
+
-d @- <<'JSON'
|
|
58
|
+
{"content":"---\ntype: rule\nkind: policy\nowner: agent\nupdated: 2026-04-24\nslug: <slug>\nstatus: active\ncreated_at: 2026-04-24\ncreated_via: dm\norigin: \"User DM 2026-04-24T14:30Z: <one-line summary or short quote>\"\nlinked:\n routine: <slug>\n dossier: <topic>\ntemplate_version: 1\n---\n# <Title>\n\n## Why\n<one short paragraph>\n\n## How\n1. …\n\n## Source of Truth\n- Authoritative: …\n- Local cache: dossiers/<topic>.md\n\n## Captured From\n> <verbatim DM quote, only when too long for the origin line>\n\n## Notes\n- …\n"}
|
|
59
|
+
JSON
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The global FS-watch reconciler picks this up within ~1 s and the
|
|
63
|
+
policy appears in `context-index.md` automatically. The policy-index
|
|
64
|
+
reconciler also fires on the same FS event (chained off the same
|
|
65
|
+
debounce), so `rules/policies/_index.md` and `rules/management.md`'s
|
|
66
|
+
`## Active Policies` section refresh within ~10 s — no manual PATCH
|
|
67
|
+
needed.
|
|
68
|
+
|
|
69
|
+
The `linked:` mapping uses nested YAML for human / LLM readability.
|
|
70
|
+
The daemon's frontmatter validator does not parse nested keys, but
|
|
71
|
+
the **policy-index reconciler does** — it reads `linked.routine` to
|
|
72
|
+
populate the cadence column (by reading the routine file's `cron`
|
|
73
|
+
field) and `linked.dossier` for the dossier column. Keep the slug
|
|
74
|
+
values aligned with the filenames you created at 5.1 / 5.2 so the
|
|
75
|
+
reconciler can resolve them.
|
|
76
|
+
|
|
77
|
+
## 5.4 _(no manual step required)_
|
|
78
|
+
|
|
79
|
+
`rules/policies/_index.md` is auto-maintained by the daemon's
|
|
80
|
+
policy-index reconciler — it re-renders within ~10 s of step 5.3's
|
|
81
|
+
write. Same for the `## Active Policies` section in
|
|
82
|
+
`rules/management.md`. **Do not PATCH or PUT either path manually**;
|
|
83
|
+
doing so just races the reconciler and creates snapshot churn.
|
|
84
|
+
|
|
85
|
+
If you need to confirm the index is up to date before replying to the
|
|
86
|
+
user, GET `rules/policies/_index` after a short wait. The
|
|
87
|
+
reconciler's last-run record lives at `runtime_state` key
|
|
88
|
+
`reconciler.policy_index.last_run` for diagnostics.
|
|
89
|
+
|
|
90
|
+
## Rollback table
|
|
91
|
+
|
|
92
|
+
| Failure at | Roll back |
|
|
93
|
+
|---|---|
|
|
94
|
+
| 5.2 | undo 5.1 (`DELETE` the dossier file you just created — only if you created it; do not delete a pre-existing dossier) |
|
|
95
|
+
| 5.3 | undo 5.2 (PUT routines file back to `enabled: false` and the next reconcile clears the cron job; or `DELETE` if you created it new), then undo 5.1 as above |
|
|
96
|
+
| 5.4 | none required — there is no manual 5.4. If the reconciler does not pick the change up within ~30 s, surface the diagnostics record (`runtime_state` key above) to the user rather than rolling back. |
|
|
97
|
+
|
|
98
|
+
If any rollback step itself fails, **report the partial state to the
|
|
99
|
+
user verbatim** (which slugs / files are in which state) rather than
|
|
100
|
+
silently re-attempting. The user can then decide whether to retry,
|
|
101
|
+
hand-edit, or accept the partial.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: notify
|
|
3
3
|
description: Load whenever composing user-facing text — DMs, notifications, briefings, replies, observer alerts. Owns awareness gate + /api/notify.
|
|
4
|
-
when_to_use: Universal message discipline — awareness gate, no ceremony, no readback. Also covers the evening wrap-up contract and quiet-hours flushing.
|
|
5
4
|
allowed-tools:
|
|
6
5
|
- Bash(curl *)
|
|
7
6
|
- Read
|
|
@@ -16,8 +15,8 @@ A bad notification (noisy, poorly timed, unclear) is worse than no notification.
|
|
|
16
15
|
Every user-facing message — `/api/notify` call, `scheduled.dm`
|
|
17
16
|
final-text DM (Morning briefing), `scheduled.task` final-text DM,
|
|
18
17
|
message.received reply, observer alert — must clear the gates below.
|
|
19
|
-
Specific contracts (
|
|
20
|
-
|
|
18
|
+
Specific contracts (Morning briefing) layer additional rules on top;
|
|
19
|
+
nothing they say overrides a universal rule.
|
|
21
20
|
|
|
22
21
|
### Awareness gate
|
|
23
22
|
|
|
@@ -102,89 +101,18 @@ Notify when **all three** are true: (1) **actionable** or requires awareness, (2
|
|
|
102
101
|
- **Routine file changes** or **agent internal state** — use Agent Log instead
|
|
103
102
|
- **When in doubt — prefer silence**
|
|
104
103
|
|
|
105
|
-
Rate-limit defaults: 3/hour, 12/day. The agent CANNOT query
|
|
106
|
-
`notification_log` directly (Approve-tier); use `<today>` `## Agent
|
|
107
|
-
Log` as the authoritative dedup source.
|
|
108
|
-
|
|
109
104
|
## Priority
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
| `high` | Hard deadlines, urgent messages, meeting starting now | Bypasses |
|
|
115
|
-
| `normal` | Regular reminders, summaries, evening wrap-up | Respects (dropped) |
|
|
116
|
-
| `low` | Background updates, informational FYI | Respects (dropped) |
|
|
106
|
+
**Default to `normal`.** Reserve `high` for 8h-delay-matters. Reserve
|
|
107
|
+
`critical` for 3am-matters. Full per-level table, examples, and
|
|
108
|
+
rate-limit caps are in the priority reference below.
|
|
117
109
|
|
|
118
|
-
|
|
110
|
+
{{> ref:priority }}
|
|
119
111
|
|
|
120
112
|
## Style
|
|
121
113
|
|
|
122
114
|
One notification per task, under 5 bullets, lead with the action, follow the Character block. Actionable > informational: "3 emails from boss — 1 asks for Q2 plan by EOD" beats "3 emails from boss".
|
|
123
115
|
|
|
124
|
-
## Evening wrap-up contract
|
|
125
|
-
|
|
126
|
-
Used by `routine.evening_review`. The prompt owns go/no-go (silence is
|
|
127
|
-
the default; see Step 4a's awareness gate). This section owns format
|
|
128
|
-
rules for the rare evening where the gate plus a positive trigger
|
|
129
|
-
clears the bar.
|
|
130
|
-
|
|
131
|
-
### Content (follows `<output_language_policy>`)
|
|
132
|
-
|
|
133
|
-
1. **The agent-discovered thing the user needs to know** — the
|
|
134
|
-
specific item that cleared the awareness gate. Lead with substance.
|
|
135
|
-
2. **What's still open** — at most 2 carry-overs with brief reason.
|
|
136
|
-
Omit if nothing.
|
|
137
|
-
3. **What's next** — only if the agent learned something new today
|
|
138
|
-
that affects tomorrow. Omit if it's just the user's own calendar
|
|
139
|
-
reading back to them.
|
|
140
|
-
|
|
141
|
-
Optional 4th line: brief acknowledgement if today was emotionally
|
|
142
|
-
significant.
|
|
143
|
-
|
|
144
|
-
### Format — hard limits
|
|
145
|
-
|
|
146
|
-
- **Maximum 4 short lines.** No markdown headers. No bullet list > 2 items.
|
|
147
|
-
- **No ceremony.** Open with substance, not "Evening Review complete",
|
|
148
|
-
"Summary:", or "Evening check-in —". Any opener that announces the
|
|
149
|
-
routine itself rather than the content is forbidden.
|
|
150
|
-
- **No internal names.** Never mention `today.md`, `user/profile.md`, `roadmap.md`, `## Handoff`, `## Agent Plan`, `## Agent Log`, `did-not-fire`, or "Evening Review".
|
|
151
|
-
- **Don't enumerate agent actions.** Surface only what the user would
|
|
152
|
-
forget by morning AND only things the user couldn't already know
|
|
153
|
-
from their own calendar / syllabus / scheduled events.
|
|
154
|
-
- **No filler timing commentary** ("Still about 6 hours to go", "Just
|
|
155
|
-
a heads-up", etc.) — if the timing matters, the deadline itself
|
|
156
|
-
carries it.
|
|
157
|
-
- **Priority `high`.** The awareness gate raises the bar high enough
|
|
158
|
-
that anything reaching the user tonight genuinely deserves to. One
|
|
159
|
-
notification per evening.
|
|
160
|
-
|
|
161
|
-
### Examples
|
|
162
|
-
|
|
163
|
-
**Good** (agent surfaced something from new mail today that the user
|
|
164
|
-
hasn't seen yet):
|
|
165
|
-
```
|
|
166
|
-
Sarah's reply on the API spec landed at 6pm — she's blocking on your call on the auth contract before tomorrow's standup.
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Bad — ceremony + internal-state recap:**
|
|
170
|
-
```
|
|
171
|
-
Evening Review complete. Summary:
|
|
172
|
-
today.md updates: Agent Plan rows closed as did-not-fire, Handoff carried over.
|
|
173
|
-
user/profile.md: Raw Signals cleared.
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Bad — agent reading the user's own calendar back to them** (the
|
|
177
|
-
exact shape the user has flagged as unwanted; every element fails the
|
|
178
|
-
awareness gate or the no-ceremony rule):
|
|
179
|
-
```
|
|
180
|
-
Evening check-in — [408019] Week 3 deadline tonight at 11:59pm PT:
|
|
181
|
-
Procurement Plan, RACI Chart, Resource Plan. Still about 6 hours to go.
|
|
182
|
-
Tomorrow: Agile class 6–9pm @ UCLA Extension Gayley.
|
|
183
|
-
```
|
|
184
|
-
The course assignment deadline is on the user's own syllabus and the
|
|
185
|
-
class is on their own calendar — both fail the awareness gate. The
|
|
186
|
-
correct response is silence + one line in ## Agent Log.
|
|
187
|
-
|
|
188
116
|
## API Reference — POST /api/notify
|
|
189
117
|
|
|
190
118
|
```bash
|