@aitne-sh/aitne 0.1.10 → 0.1.12

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 (149) hide show
  1. package/README.md +12 -8
  2. package/agent-assets/agent-profiles/background-task.md +53 -0
  3. package/agent-assets/agent-profiles/conversational.md +1 -0
  4. package/agent-assets/agent-profiles/routine-fetch-window.md +14 -75
  5. package/agent-assets/agent-profiles/routine.md +1 -1
  6. package/agent-assets/agents/{hourly-check → activity-scan}/agent.md +22 -17
  7. package/agent-assets/agents/monthly-review/agent.md +6 -5
  8. package/agent-assets/agents/morning-routine/agent.md +3 -4
  9. package/agent-assets/docs/concepts/agent-day.md +4 -5
  10. package/agent-assets/docs/concepts/auth-health.md +23 -20
  11. package/agent-assets/docs/concepts/backends-and-tiers.md +25 -18
  12. package/agent-assets/docs/concepts/costs-and-quotas.md +11 -10
  13. package/agent-assets/docs/concepts/delegated-mode.md +13 -12
  14. package/agent-assets/docs/concepts/memory-model.md +13 -9
  15. package/agent-assets/docs/concepts/observations.md +24 -20
  16. package/agent-assets/docs/concepts/process-keys.md +10 -9
  17. package/agent-assets/docs/concepts/routines.md +34 -31
  18. package/agent-assets/docs/concepts/safety-and-execution.md +11 -7
  19. package/agent-assets/docs/concepts/safety-model.md +19 -8
  20. package/agent-assets/docs/concepts/skills.md +10 -8
  21. package/agent-assets/docs/features/integrations/browser-history.md +14 -10
  22. package/agent-assets/docs/features/integrations/calendar.md +24 -13
  23. package/agent-assets/docs/features/integrations/git.md +13 -11
  24. package/agent-assets/docs/features/integrations/github.md +22 -14
  25. package/agent-assets/docs/features/integrations/mail.md +22 -20
  26. package/agent-assets/docs/features/integrations/notion.md +35 -11
  27. package/agent-assets/docs/features/integrations/obsidian.md +8 -8
  28. package/agent-assets/docs/features/lifestyle/git.md +24 -20
  29. package/agent-assets/docs/features/lifestyle/reading.md +5 -3
  30. package/agent-assets/docs/features/lifestyle/receipts.md +11 -10
  31. package/agent-assets/docs/features/memory-files/agent-journal.md +25 -16
  32. package/agent-assets/docs/features/memory-files/agent-lessons.md +7 -6
  33. package/agent-assets/docs/features/memory-files/projects.md +5 -4
  34. package/agent-assets/docs/features/memory-files/schedule.md +6 -3
  35. package/agent-assets/docs/features/memory-files/today.md +10 -7
  36. package/agent-assets/docs/features/memory-files/user-profile.md +14 -9
  37. package/agent-assets/docs/features/messaging/bang-commands.md +21 -6
  38. package/agent-assets/docs/features/messaging/dashboard-chat.md +1 -1
  39. package/agent-assets/docs/features/messaging/overview.md +12 -9
  40. package/agent-assets/docs/features/operations/activity-and-conversations.md +1 -1
  41. package/agent-assets/docs/features/operations/browser-tasks.md +184 -0
  42. package/agent-assets/docs/features/operations/cost-tracking.md +11 -1
  43. package/agent-assets/docs/features/operations/managed-chromium.md +1 -0
  44. package/agent-assets/docs/features/operations/notifications.md +11 -1
  45. package/agent-assets/docs/features/operations/quiet-hours.md +41 -12
  46. package/agent-assets/docs/features/operations/schedule-approaching.md +2 -2
  47. package/agent-assets/docs/features/routines/activity-scan.md +220 -0
  48. package/agent-assets/docs/features/routines/custom-routines.md +82 -138
  49. package/agent-assets/docs/features/routines/evening-review.md +14 -12
  50. package/agent-assets/docs/features/routines/morning-routine.md +5 -4
  51. package/agent-assets/docs/features/routines/weekly-review.md +18 -3
  52. package/agent-assets/docs/features/wiki/commands.md +1 -1
  53. package/agent-assets/docs/features/wiki/dashboard.md +1 -1
  54. package/agent-assets/docs/getting-started/01-what-is-this.md +4 -4
  55. package/agent-assets/docs/getting-started/04-first-day.md +27 -30
  56. package/agent-assets/docs/glossary.md +8 -7
  57. package/agent-assets/docs/guides/add-a-custom-routine.md +122 -68
  58. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +5 -3
  59. package/agent-assets/docs/guides/change-which-model-handles-x.md +1 -1
  60. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +1 -1
  61. package/agent-assets/docs/guides/pause-the-agent.md +22 -20
  62. package/agent-assets/docs/guides/reinstall-cleanly.md +2 -0
  63. package/agent-assets/docs/guides/setup-wizard.md +13 -10
  64. package/agent-assets/docs/reference/api.md +11 -0
  65. package/agent-assets/docs/reference/config.md +30 -20
  66. package/agent-assets/docs/reference/keyboard-shortcuts.md +2 -2
  67. package/agent-assets/docs/reference/knowledge-layout.md +14 -10
  68. package/agent-assets/docs/reference/process-keys.md +7 -7
  69. package/agent-assets/docs/reference/skills.md +5 -2
  70. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +32 -16
  71. package/agent-assets/docs/troubleshooting/observation-not-detected.md +26 -24
  72. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +1 -1
  73. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +3 -3
  74. package/agent-assets/playbooks/markdown-note.md +43 -0
  75. package/agent-assets/playbooks/monitoring.md +29 -0
  76. package/agent-assets/playbooks/research.md +47 -0
  77. package/agent-assets/skills/agent-create/SKILL.md +45 -29
  78. package/agent-assets/skills/agent-create/references/prompt-frame-extended.md +132 -0
  79. package/agent-assets/skills/agent-create/references/prompt-frame.md +125 -0
  80. package/agent-assets/skills/background-task/SKILL.md +184 -0
  81. package/agent-assets/skills/background-task-reply/SKILL.md +100 -0
  82. package/agent-assets/skills/board/SKILL.md +93 -0
  83. package/agent-assets/skills/browser-history/SKILL.md +34 -16
  84. package/agent-assets/skills/browser-history-respond/SKILL.md +3 -3
  85. package/agent-assets/skills/browser-task/SKILL.md +14 -7
  86. package/agent-assets/skills/context/SKILL.md +4 -3
  87. package/agent-assets/skills/context/references/api.md +5 -3
  88. package/agent-assets/skills/context/references/snapshot-files.md +4 -4
  89. package/agent-assets/skills/external-services/SKILL.native.claude.md +13 -7
  90. package/agent-assets/skills/external-services/SKILL.native.codex.md +11 -5
  91. package/agent-assets/skills/external-services/SKILL.native.gemini.md +11 -5
  92. package/agent-assets/skills/mail/SKILL.md +2 -2
  93. package/agent-assets/skills/mail/SKILL.native.claude.md +16 -9
  94. package/agent-assets/skills/mail/SKILL.native.codex.md +15 -8
  95. package/agent-assets/skills/mail/SKILL.native.gemini.md +11 -5
  96. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +20 -12
  97. package/agent-assets/skills/management-policy/SKILL.md +26 -17
  98. package/agent-assets/skills/management-policy/curation.json +1 -1
  99. package/agent-assets/skills/management-policy/references/policy-workflow.md +26 -13
  100. package/agent-assets/skills/notify/SKILL.md +10 -5
  101. package/agent-assets/skills/notify/references/priority.md +30 -17
  102. package/agent-assets/skills/notion/SKILL.md +1 -1
  103. package/agent-assets/skills/notion/SKILL.native.claude.md +3 -3
  104. package/agent-assets/skills/notion/SKILL.native.codex.md +2 -2
  105. package/agent-assets/skills/notion/SKILL.native.gemini.md +2 -2
  106. package/agent-assets/skills/observations/SKILL.md +5 -5
  107. package/agent-assets/skills/roadmap/references/api.md +7 -2
  108. package/agent-assets/skills/schedule/SKILL.md +26 -15
  109. package/agent-assets/skills/schedule/references/batch.md +1 -1
  110. package/agent-assets/skills/schedule/references/model-selection.md +1 -1
  111. package/agent-assets/skills/schedule/references/prompt-frame.md +125 -0
  112. package/agent-assets/skills/schedule/references/recurrence-rule.md +20 -12
  113. package/agent-assets/skills/scheduled-managed-task/SKILL.md +12 -9
  114. package/agent-assets/skills/task/SKILL.md +79 -0
  115. package/agent-assets/skills/today/SKILL.md +19 -3
  116. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +9 -4
  117. package/agent-assets/skills/today/references/agent-plan-revision.md +28 -0
  118. package/agent-assets/skills/today/references/today-skeleton.md +5 -5
  119. package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
  120. package/agent-assets/system-prompts/routine-research-cluster-update.md +71 -0
  121. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +47 -21
  122. package/agent-assets/task-flows/background_task.md +81 -0
  123. package/agent-assets/task-flows/git.local_ahead.stale.md +1 -1
  124. package/agent-assets/task-flows/git.push.detected.md +1 -1
  125. package/agent-assets/task-flows/git.tag.created.md +1 -1
  126. package/agent-assets/task-flows/github.assigned.md +1 -1
  127. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  128. package/agent-assets/task-flows/github.security_alert.md +1 -1
  129. package/agent-assets/task-flows/message.received.dm.md +7 -3
  130. package/agent-assets/task-flows/message.received.dm_first.md +4 -2
  131. package/agent-assets/task-flows/{routine.hourly_check.md → routine.activity_scan.md} +31 -23
  132. package/agent-assets/task-flows/{routine.hourly_check.triage.md → routine.activity_scan.triage.md} +3 -3
  133. package/agent-assets/task-flows/routine.monthly_review.md +9 -8
  134. package/agent-assets/task-flows/routine.research_cluster_update.md +33 -19
  135. package/agent-assets/task-flows/routine.roadmap_refresh.md +2 -2
  136. package/agent-assets/task-flows/routine.today_refresh.md +1 -1
  137. package/agent-assets/task-flows/routine.weekly_review.md +103 -4
  138. package/agent-assets/task-flows/schedule.approaching.md +2 -2
  139. package/agent-assets/task-flows/scheduled.dm.md +96 -12
  140. package/agent-assets/task-flows/scheduled.task.md +7 -1
  141. package/agent-assets/templates/_manifest.json +2 -2
  142. package/agent-assets/templates/knowledge/dossiers/_index.md +1 -1
  143. package/agent-assets/templates/knowledge/dossiers/{hourly.md → activity-scan.md} +1 -1
  144. package/agent-assets/templates/policies/journal-format.md +1 -1
  145. package/agent-assets/templates/policies/mcp.md +1 -1
  146. package/agent-assets/templates/policies/routines/_index.md +1 -1
  147. package/agent-assets/templates/policies/routines/{hourly.md → activity-scan.md} +5 -5
  148. package/package.json +6 -5
  149. package/agent-assets/docs/features/routines/hourly-check.md +0 -205
@@ -0,0 +1,184 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/operations/browser-tasks
4
+ title: Browser Tasks
5
+ id: browser-tasks
6
+ aliases:
7
+ - browser tasks
8
+ - browser task
9
+ - web task
10
+ - browser automation tasks
11
+ - sandboxed browser
12
+ category: features
13
+ summary: |
14
+ Open-ended browser actions the agent runs for you in a sandboxed,
15
+ one-tab-per-task sub-agent — "send a contact form on Amazon", "check
16
+ the price of X". You kick a task off in DM (or schedule one); the
17
+ agent DMs you back for clarification or a final confirm when it needs
18
+ your input. The Browser Tasks page is where every run shows up, with
19
+ live state, a screenshot trace, and a cancel button.
20
+ section: operations
21
+ tags:
22
+ - operations
23
+ - browser-automation
24
+ - safety
25
+ status: beta
26
+ ask_examples:
27
+ - What is the Browser Tasks page?
28
+ - How do I start a browser task?
29
+ - Why is my browser task waiting for me?
30
+ - What do the browser-task states mean?
31
+ - How do I cancel a running browser task?
32
+ - Where do I see the screenshots from a browser task?
33
+ locale: en-US
34
+ created: 2026-06-16
35
+ updated: 2026-06-16
36
+ keywords:
37
+ - browser tasks
38
+ - browser-task
39
+ - sandboxed sub-agent
40
+ - awaiting_user
41
+ - final_confirm
42
+ - screenshot trace
43
+ - allowlist
44
+ - payment-path block
45
+ - cancel task
46
+ related:
47
+ - features/operations/managed-chromium
48
+ - features/integrations/browser-history
49
+ - concepts/safety-and-execution
50
+ - concepts/safety-model
51
+ ui_anchors:
52
+ - /browser-tasks
53
+ - /browser
54
+ process_keys:
55
+ - browser_task
56
+ config_keys:
57
+ - browserTaskMaxConcurrent
58
+ - browserTaskPendingQueueTimeoutMinutes
59
+ - browserTaskRespectQuietHours
60
+ - browserTaskHostnameDenylist
61
+ api_endpoints:
62
+ - POST /api/browser-task
63
+ - GET /api/browser-task
64
+ - GET /api/browser-task/:id
65
+ - GET /api/browser-task/:id/events
66
+ - GET /api/browser-task/:id/screenshots/:file
67
+ - POST /api/browser-task/:id/clarify
68
+ - POST /api/browser-task/:id/cancel
69
+ ---
70
+
71
+ # Browser Tasks
72
+
73
+ A **browser task** is an open-ended action you ask the agent to carry
74
+ out on the web — "send a contact form on Amazon's contact-us page",
75
+ "check the price of X", "fill in this signup". Each task runs in a
76
+ sandboxed sub-agent with **one browser tab to itself**, under allowlist
77
+ enforcement, a payment-path block, and a screenshot trace. The
78
+ **Browser Tasks** page (`/browser-tasks`) is the operational surface
79
+ where every run shows up — what is queued, running, waiting on you, or
80
+ finished.
81
+
82
+ This is different from two neighbouring surfaces:
83
+
84
+ - **[Browser History](browser-history)** reads your *existing* Chrome
85
+ passively (research clusters, revisit nudges). It never drives a
86
+ browser.
87
+ - **[Managed Chromium / B-4](managed-chromium)** is the heavily-gated,
88
+ default-off *purchase-confirmation* flow. Browser tasks are the
89
+ general-purpose, non-purchasing actions; a final purchase confirm is
90
+ the one thing they hand off to the B-4 token primitive.
91
+
92
+ ## Starting a Task
93
+
94
+ You don't start a task from this page — you ask in **DM** or `/chat`:
95
+
96
+ > "Send a contact form on Amazon's contact-us page saying my order
97
+ > #123 never arrived."
98
+
99
+ The agent creates the task (`POST /api/browser-task`), opens a tab, and
100
+ works the goal step by step. You can also **schedule** one to run later
101
+ (it appears here when it fires). The page itself is a read + monitor
102
+ surface: filter, search, open a run, or cancel it.
103
+
104
+ ## Reading the Page
105
+
106
+ - **Tasks awaiting you** — a strip pinned to the top that only appears
107
+ when one or more tasks are blocked on your input. It links straight
108
+ to the run that needs you. The same signal drives the nav red-dot and
109
+ the persistent shell banner, so they stay in lock-step.
110
+ - **Filter chips** — narrow by state (`All`, `Active`, or a specific
111
+ state) and by **site**. `Active` means any non-terminal task.
112
+ - **Search** — free-text match over the task description.
113
+ - **Table** — one row per task: state, description (click to open the
114
+ run), site, originating channel, created time, and duration. Active
115
+ rows expose a **Cancel** button.
116
+
117
+ Click any row to open the **run detail** (`/browser-tasks/:id`): the
118
+ step-by-step event log and the **screenshot trace** the sub-agent
119
+ captured along the way.
120
+
121
+ ## Task States
122
+
123
+ A task moves through a small state machine. Non-terminal states are
124
+ still in flight; terminal states are done.
125
+
126
+ | State | Meaning |
127
+ | --- | --- |
128
+ | `pending` | Queued, not started yet. The duration cell shows queue wait and, when known, the site / global queue position. |
129
+ | `running` | The sub-agent is actively driving the tab. |
130
+ | `awaiting_user` | Paused — the agent DMed you a **clarifying question** and is waiting for your answer (`POST /api/browser-task/:id/clarify`). |
131
+ | `final_confirm` | Paused at a **final confirmation** gate (e.g. a submit/checkout step) waiting for your explicit go-ahead. |
132
+ | `completed` | Finished successfully. |
133
+ | `failed` | Stopped on an error; the row shows a short outcome detail. |
134
+ | `cancelled` | You (or the agent) cancelled it. |
135
+ | `timeout` | Exceeded its time budget. |
136
+ | `abandoned` | A pending task expired in the queue before it could start (see `browserTaskPendingQueueTimeoutMinutes`). |
137
+
138
+ When a task is `awaiting_user` or `final_confirm`, **answer in the DM
139
+ the agent sent you** — that is the loop that unblocks it. The dashboard
140
+ strip and banner are just where you notice it.
141
+
142
+ ## Cancelling
143
+
144
+ Active tasks have a **Cancel** button (and `POST
145
+ /api/browser-task/:id/cancel`). Cancelling releases the browser context
146
+ immediately and DMs you a confirmation. Terminal tasks can't be
147
+ cancelled — there is nothing left to stop.
148
+
149
+ ## Safety Model (why it's safe to let it drive)
150
+
151
+ Browser tasks inherit the project's structural browser defences — there
152
+ is **no hardcoded category/brand denylist**:
153
+
154
+ 1. **One sandboxed tab per task.** Tasks don't share a browser context,
155
+ so one task can't read another's session.
156
+ 2. **Allowlist enforcement + hostname denylist.** Navigation is
157
+ constrained; you manage blocked hostnames via
158
+ `browserTaskHostnameDenylist`.
159
+ 3. **IP egress layer (not configurable).** Navigations that resolve to
160
+ private, loopback, link-local, or cloud-metadata addresses are
161
+ denied at the egress chokepoint — defence-in-depth against SSRF.
162
+ 4. **Payment-path block.** A URL-pattern matcher trips at form-submit
163
+ time on payment-handoff paths, so a task can't silently push a
164
+ transaction through. An actual purchase requires the separate,
165
+ default-off [B-4 token flow](managed-chromium).
166
+ 5. **Human-in-the-loop gates.** Anything ambiguous or consequential
167
+ surfaces as `awaiting_user` / `final_confirm` and waits for your DM.
168
+
169
+ See **[Safety and Execution](../../concepts/safety-and-execution)** and
170
+ the **[Safety Model](../../concepts/safety-model)** for the full
171
+ picture.
172
+
173
+ ## Configuration
174
+
175
+ These keys live in the editable config (Settings → Infrastructure):
176
+
177
+ - `browserTaskMaxConcurrent` — how many tasks may run at once; the rest
178
+ queue (`pending`).
179
+ - `browserTaskPendingQueueTimeoutMinutes` — how long a `pending` task
180
+ waits before it is `abandoned`.
181
+ - `browserTaskRespectQuietHours` — when on, tasks defer during your
182
+ quiet hours rather than running overnight.
183
+ - `browserTaskHostnameDenylist` — hostnames a task may never navigate
184
+ to (user-managed; there is no shipped default brand/category list).
@@ -79,6 +79,16 @@ Open **Analytics**. It has two tabs:
79
79
  - **Cost** — per-run USD spend. A period selector switches between
80
80
  **Daily**, **Weekly**, and **Monthly** windows, with summary cards for
81
81
  **Today**, **Last 7 Days**, and **Last 30 Days**. Inside Cost:
82
+ - **Today's Spend Drivers** — answers "what is costing money *right
83
+ now*". **Most Expensive Runs Today** lists the day's costliest runs
84
+ (top 15, most expensive first); click a row for the full per-run
85
+ detail, including the actually-billed model and cache token breakdown.
86
+ Next to it, **By Process Today** shows each process's share of today's
87
+ total, and **Today at a Glance** tracks the day's efficiency: cache
88
+ hit rate, autonomous spend share, failed-run spend (money paid for
89
+ runs that produced no result), average cost per run, and total token
90
+ volume. Everything here uses the agent-day boundary, so the numbers
91
+ reconcile with the **Today** summary card.
82
92
  - **Overview** — a cost-trend chart over the selected period plus a
83
93
  **By Event Type** breakdown (which process keys cost the most).
84
94
  - **By Backend** — totals and a trend chart split by the backend that
@@ -105,7 +115,7 @@ reactive work such as DMs and mentions always runs.
105
115
  - **`autonomousDailyCostCapUsd`** (Autonomous Daily Cost Cap) — when
106
116
  today's autonomous spend reaches the cap, the dispatcher skips
107
117
  lower-priority routines first, using priority-based degradation:
108
- - `hourly_check` — skipped at 100% of the cap
118
+ - `activity_scan` — skipped at 100% of the cap
109
119
  - `roadmap_refresh` — skipped at 120%
110
120
  - `evening_review` — skipped at 150%
111
121
  - `morning_routine` — last to be cut, only at 200%
@@ -48,6 +48,7 @@ related:
48
48
  - concepts/safety-and-execution
49
49
  - reference/disallowed-tools
50
50
  ui_anchors:
51
+ - /browser
51
52
  - /settings/integrations/browser-history-managed
52
53
  - /settings/integrations/browser-history-managed/b4
53
54
  process_keys:
@@ -23,7 +23,7 @@ ask_examples:
23
23
  - How do I limit how often it notifies me?
24
24
  locale: en-US
25
25
  created: 2026-04-25
26
- updated: 2026-05-28
26
+ updated: 2026-06-10
27
27
  keywords:
28
28
  - notification
29
29
  - notify
@@ -74,6 +74,14 @@ by quiet hours and rate limits.
74
74
  4. It is sent to the operator over `primaryPlatform` (or, when set, the
75
75
  exact channels in `defaultNotificationPlatforms`).
76
76
 
77
+ Explicit agent notifications (`POST /api/notify`) ride the same gates
78
+ with one difference: inside quiet hours they are **deferred, not
79
+ dropped** — the full message is queued as a scheduled DM that fires
80
+ when the window ends (visible under Schedule), and repeat sends from
81
+ the same agent overnight coalesce into one combined DM. Outside quiet
82
+ hours the per-hour / per-day caps apply; a capped call is rejected
83
+ (`rate_limited`) rather than silently queued, so the agent can adapt.
84
+
77
85
  ### Safety categories always get through
78
86
 
79
87
  Notifications tagged `security`, `deadline`, `error`, or `critical`
@@ -104,6 +112,8 @@ The agent can also emit a one-off notification via `POST /api/notify`
104
112
  - **A notification you expected never arrived:** check the rate-limit
105
113
  counters (`maxNotificationsPerHour` / `maxNotificationsPerDay`) and the
106
114
  quiet-hours window — a non-safety alert can be suppressed by either.
115
+ Explicit `/api/notify` messages caught by quiet hours are not lost —
116
+ look for a pending scheduled DM under Schedule.
107
117
  Safety-category alerts (`error`/`critical`/`security`/`deadline`) are
108
118
  never suppressed, so a missing one points at delivery/pairing instead.
109
119
  - **Too many notifications:** lower the per-hour / per-day caps or widen
@@ -25,7 +25,7 @@ ask_examples:
25
25
  - Will routines still run during quiet hours?
26
26
  locale: en-US
27
27
  created: 2026-04-25
28
- updated: 2026-06-07
28
+ updated: 2026-06-10
29
29
  keywords:
30
30
  - quiet hours
31
31
  - dnd
@@ -39,7 +39,7 @@ related:
39
39
  - features/routines/morning-routine
40
40
  - concepts/agent-day
41
41
  ui_anchors:
42
- - /settings/schedule
42
+ - /settings/hours
43
43
  config_keys:
44
44
  - quietHoursStart
45
45
  - quietHoursEnd
@@ -65,6 +65,16 @@ the window:
65
65
  notification path, sees that it is quiet hours, and is logged as
66
66
  `suppressed` — it is **dropped, not held**. You will not receive it
67
67
  later.
68
+ - **An explicit agent notification (`POST /api/notify`) is deferred,
69
+ not dropped.** When an agent session calls the notify endpoint inside
70
+ the window, the full message is queued as a scheduled DM that fires
71
+ the moment the window ends (visible under Schedule). Repeat calls
72
+ from the same agent overnight coalesce into one combined DM at the
73
+ edge instead of a morning pile-up. `critical` priority bypasses the
74
+ gate and sends immediately. If you change the quiet-hours window
75
+ while deferred DMs are pending, they are retimed to the new window
76
+ end (or released immediately when the new window no longer covers
77
+ the current time).
68
78
  - **A notification already in a batch queue is deferred, not dropped.**
69
79
  Aitne batches repeat notifications of the same event type within
70
80
  `batchIntervalMinutes`. When a batch is pending and quiet hours are
@@ -82,6 +92,20 @@ the window:
82
92
  defaults — boundary `04`, quiet hours `22:00`→`08:00` — that 04:00 run
83
93
  lands inside quiet hours, so it runs normally but its proactive output
84
94
  is held back or suppressed like any other notification.
95
+ - **A custom Agent can opt its whole run out of the window.** A user
96
+ Agent created with `schedule.defer_in_quiet_hours: true` (the
97
+ "Respect quiet hours" toggle in the New Agent form) does not run
98
+ inside the window at all — the firing itself is pushed to the moment
99
+ quiet hours end, so a DM-producing Agent delivers fresh results right
100
+ at the edge instead of burning a 3 AM session whose message would be
101
+ held anyway. Each deferral is recorded in the action log
102
+ (`agent.task.deferred_for_quiet_hours`). The default is off, so a
103
+ silent file-writing Agent deliberately scheduled overnight stays put.
104
+ Built-in routines never defer. Scheduled browser tasks get the same
105
+ treatment via `browserTaskRespectQuietHours` (default on). Like
106
+ deferred DMs, already-deferred runs are retimed when you change the
107
+ quiet-hours window — shrinking or disabling it releases them at the
108
+ new edge instead of holding them until the old one.
85
109
 
86
110
  ## When It Runs / How It Is Triggered
87
111
 
@@ -93,12 +117,15 @@ timezone) before sending. The window may wrap midnight — the default
93
117
 
94
118
  ## Where in the Dashboard
95
119
 
96
- **Settings → Schedule** holds `quietHoursStart` and `quietHoursEnd`,
97
- shown as a red arc on the same 24-hour ring (dial) as the hourly-check
98
- active window drag the handles to adjust either band. There is **no
99
- overlap validation** quiet hours and the
100
- active window are allowed to overlap, and the morning routine fires
101
- regardless of where the bands sit.
120
+ **Settings → Hours & Notifications** (`/settings/hours`) holds
121
+ `quietHoursStart` and `quietHoursEnd`, shown as a red arc on the same
122
+ 24-hour ring (dial) as the activity-scan active window drag the red
123
+ handles to adjust quiet hours. The active-window band is read-only on
124
+ this page; the activity scan owns its hours, edited from **Agents
125
+ Activity Scan** (`/agents/activity-scan`). There is **no overlap
126
+ validation** — quiet hours and the active window are allowed to
127
+ overlap, and the morning routine fires regardless of where the bands
128
+ sit.
102
129
 
103
130
  ## Configuration
104
131
 
@@ -112,10 +139,12 @@ regardless of where the bands sit.
112
139
 
113
140
  - **You expected an important alert to wake you but nothing came.**
114
141
  Only the safety categories (`security`, `deadline`, `error`,
115
- `critical`) bypass quiet hours. A regular proactive notification that
116
- isn't already batched is dropped, not delayed. If you need real-time
117
- night alerts for, say, a critical mail label, either ensure that path
118
- emits a safety-category notification or disable quiet hours.
142
+ `critical`) bypass quiet hours. A regular routine-output notification
143
+ that isn't already batched is dropped, not delayed (explicit
144
+ `/api/notify` messages are deferred to the window end instead). If
145
+ you need real-time night alerts for, say, a critical mail label,
146
+ either ensure that path emits a safety-category notification or
147
+ disable quiet hours.
119
148
  - **A notification fired after the window ended but feels stale.**
120
149
  Check `batchIntervalMinutes` — a long interval means a deferred batch
121
150
  flush can lag the window end by several minutes. The deferral targets
@@ -72,7 +72,7 @@ integration mode:
72
72
  - **`native` mode** — the daemon does not poll, so it reads
73
73
  `observations` rows instead. These are posted by the agent's
74
74
  native-mode `routine.fetch_window` pre-pass. Because that pre-pass
75
- refreshes on the hourly-check tick (~60-minute cadence), events
75
+ refreshes on the activity-scan tick (~60-minute cadence), events
76
76
  scheduled with less than ~60 minutes of lead time may miss their
77
77
  reminder. Direct mode (5-minute poll) does not have this limit.
78
78
 
@@ -94,7 +94,7 @@ If a reminder you expected never arrived:
94
94
  - Check the integration mode. Reminders fire in `direct`, `delegated`,
95
95
  and `native` modes; only `disabled` mode suppresses them entirely.
96
96
  - In `native` mode, short-notice events (< ~60 min lead time) can be
97
- missed because observations refresh on the hourly-check cadence.
97
+ missed because observations refresh on the activity-scan cadence.
98
98
 
99
99
  ## Related
100
100
 
@@ -0,0 +1,220 @@
1
+ ---
2
+ schema_version: 1
3
+ slug: features/routines/activity-scan
4
+ title: Activity Scan
5
+ id: activity-scan
6
+ aliases:
7
+ - hourly
8
+ - observation consumer
9
+ - activity scan gate
10
+ category: features
11
+ summary: |
12
+ A medium-tier routine that fires every interval (default: every 2
13
+ hours) during active hours,
14
+ drains the pending observations queue, and decides whether the
15
+ accumulated change pattern warrants surfacing. Runs through a
16
+ four-layer gate that keeps quiet days quiet.
17
+ section: routines
18
+ tags:
19
+ - routines
20
+ - autonomous
21
+ - observations
22
+ - polling
23
+ - activity-scan
24
+ status: stable
25
+ ui_anchors:
26
+ - /agents/activity-scan
27
+ - /settings/hours
28
+ - /activity?tab=system
29
+ ask_examples:
30
+ - What does the activity scan do?
31
+ - When does it run?
32
+ - How does the activity scan decide whether to escalate?
33
+ - What is the harvest pre-pass?
34
+ - How do I tune the gate's freshness window?
35
+ locale: en-US
36
+ created: 2026-04-25
37
+ updated: 2026-06-10
38
+ keywords:
39
+ - hourly
40
+ - observations
41
+ - polling
42
+ - activity scan
43
+ - gate
44
+ - layer 1
45
+ - layer 2
46
+ - layer 3
47
+ - harvestForGate
48
+ - decideStage
49
+ - pre-pass
50
+ related:
51
+ - concepts/observations
52
+ - concepts/routines
53
+ - concepts/delegated-mode
54
+ - features/integrations/browser-history
55
+ process_keys:
56
+ - routine.activity_scan
57
+ - routine.activity_scan.triage
58
+ - routine.fetch_window
59
+ config_keys:
60
+ - activityScanEnabled
61
+ - activityScanIntervalMinutes
62
+ - activityScanActiveStartHour
63
+ - activityScanActiveEndHour
64
+ - activityScanMinObservations
65
+ - activityScanStage2Enabled
66
+ - activityScanHeartbeatHours
67
+ - activityScanLowSignalPendingCeiling
68
+ - activityScanPrePassFreshnessMinutes
69
+ ---
70
+
71
+ # Activity Scan
72
+
73
+ A medium-tier routine that drains the observations queue every interval
74
+ during active hours and decides whether the accumulated change
75
+ pattern warrants notifying you or appending to `state/today.md`. The
76
+ "decide" step is a four-layer gate designed to keep quiet days quiet
77
+ without missing the moment when something piles up.
78
+
79
+ ## When It Runs
80
+
81
+ Every **interval minutes** (default 120 — every 2 hours), inside the configured active
82
+ window. Cadence, window, and the enable switch live on the
83
+ activity-scan **agent** — edit them at `/agents/activity-scan`
84
+ (Definition tab → Cadence card; Enable/Disable toggles the routine).
85
+ The legacy `activityScan*` config keys are deprecated fallbacks (see
86
+ [Configuration](#configuration)). The trigger:
87
+
88
+ - **Skips** when the morning routine has not yet run today
89
+ (recoverable — the dispatcher enqueues a `queueMorningRoutineWake`
90
+ self-recovery and the activity scan resumes after the morning
91
+ routine succeeds).
92
+ - **Skips** when another activity scan is in flight (atomic flag).
93
+ - **Skips** when accumulated signal is below the agent's **min
94
+ observations** threshold and the heartbeat window
95
+ (`activityScanHeartbeatHours`) hasn't elapsed.
96
+
97
+ Every tick writes one `agent_actions` row with
98
+ `action_type = 'activity_scan.gate'` so the gate's decisions are
99
+ auditable from `aitne audit` and the dashboard activity feed.
100
+
101
+ ## The Four-Layer Gate
102
+
103
+ The gate replaced the pre-Phase-9 "30-minute rate-limit" gate. It
104
+ runs on every cron tick; only Layer 4 actually spawns a medium-tier
105
+ agent session.
106
+
107
+ ### Layer 1 — Harvest pre-pass
108
+
109
+ `ActivityScanCoordinator.harvestForGate` spawns a lite-tier
110
+ `routine.fetch_window` session for each delegated / native
111
+ integration whose `runtime_state.pre_pass_last_run:<key>` is older
112
+ than `activityScanPrePassFreshnessMinutes`. The pre-pass fetches the
113
+ integration's scan window (mail / calendar / Notion) and POSTs the
114
+ results to `/api/observations`, so the rest of the gate sees a
115
+ populated queue instead of stale data.
116
+
117
+ Telemetry: `agent_actions.detail.harvest_ran` /
118
+ `harvest_integrations` / `harvest_failed_integrations`.
119
+
120
+ ### Layer 2 — Signal compute
121
+
122
+ `computeActivityScanSignals` reads the observation table mode-blind —
123
+ it filters by source-prefix sets derived from
124
+ `INTEGRATION_DESCRIPTORS`, never by `actor`. Signal categories
125
+ include unread-mail / event-change / repo-change / browser-history
126
+ clusters; each category produces a (count, last-seen, summary)
127
+ tuple. The pre-pass freshness gate from Layer 1 is what guarantees
128
+ those counts reflect "now", not "an hour ago".
129
+
130
+ ### Layer 3 — Decide stage
131
+
132
+ `decideStage` is a pure function over the signal snapshot plus the
133
+ per-tick config (heartbeat status, `activityScanStage2Enabled`,
134
+ `activityScanLowSignalPendingCeiling`). It returns one of three stages
135
+ — `stage0_silent`, `stage2`, or `stage3`:
136
+
137
+ | Stage | What happens |
138
+ |---|---|
139
+ | `stage0_silent` | No agent session. Consume the pending observations and append a single best-effort line to `state/today.md`'s `## Agent Log`. This is the verdict for both "no signals" and "low signal under the ceiling". |
140
+ | `stage2` | Only reachable when `activityScanStage2Enabled = true` (default `false`, so low-signal ticks fall through to `stage3`). Runs a lite-tier `routine.activity_scan.triage` call whose strict JSON output decides `log_only` (→ silent path) vs. `escalate` (→ `stage3`). |
141
+ | `stage3` | Spawn the full medium-tier `routine.activity_scan` session — the visible agent run. Reached directly on high-novelty signals (VIP mail, calendar conflict, overdue agent plan, approaching schedule) or as the cautious default when Stage 2 is off. |
142
+
143
+ When a Layer 1 pre-pass fails (`harvest.failed`), the gate
144
+ short-circuits to a cautious `stage3` with reason
145
+ `cautious_escalate_prepass_failure` and tags the audit row
146
+ `agent_actions.detail.cautious_escalate = true` — a failed fetch
147
+ should never silently swallow a tick's worth of signals.
148
+
149
+ ### Layer 4 — Dispatch
150
+
151
+ When Layer 3 returns `stage0_silent` (or Stage 2 returns
152
+ `log_only`), the daemon runs `runSilentActivityScanPath` — a
153
+ daemon-direct write, no agent. When it returns `stage3` (or Stage 2
154
+ returns `escalate`), `enqueueStage3ActivityScan` puts a
155
+ `routine.activity_scan` event on the bus, which becomes the visible
156
+ agent session.
157
+
158
+ ## What It Outputs
159
+
160
+ - A best-effort line in `state/today.md`'s `## Agent Log` — even the
161
+ silent path appends one (skipped only if `today.md` is missing or
162
+ the write lock is held; the observations are still consumed either
163
+ way).
164
+ - Notifications when warranted (only on a `stage3` agent session).
165
+ - An audit row on every tick:
166
+ `agent_actions.action_type = 'activity_scan.gate'`, carrying the
167
+ harvest + signal + stage detail.
168
+
169
+ ## Configuration
170
+
171
+ The cadence, active window, min-observations threshold, and on/off
172
+ switch are owned by the activity-scan agent: edit them at
173
+ `/agents/activity-scan` (Definition tab → Cadence card;
174
+ Enable/Disable for the switch). The matching `activityScan*` config
175
+ keys below are **deprecated fallbacks** — still accepted by
176
+ `PATCH /api/config` but no longer surfaced in the dashboard; values
177
+ resolve agent override → legacy config key → built-in default.
178
+
179
+ | Setting | Default | Layer | Notes |
180
+ |---|---|---|---|
181
+ | Enable/Disable (`/agents/activity-scan`) | enabled | trigger | Master switch — the agent's `enabled` flag. Legacy key `activityScanEnabled` (deprecated fallback). |
182
+ | Interval minutes | `120` | trigger | Cron cadence. Cadence card. Legacy key `activityScanIntervalMinutes` (deprecated fallback). |
183
+ | Active start hour | `4` | trigger | Active window start. Cadence card. Legacy key `activityScanActiveStartHour` (deprecated fallback). |
184
+ | Active end hour | `24` | trigger | End-exclusive; `24` ≡ midnight. Cadence card. Legacy key `activityScanActiveEndHour` (deprecated fallback). |
185
+ | Min observations | `1` | trigger | Minimum pending observations before a non-silent stage dispatches; below this the tick records a `below_threshold` skip. Cadence card. Legacy key `activityScanMinObservations` (deprecated fallback). |
186
+ | `activityScanPrePassFreshnessMinutes` | `30` | Layer 1 | Range `0`–`480`. Skip a per-integration fetch if its pre-pass ran more recently; `0` fetches every tick, `480` is cost-minimal. |
187
+ | `activityScanStage2Enabled` | `false` | Layer 3 | Adds the lite-tier triage call; while `false`, low-signal ticks route straight to `stage3`. |
188
+ | `activityScanHeartbeatHours` | `4` | Layer 3 | Range `1`–`48`. Force a non-silent stage at least this often, even on a quiet day. |
189
+ | `activityScanLowSignalPendingCeiling` | `0` | Layer 3 | Range `0`–`20`. At or below this pending count, a low-signal tick stays silent. `0` keeps the cautious default (any pending observation escalates). |
190
+
191
+ (The agent was named "Hourly Check" until v0.1.11 — old `hourlyCheck*`
192
+ config keys and the `/api/agents/hourly-check` URL are still accepted
193
+ for one deprecation window. `hourlyCheckGateMode` was removed in
194
+ HOURLY_CHECK_GATE_REDESIGN_PLAN
195
+ Phase 4 — the gate has a single execution path now.)
196
+
197
+ ## When Something Goes Wrong
198
+
199
+ - **Skipped because the morning routine hasn't run.** The
200
+ dispatcher's `morningRoutineRanToday` gate keys on
201
+ `agent_actions.result = 'success'`. The skip reason is
202
+ `morning_routine_pending_for_today` and triggers a
203
+ `queueMorningRoutineWake` self-recovery. See
204
+ [Morning Routine Didn't Run](../../troubleshooting/morning-routine-didnt-run.md).
205
+ - **Stage 3 never fires on a quiet day.** Expected.
206
+ `activityScanHeartbeatHours` forces a tick occasionally so silence
207
+ doesn't last indefinitely.
208
+ - **Pre-pass keeps failing for one integration.** Read
209
+ `agent_actions.detail.harvest_failed_integrations`; the failing
210
+ integration name is recorded. Usually an auth issue — check
211
+ `/health.integrationModes` and the integration's settings page.
212
+
213
+ ## Related
214
+
215
+ - [Observations](../../concepts/observations.md) — what populates the
216
+ queue Layer 2 reads.
217
+ - [Delegated Mode](../../concepts/delegated-mode.md) — the
218
+ delegated / native integrations that participate in Layer 1's
219
+ harvest.
220
+ - [Routines](../../concepts/routines.md)