@agent-native/core 0.26.8 → 0.27.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 (218) hide show
  1. package/dist/agent/run-ownership.d.ts +12 -0
  2. package/dist/agent/run-ownership.d.ts.map +1 -0
  3. package/dist/agent/run-ownership.js +39 -0
  4. package/dist/agent/run-ownership.js.map +1 -0
  5. package/dist/cli/index.js +2 -2
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/cli/skills.d.ts.map +1 -1
  8. package/dist/cli/skills.js +108 -3
  9. package/dist/cli/skills.js.map +1 -1
  10. package/dist/client/db-admin/DataGrid.d.ts +42 -0
  11. package/dist/client/db-admin/DataGrid.d.ts.map +1 -0
  12. package/dist/client/db-admin/DataGrid.js +204 -0
  13. package/dist/client/db-admin/DataGrid.js.map +1 -0
  14. package/dist/client/db-admin/DbAdminPage.d.ts +2 -0
  15. package/dist/client/db-admin/DbAdminPage.d.ts.map +1 -0
  16. package/dist/client/db-admin/DbAdminPage.js +72 -0
  17. package/dist/client/db-admin/DbAdminPage.js.map +1 -0
  18. package/dist/client/db-admin/DevDatabaseLink.d.ts +19 -0
  19. package/dist/client/db-admin/DevDatabaseLink.d.ts.map +1 -0
  20. package/dist/client/db-admin/DevDatabaseLink.js +25 -0
  21. package/dist/client/db-admin/DevDatabaseLink.js.map +1 -0
  22. package/dist/client/db-admin/EditableCell.d.ts +26 -0
  23. package/dist/client/db-admin/EditableCell.d.ts.map +1 -0
  24. package/dist/client/db-admin/EditableCell.js +150 -0
  25. package/dist/client/db-admin/EditableCell.js.map +1 -0
  26. package/dist/client/db-admin/FilterBar.d.ts +8 -0
  27. package/dist/client/db-admin/FilterBar.d.ts.map +1 -0
  28. package/dist/client/db-admin/FilterBar.js +68 -0
  29. package/dist/client/db-admin/FilterBar.js.map +1 -0
  30. package/dist/client/db-admin/ResultsGrid.d.ts +6 -0
  31. package/dist/client/db-admin/ResultsGrid.d.ts.map +1 -0
  32. package/dist/client/db-admin/ResultsGrid.js +41 -0
  33. package/dist/client/db-admin/ResultsGrid.js.map +1 -0
  34. package/dist/client/db-admin/RowSidePanel.d.ts +18 -0
  35. package/dist/client/db-admin/RowSidePanel.d.ts.map +1 -0
  36. package/dist/client/db-admin/RowSidePanel.js +104 -0
  37. package/dist/client/db-admin/RowSidePanel.js.map +1 -0
  38. package/dist/client/db-admin/SqlEditor.d.ts +8 -0
  39. package/dist/client/db-admin/SqlEditor.d.ts.map +1 -0
  40. package/dist/client/db-admin/SqlEditor.js +350 -0
  41. package/dist/client/db-admin/SqlEditor.js.map +1 -0
  42. package/dist/client/db-admin/TableBrowser.d.ts +10 -0
  43. package/dist/client/db-admin/TableBrowser.d.ts.map +1 -0
  44. package/dist/client/db-admin/TableBrowser.js +61 -0
  45. package/dist/client/db-admin/TableBrowser.js.map +1 -0
  46. package/dist/client/db-admin/TableEditor.d.ts +9 -0
  47. package/dist/client/db-admin/TableEditor.d.ts.map +1 -0
  48. package/dist/client/db-admin/TableEditor.js +254 -0
  49. package/dist/client/db-admin/TableEditor.js.map +1 -0
  50. package/dist/client/db-admin/cell-format.d.ts +55 -0
  51. package/dist/client/db-admin/cell-format.d.ts.map +1 -0
  52. package/dist/client/db-admin/cell-format.js +223 -0
  53. package/dist/client/db-admin/cell-format.js.map +1 -0
  54. package/dist/client/db-admin/changeset.d.ts +74 -0
  55. package/dist/client/db-admin/changeset.d.ts.map +1 -0
  56. package/dist/client/db-admin/changeset.js +169 -0
  57. package/dist/client/db-admin/changeset.js.map +1 -0
  58. package/dist/client/db-admin/export-utils.d.ts +15 -0
  59. package/dist/client/db-admin/export-utils.d.ts.map +1 -0
  60. package/dist/client/db-admin/export-utils.js +62 -0
  61. package/dist/client/db-admin/export-utils.js.map +1 -0
  62. package/dist/client/db-admin/index.d.ts +7 -0
  63. package/dist/client/db-admin/index.d.ts.map +1 -0
  64. package/dist/client/db-admin/index.js +8 -0
  65. package/dist/client/db-admin/index.js.map +1 -0
  66. package/dist/client/db-admin/sql-storage.d.ts +35 -0
  67. package/dist/client/db-admin/sql-storage.d.ts.map +1 -0
  68. package/dist/client/db-admin/sql-storage.js +117 -0
  69. package/dist/client/db-admin/sql-storage.js.map +1 -0
  70. package/dist/client/db-admin/storage.d.ts +24 -0
  71. package/dist/client/db-admin/storage.d.ts.map +1 -0
  72. package/dist/client/db-admin/storage.js +50 -0
  73. package/dist/client/db-admin/storage.js.map +1 -0
  74. package/dist/client/db-admin/useAgentSync.d.ts +22 -0
  75. package/dist/client/db-admin/useAgentSync.d.ts.map +1 -0
  76. package/dist/client/db-admin/useAgentSync.js +120 -0
  77. package/dist/client/db-admin/useAgentSync.js.map +1 -0
  78. package/dist/client/db-admin/useDbAdmin.d.ts +20 -0
  79. package/dist/client/db-admin/useDbAdmin.d.ts.map +1 -0
  80. package/dist/client/db-admin/useDbAdmin.js +154 -0
  81. package/dist/client/db-admin/useDbAdmin.js.map +1 -0
  82. package/dist/client/index.d.ts +1 -0
  83. package/dist/client/index.d.ts.map +1 -1
  84. package/dist/client/index.js +1 -0
  85. package/dist/client/index.js.map +1 -1
  86. package/dist/credentials/index.d.ts.map +1 -1
  87. package/dist/credentials/index.js +25 -5
  88. package/dist/credentials/index.js.map +1 -1
  89. package/dist/db-admin/agent-tools.d.ts +15 -0
  90. package/dist/db-admin/agent-tools.d.ts.map +1 -0
  91. package/dist/db-admin/agent-tools.js +147 -0
  92. package/dist/db-admin/agent-tools.js.map +1 -0
  93. package/dist/db-admin/operations.d.ts +17 -0
  94. package/dist/db-admin/operations.d.ts.map +1 -0
  95. package/dist/db-admin/operations.js +541 -0
  96. package/dist/db-admin/operations.js.map +1 -0
  97. package/dist/db-admin/routes.d.ts +5 -0
  98. package/dist/db-admin/routes.d.ts.map +1 -0
  99. package/dist/db-admin/routes.js +134 -0
  100. package/dist/db-admin/routes.js.map +1 -0
  101. package/dist/db-admin/types.d.ts +85 -0
  102. package/dist/db-admin/types.d.ts.map +1 -0
  103. package/dist/db-admin/types.js +9 -0
  104. package/dist/db-admin/types.js.map +1 -0
  105. package/dist/extensions/url-safety.d.ts +20 -0
  106. package/dist/extensions/url-safety.d.ts.map +1 -1
  107. package/dist/extensions/url-safety.js +43 -0
  108. package/dist/extensions/url-safety.js.map +1 -1
  109. package/dist/file-upload/actions/upload-image.d.ts.map +1 -1
  110. package/dist/file-upload/actions/upload-image.js +6 -1
  111. package/dist/file-upload/actions/upload-image.js.map +1 -1
  112. package/dist/integrations/adapters/email.d.ts.map +1 -1
  113. package/dist/integrations/adapters/email.js +112 -0
  114. package/dist/integrations/adapters/email.js.map +1 -1
  115. package/dist/integrations/types.d.ts +11 -0
  116. package/dist/integrations/types.d.ts.map +1 -1
  117. package/dist/integrations/types.js.map +1 -1
  118. package/dist/scripts/db/exec.d.ts.map +1 -1
  119. package/dist/scripts/db/exec.js +2 -1
  120. package/dist/scripts/db/exec.js.map +1 -1
  121. package/dist/scripts/db/index.d.ts.map +1 -1
  122. package/dist/scripts/db/index.js +1 -0
  123. package/dist/scripts/db/index.js.map +1 -1
  124. package/dist/scripts/db/migrate-encrypt-credentials.d.ts +28 -0
  125. package/dist/scripts/db/migrate-encrypt-credentials.d.ts.map +1 -0
  126. package/dist/scripts/db/migrate-encrypt-credentials.js +190 -0
  127. package/dist/scripts/db/migrate-encrypt-credentials.js.map +1 -0
  128. package/dist/scripts/db/query.d.ts.map +1 -1
  129. package/dist/scripts/db/query.js +2 -1
  130. package/dist/scripts/db/query.js.map +1 -1
  131. package/dist/scripts/db/safety.d.ts +1 -0
  132. package/dist/scripts/db/safety.d.ts.map +1 -1
  133. package/dist/scripts/db/safety.js +32 -0
  134. package/dist/scripts/db/safety.js.map +1 -1
  135. package/dist/scripts/db/scoping.d.ts.map +1 -1
  136. package/dist/scripts/db/scoping.js +11 -1
  137. package/dist/scripts/db/scoping.js.map +1 -1
  138. package/dist/secrets/crypto.d.ts +28 -0
  139. package/dist/secrets/crypto.d.ts.map +1 -0
  140. package/dist/secrets/crypto.js +81 -0
  141. package/dist/secrets/crypto.js.map +1 -0
  142. package/dist/secrets/storage.d.ts.map +1 -1
  143. package/dist/secrets/storage.js +3 -61
  144. package/dist/secrets/storage.js.map +1 -1
  145. package/dist/server/action-discovery.d.ts.map +1 -1
  146. package/dist/server/action-discovery.js +5 -2
  147. package/dist/server/action-discovery.js.map +1 -1
  148. package/dist/server/action-routes.d.ts.map +1 -1
  149. package/dist/server/action-routes.js +24 -7
  150. package/dist/server/action-routes.js.map +1 -1
  151. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  152. package/dist/server/agent-chat-plugin.js +39 -0
  153. package/dist/server/agent-chat-plugin.js.map +1 -1
  154. package/dist/server/auth.d.ts +1 -1
  155. package/dist/server/auth.d.ts.map +1 -1
  156. package/dist/server/auth.js.map +1 -1
  157. package/dist/server/better-auth-instance.js +3 -3
  158. package/dist/server/better-auth-instance.js.map +1 -1
  159. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  160. package/dist/server/core-routes-plugin.js +5 -0
  161. package/dist/server/core-routes-plugin.js.map +1 -1
  162. package/dist/server/csrf.d.ts.map +1 -1
  163. package/dist/server/csrf.js +9 -1
  164. package/dist/server/csrf.js.map +1 -1
  165. package/dist/server/design-token-utils.d.ts +8 -1
  166. package/dist/server/design-token-utils.d.ts.map +1 -1
  167. package/dist/server/design-token-utils.js +12 -4
  168. package/dist/server/design-token-utils.js.map +1 -1
  169. package/dist/templates/default/AGENTS.md +4 -4
  170. package/dist/templates/default/app/routes/database.tsx +13 -0
  171. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +9 -2
  172. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +7 -1
  173. package/dist/vite/client.d.ts.map +1 -1
  174. package/dist/vite/client.js +4 -0
  175. package/dist/vite/client.js.map +1 -1
  176. package/docs/content/a2a-protocol.md +2 -2
  177. package/docs/content/actions.md +2 -54
  178. package/docs/content/agent-mentions.md +1 -1
  179. package/docs/content/agent-teams.md +1 -1
  180. package/docs/content/authentication.md +2 -2
  181. package/docs/content/cli-adapters.md +33 -17
  182. package/docs/content/client.md +11 -20
  183. package/docs/content/code-agents-ui.md +19 -6
  184. package/docs/content/context-awareness.md +36 -20
  185. package/docs/content/database.md +3 -3
  186. package/docs/content/deployment.md +8 -8
  187. package/docs/content/dispatch.md +1 -1
  188. package/docs/content/external-agents.md +5 -1
  189. package/docs/content/faq.md +1 -0
  190. package/docs/content/frames.md +110 -30
  191. package/docs/content/getting-started.md +15 -14
  192. package/docs/content/mcp-clients.md +1 -1
  193. package/docs/content/mcp-protocol.md +11 -88
  194. package/docs/content/messaging.md +1 -1
  195. package/docs/content/migration-workbench.md +13 -87
  196. package/docs/content/multi-app-workspace.md +2 -38
  197. package/docs/content/multi-tenancy.md +3 -26
  198. package/docs/content/onboarding.md +10 -3
  199. package/docs/content/recurring-jobs.md +2 -2
  200. package/docs/content/security.md +33 -1
  201. package/docs/content/server.md +1 -1
  202. package/docs/content/skills-guide.md +7 -4
  203. package/docs/content/template-assets.md +9 -9
  204. package/docs/content/template-brain.md +114 -388
  205. package/docs/content/template-clips.md +42 -2
  206. package/docs/content/template-content.md +1 -1
  207. package/docs/content/template-design.md +38 -0
  208. package/docs/content/template-dispatch.md +3 -3
  209. package/docs/content/template-forms.md +6 -6
  210. package/docs/content/template-starter.md +2 -2
  211. package/docs/content/using-your-agent.md +56 -0
  212. package/docs/content/workspace-management.md +6 -6
  213. package/docs/content/workspace.md +19 -0
  214. package/package.json +10 -3
  215. package/src/templates/default/AGENTS.md +4 -4
  216. package/src/templates/default/app/routes/database.tsx +13 -0
  217. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +9 -2
  218. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +7 -1
@@ -26,13 +26,40 @@ this product decision?", "how does this in-development feature work?", or "what
26
26
  changed in this process?" with links back to the source conversation, meeting,
27
27
  or issue.
28
28
 
29
- Brain's shipped shape is company chat plus cited, reviewed memory over approved
30
- sources. The current template also includes Brain-wide search across knowledge,
31
- captures, and source records, plus reusable workspace connections for source
32
- credentials. Broader federated workspace search and expertise ranking are
33
- platform direction, not something you need to set up on day one.
29
+ ## What you can do with it
30
+
31
+ - **Ask cited questions.** Ask is the main product surface: a clean chat over
32
+ reviewed company memory, with source health, review count, and suggested
33
+ questions kept secondary. Every answer links back to the Slack thread,
34
+ meeting, issue, or capture that supports it.
35
+ - **Connect approved sources.** Configure manual, generic webhook, Clips, Slack,
36
+ Granola, and GitHub sources. Sources are org-shared by default so company
37
+ memory is useful to the whole workspace.
38
+ - **Review before publishing.** Proposed memories get a first-class Review route
39
+ where reviewers edit wording, inspect evidence/source links, and approve or
40
+ reject. High-confidence, non-sensitive entries can publish immediately;
41
+ company-tier or sensitive entries queue as proposals.
42
+ - **Inspect cited knowledge.** The Knowledge route shows distilled, atomic
43
+ entries with kind, topic, entities, confidence, exact evidence quotes, and
44
+ supersede links.
45
+ - **Reuse workspace integrations.** Brain sources can reuse shared workspace
46
+ connection grants instead of re-entering provider tokens. The Sources page
47
+ shows Brain source records beside reusable connection grants and provider
48
+ readiness.
49
+ - **Mirror approved memory as ambient context.** Canonical approved entries can
50
+ mirror into workspace resources under `context/company-brain/...` so other
51
+ apps can use them as context. Both flows preview the exact Markdown before the
52
+ resource is written or removed.
53
+
54
+ ## Useful prompts
34
55
 
35
- ## Start Here
56
+ - "What did we decide about annual pricing, and where was that discussed?"
57
+ - "Find the most recent onboarding-process change and cite the source."
58
+ - "Summarize what this GitHub discussion means for the launch plan."
59
+ - "Review the pending memory proposals and flag anything too vague to publish."
60
+ - "Which sources are stale or failing sync?"
61
+
62
+ ## Getting started
36
63
 
37
64
  1. **Try the demo.** Open Ask and choose **Start demo**. Brain seeds a small
38
65
  product-decision corpus, runs the trust checks, and asks a cited question so
@@ -46,89 +73,55 @@ platform direction, not something you need to set up on day one.
46
73
  4. **Ask from the source.** Use Ask for questions that should be grounded in
47
74
  approved knowledge, not raw chat logs.
48
75
 
49
- ## Useful Prompts
76
+ For a public demo, the seeded corpus demonstrates product-decision recall,
77
+ citation links, supersede behavior, review gating, redaction, personal-content
78
+ exclusion, and honest not-found behavior without connecting a real workspace.
50
79
 
51
- - "What did we decide about annual pricing, and where was that discussed?"
52
- - "Find the most recent onboarding-process change and cite the source."
53
- - "Summarize what this GitHub discussion means for the launch plan."
54
- - "Review the pending memory proposals and flag anything too vague to publish."
55
- - "Which sources are stale or failing sync?"
80
+ ### Scaffolding
56
81
 
57
- ## What It Includes
58
-
59
- - **Full-page company chat.** The Ask route is the main product surface: a
60
- clean chat over cited company memory with source health, review count, and
61
- suggested questions kept secondary. It uses `AgentChatSurface`, so the Brain
62
- composer stays on the same shared chat input stack as the agent sidebar and
63
- Agent-Native Code.
64
- - **Repeatable demo flow.** Load a product-decision corpus, run the demo eval,
65
- ask a cited question immediately, then continue into Review or Knowledge so a
66
- new workspace can see the trust loop before connecting real sources.
67
- - **Approved sources.** Configure manual, generic webhook, Clips, Slack,
68
- Granola, and GitHub source records. Sources are org-shared by default so the
69
- company memory is useful to the whole workspace. Slack is channel-oriented by
70
- design; DMs and MPIMs are not scan targets.
71
- - **Raw captures.** Store transcripts, channel exports, notes, and webhook imports in portable SQL with dedupe keys and source metadata.
72
- - **Distilled knowledge.** Write atomic entries with kind, topic, entities, confidence, exact evidence quotes, and supersede links.
73
- - **Review queue.** Proposed company memories have a first-class Review route
74
- where reviewers edit wording, inspect evidence/source links, approve, or
75
- reject. Reviewers can also choose whether an approved proposal becomes
76
- canonical company context immediately.
77
- - **Review gating.** High-confidence non-sensitive entries can publish immediately; company-tier or sensitive entries can queue as proposals for approval.
78
- - **Cited retrieval.** V1 exposes `search-knowledge` and `get-knowledge` for
79
- distilled company memory. The V1.5 expansion adds a Search route and
80
- `search-everything` action for searching knowledge, raw captures, and source
81
- records together, then drilling into `get-knowledge` / `get-capture`.
82
- - **Pilot and Ops controls.** Slack pilots stay bounded by default, `get-pilot-report` summarizes source quality without raw bodies, and the Ops route tracks stale or failed distillation queue items with safe retry controls.
83
- - **Shared integrations.** The Sources page shows Brain source records beside
84
- reusable workspace connection grants and provider readiness. Reusable
85
- integrations own provider identity, credential references, and app grants;
86
- Brain sources own app-specific choices such as channels, repositories,
87
- cursors, review posture, and distillation state. The provider-reader runtime
88
- gives shared provider search/get contracts; live provider API calls stay
89
- template-owned unless a reader is explicitly promoted to shared.
90
- - **Ambient context.** Canonical approved entries can mirror into workspace
91
- resources under `context/company-brain/...` for cross-app context. The Review
92
- route exposes this as a per-proposal switch; the Knowledge route can publish
93
- or unpublish approved memories later with `set-knowledge-canonical`. Both
94
- flows preview the exact Markdown through `preview-canonical-resource` before
95
- the resource is written or removed.
96
-
97
- Brain intentionally uses SQL text search and agentic query expansion for v1.
98
- There is no vector database requirement, so the template stays portable across
99
- SQLite, Postgres, Neon, D1, Turso, and similar hosts. Privacy is handled with
100
- source allow-lists, personal-source exclusions, redaction, and review gates.
101
- Raw capture content is redacted by default in review/search surfaces;
102
- editor-authorized distillation can request exact raw text for quote validation.
103
-
104
- ## Search Model
105
-
106
- Brain search has three layers:
107
-
108
- - **V1 Company Brain search:** answer from reviewed, distilled knowledge first.
109
- This is the trust layer for decisions, policies, product facts, processes,
110
- and durable summaries.
111
- - **V1.5 Brain-wide search:** use `search-everything` as the broad first
112
- pass across knowledge, raw captures, and sources. Then call `get-knowledge`
113
- for reviewed entries or `get-capture` for exact source context and links.
114
- The action also returns `federatedCoverage`: Brain source/provider coverage,
115
- reusable workspace connection readiness, compact discovered agent metadata
116
- when available, and deterministic hints for which specialist app the agent
117
- should ask next.
118
- - **V2 federated workspace search:** reuse workspace connections and search
119
- across apps/sources with permission-aware result filtering and ranking. The
120
- expertise graph belongs to this future/platform layer. V1.5 does not directly
121
- read sibling app databases; cross-app work is delegated from the agent loop
122
- with `call-agent`.
123
-
124
- Agents should cite evidence links or source URLs whenever available. If Brain
125
- does not return support for a question, the agent should report that honestly
126
- instead of implying the company memory contains an answer.
127
-
128
- Use `federatedCoverage.delegationHints` as routing guidance, not as retrieved
129
- evidence: Analytics owns dashboards/metrics, Mail/Gmail owns mailbox-native
130
- search, and Dispatch owns workspace resources, provider grants, approvals,
131
- secrets, recurring jobs, and cross-app routing.
82
+ ```bash
83
+ pnpm dlx @agent-native/core create my-brain --template brain --standalone
84
+ ```
85
+
86
+ Then open the app, add sources, import a transcript, and ask the agent to
87
+ distill cited memories from the raw capture.
88
+
89
+ ## Connecting sources
90
+
91
+ Brain resolves provider credentials from a granted workspace connection first,
92
+ then from backward-compatible Brain-local or registered vault credentials.
93
+ Brain source credentials do not fall back to deploy-level environment variables.
94
+ If a shared provider already exists, grant Brain access instead of copying the
95
+ same secret into a Brain-specific setting.
96
+
97
+ **Slack.** Create a source scoped to specific channel IDs. The connector
98
+ verifies each configured conversation, rejects DMs and MPIMs, and stores cursor
99
+ state so each sync resumes where the last one stopped. A safe rollout flow on
100
+ each Slack source card lets you **Test** the credential and allow-list without
101
+ reading history, run a tiny capped **Safe pilot** sample, **Review captures**,
102
+ and approve in the **Review queue** before anything becomes queryable. Grant the
103
+ bot only the scopes the source needs (credential validation, allow-list
104
+ verification, allow-listed channel history, and durable permalinks).
105
+
106
+ **Granola.** Create a source with a polling window and page size. Granola
107
+ Enterprise API keys expose Team-space notes, not private notes or folders. Brain
108
+ stores the note summary, transcript, attendees, calendar metadata, and source
109
+ URL as a raw capture before distillation.
110
+
111
+ **GitHub.** Create a source scoped to approved repositories. The connector
112
+ imports bounded issue and pull-request context with stable source URLs that can
113
+ be distilled like Slack or meeting context. This is Brain context ingestion, not
114
+ a replacement for Analytics-style GitHub reporting.
115
+
116
+ **Clips and generic webhooks.** Brain exposes a signed webhook for Clips and
117
+ generic transcript/capture imports at `/api/_agent-native/brain/ingest`. Create
118
+ a source with a `sourceKey` to receive a bearer token, then send a
119
+ `RawCapturePayload` with `Authorization: Bearer <ingestToken>`. Generic sources
120
+ use the same payload shape for call transcripts, customer research, imported
121
+ notes, or any other source that can produce a bounded capture.
122
+
123
+ Slack, Granola, and GitHub sources can opt into background `autoSync` with a
124
+ poll cadence once review quality is proven.
132
125
 
133
126
  ## Brain vs Dispatch
134
127
 
@@ -145,299 +138,29 @@ In a multi-app workspace, Dispatch can route a question to Brain over A2A and
145
138
  can grant Brain shared provider credentials. Brain remains the specialist for
146
139
  approved source ingestion, review, retrieval, and cited Company Brain answers.
147
140
  Brain exposes read-only, citation-backed retrieval as its public A2A capability
148
- so Dispatch and sibling apps can ask company-memory questions. That is not
149
- anonymous data access: the A2A agent card is public discovery metadata, while
150
- retrieval still happens inside Brain's authenticated action surface. Callers
151
- ask over A2A, then Brain uses `ask-brain`, `search-everything`,
152
- `get-knowledge`, and `get-capture` with its normal review, redaction, citation,
153
- and source-access rules.
154
-
155
- ## Scaffolding
156
-
157
- ```bash
158
- pnpm dlx @agent-native/core create my-brain --template brain --standalone
159
- ```
160
-
161
- Then open the app, add sources, import a transcript, and ask the agent to distill cited memories from the raw capture.
162
-
163
- For a public demo, open the Ask page and choose **Start demo**. Brain seeds the
164
- product-decision corpus, runs the demo eval, asks the cited freemium question,
165
- then offers Review and Knowledge follow-ups. The seeded corpus demonstrates
166
- product-decision recall, citation links, supersede behavior, review gating,
167
- redaction, personal-content exclusion, and honest not-found behavior without
168
- connecting a real workspace.
169
-
170
- ## Generic Ingest
171
-
172
- Brain exposes a signed webhook for Clips and generic transcript/capture imports
173
- at:
174
-
175
- ```txt
176
- /api/_agent-native/brain/ingest
177
- ```
178
-
179
- Create a source with a `sourceKey` to receive a bearer token, then send a `RawCapturePayload`:
180
-
181
- ```json
182
- {
183
- "sourceKey": "clips",
184
- "externalId": "meeting-123",
185
- "title": "Pricing decision review",
186
- "participants": ["Ada", "Grace"],
187
- "occurredAt": "2026-05-15T15:00:00.000Z",
188
- "transcript": "We decided to keep annual pricing because...",
189
- "sourceUrl": "https://example.com/share/meeting-123",
190
- "tags": ["pricing", "product"],
191
- "raw": {}
192
- }
193
- ```
194
-
195
- Set `Authorization: Bearer <ingestToken>` on the request. Clips can export to
196
- that endpoint without Brain reading the Clips database directly. Generic sources
197
- use the same payload shape for call transcripts, customer research, imported
198
- notes, or any other source that can produce a bounded capture.
199
-
200
- ## Slack Backfill
201
-
202
- Brain resolves `SLACK_BOT_TOKEN` from a granted Slack workspace connection
203
- first, then from backward-compatible Brain-local or registered vault
204
- credentials. It scans only channels that an admin configures on the source:
205
-
206
- ```bash
207
- pnpm --filter brain action create-source \
208
- --title "Slack product channels" \
209
- --provider slack \
210
- --visibility org \
211
- --config '{"channelIds":["C0123456789"],"historyLimit":15}'
212
- ```
213
-
214
- The connector verifies each configured conversation before reading history and
215
- rejects DMs and MPIMs. Cursor state is stored on the source so each sync can pick
216
- up where the last one stopped, including after Slack rate limiting.
217
-
218
- Use `test-slack-connection` before a production backfill. It validates the
219
- Slack bot token with `auth.test` and, when channel refs are provided, checks
220
- channel metadata without reading message history.
221
-
222
- For Slack, grant the bot the smallest scopes needed for the source:
223
-
224
- - `auth.test` for credential validation.
225
- - `conversations.info` for allow-list verification and DM/MPIM rejection.
226
- - `conversations.history` for allow-listed channel history.
227
- - `chat.getPermalink` for durable citations.
228
- - `conversations.list` only when setup resolves channel names instead of IDs.
229
-
230
- Private channels require inviting the bot to the channel. Public channels may
231
- also require joining or inviting the bot depending on the Slack app posture.
232
-
233
- For local CLI/action-runner QA, put `SLACK_BOT_TOKEN` in a workspace connection,
234
- registered vault secret, or Brain-local app credential before running source
235
- actions. Brain source connectors intentionally do not read process environment
236
- variables directly, so `.env.local` alone is not a credential source.
237
-
238
- Use `run-slack-pilot` for a safer first-pass rollout report. The default action
239
- validates the Slack credential and allow-listed channels, reports guardrails,
240
- privacy exclusions, current knowledge/proposal counts, and next steps, and does
241
- not call `conversations.history`. Only pass `readHistory: true` when the user
242
- explicitly wants a tiny sample sync; the pilot caps the read to two validated
243
- channels, one page per channel, ten messages per page, ten permalinks,
244
- `autoSync: false`, and a recent default history window.
245
-
246
- After a sample sync succeeds, list the imported inventory before opening raw
247
- message bodies:
248
-
249
- ```bash
250
- pnpm --filter brain action list-captures \
251
- --sourceId <source-id> \
252
- --status queued
253
- ```
254
-
255
- The listing omits raw capture content by default and includes each capture's
256
- latest distillation queue state. Use `get-capture` for one specific record when
257
- a reviewer or agent needs exact source context, then write only durable, cited
258
- knowledge. Keep `autoSync` disabled until the channel allow-list, review gate,
259
- and first distilled entries are validated.
260
-
261
- The Sources UI has the same flow: open **Captures** on a source card to review
262
- queued records, opt into short previews only when needed, queue distillation,
263
- see whether a capture is waiting on the distillation worker, or mark non-company
264
- material ignored.
265
-
266
- Slack source cards expose this as a clean rollout flow: **Test** checks the
267
- credential and allow-list without history reads, **Safe pilot** imports only a
268
- tiny capped sample, **Review captures** opens the capture inventory, and
269
- **Review queue** sends reviewers to approve proposals before they become
270
- queryable company memory.
271
-
272
- Use `get-pilot-report` after a sample sync to inspect sync health, capture
273
- counts, queue state, published knowledge, pending proposals, privacy notes, and
274
- recommended rollout steps without returning raw capture bodies.
275
-
276
- Recommended production rollout:
277
-
278
- 1. Start with one or two high-signal channels and channel IDs.
279
- 2. Keep `autoSync: false` until review quality is proven.
280
- 3. Run `test-slack-connection`, then `run-slack-pilot` without history.
281
- 4. Run one explicit `run-slack-pilot --readHistory true` sample when the report
282
- is clean.
283
- 5. Review captures with previews only when needed; ignore social, personal, or
284
- thin records.
285
- 6. Distill durable company context, approve proposal-gated memories, and verify
286
- `ask-brain` returns cited Slack permalinks.
287
- 7. Expand with bounded manual `sync-source` runs before enabling background
288
- polling.
289
-
290
- When approving a proposal, keep the company-context switch off unless the
291
- memory should be ambient context for Dispatch and other apps. Turn it on for
292
- canonical decisions, policies, product facts, or durable process notes that are
293
- safe to place under `context/company-brain/...`; Brain shows the exact Markdown
294
- preview before approval publishes it. Use the Knowledge route or
295
- `set-knowledge-canonical --published=false` to remove a mirrored resource after
296
- previewing what will be removed, without deleting the underlying Brain
297
- knowledge.
298
-
299
- Distillation has two worker paths. When a Brain tab is open, the app shell
300
- claims queued items with `claim-distillation` and delegates them to the app
301
- agent in the background. When no tab is open, the `brain-distillation` server
302
- sweep runs with `RUN_BACKGROUND_JOBS`, claims due queued rows, reclaims stale
303
- `processing` rows, and invokes the same agent loop headlessly. Re-running
304
- `enqueue-distillation` for an active queue item refreshes the handoff instead
305
- of duplicating queue rows. The agent reads the capture, writes cited knowledge
306
- or review proposals, then calls `mark-capture-distilled`, which marks the
307
- active queue row done. If the agent does not close the queue, the worker
308
- requeues the item with a short delay and eventually fails it after repeated
309
- attempts.
310
-
311
- The Ops route is the operator view for distillation. It lists queued,
312
- processing, failed, done, stale, and retryable handoffs, backed by
313
- `list-distillation-queue` and `retry-distillation`.
314
-
315
- ## Granola Polling
316
-
317
- Brain resolves `GRANOLA_API_KEY` from a granted Granola workspace connection
318
- first, then from backward-compatible Brain-local or registered vault
319
- credentials. It polls Granola's public API for notes, then fetches each note
320
- with its transcript:
321
-
322
- ```bash
323
- pnpm --filter brain action create-source \
324
- --title "Granola team notes" \
325
- --provider granola \
326
- --visibility org \
327
- --config '{"pageSize":10,"updatedAfter":"2026-05-01T00:00:00.000Z"}'
328
- ```
329
-
330
- Granola Enterprise API keys expose Team-space notes, not private notes or
331
- private folders. Brain stores the note summary, transcript, attendees, calendar
332
- metadata, and source URL as a raw capture before distillation.
333
-
334
- ## GitHub Connector
335
-
336
- GitHub is Brain's first reusable connector proof. It resolves `GITHUB_TOKEN`
337
- from a granted GitHub workspace connection first, then from backward-compatible
338
- Brain-local or registered vault credentials, and imports bounded issue and pull
339
- request context from approved repositories:
340
-
341
- ```bash
342
- pnpm --filter brain action create-source \
343
- --title "GitHub product repos" \
344
- --provider github \
345
- --visibility org \
346
- --config '{"repositories":["owner/repo"],"state":"all","limit":25}'
347
- ```
348
-
349
- The connector accepts `repositories` or `repos`, optional `state`, `limit`,
350
- `includeIssues`, and `includePullRequests`. Imported items become raw captures
351
- with stable source URLs and can be distilled like Slack or meeting context. This
352
- is intentionally Brain context ingestion, not a replacement for Analytics-style
353
- GitHub reporting.
354
-
355
- ## Shared Workspace Connections
356
-
357
- Brain sources can reuse shared workspace connections when Dispatch or another
358
- workspace setup has already connected a provider and granted `appId=brain`
359
- access. The source record still belongs to Brain: it stores channel ids,
360
- repositories, sync cursors, review settings, and other source-specific choices,
361
- while the provider credential stays in the workspace vault behind a connection
362
- or grant credential ref.
363
-
364
- The `list-connection-providers` action returns each Brain provider with
365
- connection counts, grant state, credential reference names, credential health,
366
- and whether Brain has access. It never returns credential values. Source sync
367
- resolves credentials in this order:
368
-
369
- 1. Granted `workspace_connections` / `workspace_connection_grants` credential
370
- refs for `appId=brain`.
371
- 2. Backward-compatible Brain-local SQL credentials.
372
- 3. Registered vault secrets for the same user/org/workspace scope.
373
-
374
- Brain source credentials do not fall back to deploy-level environment
375
- variables. If a shared provider exists but has not been granted to Brain, grant
376
- Brain access instead of copying the same secret into a Brain-specific setting.
377
-
378
- Keep the ownership model simple:
379
-
380
- - Reusable workspace integrations own provider identity, account metadata,
381
- credential ref names, and app grants.
382
- - Dispatch is the workspace control plane where admins usually connect, repair,
383
- and grant those integrations.
384
- - The vault owns the secret values.
385
- - Brain owns source-local choices such as Slack channels, GitHub repositories,
386
- Granola polling windows, cursors, review posture, and distillation status.
387
- - Agents should inspect connection readiness first, then request a grant or
388
- source configuration instead of asking the user for another provider token.
389
-
390
- The Sources page surfaces the same provider catalog. A provider can be:
391
-
392
- - `connected` when an active workspace connection is already granted to Brain.
393
- - `granted` when Brain can access the connection but it is not currently active.
394
- - `needs_grant` when the workspace has a connection that has not been granted to
395
- Brain.
396
- - `not_connected` when Brain is using scoped credentials or has no connection
397
- yet.
398
-
399
- The page also shows provider readiness: ready, grant needed, needs repair,
400
- missing keys, or metadata only. Agents should inspect this same readiness via
401
- `list-connection-providers` before asking users for duplicate Slack, Granola,
402
- GitHub, or future provider credentials.
403
-
404
- ## Scheduled Sync
405
-
406
- The Sources page includes a setup sheet for Slack, Granola, GitHub, Clips,
407
- generic webhooks, and manual imports. Slack, Granola, and GitHub sources can
408
- opt into `autoSync` with a `pollMinutes` cadence. Use `sync-source` for a
409
- single source, `sync-due-sources` for all due accessible sources, or enable
410
- `RUN_BACKGROUND_JOBS=1` locally to let the Brain background job poll due sources
411
- from the Nitro process.
412
-
413
- ## Demo and Eval
414
-
415
- Brain ships with a repeatable product-decision demo corpus. `seed-demo-data`
416
- loads Slack, Clips, Granola, and webhook-style captures; creates cited knowledge
417
- about retiring freemium, how Decision Digest works, and why product decisions
418
- are the lead demo; queues a policy-sensitive proposal; redacts an email; and
419
- keeps a personal aside out of queryable knowledge.
420
-
421
- `run-demo-eval` checks the behavior that matters most for trust: recall,
422
- citations, supersede links, proposal gating, redaction, and personal-content
423
- exclusion. The Ask page includes a compact **Start demo** CTA for empty
424
- workspaces and reveals Review, Knowledge, and **Run eval** follow-ups once the
425
- demo is ready.
426
-
427
- `run-retrieval-eval` checks an offline real-channel-style retrieval set. It
428
- uses existing workspace Brain data when the expected branch-safety answers
429
- already have citation-backed support; otherwise, with `seedIfMissing` enabled,
430
- it seeds a small Slack-style fallback corpus and re-runs the same checks. The
431
- result covers Slack-style citations, branch-safety terms, and an unsupported
432
- cleanup-cron not-found case. The same mode is available through `run-demo-eval`
433
- with `mode: "retrieval"`.
434
-
435
- The repository-level `pnpm test` command includes `pnpm test:brain-evals`, which
436
- runs Brain's product-demo and retrieval action evals against a disposable local
437
- SQLite database. The CI/prep eval path is fully seeded and offline; it does not
438
- require production Slack, Granola, Clips, or any external workspace data.
439
-
440
- ## Privacy And Gating
141
+ so Dispatch and sibling apps can ask company-memory questions the A2A agent
142
+ card is public discovery metadata, while retrieval still happens inside Brain's
143
+ authenticated action surface.
144
+
145
+ ## Data model overview
146
+
147
+ Brain intentionally uses SQL text search and agentic query expansion. There is
148
+ no vector database requirement, so the template stays portable across SQLite,
149
+ Postgres, Neon, D1, Turso, and similar hosts.
150
+
151
+ - **Sources** hold connector configuration: provider, allow-listed channels or
152
+ repositories, sync cursors, review posture, and distillation state.
153
+ - **Raw captures** store transcripts, channel exports, notes, and webhook
154
+ imports in portable SQL with dedupe keys and source metadata. Raw content is
155
+ redacted from listing/search surfaces by default.
156
+ - **Distilled knowledge** holds atomic entries with kind, topic, entities,
157
+ confidence, exact evidence quotes, and supersede links.
158
+ - **Proposals** queue company-tier or sensitive entries for review before they
159
+ become durable company memory.
160
+ - **Application state** mirrors route, filters, and selected IDs so the agent
161
+ always knows the current navigation and selection.
162
+
163
+ ## Privacy and gating
441
164
 
442
165
  Brain is designed for company memory, not personal surveillance:
443
166
 
@@ -451,18 +174,21 @@ Brain is designed for company memory, not personal surveillance:
451
174
  - Settings control default publish tier, whether company-tier knowledge requires
452
175
  approval, citation requirements, email redaction, and connector error
453
176
  notifications.
454
- - Demo/eval coverage checks proposal gating, PII redaction, personal-content
455
- exclusion, citations, real-channel-style retrieval, and honest not-found
456
- behavior.
457
177
 
458
- ## Developer Notes
178
+ ## Customizing it
459
179
 
460
180
  The template follows the agent-native four-area contract:
461
181
 
462
- - **UI:** Ask, Search, Knowledge, Review, Sources, Ops, and Settings routes.
463
- - **Actions:** imports, source management, pilot reports, distillation queueing/claiming/retry, proposal review, cited search, and navigation/context actions.
464
- - **Skills/instructions:** Brain-specific guidance for distillation and retrieval.
465
- - **Application state:** route, filters, and selected IDs mirror into `application_state` for agent context.
182
+ - **UI:** Ask, Search, Knowledge, Review, Sources, and Settings routes.
183
+ - **Actions:** imports, source management, pilot reports, distillation, proposal
184
+ review, cited search, and navigation/context actions.
185
+ - **Skills/instructions:** Brain-specific guidance for distillation and
186
+ retrieval in `templates/brain/.agents/skills/`.
187
+ - **Application state:** route, filters, and selected IDs mirror into
188
+ `application_state` for agent context.
189
+
190
+ Ask the agent to make changes for you — it can edit its own source. See
191
+ [Self-Modifying Code](/docs/key-concepts#agent-modifies-code).
466
192
 
467
193
  See [Dispatch](/docs/dispatch) for the workspace control plane, the
468
194
  [Dispatch template](/docs/template-dispatch) for the scaffolded app,
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: "Clips"
3
- description: "Async screen recording (Loom-style), calendar-synced meeting notes (Granola-style), and push-to-talk voice dictation (Wisprflow-style) — all transcribed, summarized, and searchable in one app you own."
3
+ description: "Async screen recording, calendar-synced meeting notes, and push-to-talk voice dictation — all transcribed, summarized, and searchable in one app you own."
4
4
  ---
5
5
 
6
6
  # Clips
7
7
 
8
- A capture-everything app: screen recordings (Loom-style), meeting notes from your calendar (Granola-style), and Fn-hold voice dictation (Wisprflow-style). The agent transcribes, titles, summarizes, and indexes all of it — then lets you ask "find the clip where we discussed the rollout plan" and searches across every transcript you've ever made.
8
+ A capture-everything app: screen recordings, meeting notes from your calendar, and Fn-hold voice dictation. The agent transcribes, titles, summarizes, and indexes all of it — then lets you ask "find the clip where we discussed the rollout plan" and searches across every transcript you've ever made.
9
9
 
10
10
  <!-- screenshot:
11
11
  app: clips
@@ -69,6 +69,46 @@ pnpm dlx @agent-native/core create my-clips --template clips --standalone
69
69
 
70
70
  Clips is a larger template with a native recorder (it ships a desktop companion for local capture). See the template `README.md` for setup specifics around screen-capture permissions and storage configuration.
71
71
 
72
+ ### Data model
73
+
74
+ All data lives in SQL via Drizzle ORM. Schema: `templates/clips/server/db/schema.ts`. Recordings, meetings, dictations, calendar accounts, and vocabulary all carry the standard `ownableColumns` and have a matching framework shares table, so they slot into the per-user / per-org sharing model.
75
+
76
+ | Table | What it holds |
77
+ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
78
+ | `recordings` | The core resource — title, video URL/format/size, duration, thumbnails, status, non-destructive `edits_json`, `chapters_json`, privacy (password, expiry), and player toggles |
79
+ | `recording_transcripts` | Per-recording transcript: `segments_json` (`{startMs,endMs,text}`), `full_text`, language, and status |
80
+ | `recording_tags` | Free-form tags on a recording |
81
+ | `recording_ctas` | Call-to-action buttons (label, url, color, placement) overlaid on a recording |
82
+ | `recording_comments` | Threaded, timestamped comments with emoji-reaction map and resolved flag |
83
+ | `recording_reactions` | Emoji reactions pinned to a video timestamp (anonymous viewers allowed) |
84
+ | `recording_viewers` / `recording_events` | View analytics: per-viewer watch time and completion, plus granular events (view-start, watch-progress, seek, pause, cta-click, reaction) |
85
+ | `clips_meetings` | Calendar-sourced or ad-hoc meetings — schedule/actual spans, platform, user notes, AI `summary_md`, `bullets_json`, `action_items_json`, and the link to its `recording_id` |
86
+ | `meeting_participants` / `meeting_action_items` | Attendees and extracted action items for a meeting |
87
+ | `calendar_accounts` / `calendar_events` | Connected calendar accounts (OAuth tokens live in `app_secrets`, only referenced here) and synced event snapshots |
88
+ | `clips_dictations` | Push-to-talk dictation history — raw `full_text`, optional `cleaned_text`, source (`fn-hold`, etc.), and target app |
89
+ | `clips_vocabulary` | Personal vocabulary corrections (term → preferred replacement) that bias future dictations |
90
+ | `spaces` / `space_members` / `folders` | Library organization — spaces (topic-scoped containers), their members, and nestable folders |
91
+ | `organization_settings` | Per-org Clips sidecar: brand color, logo, default visibility |
92
+
93
+ Recordings and transcripts are intentionally separate tables so the library and transcript views can each render fast. Meetings compose with recordings rather than duplicating media: a meeting owns the recording it captures, but the `recordings` row remains the source of truth for the video and per-segment transcript.
94
+
95
+ Routes in the UI live under `templates/clips/app/routes/` — the authenticated app sits under `_app.*` (library, spaces, folders, meetings, dictate, insights, trash, settings), with public surfaces at `r.$recordingId`, `share.$shareId`, `embed.$shareId`, and `invite.$token`.
96
+
97
+ ### Key actions
98
+
99
+ Every agent-callable operation is a TypeScript file in `templates/clips/actions/`, auto-mounted at `POST /_agent-native/actions/:name` and runnable from the CLI as `pnpm action <name>`. There are ~80 actions; the useful groupings:
100
+
101
+ - **Recording lifecycle** — `create-recording`, `finalize-recording`, `update-recording`, `set-thumbnail`, `archive-recording` / `restore-recording` / `trash-recording` / `delete-recording-permanent`, `move-recording`, `tag-recording`.
102
+ - **Transcript & AI** — `request-transcript`, `cleanup-transcript`, `regenerate-title` / `regenerate-summary` / `regenerate-chapters`, `set-chapters`, `generate-workflow`. (`cleanup-transcript` and `finalize-meeting` are server-side media-pipeline calls; most other AI features delegate to the agent chat.)
103
+ - **Editing** — non-destructive `trim-recording`, `split-recording`, `remove-filler-words`, `remove-silences`, plus `stitch-recordings`, `undo-edit`, `clear-edits`. Edits accumulate in `edits_json`; the client concatenates/exports via ffmpeg.wasm.
104
+ - **Meetings** — `create-meeting`, `start-meeting-recording` / `stop-meeting-recording`, `finalize-meeting`, `update-meeting`, `get-meeting`, `list-meetings`, plus calendar wiring `connect-calendar` / `disconnect-calendar` / `sync-calendars` / `list-calendar-accounts`.
105
+ - **Dictation** — `create-dictation`, `cleanup-dictation`, `update-dictation`, `list-dictations`, and `add-vocabulary-term` / `list-vocabulary` for personal vocabulary biasing.
106
+ - **Library organization** — `create-space` / `rename-space` / `delete-space`, `add-space-member` / `remove-space-member`, `create-folder` / `rename-folder` / `delete-folder`, `add-recording-to-space`.
107
+ - **Sharing, comments & engagement** — framework sharing actions plus `create-cta` / `update-cta` / `delete-cta`, `add-comment` / `reply-to-comment` / `resolve-comment` / `react-to-comment` / `delete-comment`, `react-to-recording`, `list-viewers`.
108
+ - **Organizations & members** — `create-organization`, `set-organization-branding`, `invite-member` / `accept-invite` / `decline-invite` / `get-invite`, `remove-member`, `update-member-role`, `list-organization-state`, `list-notifications`.
109
+ - **Search, insights & export** — `search-recordings` (matches titles, descriptions, transcript text, and comments, with timestamps), `get-recording-insights`, `get-organization-insights`, `export-insights-csv`, `export-to-brain`.
110
+ - **Context & navigation** — `view-screen` (current clip, playhead, selected transcript range) and `navigate`; `refresh-list` after mutations.
111
+
72
112
  ### Customize it
73
113
 
74
114
  Clips is a complete, cloneable template — fork it and ask the agent to extend it. Some examples:
@@ -58,7 +58,7 @@ pnpm install
58
58
  pnpm dev
59
59
  ```
60
60
 
61
- Open `http://localhost:8080` and create your first page. The agent panel is on the right — try asking it to "create a page called Onboarding and add three sub-pages under it".
61
+ Open `http://localhost:8083` and create your first page. The agent panel is on the right — try asking it to "create a page called Onboarding and add three sub-pages under it".
62
62
 
63
63
  ### Key features (technical) {#key-features}
64
64