Data Model Reference
The NANDA node stores all state in a Cloudflare D1 database using Drizzle ORM. The schema contains 53 tables across 21 domains.
Domain Map
| Domain | Tables | Description |
|---|---|---|
| Registry | agents, agent_facts, clients | Core agent registration, metadata, API keys |
| Certifier | cert_jobs, trial_results, certificates, cert_revocations | Automated certification pipeline |
| Compliance | compliance_decisions, violations, policies, scan_runs | Policy evaluation and enforcement |
| Observer | probe_runs, reputation_snapshots, telemetry_events | Health monitoring and reputation scoring |
| Auditor | audit_intents, settlements, reconciliations, wallets | Payment verification and financial audit |
| Trust | federation_trust_scores, cross_registry_scores, behavior_metrics | Cross-registry trust framework |
| Trust Framework | trust_framework_meta, trust_graph_edges | ToIP alignment and trust graphs |
| Webhooks | webhook_subscriptions | Event notification subscriptions |
| Versioning | agent_versions | Agent version history |
| UCP | ucp_checkout_sessions | Universal Checkout Protocol sessions |
| Billing | billing_periods, billing_line_items | Usage metering and billing cycles |
| Revenue Sharing | revenue_splits, shares, settlements | Developer revenue distribution |
| Multi-Currency | currencies | Supported currencies and exchange rates |
| Subscriptions | subscriptions, subscription_events | Plan-based billing |
| Invoices | invoices, invoice_sequence | Sequential invoice generation |
| Lean Index | agent_addrs | DNS-like AgentAddr records with Ed25519 signatures |
| Resolver | resolution_log, protocol_adapters | Adaptive resolution and protocol bridging |
| Federation v2 | federation_peers, gossip_log, quilt_routes | CRDT gossip and peer management |
| Orchestration | workflows, steps, runs, step_runs, patterns, delegation_tasks, routing_decisions, events, conflict_resolutions | Multi-agent workflow engine |
| Developer Keys | developer_keys | API key management for developers |
| Site Visitors | site_visitors | Anonymous visitor tracking |
Key Relationships
agents → agent_facts
One-to-one. Each agent has a single AgentFacts document stored as JSON text. Facts URL can point to an external /.well-known/agent-facts.json.
agents → certificates → cert_revocations
One-to-many. Each agent can have multiple certificates; each cert can be revoked. Bitstring Status List tracks revocation state.
workflows → steps → runs → step_runs
Hierarchical. A workflow has ordered steps (DAG). Each run produces step_runs tracking individual step execution with input/output and status.
federation_peers → gossip_log → quilt_routes
Peers exchange gossip messages. CRDT merge entries are logged. Quilt routes define optimized gossip topology.
Schema Source
The complete schema is defined in src/lib/db/schema.ts using Drizzle ORM's sqliteTable builder. Migrations are hand-written SQL in drizzle/migrations/ (0000–0020).
Standards Referenced
- W3C Verifiable Credentials v2.0 — credential format for agent_facts and certificates
- RFC 8032 — Ed25519 — signing algorithm for AgentAddr records and credentials
- Trust over IP Foundation — governance model behind trust_framework_meta and trust_graph_edges
- CRDTs (Conflict-free Replicated Data Types) — merge semantics for gossip_log federation entries