# agnath18k/lumo_cli architecture

> Architecture diagram of the GitHub repository agnath18k/lumo_cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agnath18k/lumo_cli
- Repository: https://github.com/agnath18k/lumo_cli

## Overview

##### Project type and purpose
- Lumo is an open-source, AI-powered CLI assistant written in Go.
- It bridges natural-language input to terminal commands, offers autonomous “agent” mode, chat mode, system health checks, speed tests, and pipe analysis.

##### File structure
- **cmd/**: the CLI entry point (cmd/lumo/main.go)
- **pkg/**: modular packages implementing core functionality
- pkg/agent – planning & autonomous execution
- pkg/chat – conversational interface & REPL
- pkg/ai – wrappers for AI providers (OpenAI, Gemini, Ollama)
- pkg/executor – executing shell commands, speed tests, key status
- pkg/system – health & performance monitoring
- pkg/pipe – processing piped stdin text
- pkg/clipboard – clipboard integration
- pkg/config, pkg/setup, pkg/utils, pkg/version – bootstrap, config, utilities
- **scripts/**: release & packaging automation
- **build/** & **debian/**: pre-built binaries & Debian packaging
- **docs/**, **tests/**: examples and unit tests

##### README insights
- Emphasizes features: natural-language processing, agent/chat modes, multiple AI backends, system monitoring, pipe support

##### Detail
- Don’t merge too many subsystems: show pkg/agent planner vs. executor vs. feedback
- Call out the REPL vs. single-command modes separately
- Package names for clarity (e.g., pkg/ai/openai.go)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and CLI
    User["User"]:::external
    CLI["CLI Frontend"]:::core
    User -->|"invokes lumo"| CLI

    %% Config & Setup
    subgraph "Configuration & Setup"
        Config["Config & Setup"]:::utility
    end
    CLI -->|"loads config & setup"| Config

    %% Input Manager
    Manager["Input Manager & Flag Parsing"]:::core
    Config --> Manager

    %% Modes and Processing
    subgraph "Modes"
        Chat["Chat REPL"]:::core
        Agent["Agent Engine"]:::core
        Pipe["Pipe Processor"]:::core
        SysMon["System Monitor"]:::integration
    end
    Manager -->|"interactive mode"| Chat
    Manager -->|"auto: commands"| Agent
    Manager -->|"stdin present"| Pipe
    Manager -->|"health/speed checks"| SysMon

    %% Agent Engine details
    subgraph "Agent Engine Components" 
        Planner["Planner"]:::core
        AExec["Agent Executor"]:::core
        Feedback["Feedback Loop"]:::core
        Models["Agent Models"]:::core
    end
    Agent --> Planner
    Agent --> AExec
    Agent --> Feedback
    Agent --> Models

    %% AI Integrations
    subgraph "AI Integrations" 
        Client["AI Client"]:::integration
        OpenAI["OpenAI"]:::integration
        Gemini["Gemini"]:::integration
        Ollama["Ollama"]:::integration
        Instr["Instructions"]:::integration
        SysInstr["System Instructions"]:::integration
    end
    Planner -->|"HTTP API call"| Client
    Client --> OpenAI
    Client --> Gemini
    Client --> Ollama
    Planner --> Instr
    Planner --> SysInstr

    %% Command Executor
    subgraph "Command Executor"
        Exec["Executor"]:::core
        KeyStat["Key Status"]:::core
        SpeedExec["Speedtest Module"]:::core
        ModelList["Model List"]:::core
    end
    AExec --> Exec
    Exec --> KeyStat
    Exec --> SpeedExec
    Exec --> ModelList

    %% Utilities
    subgraph "Utilities & Tools"
        Clipboard["Clipboard"]:::utility
        Utils["Utils"]:::utility
        Version["Version"]:::utility
        Magic["Magic"]:::utility
        NLP["NLP Parser"]:::utility
        Terminal["Terminal"]:::utility
    end
    Exec --> Clipboard
    Exec --> Utils
    Exec --> Version
    Exec --> Magic
    Exec --> NLP
    Exec --> Terminal

    %% System Monitor internals
    subgraph "System Monitor Components"
        Health["Health Check"]:::integration
        Report["Report Generator"]:::integration
        SysUtils["Sys Utils"]:::integration
        SpeedTest["Speedtest"]:::integration
    end
    SysMon --> Health
    SysMon --> Report
    SysMon --> SysUtils
    SysMon --> SpeedTest

    %% Pipe processing
    Pipe --> Exec

    %% Chat REPL internals
    subgraph "Chat Components"
        ChatMgr["Chat Manager"]:::core
        ChatUI["REPL Interface"]:::core
    end
    Chat --> ChatMgr
    Chat --> ChatUI
    ChatMgr --> Client
    ChatMgr --> Exec

    %% Logging
    Logs["Logging"]:::logging
    CLI --> Logs
    Manager --> Logs
    Agent --> Logs
    Exec --> Logs
    SysMon --> Logs
    Chat --> Logs
    Pipe --> Logs

    %% External Services
    subgraph "External Services"
        ExtOpenAI["OpenAI API"]:::external
        ExtGemini["Gemini API"]:::external
        ExtOllama["Ollama Daemon"]:::external
    end
    OpenAI --> ExtOpenAI
    Gemini --> ExtGemini
    Ollama --> ExtOllama

    %% Click Events
    click CLI "https://github.com/agnath18k/lumo_cli/blob/main/cmd/lumo/main.go"
    click Manager "https://github.com/agnath18k/lumo_cli/blob/main/pkg/chat/manager.go"
    click Pipe "https://github.com/agnath18k/lumo_cli/blob/main/pkg/pipe/pipe.go"
    click Agent "https://github.com/agnath18k/lumo_cli/blob/main/pkg/agent/agent.go"
    click Planner "https://github.com/agnath18k/lumo_cli/blob/main/pkg/agent/planner.go"
    click AExec "https://github.com/agnath18k/lumo_cli/blob/main/pkg/agent/executor.go"
    click Feedback "https://github.com/agnath18k/lumo_cli/blob/main/pkg/agent/feedback.go"
    click Models "https://github.com/agnath18k/lumo_cli/blob/main/pkg/agent/models.go"
    click ChatUI "https://github.com/agnath18k/lumo_cli/blob/main/pkg/chat/repl.go"
    click ChatMgr "https://github.com/agnath18k/lumo_cli/blob/main/pkg/chat/chat.go"
    click Exec "https://github.com/agnath18k/lumo_cli/blob/main/pkg/executor/executor.go"
    click KeyStat "https://github.com/agnath18k/lumo_cli/blob/main/pkg/executor/key_status.go"
    click SpeedExec "https://github.com/agnath18k/lumo_cli/blob/main/pkg/executor/speedtest.go"
    click ModelList "https://github.com/agnath18k/lumo_cli/blob/main/pkg/executor/model_list.go"
    click Health "https://github.com/agnath18k/lumo_cli/blob/main/pkg/system/health.go"
    click Report "https://github.com/agnath18k/lumo_cli/blob/main/pkg/system/report.go"
    click SysUtils "https://github.com/agnath18k/lumo_cli/blob/main/pkg/system/utils.go"
    click SpeedTest "https://github.com/agnath18k/lumo_cli/blob/main/pkg/speedtest/speedtest.go"
    click Client "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/client.go"
    click OpenAI "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/openai.go"
    click Gemini "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/gemini.go"
    click Ollama "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/ollama.go"
    click Instr "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/instructions.go"
    click SysInstr "https://github.com/agnath18k/lumo_cli/blob/main/pkg/ai/system_instructions.go"
    click Config "https://github.com/agnath18k/lumo_cli/blob/main/pkg/config/config.go"
    click Clipboard "https://github.com/agnath18k/lumo_cli/blob/main/pkg/clipboard/clipboard.go"
    click Utils "https://github.com/agnath18k/lumo_cli/blob/main/pkg/utils/utils.go"
    click Version "https://github.com/agnath18k/lumo_cli/blob/main/pkg/version/version.go"
    click Magic "https://github.com/agnath18k/lumo_cli/blob/main/pkg/magic/magic.go"
    click NLP "https://github.com/agnath18k/lumo_cli/blob/main/pkg/nlp/parser.go"
    click Terminal "https://github.com/agnath18k/lumo_cli/blob/main/pkg/terminal/terminal.go"
    click Logs "https://github.com/agnath18k/lumo_cli/tree/main/logs/"
    click Logs "https://github.com/agnath18k/lumo_cli/blob/main/logs/lumo_2025-05-13.log"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000;
    classDef integration fill:#90EE90,stroke:#000;
    classDef utility fill:#D3D3D3,stroke:#000;
    classDef external fill:#FFA500,stroke:#000;
    classDef logging fill:#FFD700,stroke:#000;
```
