1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# Taproot — System Architecture Diagram
# dendryform YAML format
#
# This file declares the full visual architecture diagram for Taproot.
# It should produce HTML identical to architecture-diagram.html.
diagram:
title:
text: "system architecture"
accent: "taproot"
subtitle: "natural language analytics over BigQuery via MCP"
theme: dark
# Ordered sequence of visual layers (tiers, connectors, flow labels)
layers:
# ── Tier 1: Client ──────────────────────────────────────────────
- tier:
id: client-layer
label: "Client Layer"
layout: single
nodes:
- id: claude-desktop
kind: system
color: blue
icon: "◇"
title: "Claude Desktop / claude.ai"
description: "MCP client — handles OAuth dance, sends tool calls, renders responses"
tech:
- "MCP Protocol"
- "OAuth2 PKCE"
- "Streamable HTTP"
# ── Connector: Client → Server ──────────────────────────────────
- connector:
style: line
label: "Streamable HTTP + SSE"
# ── Tier 2: Server Container ────────────────────────────────────
- tier:
id: server
container:
label: "taproot server · cloud run"
border: solid
label_color: green
layers:
# ── Sub-tier: Edge ──────────────────────────────────────
- tier:
id: edge
label: "Edge"
layout:
grid:
columns: 4
nodes:
- id: auth
kind: component
color: green
icon: "◈"
title: "Auth"
description: "Google JWT validation, domain gating"
tech:
- "axum middleware"
- id: transport
kind: component
color: green
icon: "◈"
title: "Transport"
description: "MCP server, tool dispatch, SSE streams"
tech:
- "rmcp 0.8"
- id: intercept
kind: component
color: green
icon: "◈"
title: "Intercept"
description: "Mechanical query capture to Redis"
tech:
- "axum middleware"
- id: config
kind: component
color: green
icon: "◈"
title: "Config"
description: "Runtime settings, cost budgets, feature flags"
tech:
- "confyg"
- "twyg"
# ── Internal connector (dots) ───────────────────────────
- connector:
style: dots
# ── Sub-tier: Tools ─────────────────────────────────────
- tier:
id: tools
label: "Tools — 20 MCP tools exposed to Claude"
layout:
grid:
columns: 4
nodes:
- id: bq-tools
kind: component
color: amber
icon: "⊕"
title: "BQ Tools"
description: "execute_query, explain_query, describe_table, get_sample_rows, list_datasets"
- id: knowledge-tools
kind: component
color: amber
icon: "⊕"
title: "Knowledge"
description: "search_domain, semantic_search, get_concept, list_concepts"
- id: graph-tools
kind: component
color: amber
icon: "⊕"
title: "Graph"
description: "query_knowledge_graph, related_concepts, find_path, neighborhood"
- id: user-model-tools
kind: component
color: amber
icon: "⊕"
title: "User Model"
description: "get_user_profile, search_user_model, get_query_history, get_daily_cost"
# ── Internal connector (dots) ───────────────────────────
- connector:
style: dots
# ── Sub-tier: Intelligence (with knowledge container) ───
- tier:
id: intelligence
label: "Intelligence"
container:
label: "knowledge engine"
border: dashed
label_color: purple
layers:
- tier:
id: ke-search
layout:
grid:
columns: 3
nodes:
- id: graph-db
kind: component
color: purple
icon: "◆"
title: "Graph DB"
description: "153 concepts, 1,232 relationships"
tech:
- "petgraph"
- id: full-text-search
kind: component
color: purple
icon: "◆"
title: "Full-Text Search"
description: "Ranked keyword search over concept corpus"
tech:
- "tantivy"
- id: vector-search
kind: component
color: purple
icon: "◆"
title: "Vector Search"
description: "Semantic similarity, hybrid mode"
tech:
- "bge-small-en-v1.5"
- tier:
id: ke-providers
layout:
grid:
columns: 2
nodes:
- id: card-loader
kind: component
color: purple
icon: "◆"
title: "Card Loader"
description: "Domain + query-derived concept cards with access_type/access_path"
tech:
- "fabryk"
- id: content-provider
kind: component
color: purple
icon: "◆"
title: "Content Provider"
description: "In-memory provider, incremental index updates"
tech:
- "InMemoryProvider"
# ── Sub-tier: Infrastructure Clients ────────────────────
- tier:
id: infrastructure
label: "Infrastructure Clients"
layout:
grid:
columns: 3
nodes:
- id: bq-client
kind: component
color: red
icon: "◉"
title: "BigQuery Client"
description: "Read-only queries, cost estimation, scan budgets"
tech:
- "gcp-bigquery-client"
- id: redis-client
kind: component
color: teal
icon: "◉"
title: "Redis Client"
description: "Query history, daily cost tracking, user model cards"
tech:
- "redis-rs"
- id: user-model-engine
kind: component
color: teal
icon: "◉"
title: "User Model Engine"
description: "Pattern analysis, mental model generation, profile synthesis"
tech:
- "async pipeline"
# ── Flow Labels: Server → External ──────────────────────────────
- flow_labels:
items:
- "SQL queries"
- "history + cost"
- "concept cards"
# ── Tier 3: External Services ───────────────────────────────────
- tier:
id: external-services
label: "External Services"
layout:
grid:
columns: 3
nodes:
- id: bigquery
kind: infrastructure
color: red
icon: "◯"
title: "BigQuery"
description: "banyan · banyan_intermediate · banyan_metrics — 250M+ rows, partitioned by row_created_ts"
tech:
- "banyan-analytics-prod"
- id: redis-valkey
kind: infrastructure
color: teal
icon: "◯"
title: "Redis / Valkey"
description: "taproot:history:{email}:{ts} · taproot:cost:{email}:{date}"
tech:
- "GCP Memorystore"
- id: google-oauth2
kind: infrastructure
color: blue
icon: "◯"
title: "Google OAuth2"
description: "Identity tokens, Banyan domain validation"
tech:
- "oauth2.googleapis.com"
# Legend — color key for the diagram
legend:
- color: blue
label: "Client / Auth"
- color: green
label: "Server Edge"
- color: amber
label: "MCP Tools"
- color: purple
label: "Knowledge Engine"
- color: red
label: "BigQuery"
- color: teal
label: "Redis / Persistence"
# Semantic edges — relationships between nodes
# (Used for Structurizr/Mermaid export; connectors handle visual rendering)
edges:
- from: claude-desktop
to: auth
kind: uses
label: "OAuth2 Bearer tokens"
- from: claude-desktop
to: transport
kind: uses
label: "MCP tool calls via Streamable HTTP"
- from: transport
to: bq-tools
kind: uses
label: "tool dispatch"
- from: transport
to: knowledge-tools
kind: uses
label: "tool dispatch"
- from: transport
to: graph-tools
kind: uses
label: "tool dispatch"
- from: transport
to: user-model-tools
kind: uses
label: "tool dispatch"
- from: bq-tools
to: bq-client
kind: uses
label: "SQL execution"
- from: knowledge-tools
to: full-text-search
kind: reads
label: "keyword search"
- from: knowledge-tools
to: vector-search
kind: reads
label: "semantic search"
- from: knowledge-tools
to: graph-db
kind: reads
label: "graph queries"
- from: graph-tools
to: graph-db
kind: reads
label: "traversals"
- from: user-model-tools
to: user-model-engine
kind: uses
label: "profile + history"
- from: user-model-tools
to: redis-client
kind: reads
label: "query history"
- from: card-loader
to: content-provider
kind: writes
label: "concept cards"
- from: bq-client
to: bigquery
kind: uses
label: "SQL queries"
- from: redis-client
to: redis-valkey
kind: uses
label: "history + cost data"
- from: intercept
to: redis-client
kind: writes
label: "query capture"
- from: auth
to: google-oauth2
kind: uses
label: "JWKS validation"