Workspace Configuration
The rootCargo.toml defines workspace members and shared dependencies:
Crate Categories
Common Layer (loom-common-*)
Foundation crates providing shared functionality across all applications.
loom-common-core
loom-common-core
LlmClienttrait for LLM provider abstractionAgentstate machine for conversation flowLlmRequest,LlmResponse,LlmStreamtypesMessage,Role,ToolCallmessage typesAgentState,AgentEvent,AgentActionenumsToolDefinition,ToolContextfor tool system
agent.rs- Agent state machine implementationllm.rs- LLM client trait and typesstate.rs- State machine typesmessage.rs- Message typestool.rs- Tool abstractionserror.rs- Error types
loom-common-http
loom-common-http
new_client()- Creates HTTP client with standard User-Agentbuilder()- Returns ClientBuilder with User-AgentRetryConfig- Configurable retry parametersRetryableErrortrait - Determines retry eligibilityretry()function - Exponential backoff wrapper
loom/{platform}/{git_sha}loom-common-config
loom-common-config
- Layered config: CLI args → env vars → config file → defaults
- XDG Base Directory compliance
- TOML configuration format
- Environment variable overrides
loom-common-secret
loom-common-secret
Secret<T>wrapper for sensitive valuesSecretStringtype alias- Auto-redaction in Debug/Display/Serialize
expose()method for controlled access- Integration with tracing (auto-skip in logs)
loom-common-thread
loom-common-thread
- SQLite-based thread storage
- FTS5 full-text search
- Git metadata tracking
- Cross-device sync
- Message history management
loom-common-webhook
loom-common-webhook
- Webhook signature verification
- Event payload parsing
- Retry logic for failed webhooks
loom-common-i18n
loom-common-i18n
- GNU gettext-based translation
- 17 supported locales
.pofiles compiled to.moat build timet()andt_fmt()translation functions- RTL language support
en, es, ar, fr, de, ja, zh, ko, pt, ru, hi, it, nl, pl, tr, vi, thloom-common-spool
loom-common-spool
- jj (Jujutsu) VCS integration
- Tapestry naming (stitch, pin, tangle)
- Conflict-free replicated data types
loom-common-version
loom-common-version
- Semantic versioning
- Git commit tracking
- Build metadata
Server Layer (loom-server-*)
Server-side components for HTTP API, authentication, and LLM integration.
loom-server
loom-server
- Axum-based HTTP server
- OpenAPI documentation with Swagger UI
- Health check endpoint (
/health) - WebSocket support for real-time updates
- Graceful shutdown
- Database migrations
crates/loom-server/migrations/NNN_description.sqlloom-server-api
loom-server-api
- Thread management routes
- Weaver provisioning routes
- Analytics routes
- Feature flag routes
- SCIM routes
- SCM routes
loom-server-db
loom-server-db
- SQLite with sqlx
- Connection pooling
- Migration management
- Query builders
loom-server-llm-service
loom-server-llm-service
LlmService- Multi-provider support- Provider availability checks:
has_anthropic(),has_openai(), etc. - Provider-specific methods:
complete_anthropic(),complete_openai(), etc. - Owns all API keys server-side
loom-server-llm-anthropicloom-server-llm-openailoom-server-llm-vertexloom-server-llm-zai
loom-server-llm-proxy
loom-server-llm-proxy
ProxyLlmClient- ImplementsLlmClientvia HTTP- Provider-specific constructors:
anthropic(),openai(),vertex(),zai() - SSE stream parsing
- Bearer token authentication
loom-server-llm-anthropic
loom-server-llm-anthropic
- Claude API integration
- SSE streaming support
- Tool calling
- System message handling
- OAuth 2.0 PKCE for Claude Pro/Max subscriptions
loom-server-llm-openai
loom-server-llm-openai
- OpenAI API integration
- Streaming completions
- Function calling
- Organization support
loom-server-llm-vertex
loom-server-llm-vertex
- Vertex AI API integration
- Gemini Pro, Gemini Flash models
- Service account authentication
loom-server-llm-zai
loom-server-llm-zai
- Z.ai API integration (OpenAI-compatible)
- GLM-4 models:
glm-4.7,glm-4.6,glm-4.5, etc. - Streaming support
loom-server-auth*
loom-server-auth*
loom-server-auth- Auth abstraction layerloom-server-auth-devicecode- Device code flow (OAuth 2.0)loom-server-auth-github- GitHub OAuthloom-server-auth-google- Google OAuthloom-server-auth-magiclink- Email magic linksloom-server-auth-okta- Okta OIDC
loom-server-k8s
loom-server-k8s
- Pod provisioning
- Service discovery
- Resource management
- Health checks
loom-server-weaver
loom-server-weaver
- Weaver provisioning
- Lifecycle management
- Resource limits
- Audit logging
loom-server-scm
loom-server-scm
- Repository management
- Branch protection
- Webhooks
- Mirroring
- Access control
Other Server Crates
Other Server Crates
loom-server-session- Session managementloom-server-geoip- IP geolocationloom-server-jobs- Background job schedulerloom-server-smtp- Email sendingloom-server-email- Email templates and i18nloom-server-github-app- GitHub App integrationloom-server-search-serper- Serper API searchloom-server-search-google-cse- Google Custom Searchloom-server-provisioning- User/org provisioningloom-server-scim- SCIM 2.0 for IdP integrationloom-server-audit- Audit logging with SIEMloom-server-config- Server configurationloom-server-logs- Log aggregationloom-server-clips- Code snippet sharing (gists)loom-server-secrets- Secret management for weaversloom-server-wgtunnel- WireGuard tunnel serverloom-server-docs- Documentation API
CLI Layer (loom-cli-*)
Command-line interface and related utilities.
loom-cli
loom-cli
- Command-line argument parsing (clap)
- REPL loop
- Tool execution orchestration
- ProxyLlmClient integration
- Thread management
- Weaver management
loom-cli-config
loom-cli-config
- CLI-specific settings
- Server URL configuration
- Default model selection
loom-cli-credentials
loom-cli-credentials
- OAuth token storage
- Keychain integration
- Token refresh
loom-cli-tools
loom-cli-tools
ReadFileTool- Read file contentsListFilesTool- List directory contentsEditFileTool- Edit file with search/replaceBashTool- Execute bash commandsGrepTool- Search file contentsGlobTool- Find files by pattern- Tool registry
loom-cli-git
loom-cli-git
- Repository detection
- File staging
- Commit creation
- Git metadata tracking
loom-cli-auto-commit
loom-cli-auto-commit
- Post-tool hook integration
- LLM-powered commit message generation
- Automatic staging and committing
loom-cli-acp
loom-cli-acp
- Editor integration protocol
- JSON-RPC communication
- Event streaming
loom-cli-spool
loom-cli-spool
- Jujutsu VCS operations
- Tapestry workflow support
loom-cli-wgtunnel
loom-cli-wgtunnel
- WireGuard tunnel management for weaver access
- DERP relay support
Observability Suite
Integrated observability platform inspired by Sentry/PostHog.Analytics
Analytics
loom-analytics-core- Core types and traitsloom-analytics- Client libraryloom-server-analytics- Server ingestion and storage
- Event tracking
- User identification
- Identity resolution (merge users across devices)
- Funnel analysis
- Cohort analysis
Crash Reporting
Crash Reporting
loom-crash-core- Core crash typesloom-crash- Client crash reporterloom-crash-symbolicate- Source map symbolicationloom-server-crash- Crash ingestion and deduplication
- Stack trace capture
- Regression detection
- Crash grouping
- Source map upload and symbolication
Cron Monitoring
Cron Monitoring
loom-crons-core- Cron core typesloom-crons- Client check-in libraryloom-server-crons- Cron monitoring server
- Ping URL check-ins
- SDK check-ins with duration tracking
- Miss detection
- Alert integration
Session Analytics
Session Analytics
loom-sessions-core- Session core typesloom-server-sessions- Session analytics server
- Release health tracking
- Crash-free session rate
- Session replay
- Adoption tracking
Feature Flags
Feature Flags
loom-flags-core- Flag core typesloom-flags- Client flag evaluationloom-server-flags- Flag management server
- Boolean flags
- Multivariate flags
- Percentage rollouts
- User/org targeting
- Kill switches
- SSE updates for real-time changes
TUI Layer (loom-tui-*)
Terminal user interface components based on Ratatui 0.30.
loom-tui-app
loom-tui-app
- Event loop
- Screen management
- Keyboard handling
- Component composition
loom-tui-core
loom-tui-core
- Component trait
- Event system
- State management
loom-tui-component
loom-tui-component
- Composable components
- Props pattern
- Event propagation
loom-tui-theme
loom-tui-theme
- Color schemes
- Style definitions
- Theme switching
loom-tui-widget-*
loom-tui-widget-*
loom-tui-widget-message-list- Chat message displayloom-tui-widget-input-box- Text inputloom-tui-widget-markdown- Markdown renderingloom-tui-widget-thread-list- Thread/conversation listloom-tui-widget-tool-panel- Tool execution statusloom-tui-widget-status-bar- Status informationloom-tui-widget-header- Application headerloom-tui-widget-modal- Modal dialogsloom-tui-widget-spinner- Loading spinnerloom-tui-widget-scrollable- Scrollable containers
loom-tui-storybook
loom-tui-storybook
- Component storybook
- Visual regression tests
- Screenshot comparison
loom-tui-testing
loom-tui-testing
- Mock terminal
- Event simulation
- Snapshot assertions
Weaver (Remote Execution)
Kubernetes-based remote execution environment.loom-weaver-secrets
loom-weaver-secrets
- SPIFFE Verifiable Identity Document (SVID)
- Secret injection into pods
- Rotation support
loom-weaver-audit-sidecar
loom-weaver-audit-sidecar
- eBPF program loader
- Syscall event capture
- Audit log streaming
loom-weaver-wgtunnel
loom-weaver-wgtunnel
- WireGuard client for weaver pods
- Tunnel setup and teardown
loom-weaver-ebpf
loom-weaver-ebpf
- Syscall tracing programs
- Network monitoring
- File access tracking
loom-wgtunnel-*
loom-wgtunnel-*
loom-wgtunnel-common- Shared typesloom-wgtunnel-conn- Connection managementloom-wgtunnel-derp- DERP relay protocolloom-wgtunnel-engine- Tunnel engine
Utility Crates
loom-redact
loom-redact
- Gitleaks pattern-based detection
- Automatic redaction
- Secret scanning
loom-scim
loom-scim
- RFC 7643/7644 compliance
- User/Group resources
- Patch operations
loom-jobs
loom-jobs
- Job queue
- Worker pool
- Retry logic
loom-whatsapp
loom-whatsapp
- Message sending
- Webhook handling
- Media support
Dependency Graph
The workspace follows strict layering:Build Optimization
Profile Settings
The workspace uses custom build profiles for faster development:cargo2nix Integration
The workspace uses cargo2nix for reproducible builds:Database Migrations
Migrations run automatically on server startup. After adding/modifying migrations:- Run
cargo2nix-update(cargo2nix doesn’t trackinclude_str!file changes) - Commit
Cargo.nixalong with migration changes - Without this step, deployed binary won’t include the new migration!
Testing Strategy
Unit Tests
Most crates include unit tests insrc/ files or tests/ directory.
Integration Tests
Integration tests live in crate-specifictests/ directories.
Property-Based Tests
Critical crates useproptest for property-based testing: