How loorksy/nanoagent works
mokli is a self-hosted personal AI agent framework, with a browser UI, terminal and chat integrations, APIs, and a companion mobile app. The central workflow is a user request entering through a surface, being handled in a persistent session with model and tool support, and returning a response; scheduled automation and long-term memory extend that workflow. The tree also contains a distinct trading subsystem. Relationships involving unsampled modules are included only where the README documents the capability; source-level wiring is not inferred from directory names.
Main entry points: agent Agent Loop · src Browser UI · main.py UI Backend · app.ts Terminal UI
Components 21
User Surfaces
- Terminal UI
tui/src/app.ts - Browser UI
mokli-ui/src - Mobile App
mobile/app - OpenAI API
mokli/api/server.py
Agent Runtime
- Agent Loop
mokli/agent - Session Manager
mokli/session/manager.py - Model Providers
mokli/providers - Agent Tools
mokli/agent/tools - Long-term Memory
mokli/agent - Scheduled Automation
mokli/cron/service.py
Integrations
- Chat Channels
mokli/channels/manager.py - Agent Gateway
mokli/gateway/service.py - Python SDK
mokli/sdk/clients.py - UI Backend
mokli-ui/backend/mokli_ui/main.py - Retrieval
mokli-ui/backend/mokli_ui/retrieval - Pipeline Routes
mokli-ui/backend/mokli_ui/routers/pipelines.py
Trading
- Trade Management
mokli/trading/management/engine.py - Backtesting
mokli/trading/backtest/engine.py - MT5 Broker
mokli/trading
Other components
- User
- Chat Apps
Connections 21
- User → Terminal UI: enters request
- User → Browser UI: enters request
- User → Mobile App: uses app
- User → OpenAI API: submits request
- Terminal UI → Agent Loop: sends request
- Browser UI → Agent Loop: sends request
- OpenAI API → Agent Loop: routes request
mokli/api/server.py - Agent Loop → Session Manager: keeps history
mokli/agent/loop.py - Agent Loop → Model Providers: routes models
mokli/agent/loop.py - Agent Loop → Agent Tools: uses tools
mokli/agent/loop.py - Agent Loop → Long-term Memory: uses memory
- Scheduled Automation → Agent Loop: automates work
- Chat Apps → Chat Channels: sends messages
- Chat Channels → Agent Loop: forwards messages
- Agent Gateway → Agent Loop: runs agent
- Python SDK → Agent Loop: integrates with
mokli/sdk/clients.py - Browser UI → UI Backend: requests services
- UI Backend → Retrieval: uses retrieval
- UI Backend → Pipeline Routes: routes pipelines
mokli-ui/backend/mokli_ui/main.py - Trade Management → MT5 Broker: reads positions
mokli/trading/management/engine.py - Backtesting → Trade Management: shares policy