Skip to main content

Architecture

VaultysClaw is designed as a hub-and-spoke system. A central control plane acts as the hub; any number of agent controllers are the spokes. The connection is always outbound from the agent, which means agents can run behind strict firewalls with no inbound ports exposed.

Component overview

Control plane

The control plane runs as a Next.js 16 application and serves two concerns simultaneously:

REST API (/api/**)

Provides CRUD endpoints for every resource in the system (agents, policies, intents, realms, users, workflows, tool approvals). All endpoints require authentication via NextAuth.js and enforce role-based access control.

See the full API Reference.

WebSocket hub (port 8080)

A persistent WebSocket server that agent controllers connect to. The hub:

  • Maintains the registry of connected agents (in-memory + heartbeat tracking)
  • Routes signed intents to target agents or broadcasts by capability
  • Distributes policy updates and delegation certificates
  • Receives signed execution results and stores them
  • Handles tool approval requests (agent → control plane → admin → agent)
  • Delivers channel_message_send events to @mentioned agents

Dashboard

A React 19 single-page application rendered server-side by Next.js. Provides live visibility over agents, an interactive graph of the trust graph, a chat interface, workflow management, and the admin approval queue.

File storage

Knowledge file content is decoupled from the SQLite database through a FileStorage abstraction layer. Two backends are supported:

BackendWhen to use
Filesystem (default)Single-node deployments. Files written to data/knowledge-files/ alongside the database.
S3 / MinIOMulti-node or cloud deployments. Any S3-compatible service — AWS S3, MinIO, Ceph, etc.

The active backend is determined at startup from the settings table. S3 credentials (access key ID + secret) are stored encrypted, signed with the server's VaultysId — never in environment variables. Switching backends takes effect immediately without a restart; the cached storage singleton is invalidated when configuration is saved.

Uploaded files keep their binary content out of SQLite: the knowledge_files table stores a file_path key and delegates reads/writes to the active backend. Legacy rows with a content BLOB (pre-migration) remain readable through the same abstraction.

Agent controller

Each agent controller is a Node.js process that:

  1. Generates or loads a VaultysId (persistent across restarts)
  2. Connects to the control plane WebSocket hub (with auto-reconnect and exponential back-off)
  3. Registers by sending its name, public key, capabilities, and LLM config
  4. Receives signed intents, policies, and delegation certificates
  5. Verifies every intent signature against the control plane's public key
  6. Enforces policies before executing any action
  7. Signs execution results and returns them to the control plane

The agent controller also exposes a lightweight HTTP server (default port 3001) for health checks and test endpoints.

Communication protocol

WebSocket message envelope

Every message on the WebSocket channel is a JSON object with at minimum:

{
"type": "<message-type>",
"payload": { ... },
"signature": "<base64-encoded-signature>",
"publicKey": "<sender-public-key>",
"timestamp": "<ISO-8601>"
}

Receiving parties verify signature against payload + timestamp using publicKey. Messages older than a configurable threshold or with invalid signatures are rejected.

Message flow: intent execution

Message flow: agent registration

Message flow: channel @mention → agent response

Database schema

VaultysClaw supports two database backends selected via the DATABASE_URL environment variable:

BackendWhen to use
SQLite (default)Single-node development. Zero ops, zero config. Data stored at .devdata/vaultysclaw.db.
PostgreSQLProduction and the full demo/simulator stack. Provisioned automatically by demo/simulator/demo-up.sh. Managed via Prisma migrations.

Key tables:

TablePurpose
settingsKey-value store for all server configuration (storage type, S3 credentials encrypted, Docling URL, …)
agentsRegistered agent controllers with DID, capabilities, LLM config
usersHuman users with DID, email, admin flag
realmsOrganisational scopes
agent_realmsAgent ↔ realm associations
user_realmsUser ↔ realm associations
user_grantsCapability grants from users to agents
delegation_certsControl-plane-signed delegation certificates
certificatesAgent certificates issued by the control plane
policiesSigned policies pushed to agents
pending_registrationsAgents awaiting admin approval
intent_logDispatched intents with status, payload, and results
workflowsWorkflow definitions (steps, schedule, trigger config)
workflow_runsExecution history per workflow
workflow_stepsPer-step execution log within a run
workflow_approvalsHuman-in-the-loop approval requests
knowledge_sourcesRAG sources per agent (URL, text, file — with sync status)
knowledge_filesUploaded file metadata + file_path key into the FileStorage backend
model_registryRegistered LLMs with provider, model ID, and LiteLLM name
model_realm_accessWhich models each realm can access
realm_router_keysPer-realm LiteLLM virtual keys and allowed model lists
org_skillsOrganisation-level skill library entries
realm_skillsRealm-scoped skill overrides
agent_skill_overridesPer-agent skill configuration
channelsNamed rooms (realm-scoped or global)
channel_membersUser and agent membership with roles
channel_messagesPersisted messages with optional threading
channel_bridgesExternal service integrations (webhooks, Teams)
agent_token_usageRolling token counters per agent (budget enforcement)
user_invitationsPending email invitations
entra_identitiesMicrosoft Entra ID / Azure AD identity links

Technology stack

LayerTechnology
Monorepopnpm workspaces + Turborepo
Control plane HTTPNext.js 16
AuthenticationNextAuth.js
DatabaseSQLite / better-sqlite3 (dev) · PostgreSQL via Prisma (full stack/demo)
File storageFilesystem (default) · S3 via @aws-sdk/client-s3 (optional)
WebSocketws 8.x
Agent HTTPBuilt-in HTTP server (health checks · web UI on port 3002)
Identity@vaultys/id 3.x
FrontendReact 19, Tailwind CSS
LLM orchestrationMastra (@mastra/core) + @ai-sdk/openai, ollama-ai-provider-v2
LLM proxyLiteLLM (optional, self-hosted)
LanguageTypeScript 5.x throughout

Deployment topologies

Development (single machine)

Production (typical enterprise)

Agents always connect outbound — no inbound firewall holes required. S3-compatible object storage is optional but recommended when running multiple control-plane replicas or when you want knowledge files managed separately from the database volume.