@aitne-sh/aitne 0.1.7 → 0.1.9
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 +256 -833
- package/agent-assets/agent-profiles/_safety.md +52 -20
- package/agent-assets/agent-profiles/browser-task.md +108 -0
- package/agent-assets/agent-profiles/conversational.md +3 -3
- package/agent-assets/agent-profiles/profile-importer.md +3 -3
- package/agent-assets/agent-profiles/routine-fetch-window.md +30 -19
- package/agent-assets/agent-profiles/routine.md +4 -3
- package/agent-assets/agents/context-index-reconcile/agent.md +52 -0
- package/agent-assets/agents/evening-review/agent.md +53 -0
- package/agent-assets/agents/hourly-check/agent.md +62 -0
- package/agent-assets/agents/monthly-review/agent.md +55 -0
- package/agent-assets/agents/morning-routine/agent.md +78 -0
- package/agent-assets/agents/roadmap-maintenance/agent.md +52 -0
- package/agent-assets/agents/skill-curation/agent.md +52 -0
- package/agent-assets/agents/user-profile-sweep-evening/agent.md +48 -0
- package/agent-assets/agents/user-profile-sweep-morning/agent.md +53 -0
- package/agent-assets/agents/weekly-review/agent.md +51 -0
- package/agent-assets/docs/concepts/agent-day.md +18 -11
- package/agent-assets/docs/concepts/auth-health.md +56 -10
- package/agent-assets/docs/concepts/backends-and-tiers.md +110 -41
- package/agent-assets/docs/concepts/costs-and-quotas.md +74 -19
- package/agent-assets/docs/concepts/delegated-mode.md +193 -75
- package/agent-assets/docs/concepts/memory-model.md +79 -34
- package/agent-assets/docs/concepts/observations.md +61 -11
- package/agent-assets/docs/concepts/process-keys.md +66 -17
- package/agent-assets/docs/concepts/routines.md +77 -32
- package/agent-assets/docs/concepts/safety-and-execution.md +50 -21
- package/agent-assets/docs/concepts/safety-model.md +62 -37
- package/agent-assets/docs/concepts/skills.md +38 -17
- package/agent-assets/docs/features/integrations/browser-history.md +195 -0
- package/agent-assets/docs/features/integrations/calendar.md +40 -30
- package/agent-assets/docs/features/integrations/git.md +20 -9
- package/agent-assets/docs/features/integrations/github.md +93 -35
- package/agent-assets/docs/features/integrations/mail.md +60 -17
- package/agent-assets/docs/features/integrations/notion.md +51 -11
- package/agent-assets/docs/features/integrations/obsidian.md +35 -7
- package/agent-assets/docs/features/lifestyle/git.md +45 -44
- package/agent-assets/docs/features/lifestyle/reading.md +50 -22
- package/agent-assets/docs/features/lifestyle/receipts.md +66 -21
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +91 -14
- package/agent-assets/docs/features/memory-files/agent-journal.md +111 -50
- package/agent-assets/docs/features/memory-files/projects.md +75 -15
- package/agent-assets/docs/features/memory-files/roadmap.md +55 -10
- package/agent-assets/docs/features/memory-files/schedule.md +113 -70
- package/agent-assets/docs/features/memory-files/today.md +47 -21
- package/agent-assets/docs/features/memory-files/user-profile.md +67 -31
- package/agent-assets/docs/features/messaging/bang-commands.md +115 -28
- package/agent-assets/docs/features/messaging/dashboard-chat.md +43 -21
- package/agent-assets/docs/features/messaging/discord.md +46 -4
- package/agent-assets/docs/features/messaging/overview.md +40 -19
- package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +94 -27
- package/agent-assets/docs/features/messaging/slack.md +79 -14
- package/agent-assets/docs/features/messaging/telegram.md +25 -6
- package/agent-assets/docs/features/messaging/whatsapp.md +79 -14
- package/agent-assets/docs/features/operations/activity-and-conversations.md +45 -16
- package/agent-assets/docs/features/operations/approvals.md +53 -15
- package/agent-assets/docs/features/operations/backend-routing.md +75 -16
- package/agent-assets/docs/features/operations/cost-tracking.md +90 -17
- package/agent-assets/docs/features/operations/managed-chromium.md +221 -0
- package/agent-assets/docs/features/operations/notifications.md +58 -11
- package/agent-assets/docs/features/operations/quiet-hours.md +63 -40
- package/agent-assets/docs/features/operations/schedule-approaching.md +59 -16
- package/agent-assets/docs/features/routines/custom-routines.md +97 -23
- package/agent-assets/docs/features/routines/evening-review.md +75 -22
- package/agent-assets/docs/features/routines/hourly-check.md +150 -30
- package/agent-assets/docs/features/routines/morning-routine.md +60 -33
- package/agent-assets/docs/features/routines/weekly-review.md +65 -20
- package/agent-assets/docs/features/wiki/commands.md +37 -16
- package/agent-assets/docs/features/wiki/cost-and-approval.md +240 -0
- package/agent-assets/docs/features/wiki/dashboard.md +255 -0
- package/agent-assets/docs/features/wiki/overview.md +80 -12
- package/agent-assets/docs/features/wiki/search.md +248 -0
- package/agent-assets/docs/features/wiki/workspaces.md +254 -0
- package/agent-assets/docs/getting-started/01-what-is-this.md +64 -32
- package/agent-assets/docs/getting-started/02-first-steps.md +28 -10
- package/agent-assets/docs/getting-started/03-what-can-this-do.md +42 -21
- package/agent-assets/docs/getting-started/04-first-day.md +52 -20
- package/agent-assets/docs/glossary.md +285 -21
- package/agent-assets/docs/guides/add-a-custom-routine.md +74 -22
- package/agent-assets/docs/guides/backup-and-restore.md +92 -14
- package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +62 -25
- package/agent-assets/docs/guides/build-your-wiki.md +33 -6
- package/agent-assets/docs/guides/change-which-model-handles-x.md +70 -9
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +80 -15
- package/agent-assets/docs/guides/explore-with-trace-and-connect.md +32 -9
- package/agent-assets/docs/guides/import-knowledge-file.md +60 -39
- package/agent-assets/docs/guides/install-and-run.md +64 -19
- package/agent-assets/docs/guides/maintain-wiki-health.md +41 -10
- package/agent-assets/docs/guides/migrate-machines.md +86 -18
- package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +119 -59
- package/agent-assets/docs/guides/pause-the-agent.md +71 -22
- package/agent-assets/docs/guides/reinstall-cleanly.md +102 -17
- package/agent-assets/docs/guides/setup-wizard.md +126 -56
- package/agent-assets/docs/guides/switch-default-backend.md +72 -17
- package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +31 -10
- package/agent-assets/docs/reference/api.md +162 -23
- package/agent-assets/docs/reference/cli-commands.md +55 -15
- package/agent-assets/docs/reference/config.md +246 -39
- package/agent-assets/docs/reference/disallowed-tools.md +42 -10
- package/agent-assets/docs/reference/keyboard-shortcuts.md +47 -10
- package/agent-assets/docs/reference/knowledge-layout.md +620 -0
- package/agent-assets/docs/reference/process-keys.md +126 -20
- package/agent-assets/docs/reference/skills.md +62 -18
- package/agent-assets/docs/troubleshooting/auth-failed.md +53 -19
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +96 -22
- package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +94 -20
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +77 -22
- package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +87 -22
- package/agent-assets/docs/troubleshooting/observation-not-detected.md +85 -21
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +36 -6
- package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +128 -51
- package/agent-assets/docs/troubleshooting/wiki-write-failed.md +33 -11
- package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
- package/agent-assets/sandbox/linux/aitne-chromium.apparmor +91 -0
- package/agent-assets/sandbox/macos/aitne-chromium.sb +156 -0
- package/agent-assets/skills/agent-actions/SKILL.md +122 -0
- package/agent-assets/skills/agent-create/SKILL.md +149 -0
- package/agent-assets/skills/attach/SKILL.md +3 -4
- package/agent-assets/skills/browser-history/SKILL.md +198 -0
- package/agent-assets/skills/browser-history-respond/SKILL.md +106 -0
- package/agent-assets/skills/browser-task/SKILL.md +169 -0
- package/agent-assets/skills/context/SKILL.md +45 -463
- package/agent-assets/skills/context/curation.json +2 -2
- package/agent-assets/skills/context/references/api.md +232 -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 +4 -4
- package/agent-assets/skills/docs-search/SKILL.md +17 -16
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +14 -26
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +14 -26
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +14 -26
- package/agent-assets/skills/external-services/SKILL.md +9 -262
- package/agent-assets/skills/external-services/SKILL.native.claude.md +6 -7
- package/agent-assets/skills/external-services/SKILL.native.codex.md +8 -9
- package/agent-assets/skills/external-services/SKILL.native.gemini.md +5 -6
- 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 +151 -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/mail/SKILL.delegated.claude.md +15 -6
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +9 -5
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +9 -5
- 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 +110 -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 +73 -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 +54 -125
- package/agent-assets/skills/management-policy/curation.json +1 -1
- package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
- package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +1 -1
- package/agent-assets/skills/notify/SKILL.md +10 -82
- package/agent-assets/skills/notify/references/priority.md +65 -0
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +2 -2
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +2 -2
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +2 -2
- package/agent-assets/skills/notion/SKILL.md +6 -10
- package/agent-assets/skills/notion/SKILL.native.claude.md +11 -8
- package/agent-assets/skills/notion/SKILL.native.codex.md +10 -6
- package/agent-assets/skills/notion/SKILL.native.gemini.md +10 -6
- package/agent-assets/skills/observations/SKILL.md +25 -14
- package/agent-assets/skills/project-doc/SKILL.md +2 -6
- package/agent-assets/skills/project-doc/curation.json +3 -3
- package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +7 -4
- package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
- package/agent-assets/skills/reading/SKILL.md +12 -2
- package/agent-assets/skills/reading/references/reading-taste.md +2 -2
- package/agent-assets/skills/roadmap/SKILL.md +43 -141
- package/agent-assets/skills/roadmap/curation.json +1 -1
- package/agent-assets/skills/roadmap/references/api.md +100 -0
- package/agent-assets/skills/roadmap/references/cross-check.md +80 -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/roadmap/seeds/entry-types.seed.json +1 -1
- package/agent-assets/skills/schedule/SKILL.md +76 -104
- package/agent-assets/skills/schedule/references/batch.md +93 -0
- package/agent-assets/skills/schedule/references/errors.md +217 -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/scheduled-managed-task/SKILL.md +59 -51
- package/agent-assets/skills/today/SKILL.md +32 -62
- package/agent-assets/skills/today/curation.json +3 -3
- package/agent-assets/skills/today/references/agent-plan-lifecycle.md +114 -0
- package/agent-assets/skills/today/seeds/section-shape.seed.json +1 -1
- package/agent-assets/skills/user-interview/SKILL.md +23 -67
- 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 +9 -1
- package/agent-assets/skills/user-profile/SKILL.md +54 -74
- package/agent-assets/skills/user-profile/curation.json +2 -2
- package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
- package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +8 -8
- package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +30 -2
- package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
- package/agent-assets/skills/wiki/wiki-compile/SKILL.md +4 -5
- 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 +78 -0
- package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
- package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +20 -11
- package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +18 -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 +18 -9
- package/agent-assets/task-flows/_partials/notion-acquire.notion.md +26 -15
- package/agent-assets/task-flows/browser_task.md +84 -0
- package/agent-assets/task-flows/github.assigned.md +1 -1
- package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
- package/agent-assets/task-flows/github.workflow_run.failed.md +2 -2
- package/agent-assets/task-flows/knowledge.import.md +15 -15
- package/agent-assets/task-flows/message.received.dm.md +20 -17
- package/agent-assets/task-flows/message.received.dm_first.md +11 -15
- package/agent-assets/task-flows/routine.custom.md +6 -4
- package/agent-assets/task-flows/routine.evening_review.md +46 -170
- package/agent-assets/task-flows/routine.fetch_window.md +19 -14
- package/agent-assets/task-flows/routine.hourly_check.md +27 -15
- package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
- package/agent-assets/task-flows/routine.monthly_review.md +67 -25
- package/agent-assets/task-flows/routine.morning_routine_journal.md +135 -0
- package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
- package/agent-assets/task-flows/routine.research_cluster_update.md +35 -0
- package/agent-assets/task-flows/routine.research_dispatch.md +38 -0
- package/agent-assets/task-flows/routine.research_offer_dm.md +125 -0
- package/agent-assets/task-flows/routine.research_wiki_summary.md +53 -0
- package/agent-assets/task-flows/routine.roadmap_refresh.md +68 -23
- package/agent-assets/task-flows/routine.today_refresh.md +4 -4
- package/agent-assets/task-flows/routine.user_profile_sweep.md +19 -20
- package/agent-assets/task-flows/routine.weekly_review.md +370 -86
- package/agent-assets/task-flows/schedule.approaching.md +0 -1
- package/agent-assets/task-flows/scheduled.dm.md +13 -13
- package/agent-assets/task-flows/scheduled.task.md +9 -9
- package/agent-assets/task-flows/setup.initial.md +171 -251
- package/agent-assets/task-flows/setup.update.md +2 -2
- package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
- package/agent-assets/templates/README.md +27 -20
- package/agent-assets/templates/_index.md +42 -26
- package/agent-assets/templates/_manifest.json +34 -99
- package/agent-assets/templates/{user → identity}/_index.md +1 -1
- package/agent-assets/templates/identity/expertise.md +9 -0
- package/agent-assets/templates/identity/goals.md +9 -0
- package/agent-assets/templates/identity/people.md +13 -0
- package/agent-assets/templates/identity/personal.md +9 -0
- package/agent-assets/templates/{user → identity}/profile.md +2 -2
- package/agent-assets/templates/identity/work.md +9 -0
- package/agent-assets/templates/{dossiers → knowledge/dossiers}/_index.md +2 -2
- package/agent-assets/templates/{projects → plans/projects}/_active.base +1 -1
- package/agent-assets/templates/policies/_index.md +21 -0
- package/agent-assets/templates/{rules → policies}/journal-export.md +1 -1
- package/agent-assets/templates/policies/journal-format.md +168 -0
- package/agent-assets/templates/{rules/policies → policies/management-captures}/_index.md +2 -2
- package/agent-assets/templates/{rules → policies}/management.md +3 -3
- package/agent-assets/templates/{rules → policies}/mcp.md +1 -1
- package/agent-assets/templates/{rules → policies}/redaction.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/_index.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/evening.md +2 -2
- package/agent-assets/templates/{routines → policies/routines}/hourly.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/monthly.md +2 -2
- package/bin/aitne.mjs +21 -5
- package/package.json +5 -4
- package/scripts/commands/doctor.mjs +63 -5
- package/scripts/commands/run-now.mjs +187 -0
- package/scripts/commands/verify.mjs +264 -0
- package/scripts/lib/ports.d.mts +27 -0
- package/scripts/lib/ports.mjs +36 -0
- package/scripts/lib/read-api-token.mjs +176 -0
- package/scripts/start.mjs +2 -1
- package/agent-assets/docs/features/lifestyle/travel-time.md +0 -52
- 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
- package/agent-assets/templates/context-index.md +0 -42
- package/agent-assets/templates/rules/_index.md +0 -19
- package/agent-assets/templates/rules/journal-format.md +0 -61
- package/agent-assets/templates/user/expertise.md +0 -7
- package/agent-assets/templates/user/goals.md +0 -7
- package/agent-assets/templates/user/people.md +0 -7
- package/agent-assets/templates/user/personal.md +0 -7
- package/agent-assets/templates/user/work.md +0 -7
- /package/agent-assets/templates/{agent/journal.md → journal/agent.md} +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/evening.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/hourly.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/monthly.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/morning.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/roadmap.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/weekly.md +0 -0
- /package/agent-assets/templates/{projects → plans/projects}/_index.md +0 -0
- /package/agent-assets/templates/{roadmap.md → plans/roadmap.md} +0 -0
- /package/agent-assets/templates/{routines → policies/routines}/morning.md +0 -0
- /package/agent-assets/templates/{routines → policies/routines}/weekly.md +0 -0
- /package/agent-assets/templates/{agent → state}/profile-questions.md +0 -0
- /package/agent-assets/templates/{today.md → state/today.md} +0 -0
|
@@ -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
|
+
`policies/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
|
|
@@ -12,17 +11,17 @@ allowed-tools:
|
|
|
12
11
|
A **management policy** is a durable, ongoing rule the user wants the
|
|
13
12
|
agent to keep applying. It is NOT a one-off task.
|
|
14
13
|
|
|
15
|
-
Each policy lives at `
|
|
14
|
+
Each policy lives at `policies/management-captures/<slug>.md` and may link to:
|
|
16
15
|
|
|
17
|
-
- `routines/custom/<slug>.md` — the cron-driven execution rulebook
|
|
18
|
-
- `dossiers/<topic>.md` — where the policy's accumulating data lands
|
|
16
|
+
- `policies/routines/custom/<slug>.md` — the cron-driven execution rulebook
|
|
17
|
+
- `knowledge/dossiers/<topic>.md` — where the policy's accumulating data lands
|
|
19
18
|
|
|
20
|
-
A readable summary of every policy lives at `
|
|
19
|
+
A readable summary of every policy lives at `policies/management-captures/_index.md`,
|
|
21
20
|
which the daemon's policy-index reconciler **auto-maintains** from the
|
|
22
|
-
policy files on disk. The directory listing under `
|
|
21
|
+
policy files on disk. The directory listing under `policies/management-captures/` is
|
|
23
22
|
the source of truth; `_index.md` is a derived snapshot — **do not
|
|
24
23
|
PATCH or PUT it by hand**. The same reconciler also re-renders the
|
|
25
|
-
`## Active Policies` section in `
|
|
24
|
+
`## Active Policies` section in `policies/management.md` so it stays in
|
|
26
25
|
sync. Both files refresh within ~10 s of any policy file write.
|
|
27
26
|
|
|
28
27
|
## When to use this skill
|
|
@@ -43,7 +42,7 @@ Use when the user expresses a **durable, ongoing management rule**:
|
|
|
43
42
|
| "Reply more tersely from now on" / tone, voice, style | `user-profile` (routes to `character`) |
|
|
44
43
|
| "I'm an NYC-based dev" / single user fact | `user-profile` |
|
|
45
44
|
| "Add a project for the Q3 roadmap" | `context` (`projects/*.md`) |
|
|
46
|
-
| Pure data write — "log this transaction" | direct context write to the relevant `dossiers/<topic>.md` |
|
|
45
|
+
| Pure data write — "log this transaction" | direct context write to the relevant `knowledge/dossiers/<topic>.md` |
|
|
47
46
|
|
|
48
47
|
If the user's request is **a recurring task with no need for a recorded
|
|
49
48
|
reason** (e.g. "ping me every Monday at 9 to start standup prep"), use
|
|
@@ -61,12 +60,12 @@ the directory listing if you need authoritative state.
|
|
|
61
60
|
```bash
|
|
62
61
|
# Auto-maintained by the daemon — fastest read for slug / status /
|
|
63
62
|
# cadence / linked routine + dossier / one-line why.
|
|
64
|
-
curl -s "http://localhost:8321/api/context/
|
|
63
|
+
curl -s "http://localhost:8321/api/context/policies/management-captures/_index"
|
|
65
64
|
|
|
66
65
|
# Directory listing — authoritative source of truth. Use this if a
|
|
67
66
|
# specific policy file looks newer than the index (the reconciler
|
|
68
67
|
# debounces ~10 s; fresh writes may not be reflected yet).
|
|
69
|
-
curl -s "http://localhost:8321/api/context/list/
|
|
68
|
+
curl -s "http://localhost:8321/api/context/list/policies"
|
|
70
69
|
```
|
|
71
70
|
|
|
72
71
|
If the listing and `_index.md` rows disagree, **prefer the listing**
|
|
@@ -104,98 +103,24 @@ wait again.
|
|
|
104
103
|
|
|
105
104
|
### Step 4 — Build the policy file
|
|
106
105
|
|
|
107
|
-
Emit the full `
|
|
106
|
+
Emit the full `policies/management-captures/<slug>.md` content as a fenced markdown
|
|
108
107
|
block in the DM **before** writing, so the user sees what's about to be
|
|
109
108
|
saved. The slug must:
|
|
110
109
|
|
|
111
110
|
- equal the filename stem
|
|
112
111
|
- match `^[a-z0-9][a-z0-9-]*[a-z0-9]$` (or a single `[a-z0-9]`)
|
|
113
112
|
- be ≤ 64 chars
|
|
114
|
-
- equal the linked `routines/custom/<slug>.md` slug (if any) — keep
|
|
113
|
+
- equal the linked `policies/routines/custom/<slug>.md` slug (if any) — keep
|
|
115
114
|
them aligned in v1
|
|
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
|
|
|
@@ -227,7 +152,7 @@ the active policies first and ask.
|
|
|
227
152
|
`updated: <today>`, PUT back. (The frontmatter parser is
|
|
228
153
|
line-scalar so a per-field PATCH section call would not target a
|
|
229
154
|
frontmatter key — always GET-merge-PUT for frontmatter edits.)
|
|
230
|
-
2. If `linked.routine` is set: GET `routines/custom/<slug>`, flip
|
|
155
|
+
2. If `linked.routine` is set: GET `policies/routines/custom/<slug>`, flip
|
|
231
156
|
frontmatter `enabled: false`, PUT back. The reload hook flips the
|
|
232
157
|
cron job off automatically.
|
|
233
158
|
|
|
@@ -248,7 +173,7 @@ Same fan-out, with `status: active` and `enabled: true`.
|
|
|
248
173
|
1. GET the policy file, flip frontmatter `status: removed` and
|
|
249
174
|
`updated: <today>`, PUT back.
|
|
250
175
|
2. If `linked.routine` is set: `DELETE
|
|
251
|
-
/api/context/routines/custom/<slug>` (whitelisted).
|
|
176
|
+
/api/context/policies/routines/custom/<slug>` (whitelisted).
|
|
252
177
|
|
|
253
178
|
The reconciler moves the row from `## Active` to `## Removed`
|
|
254
179
|
automatically — the `removedAt` cell is read from the policy file's
|
|
@@ -260,10 +185,10 @@ is intentionally not whitelisted (see MANAGEMENT-POLICY-CAPTURE-PLAN
|
|
|
260
185
|
|
|
261
186
|
## What this skill does NOT do
|
|
262
187
|
|
|
263
|
-
- Does NOT touch `
|
|
188
|
+
- Does NOT touch `policies/management.md` body sections (Source of Truth
|
|
264
189
|
table, Notification Rules, Schedule, etc.). Those are wizard-only.
|
|
265
190
|
- Does NOT create rows in the `recurring_schedules` DB table — defer to
|
|
266
|
-
`routines/custom/` for cron, which gives the user a visible MD file
|
|
191
|
+
`policies/routines/custom/` for cron, which gives the user a visible MD file
|
|
267
192
|
to edit.
|
|
268
193
|
- Does NOT migrate existing custom routines into policy files
|
|
269
194
|
retroactively. Migration is a separate one-time operation.
|
|
@@ -272,35 +197,39 @@ is intentionally not whitelisted (see MANAGEMENT-POLICY-CAPTURE-PLAN
|
|
|
272
197
|
|
|
273
198
|
- **Need a one-off wake-up?** Use `schedule` (`/api/schedule` or
|
|
274
199
|
`/api/schedule/dm`) — no policy file needed.
|
|
275
|
-
- **Need a recurring
|
|
276
|
-
`
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
`
|
|
297
|
-
`
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
200
|
+
- **Need a recurring task with no recorded `## Why`?** Recurring autonomous
|
|
201
|
+
**work** → create an Agent via the `agent-create` skill (`POST /api/agents`);
|
|
202
|
+
recurring scheduled **DM / briefing** → `schedule`'s
|
|
203
|
+
`/api/recurring-schedules` with `taskType: "dm_session"`. Default to
|
|
204
|
+
`tier:"medium"`; pin a specific model id only when the rule needs to
|
|
205
|
+
outlive a `/settings/models` re-route.
|
|
206
|
+
- **Tone / voice / language preference?** Belongs in `user-profile`
|
|
207
|
+
(which routes to `PATCH /api/config/character`), NOT a policy file.
|
|
208
|
+
Full recipe in `user-profile/references/character-preferences.md`.
|
|
209
|
+
|
|
210
|
+
## API surface
|
|
211
|
+
|
|
212
|
+
All writes go through `/api/context/*` — see the **context** skill's
|
|
213
|
+
`references/api.md` for verb / mode / error envelope details. This
|
|
214
|
+
skill targets these paths:
|
|
215
|
+
|
|
216
|
+
- `GET /api/context/policies/management-captures/_index` (Step 1 summary)
|
|
217
|
+
- `GET /api/context/list/policies` (Step 1 authoritative — entries prefixed `management-captures/`)
|
|
218
|
+
- `GET /api/context/policies/management-captures/<slug>` (read before pause / resume / remove)
|
|
219
|
+
- `PUT /api/context/knowledge/dossiers/<topic>` (Step 5.1 — if new)
|
|
220
|
+
- `PUT /api/context/policies/routines/custom/<slug>` (Step 5.2 — if scheduling)
|
|
221
|
+
- `PUT /api/context/policies/management-captures/<slug>` (Step 5.3)
|
|
222
|
+
- `PATCH /api/context/policies/management-captures/<slug>` (pause / resume / remove; frontmatter via GET-merge-PUT only — line-scalar parser)
|
|
223
|
+
- `DELETE /api/context/policies/routines/custom/<slug>` (remove only)
|
|
224
|
+
|
|
225
|
+
`policies/management-captures/_index.md` and the `## Active Policies` section in
|
|
226
|
+
`policies/management.md` are written by the daemon's policy-index
|
|
227
|
+
reconciler — they are NOT in the agent's write surface for this skill.
|
|
228
|
+
|
|
229
|
+
Frontmatter validation enforces `kind: policy`, `owner: agent`, and
|
|
230
|
+
the slug rules in Step 4. Malformed writes return 422 with the failing
|
|
231
|
+
field — surface that text to the user verbatim rather than retrying
|
|
232
|
+
blindly.
|
|
304
233
|
|
|
305
234
|
## Policy file section shape (auto-curated)
|
|
306
235
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"anchor": "<!-- CURATION:knowledge_layout id=\"policy-file-shape\" -->",
|
|
8
8
|
"human_label": "Policy file section shape",
|
|
9
9
|
"description": "Required sections inside rules/policies/<slug>.md and what each holds",
|
|
10
|
-
"scope_paths": ["
|
|
10
|
+
"scope_paths": ["policies/management-captures/*.md"]
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}
|
|
@@ -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/knowledge/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/policies/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/policies/management-captures/<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 `policies/management-captures/_index.md` and `policies/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
|
+
`policies/management-captures/_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
|
+
`policies/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 `policies/management-captures/_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 — the dossier path does **not** accept `DELETE` (`knowledge/dossiers/*` is PUT/PATCH only; a `DELETE` returns `403 context.write_forbidden`). If you created it new, PUT it to empty content / `status: removed`; an empty dossier is harmless (per 5.1). Leave a pre-existing dossier untouched. |
|
|
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 — `policies/routines/custom/*` is DELETE-whitelisted), 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.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "knowledge_layout",
|
|
3
3
|
"files": [
|
|
4
4
|
{
|
|
5
|
-
"path": "
|
|
5
|
+
"path": "policies/management-captures/*.md",
|
|
6
6
|
"purpose": "Durable management policy capturing why a recurring rule exists, how it runs, and where data lands",
|
|
7
7
|
"sections": [
|
|
8
8
|
{ "heading": "## Why", "contains": "one short paragraph stating the motivation behind the policy" },
|
|
@@ -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
|
|
|
@@ -49,7 +48,7 @@ these in any language also fail the positive rule.
|
|
|
49
48
|
|
|
50
49
|
### No internal mechanism names
|
|
51
50
|
|
|
52
|
-
Never mention `today.md`, `
|
|
51
|
+
Never mention `state/today.md`, `identity/profile.md`, `plans/roadmap.md`, `## Agent
|
|
53
52
|
Plan`, `## Agent Log`, `## Handoff`, `did-not-fire`, "Morning
|
|
54
53
|
Routine", "Evening Review", "scheduled.task", "scheduled.dm",
|
|
55
54
|
"dm_session", "sub_flow", or any other internal mechanism in
|
|
@@ -72,7 +71,7 @@ rule above bars *introducing* such enumeration in any other surface.)
|
|
|
72
71
|
### Language and style
|
|
73
72
|
|
|
74
73
|
Output language: follow `<output_language_policy>`. Tone: follow
|
|
75
|
-
`
|
|
74
|
+
`identity/profile.md` Communication Style and the Character block in your
|
|
76
75
|
system prompt. Keep technical terms in original form.
|
|
77
76
|
|
|
78
77
|
### Compactness
|
|
@@ -92,99 +91,28 @@ Notify when **all three** are true: (1) **actionable** or requires awareness, (2
|
|
|
92
91
|
`[cal] ... — reminder sent` referencing the same item within the
|
|
93
92
|
last 4 hours. If the injected log is truncated (`[...N earlier
|
|
94
93
|
entries omitted ...]` marker) and you can't rule out a prior
|
|
95
|
-
notification, `GET /api/context/today` for the full log before
|
|
94
|
+
notification, `GET /api/context/state/today` for the full log before
|
|
96
95
|
firing. Duplicate notifications are the #1 cause of noise.
|
|
97
96
|
- **A pending Agent Plan row / scheduled DM is already set to fire
|
|
98
97
|
for this item within the next 2 hours** — let the planned channel
|
|
99
98
|
deliver; don't pre-empt it.
|
|
100
99
|
- **Quiet hours (default 22:00-08:00, configurable)** unless `critical` — schedule for after instead
|
|
101
|
-
- **
|
|
100
|
+
- **Over the rate-limit caps (3/hour, 12/day; `critical` bypasses both)** — do NOT spam-retry. The endpoint does NOT signal this: `/api/notify` returns `200 {status:"sent"}` even when quiet-hours or the rate-limit silently drops the message, so a `"sent"` response is not proof of delivery. Self-throttle by checking `<today>` `## Agent Log` before firing; if you suspect suppression, log the skip rather than re-posting. If time-critical, upgrade priority at next opportunity
|
|
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
|