How fus3n/gem-assist works
Main Components
• • Entry Point & Configuration: Highlight assistant.py as the primary runtime file and config.py for central configuration (model selection, system prompts, and assistant name).
• • Core Logic Modules: Include the gem module (which contains command definitions and utilities – see files like gem/builtin_commands.py, gem/command.py, gem/utils.py) and the func_to_schema package. These encapsulate the assistant’s command and functionality mapping.
• • Utility Tools: Mark utility.py as the collector of various built-in tools (file system, web, Reddit, system info, etc.) that the assistant leverages.
• • External Integrations: Represent the API integrations for Google Gemini (and, via litellm, additional models), DuckDuckGo, Reddit (praw), and other potential web services.
• • Testing: Separate the tests directory to indicate the presence of unit tests ensuring functionality.
Relationships and Interactions
• • The assistant.py script serves as the user interface (CLI) and orchestrates the flow: it reads user input, refers to the configuration in config.py, and delegates tasks to the gem module’s CommandExecutor or other components.
• • Communication exists between modules: the gem package receives user commands, uses functions from utility.py to perform tasks, and communicates with external APIs.
• • Indicate that errors or results flow back to the CLI, closing the loop.
Architectural Patterns & Design Principles
• • Modularity: The code is cleanly separated into modules (assistant.py, gem package, utility functions, config) which enables easy extension.
• • Tool-based Architecture: The assistant delegates specific functionalities to discrete tool functions (for file operations, web search, etc.), making the system extensible.
• • Extensibility: New commands or tools can be easily added by following examples in gem/builtin_commands.py and utility.py.
• • Testing Driven: The structure contains a tests directory, indicating unit testing practices have been followed.
Technologies & Frameworks
• • Python (3.11+): The language of implementation.
• • External Libraries: Mention libraries like google-genai (for Gemini), ollama, duckduckgo-search, praw, rich, and python-dotenv for environment management.
• • UV: The dependency manager and runner is part of the deployment/execution environment.
Elements
• • Optionally, include annotations such as “Extensible via code modifications” near gem/builtin_commands.py and note that the command ecosystem is the heart of the system.