# sapirrior/code-edith-old architecture

> Architecture diagram of the GitHub repository sapirrior/code-edith-old, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sapirrior/code-edith-old
- Repository: https://github.com/sapirrior/code-edith-old

## Overview

Code-Edith is a privacy-focused CLI agent: users enter prompts and commands, the CLI configures an OpenAI-compatible client, and the chat runtime streams model replies and dispatches requested tools before returning results. The documented tools cover web search, local files and directories, OS information, and date/time. The runtime also supports session-only conversation memory and readline prompt history. Tool dispatch is visible in the sampled chat implementation; relationships among individual tools are not implied beyond dynamic discovery.

Main entry points: [`bin/chat.py`](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py) (Chat orchestration), [`index.py`](https://github.com/sapirrior/code-edith-old/blob/main/index.py) (CLI session), [`bin/helper/banner.py`](https://github.com/sapirrior/code-edith-old/blob/main/bin/helper/banner.py) (Welcome banner), [`bin/tool/web_search.py`](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/web_search.py) (Web search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI session"]
  node_entry["CLI session<br/>[index.py]"]
  node_configuration["Environment setup<br/>[index.py]"]
  node_prompt_history[("Prompt history<br/>[index.py]")]
  node_banner["Welcome banner<br/>[banner.py]"]
end

subgraph group_agent["Agent runtime"]
  node_chat["Chat orchestration<br/>[chat.py]"]
  node_client["API client<br/>[chat.py]"]
  node_prompt_config["Prompt and tool config<br/>[chat.py]"]
  node_streaming["Stream rendering<br/>[chat.py]"]
  node_tool_dispatch["Tool dispatch<br/>[chat.py]"]
end

subgraph group_tools["Agent tools"]
  node_web_search["Web search<br/>[web_search.py]"]
  node_read_file["Read file<br/>[read_file.py]"]
  node_list_dir["List directory<br/>[list_dir.py]"]
  node_os_info["OS information<br/>[get_os_info.py]"]
  node_date_time["Date and time<br/>[data_time.py]"]
end

node_user(("CLI user"))
node_model_service{{"Compatible model API"}}

node_user -->|"enters prompts"| node_entry
node_entry -->|"loads settings"| node_configuration
node_entry -->|"loads and saves"| node_prompt_history
node_entry -->|"displays"| node_banner
node_entry -->|"authenticates"| node_client
node_client -->|"connects to"| node_model_service
node_entry -->|"submits prompt"| node_chat
node_chat -->|"loads"| node_prompt_config
node_chat -->|"requests completion"| node_client
node_model_service -.->|"streams response"| node_chat
node_chat -->|"renders stream"| node_streaming
node_chat -->|"dispatches calls"| node_tool_dispatch
node_tool_dispatch -->|"runs tool"| node_web_search
node_tool_dispatch -->|"runs tool"| node_read_file
node_tool_dispatch -->|"runs tool"| node_list_dir
node_tool_dispatch -->|"runs tool"| node_os_info
node_tool_dispatch -->|"runs tool"| node_date_time
node_tool_dispatch -->|"returns tool results"| node_chat
node_chat -->|"returns interactions"| node_entry

click node_entry "https://github.com/sapirrior/code-edith-old/blob/main/index.py"
click node_configuration "https://github.com/sapirrior/code-edith-old/blob/main/index.py"
click node_prompt_history "https://github.com/sapirrior/code-edith-old/blob/main/index.py"
click node_banner "https://github.com/sapirrior/code-edith-old/blob/main/bin/helper/banner.py"
click node_chat "https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py"
click node_client "https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py"
click node_prompt_config "https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py"
click node_streaming "https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py"
click node_tool_dispatch "https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py"
click node_web_search "https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/web_search.py"
click node_read_file "https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/read_file.py"
click node_list_dir "https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/list_dir.py"
click node_os_info "https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/get_os_info.py"
click node_date_time "https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/data_time.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_entry,node_configuration,node_prompt_history,node_banner,node_user toneBlue
class node_chat,node_client,node_prompt_config,node_streaming,node_tool_dispatch toneAmber
class node_web_search,node_read_file,node_list_dir,node_os_info,node_date_time,node_model_service toneMint
```

## Components

### CLI session

- [CLI session](https://github.com/sapirrior/code-edith-old/blob/main/index.py): `index.py`
- [Environment setup](https://github.com/sapirrior/code-edith-old/blob/main/index.py): `index.py`
- [Prompt history](https://github.com/sapirrior/code-edith-old/blob/main/index.py): `index.py`
- [Welcome banner](https://github.com/sapirrior/code-edith-old/blob/main/bin/helper/banner.py): `bin/helper/banner.py`

### Agent runtime

- [Chat orchestration](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py): `bin/chat.py`
- [API client](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py): `bin/chat.py`
- [Prompt and tool config](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py): `bin/chat.py`
- [Stream rendering](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py): `bin/chat.py`
- [Tool dispatch](https://github.com/sapirrior/code-edith-old/blob/main/bin/chat.py): `bin/chat.py`

### Agent tools

- [Web search](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/web_search.py): `bin/tool/web_search.py`
- [Read file](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/read_file.py): `bin/tool/read_file.py`
- [List directory](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/list_dir.py): `bin/tool/list_dir.py`
- [OS information](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/get_os_info.py): `bin/tool/get_os_info.py`
- [Date and time](https://github.com/sapirrior/code-edith-old/blob/main/bin/tool/data_time.py): `bin/tool/data_time.py`

### Other components

- **CLI user**
- **Compatible model API**

## Connections

- CLI user → CLI session: enters prompts (evidence: `index.py`)
- CLI session → Environment setup: loads settings (evidence: `index.py`)
- CLI session → Prompt history: loads and saves (evidence: `index.py`)
- CLI session → Welcome banner: displays (evidence: `index.py`)
- CLI session → API client: authenticates (evidence: `index.py`)
- API client → Compatible model API: connects to (evidence: `bin/chat.py`)
- CLI session → Chat orchestration: submits prompt (evidence: `index.py`)
- Chat orchestration → Prompt and tool config: loads (evidence: `bin/chat.py`)
- Chat orchestration → API client: requests completion (evidence: `bin/chat.py`)
- Compatible model API → Chat orchestration: streams response
- Chat orchestration → Stream rendering: renders stream (evidence: `bin/chat.py`)
- Chat orchestration → Tool dispatch: dispatches calls (evidence: `bin/chat.py`)
- Tool dispatch → Web search: runs tool (evidence: `bin/chat.py`)
- Tool dispatch → Read file: runs tool (evidence: `bin/chat.py`)
- Tool dispatch → List directory: runs tool (evidence: `bin/chat.py`)
- Tool dispatch → OS information: runs tool (evidence: `bin/chat.py`)
- Tool dispatch → Date and time: runs tool (evidence: `bin/chat.py`)
- Tool dispatch → Chat orchestration: returns tool results (evidence: `bin/chat.py`)
- Chat orchestration → CLI session: returns interactions (evidence: `index.py`)
