agent-steward 0.0.1 → 0.0.3

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 (345) hide show
  1. package/CHANGELOG.md +399 -0
  2. package/CROSS_PLATFORM.md +151 -0
  3. package/README.md +307 -15
  4. package/ROADMAP-STRATEGY.md +196 -0
  5. package/ROADMAP.md +184 -0
  6. package/dist/core/analytics.d.ts +132 -0
  7. package/dist/core/analytics.d.ts.map +1 -0
  8. package/dist/core/analytics.js +290 -0
  9. package/dist/core/audit.d.ts +96 -0
  10. package/dist/core/audit.d.ts.map +1 -0
  11. package/dist/core/audit.js +297 -0
  12. package/dist/core/cron-to-schtasks.d.ts +12 -0
  13. package/dist/core/cron-to-schtasks.d.ts.map +1 -0
  14. package/dist/core/cron-to-schtasks.js +175 -0
  15. package/dist/core/dry-run.d.ts +102 -0
  16. package/dist/core/dry-run.d.ts.map +1 -0
  17. package/dist/core/dry-run.js +447 -0
  18. package/dist/core/file-watcher.d.ts +31 -0
  19. package/dist/core/file-watcher.d.ts.map +1 -0
  20. package/dist/core/file-watcher.js +186 -0
  21. package/dist/core/git-trigger.d.ts +82 -0
  22. package/dist/core/git-trigger.d.ts.map +1 -0
  23. package/dist/core/git-trigger.js +312 -0
  24. package/dist/core/glob.d.ts +38 -0
  25. package/dist/core/glob.d.ts.map +1 -0
  26. package/dist/core/glob.js +233 -0
  27. package/dist/core/local-ai.d.ts +52 -0
  28. package/dist/core/local-ai.d.ts.map +1 -0
  29. package/dist/core/local-ai.js +119 -0
  30. package/dist/core/lock.d.ts +57 -0
  31. package/dist/core/lock.d.ts.map +1 -0
  32. package/dist/core/lock.js +193 -0
  33. package/dist/core/matrix.d.ts +167 -0
  34. package/dist/core/matrix.d.ts.map +1 -0
  35. package/dist/core/matrix.js +724 -0
  36. package/dist/core/native-notify.d.ts +36 -0
  37. package/dist/core/native-notify.d.ts.map +1 -0
  38. package/dist/core/native-notify.js +113 -0
  39. package/dist/core/one-shot.d.ts +90 -0
  40. package/dist/core/one-shot.d.ts.map +1 -0
  41. package/dist/core/one-shot.js +182 -0
  42. package/dist/core/otel.d.ts +4 -0
  43. package/dist/core/otel.d.ts.map +1 -0
  44. package/dist/core/otel.js +98 -0
  45. package/dist/core/permissions.d.ts +69 -0
  46. package/dist/core/permissions.d.ts.map +1 -0
  47. package/dist/core/permissions.js +143 -0
  48. package/dist/core/prometheus.d.ts +23 -0
  49. package/dist/core/prometheus.d.ts.map +1 -0
  50. package/dist/core/prometheus.js +146 -0
  51. package/dist/core/ps-wrapper.d.ts +73 -0
  52. package/dist/core/ps-wrapper.d.ts.map +1 -0
  53. package/dist/core/ps-wrapper.js +1091 -0
  54. package/dist/core/record-history.d.ts +25 -0
  55. package/dist/core/record-history.d.ts.map +1 -0
  56. package/dist/core/record-history.js +471 -0
  57. package/dist/core/retention.d.ts +29 -0
  58. package/dist/core/retention.d.ts.map +1 -0
  59. package/dist/core/retention.js +98 -0
  60. package/dist/core/savings.d.ts +70 -0
  61. package/dist/core/savings.d.ts.map +1 -0
  62. package/dist/core/savings.js +87 -0
  63. package/dist/core/schedule-gate.d.ts +2 -0
  64. package/dist/core/schedule-gate.d.ts.map +1 -0
  65. package/dist/core/schedule-gate.js +211 -0
  66. package/dist/core/schedule-v2.d.ts +116 -0
  67. package/dist/core/schedule-v2.d.ts.map +1 -0
  68. package/dist/core/schedule-v2.js +586 -0
  69. package/dist/core/scheduler/at-fallback.d.ts +42 -0
  70. package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
  71. package/dist/core/scheduler/at-fallback.js +70 -0
  72. package/dist/core/scheduler/index.d.ts +32 -0
  73. package/dist/core/scheduler/index.d.ts.map +1 -0
  74. package/dist/core/scheduler/index.js +63 -0
  75. package/dist/core/scheduler/linux.d.ts +46 -0
  76. package/dist/core/scheduler/linux.d.ts.map +1 -0
  77. package/dist/core/scheduler/linux.js +261 -0
  78. package/dist/core/scheduler/logs.d.ts +11 -0
  79. package/dist/core/scheduler/logs.d.ts.map +1 -0
  80. package/dist/core/scheduler/logs.js +34 -0
  81. package/dist/core/scheduler/mac.d.ts +46 -0
  82. package/dist/core/scheduler/mac.d.ts.map +1 -0
  83. package/dist/core/scheduler/mac.js +256 -0
  84. package/dist/core/scheduler/posix.d.ts +40 -0
  85. package/dist/core/scheduler/posix.d.ts.map +1 -0
  86. package/dist/core/scheduler/posix.js +100 -0
  87. package/dist/core/scheduler/registry.d.ts +43 -0
  88. package/dist/core/scheduler/registry.d.ts.map +1 -0
  89. package/dist/core/scheduler/registry.js +57 -0
  90. package/dist/core/scheduler/types.d.ts +86 -0
  91. package/dist/core/scheduler/types.d.ts.map +1 -0
  92. package/dist/core/scheduler/types.js +1 -0
  93. package/dist/core/scheduler/windows.d.ts +112 -0
  94. package/dist/core/scheduler/windows.d.ts.map +1 -0
  95. package/dist/core/scheduler/windows.js +749 -0
  96. package/dist/core/secrets.d.ts +66 -0
  97. package/dist/core/secrets.d.ts.map +1 -0
  98. package/dist/core/secrets.js +433 -0
  99. package/dist/core/self-analysis.d.ts +117 -0
  100. package/dist/core/self-analysis.d.ts.map +1 -0
  101. package/dist/core/self-analysis.js +539 -0
  102. package/dist/core/session.d.ts +42 -0
  103. package/dist/core/session.d.ts.map +1 -0
  104. package/dist/core/session.js +134 -0
  105. package/dist/core/shutdown.d.ts +26 -0
  106. package/dist/core/shutdown.d.ts.map +1 -0
  107. package/dist/core/shutdown.js +49 -0
  108. package/dist/core/structured-log.d.ts +84 -0
  109. package/dist/core/structured-log.d.ts.map +1 -0
  110. package/dist/core/structured-log.js +146 -0
  111. package/dist/core/summary.d.ts +69 -0
  112. package/dist/core/summary.d.ts.map +1 -0
  113. package/dist/core/summary.js +250 -0
  114. package/dist/core/telegram.d.ts +55 -0
  115. package/dist/core/telegram.d.ts.map +1 -0
  116. package/dist/core/telegram.js +344 -0
  117. package/dist/core/triage-chain.d.ts +40 -0
  118. package/dist/core/triage-chain.d.ts.map +1 -0
  119. package/dist/core/triage-chain.js +80 -0
  120. package/dist/core/triage-compare.d.ts +68 -0
  121. package/dist/core/triage-compare.d.ts.map +1 -0
  122. package/dist/core/triage-compare.js +184 -0
  123. package/dist/core/triage-rules.d.ts +23 -0
  124. package/dist/core/triage-rules.d.ts.map +1 -0
  125. package/dist/core/triage-rules.js +196 -0
  126. package/dist/core/triage-shadow.d.ts +91 -0
  127. package/dist/core/triage-shadow.d.ts.map +1 -0
  128. package/dist/core/triage-shadow.js +160 -0
  129. package/dist/core/triage-worker.d.ts +55 -0
  130. package/dist/core/triage-worker.d.ts.map +1 -0
  131. package/dist/core/triage-worker.js +314 -0
  132. package/dist/core/triage.d.ts +76 -0
  133. package/dist/core/triage.d.ts.map +1 -0
  134. package/dist/core/triage.js +271 -0
  135. package/dist/core/watch-paths.d.ts +6 -0
  136. package/dist/core/watch-paths.d.ts.map +1 -0
  137. package/dist/core/watch-paths.js +62 -0
  138. package/dist/core/wrappers/bash.d.ts +95 -0
  139. package/dist/core/wrappers/bash.d.ts.map +1 -0
  140. package/dist/core/wrappers/bash.js +413 -0
  141. package/dist/db/git-state-repo.d.ts +16 -0
  142. package/dist/db/git-state-repo.d.ts.map +1 -0
  143. package/dist/db/git-state-repo.js +38 -0
  144. package/dist/db/history-repo.d.ts +110 -0
  145. package/dist/db/history-repo.d.ts.map +1 -0
  146. package/dist/db/history-repo.js +300 -0
  147. package/dist/db/index.d.ts +49 -0
  148. package/dist/db/index.d.ts.map +1 -0
  149. package/dist/db/index.js +128 -0
  150. package/dist/db/metrics-repo.d.ts +46 -0
  151. package/dist/db/metrics-repo.d.ts.map +1 -0
  152. package/dist/db/metrics-repo.js +103 -0
  153. package/dist/db/migrate.d.ts +24 -0
  154. package/dist/db/migrate.d.ts.map +1 -0
  155. package/dist/db/migrate.js +244 -0
  156. package/dist/db/recovery.d.ts +11 -0
  157. package/dist/db/recovery.d.ts.map +1 -0
  158. package/dist/db/recovery.js +38 -0
  159. package/dist/db/run-journal.d.ts +60 -0
  160. package/dist/db/run-journal.d.ts.map +1 -0
  161. package/dist/db/run-journal.js +143 -0
  162. package/dist/db/run-resume.d.ts +48 -0
  163. package/dist/db/run-resume.d.ts.map +1 -0
  164. package/dist/db/run-resume.js +137 -0
  165. package/dist/db/runs-repo.d.ts +120 -0
  166. package/dist/db/runs-repo.d.ts.map +1 -0
  167. package/dist/db/runs-repo.js +319 -0
  168. package/dist/db/schema.d.ts +38 -0
  169. package/dist/db/schema.d.ts.map +1 -0
  170. package/dist/db/schema.js +325 -0
  171. package/dist/db/settings-repo.d.ts +8 -0
  172. package/dist/db/settings-repo.d.ts.map +1 -0
  173. package/dist/db/settings-repo.js +27 -0
  174. package/dist/db/tasks-repo.d.ts +26 -0
  175. package/dist/db/tasks-repo.d.ts.map +1 -0
  176. package/dist/db/tasks-repo.js +120 -0
  177. package/dist/db/templates-repo.d.ts +17 -0
  178. package/dist/db/templates-repo.d.ts.map +1 -0
  179. package/dist/db/templates-repo.js +57 -0
  180. package/dist/history.d.ts +60 -0
  181. package/dist/history.d.ts.map +1 -0
  182. package/dist/history.js +70 -0
  183. package/dist/i18n.d.ts +75 -0
  184. package/dist/i18n.d.ts.map +1 -0
  185. package/dist/i18n.js +357 -0
  186. package/dist/index.d.ts +858 -0
  187. package/dist/index.d.ts.map +1 -0
  188. package/dist/index.js +5209 -0
  189. package/dist/integrations.d.ts +72 -0
  190. package/dist/integrations.d.ts.map +1 -0
  191. package/dist/integrations.js +233 -0
  192. package/dist/notifications.d.ts +199 -0
  193. package/dist/notifications.d.ts.map +1 -0
  194. package/dist/notifications.js +967 -0
  195. package/dist/profiles.d.ts +64 -0
  196. package/dist/profiles.d.ts.map +1 -0
  197. package/dist/profiles.js +305 -0
  198. package/dist/rpc.d.ts +3915 -0
  199. package/dist/rpc.d.ts.map +1 -0
  200. package/dist/rpc.js +1596 -0
  201. package/dist/schtasks.d.ts +32 -0
  202. package/dist/schtasks.d.ts.map +1 -0
  203. package/dist/schtasks.js +45 -0
  204. package/dist/server.d.ts +128 -0
  205. package/dist/server.d.ts.map +1 -0
  206. package/dist/server.js +2414 -0
  207. package/dist/settings.d.ts +389 -0
  208. package/dist/settings.d.ts.map +1 -0
  209. package/dist/settings.js +770 -0
  210. package/dist/shared/jobs-view.d.ts +59 -0
  211. package/dist/shared/jobs-view.d.ts.map +1 -0
  212. package/dist/shared/jobs-view.js +146 -0
  213. package/dist/skill.d.ts +15 -0
  214. package/dist/skill.d.ts.map +1 -0
  215. package/dist/skill.js +93 -0
  216. package/dist/task-transfer.d.ts +252 -0
  217. package/dist/task-transfer.d.ts.map +1 -0
  218. package/dist/task-transfer.js +632 -0
  219. package/dist/templates.d.ts +57 -0
  220. package/dist/templates.d.ts.map +1 -0
  221. package/dist/templates.js +16 -0
  222. package/dist/types.d.ts +112 -0
  223. package/dist/types.d.ts.map +1 -0
  224. package/dist/types.js +158 -0
  225. package/dist/version.d.ts +8 -0
  226. package/dist/version.d.ts.map +1 -0
  227. package/dist/version.js +27 -0
  228. package/dist/workspaces.d.ts +113 -0
  229. package/dist/workspaces.d.ts.map +1 -0
  230. package/dist/workspaces.js +393 -0
  231. package/docs/ARCHITECTURE.md +559 -0
  232. package/docs/COMPATIBILITY.md +237 -0
  233. package/docs/CONCEPT.md +242 -0
  234. package/docs/CROSS_PLATFORM.ru.md +152 -0
  235. package/docs/CROSS_PLATFORM.zh.md +148 -0
  236. package/docs/FAQ.md +52 -0
  237. package/docs/FAQ.ru.md +53 -0
  238. package/docs/FAQ.zh.md +43 -0
  239. package/docs/FEATURES.md +699 -0
  240. package/docs/FEATURES.zh.md +656 -0
  241. package/docs/LOCAL-AI.md +300 -0
  242. package/docs/MIGRATION.md +363 -0
  243. package/docs/README.ru.md +287 -0
  244. package/docs/README.zh.md +306 -0
  245. package/docs/SAVINGS.md +61 -0
  246. package/docs/SAVINGS.ru.md +60 -0
  247. package/docs/SAVINGS.zh.md +52 -0
  248. package/docs/V1-V2-COMPATIBILITY-PLAN.md +366 -0
  249. package/docs/ZH-LOCALE-PLAN.md +324 -0
  250. package/docs/dashboard.png +0 -0
  251. package/docs/spikes/local-model-structured-output.md +81 -0
  252. package/docs/spikes/ollama-qwen3-4b-smoke.json +28 -0
  253. package/docs/spikes/ollama-qwen3-4b.json +163 -0
  254. package/gui-experimental.cjs +9 -0
  255. package/index.js +2 -0
  256. package/locales/en.json +781 -0
  257. package/locales/ru.json +781 -0
  258. package/locales/zh.json +781 -0
  259. package/package.json +154 -13
  260. package/scripts/bench-local.mjs +321 -0
  261. package/scripts/check-zh-locale.mjs +218 -0
  262. package/scripts/demo-dashboard.mjs +209 -0
  263. package/scripts/run-tests.mjs +236 -0
  264. package/scripts/spike-local-structured.mjs +182 -0
  265. package/scripts/test-locale.mjs +45 -0
  266. package/skills/scheduled-job-best-practices/SKILL.md +158 -0
  267. package/skills/scheduled-job-best-practices/references/recipes.md +163 -0
  268. package/src/core/analytics.ts +424 -0
  269. package/src/core/audit.ts +418 -0
  270. package/src/core/cron-to-schtasks.ts +209 -0
  271. package/src/core/dry-run.ts +601 -0
  272. package/src/core/file-watcher.ts +245 -0
  273. package/src/core/git-trigger.ts +391 -0
  274. package/src/core/glob.ts +226 -0
  275. package/src/core/local-ai.ts +173 -0
  276. package/src/core/lock.ts +219 -0
  277. package/src/core/matrix.ts +947 -0
  278. package/src/core/native-notify.ts +157 -0
  279. package/src/core/one-shot.ts +239 -0
  280. package/src/core/otel.ts +128 -0
  281. package/src/core/permissions.ts +200 -0
  282. package/src/core/prometheus.ts +215 -0
  283. package/src/core/ps-wrapper.ts +1160 -0
  284. package/src/core/record-history.ts +615 -0
  285. package/src/core/retention.ts +141 -0
  286. package/src/core/savings.ts +150 -0
  287. package/src/core/schedule-gate.ts +253 -0
  288. package/src/core/schedule-v2.ts +668 -0
  289. package/src/core/scheduler/at-fallback.ts +113 -0
  290. package/src/core/scheduler/index.ts +82 -0
  291. package/src/core/scheduler/linux.ts +308 -0
  292. package/src/core/scheduler/logs.ts +37 -0
  293. package/src/core/scheduler/mac.ts +322 -0
  294. package/src/core/scheduler/posix.ts +128 -0
  295. package/src/core/scheduler/registry.ts +101 -0
  296. package/src/core/scheduler/types.ts +90 -0
  297. package/src/core/scheduler/windows.ts +881 -0
  298. package/src/core/secrets.ts +503 -0
  299. package/src/core/self-analysis.ts +744 -0
  300. package/src/core/session.ts +150 -0
  301. package/src/core/shutdown.ts +69 -0
  302. package/src/core/structured-log.ts +214 -0
  303. package/src/core/summary.ts +318 -0
  304. package/src/core/telegram.ts +436 -0
  305. package/src/core/triage-chain.ts +125 -0
  306. package/src/core/triage-compare.ts +277 -0
  307. package/src/core/triage-rules.ts +238 -0
  308. package/src/core/triage-shadow.ts +240 -0
  309. package/src/core/triage-worker.ts +344 -0
  310. package/src/core/triage.ts +366 -0
  311. package/src/core/watch-paths.ts +70 -0
  312. package/src/core/wrappers/bash.ts +532 -0
  313. package/src/db/git-state-repo.ts +62 -0
  314. package/src/db/history-repo.ts +492 -0
  315. package/src/db/index.ts +176 -0
  316. package/src/db/metrics-repo.ts +170 -0
  317. package/src/db/migrate.ts +328 -0
  318. package/src/db/recovery.ts +46 -0
  319. package/src/db/run-journal.ts +212 -0
  320. package/src/db/run-resume.ts +220 -0
  321. package/src/db/runs-repo.ts +481 -0
  322. package/src/db/schema.ts +349 -0
  323. package/src/db/settings-repo.ts +31 -0
  324. package/src/db/tasks-repo.ts +162 -0
  325. package/src/db/templates-repo.ts +77 -0
  326. package/src/gui.tsx +5222 -0
  327. package/src/history.ts +128 -0
  328. package/src/i18n.ts +413 -0
  329. package/src/index.ts +6642 -0
  330. package/src/integrations.ts +297 -0
  331. package/src/notifications.ts +1346 -0
  332. package/src/profiles.ts +345 -0
  333. package/src/rpc.ts +1704 -0
  334. package/src/schtasks.ts +75 -0
  335. package/src/server.ts +2663 -0
  336. package/src/settings.ts +1369 -0
  337. package/src/shared/jobs-view.ts +188 -0
  338. package/src/skill.ts +113 -0
  339. package/src/task-transfer.ts +946 -0
  340. package/src/templates.ts +67 -0
  341. package/src/tui-v1.tsx +341 -0
  342. package/src/tui.tsx +329 -0
  343. package/src/types.ts +226 -0
  344. package/src/version.ts +27 -0
  345. package/src/workspaces.ts +487 -0
@@ -0,0 +1,300 @@
1
+ # Local assistant (triage)
2
+
3
+ The local assistant is an optional, fully offline classifier for run outcomes.
4
+ After a run finishes, the scheduler can ask a local model to classify the
5
+ outcome (quality, timeout, permission, network, unknown) and write the verdict
6
+ to the triage audit. It is **opt-in**: when no model is available the scheduler
7
+ keeps working exactly as before and notifications are never blocked.
8
+
9
+ Triage is not a scheduler feature by itself — it only affects notifications. It
10
+ never changes run status, retries, Quality Gates, DAG dependencies or history.
11
+
12
+ ## How it works
13
+
14
+ ```
15
+ run finished ──► triage chain ──► notify / skip / log-only (shadow)
16
+ │
17
+ ├─ llm — local model classifies the failure
18
+ └─ rules - built-in patterns (timeout, permission, network, quality, cost, task)
19
+ ```
20
+
21
+ - `off` — no triage; every notification is sent (default).
22
+ - `rules` — built-in rules only. No model, no network calls.
23
+ - `llm` — the configured local model only.
24
+ - `auto` — the model first, then the rules engine (recommended).
25
+
26
+ Rules semantics: if `rules` is omitted (`undefined`), the built-in rule set is
27
+ active. An explicit empty array (`rules: []`) disables the rules engine entirely.
28
+ A non-empty custom array replaces the built-in set; it does not extend it.
29
+
30
+ ### Built-in rules
31
+
32
+ The built-in set classifies errors by text, status, cost and task name. All
33
+ built-in rules are notify-only: they never suppress a notification.
34
+
35
+ | Rule | Match | Severity |
36
+ | --- | --- | --- |
37
+ | `error-timeout` | timeout / deadline in the error text | high |
38
+ | `error-permission` | permission denied, access denied, forbidden | high |
39
+ | `error-network` | connection refused/reset, DNS, network error | high |
40
+ | `error-quality` | Quality Gate, failed tests, failed build, lint | high |
41
+ | `cost-high` | `costUsd >= 1` | high |
42
+ | `task-important` | task name contains deploy, release, publish, production, backup, restore or migration | high |
43
+ | `status-error` | status is `error` | high |
44
+ | `status-partial` | status is `partial` | medium |
45
+ | `status-success` | status is `success` | low |
46
+
47
+ A custom array replaces the built-in set. For example, this configuration
48
+ suppresses noisy nightly runs and marks runs costing $5 or more as high:
49
+
50
+ ```json
51
+ "notifications": {
52
+ "triage": {
53
+ "mode": "rules",
54
+ "rules": [
55
+ { "id": "skip-nightly", "field": "task", "operator": "contains", "value": "nightly", "action": "skip", "priority": 50 },
56
+ { "id": "expensive", "field": "cost", "operator": "gte", "value": 5, "severity": "high", "priority": 90 }
57
+ ]
58
+ }
59
+ }
60
+ ```
61
+
62
+ The result is validated against a fixed JSON schema. Invalid JSON, an
63
+ unreachable endpoint, a timeout or low confidence all fall back to the rules
64
+ engine (fail-open). With `fallback: "notify"` the scheduler skips the rules step
65
+ and delivers the notification instead. The legacy name `"skip"` is still
66
+ accepted and normalized to `"notify"`.
67
+
68
+ The model only **classifies** a run: a valid verdict never suppresses a
69
+ notification on its own. Only a matching rule with `action: "skip"` can
70
+ suppress delivery. This is intentional: an uncertain small model must not be
71
+ able to hide a real failure.
72
+
73
+ ## Delivery latency (async triage)
74
+
75
+ In `llm` and `auto` modes triage runs asynchronously. `record-history` delivers
76
+ the notification immediately and starts a detached worker for the model call;
77
+ the worker writes the verdict to `audit_log` with `async: true`. The configured
78
+ `timeoutMs` applies to that background request, not to delivery: a cold model
79
+ that takes 40 seconds cannot delay the webhook, chain triggers or the task lock.
80
+
81
+ Only `rules` mode triages synchronously, because rules are the only thing that
82
+ can suppress a notification. In `llm`/`auto` the model and its rules fallback
83
+ are advisory: the notification is already sent, so `action: "skip"` in the
84
+ audit means “would have been skipped”, not “was suppressed”. Use `rules` mode
85
+ if rules must actually suppress delivery. The GUI shows this warning when a
86
+ model mode is selected.
87
+
88
+ In shadow mode the worker records `shadow: true` and `suppressed: false`, so a
89
+ shadow report remains a safe preview of triage decisions.
90
+
91
+ ## Requirements
92
+
93
+ - [Ollama](https://ollama.com/) running locally, or any OpenAI-compatible
94
+ server (a `baseUrl` ending with `/v1` switches to the OpenAI protocol).
95
+ - One pulled model, for example `qwen3:4b`.
96
+ - No internet access is required after the model is downloaded.
97
+
98
+ ```bash
99
+ ollama serve
100
+ ollama pull qwen3:4b
101
+ ```
102
+
103
+ ## Configuration
104
+
105
+ Triage settings live under `notifications.triage` and are edited from the GUI
106
+ side panel ("Local assistant") or through the `manage_local_ai` agent tool.
107
+
108
+ The panel shows a persistent connection status next to **Test connection**:
109
+ grey means "not checked", amber "checking", green "connected", red "no
110
+ connection" with the provider error. The test sends one synthetic
111
+ classification request (it is not saved) and reports the model, protocol and
112
+ latency. Status resets when `mode`, `baseUrl` or `model` changes, so a stale
113
+ green cannot hide a new endpoint. A red status never blocks notifications:
114
+ `llm`/`auto` triage is asynchronous and fail-open.
115
+
116
+ | Setting | Values | Default | Meaning |
117
+ | --- | --- | --- | --- |
118
+ | `mode` | `off` / `rules` / `llm` / `auto` | `off` | Triage strategy. |
119
+ | `baseUrl` | URL | `http://127.0.0.1:11434` | Ollama or OpenAI-compatible endpoint. |
120
+ | `model` | string | `""` | Model id, for example `qwen3:4b`. |
121
+ | `timeoutMs` | 1000..120000 | `60000` | Background request timeout in `llm`/`auto`; does not delay delivery. |
122
+ | `fallback` | `rules` / `notify` | `rules` | Behaviour when the model fails or is unsure. |
123
+ | `confidenceThreshold` | 0..1 | `0.6` | Minimum model confidence; below it the fallback applies. |
124
+ | `shadow.enabled` | boolean | `true` | Log decisions without suppressing notifications. |
125
+ | `shadow.days` | 1..365 | `14` | Shadow period length. |
126
+ | `shadow.startedAt` | ISO string / null | `null` | Start of the shadow period; `null` restarts it. |
127
+
128
+ `fallback: "skip"` is accepted as a legacy alias for `notify` and is normalized
129
+ on load, so old settings keep working without edits.
130
+
131
+ ## Message summaries
132
+
133
+ `notifications.summary` turns a notification into at most three short lines for
134
+ Telegram and OS toasts. The same Ollama/OpenAI-compatible provider is used, but
135
+ the request is independent of triage and has its own timeout.
136
+
137
+ | Setting | Values | Default | Meaning |
138
+ | --- | --- | --- | --- |
139
+ | `summary.enabled` | boolean | `false` | Use the model summary instead of the template message. |
140
+ | `summary.maxLines` | 1..3 | `3` | Maximum number of lines. |
141
+ | `summary.maxCharsPerLine` | 20..500 | `120` | Hard cut per line. |
142
+ | `summary.timeoutMs` | 1000..120000 | `8000` | Summary request timeout. |
143
+
144
+ The model must answer with strict JSON `{"lines": ["...", "..."]}`. Any
145
+ failure — no provider, HTTP error, timeout, invalid JSON or schema — falls back
146
+ to a deterministic truncation: status and task name, the error text, then
147
+ runtime, tokens and cost. A summary never blocks or drops the notification:
148
+ delivery waits at most `timeoutMs`.
149
+
150
+ ## Managing triage from the agent
151
+
152
+ The `manage_local_ai` tool has three actions.
153
+
154
+ Read the current state:
155
+
156
+ ```json
157
+ { "action": "get" }
158
+ ```
159
+
160
+ Update one or more fields (merged with the current settings):
161
+
162
+ ```json
163
+ {
164
+ "action": "update",
165
+ "mode": "auto",
166
+ "baseUrl": "http://127.0.0.1:11434",
167
+ "model": "qwen3:4b",
168
+ "timeoutMs": 60000,
169
+ "fallback": "rules",
170
+ "confidenceThreshold": 0.6,
171
+ "shadow": { "enabled": true, "days": 14 }
172
+ }
173
+ ```
174
+
175
+ Send one classification request against the configured model (or a candidate
176
+ patch without saving it):
177
+
178
+ ```json
179
+ { "action": "test", "model": "qwen3:4b", "timeoutMs": 60000 }
180
+ ```
181
+
182
+ `get` and `update` return a summary: `mode`, `baseUrl`, `model`, `timeoutMs`,
183
+ `fallback`, `confidenceThreshold`, `rules` (number of active rules or `null`),
184
+ `shadow`, `llmReady`, `shadowActive` and `protocol` (`ollama` or `openai`).
185
+
186
+ ## Picking a model by RAM
187
+
188
+ The classifier is a small, structured task: a 4B model is usually enough. The
189
+ benchmark below prints a tier for the current machine.
190
+
191
+ | RAM | Tier | Recommended model | Notes |
192
+ | --- | --- | --- | --- |
193
+ | < 8 GB | rules-only | `qwen3:0.6b` | Prefer `mode: "rules"`; a tiny model may be too slow. |
194
+ | 8–15 GB | light | `qwen3:1.7b` | Fast, lower accuracy. |
195
+ | 15–30 GB | balanced | `qwen3:4b` | Recommended default. |
196
+ | > 30 GB | max | `qwen3:8b` | Better accuracy, more latency. |
197
+
198
+ ## Benchmarking a machine
199
+
200
+ `scripts/bench-local.mjs` measures latency, schema validity and throughput
201
+ (tokens/s) for the configured model. It reuses the same triage prompt and JSON
202
+ schema as the scheduler.
203
+
204
+ ```bash
205
+ npm run bench:local -- --model qwen3:4b --runs 3
206
+ npm run bench:local -- --model qwen3:4b --runs 5 --out bench.json
207
+ ```
208
+
209
+ Options: `--base-url`, `--model`, `--runs` (1..50), `--timeout` (1000..600000),
210
+ `--out`, `--help`.
211
+
212
+ The report is a versioned JSON envelope (`schemaVersion: "1"`) suitable for
213
+ crowdsourcing results:
214
+
215
+ ```json
216
+ {
217
+ "schemaVersion": "1",
218
+ "generatedAt": "2026-11-15T12:00:00.000Z",
219
+ "available": true,
220
+ "machine": { "platform": "win32", "arch": "x64", "cpu": "…", "cpuCount": 16, "ramGb": 15.9, "nodeVersion": "v24.21.0" },
221
+ "tier": { "id": "balanced", "recommendedModel": "qwen3:4b", "reason": "…" },
222
+ "model": "qwen3:4b",
223
+ "runs": 3,
224
+ "metrics": {
225
+ "schemaValid": 3,
226
+ "schemaValidRate": 1,
227
+ "jsonValid": 3,
228
+ "jsonValidRate": 1,
229
+ "avgLatencyMs": 23785,
230
+ "p95LatencyMs": 26904,
231
+ "avgTokPerSec": 28.7,
232
+ "p95TokPerSec": 28.98
233
+ },
234
+ "results": []
235
+ }
236
+ ```
237
+
238
+ Exit codes: `0` when at least 70% of responses are schema-valid, `1` otherwise,
239
+ `2` when the endpoint or model is unavailable (the JSON report is still written
240
+ with `available: false`).
241
+
242
+ ## Shadow mode
243
+
244
+ Shadow mode is the safe way to evaluate triage. Decisions are written to the
245
+ persistent audit journal (`audit_log`, action `triage.decision`), but no
246
+ notification is suppressed. In `llm`/`auto` the verdict arrives asynchronously
247
+ after delivery; in `rules` mode it is computed before delivery. Check the shadow
248
+ report before switching to `mode: "auto"`: it shows how many notifications
249
+ would have been skipped and whether any of those were false positives.
250
+
251
+ The journal survives restarts and runs in the short-lived `record-history`
252
+ process, unlike the old in-memory counters. Read individual decisions with
253
+ `get_audit_log` (`action: "triage.decision"`); the report is also available as
254
+ `rpc.get_shadow_report` (including the last 50 decisions). The report covers
255
+ the configured shadow window `[startedAt, startedAt + days]`; resetting it
256
+ deletes only shadow rows and keeps ordinary decision history.
257
+
258
+ Start with `mode: "auto"`, `shadow.enabled: true` and `shadow.days: 14`. After
259
+ the period, review the shadow report and only then disable shadow mode.
260
+
261
+ ## Troubleshooting
262
+
263
+ | Symptom | Cause | Fix |
264
+ | --- | --- | --- |
265
+ | `connection refused` / `fetch failed` | Ollama is not running | `ollama serve` |
266
+ | `model not found` | Model not pulled | `ollama pull <model>`, then check `ollama list` |
267
+ | Requests time out | Model too large for the machine or context too long | Lower the model tier, raise `timeoutMs`, cap context (below) |
268
+ | `llmReady: false` in `manage_local_ai` `get` | Endpoint or model unavailable | Check `baseUrl` and `model` |
269
+ | Very slow first response | Cold model load | Run once to warm the model; the benchmark shows steady-state numbers |
270
+ | Invalid JSON from the model | Model too small or prompt drift | Use a larger model or `mode: "rules"` |
271
+
272
+ ### OLLAMA_CONTEXT_LENGTH
273
+
274
+ Ollama allocates a large context window by default, which costs RAM and slows
275
+ CPU inference. For triage, a short context is enough. Set it in the environment
276
+ before starting the server:
277
+
278
+ ```bash
279
+ # Windows (PowerShell)
280
+ $env:OLLAMA_CONTEXT_LENGTH = "2048"
281
+ ollama serve
282
+ ```
283
+
284
+ ```bash
285
+ # Linux / macOS
286
+ OLLAMA_CONTEXT_LENGTH=2048 ollama serve
287
+ ```
288
+
289
+ Restart Ollama after changing the variable. If the model still does not fit,
290
+ choose a smaller tier or use `mode: "rules"`.
291
+
292
+ ## Limits
293
+
294
+ - Triage only affects notifications. It never rewrites run results.
295
+ - The model runs locally; prompts and logs are not sent to a third party.
296
+ - A missing model never blocks scheduling: rules or direct delivery take over.
297
+ - The classifier is intentionally conservative. When in doubt it delivers the
298
+ notification (fail-open).
299
+ - The benchmark measures a single machine; results are not a guarantee for other
300
+ hardware.
@@ -0,0 +1,363 @@
1
+ # Migration guide
2
+
3
+ How to move existing automation into `agent-steward` (plugin id
4
+ `opencode-windows-scheduler`) from cron, systemd
5
+ timers, launchd, Windows Task Scheduler, or another scheduler plugin.
6
+
7
+ - [Before you start](#before-you-start)
8
+ - [From cron / crontab](#from-cron--crontab)
9
+ - [From systemd timers](#from-systemd-timers)
10
+ - [From launchd](#from-launchd)
11
+ - [From Windows Task Scheduler](#from-windows-task-scheduler)
12
+ - [From another scheduler plugin](#from-another-scheduler-plugin)
13
+ - [Bulk import and export](#bulk-import-and-export)
14
+ - [Verification checklist](#verification-checklist)
15
+ - [Common pitfalls](#common-pitfalls)
16
+ - [Rollback](#rollback)
17
+
18
+ ## Before you start
19
+
20
+ 1. **Install and build.**
21
+
22
+ ```bash
23
+ npm install -g agent-steward
24
+ ```
25
+
26
+ Add the plugin to `opencode.json` and reload OpenCode (V2 reloads config
27
+ automatically; on V1 restart it). If OpenCode's built-in
28
+ schedules are enabled, disable them so two schedulers do not run the same work.
29
+
30
+ 2. **Check Node.** `node --version` must be 20 or newer (22.5+ for the built-in SQLite
31
+ driver; Node 24 recommended).
32
+
33
+ 3. **Inventory the old jobs.** For each job write down: name, schedule, command,
34
+ working directory, environment variables, timeout, and what "success" means. The
35
+ last one becomes your Quality Gate.
36
+
37
+ 4. **Do not delete the old jobs yet.** Run both schedulers side by side for a few days,
38
+ then remove the old entries.
39
+
40
+ ## From cron / crontab
41
+
42
+ Cron expressions are compatible (five fields). The differences are in the command.
43
+
44
+ **Before (crontab)**
45
+
46
+ ```cron
47
+ 0 2 * * * cd /srv/api && /usr/bin/git pull && /usr/bin/npm test >> /var/log/api.log 2>&1
48
+ ```
49
+
50
+ **After (agent tool or GUI)**
51
+
52
+ ```json
53
+ {
54
+ "name": "api-nightly",
55
+ "schedule": "0 2 * * *",
56
+ "workingDirectory": "/srv/api",
57
+ "beforeScript": "git pull --ff-only",
58
+ "prompt": "Inspect the repository, apply safe dependency updates, and explain every change you made.",
59
+ "qualityGate": "npm test",
60
+ "timeoutSeconds": 1800
61
+ }
62
+ ```
63
+
64
+ Mapping table:
65
+
66
+ | Cron concept | Scheduler equivalent |
67
+ | --- | --- |
68
+ | `cd /path && command` | `workingDirectory` or `workspaceId` |
69
+ | `>> file 2>&1` | log file is written automatically (`logs/<task>.log`) |
70
+ | `&&` chains | `beforeScript`, `prompt`, `qualityGate`, `afterScript` |
71
+ | exit code check | Quality Gate |
72
+ | `MAILTO` | webhook notifications |
73
+ | `%` escapes | not needed; write the prompt as normal text |
74
+ | `@reboot` | not supported; use a file/MCP trigger or a frequent cron |
75
+
76
+ Notes:
77
+
78
+ - `@daily`, `@hourly` and similar macros are not supported — write `0 0 * * *`,
79
+ `0 * * * *`, and so on.
80
+ - `@reboot` and `@yearly` have no direct equivalent.
81
+ - Cron environments are minimal. The wrapper inherits the user environment of the OS
82
+ scheduler entry, not your interactive shell. Absolute paths are safer than relying on
83
+ `PATH` from `.bashrc`.
84
+
85
+ ## From systemd timers
86
+
87
+ The plugin schedules through the user crontab on Linux, so systemd calendar syntax is
88
+ translated to a cron expression when you migrate.
89
+
90
+ **Before**
91
+
92
+ ```ini
93
+ # api-nightly.timer
94
+ [Timer]
95
+ OnCalendar=*-*-* 02:00:00
96
+ Persistent=true
97
+ ```
98
+
99
+ ```ini
100
+ # api-nightly.service
101
+ [Service]
102
+ WorkingDirectory=/srv/api
103
+ ExecStart=/usr/bin/npm run nightly
104
+ ```
105
+
106
+ **After**
107
+
108
+ ```json
109
+ {
110
+ "name": "api-nightly",
111
+ "schedule": "0 2 * * *",
112
+ "workingDirectory": "/srv/api",
113
+ "prompt": "Run the nightly routine described in package.json and summarize the result.",
114
+ "qualityGate": "npm test"
115
+ }
116
+ ```
117
+
118
+ | systemd | Scheduler |
119
+ | --- | --- |
120
+ | `OnCalendar=*-*-* 02:00` | `0 2 * * *` |
121
+ | `OnUnitActiveSec=15min` | `*/15 * * * *` |
122
+ | `WorkingDirectory` | `workingDirectory` / `workspaceId` |
123
+ | `Environment=` | set it in the hook or in the user environment |
124
+ | `TimeoutStartSec` | `timeoutSeconds` |
125
+ | `Persistent=true` | catch-up is not implemented; a missed window is skipped |
126
+ | `Requires=` / `After=` | `dependsOn` |
127
+
128
+ Disable the old units (`systemctl --user disable --now api-nightly.timer`) only after
129
+ the new task has run successfully at least once.
130
+
131
+ ## From launchd
132
+
133
+ **Before**
134
+
135
+ ```xml
136
+ <key>StartCalendarInterval</key>
137
+ <dict><key>Hour</key><integer>2</integer></dict>
138
+ ```
139
+
140
+ **After**
141
+
142
+ ```json
143
+ {
144
+ "name": "mac-nightly",
145
+ "schedule": "0 2 * * *",
146
+ "workingDirectory": "/Users/me/projects/api",
147
+ "prompt": "Run the nightly maintenance and report anything unusual."
148
+ }
149
+ ```
150
+
151
+ | launchd | Scheduler |
152
+ | --- | --- |
153
+ | `StartCalendarInterval` | cron expression |
154
+ | `StartInterval` (seconds) | `*/N * * * *` (minute granularity) |
155
+ | `WorkingDirectory` | `workingDirectory` |
156
+ | `StandardOutPath` / `StandardErrorPath` | automatic log file |
157
+ | `RunAtLoad` | not supported; use a manual run or a file trigger |
158
+
159
+ ## From Windows Task Scheduler
160
+
161
+ Existing tasks usually point to a `.bat`/`.ps1` file or a command line.
162
+
163
+ **After**
164
+
165
+ ```json
166
+ {
167
+ "name": "win-nightly",
168
+ "schedule": "0 2 * * *",
169
+ "workingDirectory": "C:\\projects\\api",
170
+ "prompt": "Run the nightly maintenance for this repository.",
171
+ "qualityGate": "npm test"
172
+ }
173
+ ```
174
+
175
+ | Task Scheduler | Scheduler |
176
+ | --- | --- |
177
+ | Trigger "Daily" | `0 2 * * *` |
178
+ | Trigger "At log on" | not supported; use a file trigger or a start-up hook |
179
+ | "Run whether user is logged on" | the plugin registers tasks in the current user context |
180
+ | "Stop task if it runs longer than" | `timeoutSeconds` |
181
+ | "If the task is already running" | lock file, the second run is `skipped` |
182
+ | Action "Start a program" | you describe the goal in a prompt instead of a command |
183
+ | Multiple actions | `beforeScript` + `prompt` + `qualityGate` + `afterScript` |
184
+
185
+ Delete the old task only after verifying the new one:
186
+ `schtasks /delete /tn "<old task>" /f`.
187
+
188
+ ## From another scheduler plugin
189
+
190
+ There is no universal importer, because definition formats differ. The workflow is:
191
+
192
+ 1. List the old jobs and copy their schedules, prompts and working directories.
193
+ 2. Recreate them with `schedule_task` or the GUI.
194
+ 3. If the old plugin exports JSON, transform it into the import format below and use
195
+ `import_tasks` — validation reports per-record errors.
196
+ 4. Disable the old plugin before the first overlapping run.
197
+
198
+ ## Bulk import and export
199
+
200
+ **Export format**
201
+
202
+ ```json
203
+ {
204
+ "version": 1,
205
+ "exportedAt": "2026-01-01T00:00:00.000Z",
206
+ "tasks": [
207
+ {
208
+ "name": "api-nightly",
209
+ "schedule": "0 2 * * *",
210
+ "prompt": "Nightly maintenance.",
211
+ "qualityGate": "npm test",
212
+ "workspaceId": "ws-api"
213
+ }
214
+ ]
215
+ }
216
+ ```
217
+
218
+ **Import**
219
+
220
+ Use `import_tasks` from the GUI or the RPC layer. Rules:
221
+
222
+ - `name` and `prompt` are required.
223
+ - `cron` tasks need a schedule; `file` tasks need `watchPath`; `mcp-event` tasks need
224
+ `mcpEvent.event`.
225
+ - Matrix tasks cannot also set `workspaceId`, and `matrix.workspaceIds` must not be
226
+ empty.
227
+ - Workspace ids must exist in the target installation, or the record is rejected.
228
+ - Errors are reported per record; valid records are imported.
229
+
230
+ Workspaces are not exported as directories — recreate them with
231
+ `manage_workspaces` first, then map old paths by hand.
232
+
233
+ ## Verification checklist
234
+
235
+ For every migrated job:
236
+
237
+ 1. `dry_run` with the task name — check order, dependencies and estimated time.
238
+ 2. `run_task_now` — confirm the log shows the expected work.
239
+ 3. Check the Quality Gate result in `get_history`.
240
+ 4. Confirm the next scheduled run appears with a correct "next run" timestamp.
241
+ 5. For matrix jobs, expand the parent in the dashboard and verify every clone has the
242
+ right workspace path.
243
+ 6. Wait for at least one natural scheduled run before deleting the old definition.
244
+
245
+ ## From `opencode-windows-scheduler` to `agent-steward` (package rename)
246
+
247
+ The npm package `opencode-windows-scheduler` was renamed to `agent-steward` at milestone
248
+ **Д7** (release `agent-steward@0.0.2`). This section covers the rename migration only — task definitions, schedules,
249
+ history and settings are **unchanged**.
250
+
251
+ ### What changes
252
+
253
+ | Item | Before (`opencode-windows-scheduler`) | After (`agent-steward`) |
254
+ |------|--------------------------------------|-------------------------|
255
+ | npm package name | `opencode-windows-scheduler` | `agent-steward` |
256
+ | GitHub repository | `DeadSno/opencode-windows-scheduler` | `DeadSno/agent-steward` |
257
+ | Install command | `opencode plugin add opencode-windows-scheduler` | `opencode plugin add agent-steward` |
258
+ | V1 config key | `"plugin": ["opencode-windows-scheduler"]` | `"plugin": ["agent-steward"]` |
259
+ | V2 config key | `"plugins": ["opencode-windows-scheduler"]` | `"plugins": ["agent-steward"]` |
260
+ | `plugin id` | `opencode-windows-scheduler` | same (unchanged) |
261
+ | State paths | `%APPDATA%\opencode\windows-scheduler` / `~/.config/opencode/windows-scheduler` | `%APPDATA%\opencode\agent-steward` / `~/.config/opencode/agent-steward` (migrated automatically) |
262
+ | Windows task folder | `\OpenCode\windows-scheduler\` | `\OpenCode\agent-steward\` (legacy folder still recognized) |
263
+
264
+ **The npm package name, config entries and user-facing data/task paths changed.**
265
+ The plugin id, SQLite filename and log file names stay the same. On first start the
266
+ legacy state directory is copied to the new location and absolute paths in settings
267
+ are rewritten; existing tasks and history are preserved.
268
+
269
+ ### Migration steps
270
+
271
+ 1. **Update the OpenCode config** (`opencode.jsonc`) — the value is the npm package
272
+ name, so it changes to `agent-steward`:
273
+
274
+ V1:
275
+ ```jsonc
276
+ {
277
+ "$schema": "https://opencode.ai/config.json",
278
+ "plugin": ["agent-steward"]
279
+ }
280
+ ```
281
+
282
+ V2:
283
+ ```jsonc
284
+ {
285
+ "$schema": "https://opencode.ai/config.json",
286
+ "plugins": ["agent-steward"]
287
+ }
288
+ ```
289
+
290
+ The `plugin id` reported by the plugin remains `opencode-windows-scheduler`.
291
+ OpenCode V2 reloads the config automatically (use `/reload` if needed); on V1
292
+ restart OpenCode after saving.
293
+
294
+ 2. **Install from the new package**:
295
+
296
+ ```bash
297
+ opencode plugin add agent-steward
298
+ ```
299
+
300
+ Existing installations that still list `opencode-windows-scheduler` keep working
301
+ until the thin re-export wrapper is deprecated.
302
+
303
+ 3. **Old package (`opencode-windows-scheduler`)** — remains published as a thin
304
+ re-export wrapper around `agent-steward` for one major version. It receives only
305
+ critical patches. No action required if you already have it installed; it will
306
+ continue to work until `npm deprecate` (planned for `>= 2.1`, after download parity
307
+ with the new package).
308
+
309
+ 4. **Verify** — run `dry_run` on any existing task and confirm it executes. Check
310
+ `get_history` for the latest runs. Task behaviour should not change; after the first
311
+ start your data appears in the new state directory.
312
+
313
+ ### Rollback
314
+
315
+ The `plugin id`, SQLite filename and log names are identical before and after the
316
+ rename, so the plugin itself needs no rollback. If you prefer the old npm package name,
317
+ switch the config entry back to `opencode-windows-scheduler` while the thin re-export is
318
+ still published. Note that `agent-steward` is the authoritative state directory after
319
+ migration: copy it back to the legacy path if the old package must read the migrated
320
+ data.
321
+
322
+
323
+ ## Local AI / triage migration
324
+
325
+ If you are migrating from a setup that used cloud AI for lightweight task triage or
326
+ classification, you can move that load to a local model to save tokens:
327
+
328
+ 1. Install Ollama: `ollama serve` and `ollama pull qwen3:4b` (or a smaller model for
329
+ RAM-constrained machines — see `docs/LOCAL-AI.md` for tier recommendations).
330
+ 2. Configure triage via `manage_local_ai({action: "update", mode: "auto", ...})` or
331
+ through the GUI notifications panel.
332
+ 3. Start in `shadow` mode so decisions are logged but not applied, then switch to `auto`
333
+ once confidence is acceptable.
334
+ 4. Ollama is optional — if it is unavailable, the plugin falls back to rules-only mode
335
+ (fail-open) and never blocks notifications.
336
+
337
+ ## Common pitfalls
338
+
339
+ | Symptom | Cause | Fix |
340
+ | --- | --- | --- |
341
+ | `skipped` in history | previous run still holds the lock | wait, or lower `timeoutSeconds` |
342
+ | `timeout` every run | the agent needs more time | raise `timeoutSeconds` |
343
+ | Quality Gate fails but the work looks fine | gate runs in the task directory, not a subdirectory | prefix the command with `cd subdir && ...` |
344
+ | Agent cannot find the project | no `workingDirectory`/`workspaceId`, so it ran in the plugin directory | set the working directory |
345
+ | "Workspace path does not exist" on import | workspace ids belong to another machine | recreate workspaces and remap ids |
346
+ | Two runs at once after migration | old scheduler is still enabled | disable the old job |
347
+ | Cron rejected | expression not expressible by `schtasks` | use a supported pattern (`*/N`, fixed minute/hour, weekdays) |
348
+ | Prompts behave differently at night | interactive shell environment vs scheduler environment | use absolute paths, avoid alias-dependent commands |
349
+ | Local AI (Ollama) unreachable | `manage_local_ai` test fails or triage falls back to rules | run `ollama serve`, `ollama pull <model>`, check `OLLAMA_CONTEXT_LENGTH` |
350
+ | Local AI confidence too low | rules fire instead of LLM, more tokens used than expected | raise `confidenceThreshold` in `manage_local_ai`, review rule reasons in audit |
351
+
352
+
353
+ ## Rollback
354
+
355
+ If something goes wrong:
356
+
357
+ 1. Re-enable the old jobs (they were never deleted).
358
+ 2. `pause_task` the migrated ones, or delete them.
359
+ 3. Export the plugin definitions before major changes: `export_tasks` gives a single
360
+ JSON file you can re-import on any machine.
361
+
362
+ Definitions live in `scheduler.db`; deleting the plugin directory removes all state.
363
+ Export first if you might want it back.