Neon database architecture
Logical tables, ownership, ordered conversations and graph version relationships.
On this page
Versioned SQL migrations define the application schema. The Neon serverless driver provides HTTP queries and a pooled client for explicit multi-statement transactions. This reference describes logical public-facing behavior and contains no real user records.
Users, sessions, and messages
| Table | Key and relationship | Purpose |
|---|---|---|
| users | UUID primary key, unique wallet address | Verified wallet identity |
| auth_challenges | UUID primary key and wallet scope | Expiring single-use nonce digest and consumption status |
| auth_sessions | UUID primary key, user foreign key | Token digest, expiration and revocation |
| user_chat_sessions | UUID primary key, user foreign key | Title and activity timestamps |
| chat_messages | UUID primary key, session foreign key | Role, sequence, content, state, response_blocks JSONB, feedback and provider metadata |
| chat_actions | UUID primary key, unique message foreign key | Local action identifier and application state |
| chat_tool_calls | UUID primary key, message foreign key | Safe tool status and metadata |
| chat_message_sources | UUID primary key, message foreign key | Citation order, title, normalized URL, optional excerpt and publication time |
| ai_usage_logs | UUID primary key, user/session/message references | Reported model and tool usage |
| cogni_chat_requests | Compound request ownership key and session reference | Idempotent conversation creation |
- users
- user_chat_sessions
- chat_messages
- chat_actions
- chat_messages
- chat_tool_calls and chat_message_sources
- users
- user_strategies
- strategy_versions
- strategy_runs
- strategy_run_steps
Message sequence numbers are unique inside a conversation. The application queries with owner constraints and orders history by sequence; database IDs do not themselves confer access.
Strategies
| Table | Key and relationship | Purpose |
|---|---|---|
| user_strategies | UUID primary key, user foreign key, unique user/request pair | JSONB draft, revision, status and timestamps |
| strategy_versions | UUID primary key, strategy foreign key, unique strategy/version number | Versioned graph snapshots and change summaries |
| strategy_runs | UUID primary key, strategy/version/user references | Node or workflow test state and sanitized aggregate summary |
| strategy_run_steps | UUID primary key, run foreign key, unique run/node pair | Execution order, node type, state and sanitized summaries |
| strategy_ai_usage | UUID primary key, user foreign key and optional strategy reference | Model, operation, usage, latency |
Private Gloam notes, passwords, receiving keys and payroll settlement journals are not database tables in Neon. See browser encryption and Neon documentation.

CogniTech