@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
@@ -0,0 +1,264 @@
1
+ /**
2
+ * `aitne verify <target>` — post-launch verification for shipped design
3
+ * surfaces. Each target bundles a small set of pass/warn/fail checks an
4
+ * operator runs once after a rollout to confirm the change actually
5
+ * delivered what it promised.
6
+ *
7
+ * Targets:
8
+ * - `evening-review-slimdown` — Phase 4 of
9
+ * `docs/design/appendices/evening-review-slimdown.md`. Confirms the
10
+ * four post-launch invariants the doc lists (cron audit freshness,
11
+ * token-envelope drop, conditional notify load, 30-day notify
12
+ * invocation sample).
13
+ *
14
+ * Verify is read-only and offline. No daemon HTTP call, no DB writes,
15
+ * no network. Safe to run while the daemon is up (the daemon enables
16
+ * WAL — concurrent readers are fine) or while it is stopped (we open
17
+ * the SQLite file in readonly mode).
18
+ *
19
+ * The check logic itself lives in
20
+ * `packages/daemon/src/core/evening-review-verify.ts` so the rulebook
21
+ * predicate is reused verbatim from the daemon (no drift risk) and the
22
+ * checks are unit-testable under the daemon's coverage gate. This file
23
+ * is a thin CLI wrapper: parse args → resolve contextDir → call the
24
+ * typed runner → render.
25
+ *
26
+ * Exit codes:
27
+ * 0 every check returned pass or warn
28
+ * 1 at least one check returned fail
29
+ * 2 argument error / unknown target
30
+ * 3 the SQLite file or daemon dist is missing
31
+ */
32
+ import fs from "node:fs";
33
+ import path from "node:path";
34
+ import { fileURLToPath, pathToFileURL } from "node:url";
35
+
36
+ const KNOWN_TARGETS = new Set(["evening-review-slimdown"]);
37
+
38
+ export async function run(args, ctx) {
39
+ if (args.includes("--help") || args.includes("-h")) {
40
+ printHelp();
41
+ return;
42
+ }
43
+ const opts = parseArgs(args);
44
+
45
+ if (!KNOWN_TARGETS.has(opts.target)) {
46
+ process.stderr.write(`Unknown verify target: ${opts.target}\n`);
47
+ process.stderr.write(`Available targets: ${[...KNOWN_TARGETS].join(", ")}\n`);
48
+ process.exit(2);
49
+ }
50
+
51
+ const dbPath = path.join(ctx.DATA_DIR, "data", "personal_agent.db");
52
+ if (!fs.existsSync(dbPath)) {
53
+ process.stderr.write(
54
+ `SQLite file not found at ${dbPath}.\n` +
55
+ `Has the daemon been started? Run \`aitne start\` first.\n`,
56
+ );
57
+ process.exit(3);
58
+ }
59
+
60
+ const verifyMod = await loadVerifyModule(ctx.PROJECT_ROOT);
61
+ if (!verifyMod) {
62
+ process.stderr.write(
63
+ "Daemon dist is missing — `packages/daemon/dist/core/evening-review-verify.js` " +
64
+ "did not resolve.\nRun `aitne build` first (or `aitne start`, which builds " +
65
+ "if stale).\n",
66
+ );
67
+ process.exit(3);
68
+ }
69
+
70
+ const { loadBetterSqlite3 } = await import("../lib/sqlite-loader.mjs");
71
+ const Database = await loadBetterSqlite3(ctx.PROJECT_ROOT);
72
+ const db = new Database(dbPath, { readonly: true, fileMustExist: true });
73
+
74
+ let report;
75
+ try {
76
+ const contextDir = verifyMod.resolveContextDirFromDb(db, ctx.DATA_DIR);
77
+ report = verifyMod.runEveningReviewSlimdownChecks({
78
+ db,
79
+ contextDir,
80
+ windowDays: opts.days,
81
+ });
82
+ } finally {
83
+ db.close();
84
+ }
85
+
86
+ if (opts.json) {
87
+ process.stdout.write(JSON.stringify(report, null, 2) + "\n");
88
+ process.exit(report.summary.failed > 0 ? 1 : 0);
89
+ }
90
+
91
+ printReport(opts.target, report, ctx);
92
+ process.exit(report.summary.failed > 0 ? 1 : 0);
93
+ }
94
+
95
+ // ─────────────────────────────────────────────────────────────────────────
96
+ // CLI parsing
97
+ // ─────────────────────────────────────────────────────────────────────────
98
+
99
+ function parseArgs(args) {
100
+ const opts = {
101
+ target: "evening-review-slimdown",
102
+ days: 7,
103
+ json: false,
104
+ };
105
+
106
+ let positional = null;
107
+ for (let i = 0; i < args.length; i++) {
108
+ const a = args[i];
109
+ if (a === "--json") {
110
+ opts.json = true;
111
+ continue;
112
+ }
113
+ if (a === "--days") {
114
+ if (i + 1 >= args.length) {
115
+ process.stderr.write("--days requires a value\n");
116
+ process.exit(2);
117
+ }
118
+ const raw = args[++i];
119
+ const n = parseInt(raw, 10);
120
+ if (!Number.isFinite(n) || n <= 0 || n > 365) {
121
+ process.stderr.write(`--days must be a positive integer ≤ 365 (got: ${raw})\n`);
122
+ process.exit(2);
123
+ }
124
+ opts.days = n;
125
+ continue;
126
+ }
127
+ if (a.startsWith("-")) {
128
+ process.stderr.write(`Unknown flag: ${a}\n`);
129
+ process.stderr.write("See `aitne verify --help`.\n");
130
+ process.exit(2);
131
+ }
132
+ if (positional !== null) {
133
+ process.stderr.write(`Unexpected positional argument: ${a}\n`);
134
+ process.exit(2);
135
+ }
136
+ positional = a;
137
+ }
138
+ if (positional !== null) opts.target = positional;
139
+ return opts;
140
+ }
141
+
142
+ // ─────────────────────────────────────────────────────────────────────────
143
+ // Daemon module + contextDir resolution
144
+ // ─────────────────────────────────────────────────────────────────────────
145
+
146
+ /**
147
+ * Dynamically import the compiled `evening-review-verify` module from
148
+ * the daemon's dist directory. Returns null when the dist is missing so
149
+ * the caller can surface a clear "build first" hint instead of a stack
150
+ * trace.
151
+ *
152
+ * Three resolution paths cover every shipping shape:
153
+ *
154
+ * 1. Workspace dev — pnpm symlinks `node_modules/@aitne/daemon` →
155
+ * `packages/daemon`, so the compiled module sits under the repo's
156
+ * own `packages/daemon/dist/`. Direct filesystem path.
157
+ * 2. Published install — `npm i -g @aitne-sh/aitne` installs
158
+ * `@aitne/daemon` as a sibling under `<install>/node_modules/`.
159
+ * The daemon's `package.json` only exports `.` (its barrel
160
+ * index), so `import("@aitne/daemon/core/...")` is blocked by
161
+ * Node's exports-field gate. Resolve the barrel via
162
+ * `import.meta.resolve("@aitne/daemon")` to get the daemon root,
163
+ * then reach the sibling file directly.
164
+ * 3. Legacy flatten — historical install layout where `dist/` ended up
165
+ * at the project root. Kept as a last-resort fallback so a future
166
+ * build/publish change doesn't silently break this CLI.
167
+ *
168
+ * The barrel `index.ts` does NOT re-export this module by design —
169
+ * verify is operator-tooling, not a daemon API surface — so we always
170
+ * go through the filesystem path rather than `import("@aitne/daemon")`.
171
+ */
172
+ async function loadVerifyModule(projectRoot) {
173
+ const candidates = [
174
+ // 1. Workspace dev (pnpm symlink).
175
+ path.join(projectRoot, "packages/daemon/dist/core/evening-review-verify.js"),
176
+ ];
177
+ // 2. Published install — resolve via the daemon's own package root.
178
+ try {
179
+ const daemonMainUrl = import.meta.resolve("@aitne/daemon");
180
+ const daemonMainPath = fileURLToPath(daemonMainUrl);
181
+ candidates.push(
182
+ path.join(path.dirname(daemonMainPath), "core/evening-review-verify.js"),
183
+ );
184
+ } catch {
185
+ // @aitne/daemon not resolvable from this context — fall through to
186
+ // the legacy candidate below.
187
+ }
188
+ // 3. Legacy flatten fallback (defensive).
189
+ candidates.push(path.join(projectRoot, "dist/core/evening-review-verify.js"));
190
+
191
+ for (const candidate of candidates) {
192
+ if (fs.existsSync(candidate)) {
193
+ return import(pathToFileURL(candidate).href);
194
+ }
195
+ }
196
+ return null;
197
+ }
198
+
199
+ // ContextDir resolution lives in the typed daemon module
200
+ // (`resolveContextDirFromDb`) so the degraded-mode branch + tilde
201
+ // expansion are unit-tested in lockstep with `getContextDir`.
202
+
203
+ // ─────────────────────────────────────────────────────────────────────────
204
+ // Output
205
+ // ─────────────────────────────────────────────────────────────────────────
206
+
207
+ function printReport(target, report, ctx) {
208
+ console.log(`${ctx.APP_NAME} verify ${target} — ${report.checks.length} check(s)`);
209
+ console.log("");
210
+ const labelWidth = Math.max(...report.checks.map((c) => c.label.length));
211
+ for (const c of report.checks) {
212
+ const mark = c.status === "pass" ? "ok " : c.status === "warn" ? "warn" : "FAIL";
213
+ const label = c.label.padEnd(labelWidth);
214
+ console.log(` [${mark}] ${label} ${c.detail}`);
215
+ if (c.hint && c.status !== "pass") {
216
+ console.log(` ${" ".repeat(labelWidth)} hint: ${c.hint}`);
217
+ }
218
+ }
219
+ const { passed, warned, failed, windowDays, installAgeDays } = report.summary;
220
+ console.log("");
221
+ console.log(
222
+ `${passed} ok · ${warned} warn · ${failed} fail · window ${windowDays}d · install age ~${installAgeDays}d`,
223
+ );
224
+ }
225
+
226
+ // ─────────────────────────────────────────────────────────────────────────
227
+ // Help
228
+ // ─────────────────────────────────────────────────────────────────────────
229
+
230
+ function printHelp() {
231
+ console.log(`Usage: aitne verify [target] [flags]
232
+
233
+ Run post-launch verification for a shipped design surface. Read-only —
234
+ no daemon HTTP call required, no DB writes, no network. Safe to invoke
235
+ any time.
236
+
237
+ Targets:
238
+ evening-review-slimdown (default)
239
+ Phase 4 of docs/design/appendices/evening-review-slimdown.md.
240
+ Bundles four checks:
241
+ 1. Daily 17:45 \`roadmap_mechanical_maintenance\` audit row.
242
+ 2. evening_review session envelope (cost / turns / tokens).
243
+ 3. Conditional notify load (resolveSkillManifest mirror).
244
+ 4. 30-day notify invocations attributable to evening_review.
245
+
246
+ Flags:
247
+ --days <N> Window for time-bounded checks (default 7, max 365).
248
+ Capped at install age automatically; the 30-day notify
249
+ sample uses min(30, install age) regardless.
250
+ --json Machine-readable output. Implies no terminal formatting.
251
+ -h, --help Print this message.
252
+
253
+ Exit codes:
254
+ 0 every check returned pass or warn
255
+ 1 at least one check returned fail
256
+ 2 argument error / unknown target
257
+ 3 SQLite file or daemon dist missing — run \`aitne start\` once first
258
+
259
+ Examples:
260
+ aitne verify
261
+ aitne verify evening-review-slimdown --days 14
262
+ aitne verify --json | jq '.summary'
263
+ aitne verify --json | jq '.checks[] | select(.status != "pass")'`);
264
+ }
@@ -1,65 +0,0 @@
1
- ---
2
- schema_version: 1
3
- slug: features/routines/monthly-review
4
- title: Monthly Review
5
- id: monthly-review
6
- aliases:
7
- - monthly retro
8
- category: features
9
- summary: |
10
- Once a month, the agent rolls up the four weekly retros into a
11
- single monthly synthesis under monthly/<YYYY-MM>.md.
12
- section: routines
13
- tags:
14
- - routine
15
- - autonomous
16
- - light-tier
17
- status: stable
18
- ask_examples:
19
- - When does the monthly review fire?
20
- - Where do monthly retros live?
21
- locale: en-US
22
- created: 2026-04-25
23
- updated: 2026-04-25
24
- related:
25
- - features/routines/weekly-review
26
- process_keys:
27
- - routine.monthly_review
28
- ---
29
-
30
- # Monthly Review
31
-
32
- ## In One Sentence
33
-
34
- Light-tier monthly retro that synthesizes the four weekly reviews into
35
- a single monthly file.
36
-
37
- ## What It Does
38
-
39
- - Reads the past month of weekly retros.
40
- - Surfaces threads, recurring patterns, and unfinished pushes.
41
- - Writes the synthesis into `monthly/<YYYY-MM>.md`.
42
-
43
- ## When It Runs / How It Is Triggered
44
-
45
- The **last day of the calendar month at 18:00 local time**. The schedule
46
- is fixed in `packages/daemon/src/core/scheduler.ts` and is not
47
- operator-configurable.
48
-
49
- ## What It Outputs
50
-
51
- - A single `monthly/<YYYY-MM>.md` file.
52
-
53
- ## Configuration
54
-
55
- This routine has no operator-tunable knobs. The fire time, day-of-month,
56
- and tier are fixed in code.
57
-
58
- ## When Something Goes Wrong
59
-
60
- - A late-month install will skip the first month's retro because
61
- there are not four weekly retros to synthesize yet.
62
-
63
- ## Related
64
-
65
- - [Weekly Review](weekly-review.md)
@@ -1,203 +0,0 @@
1
- ---
2
- name: management-task-modify
3
- description: Change cadence, intent, or output path on an existing managed task (`mt_<n>`) from a DM — "move daily Zoom check to 9am", "switch Gmail triage to Mondays". Owns PATCH on §B rows. SKIP for new registrations, stops, or app changes.
4
- when_to_use: User wants to keep a managed task running but adjust its cadence / intent / output path. SKIP for new registrations (`management-task-register`), stops (`management-task-stop`), or one-off run-now (`POST /api/managed-tasks/:id/run-now`).
5
- allowed-tools:
6
- - Bash(curl *)
7
- - Bash(jq *)
8
- - Read
9
- ---
10
-
11
- # Modify a Managed Task
12
-
13
- Changes the cadence, intent, or `Output path` on an existing
14
- `mt_<n>` row in place. The `mt_id` is preserved across modifications
15
- so historical references in `agent_actions` and
16
- `_activity/<source>.md` remain unambiguous (§10.2).
17
-
18
- ## When to use
19
-
20
- The user clearly references an existing recurring commitment and asks
21
- to change its **cadence**, **intent text**, or **output path**:
22
-
23
- - "Move the Zoom check to 9am instead of 10am"
24
- - "Switch the Gmail invoice triage to every Monday"
25
- - "Send Drive receipts to `finance/receipts/` instead of `personal/receipts/`"
26
- - "Rename the intent on `mt_42` to `Zoom recordings → meeting notes`"
27
-
28
- ## When NOT to use
29
-
30
- | Shape | Use instead |
31
- |---|---|
32
- | New recurring commitment | `management-task-register` |
33
- | User wants to stop / pause it | `management-task-stop` (no soft-pause; hard-delete + re-register if they want to resume) |
34
- | User wants to run once off-schedule | `POST /api/managed-tasks/<id>/run-now` |
35
- | User wants to change which **app** an existing task targets | `management-task-stop` then `management-task-register` (different connector ⇒ different commitment) |
36
- | User wants to change the SoT for a category | `PUT /api/sot-bindings` (A-section flow) |
37
-
38
- A change of `app` is a different commitment — stop and re-register
39
- rather than mutating the row, because the connector probe must run
40
- fresh and the entity-mirror associations may differ.
41
-
42
- ## Algorithm (mirror of design 21 §10.2)
43
-
44
- ### Step 1 — Locate the row
45
-
46
- Read the registry and find the row the user means. If the user named
47
- an `mt_<n>` directly, fetch by id; otherwise dedup by `(app, cadence,
48
- intent)` the same way `management-task-register` does.
49
-
50
- ```bash
51
- # By id when the user said "mt_42":
52
- curl -s "http://localhost:8321/api/managed-tasks/mt_42" | jq .item
53
-
54
- # By app fuzzy lookup:
55
- curl -s "http://localhost:8321/api/managed-tasks" | jq '.items[] | select(.app_normalized == "zoom")'
56
- ```
57
-
58
- GET-by-id wraps the row in `{item:<row>}`; the list returns
59
- `{items:[…], count:N}`.
60
-
61
- If no row matches, DM:
62
-
63
- > No managed task for `<app>` is registered. Want me to register one?
64
-
65
- If multiple rows could plausibly match, list them with id + cadence +
66
- intent and ask the user to pick. Stop until they reply.
67
-
68
- ### Step 2 — Diff the requested change
69
-
70
- Map the user's request to one or more of these fields:
71
-
72
- | User request | PATCH field | Notes |
73
- |---|---|---|
74
- | "9am instead of 10am" / "every Monday" | `cadence` + `recurrenceRule` (send both together) | Same `recurrenceRule` shape as `management-task-register` Step 5; only `daily`/`weekly`/`monthly` are representable |
75
- | "Rename intent" / "describe it as `<text>`" | `intent` | ≤ 200 chars, NFC, no `\n`, no `\|` |
76
- | "Send to `<dir>/`" | `output_path` | Validate against §9.3 (`<domain>/<type-plural>/`, trailing `/`, no `..`); send `null` to clear |
77
-
78
- If the request implies **app change**, stop and route the user to
79
- "stop + re-register" (Step 1 disambiguator above).
80
-
81
- ### Step 3 — Confirm with the user before mutating (Notify tier)
82
-
83
- PATCH on a managed task is **Notify tier** (§13.1). DM the user
84
- verbatim with the proposed change and wait for an explicit yes:
85
-
86
- > `mt_42` Zoom check — change cadence from `daily 10:00 (Asia/Tokyo)`
87
- > to `daily 09:00 (Asia/Tokyo)`?
88
-
89
- Only after the user confirms do you issue the PATCH. If they decline
90
- or amend, restart at Step 2 with the new shape.
91
-
92
- When the user's confirmation also implies a different output path
93
- ("…and write into `work/meetings/agendas/`"), include both fields in
94
- one PATCH so the audit row reflects the user's actual intent in a
95
- single transition.
96
-
97
- ### Step 4 — PATCH /api/managed-tasks/:id
98
-
99
- ```bash
100
- curl -sS -X PATCH http://localhost:8321/api/managed-tasks/mt_42 \
101
- -H 'Content-Type: application/json' \
102
- -d @- <<'JSON'
103
- {
104
- "cadence": "daily 09:00 (Asia/Tokyo)",
105
- "recurrenceRule": {
106
- "frequency": "daily",
107
- "time": "09:00",
108
- "timezone": "Asia/Tokyo"
109
- }
110
- }
111
- JSON
112
- ```
113
-
114
- | Field | When to send | Notes |
115
- |---|---|---|
116
- | `cadence` + `recurrenceRule` | Cadence change | Send both together so the rendered §B label matches the executable schedule. PATCH body must include at least one mutable field; an empty body returns `validation_error`. |
117
- | `intent` | Intent rename | ≤ 200 chars; trimmed + NFC at the boundary |
118
- | `output_path` | Output relocation | `<domain>/<type-plural>/` per §9.3; `null` clears it (back to "first run decides") |
119
-
120
- `app` / `app_normalized` / `last_run_at` / `last_result` /
121
- `consecutive_failures` are NOT mutable through this PATCH. Run-result
122
- writes go through the internal `/run-result` route used by
123
- `scheduled-managed-task`; app rename goes through the dedicated
124
- `POST /api/managed-tasks/:id/rename-app` (Step 1 disambiguator above
125
- already routes that case to "stop + re-register" for safety).
126
-
127
- The server-side transaction:
128
-
129
- a. UPDATEs `recurring_schedules` (if `recurrenceRule` changed),
130
- b. UPDATEs `managed_tasks.{intent,cadence,output_path,updated_at}`,
131
- c. re-renders `rules/management.md` from DB (locked + snapshotted),
132
- d. INSERTs `agent_actions` (`action_type='management_task.modified',
133
- detail={changed, from, to}`).
134
-
135
- The response is `{status:"updated", item:<ManagedTask>, render_status}`.
136
-
137
- The `mt_id`, `last_run_at`, `last_result`, and
138
- `consecutive_failures` are preserved across the PATCH — history is
139
- continuous (§10.2).
140
-
141
- A cadence change cancels any in-flight `agent_schedule` row tied to
142
- the old cron; the new cron takes effect from the next eligible slot.
143
- Do not separately DELETE `agent_schedule` items — the daemon owns
144
- that.
145
-
146
- **Output-path relocation does NOT move existing entity files.** Past
147
- entities stay where they were written. If the user wants
148
- re-organization, stop the task, move the entity files manually (or
149
- ask the user to), and re-register.
150
-
151
- ### Step 5 — Confirm to user
152
-
153
- One DM, persona-tone (`notify` skill discipline applies). Read the
154
- resolved fields from the PATCH response — do NOT echo what you sent
155
- in case the daemon normalized something:
156
-
157
- > Updated `mt_42` Zoom check — now daily 09:00 JST. Next run 2026-12-05 09:00 JST.
158
-
159
- If the PATCH only changed `intent` or `output_path` (no cadence
160
- shift), do not announce a "next run" line — the next firing is
161
- unchanged.
162
-
163
- ## Error envelope
164
-
165
- | HTTP | `error` | What to do |
166
- |---|---|---|
167
- | 400 | `invalid_id` | The `:id` segment didn't match `^mt_[1-9]\d*$`; the user typed the id wrong — ask them to repeat |
168
- | 400 | `validation_error` | Body has Zod `details`; pin the failing path (e.g. `recurrenceRule.daysOfWeek` not allowed for `daily`) and ask for a fix |
169
- | 404 | `not_found` | DM "I don't have an `mt_<id>` to modify"; offer to register one |
170
- | 5xx | `internal_error` | Surface `body.message` if present; advise `aitne logs` |
171
-
172
- The daemon does not currently emit `cron_too_tight` (the recurrence
173
- schema only accepts daily/weekly/monthly — sub-daily is impossible),
174
- nor `cadence_partial` (the recurrence rule is one structured field, so
175
- there is no partial-cadence shape to reject). If a future schema gain
176
- adds them, surface them verbatim.
177
-
178
- ## What this skill does NOT do
179
-
180
- - Does NOT mutate `app` — that is a different commitment, stop +
181
- re-register.
182
- - Does NOT pause / disable a task — there is no soft-pause; stop +
183
- re-register if the user wants a hiatus.
184
- - Does NOT touch §A (SoT bindings) or §C (Active Policies).
185
- - Does NOT PUT `rules/management.md` directly. The daemon owns the
186
- file write.
187
- - Does NOT migrate entity files when `output_path` changes; only
188
- future runs honor the new path.
189
- - Does NOT auto-confirm "this looks right" — Notify-tier means a real
190
- user-facing confirmation. Output language: follow
191
- `<output_language_policy>`.
192
-
193
- ## API summary
194
-
195
- | Verb + path | Used in |
196
- |---|---|
197
- | `GET /api/managed-tasks` | Step 1 (lookup by app/cadence) |
198
- | `GET /api/managed-tasks/:id` | Step 1 (lookup by id) |
199
- | `PATCH /api/managed-tasks/:id` | Step 4 (Notify-tier) |
200
- | `POST /api/notify` | Step 5 (user-facing confirmation) |
201
-
202
- The PATCH writes one `agent_actions` row and snapshots the file —
203
- do NOT post a separate audit event yourself.