How prateekjannu/zen works
Main Components
• Frontend UI (Svelte/Vite)
• Backend Server (Python, uv)
• Agent Orchestrator & Sub‑agents
• LLM Clients (Gemini, optional OpenAI)
• Browser Automation (Playwright)
• Memory & Persistence (SQLite zen.db, project files)
• Services Layer (Git, GitHub, Netlify, Search APIs)
• Logging & Monitoring
Relationships and Data Flows
• UI ↔ Backend: bi‑directional WebSocket/HTTP (via ui/src/lib/sockets.js and src/socket_instance.py)
• Backend ↔ LLM APIs: request/response over HTTPS (Gemini API via src/llm/gemini_client.py)
• Agent Orchestrator ⟶ Sub‑agents: in‑process calls (each agent module imports src/agents/...)
• Agents ⟶ Browser: control Playwright (src/browser/browser.py) for web searches and scraping
• Agents ⟶ Memory DB: read/write to SQLite (data/db/zen.db via src/memory/knowledge_base.py)
• Agents ⟶ External Services: Git/GitHub pulls/pushes (src/services/git.py, github.py), Netlify deploys (netlify.py), search API calls (src/services/utils.py)
• Logging: all components emit logs to data/logs/zen_agent.log via src/logger.py
Architectural Patterns
• Layered Architecture:
• Presentation (UI)
• API/WebSocket Gateway
• Application Logic (Agent Orchestrator → Sub‑agents)
• Integration Layer (LLM client, Browser, Services)
• Persistence (SQLite, project filesystem)
• Plugin‑like Agent Modules: each agent (action, planner, researcher, etc.) implements a common interface (src/agents/agent.py) and Jinja2 prompts.
Incorporate Key Technologies
• Frontend: Svelte, Vite, Bun, Tailwind CSS
• Backend: Python ≥3.10, uv server, Playwright, SQLite
• APIs: Gemini, Bing/Google Search, GitHub
• Inter‑process comms: WebSockets (socket.io style)
Essential Details to Capture
• Frontend ↔ Backend communication channel (sockets.js ↔ socket_instance.py)
• Agent orchestration flow: high‑level task → planner → researcher/builder → coder → patcher → reporter
• Integration modules: browser automation, API calls, file I/O
• Persistence: how projects and logs are stored under data/