@aitne-sh/aitne 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +195 -829
  2. package/agent-assets/agent-profiles/_safety.md +49 -17
  3. package/agent-assets/agent-profiles/profile-importer.md +1 -1
  4. package/agent-assets/agent-profiles/routine.md +4 -3
  5. package/agent-assets/docs/concepts/agent-day.md +6 -1
  6. package/agent-assets/docs/concepts/auth-health.md +10 -1
  7. package/agent-assets/docs/concepts/backends-and-tiers.md +74 -40
  8. package/agent-assets/docs/concepts/costs-and-quotas.md +25 -5
  9. package/agent-assets/docs/concepts/delegated-mode.md +147 -68
  10. package/agent-assets/docs/concepts/memory-model.md +9 -4
  11. package/agent-assets/docs/concepts/observations.md +13 -1
  12. package/agent-assets/docs/concepts/process-keys.md +20 -5
  13. package/agent-assets/docs/concepts/routines.md +38 -20
  14. package/agent-assets/docs/concepts/safety-model.md +30 -13
  15. package/agent-assets/docs/concepts/skills.md +12 -7
  16. package/agent-assets/docs/features/integrations/calendar.md +1 -1
  17. package/agent-assets/docs/features/integrations/git.md +2 -2
  18. package/agent-assets/docs/features/integrations/github.md +9 -2
  19. package/agent-assets/docs/features/integrations/mail.md +1 -1
  20. package/agent-assets/docs/features/integrations/notion.md +34 -6
  21. package/agent-assets/docs/features/integrations/obsidian.md +7 -2
  22. package/agent-assets/docs/features/lifestyle/git.md +4 -7
  23. package/agent-assets/docs/features/lifestyle/receipts.md +17 -2
  24. package/agent-assets/docs/features/lifestyle/travel-bookings.md +15 -0
  25. package/agent-assets/docs/features/lifestyle/travel-time.md +7 -1
  26. package/agent-assets/docs/features/memory-files/agent-journal.md +2 -2
  27. package/agent-assets/docs/features/memory-files/projects.md +6 -0
  28. package/agent-assets/docs/features/memory-files/roadmap.md +5 -0
  29. package/agent-assets/docs/features/memory-files/today.md +1 -0
  30. package/agent-assets/docs/features/memory-files/user-profile.md +6 -0
  31. package/agent-assets/docs/features/messaging/bang-commands.md +20 -10
  32. package/agent-assets/docs/features/messaging/discord.md +12 -1
  33. package/agent-assets/docs/features/messaging/overview.md +10 -7
  34. package/agent-assets/docs/features/messaging/slack.md +13 -1
  35. package/agent-assets/docs/features/messaging/telegram.md +7 -1
  36. package/agent-assets/docs/features/messaging/whatsapp.md +12 -1
  37. package/agent-assets/docs/features/operations/activity-and-conversations.md +2 -2
  38. package/agent-assets/docs/features/operations/approvals.md +6 -0
  39. package/agent-assets/docs/features/operations/backend-routing.md +7 -0
  40. package/agent-assets/docs/features/operations/cost-tracking.md +6 -0
  41. package/agent-assets/docs/features/operations/notifications.md +6 -0
  42. package/agent-assets/docs/features/operations/schedule-approaching.md +22 -9
  43. package/agent-assets/docs/features/routines/custom-routines.md +10 -4
  44. package/agent-assets/docs/features/routines/evening-review.md +1 -1
  45. package/agent-assets/docs/features/routines/hourly-check.md +1 -1
  46. package/agent-assets/docs/features/routines/morning-routine.md +24 -15
  47. package/agent-assets/docs/features/routines/weekly-review.md +38 -12
  48. package/agent-assets/docs/features/wiki/commands.md +11 -0
  49. package/agent-assets/docs/features/wiki/overview.md +13 -3
  50. package/agent-assets/docs/getting-started/01-what-is-this.md +32 -11
  51. package/agent-assets/docs/getting-started/02-first-steps.md +17 -4
  52. package/agent-assets/docs/getting-started/03-what-can-this-do.md +21 -11
  53. package/agent-assets/docs/getting-started/04-first-day.md +14 -0
  54. package/agent-assets/docs/glossary.md +65 -12
  55. package/agent-assets/docs/guides/add-a-custom-routine.md +12 -0
  56. package/agent-assets/docs/guides/backup-and-restore.md +16 -2
  57. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +6 -0
  58. package/agent-assets/docs/guides/build-your-wiki.md +14 -0
  59. package/agent-assets/docs/guides/change-which-model-handles-x.md +7 -0
  60. package/agent-assets/docs/guides/connect-a-new-mail-account.md +16 -0
  61. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +6 -0
  62. package/agent-assets/docs/guides/import-knowledge-file.md +11 -0
  63. package/agent-assets/docs/guides/install-and-run.md +20 -4
  64. package/agent-assets/docs/guides/maintain-wiki-health.md +6 -0
  65. package/agent-assets/docs/guides/migrate-machines.md +13 -1
  66. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +9 -0
  67. package/agent-assets/docs/guides/pause-the-agent.md +12 -4
  68. package/agent-assets/docs/guides/reinstall-cleanly.md +19 -4
  69. package/agent-assets/docs/guides/setup-wizard.md +20 -9
  70. package/agent-assets/docs/guides/switch-default-backend.md +10 -1
  71. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +5 -0
  72. package/agent-assets/docs/reference/api.md +29 -1
  73. package/agent-assets/docs/reference/cli-commands.md +22 -3
  74. package/agent-assets/docs/reference/config.md +37 -5
  75. package/agent-assets/docs/reference/disallowed-tools.md +13 -0
  76. package/agent-assets/docs/reference/keyboard-shortcuts.md +13 -0
  77. package/agent-assets/docs/reference/process-keys.md +70 -20
  78. package/agent-assets/docs/reference/skills.md +27 -9
  79. package/agent-assets/docs/troubleshooting/auth-failed.md +7 -2
  80. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +13 -1
  81. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +10 -0
  82. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +11 -0
  83. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +9 -4
  84. package/agent-assets/docs/troubleshooting/observation-not-detected.md +12 -0
  85. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -1
  86. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +5 -0
  87. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +5 -0
  88. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
  89. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
  90. package/agent-assets/skills/agent-actions/SKILL.md +122 -0
  91. package/agent-assets/skills/attach/SKILL.md +1 -2
  92. package/agent-assets/skills/context/SKILL.md +36 -454
  93. package/agent-assets/skills/context/references/api.md +220 -0
  94. package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
  95. package/agent-assets/skills/context/references/snapshot-files.md +103 -0
  96. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +1 -1
  97. package/agent-assets/skills/docs-search/SKILL.md +13 -13
  98. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +5 -7
  99. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +5 -7
  100. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +5 -7
  101. package/agent-assets/skills/external-services/SKILL.md +6 -259
  102. package/agent-assets/skills/external-services/SKILL.native.claude.md +1 -2
  103. package/agent-assets/skills/external-services/SKILL.native.codex.md +1 -2
  104. package/agent-assets/skills/external-services/SKILL.native.gemini.md +1 -2
  105. package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
  106. package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
  107. package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
  108. package/agent-assets/skills/external-services/references/github.md +17 -0
  109. package/agent-assets/skills/external-services/references/obsidian.md +49 -0
  110. package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
  111. package/agent-assets/skills/gmail-lifestyle/SKILL.md +224 -0
  112. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
  113. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
  114. package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +59 -0
  115. package/agent-assets/skills/mail/SKILL.delegated.claude.md +1 -1
  116. package/agent-assets/skills/mail/SKILL.delegated.codex.md +1 -1
  117. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +1 -1
  118. package/agent-assets/skills/mail/SKILL.md +9 -114
  119. package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
  120. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  121. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  122. package/agent-assets/skills/mail/references/api.md +108 -0
  123. package/agent-assets/skills/mail/references/examples.md +70 -0
  124. package/agent-assets/skills/mail/references/providers.md +8 -8
  125. package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
  126. package/agent-assets/skills/managed-tasks/references/errors.md +70 -0
  127. package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
  128. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
  129. package/agent-assets/skills/management-policy/SKILL.md +33 -105
  130. package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
  131. package/agent-assets/skills/notify/SKILL.md +6 -78
  132. package/agent-assets/skills/notify/references/priority.md +60 -0
  133. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  134. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  135. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  136. package/agent-assets/skills/notion/SKILL.md +6 -10
  137. package/agent-assets/skills/notion/SKILL.native.claude.md +1 -2
  138. package/agent-assets/skills/notion/SKILL.native.codex.md +1 -2
  139. package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -2
  140. package/agent-assets/skills/observations/SKILL.md +1 -6
  141. package/agent-assets/skills/project-doc/SKILL.md +1 -5
  142. package/agent-assets/skills/reading/SKILL.md +2 -2
  143. package/agent-assets/skills/roadmap/SKILL.md +37 -135
  144. package/agent-assets/skills/roadmap/references/api.md +100 -0
  145. package/agent-assets/skills/roadmap/references/cross-check.md +73 -0
  146. package/agent-assets/skills/roadmap/references/migration.md +56 -0
  147. package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
  148. package/agent-assets/skills/schedule/SKILL.md +52 -88
  149. package/agent-assets/skills/schedule/references/batch.md +93 -0
  150. package/agent-assets/skills/schedule/references/errors.md +214 -0
  151. package/agent-assets/skills/schedule/references/model-selection.md +96 -0
  152. package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
  153. package/agent-assets/skills/schedule/references/recurring.md +185 -0
  154. package/agent-assets/skills/scheduled-managed-task/SKILL.md +13 -15
  155. package/agent-assets/skills/today/SKILL.md +27 -57
  156. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +113 -0
  157. package/agent-assets/skills/user-interview/SKILL.md +12 -59
  158. package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
  159. package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
  160. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  161. package/agent-assets/skills/user-profile/SKILL.md +43 -63
  162. package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
  163. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +28 -0
  164. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
  165. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +0 -1
  166. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
  167. package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
  168. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
  169. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
  170. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
  171. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
  172. package/agent-assets/system-prompts/routine-fetch-window.md +68 -0
  173. package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
  174. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +18 -11
  175. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +16 -9
  176. package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
  177. package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
  178. package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
  179. package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
  180. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
  181. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +17 -9
  182. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +18 -12
  183. package/agent-assets/task-flows/knowledge.import.md +1 -1
  184. package/agent-assets/task-flows/message.received.dm.md +13 -15
  185. package/agent-assets/task-flows/message.received.dm_first.md +10 -14
  186. package/agent-assets/task-flows/routine.custom.md +3 -1
  187. package/agent-assets/task-flows/routine.evening_review.md +39 -163
  188. package/agent-assets/task-flows/routine.fetch_window.md +17 -12
  189. package/agent-assets/task-flows/routine.hourly_check.md +16 -8
  190. package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
  191. package/agent-assets/task-flows/routine.monthly_review.md +46 -4
  192. package/agent-assets/task-flows/routine.morning_routine_journal.md +113 -0
  193. package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
  194. package/agent-assets/task-flows/routine.roadmap_refresh.md +60 -15
  195. package/agent-assets/task-flows/routine.user_profile_sweep.md +9 -10
  196. package/agent-assets/task-flows/routine.weekly_review.md +285 -70
  197. package/agent-assets/task-flows/scheduled.dm.md +8 -8
  198. package/agent-assets/task-flows/scheduled.task.md +5 -5
  199. package/agent-assets/task-flows/setup.initial.md +165 -245
  200. package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
  201. package/agent-assets/templates/_manifest.json +7 -7
  202. package/agent-assets/templates/dossiers/_index.md +1 -1
  203. package/agent-assets/templates/rules/journal-format.md +145 -38
  204. package/agent-assets/templates/user/expertise.md +4 -2
  205. package/agent-assets/templates/user/goals.md +4 -2
  206. package/agent-assets/templates/user/people.md +8 -2
  207. package/agent-assets/templates/user/personal.md +4 -2
  208. package/agent-assets/templates/user/work.md +4 -2
  209. package/bin/aitne.mjs +8 -1
  210. package/package.json +4 -4
  211. package/scripts/commands/doctor.mjs +52 -0
  212. package/scripts/commands/run-now.mjs +202 -0
  213. package/scripts/commands/verify.mjs +264 -0
  214. package/agent-assets/docs/features/routines/monthly-review.md +0 -65
  215. package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
  216. package/agent-assets/skills/management-task-register/SKILL.md +0 -330
  217. package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
  218. package/agent-assets/skills/receipts/SKILL.md +0 -134
  219. package/agent-assets/skills/travel/SKILL.md +0 -132
  220. package/agent-assets/skills/travel-time/SKILL.md +0 -158
  221. package/agent-assets/task-flows/routine.morning_routine.md +0 -322
  222. package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
@@ -279,11 +279,11 @@ voice carries the whole message.
279
279
  ### Delivery channel — final text only, NOT `/api/notify`
280
280
 
281
281
  The briefing is delivered as the final assistant turn of this
282
- session. Do NOT call `POST /api/notify` for it — that path applies
283
- the `notify` skill's evening wrap-up contract (silent-by-default,
284
- priority `high`) which has the wrong semantics for a daily DM.
285
- Compose the briefing as your final assistant turn; the daemon DMs
286
- it automatically.
282
+ session. Do NOT call `POST /api/notify` for it — that path is for
283
+ ad-hoc alerts and applies the `notify` skill's universal
284
+ message-discipline rules, which have the wrong semantics for a daily
285
+ DM. Compose the briefing as your final assistant turn; the daemon
286
+ DMs it automatically.
287
287
 
288
288
  ### Bookkeeping (silent — never visible to the user)
289
289
 
@@ -460,7 +460,7 @@ Inspect `<recent_dm_messages window="60min">`:
460
460
  "time": "<current_time + 15min, ISO 8601 with offset>",
461
461
  "taskType": "dm_session",
462
462
  "description": "confirm:<topic> — <hint>",
463
- "model": "sonnet",
463
+ "tier": "medium",
464
464
  "taskContext": {
465
465
  "scheduledBy": "scheduled_dm.confirm_followup.self_defer",
466
466
  "sub_flow": "confirm",
@@ -775,7 +775,7 @@ curl -s -X POST http://localhost:8321/api/schedule \
775
775
  "time": "<current_time + 24h, ISO 8601 with offset>",
776
776
  "taskType": "dm_session",
777
777
  "description": "confirm:<topic> — <hint, softened paraphrase>",
778
- "model": "sonnet",
778
+ "tier": "medium",
779
779
  "taskContext": {
780
780
  "scheduledBy": "scheduled_dm.confirm_followup.retry",
781
781
  "sub_flow": "confirm",
@@ -817,7 +817,7 @@ curl -s -X POST http://localhost:8321/api/schedule \
817
817
  "time": "<current_time + 24h, ISO 8601 with offset>",
818
818
  "taskType": "dm_session",
819
819
  "description": "confirm:<topic> — silence-evaluator",
820
- "model": "sonnet",
820
+ "tier": "medium",
821
821
  "taskContext": {
822
822
  "scheduledBy": "scheduled_dm.confirm_followup.evaluator",
823
823
  "sub_flow": "confirm",
@@ -91,14 +91,14 @@ confirmation.
91
91
  proceed to Step 3 below so the task still executes.
92
92
  2. `GET /api/context/roadmap` and locate the matching
93
93
  `### Scheduled: ... (task #<id>) <!-- id: rm-... -->` entry.
94
- Flip only its Status line to `▶ running` via `PATCH`
94
+ Flip only its Status line to `running` via `PATCH`
95
95
  `section=agent_action_plan` `mode=replace` (include
96
96
  `X-Lock-Id: <lockId>`). Preserve the heading ID marker and any
97
- `✓ completed ...` Preparation Timeline rows byte-for-byte.
97
+ `completed ...` Preparation Timeline rows byte-for-byte.
98
98
  Follow the **roadmap** skill for the exact entry shape.
99
99
  3. Execute the task body (the remaining steps in this prompt).
100
100
  4. After Step 4 closes the loop, PATCH the entry Status to
101
- `✓ completed` / `✗ failed` (`X-Lock-Id: <lockId>`), then
101
+ `completed` / `failed` (`X-Lock-Id: <lockId>`), then
102
102
  `DELETE /api/context/lock/roadmap` with `{"lockId": "<lockId>"}`
103
103
  — always release even on failure paths.
104
104
 
@@ -129,8 +129,8 @@ confirmation.
129
129
  7. If Step 1 found a matching Agent Plan row, flip it to `- [x]` via the
130
130
  lifecycle recipe in the context skill (GET → edit body → PATCH
131
131
  replace section=agent_plan). Annotate per the skill's outcome table:
132
- success = no annotation, skip = `⚠ skipped: <reason>`, failure =
133
- `⚠ failed: <reason>`. Never leave a past-HH:MM row as `[ ]`.
132
+ success = no annotation, skip = `(skipped: <reason>)`, failure =
133
+ `(failed: <reason>)`. Never leave a past-HH:MM row as `[ ]`.
134
134
  8. If the PATCH returns 409 (Morning Routine lock), follow the skill's
135
135
  "retry 3 times, else log deferred" guidance. Do not drop silently.
136
136
 
@@ -2,249 +2,148 @@
2
2
 
3
3
  ## Task: Initial Setup — Create rules/management.md
4
4
 
5
- The user has started the initial setup from the dashboard. The dashboard
6
- Vault step already captured `settings.primary_language` (BCP-47 tag, e.g.
7
- `en` or `es`) and `settings.vault_mode` (`plain` or `obsidian`) — the
8
- latter controls how the **primary management vault** is laid out, not the
9
- separate external Obsidian integration. Do NOT re-ask those questions.
10
- Output language for everything written to disk in this flow
11
- (`user/profile.md`, `user/*.md`, `rules/management.md` body): follow
12
- `<output_language_policy>`.
13
-
14
- SETUP-FLOW-REDESIGN-PLAN §5.8 — the legacy "tool selections" form was
15
- removed. Steps 4–6 of the wizard (Mail, Calendar, Note) already
16
- configured the user's integrations, so you derive the Source-of-Truth
17
- rows yourself and confirm them rather than asking from scratch.
18
-
19
- Your role is to derive an initial Source-of-Truth table from the
20
- configured integrations, confirm it with the user, gather the two
21
- remaining management preferences, and generate rules/management.md.
22
- This is a multi-turn conversation subsequent user messages will
23
- arrive via session resume.
24
-
25
- Output language for this conversation: follow `<output_language_policy>`
26
- match the user's input language from the very first message; fall back
27
- to `<settings primary_language>` when input is ambiguous.
28
-
29
- ### Step 0 (silent, agent-owned) Derive Source-of-Truth rows
30
-
31
- Read integration state and the external-vault path **from the prompt
32
- context tags** the daemon injects on every turn. Do NOT curl `GET
33
- /api/integrations` or `GET /api/config` for this step both are
34
- Approve-tier (Bearer-only) and the agent's session has only an
35
- `X-Read-Token`, so those two reads will 401. (Other curls in this
36
- file — e.g. `PUT /api/context/user/profile` — are Autonomous-tier and
37
- work normally.)
38
-
39
- Tags available in the prompt:
40
-
41
- - `<integration_modes …/>` — one attribute per integration. Always
42
- present, always covers every key. Example:
43
- `<integration_modes gmail="disabled" google_calendar="direct" notion="delegated" notion_delegated_to="claude" outlook_calendar="disabled" outlook_mail="disabled" git="disabled" github="disabled" />`.
44
- Values are `direct | delegated | disabled`.
45
- - `<obsidian_vault_path>…</obsidian_vault_path>` — emitted **iff** the
46
- user has configured an external Obsidian vault. **Absence means the
47
- user has no external Obsidian vault** (treat as "no").
5
+ The dashboard wizard already captured `settings.primary_language` and
6
+ `settings.vault_mode`. Steps 4–6 (Mail / Calendar / Note) configured
7
+ the user's integrations. Your role:
8
+ derive an initial Source-of-Truth table from those integrations,
9
+ confirm it with the user, gather two remaining preferences, and
10
+ generate rules/management.md.
11
+
12
+ Output language: follow `<output_language_policy>`. The conversation
13
+ matches the user's input language.
14
+
15
+ This is a **strictly two-turn** dashboard conversation. The same prompt
16
+ renders every turn decide which turn you're on by inspecting prior
17
+ assistant messages.
18
+
19
+ | Turn | Trigger | What you emit |
20
+ |------|---------|---------------|
21
+ | Turn 1 | No prior assistant message | One natural-language message: greeting + derived Source-of-Truth table + remaining questions. **No code blocks. No curl.** |
22
+ | Turn 2 | The most recent prior assistant message was Turn 1 and the user has now replied | `management-rules` block **FIRST**, then optional `character` block, then silent PUT /api/context/user/profile + any user/*.md PATCHes |
23
+ | Turn 3+ | User requested revisions after Turn 2 | Revised `management-rules` block only (cap: 2 revision rounds). No curl writes — they already ran in Turn 2. |
24
+
25
+ ### Step 0 (silent) Derive Source-of-Truth from context tags
26
+
27
+ Read these tags from the prompt context. Do **NOT** curl
28
+ `/api/integrations` or `/api/config` — both are Approve-tier and the
29
+ agent's session has only an `X-Read-Token`, so those reads return 401.
30
+
31
+ - `<integration_modes …/>` one attribute per integration, always
32
+ emitted. Values are `direct | delegated | native | disabled`. Any
33
+ value other than `disabled` means the integration is wired up.
34
+ - `<obsidian_vault_path>…</obsidian_vault_path>` present **iff** the
35
+ user has configured an external Obsidian vault. Absence means "no".
48
36
  - `<settings primary_language="…" vault_mode="…" />` — primary
49
- language and primary-vault layout (`plain` | `obsidian`).
37
+ language and primary-vault layout.
50
38
 
51
- Apply these deterministic rules to draft the four rows:
39
+ Derive the four rows:
52
40
 
53
41
  | Source-of-Truth row | Derive from |
54
42
  |---|---|
55
- | Schedule | `google_calendar != "disabled"` → `Google Calendar`; else `outlook_calendar != "disabled"` → `Outlook Calendar`; else ask the user |
56
- | Notes | `<obsidian_vault_path>` tag present → `Obsidian`; else `notion != "disabled"` → `Notion`; else ask the user |
57
- | Tasks | `notion != "disabled"` → `Notion`; else `Obsidian` if `<obsidian_vault_path>` tag present; else ask the user |
43
+ | Schedule | `google_calendar != "disabled"` → `Google Calendar`; else `outlook_calendar != "disabled"` → `Outlook Calendar`; else ask |
44
+ | Notes | `<obsidian_vault_path>` present → `Obsidian`; else `notion != "disabled"` → `Notion`; else ask |
45
+ | Tasks | `notion != "disabled"` → `Notion`; else `<obsidian_vault_path>` present → `Obsidian`; else ask |
58
46
  | Projects | same precedence as Tasks |
59
47
 
60
- Surface the derived table back to the user in the first message
61
- ("Here's what I picked up from your setup does this look right?")
62
- and ask **only** about rows you could not infer. Typical outcome:
63
- zero or one follow-up question.
64
-
65
- Defensive fallback: if `<integration_modes …/>` is somehow missing
66
- from the prompt (shouldn't happen — `context-builder.ts` emits it
67
- unconditionally before any routine-specific branch), ask the user
68
- about all four rows rather than fabricating defaults. Do not retry
69
- with a curl.
70
-
71
- ### Instructions
72
-
73
- Steps 3–8 all happen in the same agent turn. They are ordered to match
74
- the actual emission sequence: the two staged code blocks (rules then
75
- character) land in the stream first; the silent curl writes follow. The
76
- dashboard reveals the preview as soon as the rules block lands but
77
- keeps "Save & Finish" disabled until the whole turn ends, so emitting
78
- blocks before curls minimizes how long the user waits on a disabled
79
- button.
80
-
81
- 1. Run Step 0 silently. Greet the user in one line, introducing
82
- yourself by the name in `<agent_identity>` display_name. Then
83
- present the derived Source-of-Truth table and ask any remaining
84
- row + the two preference questions in the same turn. Do NOT label
85
- anything "Q1", "Q2", etc. — speak naturally.
86
- 2. Ask the two preference questions in a single message:
87
- - Communication style preference (how should the agent talk to you?)
88
- - Project-management method preferences (anything you want the agent
89
- to follow when handling your projects?)
90
- Either answer may be "no preference" / "skip" accept that cleanly.
91
- 3. Generate rules/management.md inside a ```management-rules code
92
- block. This is the FIRST thing emitted in the turn — the dashboard
93
- reveals the preview as soon as it lands.
94
- 4. If the user requests changes, revise (return to step 3). Complete
95
- within **at most 2 revision rounds**.
96
- 5. **Do NOT put communication style inside rules/management.md, and do NOT
97
- put it inside `user/profile.md` either.** Tone / style / voice / emoji
98
- / language preferences live in the `character` runtime-config field
99
- only emitted as a ```character``` code block (see step 6). See
100
- `docs/design/15-character.md` for the split rule.
101
- 6. If the user stated a communication-style preference in step 2, emit
102
- a ```character``` code block immediately after the rules block (see
103
- "Character code block format" below). If the user skipped, omit the
104
- block.
105
- 7. After the staged blocks, silently call PUT /api/context/user/profile
106
- using the template in "user/profile.md Format" below. Working hours
107
- and quiet hours are pre-populated with defaults (Weekdays 09:00–18:00,
108
- Quiet hours 22:00–08:00) do not ask about them. Fill Platforms
109
- from the **derived Source-of-Truth table** (Step 0) — the row values
110
- you confirmed with the user. Leave Identity blank — setup does not
111
- collect name or timezone.
112
- 8. If the conversation surfaced detail-heavy facts that belong in the
113
- detailed profile layer, also PATCH the matching user/*.md file (still
114
- the same turn, after step 7). Typical Q&A file mappings:
115
- - Named colleagues, family, friends user/people.md
116
- - Current company, role specifics, ongoing projects → user/work.md
117
- - Specific frameworks, years of experience → user/expertise.md
118
- (user/profile.md ## Expertise keeps a one-line summary only)
119
- - Long-term goals, aspirations user/goals.md
120
- - Hobbies, lifestyle habits, dietary notes → user/personal.md
121
- Only seed what the user actually stated — do not invent or infer. If
122
- nothing came up for a given file, do not touch it. See the user-profile
123
- skill for the read-before-write PATCH recipe.
124
- 9. Keep steps 7–8 silent the dashboard handles saving
125
- rules/management.md separately when the user approves the preview. Do
126
- not create or modify any other context files; the daemon seeds the
127
- rest of the primary-vault scaffold automatically.
128
-
129
- ### Questions to ask (do NOT show these labels to the user)
130
-
131
- Ask both in a single natural message:
132
-
133
- - **Communication style** — how should the agent talk to you? (e.g.,
134
- be concise, speak casually, no emojis, end every reply with a
135
- period, etc.) Skip if no preference.
136
- - **Project-management method** any preferences for how the agent
137
- should handle your projects? (e.g., break work into weekly
138
- milestones, always produce a design doc before code, prefer GitHub
139
- issues over markdown TODOs, etc.) Skip if no preference.
140
-
141
- Notification hours and working hours are NOT asked here — they default
142
- to quiet hours 22:00–08:00 and working hours Weekdays 09:00–18:00, and
143
- the user can change them on the Settings page.
144
-
145
- ### user/profile.md Format
146
-
147
- When you PUT /api/context/user/profile, write the full file in this shape so setup is deterministic:
148
-
149
- ```
150
- ---
151
- type: user
152
- owner: shared
153
- updated: 2026-04-21
154
- ---
155
- # User
156
- > Primary profile injected into every session. Keep this file concise.
157
- > Detailed profile lives under `user/`.
158
- > Fetch index: `curl -s http://localhost:8321/api/context/user/_index`
159
-
160
- ## Identity
161
- (leave bullets blank — setup does not collect name or timezone)
162
-
163
- ## Work Pattern
164
- - Working hours: Weekdays 09:00–18:00
165
-
166
- ## Platforms
167
- - Schedule: {from derived Source-of-Truth table}
168
- - Tasks: {from derived Source-of-Truth table}
169
- - Notes: {from derived Source-of-Truth table}
170
- - Projects: {from derived Source-of-Truth table}
171
-
172
- ## Expertise
173
- - {one-line summary if the user mentioned their field; otherwise leave empty}
174
-
175
- ## Notification Preferences
176
- - Quiet hours: 22:00–08:00
177
-
178
- ## Learned Context
179
-
180
- ## Raw Signals
181
- ```
182
-
183
- Use today's YYYY-MM-DD for `updated` (the date above is only an example).
184
- Do not omit `## Notification Preferences` — Morning Routine reads it directly.
185
-
186
- ### How to submit user/profile.md
187
-
188
- Use inline `-d '{"content": "..."}'` with `\n` escapes. Do NOT use
189
- `-d @-`, heredoc pipelines, or `--data-raw '@-'` — those have
190
- produced malformed bodies in this flow (server saw literal `@-` and
191
- returned 500).
192
-
193
- ```bash
194
- curl -s -X PUT http://localhost:8321/api/context/user/profile \
195
- -H 'Content-Type: application/json' \
196
- -d '{"content": "---\ntype: user\nowner: shared\nupdated: 2026-04-23\n---\n<!-- DO NOT write tone / style / voice / formality / verbosity / emoji / language preferences in this file. Those are Character-field content — write them via PATCH http://localhost:8321/api/config/character with {\"character\": \"...\"}. This file is for USER FACTS only: identity, expertise, habits, relationships, goals. -->\n# User\n> Primary profile injected into every session.\n> Detailed profile lives under `user/`.\n> Fetch index: `curl -s http://localhost:8321/api/context/user/_index`\n\n## Identity\n\n## Work Pattern\n- Working hours: Weekdays 09:00–18:00\n\n## Platforms\n- Schedule: Google Calendar\n- Notes: Obsidian\n- Projects: Notion\n\n## Expertise\n\n## Notification Preferences\n- Quiet hours: 22:00–08:00\n\n## Learned Context\n\n## Raw Signals\n"}'
197
- ```
198
-
199
- If the response is non-2xx, retry once with a smaller body or switch
200
- to section-level PATCH. Do not report the error to the user as a
201
- permission issue — the default allowlist includes `Bash(curl *)`.
202
-
203
- ### Character code block format
204
-
205
- If the user answered the communication-style question with an actual
206
- preference (not "no preference" / "skip"), emit a ```character``` code
207
- block in the same turn the management-rules block is emitted:
208
-
209
- ```character
210
- Speak casually. Tight bullets. No emojis.
211
- ```
212
-
213
- Rules for the block body:
214
- - The body is raw text — no markdown, no outer quotes, no nested fences.
215
- - Stay under the 1000-char cap; surface the excess to the user rather
216
- than silently truncating.
217
- - Emit **at most one** character block per turn.
218
-
219
- The dashboard extracts this block, stages it into an inline editor
220
- alongside the Management Rules Preview, and PATCHes `/api/config`
221
- atomically when the user clicks Save & Finish. **Do NOT call `/api/config/character` (or any `/api/config*`) yourself from the agent during setup.**
222
-
223
- If the user did not state a preference, omit the block entirely — the
224
- dashboard will leave the existing `character` value unchanged.
225
-
226
- The character value is written verbatim into every session's
227
- CLAUDE.md / AGENTS.md / GEMINI.md (between the safety preamble and
228
- the profile body) uniformly across Claude, Codex, and Gemini. Never
229
- write tone/style preferences into user/profile.md.
48
+ Defensive fallback: if `<integration_modes>` is missing from the prompt
49
+ (shouldn't happen), ask the user about all four rows rather than
50
+ fabricating defaults. Do not retry with a curl.
51
+
52
+ ### Turn 1 — Greet, present derived table, ask questions
53
+
54
+ Emit ONE natural-language message containing:
55
+
56
+ 1. A one-line greeting using `<agent_identity>` display_name.
57
+ 2. The derived Source-of-Truth table ("Here's what I picked up from
58
+ your setup — does this look right?").
59
+ 3. Any **rows you could NOT infer** (typically zero or one).
60
+ 4. Two preference questions in the **same** message — no `Q1`/`Q2`
61
+ labels, speak naturally:
62
+ - Communication style how should the agent talk to you?
63
+ (e.g., concise, casual, no emojis). Skip is OK.
64
+ - Project-management preferences any preferences for how the
65
+ agent should handle your projects? (e.g., weekly milestones,
66
+ design doc before code). Skip is OK.
67
+
68
+ Hard rules for Turn 1:
69
+
70
+ - Do **NOT** emit a `management-rules` code block.
71
+ - Do **NOT** emit a `character` code block.
72
+ - Do **NOT** call any curl.
73
+
74
+ Then wait for the user's reply.
75
+
76
+ A common failure mode here is the model treating Turn 1 as a one-shot
77
+ "produce the document" task and emitting `management-rules` before
78
+ the user has answered the dashboard would silently lock in default
79
+ preferences on the unanswered Turn-1 emission. Don't.
80
+
81
+ ### Turn 2 — After the user replies, emit the artifacts
82
+
83
+ In this exact order:
84
+
85
+ 1. Emit the `management-rules` code block **FIRST** the dashboard
86
+ reveals the preview as soon as the block lands, so emitting it
87
+ first makes visible-progress immediate. Use the template in
88
+ "rules/management.md Format" below.
89
+
90
+ 2. If the user stated a tone / style preference (not "no preference" /
91
+ "skip"), emit a `character` code block immediately after see
92
+ "Character code block format" below. Omit the block entirely if
93
+ they skipped.
94
+ **Do NOT put communication style inside rules/management.md, and do NOT put it inside user/profile.md.**
95
+ Tone / style / voice / formality / emoji / language preferences
96
+ live in the `character` runtime-config field only.
97
+
98
+ 3. Silently PUT /api/context/user/profile using the
99
+ "user/profile.md Format" template below. Working hours and quiet
100
+ hours pre-populate with defaults (Weekdays 09:00–18:00,
101
+ Quiet hours 22:00–08:00) do not ask. Fill Platforms from the
102
+ **derived Source-of-Truth table** (Step 0). Leave Identity blank
103
+ setup does not collect name or timezone.
104
+
105
+ 4. If the user shared detail-heavy facts in their reply, PATCH the
106
+ matching `user/*.md` file. **Only seed what the user actually
107
+ stated do not invent or infer.**
108
+
109
+ | Fact type | File |
110
+ |-----------|------|
111
+ | Named colleagues, family, friends | user/people.md |
112
+ | Current company, role specifics, ongoing projects | user/work.md |
113
+ | Specific frameworks, years of experience | user/expertise.md |
114
+ | Long-term goals, aspirations | user/goals.md |
115
+ | Hobbies, lifestyle habits, dietary notes | user/personal.md |
116
+
117
+ See the user-profile skill for the read-before-write PATCH recipe
118
+ and the `section_not_found` → `append_to_file` first-write
119
+ fallback. (user/profile.md `## Expertise` keeps a one-line summary
120
+ only — detailed framework history goes to user/expertise.md.)
121
+
122
+ **Important**: Do NOT curl-write rules/management.md yourself. The
123
+ dashboard persists it via `POST /setup/save-rules` when the user
124
+ clicks Save & Finish. Do NOT PATCH /api/config/character either
125
+ the dashboard stages the `character` block and writes it atomically
126
+ on Save & Finish.
127
+
128
+ ### Turn 3+ — Revisions (cap: 2 rounds)
129
+
130
+ If the user requests changes, revise the `management-rules` block and
131
+ re-emit it. Hard cap: **at most 2 revision rounds** total. Do NOT
132
+ re-run the Turn-2 curl writes — they already persisted. The dashboard
133
+ saves the revised rules block on Save & Finish.
230
134
 
231
135
  ### rules/management.md Format
232
136
 
233
- Output language: follow `<output_language_policy>`. rules/management.md
234
- is Policy B the section headers (`## Agent Identity`, `## Source of
235
- Truth`, `## Autonomy Levels`, `## Notification Rules`, `## Schedule`,
236
- `## Project Management`) are skeleton and stay English; the descriptive
237
- bullets under `## Autonomy Levels`, `## Notification Rules`, `## Schedule`,
238
- and `## Project Management` are written in `<settings primary_language>`.
239
- File-specific carve-outs that also stay English: the `## Agent Identity`
240
- field labels (`- AI name:`, `- WhatsApp label:`) — the daemon parses and
241
- rewrites this section; the Source of Truth table column headers and
242
- Domain-column row labels; and product/brand cells (`Google Calendar`,
243
- `Obsidian`, `Notion`, `today.md`, `projects/*.md`).
244
-
245
- Fill the Source of Truth table from the **derived rows you confirmed
246
- with the user in Step 0** (Schedule / Tasks / Notes / Projects).
247
- Generate using this format:
137
+ Output language: section headers stay English (the daemon parses
138
+ them); descriptive bullets under `## Autonomy Levels`, `## Notification
139
+ Rules`, `## Schedule`, `## Project Management` follow `<settings
140
+ primary_language>`. Also stay English: `## Agent Identity` field
141
+ labels (`- AI name:`, `- WhatsApp label:`), Source-of-Truth table
142
+ headers and Domain labels, and product/brand cells (`Google
143
+ Calendar`, `Obsidian`, `Notion`, `today.md`, `projects/*.md`).
144
+
145
+ Fill the Source of Truth table from the rows you confirmed in Turn 1.
146
+ Use today's YYYY-MM-DD for `updated` (the date below is an example).
248
147
 
249
148
  ```management-rules
250
149
  ---
@@ -288,18 +187,39 @@ updated: 2026-04-21
288
187
  - {user's project-management-method answer verbatim, or "No specific preferences — follow standard project practices" if they skipped}
289
188
  ```
290
189
 
291
- Use today's YYYY-MM-DD for `updated` (the date above is only an example).
190
+ Reproduce blank lines exactly every `##` heading and every table
191
+ must be preceded by a blank line. Never concatenate a heading onto
192
+ the end of the previous list item.
292
193
 
293
- ### Markdown formatting (the block is saved to disk verbatim)
194
+ ### Character code block format
294
195
 
295
- Reproduce the template's blank lines exactly every `##` heading and
296
- every table must be preceded by a blank line. Never concatenate a
297
- heading onto the end of the previous list item (e.g. `- Label:
298
- <value>## Next Section` on one line). Copy user-provided values as-is,
299
- then newline, blank line, then the next heading.
196
+ Emit only when the user stated an actual preference. Body rules:
197
+ raw text only (no markdown, no outer quotes, no nested fences),
198
+ ≤1000 chars (surface excess rather than silently truncating), at
199
+ most one block per turn.
300
200
 
301
- **Important**: Do NOT curl-write rules/management.md to disk yourself.
302
- The dashboard persists it via `POST /setup/save-rules` when the user
303
- clicks Save & Finish. (The silent curl PUT to /api/context/user/profile
304
- in step 7 and the user/*.md PATCHes in step 8 ARE required — only the
305
- rules file is saved by the dashboard.)
201
+ ```character
202
+ Speak casually. Tight bullets. No emojis.
203
+ ```
204
+
205
+ ### user/profile.md Format
206
+
207
+ When you PUT /api/context/user/profile, write the full file in this
208
+ shape. Use today's YYYY-MM-DD for `updated`. Do not omit
209
+ `## Notification Preferences` — Morning Routine reads it directly.
210
+
211
+ Use inline `-d '{"content": "..."}'` with `\n` escapes. Do **NOT**
212
+ use `-d @-`, heredoc pipelines, or `--data-raw '@-'` — those have
213
+ produced malformed bodies in this flow (server saw literal `@-` and
214
+ returned 500).
215
+
216
+ ```bash
217
+ curl -s -X PUT http://localhost:8321/api/context/user/profile \
218
+ -H 'Content-Type: application/json' \
219
+ -d '{"content": "---\ntype: user\nowner: shared\nupdated: 2026-04-23\n---\n# User\n\n## Identity\n\n## Work Pattern\n- Working hours: Weekdays 09:00–18:00\n\n## Platforms\n- Schedule: Google Calendar\n- Notes: Obsidian\n- Projects: Notion\n\n## Expertise\n\n## Notification Preferences\n- Quiet hours: 22:00–08:00\n\n## Learned Context\n\n## Raw Signals\n"}'
220
+ ```
221
+
222
+ If the response is non-2xx, retry once with a smaller body or switch
223
+ to section-level PATCH. The default allowlist includes
224
+ `Bash(curl *)` — a denial here is a body-shape issue, not a
225
+ permission issue.
@@ -26,7 +26,7 @@ The shim reads stdin when `-d @-` is passed, so the heredoc body lands as the JS
26
26
 
27
27
  ### Procedure
28
28
 
29
- 1. Fetch the URL with the per-backend primitive (WebFetch on Claude, curl on Codex, web_fetch on Gemini).
29
+ 1. Fetch the URL with the per-backend primitive (WebFetch on Claude, curl on Codex/OpenCode, web_fetch on Gemini).
30
30
  2. POST one new note at `10_raw/<slug>.md` via the daemon Wiki API with `-H 'x-process-key: wiki.ingest_url'`. Path is EXACTLY `10_raw/<slug>.md` — no nested folders like `10_raw/articles/...`.
31
31
  3. **Inspect the curl response.** Only `{"ok":true,"path":"10_raw/<slug>.md"}` counts as success. Anything else (4xx, 5xx, missing fields, hallucinated endpoint like `/api/send-message`, no response) means the file was NOT created — PATCH `log.md` with the failure reason and emit the failure DM.
32
32
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
- "generatedAt": "2026-04-23",
3
+ "generatedAt": "2026-05-18",
4
4
  "notes": "Auto-generated inventory of versioned templates. Each entry's 'version' must equal the `template_version:` field in the corresponding template file's frontmatter. Bump both in the same PR. A unit test asserts this consistency.",
5
5
  "templates": {
6
6
  "_index.md": {
@@ -64,7 +64,7 @@
64
64
  "version": 1
65
65
  },
66
66
  "rules/journal-format.md": {
67
- "version": 1
67
+ "version": 3
68
68
  },
69
69
  "rules/management.md": {
70
70
  "version": 2
@@ -82,22 +82,22 @@
82
82
  "version": 1
83
83
  },
84
84
  "user/expertise.md": {
85
- "version": 1
85
+ "version": 2
86
86
  },
87
87
  "user/goals.md": {
88
- "version": 1
88
+ "version": 2
89
89
  },
90
90
  "user/people.md": {
91
- "version": 1
91
+ "version": 2
92
92
  },
93
93
  "user/personal.md": {
94
- "version": 1
94
+ "version": 2
95
95
  },
96
96
  "user/profile.md": {
97
97
  "version": 2
98
98
  },
99
99
  "user/work.md": {
100
- "version": 1
100
+ "version": 2
101
101
  }
102
102
  }
103
103
  }
@@ -15,7 +15,7 @@ Injected into prompts through the root-level context-index.md catalog.
15
15
  | File | Process key |
16
16
  |---|---|
17
17
  | `hourly.md` | `routine.hourly_check` |
18
- | `morning.md` | `routine.morning_routine`, `routine.morning_routine_initial` |
18
+ | `morning.md` | `routine.morning_routine`, `routine.morning_routine_today` |
19
19
  | `evening.md` | `routine.evening_review` |
20
20
  | `weekly.md` | `routine.weekly_review` |
21
21
  | `monthly.md` | `routine.monthly_review` |