You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All commands: clean single JSON to stdout in --json mode
All command files
Done
1.16 OpenAPI Specification — Complete
Component
Files
Status
@fastify/swagger auto-generation
src/server/app.ts
Done
@fastify/swagger-ui at /docs
src/server/app.ts
Done
OpenAPI 3.0 spec at /openapi.json
Auto-generated
Done
2. Remaining Work
2.1 Web Dashboard — Not Started
The web SPA (web/) currently has a minimal shell (landing page, layout, router). The following features are needed to make it a functional management console:
Node details on click (identity metadata, trust scores)
Zoom, pan, and layout controls
Edge coloring by trust value (green = trust, red = distrust, gray = neutral)
Search
Search for identities by npub, name, or metadata
Search for trust events by subject, context, author
Full-text search across event content
Results with trust score context (from current user's perspective)
Management Console
View and manage the current identity
View sync status and statistics
Monitor graph size (nodes, edges, events)
Configuration viewer/editor
Server health dashboard
Relay connection status
API Integration
The web app should use the existing REST API endpoints. Most dashboard data endpoints are now available:
GET /health — Status, graph stats, sync info, uptime
GET /graph/stats — Node/edge counts
GET /events — Event listing with filters
GET /trusted — Trusted subjects list
GET /identity — Current identity
POST /resolve and POST /resolve/batch — Trust resolution
Additional endpoints may be needed:
GET /graph/nodes — Paginated node list with filtering
GET /graph/edges — Paginated edge list with filtering
2.2 Additional NIP Support — Deferred
The following NIPs are specified in documentation/nips/ but not yet implemented beyond the protocol specification:
NIP
Feature
Priority
NIP-32011
Event completeness index (sync optimization)
Medium
NIP-32012
Subject bloom filter (membership testing)
Medium
NIP-32013
Delegate trust (dual-signed delegation)
Low
NIP-32014
Subject rating (numeric scoring)
Low
NIP-32015
Subject confirmation (boolean acknowledgment)
Low
NIP-32016
Subject link (URL/source binding)
Low
The current architecture supports these extensions — the database stores events of any kind, the graph model can accommodate new edge types, and the relay facade forwards events transparently.
2.3 Enhancements — Future
Feature
Description
Priority
npm publish
Publish @dtp/trust to npm registry for npm install -g
High
Docker image
Containerized deployment for server mode
Medium
Follow graph integration
Import kind 3 (contact list) as initial trust seeds
Medium
Authentication
API key or NIP-98 HTTP auth for write endpoints
Medium
Graph-limited cache loading
BFS-bounded graph loading for very large datasets
Low
SSE/WebSocket push for trust changes
Real-time trust score updates
Low
Rate limiting
API rate limiting for public deployments
Low
Metrics/monitoring
Prometheus metrics for server health
Low
3. Architecture Decisions
These decisions were made during implementation and should be preserved:
Single Package, Multiple Roles
The application is a single npm package that serves all roles (CLI, SDK, server, relay, MCP, web). This was a deliberate choice to keep deployment simple — install once, configure for your use case. The codebase is not large enough to justify splitting into separate packages.
AI-First Interface Design
The application provides four interface layers, all sharing the same core logic:
SDK (import from '@dtp/trust') — Direct library import for Node.js AI agents
MCP Server (trust-mcp) — Tool integration for MCP-compatible AI environments
HTTP API (trust server) — REST endpoints with consistent JSON envelopes
CLI (trust) — Command-line with --json for scripting
Each layer is a thin adapter over the core modules. No logic duplication.
SQLite as Default, Postgres for Scale
SQLite provides zero-configuration local storage for single-node deployments and CLI usage. Postgres enables multi-instance deployments where relay and API processes share a database. Both use the same Kysely query builder and Nostr store interface.
In-Memory Graph vs Database Queries
Trust resolution requires multi-hop graph traversal (BFS). Doing this against a relational database would be prohibitively slow for real-time queries. The in-memory graph gives sub-millisecond resolution. The trade-off is memory usage, mitigated by BFS-bounded loading and the graph cache file.
Event Store as Source of Truth
Raw Nostr events are the canonical data. The graph is derived and disposable — it can be rebuilt from the event store at any time. This simplifies replication, backup, and debugging.
Context as First-Class Concept
Trust is always scoped by context. An empty context acts as "general" (applies everywhere when a specific context is queried). This enables domain-specific trust without requiring separate trust graphs.
Consistent API Envelope
All HTTP responses use { ok: true, data: ... } / { ok: false, error: { code, message } }. This allows AI consumers to parse responses without inspecting HTTP status codes, and provides machine-readable error codes for programmatic handling.
4. File Quick Reference
For developers starting work on remaining features, these are the key entry points: