How adhilgafoor00-stack/spektra works
This is a single-process Flask web application that serves a local, modular “intelligent assistant”. It provides:
• A web UI (HTML/CSS/JS) with “HUD widgets” (clock/system/network stats).
• An assistant core that parses commands and routes them to “tools” / “skills”.
• Memory + learning persisted to JSON (data/memory.json, data/facts.json).
• Optional external integrations (Wikipedia, DuckDuckGo) depending on installed packages / network availability.
• A project generator tool (genproj) and small utilities (file manager, calculator, code snippets).
Entry point / Web server
• app.py
Likely creates the Flask app, defines HTTP routes, serves templates/index.html, and exposes endpoints used by static/js/app.js for:
• sending user commands
• fetching widget data
Core assistant engine (domain layer)
• core/assistant.py
Central orchestrator: command parsing, dispatch, response formatting.
• core/tools.py
“Tool registry” / execution layer (calc/search/code/genproj/etc).
• core/memory.py
Persistence + retrieval for notes/recall; reads/writes data/memory.json.
• core/learn.py
“teach/facts/ask retrieval” logic; reads/writes data/facts.json; used by assistant for Q&A.
• core/widgets.py
Provides widget data (clock/system/network) to UI; depends on psutil optionally.
Extensible skills (plugin-like layer)
• skills/ (skills/general.py, skills/file_manager.py, skills/__init__.py)
Data stores (local persistence)
• data/facts.json
• data/memory.json
Build/runtime config
• requirements.txt
Shows runtime dependencies (not architecture per se, but important callouts: Flask, wikipedia, psutil).
Browser UI (index.html + app.js)
→ sends user text command over HTTP (likely AJAX/fetch)
Flask app (app.py)
→ calls Assistant (core/assistant.py)
Assistant
→ routes to:
• Tools layer (core/tools.py) and/or Skills (skills/*)
• Memory (core/memory.py) for save/recall/notes
• Learning (core/learn.py) for teach/facts/ask (local facts retrieval)
Optional external calls
• ask may call Wikipedia API (via wikipedia package)
• search may call DuckDuckGo (or open a URL / scrape depending on implementation)
Assistant returns response
→ Flask returns JSON/HTML
→ Browser renders output
Persistence flows
• teach ... → core/learn.py → writes data/facts.json
• save note ... → core/memory.py → writes data/memory.json
• facts/recall → read from those JSON files
Project generation / filesystem operations (security-relevant)
• genproj ... and ls/cat → skills/tools that read/write local filesystem
Architectural pattern callouts (what to label explicitly)
• Modular Monolith: one Flask process, separated into core modules + skills.
• Command Router / Dispatcher: assistant parses text → routes to a handler (tools/skills).
• Plugin-like Skills: skills/ directory as extensibility point (add new capabilities without rewriting core).
• File-based persistence: JSON “datastores” instead of DB.
• Graceful degradation: widgets degrade if psutil missing; ask falls back if Wikipedia missing.
Use this as the exact layout:
• User
→ Browser (templates/index.html + static/js/app.js + static/css/styles.css)
⇄ HTTP/JSON
Flask App (app.py)
→ core/assistant.py (parse + dispatch)
→ core/tools.py (tool execution)
→ skills/general.py
→ skills/file_manager.py (filesystem ops)
→ (search / code / genproj handlers)
→ core/memory.py ⇄ data/memory.json
→ core/learn.py ⇄ data/facts.json
→ (ask) ⇄ Wikipedia (optional)
→ (search) ⇄ DuckDuckGo (optional)
→ core/widgets.py → psutil/OS (optional) → returns widget JSON