ADR 0002 — Embedded DuckDB + DuckDB-Wasm Graph & Vector Projection Layer
Context
NEG-002 and INACC-002 documented that an external TypeDB server daemon (127.0.0.1:1729) cannot serve as a zero-daemon, offline-reproducible primary projection in sandboxed CI or static Quartz 5 browser builds. At the same time, INV-008 (“Markdown is canonical”) requires that every graph and vector projection be deterministically rebuildable from content/**/*.md alone.
Decision
- Primary Embedded Store (
tools/garden/sync_duckdb.py):- Build
.garden-scratch/garden.duckdbandpublic/static/garden.duckdb(plus portable Parquet/JSON tablesnotes,edges,sources,embeddings) directly from governed markdown notes. - Support SQL
WITH RECURSIVEgraph lineage / transitive impact queries (lineage,impact_of) and 384-dimensional vector cosine/HNSW similarity search (hybrid_search), with a deterministic local embedding pipeline that runs in<1swith zero network access.
- Build
- MCP Server Integration (
tools/garden/mcp_server.py):- Expose
garden_graph_query,garden_vector_search,garden_typeql_read,garden_capture_inbox, andgarden_analyzeover stdio JSON-RPC 2.0 backed by the embedded store.
- Expose
- Optional TypeDB Exporter (
tools/garden/sync_typedb.py):- Retain
sync_typedb.py(with fixedtool_fingerprint(),indexed-byhyphen parsing, andinbox/source-materialsexclusions) as an optional external exporter when a live TypeDB daemon is explicitly provisioned.
- Retain
Consequences
bash scripts/verify_garden.shrebuilds and tests the full graph + vector projection offline in<1swith zero external daemons (INV-008).- Static Quartz 5 builds (
public/static/garden.duckdbandpublic/static/garden-meta.json) carry the complete Milner Bigraph and vector embeddings for client-side DuckDB-Wasm inspection.