@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
package/README.md CHANGED
@@ -2,198 +2,66 @@
2
2
 
3
3
  # Aitne
4
4
 
5
- ### Always on. Always yours.
6
-
7
- **A local-first, proactive personal AI agent that runs continuously on your own machine — and learns *you* every day.**
5
+ **A local-first, proactive personal AI agent.**
6
+ A long-running TypeScript daemon watches your calendar, mail, repos, and notes — and acts on its own. Your AI of choice (Claude / Codex / Gemini; OpenCode coming soon) is the brain; Aitne is the nervous system.
8
7
 
9
8
  [![npm version](https://img.shields.io/npm/v/@aitne-sh/aitne.svg)](https://www.npmjs.com/package/@aitne-sh/aitne)
10
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
11
10
  [![Node](https://img.shields.io/badge/node-%E2%89%A522-brightgreen)](https://nodejs.org)
11
+ [![Status](https://img.shields.io/badge/status-pre--1.0-orange)](#status)
12
12
  [![Platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue)](#platform-support)
13
- [![Backends](https://img.shields.io/badge/backends-Claude%20%7C%20Codex%20%7C%20Gemini-purple)](#multi-backend)
14
13
 
15
14
  ```bash
16
15
  npm install -g @aitne-sh/aitne@latest
17
16
  aitne start
18
17
  ```
19
18
 
20
- </div>
21
-
22
- ---
23
-
24
- ## Overview
19
+ ![Aitne setup and dashboard walkthrough](./docs/assets/aitne-demo.gif)
25
20
 
26
- ChatGPT and Claude wait for you to type. **Aitne does not.** It's a tiny TypeScript daemon that lives on your laptop, watches your calendar, mail, repositories, and notes, and acts on its own — drafting your morning plan at 04:00, surfacing the email you forgot, nudging you about the PR your teammate is waiting on, and weaving everything into Markdown files *you* own.
27
-
28
- You bring the brain — Claude Code, OpenAI Codex CLI, or Google Gemini CLI. Aitne is the nervous system that schedules, routes, observes, and remembers.
21
+ </div>
29
22
 
30
23
  ---
31
24
 
32
- ## What makes Aitne different
33
-
34
- **It compounds.** Every DM, every reaction, every implicit signal shapes how Aitne thinks about you. After a month it sounds like you. After a year it remembers what you forgot last quarter. The model never changes — *the context does*.
35
-
36
- **You manage it in plain language.** "Don't ping me before 9am." "Remember my partner's birthday." "Stop running hourly checks on weekends." A dedicated set of management skills (`management-task-register`, `management-policy`, `user-profile`, …) maps your words to settings, schedules, and profile updates. No 80-panel settings UI.
25
+ ## Why Aitne
37
26
 
38
- **It rides on what you already have.** Your `~/.claude/skills`, your `~/.codex/config.toml`, your `~/.gemini/` settings, your custom MCP servers Aitne reads them on session init and layers its persona on top. Your existing toolkit shows up in every Aitne-spawned session. No re-configuring. No vendor lock.
39
-
40
- **Your memory is plain Markdown.** Everything Aitne writes lands in `~/.personal-agent/context/*.md`. You can `cat`, `vim`, `obsidian`, or `cp` any of it. Uninstall and the memory is still yours. No proprietary format. No migration headache.
41
-
42
- **It runs entirely on your machine.** The daemon binds to `127.0.0.1` only. Secrets live in the OS keychain (macOS Keychain / libsecret / DPAPI). No telemetry. No cloud state. Verify with `lsof` and `nettop`.
27
+ - **Proactive, not reactive.** Drafts your morning plan at 04:00. Surfaces the email you forgot. Nudges you about the PR your teammate is waiting on. You don't have to open an app.
28
+ - **Local-first.** Daemon binds to `127.0.0.1` only. Secrets in the OS keychain. Memory in plain Markdown under `~/.personal-agent/`. No telemetry, no cloud state.
29
+ - **Multi-backend.** Bring Claude Code, Codex CLI, or Gemini CLI or all three. Per-task tier routing decides which one runs for each kind of work. (OpenCode is wired internally and ships as preview-only in this release.)
30
+ - **Compounds.** Every DM, every correction shapes how Aitne thinks about you. The model doesn't change — the context does.
43
31
 
44
32
  ---
45
33
 
46
- ## Installation
47
-
48
- ### From npm
49
-
50
- The recommended path. Installs the `aitne` CLI globally with the daemon, dashboard, and built-in agent assets.
51
-
52
- ```bash
53
- npm install -g @aitne-sh/aitne@latest
54
- aitne start
55
- ```
56
-
57
- Then bring **at least one** AI backend:
58
-
59
- ```bash
60
- # Claude Code — full feature support including server-side advisor
61
- npm install -g @anthropic-ai/claude-code
62
- claude auth login
63
-
64
- # OpenAI Codex CLI
65
- npm install -g @openai/codex
66
- codex login --device-auth
67
-
68
- # Google Gemini CLI
69
- npm install -g @google/gemini-cli
70
- # OAuth handled on first use
71
- ```
72
-
73
- Login once with each CLI you intend to use — Aitne auto-detects them on the next session.
74
-
75
- ### From source (git)
76
-
77
- For contributors, or if you want to hack on the daemon directly. Requires Node ≥ 22 and pnpm 10.x.
78
-
79
- ```bash
80
- git clone https://github.com/Aitne-sh/Aitne.git aitne
81
- cd aitne
82
- corepack enable
83
- pnpm install
84
- pnpm start # build (if stale) + launch daemon and dashboard in background
85
- # or
86
- pnpm dev # foreground with full stdio for debugging
87
- ```
88
-
89
- Common workflows:
90
-
91
- ```bash
92
- pnpm test # vitest unit tests across packages/*
93
- pnpm test:watch
94
- pnpm lint # turbo run lint
95
- pnpm clean # turbo clean + remove node_modules and .buildstamp
96
- ```
97
-
98
- ### Verifying the install
99
-
100
- ```bash
101
- aitne status # PIDs, uptime, connected platforms, backends, today's spend
102
- aitne doctor # 9-check install diagnostic
103
- aitne logs -f # tail the daemon log
104
- ```
105
-
106
- The daemon listens on `:8321`, the dashboard on `:3000`. Open `http://localhost:3000` and finish the 9-step setup wizard.
107
-
108
- ---
109
-
110
- ## How it works
111
-
112
- A long-running daemon receives signals from every channel you've connected, parks short-term state in SQLite, and spawns an AI session whenever it needs to think. The session reads your Markdown memory, calls a curated set of skills, and writes results back through the daemon API.
113
-
114
- ```mermaid
115
- flowchart LR
116
- subgraph WORLD["Your digital life"]
117
- direction TB
118
- W1["Messages"]
119
- W2["Calendar"]
120
- W3["Mail"]
121
- W4["Git / GitHub"]
122
- W5["Notes"]
123
- end
124
-
125
- subgraph LOCAL["Your laptop"]
126
- direction TB
127
- DAEMON["Aitne daemon<br/>(always on)"]
128
- BRAIN["AI session<br/>Claude / Codex / Gemini"]
129
- MEMORY["Markdown memory<br/>plain files you own"]
130
- DAEMON --- BRAIN
131
- BRAIN --- MEMORY
132
- DAEMON --- MEMORY
133
- end
134
-
135
- YOU["You<br/>Slack · Telegram · Discord<br/>WhatsApp · Web dashboard"]
136
-
137
- WORLD --- DAEMON
138
- DAEMON --- YOU
139
- ```
140
-
141
- The daemon runs two execution paths in parallel:
142
-
143
- - **Reactive path** — owner DMs, mentions, cron-driven routines (morning, evening, weekly, monthly), and calendar-approach events flow through the EventBus into the Dispatcher, which spawns a backend session sized for the work.
144
- - **Polling path** — observers for Git, GitHub, Obsidian, Notion, Calendar, and mail write to an `observations` table without spawning sessions. A cron-driven hourly check triages those observations through a lite-tier session, then escalates to a full Sonnet-class session only if something worth surfacing was found.
145
-
146
- A pre-pass `routine.fetch_window` session runs before each routine, fanning out per-account fetches (mail, calendar, Notion) into the `observations` table so the main session reads from a single source.
147
-
148
- ### What you can do with it
149
-
150
- A non-exhaustive catalogue — every entry below is backed by an implemented skill, route, or observer. Click to expand.
34
+ ## Highlights
151
35
 
152
36
  <details>
153
37
  <summary><b>Time, calendar, travel</b></summary>
154
38
 
155
39
  - Auto-generate `today.md` every morning with your real schedule
156
- - 15-min approach reminders for every calendar event, with travel time pre-computed via Google Maps
40
+ - 15-min approach reminders for every event, with travel time pre-computed via Google Maps
157
41
  - Find a 30-min slot across multiple calendars — Aitne checks freebusy and replies with options
158
- - Auto-extract flight, hotel, restaurant, train confirmations from email into a structured travel timeline
159
- - Surface tomorrow's itinerary in the morning briefing
160
- - "What time should I leave for my next meeting?" — answers with live traffic
42
+ - Auto-extract flight, hotel, train confirmations from email into a structured travel timeline
161
43
  </details>
162
44
 
163
45
  <details>
164
46
  <summary><b>Mail across every account</b></summary>
165
47
 
166
48
  - Unified inbox across Gmail, Outlook, Yahoo, and iCloud (OAuth or app-password / IMAP)
167
- - Local FTS5 full-text search across every account ("find emails about acme last quarter")
168
- - Auto-classify, label, and archive (Gmail) filter rules across all providers
169
- - Draft replies in your style ("draft a polite no to this conference invite")
170
- - Forwarded receipts extract to a structured `receipts` table with category, vendor, amount
171
- - Daily digest of unread mail in the morning briefing
172
- - IMAP IDLE for near-real-time delivery; PDF and image attachments are extracted and indexed
49
+ - Local FTS5 full-text search across every account
50
+ - Auto-classify, label, archive, and draft replies in your style
51
+ - Forwarded receipts auto-extract into a structured receipts table
52
+ - IMAP IDLE for near-real-time delivery; PDF/image attachments are extracted and indexed
173
53
  </details>
174
54
 
175
55
  <details>
176
- <summary><b>Knowledge: Obsidian, Notion, your own notes</b></summary>
56
+ <summary><b>Knowledge: Obsidian, Notion, your own wiki</b></summary>
177
57
 
178
58
  - Use your existing Obsidian vault as Aitne's primary memory store — wiki-links keep working
179
- - Append to your daily note via the official Obsidian CLI (`obsidian create` / `daily:append`)
180
- - Full Notion page and database CRUD — query, create, update, archive
181
- - "Summarize what I wrote about this project last month" across vault layers
182
- - Auto-link new notes to existing concepts
183
- </details>
184
-
185
- <details>
186
- <summary><b>Build a personal wiki from anything you DM</b></summary>
187
-
188
- - DM `!ingest <url>` — the agent fetches, summarises, and saves a raw note in `10_raw/`
189
- - Run `!compile` to synthesise raw notes into linked wiki articles in `20_wiki/` with an auto-maintained `_index.md`
190
- - `!compile --preview` shows added / modified / unchanged pages plus cost and ETA before you spend tokens
191
- - `!compile full` rebuilds everything — cost-gated, with a dashboard approval queue and an optional git pre-compile snapshot for external vaults
59
+ - Append to your daily note via the official Obsidian CLI
60
+ - Full Notion page and database CRUD
61
+ - DM `!ingest <url>` to capture a source, `!compile` to synthesize raw notes into linked wiki articles
192
62
  - `!ask <question>` answers from your own wiki and writes the cited reply to `30_outputs/`
193
- - `!lint` audits for orphans, broken links, schema drift, and taxonomy candidates → dated health report
194
- - `!trace <topic>` and `!connect A B` reconstruct how an idea evolved and find shared structure across domains
195
- - Multiple workspaces (`!ingest @research ...`, `!compile @ops full`) — default workspace falls through when `@` is omitted
196
- - Workspaces can be internal (`~/.personal-agent/wiki/`) or any number of external Obsidian vaults
63
+ - `!lint`, `!trace`, `!connect` for vault health, idea evolution, cross-domain bridges
64
+ - Multiple workspaces (`!ingest @research ...`) internal or any number of external Obsidian vaults
197
65
  </details>
198
66
 
199
67
  <details>
@@ -202,816 +70,314 @@ A non-exhaustive catalogue — every entry below is backed by an implemented ski
202
70
  - Local Git: `git log`, `git diff`, `git show` exposed via daemon proxy
203
71
  - GitHub: PR lists, comments, issues, webhook receivers (HMAC-SHA256 verified)
204
72
  - Per-repo cron triggers — "every Monday at 09:00, summarize merged PRs into `projects/<repo>.md`"
205
- - "Why did this build break?" — agent reads CI status, diff, and traces
206
73
  - Auto-detect when a coworker modified a file you're about to ship
207
74
  - Unified Repositories: one row pairs a local clone with a GitHub remote; the doctor flags drift
208
75
  </details>
209
76
 
210
77
  <details>
211
- <summary><b>Tasks, projects, life admin</b></summary>
212
-
213
- - Unified task view across GitHub Issues, mail-derived TODOs, and your own `today.md`
214
- - Per-project Markdown files with auto-maintained status, deadlines, and people
215
- - Long-term roadmap with quarterly milestones
216
- - "Carry this to tomorrow" — handoff between `today.md`, `daily/`, `weekly/`, `monthly/`
217
- - Auto-detect recurring chores and set up reminders
218
- </details>
219
-
220
- <details>
221
- <summary><b>Reading, lifestyle, voice</b></summary>
222
-
223
- - Import Kindle highlights, build a reading-taste profile
224
- - Friday book recommendation DM based on your taste
225
- - Receipts auto-organized by month into your vault
226
- - Travel itinerary roll-up surfaced before each trip
227
- - Voice attachments — send a voice memo, get a Whisper-transcribed message (opt-in, runs locally via `ffmpeg-static` + `@huggingface/transformers`)
228
- </details>
229
-
230
- <details>
231
- <summary><b>Self-management and automation</b></summary>
232
-
233
- - Tell it to remember things in plain language ("I'm allergic to nuts")
234
- - Tell it to forget things ("delete that note about my old job")
235
- - Tell it to change schedules ("don't run hourly checks on weekends")
236
- - Tell it to change tone ("be more concise, no preamble")
237
- - Custom routines on any cron schedule with free-form prompts
238
- - Self-scheduled wakeups — agent decides when to check on something
78
+ <summary><b>Self-management via natural language</b></summary>
79
+
80
+ - "Don't run hourly checks on weekends" patches the cron window
81
+ - "Remember my partner's birthday is March 14" appends to `user/profile.md`
82
+ - "I prefer concise replies — no preamble" — updates the agent's `character` field
83
+ - "Email me a summary every Friday at 5pm" — creates a recurring schedule
84
+ - "Switch to Codex for code reviews" — flips the per-process backend mapping
85
+ - Every change is journaled to `agent_actions` — audit anything via `aitne audit`
239
86
  </details>
240
87
 
241
88
  <details>
242
- <summary><b>Run your own tools</b></summary>
89
+ <summary><b>Bring your own toolkit</b></summary>
243
90
 
244
- - Bring your own MCP servers they materialize into every session workdir
245
- - Bring your own Claude Code skills they show up wherever the agent runs
246
- - Bring your own Codex / Gemini config Aitne reads it on session init
247
- - Custom skills via the `/api/skills` endpoint drop a `SKILL.md` and it's live
91
+ - Your `~/.claude/skills`, `~/.codex/config.toml`, and `~/.gemini/` settings are loaded on session init (`~/.opencode/` is recognised but its executor is coming soon)
92
+ - Custom MCP servers materialize into every per-session workdir
93
+ - Aitne layers its persona on top of your existing config nothing gets overwritten
94
+ - Voice attachments opt-in local Whisper transcription via `ffmpeg-static` + `@huggingface/transformers`
248
95
  </details>
249
96
 
250
97
  ---
251
98
 
252
- ## A day with Aitne
253
-
254
- A walkthrough of one user's Tuesday.
255
-
256
- **04:00 — While you sleep.** Aitne reads yesterday's handoff, your calendar for today, the last 24 hours of mail across your accounts, new commits in your repos, and the pending observations from Notion. It generates `today.md` and queues a Morning Briefing DM for after quiet hours end.
257
-
258
- **07:30 — Slack DM lands as you grab coffee:**
259
- > Good morning. 3 things to flag:
260
- > - **Sarah's PR (#487)** needs your review — she's been blocked since Friday
261
- > - **Sales call with Acme @ 14:00** — leaving home by 13:25 (12-min commute)
262
- > - **IRS reminder from Friday** — deadline is *tomorrow*
263
- >
264
- > Today: 2 meetings, 4 tasks. Light day. Reply `end` to close, or just talk to me.
265
-
266
- **09:15 — You DM Aitne:** *"Tell Sarah I'll review by 11. And book lunch with Mark on Thursday — somewhere near his office."*
267
-
268
- Aitne drafts the Slack reply to Sarah, finds 3 lunch slots Thursday, checks Mark's last 5 lunch venues from your `people.md`, suggests Tartine. You confirm.
269
-
270
- **11:30 — Hourly check fires.** A new commit in your repo modified the API contract you're about to ship. Aitne adds a note to `today.md` and DMs once: *"Heads up — `auth.ts:84` was just changed by @Yuki. Want me to summarize the diff?"*
99
+ ## Status
271
100
 
272
- **13:45 Calendar approach.** *"Sales call in 15 min. Acme is the warm lead from last Tuesday they mentioned wanting webhook integration. Brief is in `projects/acme.md`."*
273
-
274
- **15:45 — You forward a hotel confirmation email.** Aitne extracts dates, address, and confirmation number into `travel_bookings`, saves the PDF to `~/.personal-agent/context/receipts/2026/05/`, and adds the trip to next week's morning briefing.
275
-
276
- **18:00 — Evening review.** Aitne notices you didn't reply to two emails from this morning. They get carried to tomorrow's `today.md`. It also sees you wrote *"shorter please"* twice today, classifies that as a tone-class signal, and silently shortens its replies going forward.
277
-
278
- **Friday 18:30 — Weekly review.**
279
- > Week of 2026-05-04: shipped 3 PRs, 2 deferred. Open loops: hotel cancellation, Acme follow-up. Focus next week: launch prep. Heads up: you've worked past 22:00 every day this week — should I clear Friday afternoon?
280
-
281
- The point isn't any single trick — it's that **all of this happens without you opening an app.**
101
+ Pre-1.0. APIs, schema, and dashboard surfaces may still change. SQLite migrations are deliberately destructive ("clean reinstall, no data migration"); Markdown memory in `context/` is forward-compatible and safe to keep across upgrades.
282
102
 
283
103
  ---
284
104
 
285
- ## How Aitne accumulates knowledge
286
-
287
- Every signal flows through the same pipeline: capture → short-term → long-term → injected back into every future conversation.
105
+ ## Install
288
106
 
289
- ```mermaid
290
- flowchart TB
291
- SOURCES["Sources: messages, calendar, mail,<br/>git, GitHub, Obsidian, Notion,<br/>your own manual edits"]
292
- OB["Observers and adapters<br/>(WebSocket, IDLE, polling)"]
293
- SQL["SQLite: observations,<br/>messages, agent_actions"]
294
- TODAY["today.md<br/>(working view, always injected)"]
295
- PROFILE["user/profile.md<br/>work, expertise,<br/>people, goals"]
296
- PROJECTS["projects/*.md<br/>roadmap.md"]
297
- JOURNAL["daily/YYYY-MM-DD.md<br/>weekly/YYYY-Www.md<br/>monthly/YYYY-MM.md"]
298
- AI["Next session<br/>any backend, any platform"]
299
-
300
- SOURCES --> OB
301
- OB --> SQL
302
- SQL --> TODAY
303
- TODAY --> JOURNAL
304
- TODAY --> PROFILE
305
- TODAY --> PROJECTS
306
-
307
- PROFILE -.-> AI
308
- TODAY -.-> AI
309
- PROJECTS -.-> AI
310
- JOURNAL -.-> AI
107
+ ```bash
108
+ npm install -g @aitne-sh/aitne@latest
109
+ aitne start
311
110
  ```
312
111
 
313
- **Key properties:**
112
+ Then bring at least one AI backend. The documented operating mode is **provider API keys** — paste them into the setup wizard (they land in the OS keychain, never `.env`):
314
113
 
315
- - **Plain Markdown.** `cat`, `vim`, `obsidian`, `cp` — there is no proprietary format. Uninstall and the memory stays yours.
316
- - **Layered retention.** `today.md` rotates to `yesterday.md` once per agent-day. `daily/` files are persistent by design (synthesized journal). `weekly/` is pruned after one year. `agent/journal.md` keeps the most recent ~12 weekly + 24 monthly sections. SQLite-backed history (messages, agent_actions) is pruned after 90 days.
317
- - **Always-injected context.** Every session starts with `user/profile.md` + `rules/management.md` + `today.md` already loaded — the agent never has to "search for context".
318
- - **You can always intervene.** Edit any file by hand. The agent picks up your changes on the next routine.
114
+ | Backend | Install | Auth |
115
+ |---|---|---|
116
+ | **Claude Code** | `npm install -g @anthropic-ai/claude-code` | `ANTHROPIC_API_KEY` in the wizard (Anthropic's headless-agent policy disallows Pro/Max subscriptions for SDK-driven sessions) |
117
+ | **OpenAI Codex CLI** | `npm install -g @openai/codex` | `OPENAI_API_KEY` in the wizard, or `codex login --device-auth` as fallback |
118
+ | **Google Gemini CLI** | `npm install -g @google/gemini-cli` | `GEMINI_API_KEY` / `GOOGLE_API_KEY`, or OAuth on first use |
119
+ | **OpenCode** (sst/opencode) | _coming soon_ — registered for preview; setup will open when the runtime executor lands | _coming soon_ |
319
120
 
320
- ### Compounding intelligence
121
+ The daemon listens on `:8321`, the dashboard on `:3000`. After `aitne start`, the browser opens to a 9-step setup wizard.
321
122
 
322
- The longer you use it, the better it gets. Not because the model improves — because the context does.
123
+ ### Verify the install
323
124
 
324
- ```mermaid
325
- flowchart LR
326
- D1["Day 1<br/>Empty profile<br/>Generic answers"]
327
- W1["Week 1<br/>Calendar synced<br/>People dictionary"]
328
- M1["Month 1<br/>Profile auto-filled<br/>Tone matches you"]
329
- M3["Month 3<br/>Full project map<br/>Proactive nudges"]
330
- Y1["Year 1<br/>Anticipates needs<br/>Recalls Q1 context"]
331
-
332
- D1 --> W1 --> M1 --> M3 --> Y1
125
+ ```bash
126
+ aitne status # PIDs, uptime, connected platforms, today's spend
127
+ aitne doctor # 10-check install diagnostic
128
+ aitne logs -f # tail the daemon log
333
129
  ```
334
130
 
335
- ### The implicit feedback loop
336
-
337
- Every interaction shapes Aitne's understanding of you implicitly. No buttons. No surveys.
338
-
339
- The Signal Detector tags each turn for **tone-class signals** (corrections like "be shorter", "no preamble") and **attribute-class signals** (durable facts like "I'm allergic to nuts"). The Evening Review interprets them:
340
-
341
- - **Tone** → updates the `character` runtime-config field, applied to every backend's system prompt.
342
- - **Attribute** → updates `user/profile.md` Learned Context.
343
-
344
- The line is enforced server-side: "I prefer concise replies" is tone (goes to character). "My flight is on Friday" is attribute (goes to profile).
131
+ ### From source
345
132
 
346
- ---
347
-
348
- ## Talk to it like a person
133
+ For contributors, or to hack on the daemon directly. Requires Node ≥ 22 and pnpm 10.x.
349
134
 
350
- Aitne has a dedicated set of management skills — `management-task-register`, `management-task-modify`, `management-task-stop`, `management-policy`, `user-profile`, `user-interview`. **You don't poke through 80 settings panels — you tell it.**
135
+ ```bash
136
+ git clone https://github.com/Aitne-sh/Aitne.git aitne
137
+ cd aitne
138
+ corepack enable
139
+ pnpm install
140
+ pnpm dev # foreground mode with full stdio
141
+ ```
351
142
 
352
- | You say (in any language) | Aitne does |
353
- |---|---|
354
- | *"Don't run the hourly check on weekends"* | Patches `hourlyCheckActiveStartHour/EndHour` per weekday |
355
- | *"Stop pinging me about Slack after 9pm"* | Updates `quietHoursStart/End` and per-platform notify policy |
356
- | *"Always check Sarah's calendar before scheduling with her"* | Adds a rule to `rules/management.md` |
357
- | *"Remember my partner's birthday is March 14"* | Appends to `user/profile.md` Learned Context |
358
- | *"I prefer concise replies — no preamble"* | Updates `character` field |
359
- | *"Move all my React work into one project file"* | Refactors `projects/*.md` and re-indexes |
360
- | *"Cancel tomorrow's morning briefing"* | Removes the `agent_schedule` row |
361
- | *"Forget what I said about my old job"* | Surgically edits `user/work.md` |
362
- | *"Email me a summary every Friday at 5pm"* | Creates a recurring schedule with a free-form prompt |
363
- | *"Switch to Codex for code reviews from now on"* | Updates `process_backend_config` mapping |
364
-
365
- Behind the scenes, the agent maps natural language to one of:
366
-
367
- - `PATCH /api/config` — runtime config (~100 keys)
368
- - `PUT /api/context/*` — Markdown memory (locked, validated, snapshotted)
369
- - `DELETE /api/schedule/:id` / `POST /api/recurring-schedules` — scheduling
370
- - `PATCH /api/config/character` — tone
371
- - `POST /api/triggers` — cron-driven custom routines
372
-
373
- Every change is journaled to `agent_actions` with `source_kind=user_directive`. Audit anything you don't recognize via `aitne audit`.
143
+ See [docs/setup-guide.md](docs/setup-guide.md) for the full installation walkthrough.
374
144
 
375
145
  ---
376
146
 
377
- ## Bring your own harness
147
+ ## How it works
378
148
 
379
- Already invested in Claude Code skills? Custom MCP servers? A polished `~/.codex/config.toml`? **Aitne loads them all.** No re-configuring. No vendor lock.
149
+ A long-running daemon receives signals from every channel you've connected, parks short-term state in SQLite, and spawns an AI session whenever it needs to think. The session reads your Markdown memory, calls a curated set of skills, and writes results back through the daemon API.
380
150
 
381
151
  ```mermaid
382
152
  flowchart LR
383
- Y1["~/.claude/<br/>skills, slash commands,<br/>MCP servers"]
384
- Y2["~/.codex/<br/>config, plugins"]
385
- Y3["~/.gemini/<br/>config, tools"]
386
- Y4["Your custom<br/>MCP servers"]
387
- A1["Aitne built-in skills<br/>(24 of them)"]
388
- A2["Per-event task flows"]
389
- A3["Persona MD per backend"]
390
- SESS["Per-session workdir<br/>~/.personal-agent/agent-sessions/[id]/<br/>CLAUDE.md, AGENTS.md, GEMINI.md<br/>plus .claude/skills, .codex/skills<br/>plus materialized MCP config"]
391
- RUN["Backend runs with<br/>your full toolkit plus Aitne's"]
392
-
393
- Y1 --> SESS
394
- Y2 --> SESS
395
- Y3 --> SESS
396
- Y4 --> SESS
397
- A1 --> SESS
398
- A2 --> SESS
399
- A3 --> SESS
400
- SESS --> RUN
401
- ```
153
+ subgraph WORLD["Your digital life"]
154
+ direction TB
155
+ W1["Messages"]
156
+ W2["Calendar"]
157
+ W3["Mail"]
158
+ W4["Git / GitHub"]
159
+ W5["Notes"]
160
+ end
402
161
 
403
- | You already have… | In Aitne it just works |
404
- |---|---|
405
- | A Claude Code MCP server connected to your company's internal API | Every Aitne session can use it. No code changes. |
406
- | Custom slash commands you built for `/review` or `/test` | Available in every Aitne-spawned Claude Code session. |
407
- | A polished `AGENTS.md` for your Codex setup | Aitne layers its persona on top, keeping your config intact. |
408
- | Your Gemini auth and project preferences | Inherited automatically. |
409
- | Skills you wrote for `~/.claude/skills/` | Imported on demand. |
162
+ subgraph LOCAL["Your laptop"]
163
+ direction TB
164
+ DAEMON["Aitne daemon<br/>(always on, 127.0.0.1)"]
165
+ BRAIN["AI session<br/>Claude / Codex / Gemini<br/>(OpenCode coming soon)"]
166
+ MEMORY["Markdown memory<br/>plain files you own"]
167
+ DAEMON --- BRAIN
168
+ BRAIN --- MEMORY
169
+ DAEMON --- MEMORY
170
+ end
410
171
 
411
- **The growth flywheel:** Claude Code, Codex, or Gemini ships a new connector → Aitne picks it up on next session → you get it for free.
172
+ YOU["You<br/>Slack · Telegram · Discord<br/>WhatsApp · Web dashboard"]
412
173
 
413
- ---
174
+ WORLD --- DAEMON
175
+ DAEMON --- YOU
176
+ ```
414
177
 
415
- ## Multi-platform, multi-app
178
+ Two execution paths run in parallel:
416
179
 
417
- One agent, every surface. A morning brief delivered to Slack, a follow-up via WhatsApp, an email draft from the dashboard Aitne carries the same context across all of them.
180
+ - **Reactive path** owner DMs/mentions, cron routines (morning / evening / weekly), calendar approach events. Event priority heap dispatcher backend session.
181
+ - **Polling path** — observers for Git, GitHub, Obsidian, Notion, Calendar, Mail write to an `observations` table without spawning sessions. An hourly cron triages those observations through a lite-tier session, then escalates to a full Sonnet-class session only if something worth surfacing was found.
418
182
 
419
- ```mermaid
420
- flowchart LR
421
- IN["Input surfaces:<br/>Slack DM, Telegram, Discord,<br/>WhatsApp, Web dashboard,<br/>manual file edits"]
422
- AITNE["Aitne daemon"]
423
- SVC["Connected apps:<br/>Google Calendar, Outlook Calendar,<br/>Gmail, Outlook, Yahoo, iCloud,<br/>Notion, Obsidian, GitHub,<br/>local Git, Google Maps,<br/>custom MCP servers"]
424
- OUT["Output surfaces:<br/>same DM channel,<br/>today.md updates,<br/>calendar actions,<br/>drafted emails,<br/>proactive notifications"]
425
-
426
- IN --> AITNE
427
- AITNE --- SVC
428
- AITNE --> OUT
429
- ```
183
+ A pre-pass `routine.fetch_window` session runs before each routine, fanning out per-account fetches (mail, calendar, Notion) into the `observations` table so the main session reads from a single source.
430
184
 
431
185
  ---
432
186
 
433
- ## CLI reference
187
+ ## CLI
434
188
 
435
189
  ### Lifecycle
436
190
 
437
191
  | Command | What it does |
438
192
  |---|---|
439
- | `aitne start [--no-open]` | Build if stale, launch daemon + dashboard in background. Opens browser unless `--no-open`. |
440
- | `aitne stop` | Graceful shutdown (SIGTERM → SIGKILL after 10 s). |
441
- | `aitne restart [--no-open] [--clean-context]` | Stop then start. `--clean-context` wipes `context/` after a tarball backup. |
442
- | `aitne status` | PIDs, uptime, connected platforms, backends, today's spend, last action, next scheduled item. |
443
- | `aitne logs [-f] [-n N] [-d]` | Tail the daemon log. `-d` = dashboard log. `-f` = follow. `-n N` = last N lines. |
444
- | `aitne dev` | Foreground mode (full stdio, useful for debugging). |
445
- | `aitne build` | Force a build (skip the mtime gate). |
193
+ | `aitne start [--no-open]` | Build if stale, launch daemon + dashboard in background |
194
+ | `aitne stop` | Graceful shutdown (SIGTERM → SIGKILL after 10 s) |
195
+ | `aitne restart [--clean-context]` | Stop then start. `--clean-context` wipes `context/` after a tarball backup |
196
+ | `aitne status` | PIDs, uptime, platforms, backends, today's spend |
197
+ | `aitne logs [-f] [-n N] [-d]` | Tail daemon log (`-d` = dashboard log, `-f` = follow) |
198
+ | `aitne dev` | Foreground mode (full stdio) |
446
199
 
447
200
  ### Operations
448
201
 
449
202
  | Command | What it does |
450
203
  |---|---|
451
- | `aitne setup` | Re-open the dashboard `/setup` wizard. Auto-starts the daemon if needed. |
452
- | `aitne open` | Open the dashboard in your browser. |
453
- | `aitne doctor [--json]` | 8 base install checks; the repository-drift check expands into one extra row per drifted repo. |
454
- | `aitne audit [flags]` | Read the agent action log directly from SQLite. |
455
- | `aitne version [--json]` | Version, Node, install path, last build time. |
456
- | `aitne update [--check]` | Print the npm command to upgrade. `--check` makes one network call. |
457
- | `aitne uninstall [--keep-data\|--wipe-data]` | Stop the daemon and offer to wipe `~/.personal-agent`. |
458
- | `aitne help [cmd]` | Help (or per-command help). |
459
-
460
- ### `aitne audit` flags
461
-
462
- | Flag | Default | Description |
463
- |---|---|---|
464
- | `--since <duration>` | `24h` | Time window (`1h`, `7d`, `2026-04-20`). |
465
- | `--type <pattern>` | — | `action_type` filter (`%` for LIKE matching). |
466
- | `--result <value>` | — | `success` / `failed` / `partial` / `skipped`. |
467
- | `--backend <name>` | — | `claude` / `codex` / `gemini`. |
468
- | `--limit <N>` | 50 | Row cap. |
469
- | `--detail` | off | Expand the `detail` JSON column. |
470
- | `--json` | off | Machine-readable output. |
471
-
472
- ### `aitne doctor` checks
473
-
474
- 1. Node version ≥ 22.0.0
475
- 2. Daemon port (`PA_API_PORT`, default 8321) is bindable
476
- 3. Dashboard port (`PA_DASHBOARD_PORT`, default 3000) is bindable
477
- 4. OS secret store usable (`security` / `secret-tool` / `PA_MASTER_PASSWORD`)
478
- 5. At least one backend CLI (`claude`, `codex`, or `gemini`) responds
479
- 6. `~/.personal-agent` exists and is writable
480
- 7. `better-sqlite3` native binding loads
481
- 8. `agent-assets/skills/` is reachable
482
- 9. Repository drift — one row per paired-local + GitHub repo whose `origin` no longer matches the registered `<owner>/<repo>`
483
-
484
- ---
485
-
486
- ## Architecture
487
-
488
- ```mermaid
489
- flowchart TB
490
- PLAT["Input platforms:<br/>Slack, Telegram, Discord,<br/>WhatsApp, Web dashboard"]
491
-
492
- subgraph DAEMON["Aitne daemon (Hono on :8321)"]
493
- direction TB
494
- EB["EventBus<br/>(priority heap)"]
495
- DI["Dispatcher<br/>(2 reactive + 3 autonomous semaphores)"]
496
- BR["BackendRouter<br/>ProcessKey to tier and backend<br/>plus fallback"]
497
- AC["Agent Core<br/>(IAgentCore interface)"]
498
- OB["Observers:<br/>Git, GitHub, Obsidian,<br/>Notion, Calendar, Mail"]
499
- SC["Scheduler<br/>(node-cron + agent_schedule)"]
500
- end
501
-
502
- BACKENDS["AI runtimes:<br/>Claude Code SDK,<br/>Codex CLI subprocess,<br/>Gemini CLI subprocess"]
503
-
504
- DATA["Local data:<br/>SQLite (WAL + FTS5),<br/>Markdown memory,<br/>OS Keychain"]
505
-
506
- PLAT --> EB
507
- SC --> EB
508
- OB --> DATA
509
- DATA --> EB
510
- EB --> DI
511
- DI --> BR
512
- BR --> AC
513
- AC --> BACKENDS
514
- AC --> DATA
515
- ```
516
-
517
- ### Two execution paths
518
-
519
- **Reactive path** — owner DMs / mentions, cron routines, calendar approach events, scheduled tasks
520
- → Event source → EventBus → Dispatcher → BackendRouter → Agent → output to user.
521
-
522
- **Polling path** — Obsidian, Git, GitHub, Notion, Calendar, Mail change detection
523
- → Observer → `observations` table (UPSERT, with `actor='user'|'agent'`)
524
- … time passes …
525
- → Hourly cron → Stage 2 lite-tier triage → Stage 3 full `routine.hourly_check` (if escalated) → agent reads pending → updates `today.md` / `roadmap.md` → notifies if needed.
204
+ | `aitne doctor [--json]` | 10 install-health checks + repo-drift expansion |
205
+ | `aitne audit [flags]` | Read the agent action log from SQLite — `--since`, `--type`, `--result`, `--backend`, `--detail`, `--json` |
206
+ | `aitne setup` | Re-open the dashboard `/setup` wizard |
207
+ | `aitne open` | Open the dashboard in your browser |
208
+ | `aitne run-now <job>` | Fire a maintenance job on demand (currently `roadmap_maintenance`) |
209
+ | `aitne verify <target>` | Read-only post-launch verification of a shipped design surface |
210
+ | `aitne version` / `update` / `uninstall` | Self-explanatory |
526
211
 
527
- `AgentWriteTracker` prevents agent → observer → agent loops by tagging the agent's own writes so the hourly check filters them out. A pre-pass `routine.fetch_window` session fans out per-account fetches into the `observations` table before each routine runs.
528
-
529
- ### Repo layout
530
-
531
- ```
532
- packages/
533
- ├── daemon/ # Hono server, EventBus, Dispatcher, BackendRouter, observers, SQLite layer, integration SDK wrappers
534
- ├── dashboard/ # Next.js 16 + React 19 + Tailwind 4 + shadcn/ui
535
- └── shared/ # Types, Zod schemas, ProcessKey enum, branding constants
536
-
537
- agent-assets/ # Read by the daemon at session-init time
538
- ├── agent-profiles/ # Persona MD per backend (CLAUDE.md / AGENTS.md / GEMINI.md)
539
- ├── skills/ # 24 built-in skills (context, calendar, mail, notion, …)
540
- ├── task-flows/ # Per-event prompt templates
541
- └── templates/ # Scaffold MD copied to context/ on first run
542
-
543
- bin/aitne.mjs # CLI entry — lifecycle + ops
544
- scripts/ # Build/run helpers and per-command modules
545
- docs/design/ # Architecture and design docs — source of truth
546
- ```
212
+ `aitne help [cmd]` for per-command details.
547
213
 
548
214
  ---
549
215
 
550
- ## Memory layout
551
-
552
- Everything the agent writes lives under `PA_DATA_DIR` (default `~/.personal-agent`):
553
-
554
- ```
555
- ~/.personal-agent/
556
- ├── context/ # Markdown memory — edit any file by hand at any time
557
- │ ├── _index.md # Navigation hub
558
- │ ├── today.md # Today's working view (always injected)
559
- │ ├── yesterday.md # Daemon-rotated archive
560
- │ ├── roadmap.md # Long-term goals (Morning + Evening injection)
561
- │ ├── context-index.md # Auto-maintained index
562
- │ ├── user/
563
- │ │ ├── profile.md # ~600 tokens, always injected
564
- │ │ ├── people.md # Relationship dictionary
565
- │ │ ├── work.md, expertise.md, personal.md, goals.md
566
- │ ├── rules/ # Policy files (management, redaction, journal)
567
- │ ├── routines/ # Per-cadence checklist rulebooks
568
- │ ├── dossiers/ # Carry-forward state per routine
569
- │ ├── projects/ # One file per active project + Obsidian Bases view
570
- │ ├── daily/YYYY-MM-DD.md # Synthesized daily journal (persistent by design)
571
- │ ├── weekly/YYYY-Www.md # Weekly review (1 yr file retention)
572
- │ ├── monthly/YYYY-MM.md # Monthly review (persistent by design)
573
- │ ├── inbox/ # Optional paste bucket
574
- │ └── agent/
575
- │ ├── journal.md # Private agent self-reflection
576
- │ └── scratch/ # 48-h TTL temp files
577
- ├── data/personal_agent.db # SQLite (WAL + FTS5)
578
- ├── logs/{daemon,dashboard}.log
579
- ├── prompts/ # Editable prompt templates
580
- ├── attachments/ # Chat attachments
581
- ├── agent-sessions/[id]/ # Per-session backend workdir
582
- ├── secrets/ # File-fallback secret store (empty when OS keychain is used)
583
- └── run/ # PID files for daemon + dashboard
584
- ```
585
-
586
- ### Write chokepoint
216
+ ## Backends
587
217
 
588
- Context-MD writes go through `curl http://localhost:8321/api/context/<path>` rather than the SDK's `Edit`/`Write` tools on those paths. This is enforced by **skill instructions** (the bundled skills only ever invoke the daemon API) plus the **absolute-block path globs** that hard-deny SDK writes to secret paths (`.env`, `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.personal-agent/secrets/**`, ). Routing context writes through the daemon API gives one chokepoint for locks (`today.md` write lock), frontmatter validation, and snapshots (30-day `md_file_snapshots` retention).
218
+ Aitne abstracts four AI runtimes behind a single `IAgentCore` interface. Every kind of work has a `ProcessKey` mapped to a tier (`lite` / `medium` / `high`) and a backend; for Claude those tiers map to **Haiku 4.5 / Sonnet 4.6 / Opus 4.7**.
589
219
 
590
- ---
591
-
592
- ## Multi-backend
593
-
594
- Aitne abstracts three AI runtimes behind a single `IAgentCore` interface:
595
-
596
- | Backend | Implementation | Session resume | Strengths |
220
+ | Backend | Implementation | Resume | Strengths |
597
221
  |---|---|---|---|
598
- | **Claude Code** | `@anthropic-ai/claude-agent-sdk` | Yes (SDK `resume` option) | Best for routines, deep context, server-side advisor |
599
- | **Codex CLI** | OpenAI Codex CLI subprocess + JSONL stream | Yes (`--resume <session-id>`) | Best for code-heavy tasks, fast iteration |
600
- | **Gemini CLI** | Google Gemini CLI subprocess + JSONL stream | Yes (`--resume <session-id>`) | Best for free-tier headroom, large-context summarization |
222
+ | **Claude Code** | `@anthropic-ai/claude-agent-sdk` | | Best for routines, deep context, server-side advisor |
223
+ | **Codex CLI** | OpenAI Codex CLI subprocess + JSONL stream | | Code-heavy tasks, fast iteration |
224
+ | **Gemini CLI** | Google Gemini CLI subprocess + JSONL stream | | Free-tier headroom, large-context summarization |
225
+ | **OpenCode** _(coming soon)_ | `opencode-ai` HTTP server + SDK client | ✓ | Multi-provider — routes to any `opencode auth login` provider. Preview-only in this release; the dashboard selectors are disabled until the runtime executor ships. |
601
226
 
602
- ### Per-process tier routing
227
+ The router fails over to a configured fallback backend automatically on `BackendQuotaError` or decisive failure, re-materializing the fallback's instruction file and skill directories into the session workdir.
603
228
 
604
- Every kind of work has a `ProcessKey` mapped to a tier (`lite` / `medium` / `high`) and a backend. For Claude, those tiers map to Haiku 4.5 / Sonnet 4.6 / Opus 4.7.
605
-
606
- | ProcessKey | Default tier | What runs there |
607
- |---|---|---|
608
- | `routine.morning_routine_initial` | **high** | First-day plan generation (one-shot, sets up profile) |
609
- | `routine.morning_routine` | medium | Daily plan generation — the highest-value recurring process |
610
- | `routine.evening_review` | medium | Today wrap-up |
611
- | `routine.weekly_review`, `routine.monthly_review` | medium | Cadence summaries |
612
- | `routine.hourly_check` | medium | Stage 3 observation aggregation |
613
- | `routine.hourly_check.triage` | lite | Stage 2 escalate-vs-log-only gate |
614
- | `routine.fetch_window` | lite | Pre-pass fan-out fetcher for routines |
615
- | `message.dm`, `message.mention` | medium | DM and channel response |
616
- | `dashboard.chat` | medium | Web chat |
617
- | `dashboard.docs_qa` | medium (tier-locked) | Docs panel — never burns Opus quota |
618
- | `agent.task`, `agent.dm_task` | medium | Scheduled wakeups |
619
- | `knowledge.import` | high | One-shot knowledge ingestion |
620
- | `calendar.change`, `gmail_classify` | lite | Polling-derived events |
621
- | `git.*`, `github.*` (event triage) | lite | Git/GitHub event triage |
622
- | `delegated_task` | lite | Delegated subprocess task mode |
623
- | `delegated_task_heavy` | high | Opt-in destructive-write task mode |
624
- | `observation.summarize` | lite | Per-observation classification |
625
- | `wiki.ingest_url`, `wiki.compile`, `wiki.ask`, `wiki.lint`, `wiki.trace`, `wiki.connect` | medium | Personal wiki surfaces |
626
-
627
- Configure each ProcessKey's backend and tier from the dashboard `/settings/models` page. The router fails over to a fallback backend automatically on `BackendQuotaError` or `BackendDecisiveFailure`, re-materializing the fallback's instruction file + skill directories into the session workdir.
229
+ Per-process tier defaults and the routing table are editable from the dashboard at `:3000/settings/models`.
628
230
 
629
231
  ---
630
232
 
631
233
  ## Integrations
632
234
 
633
- ### Messaging
634
-
635
- | Platform | Library | Mode | Setup |
636
- |---|---|---|---|
637
- | Slack | `@slack/bolt` | Socket Mode (WebSocket) | Bot + App tokens |
638
- | Telegram | `telegraf` | Long polling | Bot token |
639
- | Discord | `discord.js` | Gateway | Bot token |
640
- | WhatsApp | `@whiskeysockets/baileys` | QR pairing | Scan QR from dashboard |
641
- | Web Dashboard | Hono SSE | Always on | None |
642
-
643
- ### Mail (multi-provider, unified API)
644
-
645
- | Provider | Auth | Features |
646
- |---|---|---|
647
- | **Gmail** | `googleapis` OAuth2 | Read · send · drafts · labels · IMAP IDLE · classifier · attachment extraction |
648
- | **Outlook** | `@azure/msal-node` Graph API | Read · send · drafts · folders |
649
- | **Yahoo** | IMAP + app password | Read · send · IMAP IDLE |
650
- | **iCloud** | IMAP + app password | Read · send · IMAP IDLE |
651
-
652
- Local FTS5 full-text search runs across every account via `GET /api/mail/search?q=...`. The classifier (`mail-classifier`) tags messages across all providers; the Gmail-specific classifier auto-applies labels.
653
-
654
- ### Knowledge and docs
655
-
656
- - **Obsidian** — read directly via `Read`; write via the official Obsidian CLI (`obsidian create`, `obsidian append`, `obsidian daily:append`, …); `chokidar` watches the vault for user edits
657
- - **Notion** — `@notionhq/client` REST API; full page + database CRUD
658
- - **Wiki builder** — per-workspace ingest / compile / ask / lint / trace / connect surface backed by `packages/daemon/src/core/wiki/` (cost-gated full rebuilds, approval queue, compile preview, optional git pre-compile snapshot, dispatch-mode fan-out). One internal workspace or any number of external Obsidian vaults; addressed with `@<workspace>` on every bang command.
659
- - **Custom MCP servers** — register via `/api/mcp/servers`; materialized into the per-session workdir so backends use them transparently
660
-
661
- ### Code
662
-
663
- - **Git** (local) — daemon proxies `git log`, `git diff`, `git show`; cron-driven repository observer; `automation_triggers` table fires LLM prompts on `cron.daily` / `cron.weekly`
664
- - **GitHub** — `@octokit/rest` + webhooks; PR list and comment, issue ops, HMAC-SHA256 signature verification at `POST /webhook/github`
665
-
666
- ### Calendar and travel
667
-
668
- - **Google Calendar** — `googleapis` OAuth2; full event CRUD, freebusy, calendar list, 15-min approaching reminders
669
- - **Outlook Calendar** — Microsoft Graph via `@azure/msal-node` in direct mode, or user-managed MCP in delegated / native modes
670
- - **iCloud Calendar** — CalDAV via `tsdav`
671
- - **Google Maps** — Directions API for travel-time estimation tied to calendar events
672
-
673
- ### Lifestyle
674
-
675
- - **Receipts** — auto-extracts PDF / image attachments from mail with category detection
676
- - **Travel bookings** — auto-extracts flight, hotel, restaurant, train confirmations
677
- - **Reading** — Kindle My Clippings importer; reading-taste profile; weekly book recommendations
678
- - **Voice** — opt-in Whisper transcription (`ffmpeg-static` + `@huggingface/transformers`) runs locally on voice attachments. Install via `POST /api/voice/install`.
679
-
680
- ### Integration delegation modes
235
+ | Category | Providers |
236
+ |---|---|
237
+ | **Messaging** | Slack (Socket Mode), Telegram, Discord, WhatsApp (Baileys), Web dashboard |
238
+ | **Mail** | Gmail, Outlook, Yahoo, iCloud — unified API, classifier, local FTS5 search, IMAP IDLE |
239
+ | **Calendar** | Google Calendar, Outlook Calendar, iCloud (CalDAV), Google Maps for travel time |
240
+ | **Knowledge** | Obsidian (CLI + vault watch), Notion (REST), custom MCP servers |
241
+ | **Code** | Local Git, GitHub (Octokit + webhooks) |
242
+ | **Lifestyle** | Auto-extracted receipts · travel bookings · Kindle highlights · voice transcription (Whisper, opt-in) |
681
243
 
682
- Each integration runs in one of **four** modes:
244
+ ### Integration modes
683
245
 
684
- | Mode | Auth held by | Polling? | Setup cost | Capabilities |
685
- |---|---|---|---|---|
686
- | **`direct`** | Daemon (OAuth in OS Keychain) | Daemon poller | 5–6 vendor-console steps | Full feature set |
687
- | **`delegated`** | Main backend's connector | Cron `delegated-sync-worker` (per-cadence opt-in) | None — backend already authed | Reduced (whatever the connector exposes) |
688
- | **`native`** | Main backend's connector | None — agent reaches the integration in-turn via MCP | None | On-demand only; observations posted via `/api/observations` |
689
- | **`disabled`** | — | No | — | Off |
246
+ Each integration runs in one of four modes:
690
247
 
691
- `delegated` runs the backend's connector on a cron cadence (default-off, opt-in per cadence). `native` skips polling entirely and routes calls in-band during DMs / hourly checks. Outlook Mail and Outlook Calendar are user-managed-connector native: install the MCP yourself, Aitne synthesises a probe pass.
248
+ | Mode | Auth held by | Polling? | Capabilities |
249
+ |---|---|---|---|
250
+ | **`direct`** | Daemon (OAuth in OS Keychain) | Daemon poller | Full feature set |
251
+ | **`delegated`** | Main backend's connector | Cron worker (per-cadence opt-in) | Whatever the connector exposes |
252
+ | **`native`** | Main backend's connector | None — reached in-turn via MCP | On-demand only |
253
+ | **`disabled`** | — | — | Off |
692
254
 
693
- Every mode change goes through `POST /api/integrations/:key/probe` and the per-key flip lock — a live capability check is mandatory before flipping to `delegated` or `native`.
255
+ Every mode change goes through a live capability probe and a per-key flip lock.
694
256
 
695
257
  ---
696
258
 
697
- ## Safety model
259
+ ## Memory
698
260
 
699
- Aitne stacks **four** independent safety layers. The bottom layer holds even when the upper layers are widened by the user.
261
+ Everything Aitne writes lives in `~/.personal-agent/context/*.md` plain Markdown you can `cat`, `vim`, `obsidian`, or `cp`:
700
262
 
701
- ### Layer 1 — SDK permission model
702
-
703
- ```typescript
704
- // Safe (strict) mode — claude-tool-collection.ts:CLAUDE_DEFAULT_ALLOWED_TOOLS
705
- permissionMode: "dontAsk"
706
- allowedTools: ["Read", "Glob", "Grep", "Write", "Edit", "Skill",
707
- "Bash(curl *)", "Bash(git *)", "Bash(jq *)"]
708
- disallowedTools: ALWAYS_DISALLOWED_TOOLS + dashboard overrides
263
+ ```
264
+ context/
265
+ ├── today.md # Working view, always injected
266
+ ├── yesterday.md # Daemon-rotated archive
267
+ ├── roadmap.md # Long-term goals
268
+ ├── user/ # profile.md, people.md, work.md,
269
+ ├── rules/ # Policy files (management, redaction)
270
+ ├── projects/ # One file per active project
271
+ ├── daily/YYYY-MM-DD.md # Synthesized daily journal
272
+ ├── weekly/ # Weekly retrospectives
273
+ └── agent/journal.md # Private agent self-reflection
709
274
  ```
710
275
 
711
- Allow mode swaps to `permissionMode: "bypassPermissions"` but the absolute-block layer below still applies.
712
-
713
- ### Layer 2 — PreToolUse hooks (Claude, Safe mode)
714
-
715
- In Safe mode, every `Bash(curl ...)` invocation is parsed: the hostname must be `localhost` or `127.0.0.1` and the port must match the daemon's `apiPort`. Connection-override flags (`--connect-to`, `--resolve`, `--proxy`, `-x`, `--socks`, `-K`) are also rejected. A parallel `jq` hook blocks `--rawfile` / env-leak filters. In Allow mode the curl/jq pair is skipped, but the absolute-block hook (below) and the context-write attribution hook still run. Vault writes are attributed to the agent via `AgentWriteTracker` so they don't loop back as observations.
716
-
717
- ### Layer 3 — Daemon API risk tiers
718
-
719
- | Tier | Examples | Auth required |
720
- |---|---|---|
721
- | **Autonomous** | `GET /api/context/*`, `POST /api/notify`, `POST /api/schedule`, `POST /api/observations` | None (localhost only) |
722
- | **ReadSensitive** | `GET /api/observations`, `GET /api/calendar/events`, `GET /api/mail/search` | `X-Read-Token` or Bearer |
723
- | **Approve** | `PATCH /api/config`, `POST /api/setup/*`, `POST /api/system/factory-reset`, `POST /api/triggers`, `/api/repositories`, `/api/mcp/servers`, `/api/integrations` | Bearer |
724
-
725
- ### Layer 4 — Absolute-block layer (`ALWAYS_DISALLOWED_TOOLS`)
276
+ Context writes flow through `curl http://localhost:8321/api/context/<path>`, not the SDK's `Edit`/`Write` tools — this gives the daemon a single chokepoint for write locks, frontmatter validation, and 30-day snapshots. SQLite (`better-sqlite3` with FTS5) backs sessions, observations, agent actions, and history.
726
277
 
727
- Hard-blocked in **both Safe and Allow** modes. `bypassPermissions` and `allowedToolsOverride` cannot widen past this:
278
+ ---
728
279
 
729
- - Recursive delete: `rm -rf *`, `rm -r *`, `rm --recursive*`, plus every common short-flag bundle (`-rfv`, `-fr`, `-vr`, `-R`, `-fR`, …)
730
- - Privilege escalation: `sudo *`, `doas *`, `su *`
731
- - Pipe-to-shell RCE: `curl * | sh`, `wget * | bash`, `bash <(...)`, `sh <(...)`, no-space `bash<...` / `sh<...`
732
- - Indirect-eval RCE: `eval *`, `source *` (no Aitne skill or task flow uses these)
733
- - Platform secret CLI: `security *` (macOS), `secret-tool *` (Linux), `cmdkey *` (Windows)
734
- - Secret file reads and writes: `.env`, `**/.env`, `id_rsa*`, `id_ed25519*`, `~/.ssh/**`, `~/.gnupg/**`, `~/.aws/**`, `~/.config/gcloud/**`, `~/.config/gh/hosts.yml`, `~/.netrc`, `~/Library/Keychains/**`, `~/.local/share/keyrings/**`
735
- - Daemon-managed secret surfaces: `~/.personal-agent/secrets/**`, `~/.personal-agent/whatsapp/auth/**`, `~/.personal-agent/backups/**`
736
- - Anthropic-cloud managed-agent tools: `CronCreate`, `CronList`, `CronDelete`, `RemoteTrigger`, `PushNotification` (would bypass the local audit log, MD memory, and cost telemetry)
280
+ ## Safety
737
281
 
738
- Every blocked attempt lands in `agent_actions` with `action_type='blocked_absolute'`.
282
+ Four independent layers, designed so that the bottom layer holds even when upper layers are widened:
739
283
 
740
- ### Other guarantees
284
+ 1. **SDK permission model** — strict `allowedTools` whitelist in Safe mode; `bypassPermissions` in Allow mode
285
+ 2. **PreToolUse hooks** (Claude, Safe mode) — `curl` parsed for hostname + port; daemon-API is the only legal write path
286
+ 3. **Daemon API risk tiers** — `Autonomous` / `ReadSensitive` (X-Read-Token) / `Approve` (Bearer token)
287
+ 4. **Absolute-block layer** — recursive deletes, `sudo`, pipe-to-shell, secret-file reads/writes, Anthropic-cloud managed-agent tools — hard-denied in **both** modes regardless of overrides
741
288
 
742
- - **Localhost-only API** daemon binds to `127.0.0.1` only
743
- - **Bearer token** — required for all Approve-tier endpoints
744
- - **Webhook HMAC** — GitHub webhooks verified with `X-Hub-Signature-256`
745
- - **No automated financial transactions** — never trade, transfer, or pay
746
- - **No automated social posting** — never post publicly on your behalf
747
- - **Single-owner only** — group chats and multi-user channels are filtered at the adapter layer
748
- - **Auth Health Monitor** — hourly probe of every backend's auth state, with grace periods, escalating DMs, and auto-recovery flows for Claude / Codex / Gemini
289
+ Plus: localhost-only API, webhook HMAC verification, no automated financial transactions, no automated social posting, single-owner adapter filtering, hourly auth-health monitoring with auto-recovery.
749
290
 
750
291
  ---
751
292
 
752
- ## Cost and quotas
753
-
754
- ### Built-in controls
293
+ ## Cost
755
294
 
756
- | Control | Default | Configurable |
295
+ | Control | Default | Effect when set |
757
296
  |---|---|---|
758
- | `maxConcurrentSessions` (autonomous) | 3 | yes |
759
- | `maxReactiveSessions` (DMs) | 2 | yes |
760
- | `executeTimeoutMinutes` (per-execute watchdog) | 60 | yes |
761
- | `autonomousDailyCostCapUsd` | null (alert-only) | yes |
762
- | `autonomousMonthlyCostCapUsd` | null (alert-only) | yes |
763
- | Per-ProcessKey `maxBudgetUsd` (in `process_backend_config`) | per-row, set from `/settings/models` | yes |
764
- | `delegated_task` hard caps | `maxToolCalls=15` · `maxBudgetUsd=$0.50` · `timeoutMs=300_000` | no (compile-time) |
297
+ | `maxConcurrentSessions` (autonomous) | 3 | Hard semaphore |
298
+ | `maxReactiveSessions` (DMs) | 2 | Hard semaphore |
299
+ | `executeTimeoutMinutes` | 60 | Per-execute watchdog |
300
+ | `autonomousDailyCostCapUsd` | `null` | Priority-based skipping: `hourly_check` at 100%, `evening_review` at 150%, `morning_routine` at 200%. Reactive DMs are not gated. |
301
+ | `autonomousMonthlyCostCapUsd` | `null` | Alert + warn surface |
302
+ | Per-ProcessKey `maxBudgetUsd` | per-row | Hard cap per execute |
765
303
 
766
- ### Typical day's spend
767
-
768
- ```
769
- 04:00 Morning Routine (Sonnet) ~$0.15
770
- 07:00 Morning Briefing (Sonnet) ~$0.03
771
- 09:00 Hourly Check (Sonnet) ~$0.05
772
- 12:00 Hourly Check (Sonnet) ~$0.03
773
- 12:55 DM response (Sonnet) ~$0.08
774
- 18:00 Evening Review (Sonnet) ~$0.15
775
- ─────────────────────────────────────────────────
776
- Total ~$0.49
777
- ```
778
-
779
- If you're on a Claude / Codex / Gemini subscription, none of this hits a metered API key — it consumes your subscription quota directly. Quota exhaustion is detected, dedupe-notified once per 2-hour window, and the next hourly tick retries automatically.
304
+ Typical day for an active user: **~$0.50** (Morning routine + briefing + 2× hourly check + 1 DM + Evening review, all on Sonnet 4.6). Quota exhaustion is detected, dedupe-notified once per 2-hour window, and retried on the next tick.
780
305
 
781
306
  ---
782
307
 
783
308
  ## Configuration
784
309
 
785
- `.env` is **bootstrap-only**. Everything else is editable from the dashboard at runtime or via natural-language DMs.
786
-
787
- ### `.env` (bootstrap)
788
-
789
- ```bash
790
- PA_DATA_DIR=~/.personal-agent
791
- PA_API_PORT=8321
792
- PA_DASHBOARD_PORT=3000
793
- PA_LOG_LEVEL=info # trace | debug | info | warn | error
794
- ```
795
-
796
- ### Pre-seeding identifiers via env (optional)
797
-
798
- Bot tokens and OAuth credentials always live in the OS keychain — they are never read from environment variables. The wizard's Messaging step (or `/connections/*`) is the single entry point. The few non-secret identifiers you can pre-seed for fully scripted installs:
799
-
800
- ```bash
801
- PA_SLACK_OWNER_USER_ID=U...
802
- PA_TELEGRAM_OWNER_CHAT_ID=...
803
- PA_DISCORD_OWNER_USER_ID=...
804
- PA_WHATSAPP_ENABLED=true
805
- PA_WHATSAPP_OWNER_PHONE=...
806
-
807
- PA_PRIMARY_VAULT_PATH=~/Documents/MyVault
808
- PA_EXTERNAL_OBSIDIAN_VAULT_PATH=~/Documents/SecondaryVault
809
-
810
- PA_NOTION_DATABASE_IDS='{"tasks":"abc...","notes":"def..."}'
811
- ```
812
-
813
- Everything else — bot tokens, OAuth refresh tokens, Notion API key, GitHub token, Google Maps key, Apple Calendar credentials — is set from the dashboard `/connections` page (or via the setup wizard) and lives in the keychain.
310
+ `.env` is **bootstrap-only** (`PA_DATA_DIR`, `PA_API_PORT`, `PA_DASHBOARD_PORT`, `PA_LOG_LEVEL`). Everything else — ~100 runtime keys covering schedule, notifications, models, character, mail, voice, delegated mode — is editable from the dashboard at `:3000`, or via natural-language DMs to the agent.
814
311
 
815
- ### Runtime settings
816
-
817
- The dashboard `/settings` tree exposes ~100 runtime keys. Headline groups:
818
-
819
- - **Schedule** — `timezone`, `dayBoundaryHour`, hourly check window and interval, cron schedules
820
- - **Notifications** — `quietHoursStart/End`, `maxNotificationsPerHour`, `maxNotificationsPerDay`, `batchIntervalMinutes`
821
- - **Sessions** — `sessionTimeoutDmMinutes`, `historyInjectionMaxMessages`, `historyInjectionMaxTokens`
822
- - **Safety** — execution mode per backend, `disallowedTools` overrides
823
- - **Models** — per-ProcessKey backend + tier, advisor on/off, advisor model
824
- - **Cost** — daily / monthly soft caps with 80% and 100% alerts
825
- - **Mail** — provider list, poll interval, IMAP IDLE on/off
826
- - **Character** — 1,000-char free-form tone description
827
- - **Language** — `primaryLanguage` nudges output language for DMs, knowledge, and vault writes
828
- - **Voice** — `voiceTranscriptionEnabled`, `voiceTranscriptionPrimaryLanguage` (the model itself is set via `PA_VOICE_TRANSCRIPTION_MODEL` env-only)
829
- - **Delegated task mode** — kill switch, per-day quota, heavy-tier opt-in, cache / pool / structured-output toggles
830
-
831
- …or just DM the agent: *"Don't run hourly checks on weekends."*
312
+ Bot tokens and OAuth credentials always live in the OS keychain, never in environment variables.
832
313
 
833
314
  ---
834
315
 
835
316
  ## Platform support
836
317
 
837
- | Concern | macOS | Linux | Windows |
318
+ | | macOS | Linux | Windows |
838
319
  |---|---|---|---|
839
- | **Secret storage** | Keychain (`security`) | `secret-tool` (libsecret) → AES file fallback | DPAPI via `powershell.exe` → AES file fallback |
840
- | **Folder picker** | `osascript` | `zenity` / `kdialog` / `yad` | `System.Windows.Forms.FolderBrowserDialog` |
320
+ | **Secret storage** | Keychain | `secret-tool` (libsecret) → AES file fallback | DPAPI → AES file fallback |
321
+ | **Folder picker** | `osascript` | `zenity` / `kdialog` / `yad` | `FolderBrowserDialog` |
841
322
  | **Process tree kill** | POSIX process group | POSIX process group | `taskkill /T /F` |
842
- | **Log tailing (`-f`)** | Built-in Node tailer | Built-in Node tailer | Built-in Node tailer (no `tail` binary needed) |
843
- | **Console windows** | n/a | n/a | Background spawns hide the console window |
844
323
 
845
- ### WSL
324
+ WSL falls back to the encrypted file store — set `PA_MASTER_PASSWORD` to a long random string. Windows users hitting `ENAMETOOLONG` on install should enable long paths via `LongPathsEnabled=1` registry key.
846
325
 
847
- GNOME Keyring / D-Bus are typically unavailable. Aitne falls back to the encrypted file store. Set:
848
-
849
- ```bash
850
- export PA_MASTER_PASSWORD='use-a-long-random-string'
851
- ```
852
-
853
- ### Linux secret-tool
854
-
855
- ```bash
856
- sudo apt-get install libsecret-tools # Debian / Ubuntu
857
- sudo dnf install libsecret # Fedora
858
- sudo pacman -S libsecret # Arch
859
- ```
860
-
861
- ### Windows long paths
862
-
863
- If `npm install` fails with `ENAMETOOLONG`, run from elevated PowerShell and reboot:
864
-
865
- ```powershell
866
- Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
867
- -Name "LongPathsEnabled" -Value 1
868
- ```
326
+ Common gotchas: [docs/troubleshooting.md](docs/troubleshooting.md)
869
327
 
870
328
  ---
871
329
 
872
- ## Troubleshooting
873
-
874
- ### `aitne start` says "dist not found"
875
-
876
- The build did not complete. Run `aitne build` and check for TypeScript errors.
877
-
878
- ### Port already in use
879
-
880
- Change `PA_API_PORT` (or `PA_DASHBOARD_PORT`) in `.env`. To find the conflicting process:
881
-
882
- ```bash
883
- # macOS / Linux
884
- lsof -i :8321
885
-
886
- # Windows
887
- netstat -ano | findstr :8321
888
- ```
889
-
890
- ### `aitne` not found after `npm install -g`
891
-
892
- ```bash
893
- npm config get prefix
894
- # add the printed prefix's `bin/` (or its root on Windows) to your PATH
895
- ```
330
+ ## Documentation
896
331
 
897
- ### SQLite errors on startup
898
-
899
- The DB can be reset safely — your Markdown memory in `context/` is untouched. The `*` clears the WAL + SHM companion files:
332
+ | Topic | Doc |
333
+ |---|---|
334
+ | Documentation index | [docs/index.md](docs/index.md) |
335
+ | Setup walkthrough | [docs/setup-guide.md](docs/setup-guide.md) |
336
+ | Troubleshooting | [docs/troubleshooting.md](docs/troubleshooting.md) |
337
+ | Maintenance playbook | [docs/maintenance.md](docs/maintenance.md) |
338
+ | Advisor model | [docs/advisor.md](docs/advisor.md) |
900
339
 
901
- ```bash
902
- aitne stop
903
- rm ~/.personal-agent/data/personal_agent.db*
904
- # Remove-Item "$env:USERPROFILE\.personal-agent\data\personal_agent.db*" # Windows
905
- aitne start
906
- ```
340
+ ---
907
341
 
908
- ### Backend auth expired
342
+ ## Tech stack
909
343
 
910
- ```bash
911
- aitne doctor # confirms which backend failed
912
- claude auth login # re-auth Claude
913
- codex login --device-auth # re-auth Codex
914
- # Gemini re-auth happens automatically via the dashboard banner
915
- ```
344
+ Daemon: Node.js 22 · Hono · `@anthropic-ai/claude-agent-sdk` · `@slack/bolt` · `telegraf` · `discord.js` · `@whiskeysockets/baileys` · `googleapis` · `@azure/msal-node` · `@notionhq/client` · `@octokit/rest` · `tsdav` · `chokidar` · `node-cron` · `better-sqlite3` (FTS5) · `pino` · `zod`
916
345
 
917
- ### Diagnostic dump
346
+ Dashboard: Next.js 16 · React 19 · Tailwind 4 · shadcn/ui · TanStack Query · Recharts · Monaco
918
347
 
919
- ```bash
920
- aitne audit --since 24h --result failed --detail
921
- ```
348
+ Monorepo: pnpm 10 workspaces · Turborepo · TypeScript 5.8 · Vitest 3 (100% coverage gate on a curated pure-logic subset)
922
349
 
923
350
  ---
924
351
 
925
- ## Development
926
-
927
- ### Tech stack
928
-
929
- | Layer | Stack |
930
- |---|---|
931
- | **Daemon** | Node.js 22 · Hono · `@anthropic-ai/claude-agent-sdk` · `@slack/bolt` · `telegraf` · `discord.js` · `@whiskeysockets/baileys` · `googleapis` · `@azure/msal-node` · `@notionhq/client` · `@octokit/rest` · `tsdav` · `chokidar` · `node-cron` · `heap-js` · `pino` · `zod` |
932
- | **Storage** | `better-sqlite3` (WAL + FTS5 trigram) · OS Keychain · plain Markdown |
933
- | **Dashboard** | Next.js 16 (App Router) · React 19 · Tailwind CSS 4 · shadcn/ui · TanStack Query · Recharts · Monaco Editor |
934
- | **Voice** | `ffmpeg-static` · `@huggingface/transformers` (Whisper, opt-in) |
935
- | **Monorepo** | pnpm 10.x workspaces · Turborepo · TypeScript 5.8 · Vitest 3 |
352
+ ## Contributing
936
353
 
937
- ### Conventions
354
+ Issues and PRs welcome. Conventions:
938
355
 
939
356
  - All code, comments, tests, and user-facing text are in **English**
940
357
  - TypeScript throughout, camelCase, ESM with `.js` import extensions
941
358
  - Tests colocated with source as `foo.ts` + `foo.test.ts`
942
- - Vitest enforces **100% coverage** on a curated subset of pure-logic modules
943
- - The `docs/design/` tree is the authoritative spec; `packages/daemon/src/` is the source of truth when they diverge
944
-
945
- ### Source-of-truth pointers
946
-
947
- | If you need to… | Start in |
948
- |---|---|
949
- | Understand startup order | `packages/daemon/src/index.ts` |
950
- | Change event routing | `src/core/dispatcher.ts` + `src/core/event-bus.ts` |
951
- | Add a backend or change tier mapping | `packages/shared/src/process-key.ts` + `src/core/backends/backend-router.ts` |
952
- | Add an API route | `src/api/routes/` + register in `src/api/server.ts` |
953
- | Add an integration | `packages/shared/src/integrations.ts` (registry) + `src/services/<name>/` + optional `src/observers/` |
954
- | Edit a built-in skill | `agent-assets/skills/<slug>/SKILL.md` |
955
- | Edit an event task flow | `agent-assets/task-flows/<eventType>.md` |
956
- | Change risk classification | `src/safety/risk-classifier.ts` |
957
- | Change the absolute-block layer | `src/safety/always-disallowed.ts` |
958
- | Change auth health / recovery | `src/core/backends/auth-health-monitor.ts` + `auth-recovery.ts` |
359
+ - `packages/daemon/src/` is the source of truth
959
360
 
960
361
  ---
961
362
 
962
363
  ## FAQ
963
364
 
964
- **Is Aitne a chatbot?**
965
- No. It's a daemon. It also responds to chat, but the more interesting half is what it does while you're not looking at it.
966
-
967
- **Does it phone home?**
968
- No. The daemon binds to `127.0.0.1` only. There is no telemetry. Verify with `lsof` and `nettop`.
969
-
970
- **Where do my secrets live?**
971
- In your OS-native credential store (macOS Keychain / libsecret / DPAPI). Never in `.env`. On systems without a credential store, in an AES-encrypted file under `~/.personal-agent/secrets/`.
972
-
973
- **Can I bring my own AI?**
974
- Yes — Claude Code, OpenAI Codex, and Google Gemini CLI are all supported. Pick one or all three. Per-process tier routing lets you mix-and-match.
975
-
976
- **Do I need an API key?**
977
- No metered API key required — Aitne uses your subscription quota via the official CLIs (`claude auth login`, `codex login`, `gemini`). If you'd rather pay-as-you-go, supply `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GEMINI_API_KEY` in the wizard.
978
-
979
- **Can I edit the agent's memory directly?**
980
- Yes — that's the entire point. Open `~/.personal-agent/context/today.md` in your editor, change anything, save. The agent picks up your edits on the next routine. Any edit is just text in a file — no proprietary format, no migration headaches if you uninstall.
981
-
982
- **What about Obsidian?**
983
- Aitne can use your existing Obsidian vault as the primary memory store. The agent reads vault files directly and writes via the official Obsidian CLI. Your wiki links keep working. Your daily notes get appended to.
365
+ **Is Aitne a chatbot?** No — it's a daemon. It also responds to chat, but the more interesting half is what it does while you're not looking at it.
984
366
 
985
- **Can I run my own MCP servers?**
986
- Yes. Register them in the dashboard `/connections` page; the daemon writes the per-session MCP config into each backend's session workdir before launching, so all your MCP tools are available transparently.
367
+ **Does it phone home?** No. The daemon binds to `127.0.0.1` only. No telemetry. Verify with `lsof` and `nettop`.
987
368
 
988
- **Do my existing Claude Code / Codex / Gemini settings work?**
989
- Yes. Aitne reads your `~/.claude/`, `~/.codex/`, `~/.gemini/` configs on session init and layers its persona on top. Custom skills, slash commands, MCP servers, and plugins all carry over. See [Bring your own harness](#bring-your-own-harness).
369
+ **Can I edit memory directly?** Yes. Open `~/.personal-agent/context/today.md`, change anything, save. The agent picks up your edits on the next routine.
990
370
 
991
- **Does it work without internet?**
992
- The AI backends and reactive messaging need internet (to hit those services). The daemon, dashboard, observers (Git, Obsidian local), and Markdown memory are entirely offline.
371
+ **Do my existing Claude Code / Codex / Gemini settings work?** Yes. Aitne reads `~/.claude/`, `~/.codex/`, and `~/.gemini/` on session init and layers its persona on top. (`~/.opencode/` is recognised but the OpenCode runtime is coming soon.)
993
372
 
994
- **Does it support languages other than English?**
995
- Yes. Talk to it in your native language — Japanese, German, Spanish, anything. The LLM handles it; the `primaryLanguage` setting nudges DM, knowledge, and vault outputs into that language too. Implementation code remains English-only.
373
+ **Is this for my team?** No — single-owner by design. Group chats and multi-user channels are filtered at the adapter layer.
996
374
 
997
- **Is this for my whole team?**
998
- No — Aitne is **single-owner by design**. Group chats and multi-user channels are filtered at the adapter layer. If you want a team agent, run one Aitne per teammate.
375
+ **Does it work without internet?** Backends and reactive messaging need internet. The daemon, dashboard, observers, and Markdown memory are entirely offline.
999
376
 
1000
- **How do I uninstall?**
1001
- `aitne uninstall`. It will offer to wipe `~/.personal-agent` or keep it for re-installation.
377
+ **How do I uninstall?** `aitne uninstall` — offers to wipe `~/.personal-agent` or keep it for re-installation.
1002
378
 
1003
379
  ---
1004
380
 
1005
381
  ## License
1006
382
 
1007
- MIT — use, modify, and distribute freely. See [LICENSE](./LICENSE) for the full text.
1008
-
1009
- ---
1010
-
1011
- <div align="center">
1012
-
1013
- **Aitne — Always on. Always yours.**
1014
-
1015
- [Issues](https://github.com/Aitne-sh/Aitne/issues) · [Discussions](https://github.com/Aitne-sh/Aitne/discussions) · [npm](https://www.npmjs.com/package/@aitne-sh/aitne)
1016
-
1017
- </div>
383
+ MIT — see [LICENSE](./LICENSE).