stagent 0.5.0 → 0.6.0

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 (252) hide show
  1. package/README.md +8 -8
  2. package/dist/cli.js +146 -2
  3. package/docs/.coverage-gaps.json +21 -0
  4. package/docs/.last-generated +1 -1
  5. package/docs/features/agent-intelligence.md +36 -14
  6. package/docs/features/chat.md +33 -56
  7. package/docs/features/cost-usage.md +14 -10
  8. package/docs/features/dashboard-kanban.md +30 -13
  9. package/docs/features/delivery-channels.md +198 -0
  10. package/docs/features/design-system.md +10 -10
  11. package/docs/features/documents.md +8 -8
  12. package/docs/features/home-workspace.md +20 -15
  13. package/docs/features/inbox-notifications.md +22 -10
  14. package/docs/features/keyboard-navigation.md +11 -11
  15. package/docs/features/monitoring.md +1 -1
  16. package/docs/features/playbook.md +30 -32
  17. package/docs/features/profiles.md +33 -11
  18. package/docs/features/projects.md +2 -2
  19. package/docs/features/provider-runtimes.md +58 -14
  20. package/docs/features/schedules.md +70 -40
  21. package/docs/features/settings.md +74 -46
  22. package/docs/features/shared-components.md +7 -15
  23. package/docs/features/tool-permissions.md +9 -9
  24. package/docs/features/workflows.md +32 -21
  25. package/docs/getting-started.md +33 -9
  26. package/docs/index.md +25 -16
  27. package/docs/journeys/developer.md +124 -207
  28. package/docs/journeys/personal-use.md +70 -79
  29. package/docs/journeys/power-user.md +107 -151
  30. package/docs/journeys/work-use.md +81 -113
  31. package/docs/manifest.json +77 -45
  32. package/docs/superpowers/plans/2026-03-30-finish-in-progress-features.md +547 -0
  33. package/docs/use-cases/agency-operator.md +84 -0
  34. package/docs/use-cases/solo-founder.md +75 -0
  35. package/docs/why-stagent.md +59 -0
  36. package/package.json +10 -3
  37. package/src/app/api/channels/[id]/route.ts +103 -0
  38. package/src/app/api/channels/[id]/test/route.ts +52 -0
  39. package/src/app/api/channels/inbound/slack/route.ts +109 -0
  40. package/src/app/api/channels/inbound/telegram/poll/route.ts +128 -0
  41. package/src/app/api/channels/inbound/telegram/route.ts +76 -0
  42. package/src/app/api/channels/route.ts +71 -0
  43. package/src/app/api/chat/conversations/route.ts +15 -0
  44. package/src/app/api/chat/entities/search/route.ts +46 -31
  45. package/src/app/api/environment/profiles/suggest/route.ts +19 -3
  46. package/src/app/api/environment/scan/route.ts +8 -1
  47. package/src/app/api/handoffs/[id]/route.ts +76 -0
  48. package/src/app/api/handoffs/route.ts +89 -0
  49. package/src/app/api/memory/route.ts +181 -0
  50. package/src/app/api/profiles/[id]/route.ts +16 -1
  51. package/src/app/api/profiles/[id]/test/route.ts +4 -0
  52. package/src/app/api/profiles/[id]/test-results/route.ts +22 -0
  53. package/src/app/api/profiles/[id]/test-single/route.ts +64 -0
  54. package/src/app/api/profiles/assist/route.ts +35 -0
  55. package/src/app/api/profiles/import-repo/apply-updates/route.ts +123 -0
  56. package/src/app/api/profiles/import-repo/check-updates/route.ts +163 -0
  57. package/src/app/api/profiles/import-repo/confirm/route.ts +118 -0
  58. package/src/app/api/profiles/import-repo/preview/route.ts +107 -0
  59. package/src/app/api/profiles/import-repo/route.ts +29 -0
  60. package/src/app/api/profiles/import-repo/scan/route.ts +25 -0
  61. package/src/app/api/profiles/route.ts +73 -22
  62. package/src/app/api/runtimes/ollama/route.ts +86 -0
  63. package/src/app/api/runtimes/suggest/route.ts +29 -0
  64. package/src/app/api/schedules/[id]/heartbeat-history/route.ts +77 -0
  65. package/src/app/api/schedules/[id]/route.ts +41 -3
  66. package/src/app/api/schedules/parse/route.ts +66 -0
  67. package/src/app/api/schedules/route.ts +71 -12
  68. package/src/app/api/settings/author-default/route.ts +7 -0
  69. package/src/app/api/settings/learning/route.ts +41 -0
  70. package/src/app/api/settings/ollama/route.ts +34 -0
  71. package/src/app/api/settings/providers/route.ts +57 -0
  72. package/src/app/api/settings/routing/route.ts +24 -0
  73. package/src/app/api/settings/web-search/route.ts +28 -0
  74. package/src/app/api/tasks/[id]/execute/route.ts +13 -1
  75. package/src/app/documents/page.tsx +3 -0
  76. package/src/app/environment/page.tsx +8 -1
  77. package/src/app/settings/page.tsx +10 -4
  78. package/src/app/workflows/[id]/edit/page.tsx +2 -0
  79. package/src/app/workflows/new/page.tsx +2 -0
  80. package/src/components/chat/chat-command-popover.tsx +22 -19
  81. package/src/components/chat/chat-input.tsx +5 -0
  82. package/src/components/chat/chat-model-selector.tsx +42 -1
  83. package/src/components/chat/chat-shell.tsx +2 -0
  84. package/src/components/dashboard/welcome-landing.tsx +9 -9
  85. package/src/components/environment/artifact-card.tsx +27 -1
  86. package/src/components/environment/environment-dashboard.tsx +50 -2
  87. package/src/components/environment/environment-summary-card.tsx +5 -2
  88. package/src/components/environment/suggested-profiles.tsx +117 -52
  89. package/src/components/handoffs/handoff-approval-card.tsx +159 -0
  90. package/src/components/memory/memory-browser.tsx +315 -0
  91. package/src/components/profiles/learned-context-panel.tsx +4 -4
  92. package/src/components/profiles/profile-assist-panel.tsx +512 -0
  93. package/src/components/profiles/profile-browser.tsx +109 -8
  94. package/src/components/profiles/profile-card.tsx +29 -1
  95. package/src/components/profiles/profile-detail-view.tsx +200 -28
  96. package/src/components/profiles/profile-form-view.tsx +220 -82
  97. package/src/components/profiles/repo-import-wizard.tsx +648 -0
  98. package/src/components/profiles/smoke-test-editor.tsx +106 -0
  99. package/src/components/schedules/schedule-create-sheet.tsx +9 -1
  100. package/src/components/schedules/schedule-form.tsx +348 -9
  101. package/src/components/schedules/schedule-list.tsx +15 -2
  102. package/src/components/settings/auth-method-selector.tsx +7 -1
  103. package/src/components/settings/budget-guardrails-section.tsx +111 -48
  104. package/src/components/settings/channels-section.tsx +526 -0
  105. package/src/components/settings/chat-settings-section.tsx +27 -1
  106. package/src/components/settings/data-management-section.tsx +8 -6
  107. package/src/components/settings/learning-context-section.tsx +124 -0
  108. package/src/components/settings/ollama-section.tsx +270 -0
  109. package/src/components/settings/providers-runtimes-section.tsx +499 -0
  110. package/src/components/settings/web-search-section.tsx +101 -0
  111. package/src/components/shared/tag-input.tsx +156 -0
  112. package/src/components/tasks/kanban-board.tsx +32 -0
  113. package/src/components/tasks/kanban-column.tsx +4 -2
  114. package/src/components/tasks/task-card.tsx +1 -0
  115. package/src/components/tasks/task-chip-bar.tsx +6 -1
  116. package/src/components/tasks/task-create-panel.tsx +55 -5
  117. package/src/components/workflows/workflow-form-view.tsx +38 -3
  118. package/src/hooks/use-chat-autocomplete.ts +24 -26
  119. package/src/hooks/use-project-skills.ts +66 -0
  120. package/src/hooks/use-tag-suggestions.ts +31 -0
  121. package/src/instrumentation.ts +4 -1
  122. package/src/lib/agents/__tests__/claude-agent.test.ts +3 -0
  123. package/src/lib/agents/__tests__/learned-context.test.ts +10 -0
  124. package/src/lib/agents/agentic-loop.ts +235 -0
  125. package/src/lib/agents/browser-mcp.ts +59 -4
  126. package/src/lib/agents/claude-agent.ts +26 -199
  127. package/src/lib/agents/handoff/bus.ts +164 -0
  128. package/src/lib/agents/handoff/governance.ts +47 -0
  129. package/src/lib/agents/handoff/types.ts +16 -0
  130. package/src/lib/agents/learned-context.ts +27 -7
  131. package/src/lib/agents/memory/decay.ts +61 -0
  132. package/src/lib/agents/memory/extractor.ts +181 -0
  133. package/src/lib/agents/memory/retrieval.ts +96 -0
  134. package/src/lib/agents/memory/types.ts +6 -0
  135. package/src/lib/agents/profiles/__tests__/project-profiles.test.ts +119 -0
  136. package/src/lib/agents/profiles/__tests__/registry.test.ts +11 -3
  137. package/src/lib/agents/profiles/builtins/code-reviewer/profile.yaml +2 -2
  138. package/src/lib/agents/profiles/builtins/content-creator/SKILL.md +19 -0
  139. package/src/lib/agents/profiles/builtins/content-creator/profile.yaml +27 -0
  140. package/src/lib/agents/profiles/builtins/customer-support-agent/SKILL.md +19 -0
  141. package/src/lib/agents/profiles/builtins/customer-support-agent/profile.yaml +26 -0
  142. package/src/lib/agents/profiles/builtins/data-analyst/profile.yaml +2 -2
  143. package/src/lib/agents/profiles/builtins/devops-engineer/profile.yaml +2 -2
  144. package/src/lib/agents/profiles/builtins/document-writer/profile.yaml +2 -2
  145. package/src/lib/agents/profiles/builtins/financial-analyst/SKILL.md +19 -0
  146. package/src/lib/agents/profiles/builtins/financial-analyst/profile.yaml +24 -0
  147. package/src/lib/agents/profiles/builtins/general/profile.yaml +2 -2
  148. package/src/lib/agents/profiles/builtins/health-fitness-coach/profile.yaml +2 -2
  149. package/src/lib/agents/profiles/builtins/learning-coach/profile.yaml +2 -2
  150. package/src/lib/agents/profiles/builtins/marketing-strategist/SKILL.md +19 -0
  151. package/src/lib/agents/profiles/builtins/marketing-strategist/profile.yaml +27 -0
  152. package/src/lib/agents/profiles/builtins/operations-coordinator/SKILL.md +19 -0
  153. package/src/lib/agents/profiles/builtins/operations-coordinator/profile.yaml +26 -0
  154. package/src/lib/agents/profiles/builtins/project-manager/profile.yaml +2 -2
  155. package/src/lib/agents/profiles/builtins/researcher/SKILL.md +1 -0
  156. package/src/lib/agents/profiles/builtins/researcher/profile.yaml +2 -2
  157. package/src/lib/agents/profiles/builtins/sales-researcher/SKILL.md +19 -0
  158. package/src/lib/agents/profiles/builtins/sales-researcher/profile.yaml +26 -0
  159. package/src/lib/agents/profiles/builtins/shopping-assistant/SKILL.md +1 -0
  160. package/src/lib/agents/profiles/builtins/shopping-assistant/profile.yaml +2 -2
  161. package/src/lib/agents/profiles/builtins/sweep/profile.yaml +1 -1
  162. package/src/lib/agents/profiles/builtins/technical-writer/profile.yaml +2 -2
  163. package/src/lib/agents/profiles/builtins/travel-planner/SKILL.md +2 -0
  164. package/src/lib/agents/profiles/builtins/travel-planner/profile.yaml +2 -2
  165. package/src/lib/agents/profiles/builtins/wealth-manager/SKILL.md +2 -0
  166. package/src/lib/agents/profiles/builtins/wealth-manager/profile.yaml +2 -2
  167. package/src/lib/agents/profiles/project-profiles.ts +193 -0
  168. package/src/lib/agents/profiles/registry.ts +130 -6
  169. package/src/lib/agents/profiles/types.ts +28 -0
  170. package/src/lib/agents/router.ts +174 -2
  171. package/src/lib/agents/runtime/__tests__/catalog.test.ts +15 -4
  172. package/src/lib/agents/runtime/anthropic-direct.ts +644 -0
  173. package/src/lib/agents/runtime/catalog.ts +57 -2
  174. package/src/lib/agents/runtime/claude.ts +205 -1
  175. package/src/lib/agents/runtime/index.ts +22 -0
  176. package/src/lib/agents/runtime/ollama-adapter.ts +409 -0
  177. package/src/lib/agents/runtime/openai-direct.ts +514 -0
  178. package/src/lib/agents/runtime/profile-assist-types.ts +30 -0
  179. package/src/lib/agents/runtime/types.ts +2 -0
  180. package/src/lib/agents/tool-permissions.ts +203 -0
  181. package/src/lib/channels/gateway.ts +321 -0
  182. package/src/lib/channels/poller.ts +268 -0
  183. package/src/lib/channels/registry.ts +90 -0
  184. package/src/lib/channels/slack-adapter.ts +188 -0
  185. package/src/lib/channels/telegram-adapter.ts +218 -0
  186. package/src/lib/channels/types.ts +43 -0
  187. package/src/lib/channels/webhook-adapter.ts +74 -0
  188. package/src/lib/chat/context-builder.ts +22 -2
  189. package/src/lib/chat/engine.ts +95 -13
  190. package/src/lib/chat/ollama-engine.ts +198 -0
  191. package/src/lib/chat/stagent-tools.ts +106 -20
  192. package/src/lib/chat/tool-catalog.ts +24 -0
  193. package/src/lib/chat/tool-registry.ts +90 -0
  194. package/src/lib/chat/tools/chat-history-tools.ts +4 -4
  195. package/src/lib/chat/tools/document-tools.ts +7 -7
  196. package/src/lib/chat/tools/handoff-tools.ts +70 -0
  197. package/src/lib/chat/tools/notification-tools.ts +4 -4
  198. package/src/lib/chat/tools/profile-tools.ts +3 -3
  199. package/src/lib/chat/tools/project-tools.ts +3 -3
  200. package/src/lib/chat/tools/schedule-tools.ts +29 -13
  201. package/src/lib/chat/tools/settings-tools.ts +2 -2
  202. package/src/lib/chat/tools/task-tools.ts +66 -11
  203. package/src/lib/chat/tools/usage-tools.ts +2 -2
  204. package/src/lib/chat/tools/workflow-tools.ts +8 -8
  205. package/src/lib/chat/types.ts +11 -5
  206. package/src/lib/constants/known-tools.ts +19 -0
  207. package/src/lib/constants/prose-styles.ts +1 -1
  208. package/src/lib/constants/settings.ts +7 -0
  209. package/src/lib/data/channel-bindings.ts +85 -0
  210. package/src/lib/data/clear.ts +22 -0
  211. package/src/lib/data/profile-test-results.ts +48 -0
  212. package/src/lib/data/seed-data/conversations.ts +196 -0
  213. package/src/lib/data/seed-data/learned-context.ts +99 -0
  214. package/src/lib/data/seed-data/notifications.ts +54 -1
  215. package/src/lib/data/seed-data/profile-test-results.ts +96 -0
  216. package/src/lib/data/seed-data/repo-imports.ts +51 -0
  217. package/src/lib/data/seed-data/views.ts +60 -0
  218. package/src/lib/data/seed.ts +51 -0
  219. package/src/lib/db/bootstrap.ts +162 -0
  220. package/src/lib/db/migrations/0013_add_repo_imports.sql +15 -0
  221. package/src/lib/db/migrations/0014_add_linked_profile_id.sql +3 -0
  222. package/src/lib/db/migrations/0015_add_channel_bindings.sql +23 -0
  223. package/src/lib/db/schema.ts +187 -1
  224. package/src/lib/environment/__tests__/auto-scan.test.ts +86 -0
  225. package/src/lib/environment/__tests__/profile-linker.test.ts +187 -0
  226. package/src/lib/environment/auto-scan.ts +48 -0
  227. package/src/lib/environment/data.ts +25 -0
  228. package/src/lib/environment/profile-generator.ts +40 -10
  229. package/src/lib/environment/profile-linker.ts +143 -0
  230. package/src/lib/environment/profile-rules.ts +96 -0
  231. package/src/lib/import/dedup.ts +149 -0
  232. package/src/lib/import/format-adapter.ts +631 -0
  233. package/src/lib/import/github-api.ts +219 -0
  234. package/src/lib/import/repo-scanner.ts +251 -0
  235. package/src/lib/schedules/__tests__/nlp-parser.test.ts +330 -0
  236. package/src/lib/schedules/active-hours.ts +120 -0
  237. package/src/lib/schedules/heartbeat-parser.ts +224 -0
  238. package/src/lib/schedules/heartbeat-prompt.ts +153 -0
  239. package/src/lib/schedules/nlp-parser.ts +357 -0
  240. package/src/lib/schedules/scheduler.ts +218 -3
  241. package/src/lib/settings/__tests__/budget-guardrails.test.ts +39 -1
  242. package/src/lib/settings/helpers.ts +6 -0
  243. package/src/lib/settings/routing.ts +24 -0
  244. package/src/lib/settings/runtime-setup.ts +28 -1
  245. package/src/lib/usage/ledger.ts +2 -1
  246. package/src/lib/validators/__tests__/settings.test.ts +9 -0
  247. package/src/lib/validators/profile.ts +39 -0
  248. package/src/lib/workflows/blueprints/builtins/business-daily-briefing.yaml +102 -0
  249. package/src/lib/workflows/blueprints/builtins/content-marketing-pipeline.yaml +90 -0
  250. package/src/lib/workflows/blueprints/builtins/customer-support-triage.yaml +107 -0
  251. package/src/lib/workflows/blueprints/builtins/financial-reporting.yaml +104 -0
  252. package/src/lib/workflows/blueprints/builtins/lead-research-pipeline.yaml +82 -0
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Stagent
2
2
 
3
- > Governed AI Agent WorkspaceSupervised Local Execution, Workflows, Documents, and Provider Runtimes.
3
+ > AI Business Operating System Run your business with AI agents. Local-first, multi-provider, governed.
4
4
 
5
- [![npm](https://img.shields.io/npm/v/stagent)](https://www.npmjs.com/package/stagent) [![Next.js 16](https://img.shields.io/badge/Next.js-16-black)](https://nextjs.org/) [![React 19](https://img.shields.io/badge/React-19-61DAFB)](https://react.dev/) [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178C6)](https://www.typescriptlang.org/) [![Claude Agent SDK](https://img.shields.io/badge/Claude-Agent_SDK-D97706)](https://docs.anthropic.com/) [![OpenAI Codex App Server](https://img.shields.io/badge/OpenAI-Codex_App_Server-10A37F)](https://developers.openai.com/codex/app-server) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
5
+ [![AI Business Operating System](https://img.shields.io/badge/AI_Business-Operating_System-6366F1)](https://stagent.io) [![npm](https://img.shields.io/npm/v/stagent)](https://www.npmjs.com/package/stagent) [![Next.js 16](https://img.shields.io/badge/Next.js-16-black)](https://nextjs.org/) [![React 19](https://img.shields.io/badge/React-19-61DAFB)](https://react.dev/) [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178C6)](https://www.typescriptlang.org/) [![Claude Agent SDK](https://img.shields.io/badge/Claude-Agent_SDK-D97706)](https://docs.anthropic.com/) [![OpenAI Codex App Server](https://img.shields.io/badge/OpenAI-Codex_App_Server-10A37F)](https://developers.openai.com/codex/app-server) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6
6
 
7
7
  **[stagent.io](https://stagent.io)** · **[GitHub](https://github.com/navam-io/stagent)**
8
8
 
@@ -28,20 +28,20 @@ Open [localhost:3000](http://localhost:3000). That's it — zero config, local S
28
28
 
29
29
  ## Why Stagent
30
30
 
31
- AI agents are powerful but production use breaks down when teams cannot see what the agent is doing, which rules it follows, or intervene before an unsafe action lands. Stagent gives you a **governed operations workspace** where every run is visible, every profile is reusable, and every approval is auditable.
31
+ The AI agent stack is broken for business operators. You can spin up an agent in minutes but running it reliably for real work means stitching together orchestration, governance, cost controls, and team coordination yourself. Stagent closes that gap with a single local-first platform where agents do the work and you stay in control.
32
32
 
33
33
  - **Local-first** — SQLite database, no cloud dependency, `npx stagent` and go
34
34
  - **Multi-provider** — Claude Code + OpenAI Codex App Server behind one runtime registry
35
- - **Human-in-the-loop** — Inbox approvals, ambient toasts, tool permission policies
36
- - **Reusable profiles** — 21 agent profiles with instructions, tool policies, and runtime tuning
37
- - **Workflow orchestration** — 6 patterns (sequence, planner-executor, checkpoint, parallel, loop, swarm)
38
- - **Cost governance** — Usage metering, budgets, and spend visibility per provider and model
35
+ - **Your rules, enforced** — Tool permissions, inbox approvals, and audit trails for every agent action
36
+ - **Your AI team** — 21 specialist profiles ready to deploy, each with instructions, tool policies, and runtime tuning
37
+ - **Business processes, automated** — 6 workflow patterns (sequence, planner-executor, checkpoint, parallel, loop, swarm)
38
+ - **Know what you spend** — Usage metering, budgets, and spend visibility per provider and model
39
39
 
40
40
  ---
41
41
 
42
42
  ## Runtime Bridge
43
43
 
44
- Stagent ships a shared runtime registry that routes tasks, schedules, and workflow steps through two governed execution backends: **Claude Code** (Anthropic Claude Agent SDK) and **OpenAI Codex App Server**. Both land in the same inbox, monitoring, and task-state surfaces switching providers is a config change, not a rewrite.
44
+ Run the same business process on different AI providers without changing a line of configuration. Stagent's shared runtime registry routes tasks, schedules, and workflow steps through **Claude Code** (Anthropic Claude Agent SDK) and **OpenAI Codex App Server**, landing everything in the same inbox, monitoring, and cost surfaces. Switching providers is a settings change, not a rewrite.
45
45
 
46
46
  ---
47
47
 
package/dist/cli.js CHANGED
@@ -106,7 +106,13 @@ var STAGENT_TABLES = [
106
106
  "conversations",
107
107
  "chat_messages",
108
108
  "reading_progress",
109
- "bookmarks"
109
+ "bookmarks",
110
+ "profile_test_results",
111
+ "repo_imports",
112
+ "agent_memory",
113
+ "channel_configs",
114
+ "channel_bindings",
115
+ "agent_messages"
110
116
  ];
111
117
  function bootstrapStagentDatabase(sqlite2) {
112
118
  sqlite2.exec(`
@@ -224,6 +230,16 @@ function bootstrapStagentDatabase(sqlite2) {
224
230
  expires_at INTEGER,
225
231
  last_fired_at INTEGER,
226
232
  next_fire_at INTEGER,
233
+ type TEXT DEFAULT 'scheduled' NOT NULL,
234
+ heartbeat_checklist TEXT,
235
+ active_hours_start INTEGER,
236
+ active_hours_end INTEGER,
237
+ active_timezone TEXT DEFAULT 'UTC',
238
+ suppression_count INTEGER DEFAULT 0 NOT NULL,
239
+ last_action_at INTEGER,
240
+ heartbeat_budget_per_day INTEGER,
241
+ heartbeat_spent_today INTEGER DEFAULT 0 NOT NULL,
242
+ heartbeat_budget_reset_at INTEGER,
227
243
  created_at INTEGER NOT NULL,
228
244
  updated_at INTEGER NOT NULL,
229
245
  FOREIGN KEY (project_id) REFERENCES projects(id) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -320,6 +336,17 @@ function bootstrapStagentDatabase(sqlite2) {
320
336
  sqlite2.exec(`CREATE INDEX IF NOT EXISTS idx_tasks_schedule_id ON tasks(schedule_id);`);
321
337
  addColumnIfMissing(`ALTER TABLE projects ADD COLUMN working_directory TEXT;`);
322
338
  addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN assigned_agent TEXT;`);
339
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN type TEXT DEFAULT 'scheduled' NOT NULL;`);
340
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_checklist TEXT;`);
341
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN active_hours_start INTEGER;`);
342
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN active_hours_end INTEGER;`);
343
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN active_timezone TEXT DEFAULT 'UTC';`);
344
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN suppression_count INTEGER DEFAULT 0 NOT NULL;`);
345
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN last_action_at INTEGER;`);
346
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_budget_per_day INTEGER;`);
347
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_spent_today INTEGER DEFAULT 0 NOT NULL;`);
348
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN heartbeat_budget_reset_at INTEGER;`);
349
+ addColumnIfMissing(`ALTER TABLE tasks ADD COLUMN source_type TEXT;`);
323
350
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN version INTEGER NOT NULL DEFAULT 1;`);
324
351
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN source TEXT DEFAULT 'upload';`);
325
352
  addColumnIfMissing(`ALTER TABLE documents ADD COLUMN conversation_id TEXT REFERENCES conversations(id);`);
@@ -358,6 +385,7 @@ function bootstrapStagentDatabase(sqlite2) {
358
385
  metadata TEXT,
359
386
  size_bytes INTEGER DEFAULT 0 NOT NULL,
360
387
  modified_at INTEGER NOT NULL,
388
+ linked_profile_id TEXT,
361
389
  created_at INTEGER NOT NULL,
362
390
  FOREIGN KEY (scan_id) REFERENCES environment_scans(id) ON UPDATE NO ACTION ON DELETE NO ACTION
363
391
  );
@@ -415,6 +443,8 @@ function bootstrapStagentDatabase(sqlite2) {
415
443
 
416
444
  CREATE INDEX IF NOT EXISTS idx_env_templates_scope ON environment_templates(scope);
417
445
  `);
446
+ addColumnIfMissing(`ALTER TABLE environment_artifacts ADD COLUMN linked_profile_id TEXT;`);
447
+ sqlite2.exec(`CREATE INDEX IF NOT EXISTS idx_env_artifacts_linked_profile ON environment_artifacts(linked_profile_id);`);
418
448
  const legacyConv = sqlite2.prepare(
419
449
  `SELECT sql FROM sqlite_master WHERE type='table' AND name='conversations'`
420
450
  ).get();
@@ -475,6 +505,120 @@ function bootstrapStagentDatabase(sqlite2) {
475
505
 
476
506
  CREATE INDEX IF NOT EXISTS idx_bookmarks_chapter_id ON bookmarks(chapter_id);
477
507
  `);
508
+ sqlite2.exec(`
509
+ CREATE TABLE IF NOT EXISTS repo_imports (
510
+ id TEXT PRIMARY KEY NOT NULL,
511
+ repo_url TEXT NOT NULL,
512
+ repo_owner TEXT NOT NULL,
513
+ repo_name TEXT NOT NULL,
514
+ branch TEXT NOT NULL,
515
+ commit_sha TEXT NOT NULL,
516
+ profile_ids TEXT NOT NULL,
517
+ skill_count INTEGER NOT NULL,
518
+ last_checked_at INTEGER,
519
+ created_at INTEGER NOT NULL
520
+ );
521
+
522
+ CREATE INDEX IF NOT EXISTS idx_repo_imports_repo_url ON repo_imports(repo_url);
523
+ CREATE INDEX IF NOT EXISTS idx_repo_imports_owner_name ON repo_imports(repo_owner, repo_name);
524
+ `);
525
+ sqlite2.exec(`
526
+ CREATE TABLE IF NOT EXISTS agent_memory (
527
+ id TEXT PRIMARY KEY NOT NULL,
528
+ profile_id TEXT NOT NULL,
529
+ category TEXT NOT NULL,
530
+ content TEXT NOT NULL,
531
+ confidence INTEGER DEFAULT 700 NOT NULL,
532
+ source_task_id TEXT,
533
+ tags TEXT,
534
+ last_accessed_at INTEGER,
535
+ access_count INTEGER DEFAULT 0 NOT NULL,
536
+ decay_rate INTEGER DEFAULT 10 NOT NULL,
537
+ status TEXT DEFAULT 'active' NOT NULL,
538
+ created_at INTEGER NOT NULL,
539
+ updated_at INTEGER NOT NULL,
540
+ FOREIGN KEY (source_task_id) REFERENCES tasks(id) ON UPDATE NO ACTION ON DELETE NO ACTION
541
+ );
542
+
543
+ CREATE INDEX IF NOT EXISTS idx_agent_memory_profile_status ON agent_memory(profile_id, status);
544
+ CREATE INDEX IF NOT EXISTS idx_agent_memory_confidence ON agent_memory(confidence);
545
+ `);
546
+ sqlite2.exec(`
547
+ CREATE TABLE IF NOT EXISTS profile_test_results (
548
+ id TEXT PRIMARY KEY NOT NULL,
549
+ profile_id TEXT NOT NULL,
550
+ runtime_id TEXT NOT NULL,
551
+ report_json TEXT NOT NULL,
552
+ total_passed INTEGER DEFAULT 0 NOT NULL,
553
+ total_failed INTEGER DEFAULT 0 NOT NULL,
554
+ created_at INTEGER NOT NULL
555
+ );
556
+
557
+ CREATE INDEX IF NOT EXISTS idx_profile_test_results_profile_runtime ON profile_test_results(profile_id, runtime_id);
558
+ `);
559
+ sqlite2.exec(`
560
+ CREATE TABLE IF NOT EXISTS channel_configs (
561
+ id TEXT PRIMARY KEY NOT NULL,
562
+ channel_type TEXT NOT NULL,
563
+ name TEXT NOT NULL,
564
+ config TEXT NOT NULL,
565
+ status TEXT DEFAULT 'active' NOT NULL,
566
+ test_status TEXT DEFAULT 'untested' NOT NULL,
567
+ created_at INTEGER NOT NULL,
568
+ updated_at INTEGER NOT NULL
569
+ );
570
+
571
+ CREATE INDEX IF NOT EXISTS idx_channel_configs_type ON channel_configs(channel_type);
572
+ `);
573
+ addColumnIfMissing(`ALTER TABLE schedules ADD COLUMN delivery_channels TEXT;`);
574
+ addColumnIfMissing(`ALTER TABLE channel_configs ADD COLUMN direction TEXT DEFAULT 'outbound' NOT NULL;`);
575
+ sqlite2.exec(`
576
+ CREATE TABLE IF NOT EXISTS channel_bindings (
577
+ id TEXT PRIMARY KEY NOT NULL,
578
+ channel_config_id TEXT NOT NULL,
579
+ conversation_id TEXT NOT NULL,
580
+ external_thread_id TEXT,
581
+ runtime_id TEXT NOT NULL,
582
+ model_id TEXT,
583
+ profile_id TEXT,
584
+ status TEXT DEFAULT 'active' NOT NULL,
585
+ pending_request_id TEXT,
586
+ created_at INTEGER NOT NULL,
587
+ updated_at INTEGER NOT NULL,
588
+ FOREIGN KEY (channel_config_id) REFERENCES channel_configs(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
589
+ FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON UPDATE NO ACTION ON DELETE NO ACTION
590
+ );
591
+
592
+ CREATE INDEX IF NOT EXISTS idx_channel_bindings_config ON channel_bindings(channel_config_id);
593
+ CREATE INDEX IF NOT EXISTS idx_channel_bindings_conversation ON channel_bindings(conversation_id);
594
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_channel_bindings_config_thread ON channel_bindings(channel_config_id, external_thread_id);
595
+ `);
596
+ sqlite2.exec(`
597
+ CREATE TABLE IF NOT EXISTS agent_messages (
598
+ id TEXT PRIMARY KEY NOT NULL,
599
+ from_profile_id TEXT NOT NULL,
600
+ to_profile_id TEXT NOT NULL,
601
+ task_id TEXT,
602
+ target_task_id TEXT,
603
+ subject TEXT NOT NULL,
604
+ body TEXT NOT NULL,
605
+ attachments TEXT,
606
+ priority INTEGER DEFAULT 2 NOT NULL,
607
+ status TEXT DEFAULT 'pending' NOT NULL,
608
+ requires_approval INTEGER DEFAULT 0 NOT NULL,
609
+ approved_by TEXT,
610
+ parent_message_id TEXT,
611
+ chain_depth INTEGER DEFAULT 0 NOT NULL,
612
+ created_at INTEGER NOT NULL,
613
+ responded_at INTEGER,
614
+ expires_at INTEGER,
615
+ FOREIGN KEY (task_id) REFERENCES tasks(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
616
+ FOREIGN KEY (target_task_id) REFERENCES tasks(id) ON UPDATE NO ACTION ON DELETE NO ACTION
617
+ );
618
+
619
+ CREATE INDEX IF NOT EXISTS idx_agent_messages_to_status ON agent_messages(to_profile_id, status);
620
+ CREATE INDEX IF NOT EXISTS idx_agent_messages_task ON agent_messages(task_id);
621
+ `);
478
622
  }
479
623
  function hasLegacyStagentTables(sqlite2) {
480
624
  const placeholders = STAGENT_TABLES.map(() => "?").join(", ");
@@ -544,7 +688,7 @@ Examples:
544
688
  node dist/cli.js --data-dir ~/.stagent-dogfood --port 3100
545
689
  `;
546
690
  }
547
- program.name("stagent").description("Governed AI agent workspace").version(pkg.version).addHelpText("after", getHelpText).option("-p, --port <number>", "port to start on", "3000").option("--data-dir <path>", "custom data directory (overrides STAGENT_DATA_DIR)").option("--reset", "delete the local database before starting").option("--no-open", "don't auto-open browser").parse();
691
+ program.name("stagent").description("AI Business Operating System").version(pkg.version).addHelpText("after", getHelpText).option("-p, --port <number>", "port to start on", "3000").option("--data-dir <path>", "custom data directory (overrides STAGENT_DATA_DIR)").option("--reset", "delete the local database before starting").option("--no-open", "don't auto-open browser").parse();
548
692
  var opts = program.opts();
549
693
  if (opts.dataDir) {
550
694
  process.env.STAGENT_DATA_DIR = opts.dataDir;
@@ -0,0 +1,21 @@
1
+ {
2
+ "generated": "2026-03-31T21:00:00Z",
3
+ "totalFeatures": 31,
4
+ "coveredFeatures": 28,
5
+ "uncoveredFeatures": 3,
6
+ "coveragePercent": 90.3,
7
+ "gaps": {
8
+ "book-content-merge": {
9
+ "availableScreenshots": ["book-reader.png"],
10
+ "note": "Book reader screenshot exists but not referenced in any journey doc"
11
+ },
12
+ "book-reading-paths": {
13
+ "availableScreenshots": ["book-reader.png", "book-chapter-nav.png"],
14
+ "note": "Book navigation screenshots exist but not referenced in any journey doc"
15
+ },
16
+ "browser-tool-orchestration": {
17
+ "availableScreenshots": ["settings-browser-tools.png"],
18
+ "note": "Browser tools settings screenshot exists but not referenced in any journey doc"
19
+ }
20
+ }
21
+ }
@@ -1 +1 @@
1
- 2026-03-28T00:33:25Z
1
+ 2026-04-01T05:15:01Z
@@ -3,38 +3,36 @@ title: "Agent Intelligence"
3
3
  category: "feature-reference"
4
4
  section: "agent-intelligence"
5
5
  route: "cross-cutting"
6
- tags: [ai-assist, routing, autonomous, swarm, self-improvement, context, parallel]
7
- features: ["task-definition-ai", "multi-agent-routing", "autonomous-loop-execution", "multi-agent-swarm", "agent-self-improvement", "workflow-context-batching", "parallel-research-fork-join"]
6
+ tags: [ai-assist, routing, autonomous, swarm, self-improvement, context, parallel, episodic-memory, handoffs]
7
+ features: ["task-definition-ai", "multi-agent-routing", "autonomous-loop-execution", "multi-agent-swarm", "agent-self-improvement", "workflow-context-batching", "parallel-research-fork-join", "agent-episodic-memory", "agent-async-handoffs"]
8
8
  screengrabCount: 0
9
- lastUpdated: "2026-03-21"
9
+ lastUpdated: "2026-03-31"
10
10
  ---
11
11
 
12
12
  # Agent Intelligence
13
13
 
14
- Stagent layers several AI-powered capabilities on top of basic task execution. From one-click description improvement to multi-agent coordination, these features reduce manual effort and improve output quality across the workspace.
15
-
16
- ## Screenshots
14
+ Stagent layers several AI-powered capabilities on top of basic task execution. From one-click description improvement to multi-agent coordination, episodic memory, and async handoffs, these features reduce manual effort and improve output quality across the workspace.
17
15
 
18
16
  ## Key Features
19
17
 
20
18
  ### Task Definition AI Assist
21
19
 
22
- A single-click "AI Assist" button on the task creation form takes the current title and generates a richer, more actionable description. The improved text is previewed before applying, so the user retains full control.
20
+ A single-click "AI Assist" button on the task creation form takes the current title and generates a richer, more actionable description. The improved text is previewed before applying, so you retain full control.
23
21
 
24
22
  ### Multi-Agent Routing
25
23
 
26
- When a task is created, the task classifier analyzes its content and automatically selects the best-fit agent profile from the registry (General, Code Reviewer, Researcher, Document Writer). The selected profile can be overridden manually via the profile dropdown. Routing logic lives in `src/lib/agents/profiles/`.
24
+ When a task is created, the task classifier analyzes its content and automatically selects the best-fit agent profile from the registry. The selected profile can be overridden manually via the profile dropdown. The router considers task content, project context, profile capabilities, and runtime availability.
27
25
 
28
26
  ### Autonomous Loop Execution
29
27
 
30
28
  Tasks can run in autonomous loops with configurable stop conditions:
31
29
 
32
- - **Iteration limit** stop after N iterations.
33
- - **Time limit** stop after a duration elapses.
34
- - **Success criteria** stop when the agent reports completion.
35
- - **Error threshold** stop after repeated failures.
30
+ - **Iteration limit** -- stop after N iterations.
31
+ - **Time limit** -- stop after a duration elapses.
32
+ - **Success criteria** -- stop when the agent reports completion.
33
+ - **Error threshold** -- stop after repeated failures.
36
34
 
37
- Loops support pause and resume. The `LoopStatusView` component provides real-time progress and control.
35
+ Loops support pause and resume. The loop status view provides real-time progress and control.
38
36
 
39
37
  ### Multi-Agent Swarm
40
38
 
@@ -42,7 +40,30 @@ For complex tasks that benefit from multiple perspectives, the swarm feature coo
42
40
 
43
41
  ### Agent Self-Improvement
44
42
 
45
- Agents accumulate learned context across iterations, stored in the `learned_context` table. This context feeds back into subsequent runs, allowing agents to refine their approach over time without manual prompt tuning.
43
+ Agents accumulate learned context across iterations, stored in the database. This behavioral context feeds back into subsequent runs, allowing agents to refine their approach over time without manual prompt tuning. Context proposals require human approval before being applied.
44
+
45
+ ### Agent Episodic Memory
46
+
47
+ Distinct from behavioral learned context, episodic memory captures factual knowledge the agent discovers during task execution. Key characteristics:
48
+
49
+ - **Memory extraction** -- agents identify and store important facts, decisions, and discoveries as discrete memory entries
50
+ - **Confidence scoring** -- each memory has a confidence level based on source reliability
51
+ - **Time-based decay** -- older memories gradually lose relevance weight, keeping the context window focused on current knowledge
52
+ - **Relevance-filtered retrieval** -- when executing a new task, the agent retrieves only memories relevant to the current context
53
+ - **Operator review** -- a memory browser UI lets you inspect, edit, and delete stored memories
54
+
55
+ Episodic memory means agents build institutional knowledge over time. A financial analyst profile that researches a company once can recall that research in future tasks without re-doing the work.
56
+
57
+ ### Agent Async Handoffs
58
+
59
+ Agents can hand off work to other agents asynchronously through a message bus:
60
+
61
+ - **send_handoff tool** -- agents use this tool to delegate work to another profile
62
+ - **Governance gates** -- chain depth limits prevent infinite handoff loops, and self-handoff is blocked
63
+ - **Inbox approvals** -- handoff requests surface in the inbox for human approval before the receiving agent begins work
64
+ - **Handoff policies** -- configure which profiles can hand off to which, and under what conditions
65
+
66
+ This enables multi-agent workflows where a researcher discovers a code issue and hands it off to the code reviewer without requiring a pre-built workflow definition.
46
67
 
47
68
  ### Workflow Context Batching
48
69
 
@@ -58,3 +79,4 @@ Research tasks can be forked into concurrent sub-tasks that investigate differen
58
79
  - [Profiles](./profiles.md)
59
80
  - [Workflows](./workflows.md)
60
81
  - [Schedules](./schedules.md)
82
+ - [Inbox & Notifications](./inbox-notifications.md)
@@ -3,15 +3,15 @@ title: "Chat"
3
3
  category: "feature-reference"
4
4
  section: "chat"
5
5
  route: "/chat"
6
- tags: ["chat", "conversation", "ai", "tool-catalog", "mentions"]
7
- features: ["chat-data-layer", "chat-engine", "chat-api-routes", "chat-ui-shell", "chat-message-rendering", "chat-input-composer"]
8
- screengrabCount: 5
9
- lastUpdated: "2026-03-27"
6
+ tags: ["chat", "conversation", "ai", "tool-catalog", "mentions", "channels", "bidirectional"]
7
+ features: ["chat-data-layer", "chat-engine", "chat-api-routes", "chat-ui-shell", "chat-message-rendering", "chat-input-composer", "bidirectional-channel-chat"]
8
+ screengrabCount: 4
9
+ lastUpdated: "2026-03-31"
10
10
  ---
11
11
 
12
12
  # Chat
13
13
 
14
- The Chat page is your AI-powered command center for everything in your workspace. Instead of a blank prompt, you land on a **Tool Catalog** that organizes suggested prompts into four action-oriented categories -- Explore, Create, Debug, and Automate -- plus a Smart Picks row of personalized suggestions drawn from your actual projects, tasks, and documents. Pick a model, choose a prompt (or type your own), and get context-aware answers with direct links to the items the assistant mentions.
14
+ The Chat page is your AI-powered command center for everything in your workspace. Instead of a blank prompt, you land on a **Tool Catalog** that organizes suggested prompts into four action-oriented categories -- Explore, Create, Debug, and Automate -- plus a Smart Picks row of personalized suggestions drawn from your actual projects, tasks, and documents. Pick a model, choose a prompt (or type your own), and get context-aware answers with direct links to the items the assistant mentions. Conversations can also originate from Slack and Telegram via bidirectional delivery channels.
15
15
 
16
16
  ## Screenshots
17
17
 
@@ -27,9 +27,6 @@ The Chat page is your AI-powered command center for everything in your workspace
27
27
  ![Active conversation](../screengrabs/chat-conversation.png)
28
28
  *Active conversation with @ document context injected and streamed response with formatted markdown*
29
29
 
30
- ![Quick Access navigation](../screengrabs/chat-quick-access.png)
31
- *Response content with Quick Access navigation pills linking directly to mentioned entities*
32
-
33
30
  ## Key Features
34
31
 
35
32
  ### Tool Catalog
@@ -40,85 +37,65 @@ When no conversation is active, the chat page displays a curated grid of suggest
40
37
  - **Create** -- Prompts that help you spin up new tasks, workflows, projects, and schedules.
41
38
  - **Debug** -- Investigate failed tasks, review agent logs, and diagnose workflow issues.
42
39
  - **Automate** -- Set up scheduled loops, bulk operations, and repeating workflows.
43
- - **Smart Picks** -- A personalized row of suggestions generated from your actual workspace data. If you have a recently failed task, a prompt like "Why did [task name] fail?" appears automatically.
44
-
45
- Click any suggestion to insert it into the input and start a conversation instantly.
40
+ - **Smart Picks** -- A personalized row of suggestions generated from your actual workspace data.
46
41
 
47
42
  ### Model Selection
48
43
 
49
44
  Choose which AI model powers your conversation using the model selector at the bottom-left of the input area. Models are grouped by provider with clear cost and capability labels:
50
45
 
51
- - **Haiku 4.5** -- Fast responses at the lowest cost ($). The default choice for everyday questions.
52
- - **Sonnet 4.6** -- A balance of speed and depth ($$). Good for nuanced analysis.
53
- - **Opus 4.6** -- The most capable model ($$$). Best for complex reasoning and detailed answers.
54
- - **GPT-4o-mini** -- Fast alternative ($). Available when the Codex runtime is connected.
55
- - **GPT-4o** -- Balanced alternative ($$). Available when the Codex runtime is connected.
56
-
57
- Your preferred default model can be set in the Settings page under "Chat default model." The selection persists per conversation, so switching models mid-conversation is seamless.
46
+ - **Haiku 4.5** -- Fast responses at the lowest cost ($).
47
+ - **Sonnet 4.6** -- A balance of speed and depth ($$).
48
+ - **Opus 4.6** -- The most capable model ($$$).
49
+ - **GPT-4o-mini** / **GPT-4o** -- Available when the Codex runtime is connected.
50
+ - **Ollama models** -- Available when a local Ollama instance is connected ($0).
58
51
 
59
52
  ### @ Mentions and Context
60
53
 
61
- Type **@** in the chat input to reference a specific project, task, workflow, document, profile, or schedule by name. An autocomplete popover appears with fuzzy-searchable results grouped by entity type. When you select a mention, the assistant receives the full details of that entity as part of the conversation context -- so it can give precise, informed answers without you having to copy-paste information.
62
-
63
- The assistant also loads workspace context automatically in the background. Your active project, recent tasks, running workflows, and linked documents are all available to the model without any extra effort on your part.
54
+ Type **@** in the chat input to reference a specific project, task, workflow, document, profile, or schedule by name. An autocomplete popover appears with fuzzy-searchable results. When you select a mention, the assistant receives the full details of that entity as part of the conversation context.
64
55
 
65
56
  ### Conversation Management
66
57
 
67
- Every chat starts a new conversation that is saved automatically. Your conversation history appears in the left sidebar, sorted by most recent. Click any past conversation to pick up where you left off. You can rename, archive, or delete conversations from the context menu.
68
-
69
- On smaller screens, the conversation list is tucked behind a menu icon and slides in as an overlay so the message area gets full screen space.
58
+ Every chat starts a new conversation that is saved automatically. Your conversation history appears in the left sidebar, sorted by most recent. Channel conversations from Slack and Telegram also appear here, titled "Channel: [channel name]," so you can continue them from the web UI.
70
59
 
71
- ### Quick Access Navigation
60
+ ### Channel Conversations
72
61
 
73
- When the assistant mentions a project, task, workflow, document, or schedule in its response, navigation pills appear at the bottom of the message bubble after the response completes. Each pill shows an icon and label -- click it to jump directly to that entity's page. This turns the chat into a workspace control plane: ask a question, then navigate to the relevant item in one click.
62
+ When bidirectional chat is enabled on a Slack or Telegram delivery channel, messages sent to Stagent from those platforms create conversations visible in the Chat sidebar. The same chat engine handles both web and channel conversations, including tool access, permission handling, and multi-turn context.
74
63
 
75
64
  ### Streaming Responses
76
65
 
77
- Responses stream in token by token with a blinking cursor, so you see the answer forming in real time. A "Thinking..." indicator appears before the first token arrives. Markdown formatting -- headings, lists, code blocks with syntax highlighting, tables, and links -- renders as the text streams in. Code blocks include a copy button and language label for easy reference.
66
+ Responses stream in token by token with a blinking cursor. Markdown formatting -- headings, lists, code blocks with syntax highlighting, tables, and links -- renders as the text streams in. Code blocks include a copy button and language label.
78
67
 
79
68
  ## How To
80
69
 
81
70
  ### Start a New Conversation
82
71
 
83
72
  1. Click **Chat** in the sidebar (under the Work section).
84
- 2. Browse the tool catalog categories or type your question in the input area at the bottom.
73
+ 2. Browse the tool catalog categories or type your question in the input area.
85
74
  3. Click a suggested prompt to insert it, or type your own message.
86
- 4. Press **Enter** to send. The assistant's response streams in immediately.
75
+ 4. Press **Enter** to send. The response streams in immediately.
87
76
 
88
77
  ### Switch AI Models
89
78
 
90
- 1. Click the model selector to the left of the input area (it shows the current model name and cost tier).
91
- 2. Choose a different model from the dropdown. Models are labeled with cost tiers ($, $$, $$$).
92
- 3. Your next message will use the selected model. The choice is saved for this conversation.
93
-
94
- ### Reference Documents in Chat
95
-
96
- 1. In the chat input, type **@** followed by the name of a document, project, task, or other entity.
97
- 2. An autocomplete popover appears -- use arrow keys or click to select the entity you want.
98
- 3. The selected mention appears as a highlighted reference in your message.
99
- 4. When you send the message, the assistant receives the full context of the mentioned entity and can answer questions about it in detail.
100
-
101
- ### Navigate to Entities from Chat
102
-
103
- 1. Ask the assistant about a project, task, or other workspace item.
104
- 2. After the response finishes, look for the Quick Access pills at the bottom of the message.
105
- 3. Click a pill to navigate directly to that entity's detail page.
79
+ 1. Click the model selector to the left of the input area.
80
+ 2. Choose a different model from the dropdown. Models are labeled with cost tiers.
81
+ 3. Your next message will use the selected model.
106
82
 
107
- ### Manage Conversations
83
+ ### Reference Entities in Chat
108
84
 
109
- 1. Right-click (or long-press on mobile) a conversation in the sidebar to rename, archive, or delete it.
110
- 2. Click "New Chat" at the top of the conversation list to start a fresh conversation.
111
- 3. Archived conversations can be restored from the conversation list filters.
85
+ 1. Type **@** followed by the name of a document, project, task, or other entity.
86
+ 2. An autocomplete popover appears -- use arrow keys or click to select.
87
+ 3. The assistant receives the full context of the mentioned entity.
112
88
 
113
- ### Stop a Response
89
+ ### Chat from Slack or Telegram
114
90
 
115
- 1. While a response is streaming, the Send button changes to a Stop button (square icon).
116
- 2. Click Stop to cancel the response. The partial text is preserved in the conversation.
91
+ 1. Configure a delivery channel with Chat mode enabled (see [Settings](./settings.md)).
92
+ 2. Send a message to Stagent from Slack or Telegram.
93
+ 3. The conversation appears in the Chat sidebar and can be continued from either platform.
117
94
 
118
95
  ## Related
119
96
 
120
- - [Settings](./settings.md) -- Configure default chat model and browser tools
121
- - [Documents](./documents.md) -- Documents the assistant can summarize and reference via @ mentions
122
- - [Projects](./projects.md) -- Projects that provide context to your chat conversations
97
+ - [Settings](./settings.md) -- Configure default chat model, Ollama, and delivery channels
98
+ - [Documents](./documents.md) -- Documents the assistant can reference via @ mentions
99
+ - [Projects](./projects.md) -- Projects that provide context to conversations
123
100
  - [Profiles](./profiles.md) -- Agent profiles that shape how the assistant responds
124
- - [Dashboard Kanban](./dashboard-kanban.md) -- Manage the tasks your chat assistant references
101
+ - [Delivery Channels](./delivery-channels.md) -- Bidirectional Slack and Telegram integration
@@ -3,21 +3,24 @@ title: "Cost & Usage"
3
3
  category: "feature-reference"
4
4
  section: "cost-usage"
5
5
  route: "/costs"
6
- tags: [costs, usage, budget, metering, tokens, spend, guardrails]
6
+ tags: [costs, usage, budget, metering, tokens, spend, guardrails, ollama]
7
7
  features: ["cost-and-usage-dashboard", "usage-metering-ledger", "spend-budget-guardrails"]
8
- screengrabCount: 1
9
- lastUpdated: "2026-03-21"
8
+ screengrabCount: 2
9
+ lastUpdated: "2026-03-31"
10
10
  ---
11
11
 
12
12
  # Cost & Usage
13
13
 
14
- Track spend across providers and monitor token consumption with the cost and usage dashboard. The usage metering ledger records every token used by task, project, and provider, while budget guardrails enforce configurable spend caps to prevent runaway costs. Visual meters give you an at-a-glance view of current spend versus your configured budget.
14
+ Track spend across providers and monitor token consumption with the cost and usage dashboard. The usage metering ledger records every token used by task, project, and provider, while budget guardrails enforce configurable spend caps to prevent runaway costs. Visual meters give you an at-a-glance view of current spend versus your configured budget. Tasks executed via Ollama (local models) are tracked at $0.
15
15
 
16
16
  ## Screenshots
17
17
 
18
18
  ![Cost and usage dashboard with spend breakdown](../screengrabs/cost-usage-list.png)
19
19
  *The cost and usage dashboard showing spend metrics, provider breakdown, and budget pacing indicators.*
20
20
 
21
+ ![Cost and usage below fold](../screengrabs/cost-usage-below-fold.png)
22
+ *Detailed usage table and cost trends below the summary cards.*
23
+
21
24
  ## Key Features
22
25
 
23
26
  ### Spend Dashboard
@@ -27,10 +30,10 @@ The cost dashboard provides an overview of total spend across all provider runti
27
30
  Every agent execution records token consumption in the usage ledger. The ledger tracks input tokens, output tokens, and total tokens broken down by individual task, parent project, and provider runtime. This granular data enables precise cost attribution and optimization.
28
31
 
29
32
  ### Provider Breakdown
30
- Spend is segmented by provider runtime, showing separate cost totals for Claude (Agent SDK) and Codex (App Server). The breakdown helps you understand which provider is driving costs and make informed decisions about runtime selection.
33
+ Spend is segmented by provider runtime, showing separate cost totals for Claude (Agent SDK and Direct API), Codex (App Server and Direct API), and Ollama ($0 local). The breakdown helps you understand which provider is driving costs and make informed decisions about runtime selection.
31
34
 
32
35
  ### Budget Guardrails
33
- Configure spend caps to prevent unexpected cost overruns. Set an overall budget limit and monthly allocation splits. When spend approaches the cap, alerts notify you before the limit is reached. Once the cap is hit, guardrails can pause new executions to prevent further charges.
36
+ Configure spend caps to prevent unexpected cost overruns. Set an overall budget limit and monthly allocation splits. When spend approaches the cap, alerts notify you before the limit is reached. Once the cap is hit, guardrails pause new executions to prevent further charges.
34
37
 
35
38
  ### Visual Budget Meters
36
39
  Progress bars and visual meters display current spend relative to your configured budget. Color-coded indicators shift from green to yellow to red as spend approaches the cap, providing immediate visual feedback on budget health.
@@ -38,9 +41,9 @@ Progress bars and visual meters display current spend relative to your configure
38
41
  ## How To
39
42
 
40
43
  ### Review Current Spend
41
- 1. Navigate to `/costs` from the sidebar under the **Configure** group.
44
+ 1. Navigate to `/costs` from the sidebar under the **Manage** group.
42
45
  2. View the total spend summary at the top of the dashboard.
43
- 3. Check the provider breakdown to see Claude vs. Codex spend.
46
+ 3. Check the provider breakdown to see spend by runtime.
44
47
  4. Review the visual meters for budget pacing.
45
48
 
46
49
  ### Set a Budget Cap
@@ -52,10 +55,11 @@ Progress bars and visual meters display current spend relative to your configure
52
55
  ### Investigate High Spend
53
56
  1. Open the cost dashboard at `/costs`.
54
57
  2. Identify which provider or project is contributing the most spend.
55
- 3. Drill into the usage ledger to find high-token-count tasks.
56
- 4. Consider switching to a different provider runtime or adjusting task prompts to reduce token usage.
58
+ 3. Scroll down to the usage breakdown table for granular task-level data.
59
+ 4. Consider switching to Ollama (local models) for tasks that do not require cloud-level capability, or adjust task prompts to reduce token usage.
57
60
 
58
61
  ## Related
59
62
  - [Settings](./settings.md)
60
63
  - [Monitoring](./monitoring.md)
61
64
  - [Schedules](./schedules.md)
65
+ - [Provider Runtimes](./provider-runtimes.md)