Server Capabilities
The Loom server is a production-ready HTTP API that provides:- LLM Proxy: Route requests to Anthropic/OpenAI with authentication
- Thread Persistence: Store and sync conversation history
- Weaver Orchestration: Manage ephemeral Kubernetes execution environments
- Crash Analytics: Error tracking and symbolication
- Cron Monitoring: Job scheduling and health checks
- Session Analytics: User session tracking and release health
Architecture
Starting the Server
- Development
- Production (Nix)
- Docker
Configuration
Server configuration is loaded from:- Environment variables (
LOOM_SERVER_*) .envfile (viadotenvy)- Built-in defaults
Required Configuration
PostgreSQL connection stringExample:
postgres://user:pass@localhost/loomHTTP Server
Bind address
Default:
Default:
0.0.0.0HTTP port
Default:
Default:
8080Authentication
Bypass authentication (development only)
Default:
Default:
falseSession cleanup job interval
Default:
Default:
3600 (1 hour)OAuth state cleanup interval
Default:
Default:
300 (5 minutes)Weaver Configuration
Enable weaver provisioning
Default:
Default:
falseKubernetes namespace for weavers
Default:
Default:
loom-weaversWeaver TTL cleanup job interval
Default:
Default:
60 (1 minute)Logging
Log level: trace, debug, info, warn, error
Default:
Default:
infoCore APIs
Health Check
LLM Proxy
The LLM proxy routes requests to configured providers (Anthropic/OpenAI) while handling authentication, rate limiting, and token management.
- Server-Sent Events (SSE)
- Event types:
text_delta,tool_call_delta,completed,error
Thread APIs
- Create/Update
- Retrieve
- List
- Search
- Messages (user, assistant, tool)
- Agent state (waiting, executing, error)
- Git metadata (branch, commits, remote)
- Workspace info
Weaver APIs
See Weavers documentation for complete API reference.Background Jobs
The server runs scheduled background jobs using theJobScheduler:
Weaver Cleanup
Deletes expired weavers based on TTL
Interval: 60 seconds
Interval: 60 seconds
Session Cleanup
Removes expired auth sessions
Interval: 1 hour
Interval: 1 hour
OAuth State Cleanup
Purges expired OAuth states
Interval: 5 minutes
Interval: 5 minutes
Job History Cleanup
Archives old job execution logs
Interval: 24 hours
Interval: 24 hours
Token Refresh
Refreshes OAuth tokens for LLM pool
Interval: 5 minutes
Interval: 5 minutes
SCM Maintenance
Runs git gc on SCM repositories
Interval: Configurable
Interval: Configurable
Cron Monitoring
Detects missed runs and timeouts
Interval: 60 seconds
Interval: 60 seconds
Session Aggregation
Aggregates app sessions into metrics
Interval: 1 hour
Interval: 1 hour
Database Schema
Migrations are incrates/loom-server/migrations/ as numbered SQL files:
- Create new file:
NNN_description.sql - Run
cargo2nix-updateto regenerateCargo.nix - Migrations auto-run on server startup
Self-Monitoring
Loom uses itself for crash reporting:loom-server(backend crashes)loom-web(frontend crashes)loom-cli(CLI crashes)
Deployment
NixOS Auto-Update
Production server runs NixOS with automatic deployment:- Push to
trunkbranch - Auto-update service polls every 10 seconds
- Pulls latest commit
- Rebuilds with Nix
- Switches to new configuration
- Restarts
loom-server.service
Verify Deployment
Monitoring
Logs
Admin UI
The server includes a log streaming endpoint for admin dashboards:Security
Authentication
- OAuth 2.0: GitHub, Google providers
- Magic Links: Email-based passwordless auth
- Session Tokens: Secure, httpOnly cookies
- API Keys: For programmatic access
Secrets Management
All secrets useloom-common-secret::SecretString:
- Auto-redacts in Debug/Display/Serialize
- Access via
.expose()only when needed - Never logged by tracing instrumentation
CORS
Configured to allow:- Any origin (development)
- Any methods
- Any headers
Performance
Database Connection Pooling
sqlx::PgPool with:
- Automatic connection management
- Prepared statement caching
- Health checks
Caching
- Thread Store: In-memory cache for recent threads
- Docs Index: Loaded once on startup
- Job Scheduler: Periodic task execution without polling
Troubleshooting
Server won't start
Server won't start
Check PostgreSQL connection:Verify migrations:
Weaver provisioning fails
Weaver provisioning fails
Check Kubernetes access:Verify namespace exists:
LLM proxy errors
LLM proxy errors
Enable debug logging:Check provider credentials in database.