@agent-native/core 0.84.21 → 0.84.23

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 (137) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +16 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/agent/model-config.ts +1 -1
  5. package/corpus/core/src/cli/skills.ts +17 -3
  6. package/corpus/core/src/client/AssistantChat.tsx +27 -4
  7. package/corpus/core/src/client/guided-questions.tsx +11 -6
  8. package/corpus/core/src/client/tool-display.ts +8 -0
  9. package/corpus/core/src/file-upload/builder.ts +7 -2
  10. package/corpus/core/src/notifications/channels.ts +235 -38
  11. package/corpus/core/src/notifications/index.ts +1 -0
  12. package/corpus/core/src/notifications/registry.ts +13 -1
  13. package/corpus/core/src/server/analytics.ts +32 -6
  14. package/corpus/core/src/server/ssr-handler.ts +31 -12
  15. package/corpus/core/src/templates/default/.agents/skills/frontend-design/SKILL.md +2 -0
  16. package/corpus/core/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +2 -0
  17. package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +2 -0
  18. package/corpus/templates/analytics/AGENTS.md +21 -0
  19. package/corpus/templates/analytics/README.md +35 -0
  20. package/corpus/templates/analytics/actions/delete-analytics-alert-rule.ts +23 -0
  21. package/corpus/templates/analytics/actions/list-analytics-alert-rules.ts +20 -0
  22. package/corpus/templates/analytics/actions/run-analytics-alerts.ts +23 -0
  23. package/corpus/templates/analytics/actions/save-analytics-alert-rule.ts +69 -0
  24. package/corpus/templates/analytics/changelog/2026-07-01-analytics-can-alert-when-first-party-events-spike.md +6 -0
  25. package/corpus/templates/analytics/changelog/2026-07-01-session-replays-play-back-in-production-instead-of-showing.md +6 -0
  26. package/corpus/templates/analytics/netlify.toml +3 -0
  27. package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +126 -0
  28. package/corpus/templates/analytics/server/db/schema.ts +55 -0
  29. package/corpus/templates/analytics/server/handlers/session-replay.ts +5 -2
  30. package/corpus/templates/analytics/server/jobs/analytics-alerts.ts +74 -0
  31. package/corpus/templates/analytics/server/lib/analytics-alerts.ts +803 -0
  32. package/corpus/templates/analytics/server/lib/session-replay.ts +10 -3
  33. package/corpus/templates/analytics/server/plugins/analytics-alert-jobs.ts +54 -0
  34. package/corpus/templates/analytics/server/plugins/db.ts +100 -0
  35. package/corpus/templates/analytics/server/routes/api/analytics-alerts/run.post.ts +60 -0
  36. package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +2 -0
  37. package/corpus/templates/assets/README.md +30 -8
  38. package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +2 -0
  39. package/corpus/templates/brain/README.md +20 -552
  40. package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +2 -0
  41. package/corpus/templates/calendar/README.md +22 -28
  42. package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +2 -0
  43. package/corpus/templates/chat/README.md +32 -0
  44. package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +2 -0
  45. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +30 -1
  46. package/corpus/templates/clips/README.md +37 -0
  47. package/corpus/templates/clips/actions/finalize-recording.ts +84 -4
  48. package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +256 -0
  49. package/corpus/templates/clips/actions/reprocess-recording.ts +160 -0
  50. package/corpus/templates/clips/app/components/library/library-grid.tsx +18 -7
  51. package/corpus/templates/clips/app/components/library/recording-card.tsx +42 -5
  52. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +41 -1
  53. package/corpus/templates/clips/changelog/2026-07-01-move-to-folder-now-opens-folder-choices-directly-instead-of.md +6 -0
  54. package/corpus/templates/clips/changelog/2026-07-01-shared-clips-now-start-playing-and-scrub-instantly-instead-o.md +6 -0
  55. package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
  56. package/corpus/templates/clips/server/lib/video-remux.ts +222 -0
  57. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +37 -0
  58. package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +2 -0
  59. package/corpus/templates/content/AGENTS.md +7 -3
  60. package/corpus/templates/content/README.md +22 -34
  61. package/corpus/templates/content/actions/list-trashed-content-databases.ts +4 -0
  62. package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +58 -6
  63. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +257 -24
  64. package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +41 -15
  65. package/corpus/templates/content/app/i18n/zh-TW.ts +25 -7
  66. package/corpus/templates/content/app/i18n-data.ts +278 -40
  67. package/corpus/templates/content/changelog/2026-06-30-database-once-again-creates-an-inline-database-in-the-curren.md +6 -0
  68. package/corpus/templates/content/shared/api.ts +1 -0
  69. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +75 -19
  70. package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +2 -0
  71. package/corpus/templates/design/AGENTS.md +7 -6
  72. package/corpus/templates/design/README.md +33 -0
  73. package/corpus/templates/design/actions/delete-file.ts +86 -10
  74. package/corpus/templates/design/actions/get-design-snapshot.ts +13 -0
  75. package/corpus/templates/design/actions/present-design-variants.ts +11 -13
  76. package/corpus/templates/design/app/hooks/use-question-flow.ts +2 -2
  77. package/corpus/templates/design/app/pages/DesignEditor.tsx +13 -3
  78. package/corpus/templates/design/changelog/2026-07-01-design-chat-no-longer-shows-an-empty-state-selection-chip-in-the-composer.md +6 -0
  79. package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +2 -0
  80. package/corpus/templates/dispatch/README.md +34 -0
  81. package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +2 -0
  82. package/corpus/templates/forms/README.md +34 -0
  83. package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +2 -0
  84. package/corpus/templates/macros/README.md +28 -0
  85. package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +2 -0
  86. package/corpus/templates/mail/README.md +35 -0
  87. package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +2 -0
  88. package/corpus/templates/plan/README.md +30 -118
  89. package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +2 -0
  90. package/corpus/templates/slides/README.md +34 -0
  91. package/corpus/templates/videos/.agents/skills/frontend-design/SKILL.md +2 -0
  92. package/corpus/templates/videos/README.md +22 -201
  93. package/dist/agent/model-config.js +1 -1
  94. package/dist/agent/model-config.js.map +1 -1
  95. package/dist/cli/skills.d.ts.map +1 -1
  96. package/dist/cli/skills.js +17 -3
  97. package/dist/cli/skills.js.map +1 -1
  98. package/dist/client/AssistantChat.d.ts.map +1 -1
  99. package/dist/client/AssistantChat.js +28 -4
  100. package/dist/client/AssistantChat.js.map +1 -1
  101. package/dist/client/guided-questions.d.ts.map +1 -1
  102. package/dist/client/guided-questions.js +10 -6
  103. package/dist/client/guided-questions.js.map +1 -1
  104. package/dist/client/tool-display.d.ts.map +1 -1
  105. package/dist/client/tool-display.js +8 -0
  106. package/dist/client/tool-display.js.map +1 -1
  107. package/dist/collab/routes.d.ts +1 -1
  108. package/dist/file-upload/builder.d.ts.map +1 -1
  109. package/dist/file-upload/builder.js +6 -2
  110. package/dist/file-upload/builder.js.map +1 -1
  111. package/dist/notifications/channels.d.ts +10 -0
  112. package/dist/notifications/channels.d.ts.map +1 -1
  113. package/dist/notifications/channels.js +172 -20
  114. package/dist/notifications/channels.js.map +1 -1
  115. package/dist/notifications/index.d.ts +1 -1
  116. package/dist/notifications/index.d.ts.map +1 -1
  117. package/dist/notifications/index.js +1 -1
  118. package/dist/notifications/index.js.map +1 -1
  119. package/dist/notifications/registry.d.ts +5 -0
  120. package/dist/notifications/registry.d.ts.map +1 -1
  121. package/dist/notifications/registry.js +4 -1
  122. package/dist/notifications/registry.js.map +1 -1
  123. package/dist/progress/routes.d.ts +1 -1
  124. package/dist/resources/handlers.d.ts +1 -1
  125. package/dist/server/analytics.d.ts +16 -0
  126. package/dist/server/analytics.d.ts.map +1 -1
  127. package/dist/server/analytics.js +30 -7
  128. package/dist/server/analytics.js.map +1 -1
  129. package/dist/server/ssr-handler.d.ts.map +1 -1
  130. package/dist/server/ssr-handler.js +28 -12
  131. package/dist/server/ssr-handler.js.map +1 -1
  132. package/dist/server/transcribe-voice.d.ts +1 -1
  133. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +2 -0
  134. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +2 -0
  135. package/package.json +1 -1
  136. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +2 -0
  137. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +2 -0
@@ -1,564 +1,32 @@
1
- # Agent-Native Brain
1
+ # Brain
2
2
 
3
- Brain is clean company chat backed by cited institutional knowledge. People ask
4
- questions in the Ask route; Brain answers from approved company knowledge with
5
- links back to the Slack thread, meeting, transcript, issue, or webhook capture
6
- that supports the answer. Sources, Review, and Knowledge are the admin/support
7
- surfaces for connecting data, approving proposals, and inspecting cited knowledge.
3
+ An open-source, agent-native alternative to Glean — clean company chat backed by
4
+ cited institutional knowledge. Ask a plain-English question and get an answer
5
+ from approved company knowledge, with links back to the source.
8
6
 
9
- Brain ingests approved Slack channels, Clips recordings, Granola Team-space
10
- notes, GitHub issues/PRs, and generic transcript/webhook payloads. Transcript
11
- style captures pass through a pre-storage privacy filter first, so Brain stores
12
- the company-relevant capture text rather than the full raw call transcript or
13
- provider payload. It then distills imported captures into reviewable SQL-backed
14
- knowledge with source links.
7
+ **Live app: [brain.agent-native.com](https://brain.agent-native.com)**
15
8
 
16
- The product direction is intentionally Glean-shaped, but the shipped V1 is not a
17
- full enterprise search replacement. Brain starts with open-source company knowledge
18
- over reviewed knowledge, then expands toward broader, permission-aware
19
- workspace search.
9
+ Brain ingests approved Slack channels, meetings, transcripts, GitHub issues/PRs,
10
+ and webhook captures, distills them into reviewable knowledge, and answers with
11
+ exact evidence quotes and source links instead of guesses.
20
12
 
21
- ## Version Direction
13
+ ## Features
22
14
 
23
- - **V1 Company Brain:** clean company chat over SQL-backed, reviewed,
24
- distilled knowledge with exact evidence quotes and source links.
25
- - **V1.5 Search:** a Search route and `search-everything` action for searching
26
- distilled knowledge, raw captures, and source records together. Agents should
27
- use it as the broad first pass, then open records with `get-knowledge` or
28
- `get-capture`. The response also includes `federatedCoverage` metadata that
29
- names Brain source/provider coverage, workspace connection readiness, compact
30
- discovered agent metadata when available, and deterministic delegation hints.
31
- It does not directly search sibling apps.
32
- - **V1.5 shared integrations:** reusable workspace connections let Brain source
33
- sync use provider credentials granted from Dispatch or the workspace layer.
34
- The provider-reader runtime gives shared contracts for provider search/get
35
- shapes, but live provider API calls stay template-owned unless a reader is
36
- explicitly promoted to shared.
37
- - **V2 platform direction:** federated search across apps and sources,
38
- permission-aware result ranking, and an expertise graph as a future/platform
39
- layer.
40
- - **Portability:** V1 uses portable SQL text search and agentic query expansion.
41
- There is no vector database requirement.
15
+ - Company chat that answers from cited, reviewed knowledge — not hallucinations.
16
+ - Source connectors for Slack, Granola, GitHub, Clips, and generic webhooks.
17
+ - Pre-storage privacy filter and review queue before knowledge becomes durable.
18
+ - Portable SQL text search and agentic query expansion no vector database required.
19
+ - Read-only, citation-backed retrieval exposed to other apps over A2A.
42
20
 
43
- ## Product Shape
21
+ ## Develop locally
44
22
 
45
- - **Full-page company chat:** the Ask route is the main surface. It runs
46
- `AgentChatSurface` in page mode and only surfaces setup/review attention when
47
- action is needed. Keep this route on `AgentChatSurface` so Brain uses the
48
- same composer UX as the agent sidebar and Agent-Native Code.
49
- - **Demo and evals stay out of the product UI:** seed product-decision sources
50
- and run trust evals from actions/CLI/docs, not as prominent Ask-page controls.
51
- - **Search and drill-in:** the hidden Search route uses `search-everything` across
52
- knowledge, raw captures, and source records, then agents can open exact
53
- records with `get-knowledge` or `get-capture`. Cross-app expansion is exposed
54
- as delegation guidance, not as hidden reads from other apps.
55
- - **Review queue:** the Review route lists pending/approved/rejected proposals,
56
- lets reviewers edit proposed knowledge text, inspect evidence/source links, and
57
- approve or reject. Reviewers can publish approved proposals as shared
58
- `context/company-brain/...` workspace context when the knowledge should be
59
- ambient for Dispatch and other apps.
60
- - **Source setup:** the Sources route leads with configured sources and one
61
- clear Add source action. Provider catalog, source filtering, health checks,
62
- and maintenance syncs live under Advanced. Sources are org-shared by default
63
- so approved knowledge benefits the whole workspace.
64
- - **Ops and settings:** Ops stays available as an advanced/debug route for
65
- queued, processing, stale, failed, and done distillation work. Settings
66
- controls assistant identity, source posture, default publish tier,
67
- company-knowledge approval, citations, redaction, and connector notifications.
68
-
69
- ## Brain vs Dispatch
70
-
71
- Brain is the company-knowledge specialist. It ingests approved sources, reviews
72
- captures, distills durable facts and decisions, and answers from citations.
73
-
74
- Dispatch is the workspace control plane. It owns central messaging, the shared
75
- secrets vault, cross-app A2A routing, recurring jobs, approvals, and the
76
- distribution and approval of workspace-wide resources. In a workspace, Dispatch
77
- can route questions to Brain and grant Brain shared provider credentials, but
78
- Brain remains the place where company knowledge is ingested, reviewed, searched,
79
- and cited. Brain exposes
80
- read-only, citation-backed retrieval as its public A2A capability so Dispatch
81
- and sibling apps can ask company-knowledge questions. That is not anonymous data
82
- access: Brain's A2A agent card can be discovered publicly, but actual retrieval
83
- stays behind the authenticated A2A/action boundary and uses the same review,
84
- redaction, citation, and source-access rules as in-app Brain searches.
85
-
86
- ## Start
23
+ Scaffold your own copy and run it:
87
24
 
88
25
  ```bash
26
+ npx @agent-native/core@latest create my-brain --standalone --template brain
27
+ cd my-brain
89
28
  pnpm install
90
- pnpm --filter brain dev
91
- ```
92
-
93
- Useful checks:
94
-
95
- ```bash
96
- pnpm --filter brain typecheck
97
- pnpm --filter brain build
98
- ```
99
-
100
- ## Core Flow
101
-
102
- 1. Check `get-brain-health` for the next first-run step, source freshness,
103
- pending proposals, queue issues, and the last retrieval eval score.
104
- 2. Create a source with `create-source`.
105
- 3. Run `sync-source` for Slack/Granola/GitHub sources, import a transcript with
106
- `import-transcript`, import raw text with `import-capture`, or POST a signed
107
- `RawCapturePayload` to `/api/_agent-native/brain/ingest`.
108
- 4. Review the raw capture inventory with `list-captures` or the Sources page,
109
- then queue durable-company-context captures with `enqueue-distillation`.
110
- 5. Distillation runs through the app agent: the open-tab bridge claims queued
111
- work immediately, and the `brain-distillation` background sweep handles
112
- queued or stale work when `RUN_BACKGROUND_JOBS` is enabled. The agent reads
113
- the capture, writes cited knowledge or proposals with `write-knowledge`, and
114
- closes the queue with `mark-capture-distilled`.
115
- 6. Monitor failed or stale handoffs in the Ops route, or with
116
- `list-distillation-queue` and `retry-distillation`.
117
- 7. Review queued proposals in the Review route. Reviewers can edit a pending
118
- proposal with `update-proposal`, then approve it with `approve-proposal` or
119
- reject it with `reject-proposal`. Use `--publishCanonical true` only for
120
- approved memories that should also be mirrored into workspace context. Brain
121
- previews the exact Markdown first with `preview-canonical-resource`; the
122
- Knowledge route and `set-knowledge-canonical` action can publish or unpublish
123
- canonical context later without deleting the Brain knowledge row.
124
- 8. Ask Brain or another workspace agent to search broadly with
125
- `search-everything` when the V1.5 search surface is available, then drill
126
- into `get-knowledge` / `get-capture` for cited answers. In V1-only
127
- workspaces, use `search-knowledge` and `get-knowledge`.
128
-
129
- ## Agent Retrieval Pattern
130
-
131
- Agents should treat Brain as cited company knowledge, not a guess engine:
132
-
133
- - Start with `search-everything` for broad questions so knowledge, raw captures,
134
- and sources can all be considered. Inspect `federatedCoverage` before
135
- claiming "everything": it shows what Brain actually searched, which provider
136
- connections are visible/granted, and whether the agent should next use
137
- `call-agent` for Analytics dashboards, Mail/Gmail mailbox search, or Dispatch
138
- workspace resources/provider grants.
139
- - Use `get-knowledge` for reviewed facts, decisions, policies, and durable
140
- summaries.
141
- - Use `get-capture` when the answer needs source context, exact quote checking,
142
- or a direct link back to a meeting/transcript/message. Capture content is
143
- redacted by default; pass `includeRawContent: true` only for
144
- editor-authorized distillation or exact quote validation.
145
- - Cite links from evidence or capture metadata whenever available.
146
- - If Brain does not contain supporting results, say that the answer was not
147
- found instead of filling in from general knowledge.
148
- - Cross-app delegation happens in the agent loop through `call-agent`. Brain
149
- actions stay deterministic and read-only; they report coverage and hints but
150
- do not call sibling app agents or read sibling app databases.
151
-
152
- ## Privacy And Gating
153
-
154
- Brain is scoped to company knowledge, not personal surveillance:
155
-
156
- - Slack sync reads only configured channels and rejects DMs/MPIMs.
157
- - Granola sync reads Team-space notes exposed by Granola's API, not private
158
- notes or private folders.
159
- - Source setup should use allow-lists, exclusions, redaction, and review gates
160
- before broad sync is enabled.
161
- - Raw capture bodies are omitted from list/search responses by default. Use
162
- previews for intentional human review and `includeRawContent` only for
163
- distillation or exact quote validation.
164
- - Source configs default to review-required, and Settings can require approval
165
- for company-tier knowledge before publishing.
166
- - Settings can require citations, auto-redact emails, and notify reviewers when
167
- connectors degrade.
168
- - `run-demo-eval` covers proposal gating, PII redaction, personal-content
169
- exclusion, citation presence, and honest not-found behavior.
170
- - `run-retrieval-eval` covers offline real-channel-style retrieval, using
171
- existing workspace data when #dev-fusion/stale Fusion branch support is
172
- already present and seeding fallback Slack-style data when absent.
173
-
174
- ## Slack Source Config
175
-
176
- Slack resolves `SLACK_BOT_TOKEN` from a granted workspace connection first,
177
- then from backward-compatible Brain-local or registered vault credentials. It
178
- only scans configured channels and rejects DMs/MPIMs.
179
-
180
- ```bash
181
- pnpm --filter brain action create-source \
182
- --title "Slack product channels" \
183
- --provider slack \
184
- --visibility org \
185
- --config '{"channelIds":["C0123456789"],"historyLimit":15}'
186
- ```
187
-
188
- Useful config keys:
189
-
190
- - `channelIds`, `channels`, or `allowedChannels`: Slack channel IDs or names to
191
- scan.
192
- - `historyLimit`: page size per channel. Keep this small for non-Marketplace
193
- Slack apps because `conversations.history` can be heavily rate limited.
194
- - `oldest` / `updatedAfter`: optional timestamp boundary for initial backfill.
195
- - `autoSync` and `pollMinutes`: opt the source into background polling and set
196
- the cadence. Background polling runs when `RUN_BACKGROUND_JOBS=1` in dev, and
197
- by default in production unless `RUN_BACKGROUND_JOBS=0`.
198
-
199
- Slack scopes for the bot token should be the smallest set that supports the
200
- configured source:
201
-
202
- - `auth.test`: validate the token before any history read.
203
- - `conversations.info`: verify allow-listed conversations and reject DMs/MPIMs.
204
- - `conversations.history`: read message history from allow-listed channels.
205
- - `chat.getPermalink`: store durable citation links for each capture.
206
- - `conversations.list`: optional, only when a setup flow resolves channel names
207
- instead of using channel IDs.
208
-
209
- Private channels require inviting the bot to the channel. Public channels may
210
- also require an explicit join/invite depending on the Slack app posture.
211
-
212
- For CLI/action-runner tests, store `SLACK_BOT_TOKEN` through a workspace
213
- connection or Brain/app credential first. The source credential resolver does
214
- not read process environment variables directly; a token in `.env.local` alone
215
- is only useful after it has been copied into the local credential store for the
216
- test user.
217
-
218
- Before reading real Slack history, run a credential/channel smoke test:
219
-
220
- ```bash
221
- pnpm --filter brain action test-slack-connection \
222
- --channelRefs '["C0123456789"]'
223
- ```
224
-
225
- This calls Slack `auth.test` and optional channel metadata checks only. It never
226
- calls `conversations.history`.
227
-
228
- For a fuller rollout report, use the Slack pilot workflow:
229
-
230
- ```bash
231
- pnpm --filter brain action run-slack-pilot \
232
- --sourceId <source-id>
233
- ```
234
-
235
- The default pilot validates credentials and allow-listed channels, summarizes
236
- guardrails, privacy exclusions, current knowledge/proposal counts, and next
237
- steps, and still reads no history. Only run a tiny sample sync when explicitly
238
- requested:
239
-
240
- ```bash
241
- pnpm --filter brain action run-slack-pilot \
242
- --sourceId <source-id> \
243
- --readHistory true
244
- ```
245
-
246
- Pilot sync caps reads to two validated channels, one history page per channel,
247
- ten messages per page, ten permalinks, `autoSync: false`, and a recent default
248
- history window.
249
-
250
- For a production rollout, keep the first pass deliberately narrow:
251
-
252
- 1. Create one Slack source for one or two high-signal channels, using channel
253
- IDs where possible.
254
- 2. Keep `autoSync: false` while testing and reviewing the first imported
255
- captures.
256
- 3. Run `test-slack-connection`, then `run-slack-pilot` without `readHistory`.
257
- 4. If the report is clean, run one tiny `run-slack-pilot --readHistory true`
258
- sample.
259
- 5. Review imported captures with previews only when needed; mark social,
260
- personal, or thin messages ignored.
261
- 6. Distill only durable company context, approve proposal-gated memories, and
262
- confirm `ask-brain` cites the expected Slack permalinks.
263
- 7. Expand the page/window manually with bounded `sync-source` runs before
264
- turning on `autoSync`.
265
-
266
- After the first sample succeeds, review capture inventory before distillation:
267
-
268
- ```bash
269
- pnpm --filter brain action list-captures \
270
- --sourceId <source-id> \
271
- --status queued
272
- ```
273
-
274
- `list-captures` omits raw message bodies by default and includes the latest
275
- distillation queue state for each capture. Pass `--includePreview true` only
276
- when a human is intentionally reviewing snippets. Open individual records with
277
- `get-capture`; use `--includeRawContent true` only for distillation or exact
278
- quote validation. Distill durable company context into `write-knowledge`, and
279
- keep `autoSync` disabled until the source rules and review behavior look right.
280
-
281
- After any pilot sync, generate the source-level quality report:
282
-
283
- ```bash
284
- pnpm --filter brain action get-pilot-report \
285
- --sourceId <source-id>
286
- ```
287
-
288
- The report summarizes sync health, capture counts, distillation queue state,
289
- published knowledge, pending proposals, privacy notes, and recommended next
290
- steps without returning raw capture bodies. It also includes a compact
291
- `pilotTrustLane` for the real `#dev-fusion` pilot: a status, four checks,
292
- minimal next actions, and eval questions to run before broadening sync.
293
-
294
- The Sources page exposes the same review inventory from each source card. Open
295
- **Captures** to inspect queued records, enable short previews only when needed,
296
- queue distillation for durable context, see whether a capture is waiting on the
297
- distillation worker, or mark non-company material ignored.
298
-
299
- For Slack sources, the source card presents the recommended pilot path as a
300
- minimal four-step flow: **Test** validates credentials and the allow-list
301
- without history reads, **Safe pilot** imports a tiny capped sample,
302
- **Review captures** opens the raw inventory, and **Review queue** takes
303
- reviewers to proposal approval before memories become durable company
304
- knowledge. Opening **Report** shows the same trust lane inline so operators can
305
- see whether `#dev-fusion` is blocked, needs distillation, needs review, needs
306
- retrieval eval, or is ready for a narrow expansion.
307
-
308
- Distillation has two worker paths. When a Brain tab is open, the app shell
309
- claims queued items with `claim-distillation` and hands them to the app agent in
310
- the background. When no tab is open, the `brain-distillation` server sweep runs
311
- with `RUN_BACKGROUND_JOBS`, claims due queued rows, reclaims stale `processing`
312
- rows, and invokes the same agent loop headlessly. Re-running
313
- `enqueue-distillation` for an active queue item refreshes the handoff instead
314
- of duplicating queue rows. The agent reads the capture, writes cited knowledge
315
- or review proposals, then calls `mark-capture-distilled`, which marks the
316
- active queue row done. If the agent does not close the queue, the worker requeues
317
- the item with a short delay and eventually fails it after repeated attempts.
318
-
319
- The Ops route is the operator surface for that pipeline. It shows queued,
320
- processing, failed, done, stale, and retryable distillation work. The matching
321
- actions are `list-distillation-queue` and `retry-distillation`; retries are
322
- allowed only for failed or stale processing items the current user can edit.
323
-
324
- ## Granola Source Config
325
-
326
- Granola resolves `GRANOLA_API_KEY` from a granted workspace connection first,
327
- then from backward-compatible Brain-local or registered vault credentials, and
328
- polls `https://public-api.granola.ai/v1/notes`. Enterprise API keys expose
329
- Team-space notes; private notes are not included by Granola's API.
330
-
331
- ```bash
332
- pnpm --filter brain action create-source \
333
- --title "Granola team notes" \
334
- --provider granola \
335
- --visibility org \
336
- --config '{"pageSize":10,"updatedAfter":"2026-05-01T00:00:00.000Z"}'
337
- ```
338
-
339
- Brain persists Granola cursors in the source cursor JSON and normalizes note
340
- summary, transcript, attendees, calendar metadata, and `web_url` into imported
341
- captures. Before SQL insert, the sanitizer filters the title/body down to
342
- company-relevant content and strips raw transcript segments, attendees, owner,
343
- and calendar objects from metadata. Safe linkage such as `sourceUrl`, connector,
344
- sync run id, and note timestamps remains available for review/citations.
345
-
346
- ## GitHub Source Config
347
-
348
- GitHub is Brain's first reusable connector proof. It resolves `GITHUB_TOKEN`
349
- from a granted workspace connection first, then from backward-compatible
350
- Brain-local or registered vault credentials, and imports bounded issue/PR
351
- context from configured repositories through GitHub's REST API. This is company
352
- context for Brain ingestion, not full GitHub analytics.
353
-
354
- ```bash
355
- pnpm --filter brain action create-source \
356
- --title "GitHub product repos" \
357
- --provider github \
358
- --visibility org \
359
- --config '{"repositories":["owner/repo"],"state":"all","limit":25}'
360
- ```
361
-
362
- Useful config keys:
363
-
364
- - `repositories` or `repos`: repository slugs like `owner/repo`.
365
- - `state`: `open`, `closed`, or `all`; defaults to `all`.
366
- - `limit`: bounded page size per repository, capped by the connector.
367
- - `includeIssues` / `includePullRequests`: disable either side when a source
368
- should capture only issues or only PRs.
369
- - `linkedSlackSourceIds`, `slackSourceIds`, or `linkedSourceIds`: import GitHub
370
- issue and PR URLs found in accessible Slack Brain captures.
371
- - `linkedCaptureLimit`, `linkedRefLimit`, `linkedDetailLimit`, `commentLimit`,
372
- `reviewLimit`, and `repoDetailLimit`: keep linked imports bounded.
373
-
374
- ## Workspace Connections
375
-
376
- `list-connection-providers` returns the Brain provider catalog plus
377
- `workspaceConnection`, `credentialHealth`, and `providerHealth` summaries for
378
- `appId=brain`. Use those summaries before asking for duplicate provider
379
- credentials:
380
-
381
- - `grantState: "connected"` means Brain already has a granted workspace
382
- connection for that provider.
383
- - `grantState: "granted"` means Brain has a grant, but the connection is not
384
- currently active.
385
- - `grantState: "needs_grant"` means a workspace connection exists but still
386
- needs a Brain grant.
387
- - `grantState: "not_connected"` means there is no shared connection for Brain
388
- yet, though Brain-local or registered vault credentials may still exist.
389
-
390
- Source sync resolves credentials in this order:
391
-
392
- 1. A source's configured `workspaceConnectionId`, when present.
393
- 2. Granted `workspace_connections` / `workspace_connection_grants` credential
394
- refs for `appId=brain`.
395
- 3. Brain-local SQL credentials.
396
- 4. Registered vault secrets for the same user/org/workspace scope.
397
-
398
- `workspaceConnectionId` is non-secret source config. Use it when a workspace has
399
- multiple Slack, Granola, or GitHub connections and a source must use one exact
400
- shared integration. Bound sources are strict: if the selected connection is
401
- missing, not granted to Brain, unhealthy, or missing the required vault-backed
402
- credential ref, sync fails with that specific message instead of silently using
403
- another shared connection or Brain-local credential. Leave it unset for the
404
- legacy automatic fallback behavior.
405
-
406
- It does not fall back to deploy-level environment variables for source
407
- credentials. Connection and grant refs point at vault secret names; they never
408
- contain raw credential values.
409
-
410
- The Sources route shows the same shared integration state in the provider
411
- catalog, including readiness labels such as ready, grant needed, missing keys,
412
- needs repair, or metadata only. Use Dispatch to connect or grant reusable
413
- workspace credentials, then create Brain sources against those providers
414
- without copying secret values into the Brain app.
415
-
416
- The boundary is intentional:
417
-
418
- - Reusable workspace integrations own provider identity, account metadata,
419
- credential ref names, and per-app grants.
420
- - Dispatch is the workspace control plane where admins usually connect, repair,
421
- and grant those integrations.
422
- - The vault owns the secret values.
423
- - Brain owns source-specific choices: Slack channel IDs, GitHub repositories,
424
- Granola polling windows, sync cursors, review posture, and distillation state.
425
- - Agents should inspect shared connection readiness first, then ask for a Brain
426
- grant or source config instead of asking for another raw provider token.
427
-
428
- ## Scheduled Sync
429
-
430
- Use `sync-source` to run one source immediately, or `sync-due-sources` to run
431
- accessible Slack/Granola sources whose `autoSync` cadence is due. The Nitro
432
- plugin in `server/plugins/brain-jobs.ts` registers the same due-source sweep for
433
- long-lived deployments.
434
-
435
- ## Clips And Generic Webhook
436
-
437
- Create a Clips or generic source with `sourceKey` to receive a one-time ingest
438
- token:
439
-
440
- ```bash
441
- pnpm --filter brain action create-source \
442
- --title "Clips exports" \
443
- --provider clips \
444
- --sourceKey clips \
445
- --visibility org
446
- ```
447
-
448
- Then send:
449
-
450
- ```json
451
- {
452
- "sourceKey": "clips",
453
- "externalId": "meeting-123",
454
- "title": "Product decision review",
455
- "participants": ["Ada", "Grace"],
456
- "occurredAt": "2026-05-15T15:00:00.000Z",
457
- "transcript": "We decided to...",
458
- "sourceUrl": "https://example.com/share/meeting-123",
459
- "tags": ["product", "pricing"],
460
- "raw": {}
461
- }
462
- ```
463
-
464
- Use `Authorization: Bearer <ingestToken>`.
465
-
466
- Clips exports use this endpoint without Brain reading the Clips database
467
- directly. Generic sources use the same payload shape for transcripts, customer
468
- research, meeting exports, or any bounded capture that should enter the review
469
- and distillation pipeline.
470
-
471
- Transcript payloads from Clips, generic webhooks, Granola, and
472
- `import-transcript` are sanitized before they are saved. The default model is
473
- the Brain agent model, but Settings can specify a cheaper model override for
474
- this filtering pass. The model sanitizer receives `AGENTS.md`, including the
475
- capture sanitization rules, so privacy policy tweaks can be made in instructions.
476
- Recruiting and candidate-evaluation content is always stripped. If no model is
477
- available, Brain falls back to a conservative deterministic filter that keeps
478
- only likely company-relevant lines and redacts obvious contact details, secrets,
479
- recruiting signals, and links.
480
-
481
- After enabling or tightening the filter, re-run it on already imported
482
- transcript captures:
483
-
484
- ```bash
485
- pnpm --filter brain action resanitize-captures \
486
- --sourceId <source-id> \
487
- --limit 25 \
488
- --dryRun true
489
- ```
490
-
491
- Non-dry-run resanitization skips captures that already have knowledge or
492
- proposals citing their current text, so evidence quotes do not silently drift.
493
- After reviewing the dry-run preview, re-distill affected captures or pass
494
- `--allowCitationDrift true` only for an intentional repair.
495
-
496
- ## Data
497
-
498
- Brain stores data in portable SQL through Drizzle:
499
-
500
- - `brain_sources`
501
- - `brain_raw_captures`
502
- - `brain_knowledge`
503
- - `brain_proposals`
504
- - `brain_sync_runs`
505
- - `brain_ingest_queue`
506
-
507
- JSON stays in text columns. V1 does not require a vector database.
508
-
509
- ## Demo and Eval
510
-
511
- Load the product-decision demo corpus:
512
-
513
- ```bash
514
- pnpm --filter brain action seed-demo-data
515
- ```
516
-
517
- Then run the repeatable quality check:
518
-
519
- ```bash
520
- pnpm --filter brain action run-demo-eval
521
- ```
522
-
523
- The eval checks product-decision recall, citation presence, supersede links,
524
- proposal gating, PII redaction, and personal-content exclusion. Keep these
525
- demo/eval controls in actions and docs rather than the Ask-page product UI.
526
-
527
- Run the real-channel-style retrieval eval:
528
-
529
- ```bash
530
- pnpm --filter brain action run-retrieval-eval
531
- ```
532
-
533
- This eval checks #dev-fusion stale Fusion branch retrieval, Slack-style citation
534
- presence, branch-safety terms, and an unsupported cleanup-cron not-found case.
535
- It evaluates existing workspace data first; if the answer cases do not have
536
- citation-backed support and `seedIfMissing` is true, it seeds a tiny portable SQL
537
- fallback corpus and re-runs the checks. The same eval is available through
538
- `run-demo-eval` with `mode: "retrieval"`.
539
-
540
- CI and `pnpm prep` run the deterministic action evals through the repository
541
- script:
542
-
543
- ```bash
544
- pnpm test:brain-evals
545
- ```
546
-
547
- That command uses a disposable local SQLite database at
548
- `templates/brain/data/brain-evals-ci.db`, seeds any missing demo/fallback
549
- fixtures, and removes the database when it exits. It does not call Slack,
550
- Granola, Clips, or any external service.
551
-
552
- The Slack pilot regression set lives in
553
- `templates/brain/evals/slack-pilot-corpus.ts`. It contains redacted pilot
554
- questions for reasoning-effort controls, Fusion PR #13340 missing-branch
555
- handling, Figma Plugin JSON uploader feedback, non-English support, Slack
556
- history guardrails, citation requirements, personal-content exclusion, and
557
- honest not-found behavior.
558
-
559
- ```bash
560
- pnpm --filter brain exec vitest --run --config vitest.config.ts evals/slack-pilot-corpus.test.ts
29
+ pnpm dev
561
30
  ```
562
31
 
563
- The eval is offline and validates the real `searchEverythingRows` retrieval
564
- path plus `ask-brain` cited-answer behavior.
32
+ Full docs: [agent-native.com/docs/template-brain](https://agent-native.com/docs/template-brain).
@@ -53,6 +53,8 @@ Default to Apple/Linear-level restraint: make the primary workflow obvious, then
53
53
  - **Visual assets**: Websites, games, and object-focused pages need real or generated media when images help users understand the subject.
54
54
  - **Responsive fit**: Text must not overflow buttons, cards, tabs, sidebars, or fixed-format tools. Use stable dimensions for boards, grids, toolbars, and counters.
55
55
 
56
+ **Beat convergence, not just defaults.** You sample toward the "on-distribution" center, so naming what to avoid is not enough: every "don't" needs a "do", or you converge on the next safe option (ban Inter and you reach for Roboto; ban purple gradients and you reach for Space Grotesk + a teal accent on every screen). Commit to one named direction, pair any reference with the reason it fits ("Linear: the quiet confidence of its spacing" — a bare "Linear" collapses back to the average), and match implementation effort to the vision: maximalist wants elaborate motion and effects, minimal wants restraint and precise spacing. When building on an existing app, inspect its tokens/type/components first and treat any drift back to a default as a missing token to pin, not something to re-prompt.
57
+
56
58
  ## Agent-Native UI Rules
57
59
 
58
60
  - Agent-native apps use React, Vite, Tailwind CSS, shadcn/ui, and `@tabler/icons-react`.
@@ -1,41 +1,35 @@
1
1
  # Calendar
2
2
 
3
- Google Calendar integration with a Calendly-style public booking page.
3
+ An open-source, agent-native alternative to the Google Calendar + Calendly combo.
4
+ An agent-powered calendar with Google Calendar sync and Calendly-style public
5
+ booking links — schedule, find slots, and manage availability in plain English.
4
6
 
5
- ## Setup
7
+ **Live app: [calendar.agent-native.com](https://calendar.agent-native.com)**
6
8
 
7
- ### 1. Install dependencies
9
+ Connect your Google Calendar and the agent can read your schedule, find free
10
+ slots, create events, and manage booking links. Anything you can do in the UI,
11
+ the agent can do through the same actions.
8
12
 
9
- ```bash
10
- pnpm install
11
- ```
13
+ ## Features
12
14
 
13
- ### 2. Google OAuth Setup (optional)
15
+ - Day, week, and month views with multiple Google accounts overlayed.
16
+ - Google Calendar sync and read-only ICS feed subscriptions.
17
+ - Weekly availability with timezone support for slot-finding.
18
+ - Calendly-style public booking links at `/book/{slug}` with custom fields.
19
+ - Ask the agent anything schedule-related, from "am I free Thursday?" to
20
+ creating and rescheduling events.
21
+ - Share booking links with teammates and required co-hosts.
14
22
 
15
- 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
16
- 2. Create a project and enable the Google Calendar API
17
- 3. Create OAuth 2.0 credentials (Web application type)
18
- 4. Set the authorized redirect URI to `http://localhost:5173/_agent-native/google/callback`
19
- 5. Add credentials in the app's Settings page, or set them only in a local
20
- `.env` / deployment secret. Never commit real credential values:
21
- ```
22
- GOOGLE_CLIENT_ID=your-client-id
23
- GOOGLE_CLIENT_SECRET=your-client-secret
24
- ```
23
+ ## Develop locally
25
24
 
26
- ### 3. Run
25
+ Scaffold your own copy and run it:
27
26
 
28
27
  ```bash
28
+ npx @agent-native/core@latest create my-calendar --standalone --template calendar
29
+ cd my-calendar
30
+ pnpm install
29
31
  pnpm dev
30
32
  ```
31
33
 
32
- Open http://localhost:5173
33
-
34
- ## Features
35
-
36
- - Monthly/weekly/daily calendar views
37
- - Google Calendar sync (pull-based)
38
- - Event CRUD (local + Google)
39
- - Configurable availability schedule
40
- - Public booking page at `/book/meeting`
41
- - Real-time updates via SSE when agent modifies data
34
+ Connecting Google Calendar in dev needs a Google OAuth client — see the docs for
35
+ setup. Full docs: [agent-native.com/docs/template-calendar](https://agent-native.com/docs/template-calendar).
@@ -53,6 +53,8 @@ Default to Apple/Linear-level restraint: make the primary workflow obvious, then
53
53
  - **Visual assets**: Websites, games, and object-focused pages need real or generated media when images help users understand the subject.
54
54
  - **Responsive fit**: Text must not overflow buttons, cards, tabs, sidebars, or fixed-format tools. Use stable dimensions for boards, grids, toolbars, and counters.
55
55
 
56
+ **Beat convergence, not just defaults.** You sample toward the "on-distribution" center, so naming what to avoid is not enough: every "don't" needs a "do", or you converge on the next safe option (ban Inter and you reach for Roboto; ban purple gradients and you reach for Space Grotesk + a teal accent on every screen). Commit to one named direction, pair any reference with the reason it fits ("Linear: the quiet confidence of its spacing" — a bare "Linear" collapses back to the average), and match implementation effort to the vision: maximalist wants elaborate motion and effects, minimal wants restraint and precise spacing. When building on an existing app, inspect its tokens/type/components first and treat any drift back to a default as a missing token to pin, not something to re-prompt.
57
+
56
58
  ## Agent-Native UI Rules
57
59
 
58
60
  - Agent-native apps use React, Vite, Tailwind CSS, shadcn/ui, and `@tabler/icons-react`.