# marreouu/glm-c0deur architecture

> Architecture diagram of the GitHub repository marreouu/glm-c0deur, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marreouu/glm-c0deur
- Repository: https://github.com/marreouu/glm-c0deur

## Overview

GLM Code is an interactive terminal coding assistant. Its main workflow runs from CLI startup and configuration through the Agent’s brain-model conversation, tool execution or optional coder delegation, then presents results in the terminal and persists conversation history. The repository also includes skills, file watching, and code-analysis capabilities (planning, refactoring, Git intelligence, semantic search, and a knowledge graph), plus update checks. Edges below are limited to calls shown in excerpts, indexed references, or README statements; unsampled subsystem connections are omitted.

Main entry points: [`glmcode/cli.py`](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/cli.py) (CLI and commands), [`glmcode/agent.py`](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/agent.py) (Agent orchestration), [`glmcode/tui.py`](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/tui.py) (Terminal UI), [`glmcode/updater.py`](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/updater.py) (Updater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_cli["CLI and commands<br/>[cli.py]"]
  node_terminal["Terminal UI<br/>[tui.py]"]
  node_ui["Terminal output<br/>[ui.py]"]
end

subgraph group_agent["Agent workflow"]
  node_agent_core["Agent orchestration<br/>[agent.py]"]
  node_brain["Brain model client<br/>[client.py]"]
  node_coder["Code generation<br/>[coder.py]"]
  node_tools["File and shell tools<br/>[tools.py]"]
  node_skills["Custom skills<br/>[skills.py]"]
end

subgraph group_analysis["Code analysis"]
  node_planner["Planning<br/>[planner.py]"]
  node_refactor["Refactoring<br/>[refactor_engine.py]"]
  node_git["Git intelligence"]
  node_search["Semantic search<br/>[semantic_search.py]"]
  node_knowledge["Code knowledge graph<br/>[knowledge_graph.py]"]
  node_context["Context management<br/>[context_manager.py]"]
end

subgraph group_support["Session and support"]
  node_config["Configuration<br/>[config.py]"]
  node_sessions[("Session history<br/>[session.py]")]
  node_runtime["Processes and watches<br/>[runtime.py]"]
  node_monitor["Performance monitor"]
  node_updater["Updater<br/>[updater.py]"]
  node_remote["Remote release checks<br/>[remote.py]"]
  node_version["Version handling<br/>[version.py]"]
end

node_user(("User"))
node_zai{{"Z.ai API"}}
node_openrouter{{"OpenRouter API"}}

node_user -->|"starts assistant"| node_cli
node_cli -->|"loads settings"| node_config
node_cli -->|"creates agent"| node_agent_core
node_cli -->|"starts interface"| node_terminal
node_cli -->|"loads skills"| node_skills
node_terminal -->|"submits input"| node_agent_core
node_terminal -->|"starts file watch"| node_runtime
node_agent_core -->|"requests response"| node_brain
node_brain -->|"sends model request"| node_zai
node_agent_core -->|"executes tool calls"| node_tools
node_agent_core -->|"delegates code"| node_coder
node_coder -->|"requests code"| node_openrouter
node_agent_core -->|"saves history"| node_sessions
node_agent_core -->|"prints results"| node_ui
node_cli -->|"loads resumed session"| node_sessions
node_planner -->|"uses tools"| node_tools
node_refactor -->|"uses graph"| node_knowledge
node_search -->|"uses graph"| node_knowledge
node_updater -->|"checks releases"| node_remote
node_updater -->|"compares versions"| node_version
node_cli -->|"handles update commands"| node_updater

click node_cli "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/cli.py"
click node_terminal "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/tui.py"
click node_ui "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/ui.py"
click node_config "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/config.py"
click node_agent_core "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/agent.py"
click node_brain "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/client.py"
click node_coder "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/coder.py"
click node_tools "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/tools.py"
click node_sessions "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/session.py"
click node_skills "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/skills.py"
click node_runtime "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/runtime.py"
click node_planner "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/planner.py"
click node_refactor "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/refactor_engine.py"
click node_git "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/git_intelligence.py"
click node_search "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/semantic_search.py"
click node_knowledge "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/knowledge_graph.py"
click node_context "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/context_manager.py"
click node_monitor "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/performance_monitor.py"
click node_updater "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/updater.py"
click node_remote "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/remote.py"
click node_version "https://github.com/marreouu/glm-c0deur/blob/main/glmcode/version.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_terminal,node_ui,node_user toneBlue
class node_agent_core,node_brain,node_coder,node_tools,node_skills toneAmber
class node_planner,node_refactor,node_git,node_search,node_knowledge,node_context,node_zai,node_openrouter toneMint
class node_config,node_sessions,node_runtime,node_monitor,node_updater,node_remote,node_version toneRose
```

## Components

### Interaction

- [CLI and commands](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/cli.py): `glmcode/cli.py`
- [Terminal UI](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/tui.py): `glmcode/tui.py`
- [Terminal output](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/ui.py): `glmcode/ui.py`

### Agent workflow

- [Agent orchestration](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/agent.py): `glmcode/agent.py`
- [Brain model client](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/client.py): `glmcode/client.py`
- [Code generation](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/coder.py): `glmcode/coder.py`
- [File and shell tools](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/tools.py): `glmcode/tools.py`
- [Custom skills](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/skills.py): `glmcode/skills.py`

### Code analysis

- [Planning](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/planner.py): `glmcode/planner.py`
- [Refactoring](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/refactor_engine.py): `glmcode/refactor_engine.py`
- [Git intelligence](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/git_intelligence.py): `glmcode/git_intelligence.py`
- [Semantic search](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/semantic_search.py): `glmcode/semantic_search.py`
- [Code knowledge graph](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/knowledge_graph.py): `glmcode/knowledge_graph.py`
- [Context management](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/context_manager.py): `glmcode/context_manager.py`

### Session and support

- [Configuration](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/config.py): `glmcode/config.py`
- [Session history](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/session.py): `glmcode/session.py`
- [Processes and watches](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/runtime.py): `glmcode/runtime.py`
- [Performance monitor](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/performance_monitor.py): `glmcode/performance_monitor.py`
- [Updater](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/updater.py): `glmcode/updater.py`
- [Remote release checks](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/remote.py): `glmcode/remote.py`
- [Version handling](https://github.com/marreouu/glm-c0deur/blob/main/glmcode/version.py): `glmcode/version.py`

### Other components

- **User**
- **Z.ai API**
- **OpenRouter API**

## Connections

- User → CLI and commands: starts assistant (evidence: `README.md`)
- CLI and commands → Configuration: loads settings (evidence: `glmcode/cli.py`)
- CLI and commands → Agent orchestration: creates agent (evidence: `glmcode/cli.py`)
- CLI and commands → Terminal UI: starts interface (evidence: `glmcode/cli.py`)
- CLI and commands → Custom skills: loads skills (evidence: `glmcode/cli.py`)
- Terminal UI → Agent orchestration: submits input (evidence: `README.md`)
- Terminal UI → Processes and watches: starts file watch (evidence: `glmcode/tui.py`)
- Agent orchestration → Brain model client: requests response (evidence: `glmcode/agent.py`)
- Brain model client → Z.ai API: sends model request (evidence: `README.md`)
- Agent orchestration → File and shell tools: executes tool calls (evidence: `glmcode/agent.py`)
- Agent orchestration → Code generation: delegates code (evidence: `glmcode/agent.py`)
- Code generation → OpenRouter API: requests code (evidence: `README.md`)
- Agent orchestration → Session history: saves history (evidence: `glmcode/agent.py`)
- Agent orchestration → Terminal output: prints results (evidence: `glmcode/agent.py`)
- CLI and commands → Session history: loads resumed session (evidence: `glmcode/cli.py`)
- Planning → File and shell tools: uses tools (evidence: `glmcode/planner.py`)
- Refactoring → Code knowledge graph: uses graph (evidence: `glmcode/refactor_engine.py`)
- Semantic search → Code knowledge graph: uses graph (evidence: `glmcode/semantic_search.py`)
- Updater → Remote release checks: checks releases (evidence: `glmcode/updater.py`)
- Updater → Version handling: compares versions (evidence: `glmcode/updater.py`)
- CLI and commands → Updater: handles update commands (evidence: `glmcode/cli.py`)
