How materwan/clara works
Clara is a single-process HTTP AI assistant: clients authenticate and submit conversations, the server coordinates model turns, shared SQLite memory, projects, and optional connected-resource tools, then returns streamed or direct answers. The web app and Discord adapter are distinct clients; administrator and account-management functions are additional product branches. Major capabilities are represented using paths in the tree and README; unsampled implementations are linked only where the README or indexed source establishes the relationship.
Main entry points: server.py HTTP API · agent.py Conversation agent · broker.py Tool broker · handler.py Discord adapter
Components 25
Clients
- Terminal client
src/clara/client.py - Discord adapter
src/clara/discord_bot/handler.py - Message routing
src/clara/discord_bot/routing.py - Web application
src/clara/web/app.js - Web chat
src/clara/web/chat.js - Discord service
src/clara/discord_bot/service.py
Server runtime
- HTTP API
src/clara/server.py - Conversation agent
src/clara/agent.py - Model providers
src/clara/providers.py
Memory and projects
- SQLite memory
src/clara/memory.py - Projects and files
src/clara/projects.py - File ingestion
src/clara/ingest.py
Connected tools
- Integration API
src/clara/integrationapi.py - Tool broker
src/clara/integrations/broker.py - Permission rules
src/clara/integrations/permissions.py - Integration state
src/clara/integrations/store.py - Resource connectors
src/clara/integrations/connectors - Approvals
src/clara/integrations/approvals.py
Accounts and admin
- User accounts
src/clara/users.py - Authentication
src/clara/auth.py - Tasks and reminders
src/clara/tasks.py - Notifications
src/clara/notifications.py - Web administration
src/clara/web/admin.js
Other components
- User
- Ollama web tools
Connections 28
- User → Terminal client: asks
- Terminal client → HTTP API: sends chat
- User → Web application: uses
- Web application → Web chat: opens chat
src/clara/web/app.js - Web chat → HTTP API: sends chat
- User → Discord adapter: messages
- Discord adapter → Message routing: routes messages
src/clara/discord_bot/handler.py - Discord adapter → HTTP API: forwards requests
- HTTP API → Conversation agent: runs turn
src/clara/server.py - Conversation agent → Model providers: requests completion
- Conversation agent → SQLite memory: reads and writes
- Conversation agent → Projects and files: uses project context
- Projects and files → File ingestion: extracts files
src/clara/projects.py - Integration API → Tool broker: exposes tools
- Tool broker → Permission rules: checks access
src/clara/integrations/broker.py - Tool broker → Integration state: loads resources
src/clara/integrations/broker.py - Tool broker → Resource connectors: dispatches operations
src/clara/integrations/broker.py - Tool broker → Approvals: requests approval
src/clara/integrations/broker.py - User → Authentication: signs in
- Authentication → User accounts: checks accounts
src/clara/auth.py - HTTP API → Authentication: authenticates
src/clara/server.py - User → Web administration: administers
- Web administration → HTTP API: calls API
- User → Tasks and reminders: manages tasks
- Tasks and reminders → SQLite memory: persists state
src/clara/tasks.py - Tasks and reminders → Notifications: sends notices
src/clara/tasks.py - Conversation agent → Ollama web tools: uses web tools
- Discord service → Discord adapter: runs adapter
src/clara/discord_bot/service.py