Architecture
DASH is a Rust workspace organized into library crates and four service binaries. Ingested claims are durably written to a write-ahead log, replayed into an in-memory Claim + Evidence + Edge store, and indexed for HNSW ANN candidate generation.
Workspace layout
Library crates (pkg/):
pkg/schema- data model typespkg/store- in-memory store, durable WAL with replay, checkpoints, compaction,redbpersistencepkg/ranking- retrieval planner and scoringpkg/graph- graph-backed recall layerpkg/auth- JWT + scoped API keyspkg/embeddings- embedding providers (HashEmbeddingProviderdefault, Ollama, OpenAI)
Service binaries (services/):
services/ingestion- binds127.0.0.1:8081, accepts claimsservices/retrieval- binds127.0.0.1:8080, serves retrieval and embeddingsservices/indexer- builds and maintains indicesservices/control-plane- fleet coordination
The retrieval path
- The planner takes the query (string or precomputed
query_embedding). - The built-in multi-level HNSW graph generates vector candidates, with
DASH_*_ANN_*tuning knobs. - Metadata filters, time-range filters, and stance demotion/filtering narrow the set.
- Optional graph expansion follows claim edges.
- Results are projected into citation-bearing responses.
Semantic-first retrieval (InMemoryStore::retrieve_semantic) treats the dense-similarity score (cosine in [-1, 1], mapped to [0, 1]) as the primary ranking signal when the caller passes a pre-computed query vector; the lexical score becomes a small tie-breaker.
Persistence
- Write-ahead log - durable WAL with replay, checkpoints, and compaction in
pkg/store. WAL durability guardrails reject unsafe flush policies by default; stress testing requires the explicitDASH_INGEST_ALLOW_UNSAFE_WAL_DURABILITY=trueoverride. - redb persistence - additive on-disk durability for claims, evidence, edges, vectors, and the tenant-to-claim set. Enabled via
DASH_INGEST_PERSISTENCE_PATH/DASH_RETRIEVAL_PERSISTENCE_PATH. Unset (the default), DASH runs in WAL-only mode. - Embedding providers - env-driven selection with
DASH_EMBEDDING_PROVIDER=hash|ollama|openai.
Auth and multi-tenancy
- JWT auth (HS256) with key rotation by
kid, optionaliss/audchecks, a fallback secrets list, and per-tenant claim enforcement. - Scoped API keys plus revocation (
DASH_*_SCOPED_API_KEYS,DASH_*_REVOKED_API_KEYS). - Multi-tenant allowlist enforced in the authz layer.
- Per-tenant rate limits (
DASH_*_RATE_LIMIT_*).
Audit log
Every authenticated state change is recorded as a SHA-256-chained JSON line. Verify the chain with scripts/verify_audit_chain.sh.
Observability
- Health endpoints at
/healthon both services. - Prometheus metrics at
/metrics.
Operational tooling
The scripts/ directory ships backup, restore, recovery drill, failover drill, an SLO guard, a release-candidate gate, and the audit chain verifier.
Testing and quality gates
- 415 Rust unit/integration tests passing (verified with
cargo test --workspace --all-features), plus Go, TypeScript, and Python SDK suites across the workspace. cargo clippy --workspace --all-targetsandcargo build --workspaceare clean.cargo-fuzzharnesses cover the JWT verifier, OpenAI request parser, ranking function, and WAL record parser.- A performance benchmark suite (
perf_bench) covers ingest, retrieve-lexical, retrieve-semantic, ANN-at-scale, and WAL-replay, withsmoke,hybrid, andlargeprofiles and a CI-enforced regression guard against prior scorecards.
SDKs
| SDK | Package | Notes |
|---|---|---|
| Python | dash-py | sync + async, typed dataclasses, OpenAI drop-in examples |
| Go | dash-go | Go 1.21+, functional options, errors.Is/As support |
| TypeScript | dash-ts | ESM-first, Node 18+, zero runtime deps, full type safety |
| Java, Kotlin, C# | in sdks/ | see the repository |
All SDKs are OpenAI drop-in compatible.
Deployment
Docker + docker-compose (multi-stage, multi-arch linux/amd64 + linux/arm64, non-root runtime, healthcheck, dependency ordering, dev overlay with hot-reload). docker compose up -d brings the ingestion + retrieval services online.