@agent-native/core 0.84.21 → 0.84.22
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.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +8 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +27 -4
- package/corpus/core/src/client/guided-questions.tsx +11 -6
- package/corpus/core/src/client/tool-display.ts +8 -0
- package/corpus/core/src/file-upload/builder.ts +7 -2
- package/corpus/core/src/notifications/channels.ts +235 -38
- package/corpus/core/src/server/analytics.ts +32 -6
- package/corpus/core/src/server/ssr-handler.ts +31 -12
- package/corpus/templates/analytics/AGENTS.md +21 -0
- package/corpus/templates/analytics/README.md +35 -0
- package/corpus/templates/analytics/actions/delete-analytics-alert-rule.ts +23 -0
- package/corpus/templates/analytics/actions/list-analytics-alert-rules.ts +20 -0
- package/corpus/templates/analytics/actions/run-analytics-alerts.ts +23 -0
- package/corpus/templates/analytics/actions/save-analytics-alert-rule.ts +69 -0
- package/corpus/templates/analytics/changelog/2026-07-01-analytics-can-alert-when-first-party-events-spike.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-01-session-replays-play-back-in-production-instead-of-showing.md +6 -0
- package/corpus/templates/analytics/netlify.toml +3 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +109 -0
- package/corpus/templates/analytics/server/db/schema.ts +55 -0
- package/corpus/templates/analytics/server/handlers/session-replay.ts +5 -2
- package/corpus/templates/analytics/server/jobs/analytics-alerts.ts +71 -0
- package/corpus/templates/analytics/server/lib/analytics-alerts.ts +734 -0
- package/corpus/templates/analytics/server/lib/session-replay.ts +10 -3
- package/corpus/templates/analytics/server/plugins/analytics-alert-jobs.ts +54 -0
- package/corpus/templates/analytics/server/plugins/db.ts +100 -0
- package/corpus/templates/analytics/server/routes/api/analytics-alerts/run.post.ts +60 -0
- package/corpus/templates/assets/README.md +30 -8
- package/corpus/templates/brain/README.md +20 -552
- package/corpus/templates/calendar/README.md +22 -28
- package/corpus/templates/chat/README.md +32 -0
- package/corpus/templates/clips/README.md +37 -0
- package/corpus/templates/clips/app/components/library/library-grid.tsx +18 -7
- package/corpus/templates/clips/app/components/library/recording-card.tsx +42 -5
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +41 -1
- package/corpus/templates/clips/changelog/2026-07-01-move-to-folder-now-opens-folder-choices-directly-instead-of.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +37 -0
- package/corpus/templates/content/AGENTS.md +7 -3
- package/corpus/templates/content/README.md +22 -34
- package/corpus/templates/content/actions/list-trashed-content-databases.ts +4 -0
- package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +58 -6
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +257 -24
- package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +41 -15
- package/corpus/templates/content/app/i18n/zh-TW.ts +25 -7
- package/corpus/templates/content/app/i18n-data.ts +278 -40
- package/corpus/templates/content/changelog/2026-06-30-database-once-again-creates-an-inline-database-in-the-curren.md +6 -0
- package/corpus/templates/content/shared/api.ts +1 -0
- package/corpus/templates/design/AGENTS.md +7 -6
- package/corpus/templates/design/README.md +33 -0
- package/corpus/templates/design/actions/delete-file.ts +86 -10
- package/corpus/templates/design/actions/get-design-snapshot.ts +13 -0
- package/corpus/templates/design/actions/present-design-variants.ts +11 -13
- package/corpus/templates/design/app/hooks/use-question-flow.ts +2 -2
- package/corpus/templates/design/app/pages/DesignEditor.tsx +2 -2
- package/corpus/templates/dispatch/README.md +34 -0
- package/corpus/templates/forms/README.md +34 -0
- package/corpus/templates/macros/README.md +28 -0
- package/corpus/templates/mail/README.md +35 -0
- package/corpus/templates/plan/README.md +30 -118
- package/corpus/templates/slides/README.md +34 -0
- package/corpus/templates/videos/README.md +22 -201
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +28 -4
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +10 -6
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/tool-display.d.ts.map +1 -1
- package/dist/client/tool-display.js +8 -0
- package/dist/client/tool-display.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/builder.d.ts.map +1 -1
- package/dist/file-upload/builder.js +6 -2
- package/dist/file-upload/builder.js.map +1 -1
- package/dist/notifications/channels.d.ts +10 -0
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +172 -20
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/analytics.d.ts +16 -0
- package/dist/server/analytics.d.ts.map +1 -1
- package/dist/server/analytics.js +30 -7
- package/dist/server/analytics.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +28 -12
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,564 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Brain
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
##
|
|
13
|
+
## Features
|
|
22
14
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
##
|
|
21
|
+
## Develop locally
|
|
44
22
|
|
|
45
|
-
|
|
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
|
|
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
|
-
|
|
564
|
-
path plus `ask-brain` cited-answer behavior.
|
|
32
|
+
Full docs: [agent-native.com/docs/template-brain](https://agent-native.com/docs/template-brain).
|
|
@@ -1,41 +1,35 @@
|
|
|
1
1
|
# Calendar
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
7
|
+
**Live app: [calendar.agent-native.com](https://calendar.agent-native.com)**
|
|
6
8
|
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
pnpm install
|
|
11
|
-
```
|
|
13
|
+
## Features
|
|
12
14
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Chat
|
|
2
|
+
|
|
3
|
+
The minimal agent-native starter app — a clean, ChatGPT-style shell with chat at
|
|
4
|
+
the center, durable threads, standard app navigation, auth, live sync, and
|
|
5
|
+
actions. Start here when you want a real browser app to build on without
|
|
6
|
+
committing to a domain template.
|
|
7
|
+
|
|
8
|
+
**Live app: [chat.agent-native.com](https://chat.agent-native.com)**
|
|
9
|
+
|
|
10
|
+
Chat is the basic agent-native app starting point. It gives you the app-agent
|
|
11
|
+
loop wired end to end and one example action, so you can add your own UI, data,
|
|
12
|
+
and actions on top.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- ChatGPT-style shell with a threads list and durable chat history.
|
|
17
|
+
- Auth, live sync, and application state wired out of the box.
|
|
18
|
+
- The action surface the agent and UI share, plus one example action to copy.
|
|
19
|
+
- A minimal, brandable base for any domain app.
|
|
20
|
+
|
|
21
|
+
## Develop locally
|
|
22
|
+
|
|
23
|
+
Scaffold your own copy and run it:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @agent-native/core@latest create my-app --standalone --template chat
|
|
27
|
+
cd my-app
|
|
28
|
+
pnpm install
|
|
29
|
+
pnpm dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Full docs: [agent-native.com/docs/template-chat](https://agent-native.com/docs/template-chat).
|