@aitne-sh/aitne 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/README.md +256 -833
  2. package/agent-assets/agent-profiles/_safety.md +52 -20
  3. package/agent-assets/agent-profiles/browser-task.md +108 -0
  4. package/agent-assets/agent-profiles/conversational.md +3 -3
  5. package/agent-assets/agent-profiles/profile-importer.md +3 -3
  6. package/agent-assets/agent-profiles/routine-fetch-window.md +30 -19
  7. package/agent-assets/agent-profiles/routine.md +4 -3
  8. package/agent-assets/agents/context-index-reconcile/agent.md +52 -0
  9. package/agent-assets/agents/evening-review/agent.md +53 -0
  10. package/agent-assets/agents/hourly-check/agent.md +62 -0
  11. package/agent-assets/agents/monthly-review/agent.md +55 -0
  12. package/agent-assets/agents/morning-routine/agent.md +78 -0
  13. package/agent-assets/agents/roadmap-maintenance/agent.md +52 -0
  14. package/agent-assets/agents/skill-curation/agent.md +52 -0
  15. package/agent-assets/agents/user-profile-sweep-evening/agent.md +48 -0
  16. package/agent-assets/agents/user-profile-sweep-morning/agent.md +53 -0
  17. package/agent-assets/agents/weekly-review/agent.md +51 -0
  18. package/agent-assets/docs/concepts/agent-day.md +18 -11
  19. package/agent-assets/docs/concepts/auth-health.md +56 -10
  20. package/agent-assets/docs/concepts/backends-and-tiers.md +110 -41
  21. package/agent-assets/docs/concepts/costs-and-quotas.md +74 -19
  22. package/agent-assets/docs/concepts/delegated-mode.md +193 -75
  23. package/agent-assets/docs/concepts/memory-model.md +79 -34
  24. package/agent-assets/docs/concepts/observations.md +61 -11
  25. package/agent-assets/docs/concepts/process-keys.md +66 -17
  26. package/agent-assets/docs/concepts/routines.md +77 -32
  27. package/agent-assets/docs/concepts/safety-and-execution.md +50 -21
  28. package/agent-assets/docs/concepts/safety-model.md +62 -37
  29. package/agent-assets/docs/concepts/skills.md +38 -17
  30. package/agent-assets/docs/features/integrations/browser-history.md +195 -0
  31. package/agent-assets/docs/features/integrations/calendar.md +40 -30
  32. package/agent-assets/docs/features/integrations/git.md +20 -9
  33. package/agent-assets/docs/features/integrations/github.md +93 -35
  34. package/agent-assets/docs/features/integrations/mail.md +60 -17
  35. package/agent-assets/docs/features/integrations/notion.md +51 -11
  36. package/agent-assets/docs/features/integrations/obsidian.md +35 -7
  37. package/agent-assets/docs/features/lifestyle/git.md +45 -44
  38. package/agent-assets/docs/features/lifestyle/reading.md +50 -22
  39. package/agent-assets/docs/features/lifestyle/receipts.md +66 -21
  40. package/agent-assets/docs/features/lifestyle/travel-bookings.md +91 -14
  41. package/agent-assets/docs/features/memory-files/agent-journal.md +111 -50
  42. package/agent-assets/docs/features/memory-files/projects.md +75 -15
  43. package/agent-assets/docs/features/memory-files/roadmap.md +55 -10
  44. package/agent-assets/docs/features/memory-files/schedule.md +113 -70
  45. package/agent-assets/docs/features/memory-files/today.md +47 -21
  46. package/agent-assets/docs/features/memory-files/user-profile.md +67 -31
  47. package/agent-assets/docs/features/messaging/bang-commands.md +115 -28
  48. package/agent-assets/docs/features/messaging/dashboard-chat.md +43 -21
  49. package/agent-assets/docs/features/messaging/discord.md +46 -4
  50. package/agent-assets/docs/features/messaging/overview.md +40 -19
  51. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +94 -27
  52. package/agent-assets/docs/features/messaging/slack.md +79 -14
  53. package/agent-assets/docs/features/messaging/telegram.md +25 -6
  54. package/agent-assets/docs/features/messaging/whatsapp.md +79 -14
  55. package/agent-assets/docs/features/operations/activity-and-conversations.md +45 -16
  56. package/agent-assets/docs/features/operations/approvals.md +53 -15
  57. package/agent-assets/docs/features/operations/backend-routing.md +75 -16
  58. package/agent-assets/docs/features/operations/cost-tracking.md +90 -17
  59. package/agent-assets/docs/features/operations/managed-chromium.md +221 -0
  60. package/agent-assets/docs/features/operations/notifications.md +58 -11
  61. package/agent-assets/docs/features/operations/quiet-hours.md +63 -40
  62. package/agent-assets/docs/features/operations/schedule-approaching.md +59 -16
  63. package/agent-assets/docs/features/routines/custom-routines.md +97 -23
  64. package/agent-assets/docs/features/routines/evening-review.md +75 -22
  65. package/agent-assets/docs/features/routines/hourly-check.md +150 -30
  66. package/agent-assets/docs/features/routines/morning-routine.md +60 -33
  67. package/agent-assets/docs/features/routines/weekly-review.md +65 -20
  68. package/agent-assets/docs/features/wiki/commands.md +37 -16
  69. package/agent-assets/docs/features/wiki/cost-and-approval.md +240 -0
  70. package/agent-assets/docs/features/wiki/dashboard.md +255 -0
  71. package/agent-assets/docs/features/wiki/overview.md +80 -12
  72. package/agent-assets/docs/features/wiki/search.md +248 -0
  73. package/agent-assets/docs/features/wiki/workspaces.md +254 -0
  74. package/agent-assets/docs/getting-started/01-what-is-this.md +64 -32
  75. package/agent-assets/docs/getting-started/02-first-steps.md +28 -10
  76. package/agent-assets/docs/getting-started/03-what-can-this-do.md +42 -21
  77. package/agent-assets/docs/getting-started/04-first-day.md +52 -20
  78. package/agent-assets/docs/glossary.md +285 -21
  79. package/agent-assets/docs/guides/add-a-custom-routine.md +74 -22
  80. package/agent-assets/docs/guides/backup-and-restore.md +92 -14
  81. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +62 -25
  82. package/agent-assets/docs/guides/build-your-wiki.md +33 -6
  83. package/agent-assets/docs/guides/change-which-model-handles-x.md +70 -9
  84. package/agent-assets/docs/guides/connect-a-new-mail-account.md +80 -15
  85. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +32 -9
  86. package/agent-assets/docs/guides/import-knowledge-file.md +60 -39
  87. package/agent-assets/docs/guides/install-and-run.md +64 -19
  88. package/agent-assets/docs/guides/maintain-wiki-health.md +41 -10
  89. package/agent-assets/docs/guides/migrate-machines.md +86 -18
  90. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +119 -59
  91. package/agent-assets/docs/guides/pause-the-agent.md +71 -22
  92. package/agent-assets/docs/guides/reinstall-cleanly.md +102 -17
  93. package/agent-assets/docs/guides/setup-wizard.md +126 -56
  94. package/agent-assets/docs/guides/switch-default-backend.md +72 -17
  95. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +31 -10
  96. package/agent-assets/docs/reference/api.md +162 -23
  97. package/agent-assets/docs/reference/cli-commands.md +55 -15
  98. package/agent-assets/docs/reference/config.md +246 -39
  99. package/agent-assets/docs/reference/disallowed-tools.md +42 -10
  100. package/agent-assets/docs/reference/keyboard-shortcuts.md +47 -10
  101. package/agent-assets/docs/reference/knowledge-layout.md +620 -0
  102. package/agent-assets/docs/reference/process-keys.md +126 -20
  103. package/agent-assets/docs/reference/skills.md +62 -18
  104. package/agent-assets/docs/troubleshooting/auth-failed.md +53 -19
  105. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +96 -22
  106. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +94 -20
  107. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +77 -22
  108. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +87 -22
  109. package/agent-assets/docs/troubleshooting/observation-not-detected.md +85 -21
  110. package/agent-assets/docs/troubleshooting/quota-exhausted.md +36 -6
  111. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +128 -51
  112. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +33 -11
  113. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
  114. package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +1 -1
  115. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
  116. package/agent-assets/sandbox/linux/aitne-chromium.apparmor +91 -0
  117. package/agent-assets/sandbox/macos/aitne-chromium.sb +156 -0
  118. package/agent-assets/skills/agent-actions/SKILL.md +122 -0
  119. package/agent-assets/skills/agent-create/SKILL.md +149 -0
  120. package/agent-assets/skills/attach/SKILL.md +3 -4
  121. package/agent-assets/skills/browser-history/SKILL.md +198 -0
  122. package/agent-assets/skills/browser-history-respond/SKILL.md +106 -0
  123. package/agent-assets/skills/browser-task/SKILL.md +169 -0
  124. package/agent-assets/skills/context/SKILL.md +45 -463
  125. package/agent-assets/skills/context/curation.json +2 -2
  126. package/agent-assets/skills/context/references/api.md +232 -0
  127. package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
  128. package/agent-assets/skills/context/references/snapshot-files.md +103 -0
  129. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +4 -4
  130. package/agent-assets/skills/docs-search/SKILL.md +17 -16
  131. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +14 -26
  132. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +14 -26
  133. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +14 -26
  134. package/agent-assets/skills/external-services/SKILL.md +9 -262
  135. package/agent-assets/skills/external-services/SKILL.native.claude.md +6 -7
  136. package/agent-assets/skills/external-services/SKILL.native.codex.md +8 -9
  137. package/agent-assets/skills/external-services/SKILL.native.gemini.md +5 -6
  138. package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
  139. package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
  140. package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
  141. package/agent-assets/skills/external-services/references/github.md +17 -0
  142. package/agent-assets/skills/external-services/references/obsidian.md +49 -0
  143. package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
  144. package/agent-assets/skills/gmail-lifestyle/SKILL.md +151 -0
  145. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
  146. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
  147. package/agent-assets/skills/mail/SKILL.delegated.claude.md +15 -6
  148. package/agent-assets/skills/mail/SKILL.delegated.codex.md +9 -5
  149. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +9 -5
  150. package/agent-assets/skills/mail/SKILL.md +9 -114
  151. package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
  152. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  153. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  154. package/agent-assets/skills/mail/references/api.md +110 -0
  155. package/agent-assets/skills/mail/references/examples.md +70 -0
  156. package/agent-assets/skills/mail/references/providers.md +8 -8
  157. package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
  158. package/agent-assets/skills/managed-tasks/references/errors.md +73 -0
  159. package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
  160. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
  161. package/agent-assets/skills/management-policy/SKILL.md +54 -125
  162. package/agent-assets/skills/management-policy/curation.json +1 -1
  163. package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
  164. package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +1 -1
  165. package/agent-assets/skills/notify/SKILL.md +10 -82
  166. package/agent-assets/skills/notify/references/priority.md +65 -0
  167. package/agent-assets/skills/notion/SKILL.delegated.claude.md +2 -2
  168. package/agent-assets/skills/notion/SKILL.delegated.codex.md +2 -2
  169. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +2 -2
  170. package/agent-assets/skills/notion/SKILL.md +6 -10
  171. package/agent-assets/skills/notion/SKILL.native.claude.md +11 -8
  172. package/agent-assets/skills/notion/SKILL.native.codex.md +10 -6
  173. package/agent-assets/skills/notion/SKILL.native.gemini.md +10 -6
  174. package/agent-assets/skills/observations/SKILL.md +25 -14
  175. package/agent-assets/skills/project-doc/SKILL.md +2 -6
  176. package/agent-assets/skills/project-doc/curation.json +3 -3
  177. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +7 -4
  178. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  179. package/agent-assets/skills/reading/SKILL.md +12 -2
  180. package/agent-assets/skills/reading/references/reading-taste.md +2 -2
  181. package/agent-assets/skills/roadmap/SKILL.md +43 -141
  182. package/agent-assets/skills/roadmap/curation.json +1 -1
  183. package/agent-assets/skills/roadmap/references/api.md +100 -0
  184. package/agent-assets/skills/roadmap/references/cross-check.md +80 -0
  185. package/agent-assets/skills/roadmap/references/migration.md +56 -0
  186. package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
  187. package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +1 -1
  188. package/agent-assets/skills/schedule/SKILL.md +76 -104
  189. package/agent-assets/skills/schedule/references/batch.md +93 -0
  190. package/agent-assets/skills/schedule/references/errors.md +217 -0
  191. package/agent-assets/skills/schedule/references/model-selection.md +96 -0
  192. package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
  193. package/agent-assets/skills/scheduled-managed-task/SKILL.md +59 -51
  194. package/agent-assets/skills/today/SKILL.md +32 -62
  195. package/agent-assets/skills/today/curation.json +3 -3
  196. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +114 -0
  197. package/agent-assets/skills/today/seeds/section-shape.seed.json +1 -1
  198. package/agent-assets/skills/user-interview/SKILL.md +23 -67
  199. package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
  200. package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
  201. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +9 -1
  202. package/agent-assets/skills/user-profile/SKILL.md +54 -74
  203. package/agent-assets/skills/user-profile/curation.json +2 -2
  204. package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
  205. package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +8 -8
  206. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +30 -2
  207. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
  208. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +4 -5
  209. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
  210. package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
  211. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
  212. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
  213. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
  214. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
  215. package/agent-assets/system-prompts/routine-fetch-window.md +78 -0
  216. package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
  217. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +20 -11
  218. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +18 -9
  219. package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
  220. package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
  221. package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
  222. package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
  223. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
  224. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +18 -9
  225. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +26 -15
  226. package/agent-assets/task-flows/browser_task.md +84 -0
  227. package/agent-assets/task-flows/github.assigned.md +1 -1
  228. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  229. package/agent-assets/task-flows/github.workflow_run.failed.md +2 -2
  230. package/agent-assets/task-flows/knowledge.import.md +15 -15
  231. package/agent-assets/task-flows/message.received.dm.md +20 -17
  232. package/agent-assets/task-flows/message.received.dm_first.md +11 -15
  233. package/agent-assets/task-flows/routine.custom.md +6 -4
  234. package/agent-assets/task-flows/routine.evening_review.md +46 -170
  235. package/agent-assets/task-flows/routine.fetch_window.md +19 -14
  236. package/agent-assets/task-flows/routine.hourly_check.md +27 -15
  237. package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
  238. package/agent-assets/task-flows/routine.monthly_review.md +67 -25
  239. package/agent-assets/task-flows/routine.morning_routine_journal.md +135 -0
  240. package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
  241. package/agent-assets/task-flows/routine.research_cluster_update.md +35 -0
  242. package/agent-assets/task-flows/routine.research_dispatch.md +38 -0
  243. package/agent-assets/task-flows/routine.research_offer_dm.md +125 -0
  244. package/agent-assets/task-flows/routine.research_wiki_summary.md +53 -0
  245. package/agent-assets/task-flows/routine.roadmap_refresh.md +68 -23
  246. package/agent-assets/task-flows/routine.today_refresh.md +4 -4
  247. package/agent-assets/task-flows/routine.user_profile_sweep.md +19 -20
  248. package/agent-assets/task-flows/routine.weekly_review.md +370 -86
  249. package/agent-assets/task-flows/schedule.approaching.md +0 -1
  250. package/agent-assets/task-flows/scheduled.dm.md +13 -13
  251. package/agent-assets/task-flows/scheduled.task.md +9 -9
  252. package/agent-assets/task-flows/setup.initial.md +171 -251
  253. package/agent-assets/task-flows/setup.update.md +2 -2
  254. package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
  255. package/agent-assets/templates/README.md +27 -20
  256. package/agent-assets/templates/_index.md +42 -26
  257. package/agent-assets/templates/_manifest.json +34 -99
  258. package/agent-assets/templates/{user → identity}/_index.md +1 -1
  259. package/agent-assets/templates/identity/expertise.md +9 -0
  260. package/agent-assets/templates/identity/goals.md +9 -0
  261. package/agent-assets/templates/identity/people.md +13 -0
  262. package/agent-assets/templates/identity/personal.md +9 -0
  263. package/agent-assets/templates/{user → identity}/profile.md +2 -2
  264. package/agent-assets/templates/identity/work.md +9 -0
  265. package/agent-assets/templates/{dossiers → knowledge/dossiers}/_index.md +2 -2
  266. package/agent-assets/templates/{projects → plans/projects}/_active.base +1 -1
  267. package/agent-assets/templates/policies/_index.md +21 -0
  268. package/agent-assets/templates/{rules → policies}/journal-export.md +1 -1
  269. package/agent-assets/templates/policies/journal-format.md +168 -0
  270. package/agent-assets/templates/{rules/policies → policies/management-captures}/_index.md +2 -2
  271. package/agent-assets/templates/{rules → policies}/management.md +3 -3
  272. package/agent-assets/templates/{rules → policies}/mcp.md +1 -1
  273. package/agent-assets/templates/{rules → policies}/redaction.md +1 -1
  274. package/agent-assets/templates/{routines → policies/routines}/_index.md +1 -1
  275. package/agent-assets/templates/{routines → policies/routines}/evening.md +2 -2
  276. package/agent-assets/templates/{routines → policies/routines}/hourly.md +1 -1
  277. package/agent-assets/templates/{routines → policies/routines}/monthly.md +2 -2
  278. package/bin/aitne.mjs +21 -5
  279. package/package.json +5 -4
  280. package/scripts/commands/doctor.mjs +63 -5
  281. package/scripts/commands/run-now.mjs +187 -0
  282. package/scripts/commands/verify.mjs +264 -0
  283. package/scripts/lib/ports.d.mts +27 -0
  284. package/scripts/lib/ports.mjs +36 -0
  285. package/scripts/lib/read-api-token.mjs +176 -0
  286. package/scripts/start.mjs +2 -1
  287. package/agent-assets/docs/features/lifestyle/travel-time.md +0 -52
  288. package/agent-assets/docs/features/routines/monthly-review.md +0 -65
  289. package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
  290. package/agent-assets/skills/management-task-register/SKILL.md +0 -330
  291. package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
  292. package/agent-assets/skills/receipts/SKILL.md +0 -134
  293. package/agent-assets/skills/travel/SKILL.md +0 -132
  294. package/agent-assets/skills/travel-time/SKILL.md +0 -158
  295. package/agent-assets/task-flows/routine.morning_routine.md +0 -322
  296. package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
  297. package/agent-assets/templates/context-index.md +0 -42
  298. package/agent-assets/templates/rules/_index.md +0 -19
  299. package/agent-assets/templates/rules/journal-format.md +0 -61
  300. package/agent-assets/templates/user/expertise.md +0 -7
  301. package/agent-assets/templates/user/goals.md +0 -7
  302. package/agent-assets/templates/user/people.md +0 -7
  303. package/agent-assets/templates/user/personal.md +0 -7
  304. package/agent-assets/templates/user/work.md +0 -7
  305. /package/agent-assets/templates/{agent/journal.md → journal/agent.md} +0 -0
  306. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/evening.md +0 -0
  307. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/hourly.md +0 -0
  308. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/monthly.md +0 -0
  309. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/morning.md +0 -0
  310. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/roadmap.md +0 -0
  311. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/weekly.md +0 -0
  312. /package/agent-assets/templates/{projects → plans/projects}/_index.md +0 -0
  313. /package/agent-assets/templates/{roadmap.md → plans/roadmap.md} +0 -0
  314. /package/agent-assets/templates/{routines → policies/routines}/morning.md +0 -0
  315. /package/agent-assets/templates/{routines → policies/routines}/weekly.md +0 -0
  316. /package/agent-assets/templates/{agent → state}/profile-questions.md +0 -0
  317. /package/agent-assets/templates/{today.md → state/today.md} +0 -0
@@ -0,0 +1,255 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/wiki/dashboard
4
+ title: Wiki Dashboard Surfaces
5
+ id: wiki-dashboard
6
+ aliases:
7
+ - wiki dashboard
8
+ - wiki ui
9
+ - wiki page
10
+ - wiki timeline page
11
+ - wiki settings page
12
+ - /wiki
13
+ - /wiki/timeline
14
+ - /settings/wiki
15
+ category: features
16
+ summary: |
17
+ Reference for the three dashboard surfaces the wiki feature renders:
18
+ `/wiki` (workspace summary + index + recent activity), `/wiki/timeline`
19
+ (full chronological log + latest health report), and `/settings/wiki`
20
+ (configuration). Explains what each card shows, where the data comes
21
+ from on disk, and what to do when a card is empty.
22
+ section: wiki
23
+ tags:
24
+ - wiki
25
+ - dashboard
26
+ - reference
27
+ - core
28
+ status: stable
29
+ ask_examples:
30
+ - What does the /wiki page show?
31
+ - Where do I find the wiki health report?
32
+ - Why is the Recent activity card empty?
33
+ - How do I see every !ingest run for a workspace?
34
+ - Where is the wiki configuration page?
35
+ - What is _index.md and where does the wiki page render it?
36
+ - How is /wiki different from /wiki/timeline?
37
+ - What does the Enable Wiki button do?
38
+ locale: en-US
39
+ created: 2026-05-21
40
+ updated: 2026-05-28
41
+ keywords:
42
+ - /wiki
43
+ - /wiki/timeline
44
+ - /settings/wiki
45
+ - wiki dashboard
46
+ - workspace summary card
47
+ - _index.md
48
+ - log.md
49
+ - health report
50
+ - 90_meta/health
51
+ - recent activity
52
+ - timeline filter
53
+ - Enable Wiki CTA
54
+ - vault path picker
55
+ related:
56
+ - features/wiki/overview
57
+ - features/wiki/commands
58
+ - features/wiki/workspaces
59
+ - features/wiki/cost-and-approval
60
+ - guides/build-your-wiki
61
+ - guides/maintain-wiki-health
62
+ - guides/use-an-existing-obsidian-vault
63
+ ui_anchors:
64
+ - /wiki
65
+ - /wiki/timeline
66
+ - /settings/wiki
67
+ api_endpoints:
68
+ - /api/wiki/workspaces
69
+ - /api/wiki/:workspace/index
70
+ - /api/wiki/:workspace/files/log.md
71
+ - /api/wiki/:workspace/health
72
+ - /api/wiki/:workspace/estimate
73
+ - /api/wiki/:workspace/compile/preview
74
+ process_keys:
75
+ - wiki.ask
76
+ - wiki.compile
77
+ - wiki.ingest_url
78
+ - wiki.lint
79
+ - wiki.trace
80
+ - wiki.connect
81
+ ---
82
+
83
+ # Wiki Dashboard Surfaces
84
+
85
+ The wiki has three distinct pages in the dashboard. The split mirrors
86
+ Aitne's broader IA: content browsing lives under **My Life**,
87
+ configuration lives under **Setup → Settings**. The pages share a
88
+ single read path through the daemon's `/api/wiki/*` routes — every
89
+ request carries an `x-process-key: wiki.ask` header so the safety
90
+ layer can attribute reads correctly.
91
+
92
+ ## `/wiki` — workspace home
93
+
94
+ The page you open most often. Three cards stacked top-down:
95
+
96
+ ### 1. Workspace summary
97
+
98
+ A single card with the workspace name, root path, kind badge
99
+ (`Internal` / `External`), language badge, and a stats table:
100
+
101
+ | Stat | Source |
102
+ |---|---|
103
+ | Raw notes | Count of files under `10_raw/` |
104
+ | Wiki pages | Count of files under `20_wiki/` |
105
+ | Outputs | Count of files under `30_outputs/` |
106
+ | Last ingest | `wiki_workspaces.last_ingest_at` |
107
+ | Last compile | `wiki_workspaces.last_compile_at` |
108
+
109
+ Two action buttons at the bottom of the card: **Timeline & health**
110
+ (jumps to `/wiki/timeline`) and **Configuration** (jumps to
111
+ `/settings/wiki`).
112
+
113
+ ### 2. Index
114
+
115
+ Renders the latest `20_wiki/_index.md`, the LLM-maintained catalogue
116
+ of wiki pages. The agent rewrites this file at the end of every
117
+ `!compile` run.
118
+
119
+ States:
120
+ - **Empty** — no `_index.md` yet; the CTA tells you to run `!compile`
121
+ from a DM.
122
+ - **Loaded** — the file is rendered verbatim as a monospaced code
123
+ block (the index uses wikilink syntax, so rendering as markdown
124
+ would lose information).
125
+
126
+ ### 3. Recent activity
127
+
128
+ The last 8 entries from `log.md`, the wiki's append-only operational
129
+ log. Each entry shows the wiki process key (`wiki.ingest_url`,
130
+ `wiki.compile`, `wiki.ask`, `wiki.lint`, `wiki.trace`, `wiki.connect`),
131
+ the operation (`write`, `delete`, …), the affected path, and the
132
+ timestamp. A **View full timeline** button at the top of the card
133
+ opens `/wiki/timeline`.
134
+
135
+ A freshly-enabled wiki has no `log.md` yet — the route returns 404
136
+ and the card shows the "No activity yet" hint instead of a scary
137
+ error toast.
138
+
139
+ ### Disabled state
140
+
141
+ When no `active=1` workspace exists in `wiki_workspaces`, the page
142
+ shows an **Enable Wiki** CTA that jumps to `/settings/wiki`. The
143
+ sidebar entry is always visible (gated only on the workspace
144
+ catalogue being reachable), so this disabled state is reachable via
145
+ the sidebar, a deep link, or browser history.
146
+
147
+ ## `/wiki/timeline` — full chronological history + health
148
+
149
+ Two surfaces stacked on one page:
150
+
151
+ ### 1. Latest health report
152
+
153
+ Renders the newest `90_meta/health/<YYYY-MM-DD>.md` produced by
154
+ `!lint`. The card shows:
155
+
156
+ - A purple date badge and the source file path.
157
+ - A `## Summary` block (bulleted list).
158
+ - An `## Action items` list (the punch-list of orphan notes, broken
159
+ wikilinks, schema drift, taxonomy candidates, and stale-note
160
+ warnings).
161
+ - A collapsible **View full report** button that reveals the raw
162
+ Markdown body of the report.
163
+
164
+ Empty state: "No health reports yet — send `!lint` from a DM to
165
+ generate the first one."
166
+
167
+ ### 2. Activity timeline
168
+
169
+ A reverse-chronological view of `log.md` with a process-key filter.
170
+ The filter dropdown lists every distinct `wiki.*` key found in the
171
+ log plus an **All commands** default. Entries render the same way
172
+ they do in the `/wiki` recent-activity card — process-key badge,
173
+ operation, path, timestamp.
174
+
175
+ Both surfaces read live from the wiki API; the timeline page is a
176
+ pure rendering pass over files the wiki skills already produce — no
177
+ extra daemon-side schema backs them.
178
+
179
+ ## `/settings/wiki` — configuration
180
+
181
+ The configuration surface. Two-state:
182
+
183
+ ### Disabled (no active workspace)
184
+
185
+ A two-card chooser:
186
+
187
+ - **Internal** (recommended) — managed by Aitne in its data directory
188
+ (default `~/.personal-agent/wiki`), schema seeded automatically.
189
+ The **Enable internal wiki** button turns it on with nothing else
190
+ to configure.
191
+ - **Existing Obsidian vault** (external) — point Aitne at a folder you
192
+ already own via the path picker, then confirm with **Use this
193
+ folder**.
194
+
195
+ The path picker opens your OS-native folder dialog (Finder on macOS,
196
+ File Explorer on Windows, the system folder dialog on Linux) and shows
197
+ an inline validation banner once you pick a path:
198
+
199
+ - Path-collision rules — the external root must not overlap
200
+ `dataDir`, your primary Obsidian vault, or another wiki workspace.
201
+ - Existing-Obsidian-vault detection — when the picker finds an
202
+ Obsidian vault at the target, the wiki layout is detected and
203
+ migrated on demand so you can import the vault's content (see
204
+ [guides/use-an-existing-obsidian-vault](../../guides/use-an-existing-obsidian-vault.md)
205
+ and [features/wiki/workspaces](workspaces.md)).
206
+
207
+ ### Enabled
208
+
209
+ The full configuration:
210
+
211
+ - **Workspace** — name, kind (internal / external), root path, language.
212
+ - **Dispatch mode** for `!ingest` (Parallel / Serial) and the
213
+ concurrency cap.
214
+ - **Write strategy** (`fs` / `cli` / `auto`) — internal workspaces
215
+ always use `fs`; external workspaces start in `auto` and probe on
216
+ first write (see [features/wiki/workspaces](workspaces.md)).
217
+ - **Git auto-commit before `!compile full`** toggle (only meaningful
218
+ on a git-tracked external vault).
219
+ - **Approval threshold (USD)** for `!compile full`.
220
+ - **Commands & models** — per-command selectors for the backend,
221
+ model, turn limit, and per-run budget on each `wiki.*` process key
222
+ (`wiki.ingest_url`, `wiki.compile`, `wiki.ask`, `wiki.lint`,
223
+ `wiki.trace`, `wiki.connect`). All six default to the medium tier
224
+ (Claude Sonnet 4.6) with a sensible `maxTurns` / `maxBudgetUsd`; you
225
+ can override per key.
226
+ - **Archive / delete** — archive keeps the row but flips `active=0`;
227
+ delete drops the row (data on disk is untouched on external mode).
228
+
229
+ The top of the enabled page carries a **Browse wiki** link that jumps
230
+ back to `/wiki`.
231
+
232
+ ## Where each surface reads from
233
+
234
+ | Surface | API route | On-disk source |
235
+ |---|---|---|
236
+ | Workspace summary | `GET /api/wiki/workspaces` | `wiki_workspaces` table |
237
+ | Index card | `GET /api/wiki/:ws/index` | `20_wiki/_index.md` |
238
+ | Recent activity | `GET /api/wiki/:ws/files/log.md` | `log.md` |
239
+ | Health report | `GET /api/wiki/:ws/index` + `/files/...` | `90_meta/health/<date>.md` |
240
+ | Activity timeline | `GET /api/wiki/:ws/files/log.md` | `log.md` |
241
+ | Settings | `GET /api/wiki/workspaces`, `PATCH /api/wiki/workspaces/:ws` | `wiki_workspaces` table |
242
+
243
+ Every wiki API request is gated by the `x-process-key` header. The
244
+ dashboard uses `wiki.ask` as the closest read-only intent; the
245
+ auth layer accepts any `wiki.*` key for GETs (see
246
+ `authorizeWikiRequest` in `packages/daemon/src/api/routes/wiki.ts`).
247
+
248
+ ## Contextual help
249
+
250
+ Every wiki page in the dashboard exposes a `?` Help button in the
251
+ top-right action strip. Clicking it opens the relevant wiki doc in a
252
+ slide-over for in-context reading (mirrors the global help pattern
253
+ used everywhere else in the dashboard). `/wiki/timeline` opens this
254
+ doc; `/wiki` opens [features/wiki/overview](overview.md) and
255
+ `/settings/wiki` opens [features/wiki/workspaces](workspaces.md).
@@ -17,6 +17,7 @@ section: wiki
17
17
  tags:
18
18
  - wiki
19
19
  - knowledge
20
+ - core
20
21
  status: stable
21
22
  ask_examples:
22
23
  - What is the wiki?
@@ -25,19 +26,53 @@ ask_examples:
25
26
  - Can I point the wiki at my Obsidian vault?
26
27
  locale: en-US
27
28
  created: 2026-05-12
28
- updated: 2026-05-12
29
+ updated: 2026-05-28
30
+ keywords:
31
+ - wiki
32
+ - wiki workspace
33
+ - 00_inbox
34
+ - 10_raw
35
+ - 20_wiki
36
+ - 30_outputs
37
+ - 90_meta
38
+ - wiki layers
39
+ - external vault
40
+ - internal vault
41
+ - opt-in
42
+ - wiki process keys
43
+ - wiki dispatcher
44
+ - dashboard wiki page
29
45
  related:
30
46
  - features/wiki/commands
31
- - features/memory-files
47
+ - features/wiki/dashboard
48
+ - features/wiki/workspaces
49
+ - features/wiki/search
50
+ - features/wiki/cost-and-approval
51
+ - concepts/memory-model
32
52
  - guides/build-your-wiki
33
53
  - guides/use-an-existing-obsidian-vault
34
54
  - guides/budget-and-cost-for-wiki
55
+ - guides/multiple-wikis-for-multiple-domains
56
+ - guides/maintain-wiki-health
57
+ - guides/explore-with-trace-and-connect
35
58
  - troubleshooting/wiki-write-failed
36
59
  - troubleshooting/wiki-ingest-full-blocked
37
60
  ui_anchors:
38
61
  - /wiki
39
62
  - /wiki/timeline
40
63
  - /settings/wiki
64
+ api_endpoints:
65
+ - /api/wiki/workspaces
66
+ - /api/wiki/:workspace/index
67
+ - /api/wiki/:workspace/search
68
+ - /api/wiki/:workspace/estimate
69
+ process_keys:
70
+ - wiki.ingest_url
71
+ - wiki.compile
72
+ - wiki.ask
73
+ - wiki.lint
74
+ - wiki.trace
75
+ - wiki.connect
41
76
  ---
42
77
 
43
78
  # Wiki Overview
@@ -50,6 +85,8 @@ and questions you ask it.
50
85
 
51
86
  ## What It Does
52
87
 
88
+ The three commands you reach for daily:
89
+
53
90
  - **URL ingest**: send `!ingest <url>` from a paired DM channel; the wiki
54
91
  agent fetches the source, summarises it, and stores a raw note.
55
92
  - **Compile**: `!compile` (incremental) and `!compile full` (full
@@ -58,9 +95,15 @@ and questions you ask it.
58
95
  - **Ask**: `!ask <question>` searches the wiki and writes a cited
59
96
  answer under `30_outputs/`.
60
97
 
61
- The wiki uses its own process keys (`wiki.ingest_url`, `wiki.compile`,
62
- `wiki.ask`) with independent backend / model / budget settings, so it
63
- never competes for budget with daily reactive memory.
98
+ Three more for upkeep and exploration: `!lint` (health report),
99
+ `!trace` (reconstruct an idea's evolution), and `!connect` (bridge two
100
+ domains). `!wiki` prints workspace status. See the
101
+ [commands reference](commands.md) for all of them.
102
+
103
+ The wiki uses its own process keys — `wiki.ingest_url`, `wiki.compile`,
104
+ `wiki.ask`, `wiki.lint`, `wiki.trace`, `wiki.connect` — each with
105
+ independent backend / model / budget settings, so the wiki never
106
+ competes for budget with daily reactive memory.
64
107
 
65
108
  ## Internal vs External
66
109
 
@@ -95,12 +138,14 @@ process keys can write wiki layers.
95
138
  ## Cost Safety
96
139
 
97
140
  `!compile full` rebuilds the entire wiki from raw notes and is the
98
- most expensive command. The dashboard banner shows the bracketed
99
- estimate ($0.5×–$2× the assumed input-token spend) before you run
100
- it. If the pessimistic estimate exceeds the per-workspace threshold
101
- (default $2.00), the command escalates to the dashboard `/approvals`
102
- queue and requires your explicit confirmation before the compile
103
- starts.
141
+ most expensive command. Before you run it, the dashboard shows a
142
+ bracketed estimate — the optimistic (0.5×) and pessimistic (2×)
143
+ multiples of the assumed input-token spend. If the pessimistic
144
+ estimate exceeds the per-workspace threshold (default $2.00), the
145
+ command escalates to the approval queue and requires your explicit
146
+ confirmation before the compile starts. The pending-approval card
147
+ surfaces on the dashboard home page (`/`), where you Approve or Deny
148
+ it.
104
149
 
105
150
  On a git-tracked external vault, Aitne also runs
106
151
  `git add -A && git commit -m "aitne wiki: pre-compile snapshot <ts>"`
@@ -113,7 +158,7 @@ commit or stash first.
113
158
  The wiki has two distinct surfaces in the dashboard. The split mirrors
114
159
  how Aitne organises the rest of the app — configuration lives under
115
160
  **Setup → Settings**, day-to-day content browsing lives under **My
116
- Life** next to Knowledge / Reading / Git / Trip / Finance / Health.
161
+ Life** next to Knowledge / Reading / Git.
117
162
 
118
163
  | Page | Section | Use it for |
119
164
  |---|---|---|
@@ -143,3 +188,26 @@ disk until you opt in.
143
188
  strategy, git auto-commit toggle, approval threshold, per-command
144
189
  model selectors, plus archive / delete. A "Browse wiki" link at the
145
190
  top jumps you back to `/wiki`.
191
+
192
+ ## Where to go next
193
+
194
+ This page is a high-level tour. For depth on a specific surface:
195
+
196
+ - **[Commands reference](commands.md)** — every wiki bang command
197
+ (`!ingest`, `!compile`, `!ask`, `!lint`, `!trace`, `!connect`,
198
+ `!wiki`), the `@<workspace>` addressing token, dispatch modes, and
199
+ the disabled-state behaviour.
200
+ - **[Dashboard surfaces](dashboard.md)** — what `/wiki`,
201
+ `/wiki/timeline`, and `/settings/wiki` actually render, where each
202
+ card reads from on disk, and how the contextual help button maps
203
+ to this doc set.
204
+ - **[Workspaces, vaults, write strategy](workspaces.md)** — internal
205
+ vs external, multi-workspace `@<name>` addressing, fs/cli/auto
206
+ write strategy, dispatch modes, language, and archive vs delete.
207
+ - **[Search and index](search.md)** — how `!ask` / `!trace` /
208
+ `!connect` find content via `_index.md` and the FTS5 `fts_wiki`
209
+ virtual table, plus the rebuild path.
210
+ - **[Cost estimation and approval](cost-and-approval.md)** — the
211
+ bracketed 0.5×/2× cost estimator, the `!compile full` approval
212
+ threshold, the pre-compile git snapshot, and the `--preview`
213
+ dry-run.
@@ -0,0 +1,248 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/wiki/search
4
+ title: Wiki Search and Index
5
+ id: wiki-search
6
+ aliases:
7
+ - wiki search
8
+ - wiki fts
9
+ - wiki full text search
10
+ - _index.md
11
+ - wiki index
12
+ - how ask searches
13
+ - how trace finds sources
14
+ category: features
15
+ summary: |
16
+ How `!ask`, `!trace`, and `!connect` find content inside a wiki. The
17
+ workspace exposes two search surfaces — the LLM-maintained
18
+ `20_wiki/_index.md` catalogue and a content-less FTS5 virtual table
19
+ (`fts_wiki`) the daemon syncs on every write. Both are read-only
20
+ consumers; only `!compile` writes the catalogue.
21
+ section: wiki
22
+ tags:
23
+ - wiki
24
+ - search
25
+ - fts
26
+ - reference
27
+ status: stable
28
+ ask_examples:
29
+ - How does !ask find the right wiki pages?
30
+ - What is _index.md and who writes it?
31
+ - How does the wiki search work internally?
32
+ - Can I search the wiki from the dashboard?
33
+ - Why didn't !ask find my recent ingest?
34
+ - Does the wiki search Japanese / CJK content?
35
+ - How do I rebuild the wiki search index?
36
+ - What is fts_wiki?
37
+ locale: en-US
38
+ created: 2026-05-21
39
+ updated: 2026-05-28
40
+ keywords:
41
+ - wiki search
42
+ - fts_wiki
43
+ - FTS5
44
+ - content-less FTS
45
+ - unicode61
46
+ - tokenizer
47
+ - _index.md
48
+ - index catalogue
49
+ - wiki layer
50
+ - layer classifier
51
+ - reindex
52
+ - backfillWikiFulltext
53
+ - workspace_id
54
+ - layer prefix
55
+ - !ask retrieval
56
+ related:
57
+ - features/wiki/overview
58
+ - features/wiki/commands
59
+ - features/wiki/workspaces
60
+ - features/wiki/dashboard
61
+ ui_anchors:
62
+ - /wiki
63
+ - /wiki/timeline
64
+ api_endpoints:
65
+ - /api/wiki/:workspace/search
66
+ - /api/wiki/:workspace/index
67
+ - /api/wiki/:workspace/reindex
68
+ process_keys:
69
+ - wiki.ask
70
+ - wiki.trace
71
+ - wiki.connect
72
+ - wiki.compile
73
+ - wiki.lint
74
+ context_files:
75
+ - knowledge/wiki
76
+ ---
77
+
78
+ # Wiki Search and Index
79
+
80
+ The wiki exposes two read paths the skills use to find content:
81
+
82
+ 1. **`20_wiki/_index.md`** — the LLM-maintained catalogue of pages.
83
+ A short, human-readable list with one bullet per wiki page, kept
84
+ current by every `!compile` run. Good for "give me the lay of the
85
+ land" queries.
86
+ 2. **`fts_wiki`** — a content-less SQLite FTS5 virtual table the
87
+ daemon syncs on every successful disk write. Good for "find any
88
+ page that mentions X" queries.
89
+
90
+ Both surfaces are read-only consumers; only `!compile` writes the
91
+ catalogue, and only the wiki API write endpoints update `fts_wiki`.
92
+
93
+ ## `_index.md` — the LLM-maintained catalogue
94
+
95
+ Lives at `20_wiki/_index.md`. The compile skill rewrites it at the
96
+ end of every `!compile` run with one bullet per wiki article, each
97
+ with a short summary, the source slugs that fed it, and a
98
+ `Last touched: <date>`. The dashboard `/wiki` page renders this file
99
+ verbatim as the **Index** card.
100
+
101
+ The catalogue is **not** authoritative — the source of truth is the
102
+ on-disk files. If `_index.md` drifts (e.g. references a page that
103
+ was renamed), `!lint` flags it under the **drift between
104
+ `20_wiki/_index.md` and the files on disk** check and `!compile`
105
+ rewrites it on the next pass.
106
+
107
+ `GET /api/wiki/:workspace/index` returns both the parsed catalogue
108
+ and a directory listing the dashboard uses to find the latest
109
+ `90_meta/health/<date>.md` for the timeline page.
110
+
111
+ ## `fts_wiki` — content-less FTS5 search
112
+
113
+ Aitne mirrors every wiki file into a SQLite FTS5 virtual table
114
+ named `fts_wiki`. The table is **content-less** — the indexed text
115
+ is the file on disk, not a row in another SQL table. This matters:
116
+
117
+ - The mail FTS pattern (`fts_mail_messages`) uses
118
+ `AFTER INSERT/UPDATE/DELETE` triggers on `mail_messages_index`
119
+ because the source rows live in SQLite.
120
+ - Wiki content lives on the filesystem. There's no source table to
121
+ trigger off, so the wiki API write endpoints
122
+ (`POST /api/wiki/:ws/files/:path`, `PATCH /api/wiki/:ws/files/:path`,
123
+ `DELETE /api/wiki/:ws/files/:path`) call
124
+ `upsertWikiFulltextRow` / `deleteWikiFulltextRow` directly after a
125
+ successful disk write.
126
+
127
+ The schema (`packages/daemon/src/db/schema.ts`):
128
+
129
+ ```sql
130
+ CREATE VIRTUAL TABLE IF NOT EXISTS fts_wiki USING fts5(
131
+ workspace_id UNINDEXED,
132
+ path UNINDEXED,
133
+ layer UNINDEXED,
134
+ title,
135
+ body,
136
+ mtime UNINDEXED,
137
+ tokenize = 'unicode61 remove_diacritics 2'
138
+ );
139
+ ```
140
+
141
+ The `unicode61` tokenizer with `remove_diacritics 2` matches the
142
+ mail FTS table for consistency. CJK content is handled by code-point
143
+ breaking — searches work for Japanese, Chinese, Korean, and
144
+ mixed-script wikis.
145
+
146
+ ### Layer prefixes
147
+
148
+ The path classifier maps each on-disk file to one of six layers:
149
+
150
+ - `10_raw/...` → `raw`
151
+ - `20_wiki/...` → `wiki`
152
+ - `30_outputs/...` → `output`
153
+ - `90_meta/...` → `meta`
154
+ - `log.md` (workspace root) → `log`
155
+ - `00_inbox/...` → `inbox`
156
+
157
+ Only four of these are actually indexed. `upsertWikiFulltextRow`
158
+ **drops `log` and `inbox` rows** before insert: `log.md` is an
159
+ append-only audit trail and `00_inbox/` is human-only, so indexing
160
+ them would bury wiki and raw matches under log noise. So the values
161
+ you ever see in `fts_wiki.layer` are `raw`, `wiki`, `output`, and
162
+ `meta`.
163
+
164
+ Searches can filter by layer to restrict the result set — e.g.
165
+ `layer=wiki` for only canonical pages, not raw notes.
166
+
167
+ ### Querying the index
168
+
169
+ `GET /api/wiki/:workspace/search` is the daemon-internal search
170
+ endpoint. The `!ask`, `!trace`, and `!connect` skills call it (via
171
+ `curl`) to pull a candidate set of pages before the LLM picks
172
+ evidence. The query supports:
173
+
174
+ - `q` — the search query. Each whitespace-separated token is quoted
175
+ and joined by implicit AND, so a multi-word query narrows the
176
+ result set. (Tokens are quoted to neutralise FTS5's `AND`/`OR`/
177
+ `NOT`/`NEAR` operator vocabulary — typing literally `rust AND go`
178
+ matches those words, it does not parse as a boolean.)
179
+ - `layer` — restrict to a single indexed layer (`raw` / `wiki` /
180
+ `output` / `meta`). Unknown values are ignored.
181
+ - `limit` — default 20, clamped to the range 1–50.
182
+ - `kind` — `fts` (default) queries `fts_wiki`; `grep` is a literal
183
+ case-insensitive substring fallback over the files on disk. When
184
+ an FTS query returns zero hits for a non-empty `q`, the caller gets
185
+ empty FTS results; an **empty** `q` automatically falls back to
186
+ grep so `/search?q=` enumerates the workspace.
187
+
188
+ Each result row carries `path`, `layer`, `title`, a body `snippet`
189
+ (FTS5 `snippet()` output, `<mark>`-wrapped), `mtime` so the caller
190
+ can rank by recency, and a BM25 `rank` (lower is better, `title`
191
+ weighted above `body`).
192
+
193
+ There is no dashboard content-search bar today — the FTS surface is
194
+ used by the agent, not the user UI. The dashboard timeline
195
+ (`/wiki/timeline`) does carry a process-key filter, but that filters
196
+ over `log.md` rather than searching content.
197
+
198
+ ## Rebuilding the index
199
+
200
+ The FTS index can fall out of sync if you edit files in the wiki
201
+ root with another tool (e.g. directly editing an external Obsidian
202
+ vault). Two recovery paths:
203
+
204
+ - **Per-workspace reindex** — `POST /api/wiki/:workspace/reindex`
205
+ scans the workspace tree and rebuilds every `fts_wiki` row for
206
+ that workspace. Cheap; runs synchronously.
207
+ - **Boot-time backfill** — `backfillWikiFulltext` runs once on
208
+ daemon start when `fts_wiki` is detected as empty for any active
209
+ workspace. This is the recovery path after a clean reinstall or a
210
+ fresh DB.
211
+
212
+ The reindex never deletes files on disk; it's a pure read-then-write
213
+ into the SQL index.
214
+
215
+ ## How `!ask` uses both surfaces
216
+
217
+ A simplified flow for `!ask <question>`:
218
+
219
+ 1. The skill orients on `_index.md` for the lay of the land, then
220
+ searches and reads relevant `20_wiki/` pages first — running FTS
221
+ queries against `fts_wiki` to find pages that mention the
222
+ question's key terms.
223
+ 2. It reads `10_raw/` notes only when the wiki pages need source
224
+ verification.
225
+ 3. The LLM synthesises an answer from the pages it pulled.
226
+ 4. The answer is written to
227
+ `30_outputs/<YYYY-MM-DD>-<slug>.md` (the date-prefixed output
228
+ shape the `OUTPUT_RE` path check enforces). The file records the
229
+ question, a short answer, the evidence, source links, and any
230
+ follow-up gaps; if the wiki lacks enough evidence the skill says
231
+ so and lists what is missing.
232
+ 5. The skill ends the turn with a short plain-prose reply forwarded
233
+ to the channel the command came from, citing pages inline as
234
+ `see [[<slug>]]` and pointing at the full answer file.
235
+
236
+ `!trace` and `!connect` follow a similar pattern but with
237
+ trace-specific (chronological) or connect-specific (cross-domain)
238
+ search queries.
239
+
240
+ ## Why no embedding-based search
241
+
242
+ Aitne's wiki is local-first and keychain-isolated; running embedding
243
+ inference adds either a remote API dependency or a heavy local model
244
+ — neither of which fits the "your laptop, your data" promise. FTS5
245
+ unicode61 covers the common case (find pages by keyword) without a
246
+ network round-trip and without a model file. The compile step's
247
+ wikilinks + the LLM-maintained `_index.md` carry the semantic
248
+ "connect related pages" load.