@aitne-sh/aitne 0.1.0
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/LICENSE +21 -0
- package/README.md +464 -0
- package/agent-assets/agent-profiles/_safety.md +26 -0
- package/agent-assets/agent-profiles/conversational.md +33 -0
- package/agent-assets/agent-profiles/docs-qa.md +24 -0
- package/agent-assets/agent-profiles/observer.md +28 -0
- package/agent-assets/agent-profiles/profile-importer.md +63 -0
- package/agent-assets/agent-profiles/proxy.md +28 -0
- package/agent-assets/agent-profiles/routine.md +16 -0
- package/agent-assets/agent-profiles/task.md +18 -0
- package/agent-assets/docs/concepts/agent-day.md +88 -0
- package/agent-assets/docs/concepts/auth-health.md +75 -0
- package/agent-assets/docs/concepts/backends-and-tiers.md +126 -0
- package/agent-assets/docs/concepts/costs-and-quotas.md +103 -0
- package/agent-assets/docs/concepts/delegated-mode.md +223 -0
- package/agent-assets/docs/concepts/memory-model.md +118 -0
- package/agent-assets/docs/concepts/observations.md +80 -0
- package/agent-assets/docs/concepts/process-keys.md +89 -0
- package/agent-assets/docs/concepts/routines.md +108 -0
- package/agent-assets/docs/concepts/safety-and-execution.md +109 -0
- package/agent-assets/docs/concepts/safety-model.md +279 -0
- package/agent-assets/docs/concepts/skills.md +100 -0
- package/agent-assets/docs/features/integrations/calendar.md +92 -0
- package/agent-assets/docs/features/integrations/git.md +95 -0
- package/agent-assets/docs/features/integrations/github.md +170 -0
- package/agent-assets/docs/features/integrations/mail.md +106 -0
- package/agent-assets/docs/features/integrations/notion.md +69 -0
- package/agent-assets/docs/features/integrations/obsidian.md +71 -0
- package/agent-assets/docs/features/lifestyle/git.md +178 -0
- package/agent-assets/docs/features/lifestyle/reading.md +93 -0
- package/agent-assets/docs/features/lifestyle/receipts.md +71 -0
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +44 -0
- package/agent-assets/docs/features/lifestyle/travel-time.md +52 -0
- package/agent-assets/docs/features/memory-files/agent-journal.md +105 -0
- package/agent-assets/docs/features/memory-files/projects.md +56 -0
- package/agent-assets/docs/features/memory-files/roadmap.md +61 -0
- package/agent-assets/docs/features/memory-files/schedule.md +112 -0
- package/agent-assets/docs/features/memory-files/today.md +73 -0
- package/agent-assets/docs/features/memory-files/user-profile.md +81 -0
- package/agent-assets/docs/features/messaging/dashboard-chat.md +93 -0
- package/agent-assets/docs/features/messaging/discord.md +50 -0
- package/agent-assets/docs/features/messaging/overview.md +111 -0
- package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +69 -0
- package/agent-assets/docs/features/messaging/slack.md +51 -0
- package/agent-assets/docs/features/messaging/telegram.md +63 -0
- package/agent-assets/docs/features/messaging/whatsapp.md +48 -0
- package/agent-assets/docs/features/operations/activity-and-conversations.md +105 -0
- package/agent-assets/docs/features/operations/approvals.md +58 -0
- package/agent-assets/docs/features/operations/backend-routing.md +62 -0
- package/agent-assets/docs/features/operations/cost-tracking.md +59 -0
- package/agent-assets/docs/features/operations/notifications.md +69 -0
- package/agent-assets/docs/features/operations/quiet-hours.md +106 -0
- package/agent-assets/docs/features/operations/schedule-approaching.md +60 -0
- package/agent-assets/docs/features/routines/custom-routines.md +101 -0
- package/agent-assets/docs/features/routines/evening-review.md +81 -0
- package/agent-assets/docs/features/routines/hourly-check.md +85 -0
- package/agent-assets/docs/features/routines/monthly-review.md +65 -0
- package/agent-assets/docs/features/routines/morning-routine.md +123 -0
- package/agent-assets/docs/features/routines/weekly-review.md +70 -0
- package/agent-assets/docs/getting-started/01-what-is-this.md +192 -0
- package/agent-assets/docs/getting-started/02-first-steps.md +80 -0
- package/agent-assets/docs/getting-started/03-what-can-this-do.md +110 -0
- package/agent-assets/docs/getting-started/04-first-day.md +287 -0
- package/agent-assets/docs/glossary.md +116 -0
- package/agent-assets/docs/guides/add-a-custom-routine.md +71 -0
- package/agent-assets/docs/guides/backup-and-restore.md +54 -0
- package/agent-assets/docs/guides/change-which-model-handles-x.md +47 -0
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +59 -0
- package/agent-assets/docs/guides/import-knowledge-file.md +275 -0
- package/agent-assets/docs/guides/install-and-run.md +72 -0
- package/agent-assets/docs/guides/migrate-machines.md +52 -0
- package/agent-assets/docs/guides/pause-the-agent.md +65 -0
- package/agent-assets/docs/guides/reinstall-cleanly.md +52 -0
- package/agent-assets/docs/guides/setup-wizard.md +107 -0
- package/agent-assets/docs/guides/switch-default-backend.md +60 -0
- package/agent-assets/docs/reference/api.md +51 -0
- package/agent-assets/docs/reference/cli-commands.md +121 -0
- package/agent-assets/docs/reference/config.md +74 -0
- package/agent-assets/docs/reference/disallowed-tools.md +76 -0
- package/agent-assets/docs/reference/keyboard-shortcuts.md +39 -0
- package/agent-assets/docs/reference/process-keys.md +59 -0
- package/agent-assets/docs/reference/skills.md +50 -0
- package/agent-assets/docs/troubleshooting/auth-failed.md +57 -0
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +55 -0
- package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +54 -0
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +53 -0
- package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +75 -0
- package/agent-assets/docs/troubleshooting/observation-not-detected.md +57 -0
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +57 -0
- package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +75 -0
- package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +71 -0
- package/agent-assets/optimizer-skills/skill-curation/SKILL.md +108 -0
- package/agent-assets/project-doc-templates/git-repo.md +21 -0
- package/agent-assets/project-doc-templates/project.md +38 -0
- package/agent-assets/skills/attach/SKILL.md +104 -0
- package/agent-assets/skills/context/SKILL.md +257 -0
- package/agent-assets/skills/context/curation.json +37 -0
- package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +13 -0
- package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +40 -0
- package/agent-assets/skills/docs-search/SKILL.md +176 -0
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +369 -0
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +349 -0
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +347 -0
- package/agent-assets/skills/external-services/SKILL.md +371 -0
- package/agent-assets/skills/mail/SKILL.delegated.claude.md +284 -0
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +261 -0
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +255 -0
- package/agent-assets/skills/mail/SKILL.md +313 -0
- package/agent-assets/skills/mail/references/errors.md +17 -0
- package/agent-assets/skills/mail/references/providers.md +40 -0
- package/agent-assets/skills/mail/references/query-grammar.md +24 -0
- package/agent-assets/skills/management-policy/SKILL.md +307 -0
- package/agent-assets/skills/management-policy/curation.json +13 -0
- package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +16 -0
- package/agent-assets/skills/management-task-modify/SKILL.md +202 -0
- package/agent-assets/skills/management-task-register/SKILL.md +330 -0
- package/agent-assets/skills/management-task-stop/SKILL.md +166 -0
- package/agent-assets/skills/notify/SKILL.md +196 -0
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +254 -0
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +195 -0
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +194 -0
- package/agent-assets/skills/notion/SKILL.md +86 -0
- package/agent-assets/skills/observations/SKILL.md +234 -0
- package/agent-assets/skills/observations/curation.json +13 -0
- package/agent-assets/skills/observations/seeds/source-namespacing.seed.json +20 -0
- package/agent-assets/skills/project-doc/SKILL.md +86 -0
- package/agent-assets/skills/project-doc/curation.json +21 -0
- package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +25 -0
- package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +20 -0
- package/agent-assets/skills/reading/SKILL.md +198 -0
- package/agent-assets/skills/reading/references/reading-taste.md +197 -0
- package/agent-assets/skills/receipts/SKILL.md +134 -0
- package/agent-assets/skills/roadmap/SKILL.md +276 -0
- package/agent-assets/skills/roadmap/curation.json +13 -0
- package/agent-assets/skills/roadmap/references/horizon-tags.md +40 -0
- package/agent-assets/skills/roadmap/references/preparation-timeline.md +47 -0
- package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +16 -0
- package/agent-assets/skills/schedule/SKILL.md +228 -0
- package/agent-assets/skills/scheduled-managed-task/SKILL.md +392 -0
- package/agent-assets/skills/today/SKILL.md +198 -0
- package/agent-assets/skills/today/curation.json +21 -0
- package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +17 -0
- package/agent-assets/skills/today/seeds/section-shape.seed.json +17 -0
- package/agent-assets/skills/travel/SKILL.md +132 -0
- package/agent-assets/skills/travel-time/SKILL.md +149 -0
- package/agent-assets/skills/user-interview/SKILL.md +323 -0
- package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +94 -0
- package/agent-assets/skills/user-profile/SKILL.md +210 -0
- package/agent-assets/skills/user-profile/curation.json +29 -0
- package/agent-assets/skills/user-profile/seeds/learned-context-format.seed.json +14 -0
- package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +53 -0
- package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +27 -0
- package/agent-assets/task-flows/dashboard.docs_qa.md +43 -0
- package/agent-assets/task-flows/default.md +11 -0
- package/agent-assets/task-flows/git.branch.created.md +25 -0
- package/agent-assets/task-flows/git.lifecycle.poll.md +52 -0
- package/agent-assets/task-flows/git.local_ahead.stale.md +34 -0
- package/agent-assets/task-flows/git.merge_to_default.md +30 -0
- package/agent-assets/task-flows/git.project.refresh_architecture.md +100 -0
- package/agent-assets/task-flows/git.project.retemplate.md +73 -0
- package/agent-assets/task-flows/git.push.detected.md +32 -0
- package/agent-assets/task-flows/git.push.force_pushed.md +36 -0
- package/agent-assets/task-flows/git.tag.created.md +24 -0
- package/agent-assets/task-flows/github.assigned.md +43 -0
- package/agent-assets/task-flows/github.pull_request.review_requested.md +57 -0
- package/agent-assets/task-flows/github.security_alert.md +45 -0
- package/agent-assets/task-flows/github.workflow_run.failed.md +57 -0
- package/agent-assets/task-flows/knowledge.import.md +161 -0
- package/agent-assets/task-flows/message.received.dm.md +142 -0
- package/agent-assets/task-flows/message.received.dm_first.md +117 -0
- package/agent-assets/task-flows/message.received.md +14 -0
- package/agent-assets/task-flows/routine.custom.md +38 -0
- package/agent-assets/task-flows/routine.evening_review.md +323 -0
- package/agent-assets/task-flows/routine.hourly_check.delegated.claude.md +405 -0
- package/agent-assets/task-flows/routine.hourly_check.delegated.codex.md +400 -0
- package/agent-assets/task-flows/routine.hourly_check.delegated.gemini.md +404 -0
- package/agent-assets/task-flows/routine.hourly_check.md +184 -0
- package/agent-assets/task-flows/routine.hourly_check.triage.md +93 -0
- package/agent-assets/task-flows/routine.monthly_review.md +250 -0
- package/agent-assets/task-flows/routine.morning_routine.md +300 -0
- package/agent-assets/task-flows/routine.morning_routine_initial.md +184 -0
- package/agent-assets/task-flows/routine.roadmap_refresh.md +275 -0
- package/agent-assets/task-flows/routine.today_refresh.md +172 -0
- package/agent-assets/task-flows/routine.user_profile_sweep.md +242 -0
- package/agent-assets/task-flows/routine.weekly_review.md +247 -0
- package/agent-assets/task-flows/schedule.approaching.md +124 -0
- package/agent-assets/task-flows/scheduled.dm.md +391 -0
- package/agent-assets/task-flows/scheduled.task.md +141 -0
- package/agent-assets/task-flows/setup.initial.md +277 -0
- package/agent-assets/task-flows/setup.update.md +53 -0
- package/agent-assets/templates/README.md +85 -0
- package/agent-assets/templates/_index.md +39 -0
- package/agent-assets/templates/_manifest.json +103 -0
- package/agent-assets/templates/agent/journal.md +10 -0
- package/agent-assets/templates/agent/profile-questions.md +74 -0
- package/agent-assets/templates/context-index.md +42 -0
- package/agent-assets/templates/dossiers/_index.md +22 -0
- package/agent-assets/templates/dossiers/evening.md +23 -0
- package/agent-assets/templates/dossiers/hourly.md +23 -0
- package/agent-assets/templates/dossiers/monthly.md +23 -0
- package/agent-assets/templates/dossiers/morning.md +23 -0
- package/agent-assets/templates/dossiers/roadmap.md +23 -0
- package/agent-assets/templates/dossiers/weekly.md +23 -0
- package/agent-assets/templates/projects/_active.base +14 -0
- package/agent-assets/templates/projects/_index.md +29 -0
- package/agent-assets/templates/roadmap.md +15 -0
- package/agent-assets/templates/routines/_index.md +20 -0
- package/agent-assets/templates/routines/evening.md +22 -0
- package/agent-assets/templates/routines/hourly.md +30 -0
- package/agent-assets/templates/routines/monthly.md +25 -0
- package/agent-assets/templates/routines/morning.md +26 -0
- package/agent-assets/templates/routines/weekly.md +23 -0
- package/agent-assets/templates/rules/_index.md +19 -0
- package/agent-assets/templates/rules/journal-export.md +41 -0
- package/agent-assets/templates/rules/journal-format.md +61 -0
- package/agent-assets/templates/rules/management.md +48 -0
- package/agent-assets/templates/rules/mcp.md +40 -0
- package/agent-assets/templates/rules/policies/_index.md +22 -0
- package/agent-assets/templates/rules/redaction.md +30 -0
- package/agent-assets/templates/today.md +13 -0
- package/agent-assets/templates/user/_index.md +16 -0
- package/agent-assets/templates/user/expertise.md +7 -0
- package/agent-assets/templates/user/goals.md +7 -0
- package/agent-assets/templates/user/people.md +7 -0
- package/agent-assets/templates/user/personal.md +7 -0
- package/agent-assets/templates/user/profile.md +28 -0
- package/agent-assets/templates/user/work.md +7 -0
- package/bin/aitne.mjs +1096 -0
- package/package.json +78 -0
- package/personal-agent.mjs +39 -0
- package/scripts/browser.mjs +99 -0
- package/scripts/check-redaction-coverage.mjs +109 -0
- package/scripts/commands/audit.mjs +309 -0
- package/scripts/commands/doctor.mjs +437 -0
- package/scripts/commands/open.mjs +40 -0
- package/scripts/commands/setup.mjs +21 -0
- package/scripts/commands/uninstall.mjs +114 -0
- package/scripts/commands/update.mjs +96 -0
- package/scripts/commands/version.mjs +62 -0
- package/scripts/commands.md +0 -0
- package/scripts/lib/sqlite-loader.mjs +49 -0
- package/scripts/message-discipline-digest.mjs +535 -0
- package/scripts/poc/google-connector-inheritance/REPORT.md +197 -0
- package/scripts/poc/google-connector-inheritance/claude-sdk-probe.mjs +79 -0
- package/scripts/remint-roadmap-ids.mjs +257 -0
- package/scripts/rm-paths.mjs +22 -0
- package/scripts/run-node.mjs +223 -0
- package/scripts/smoke-obsidian-api.mjs +166 -0
- package/scripts/start.mjs +160 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
{context}
|
|
2
|
+
|
|
3
|
+
## Task: User-profile sweep (`phase`: {event_data[phase]})
|
|
4
|
+
|
|
5
|
+
Autonomous background run. There is no user-visible output — writes
|
|
6
|
+
go silently to `user/profile.md` and `user/<topic>.md` per the
|
|
7
|
+
**user-profile** skill. Do NOT call `/api/notify`.
|
|
8
|
+
|
|
9
|
+
The sweep runs 10 min before each paired routine — 03:50 before
|
|
10
|
+
Morning Routine at 04:00, 17:50 before Evening Review at 18:00 — so
|
|
11
|
+
that the paired routine reads a freshly up-to-date `user/profile.md`
|
|
12
|
+
(the only user file auto-injected into sessions via `<user>`) when it
|
|
13
|
+
starts. This is the safety net for DM-time captures that the
|
|
14
|
+
`message.received.dm` / `message.received.dm_first` task-flows missed.
|
|
15
|
+
|
|
16
|
+
### Step 1 — Read the DM window
|
|
17
|
+
|
|
18
|
+
Read `<agent_day_messages>` + `<agent_day_dm_conversation_log>`. The
|
|
19
|
+
window is the current agent-day bounds at session start — for the
|
|
20
|
+
morning phase (03:50) that spans ~04:00 yesterday → 03:50 today, and
|
|
21
|
+
for the evening phase (17:50) that spans ~04:00 today → 17:50 today.
|
|
22
|
+
The two windows overlap on the daytime portion; the idempotency check
|
|
23
|
+
in Step 3 keeps this from producing duplicate writes.
|
|
24
|
+
|
|
25
|
+
If neither tag is present, the ContextBuilder failed to inject the
|
|
26
|
+
window — append one line to `agent/journal.md` (`- HH:MM user-profile
|
|
27
|
+
sweep (phase=<phase>) — aborted: missing agent-day window`) and exit.
|
|
28
|
+
Do not guess at the bounds.
|
|
29
|
+
|
|
30
|
+
### Step 2 — Extract fact candidates
|
|
31
|
+
|
|
32
|
+
Scan the window using the trigger shapes in the **user-profile**
|
|
33
|
+
skill's "When to Update" section (identity, explicit preference,
|
|
34
|
+
correction, etc.). For detail-heavy facts the DM-time capture block
|
|
35
|
+
already routes — people, work, expertise, personal, goals — see the
|
|
36
|
+
trigger-shape list in `message.received.dm.md` §"Capture user info"
|
|
37
|
+
for the canonical enumeration. Apply the same routing here.
|
|
38
|
+
|
|
39
|
+
Focus on persistent facts the user **stated about themselves**. Ignore
|
|
40
|
+
one-off references, speculative inferences, and facts already
|
|
41
|
+
recorded (Step 3 handles deduplication).
|
|
42
|
+
|
|
43
|
+
### Step 3 — Idempotent routing + PATCH
|
|
44
|
+
|
|
45
|
+
For each candidate, classify by the **user-profile** skill's decision
|
|
46
|
+
rule (profile.md vs `user/<topic>.md` vs the expertise tie-breaker
|
|
47
|
+
that writes a one-line summary to profile.md and full detail to
|
|
48
|
+
`user/expertise.md`).
|
|
49
|
+
|
|
50
|
+
For each target file:
|
|
51
|
+
|
|
52
|
+
1. **GET** the file.
|
|
53
|
+
2. **Check whether the fact (or a paraphrase) is already present.**
|
|
54
|
+
Idempotency is load-bearing. Two sweeps per day + DM-handler writes
|
|
55
|
+
will double-cover the same conversation window, so naïve re-writes
|
|
56
|
+
would duplicate every fact the DM handler already captured.
|
|
57
|
+
3. **If absent and the target section exists**: PATCH `mode: "append"`
|
|
58
|
+
with the single new bullet.
|
|
59
|
+
4. **If absent and the target section does NOT exist** (PATCH returns
|
|
60
|
+
`{"error": "section_not_found"}`): retry with PATCH `mode:
|
|
61
|
+
"append_to_file"` and include the section header in the content:
|
|
62
|
+
```bash
|
|
63
|
+
curl -s -X PATCH http://localhost:8321/api/context/user/people \
|
|
64
|
+
-H 'Content-Type: application/json' \
|
|
65
|
+
-d '{"mode": "append_to_file", "content": "\n## Family\n- Sister (Sarah): two kids as of 2026-04"}'
|
|
66
|
+
```
|
|
67
|
+
`append_to_file` does not require a section and is the intended
|
|
68
|
+
first-write path for a freshly-created topic file with only its H1.
|
|
69
|
+
5. **If a near-duplicate bullet exists with less detail, merge in
|
|
70
|
+
memory then rewrite the whole section.** GET the section body,
|
|
71
|
+
replace the matching line with the merged bullet (preserve all
|
|
72
|
+
other lines byte-for-byte), PATCH `mode: "replace"` with the FULL
|
|
73
|
+
new section body. `mode: "replace"` rewrites the entire section —
|
|
74
|
+
sending just the merged bullet as `content` overwrites the whole
|
|
75
|
+
section and deletes every sibling bullet. This is the same
|
|
76
|
+
read-before-write discipline the **user-profile** skill's "Worked
|
|
77
|
+
example" illustrates.
|
|
78
|
+
|
|
79
|
+
**Scope.** This sweep writes the same `profile.md` sections the DM
|
|
80
|
+
handler writes — Identity, Work Pattern, Expertise (summary),
|
|
81
|
+
Notification Preferences, Learned Context — plus the five
|
|
82
|
+
`user/<topic>.md` files (people, work, expertise, personal, goals).
|
|
83
|
+
Do **not** touch `## Raw Signals` — that section belongs to
|
|
84
|
+
`SignalDetector` only. Tone / style / voice / formality / emoji /
|
|
85
|
+
language preferences do **not** belong in profile.md either — route
|
|
86
|
+
those to the `character` runtime-config field via PATCH
|
|
87
|
+
/api/config/character (see user-profile skill §"Tone / character
|
|
88
|
+
preferences"). Learned
|
|
89
|
+
Context has multiple writers (DM handler, this sweep, Evening Review
|
|
90
|
+
Step 3a's Raw Signals graduation); read-before-write and merge, never
|
|
91
|
+
rewrite the whole section to add a single bullet.
|
|
92
|
+
|
|
93
|
+
**Learned Context date prefix on merge.** Learned Context entries
|
|
94
|
+
carry a `[YYYY-MM-DD]` prefix (see the **user-profile** skill's
|
|
95
|
+
"Learned Context entry format") so Evening Review can prune entries
|
|
96
|
+
older than 30 days. When your merge logic touches an existing Learned
|
|
97
|
+
Context bullet, **refresh the prefix to today's date** rather than
|
|
98
|
+
preserving the original — a restatement of the same preference is
|
|
99
|
+
evidence it's still live, so the age-based pruning timer should
|
|
100
|
+
reset. Other sections don't carry a date prefix; the byte-for-byte
|
|
101
|
+
preservation rule applies there.
|
|
102
|
+
|
|
103
|
+
### Step 4 — Log once
|
|
104
|
+
|
|
105
|
+
Append ONE line to `agent/journal.md`:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
- HH:MM user-profile sweep (phase=<phase>) — N facts appended, M merged, K skipped-duplicate
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use `<current_time>` for `HH:MM` in the configured timezone.
|
|
112
|
+
`N` = new bullets added (including first-write `append_to_file`
|
|
113
|
+
paths), `M` = existing bullets merged via `mode: "replace"`,
|
|
114
|
+
`K` = candidates skipped because a paraphrase was already recorded.
|
|
115
|
+
|
|
116
|
+
If Step 1 aborted due to a missing window, the abort line from Step 1
|
|
117
|
+
is the only journal output — do not append a summary line on top of
|
|
118
|
+
it. Silence otherwise.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Profile-interview queue maintenance (evening run only)
|
|
123
|
+
|
|
124
|
+
The remaining steps cover the profile-interview queue
|
|
125
|
+
(`agent/profile-questions.md`). They run **only on the evening
|
|
126
|
+
phase** (`phase=evening`) — the morning phase at 03:50 races with the
|
|
127
|
+
04:00 morning routine that picks the next latent question, so the
|
|
128
|
+
queue is not safe to mutate from the 03:50 run.
|
|
129
|
+
|
|
130
|
+
**On the morning phase (03:50): skip Steps 5, 5.5, and 6 entirely.**
|
|
131
|
+
|
|
132
|
+
Use the **user-interview** skill's "Operation 5" recipe for the
|
|
133
|
+
sub-steps below.
|
|
134
|
+
|
|
135
|
+
### Step 5 — Stale recovery (state=asked older than 24h)
|
|
136
|
+
|
|
137
|
+
GET `agent/profile-questions.md ## In Progress`. For each entry with
|
|
138
|
+
`state=asked` AND `(now − asked_at) > 24h`:
|
|
139
|
+
|
|
140
|
+
1. Remove the entry from `## In Progress` (PATCH replace; read-rebuild,
|
|
141
|
+
drop just that line).
|
|
142
|
+
2. Refresh the inline `<!-- last_attempted=<today> -->` HTML comment
|
|
143
|
+
on the matching `## Pending` row (PATCH replace; read-rebuild the
|
|
144
|
+
row line, swap or insert the comment, preserve siblings byte-for-byte).
|
|
145
|
+
3. Remove the matching `Profile question (asked HH:MM): <id>` line
|
|
146
|
+
from today.md `## Agent Notes` (PATCH replace, read-rebuild —
|
|
147
|
+
preserve every other Agent Notes line byte-for-byte). Without this
|
|
148
|
+
the line lingers visibly in today.md until tomorrow's PUT-replace.
|
|
149
|
+
4. Do NOT tick the row to `[x]` — the user did not reply. The 7-day
|
|
150
|
+
`last_attempted` cooldown will keep it out of the morning selector
|
|
151
|
+
until then.
|
|
152
|
+
|
|
153
|
+
### Step 5.5 — Latent fallback promotion (state=latent ≥ 3 days)
|
|
154
|
+
|
|
155
|
+
For each entry with `state=latent`, parse the `since=YYYY-MM-DD` field
|
|
156
|
+
on the entry line. Compute `today − since`; skip rows under 3 days.
|
|
157
|
+
For rows at or over 3 days latent, derive whether the user has been
|
|
158
|
+
actively DMing in the past 24h (use `<agent_day_messages>` from the
|
|
159
|
+
evening window):
|
|
160
|
+
|
|
161
|
+
**If user is active**: promote to `state=scheduled` and register a
|
|
162
|
+
fallback DM. Pick HH:MM = `quiet_hours_end + 2h` (or 14:00 if working
|
|
163
|
+
hours start before that) on tomorrow's date.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
curl -s -X POST http://localhost:8321/api/schedule \
|
|
167
|
+
-H 'Content-Type: application/json' \
|
|
168
|
+
-d '{
|
|
169
|
+
"time": "<tomorrow ISO8601 with offset>",
|
|
170
|
+
"taskType": "dm_session",
|
|
171
|
+
"description": "profile_interview:<id> — <ask-hint from Pending row>",
|
|
172
|
+
"model": "sonnet",
|
|
173
|
+
"taskContext": {
|
|
174
|
+
"scheduledBy": "user_profile_sweep_fallback",
|
|
175
|
+
"queueId": "<id>",
|
|
176
|
+
"importance": "low"
|
|
177
|
+
}
|
|
178
|
+
}'
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
PATCH the In Progress entry (preserve `since=`):
|
|
182
|
+
```
|
|
183
|
+
- <id> :: state=scheduled :: since=<unchanged> :: scheduled_at=<tomorrow HH:MM>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Then remove the matching `Profile question (latent): <id>` line from
|
|
187
|
+
today.md `## Agent Notes` (PATCH replace, read-rebuild — preserve all
|
|
188
|
+
other Agent Notes lines byte-for-byte). Without this the line
|
|
189
|
+
misrepresents state from 17:50 until tomorrow's PUT-replace.
|
|
190
|
+
|
|
191
|
+
**If user is inactive (≥ 24h silence)**: refresh
|
|
192
|
+
`<!-- last_attempted=<today> -->` on the Pending row (same recipe as
|
|
193
|
+
Step 5), remove the In Progress entry, AND remove the matching
|
|
194
|
+
`Profile question (latent): <id>` line from today.md `## Agent Notes`
|
|
195
|
+
(PATCH replace). Tomorrow's morning routine will pick a different row
|
|
196
|
+
(this one has the 7-day cooldown).
|
|
197
|
+
|
|
198
|
+
### Step 6 — Daily LLM reconcile (Layer 4)
|
|
199
|
+
|
|
200
|
+
GET `agent/profile-questions.md` and every distinct `<target_path>`
|
|
201
|
+
referenced by the union of `## Pending` AND `## Answered` rows. For
|
|
202
|
+
each row, judge with model reasoning whether the target section
|
|
203
|
+
**substantively answers the question's intent** — using the row's
|
|
204
|
+
`<id>`, `<target_path>`, optional `match=<anchor>`, `<ask-hint>`, and
|
|
205
|
+
the section body. Substantive ≠ "has any bullet": a populated `## Family`
|
|
206
|
+
section with `Sister (Sarah)` answers `family`; one holding only
|
|
207
|
+
`> Add later` does not. When `match=<anchor>` is present, look for a
|
|
208
|
+
bullet whose key references the anchor's subject.
|
|
209
|
+
|
|
210
|
+
**Tick path** (Pending `[ ]` → `[x]`):
|
|
211
|
+
|
|
212
|
+
- PATCH `## Pending`: flip the row, preserve siblings byte-for-byte.
|
|
213
|
+
- Append `- [x] <today> → <id> (reconciled:sweep)` to `## Answered`.
|
|
214
|
+
|
|
215
|
+
**Untick path** (Answered `[x]` → Pending `[ ]`):
|
|
216
|
+
|
|
217
|
+
- For rows in `## Answered` tagged `(reconciled:skeleton)` or
|
|
218
|
+
`(reconciled:morning)` whose target section the LLM judges does NOT
|
|
219
|
+
in fact answer the question (heuristic false positive from Layer 1
|
|
220
|
+
or Layer 2): revert. Re-add the row to `## Pending` with the original
|
|
221
|
+
priority, append `<!-- last_attempted=<today> -->` so it does not
|
|
222
|
+
immediately re-pick on tomorrow morning, and remove the corresponding
|
|
223
|
+
`## Answered` entry.
|
|
224
|
+
- **Do NOT untick rows tagged `(DM)`, `(import:*)`, or
|
|
225
|
+
`(reconciled:fire-time)`** — those represent user-confirmed closures.
|
|
226
|
+
|
|
227
|
+
For rows the section does NOT answer (and that are still Pending),
|
|
228
|
+
leave them. Do NOT add new rows here — Phase 2 evening-review
|
|
229
|
+
extension owns that path.
|
|
230
|
+
|
|
231
|
+
### Step 7 — Profile-interview journal line
|
|
232
|
+
|
|
233
|
+
Append a journal line to `agent/journal.md` (in addition to Step 4's
|
|
234
|
+
sweep line):
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
- HH:MM profile-questions reconcile — N stale, M latent→scheduled, P latent→deferred, T ticked, U unticked
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Skip this line if Steps 5/5.5/6 were no-ops (no In Progress entries
|
|
241
|
+
AND no tick/untick transitions). Keep the journal terse on inactive
|
|
242
|
+
days.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
{context}
|
|
2
|
+
|
|
3
|
+
## Task: Weekly Review
|
|
4
|
+
|
|
5
|
+
The "Vault policy files" block appended to this prompt includes
|
|
6
|
+
`routines/weekly.md` — run any `### <label>` entries there alongside the
|
|
7
|
+
built-in review phases below, using the same journaling conventions.
|
|
8
|
+
The "Vault review context" block includes `context-index.md` and
|
|
9
|
+
`dossiers/weekly.md`; consult it during Phase 1 and update the
|
|
10
|
+
dossier's Open items / Last run before finishing. Writes to
|
|
11
|
+
`dossiers/<flow>.md` MUST preserve the existing YAML frontmatter block
|
|
12
|
+
(`---\ntype: dossier\nowner: agent\nupdated: <date>\n---`); prefer
|
|
13
|
+
`PATCH` with a section target to mutate a single block, and when doing
|
|
14
|
+
a `PUT` full rewrite keep the frontmatter and only refresh `updated:`
|
|
15
|
+
— writes that drop the frontmatter are rejected with 422.
|
|
16
|
+
|
|
17
|
+
Generate the weekly review snapshot for the current ISO week and prepare next-week priorities.
|
|
18
|
+
|
|
19
|
+
This routine produces **two separate artifacts** with strict audience boundaries:
|
|
20
|
+
- **User-facing**: `weekly/YYYY-Www.md` + (optionally) a short notification.
|
|
21
|
+
Only real user outcomes and next-week focus. No agent mechanics.
|
|
22
|
+
- **Agent-internal**: `agent/journal.md` (append). Self-reflection, filter
|
|
23
|
+
quality, system improvement ideas, failed scheduled actions, pipeline
|
|
24
|
+
observations. **Never** surfaced to the user via notify.
|
|
25
|
+
|
|
26
|
+
Follow the context skill for file ownership rules. This routine owns the
|
|
27
|
+
workflow; the skill owns the file contract.
|
|
28
|
+
|
|
29
|
+
### Phase 1: Gather the week
|
|
30
|
+
1. Determine the target file name from <current_time>:
|
|
31
|
+
`weekly/YYYY-Www.md` (ISO week in the daemon timezone).
|
|
32
|
+
2. Fetch the source days for the current week:
|
|
33
|
+
- Use GET /api/context/list/daily to discover archived daily files.
|
|
34
|
+
- Read each `daily/YYYY-MM-DD.md` whose date falls in the current ISO week.
|
|
35
|
+
- Include <today> as the in-progress final day if it belongs to the same week.
|
|
36
|
+
3. Use <roadmap>, <active_projects>, and <calendar_events_7d> to understand:
|
|
37
|
+
- which milestones moved this week,
|
|
38
|
+
- what remains incomplete,
|
|
39
|
+
- what needs attention next week.
|
|
40
|
+
|
|
41
|
+
### Phase 2: Synthesize — split into two buckets
|
|
42
|
+
4. Build TWO separate mental lists before writing anything:
|
|
43
|
+
a. **User-facing bucket** (goes to `weekly/YYYY-Www.md` and possibly notify):
|
|
44
|
+
- What meaningful user work moved forward this week?
|
|
45
|
+
- Which user tasks or commitments slipped or stalled (with the reason
|
|
46
|
+
the USER cares about — "blocked on Sarah's reply", not "agent skipped
|
|
47
|
+
reminder")?
|
|
48
|
+
- What should the user focus on next week?
|
|
49
|
+
b. **Agent-internal bucket** (goes to `agent/journal.md` only):
|
|
50
|
+
- Scheduled tasks / reminders that did-not-fire or failed, and any
|
|
51
|
+
pattern behind the failures
|
|
52
|
+
- Quality of the day-type / focus-dimension filter (false positives,
|
|
53
|
+
false negatives)
|
|
54
|
+
- Observation pipeline health (how many observations reviewed vs.
|
|
55
|
+
ignored, any categories consistently skipped)
|
|
56
|
+
- Self-critique: where I over-notified, under-notified, or made a poor
|
|
57
|
+
prioritization call this week
|
|
58
|
+
- Concrete system improvement ideas (tighter silence gates, prompt
|
|
59
|
+
adjustments, missing context features)
|
|
60
|
+
5. Anything that fits the agent-internal bucket MUST NOT land in the
|
|
61
|
+
user-facing file or notification. When in doubt about a line item: "would
|
|
62
|
+
the user act on this, or is it a note about how the agent is doing?" →
|
|
63
|
+
agent-internal if the latter.
|
|
64
|
+
|
|
65
|
+
### Phase 3a: Write the user-facing review
|
|
66
|
+
6. PUT the review to `weekly/YYYY-Www.md`.
|
|
67
|
+
Required structure (user outcomes only — no agent mechanics in any section):
|
|
68
|
+
```
|
|
69
|
+
---
|
|
70
|
+
type: weekly
|
|
71
|
+
owner: agent
|
|
72
|
+
updated: YYYY-MM-DD
|
|
73
|
+
---
|
|
74
|
+
# Weekly Review YYYY-Www
|
|
75
|
+
> Period: YYYY-MM-DD to YYYY-MM-DD
|
|
76
|
+
> Generated at: YYYY-MM-DD HH:MM
|
|
77
|
+
|
|
78
|
+
## Highlights
|
|
79
|
+
- ...
|
|
80
|
+
|
|
81
|
+
## Completed
|
|
82
|
+
- ...
|
|
83
|
+
|
|
84
|
+
## Open Loops
|
|
85
|
+
- ...
|
|
86
|
+
|
|
87
|
+
## Metrics
|
|
88
|
+
- User tasks completed: N
|
|
89
|
+
- User tasks carried over: N
|
|
90
|
+
- Key meetings / commitments kept: N
|
|
91
|
+
|
|
92
|
+
## Next Week Priorities
|
|
93
|
+
- ...
|
|
94
|
+
```
|
|
95
|
+
The `## Metrics` section tracks **user** activity only. Do not add rows
|
|
96
|
+
like "agent plan rows completed", "scheduled tasks fired", "observations
|
|
97
|
+
processed" — those are agent mechanics and belong in agent/journal.md.
|
|
98
|
+
7. If the review reveals roadmap drift or stale project status, update
|
|
99
|
+
roadmap.md and the relevant projects/*.md in the same session.
|
|
100
|
+
|
|
101
|
+
### Phase 3b: Append to agent/journal.md (internal)
|
|
102
|
+
8. PATCH-append a new section to `agent/journal.md` with the agent-internal
|
|
103
|
+
bucket from Phase 2. Use `mode: "append_to_file"` (no `section` param
|
|
104
|
+
needed — content is appended to the end of the file).
|
|
105
|
+
Required shape for the appended block — **these bullet caps are hard
|
|
106
|
+
limits, not suggestions**. The daily retention sweep warns when any
|
|
107
|
+
section exceeds ~4000 bytes; bloat here indicates you ignored the caps.
|
|
108
|
+
```
|
|
109
|
+
## Weekly YYYY-Www
|
|
110
|
+
> Appended at: YYYY-MM-DD HH:MM
|
|
111
|
+
|
|
112
|
+
### What worked
|
|
113
|
+
- (max 5 bullets, each ≤ 1 line, concrete and specific — no padding)
|
|
114
|
+
### What slipped on my side
|
|
115
|
+
- (max 5 bullets; scheduled tasks that did-not-fire, mis-filtered items,
|
|
116
|
+
over-notifications. If none, write a single line: "- nothing notable")
|
|
117
|
+
### System improvement ideas
|
|
118
|
+
- (max 3 bullets; each must propose a specific, testable change —
|
|
119
|
+
prompt tweak / schedule adjustment / filter rule. "Improve the filter"
|
|
120
|
+
is not testable; "Add Saturday to Weekend day-type default" is)
|
|
121
|
+
### Metrics (agent side)
|
|
122
|
+
- Agent plan rows completed: N
|
|
123
|
+
- Did-not-fire / failed rows: N
|
|
124
|
+
- Observations reviewed / ignored: N / N
|
|
125
|
+
```
|
|
126
|
+
**Hard limits for this block** (the rollup will warn if exceeded):
|
|
127
|
+
- Total section budget: ≤ 4000 bytes (~1000 tokens)
|
|
128
|
+
- Bullet caps: What worked ≤ 5, What slipped ≤ 5, Improvement ideas ≤ 3
|
|
129
|
+
- Metrics section: exactly 3 numeric lines, no commentary
|
|
130
|
+
If you have more than 5 notable items in one subsection, keep only the
|
|
131
|
+
top 5 by actionable impact and drop the rest. Do not try to fit
|
|
132
|
+
everything — the monthly review synthesizes across weeks and surfaces
|
|
133
|
+
recurring items anyway.
|
|
134
|
+
|
|
135
|
+
If `agent/journal.md` does not yet exist (GET returns 404), PUT a minimal
|
|
136
|
+
file with just `# Agent Journal\n\n` as header and your new section below
|
|
137
|
+
it, in a single call. Do not abort the review.
|
|
138
|
+
|
|
139
|
+
**Idempotency note**: if a `## Weekly YYYY-Www` section for the current
|
|
140
|
+
week already exists (e.g. a previous run of this routine today), append
|
|
141
|
+
a new section anyway. The daily retention rollup collapses duplicate
|
|
142
|
+
keys last-write-wins, so your newer append automatically supersedes the
|
|
143
|
+
earlier one within 24 hours. Do not spend tokens trying to locate and
|
|
144
|
+
overwrite the old section in place.
|
|
145
|
+
|
|
146
|
+
### Phase 4: Notify (user-facing only)
|
|
147
|
+
9. The notification is for the USER, not a report of Phases 1–3. Never
|
|
148
|
+
mention weekly/YYYY-Www.md, agent/journal.md, "Weekly Review complete",
|
|
149
|
+
agent plan rows, did-not-fire, filter quality, observation processing,
|
|
150
|
+
or any other internal mechanism.
|
|
151
|
+
|
|
152
|
+
#### 4a. Silence gate — decide whether to notify at all
|
|
153
|
+
Prefer silence over noise. Send **no notification** if ALL of the following
|
|
154
|
+
hold:
|
|
155
|
+
- Fewer than 2 Highlights worth naming (a quiet week)
|
|
156
|
+
- No Open Loops the user is not already aware of
|
|
157
|
+
- No Next Week priority that needs a heads-up tonight (the user will see
|
|
158
|
+
it in Monday's morning briefing anyway)
|
|
159
|
+
- No hard deadline within the next 7 days
|
|
160
|
+
When the gate triggers: skip POST /api/notify entirely. The weekly/YYYY-Www.md
|
|
161
|
+
file is still written (user can open it on demand); just no push. Also log
|
|
162
|
+
one line into agent/journal.md's "What worked" subsection:
|
|
163
|
+
`silent weekly wrap-up — nothing actionable`.
|
|
164
|
+
|
|
165
|
+
#### 4b. When you DO notify — content rules
|
|
166
|
+
Answer, in the user's preferred language from the Character block:
|
|
167
|
+
1. **One concrete win** from this week (1 line).
|
|
168
|
+
2. **At most one open loop** that carries into next week, with a brief
|
|
169
|
+
user-meaningful reason. Omit if Open Loops is empty.
|
|
170
|
+
3. **The single most important focus for next week** (1 line).
|
|
171
|
+
|
|
172
|
+
Optional 4th line: a hard deadline heads-up if one falls within the next 7
|
|
173
|
+
days and the user has not yet acted on it.
|
|
174
|
+
|
|
175
|
+
#### 4c. Format rules (hard limits)
|
|
176
|
+
- Maximum 4 short lines total. No markdown headers. No bullet list.
|
|
177
|
+
- Lead with the win, not with "Weekly Review" or any ceremony.
|
|
178
|
+
- Forbidden vocabulary in the user-facing message: "Weekly Review",
|
|
179
|
+
"weekly/", "agent-journal", "did-not-fire", "Agent Plan", "observations",
|
|
180
|
+
"processed", "summary", "completed the review". These describe agent
|
|
181
|
+
mechanics, not user outcomes. The same rule applies in whatever
|
|
182
|
+
language the user prefers — do not paste an equivalent meta-phrase.
|
|
183
|
+
- Priority `normal`. Respects quiet hours via the notify skill contract.
|
|
184
|
+
- Exactly ONE notification via POST /api/notify. Do not split.
|
|
185
|
+
|
|
186
|
+
#### 4d. Shape example (illustrative — translate to user's language)
|
|
187
|
+
Good (something worth saying):
|
|
188
|
+
Big win this week: the design doc shipped Thursday.
|
|
189
|
+
Still open: the API spec review — Sarah back Monday.
|
|
190
|
+
Next week's focus: auth refactor landing before the Q2 deadline.
|
|
191
|
+
|
|
192
|
+
Good (silent path — nothing is sent):
|
|
193
|
+
(no POST /api/notify call; one-line note appended to agent/journal.md)
|
|
194
|
+
|
|
195
|
+
Bad (this is the failure mode this prompt exists to prevent):
|
|
196
|
+
Weekly Review YYYY-Www complete. Wrote weekly/2026-W14.md with
|
|
197
|
+
5 highlights, 3 open loops. Metrics: user tasks 7/10, agent plan
|
|
198
|
+
rows 24, did-not-fire 2. Observations processed: 18. Next week
|
|
199
|
+
priorities updated in roadmap.md.
|
|
200
|
+
|
|
201
|
+
The bad example reports the agent's bookkeeping. Everything in it either
|
|
202
|
+
belongs in agent/journal.md or was never worth telling the user.
|
|
203
|
+
|
|
204
|
+
### Phase 5: Reading sweep (silent context update)
|
|
205
|
+
|
|
206
|
+
This phase is **always silent** — it never adds a line to the user-facing
|
|
207
|
+
weekly file or agent-journal unless something unusual happens (see "When
|
|
208
|
+
to abort" below). The weekly notification MAY, but is not required to,
|
|
209
|
+
include one optional reading line; see the reading skill for the rule.
|
|
210
|
+
|
|
211
|
+
Run after Phase 4 regardless of whether Phase 4 sent a notification.
|
|
212
|
+
Purpose: keep `user/reading-taste.md` fresh, and refresh the
|
|
213
|
+
Book Candidates list.
|
|
214
|
+
|
|
215
|
+
10. Check whether a sweep is warranted using the exact delta check from
|
|
216
|
+
the `reading` skill ("Refresh-trigger check"):
|
|
217
|
+
- `GET /api/context/user/reading-taste` — treat 404 as
|
|
218
|
+
`Highlights at last sweep = 0` (first sweep writes the file).
|
|
219
|
+
- `GET /api/books/summary` — read `totalHighlights` as `M`.
|
|
220
|
+
- Extract `N` from the file's `Highlights at last sweep: N`
|
|
221
|
+
frontmatter line. If that line is missing (older file schema),
|
|
222
|
+
treat `N = 0` to force a one-time re-baseline.
|
|
223
|
+
- If `M - N < 10`, **skip Phase 5** and append one bullet under
|
|
224
|
+
agent/journal.md "What worked":
|
|
225
|
+
`reading sweep skipped — only (M-N) new highlights since last refresh`.
|
|
226
|
+
- Do NOT use the `Sampled: X` line for this check — `X` is the
|
|
227
|
+
sample size, not a DB count.
|
|
228
|
+
11. Otherwise, follow the **Reading Taste Profile** workflow in the
|
|
229
|
+
`reading` skill:
|
|
230
|
+
a. Sample highlights via the skill's sampling recipe.
|
|
231
|
+
b. Infer Topics / Thinking Patterns / Values / Preferred Formats
|
|
232
|
+
grounded in specific highlights.
|
|
233
|
+
c. Propose ≤10 Book Candidates using existing-books exclusion.
|
|
234
|
+
d. Write or PATCH `user/reading-taste.md` per the skill's
|
|
235
|
+
schema.
|
|
236
|
+
12. If the taste profile gained ≥1 new candidate and the weekly notify
|
|
237
|
+
gate in Phase 4 did NOT already fire a silent-path skip, you MAY
|
|
238
|
+
append one optional line to the already-sent notification by using a
|
|
239
|
+
second `POST /api/notify` — but only if the candidate is genuinely
|
|
240
|
+
novel and ties to a pattern the user would recognize as theirs.
|
|
241
|
+
When in doubt: omit. A forced reading pick is worse than silence.
|
|
242
|
+
|
|
243
|
+
**When to abort Phase 5 loudly**: if you detect the `reading-taste.md`
|
|
244
|
+
file is corrupted, contains non-English sections, or its "Last updated"
|
|
245
|
+
timestamp is in the future, leave it alone and append one bullet under
|
|
246
|
+
agent/journal.md "What slipped on my side" with a one-line description.
|
|
247
|
+
Never self-heal corrupted profile files without user awareness.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{context}
|
|
2
|
+
|
|
3
|
+
## Calendar Event Approaching
|
|
4
|
+
Event: {event_data[event_title]}
|
|
5
|
+
Calendar event id: {event_data[calendarEventId]}
|
|
6
|
+
Start: {event_data[start_time]}
|
|
7
|
+
End: {event_data[end_time]}
|
|
8
|
+
Minutes until start: {event_data[minutesUntil]}
|
|
9
|
+
|
|
10
|
+
### Decision Framework
|
|
11
|
+
|
|
12
|
+
The user already knows their own calendar (notify skill § Universal
|
|
13
|
+
user-facing message discipline § Awareness gate). The default for an
|
|
14
|
+
upcoming-event signal is therefore: append to today.md and stay
|
|
15
|
+
silent. Notification is only warranted when the agent has new context
|
|
16
|
+
the user could not see by glancing at their calendar app.
|
|
17
|
+
|
|
18
|
+
1. **Default: do NOT notify.** Append a heads-up to today.md
|
|
19
|
+
## Agent Notes per the context skill ("Observer event formats →
|
|
20
|
+
schedule.approaching"). If a task in <today> is affected by this
|
|
21
|
+
event (blocked by, needs prep, scheduled against), note the
|
|
22
|
+
dependency in the same entry.
|
|
23
|
+
|
|
24
|
+
2. **Notify ONLY if at least one positive trigger holds and its
|
|
25
|
+
detection mechanism is implemented.** A trigger without a concrete
|
|
26
|
+
detection path is a vacuous rule — the LLM can never honestly
|
|
27
|
+
satisfy it, so it either gets ignored or gets fabricated. Each
|
|
28
|
+
trigger below names its detection mechanism; unverified ones are
|
|
29
|
+
scoped out.
|
|
30
|
+
|
|
31
|
+
| Trigger | Priority | Detection mechanism |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| (a) reschedule arrived in the past 24 hours | `high` | See **Detection mechanism — trigger (a)** section below the table. |
|
|
34
|
+
| (d) travel-time concern | `critical` | `POST /api/travel-time` with the user's last-known location + the event venue. |
|
|
35
|
+
|
|
36
|
+
#### Detection mechanism — trigger (a) calendar reschedule
|
|
37
|
+
|
|
38
|
+
Issue the following call from this session:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
GET /api/observations?source=calendar:&pending=false&since=<UTC_24H_AGO>&limit=100
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then filter the response client-side to:
|
|
45
|
+
|
|
46
|
+
- `changeType === 'modified'`
|
|
47
|
+
- `ref === <calendarEventId from prompt header>`
|
|
48
|
+
|
|
49
|
+
If any row matches, trigger (a) clears. All five wiring points
|
|
50
|
+
below matter; getting any one wrong silently zeros this trigger.
|
|
51
|
+
|
|
52
|
+
1. **`source=calendar:`** — the API does a SQL `LIKE 'source%'`
|
|
53
|
+
prefix match (`packages/daemon/src/db/observations.ts:79-82`),
|
|
54
|
+
so pass the literal prefix `calendar:` with NO wildcard.
|
|
55
|
+
`calendar:*` is treated as a literal asterisk character and
|
|
56
|
+
matches zero rows.
|
|
57
|
+
|
|
58
|
+
2. **`pending=false`** — `routine.hourly_check` consumes
|
|
59
|
+
`actor=user` observations every hour, and calendar mutations
|
|
60
|
+
are tagged `actor='user'` (`calendar-poller.ts:210-212`). A
|
|
61
|
+
`pending=true` query would miss any reschedule older than the
|
|
62
|
+
latest hourly tick.
|
|
63
|
+
|
|
64
|
+
3. **`since=<UTC_24H_AGO>`** — pass the timestamp 24 hours before
|
|
65
|
+
the `utc=` attribute on the `<current_time>` block in your
|
|
66
|
+
context, formatted as `YYYY-MM-DD HH:MM:SS` (UTC, **space
|
|
67
|
+
separator, no `T`, no `Z`, no fractional seconds**). The DB
|
|
68
|
+
layer compares with raw lexicographic string equality against
|
|
69
|
+
`observed_at` storage (`db/observations.ts:87-90`);
|
|
70
|
+
`observed_at` is SQLite `CURRENT_TIMESTAMP` which writes the
|
|
71
|
+
space-separator format (`schema.ts:206`). An ISO `T`-separated
|
|
72
|
+
value lexicographically *exceeds* a same-instant
|
|
73
|
+
space-separated value (T 0x54 > space 0x20), so passing
|
|
74
|
+
`2026-04-25T14:30:00Z` would silently exclude observations
|
|
75
|
+
recorded the same calendar second. Worked example: if
|
|
76
|
+
`<current_time utc="2026-04-26T14:30:00.000Z" .../>`, pass
|
|
77
|
+
`since=2026-04-25 14:30:00`.
|
|
78
|
+
|
|
79
|
+
4. **`limit=100`** (NOT the default 20) — the API sorts
|
|
80
|
+
`ORDER BY observed_at ASC` (`db/observations.ts:100`), i.e.
|
|
81
|
+
oldest-first. With the default `limit=20` and a busy 24h
|
|
82
|
+
window (multiple calendars syncing, many recurring-event
|
|
83
|
+
updates), the API returns the 20 *oldest* observations in the
|
|
84
|
+
window — and the recent reschedule you're hunting for gets
|
|
85
|
+
clipped off the end. 100 is the API maximum
|
|
86
|
+
(`observations.ts:39` clamps higher values down). If a user's
|
|
87
|
+
calendar produces more than ~100 mod observations per 24
|
|
88
|
+
hours, this trigger needs a server-side `ORDER BY DESC` /
|
|
89
|
+
`changeType` filter — tracked as a follow-up beyond
|
|
90
|
+
agent-asset scope.
|
|
91
|
+
|
|
92
|
+
5. **`ref === <calendarEventId>`** — the calendar poller writes
|
|
93
|
+
`ref: event.id` (`calendar-poller.ts:214-215`), and the
|
|
94
|
+
`Calendar event id` line at the top of this prompt is the
|
|
95
|
+
exact value to match. The poller's payload also surfaces
|
|
96
|
+
`summary`/`start`/`end` for sanity-checking the result.
|
|
97
|
+
|
|
98
|
+
Triggers (b) conflict-with-another-event and (c) missing-prep are
|
|
99
|
+
**out of scope** — neither has an implemented detection mechanism
|
|
100
|
+
in this codebase. Do not notify on these heuristically; treat the
|
|
101
|
+
event as the default-silent path.
|
|
102
|
+
|
|
103
|
+
**Priority rationale.** `schedule.approaching` only fires inside
|
|
104
|
+
the heads-up window (event starts within the next ~15 minutes by
|
|
105
|
+
current daemon convention — see `calendar-poller.ts:125`'s
|
|
106
|
+
`minutesUntil <= 15` gate; the precise figure is on the `Minutes
|
|
107
|
+
until start:` line at the top of this prompt), so anything that
|
|
108
|
+
clears the awareness gate at this point is something the user
|
|
109
|
+
must act on before the event starts. `high` on (a) reaches the
|
|
110
|
+
user even in quiet hours; `critical` on (d) additionally bypasses
|
|
111
|
+
rate limits because missing the trip makes the event
|
|
112
|
+
unattendable. This overrides the notify skill's "`high` reserved
|
|
113
|
+
for 8h-delay-matters" guidance — inside the heads-up window,
|
|
114
|
+
every cleared trigger is by definition same-hour-matters.
|
|
115
|
+
|
|
116
|
+
Send via `POST /api/notify` per the notify skill at the priority
|
|
117
|
+
above. If multiple triggers fire for the same event, take the
|
|
118
|
+
highest. Never send more than one notification per
|
|
119
|
+
`schedule.approaching` event (observer.md "Boundaries").
|
|
120
|
+
|
|
121
|
+
3. **Always** log the decision to today.md ## Agent Log per the
|
|
122
|
+
context skill ("Observer event formats → schedule.approaching") —
|
|
123
|
+
even when skipping — so the user can audit calendar-triggered
|
|
124
|
+
decisions.
|