# ravisidh36/argon architecture

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

- Interactive diagram: https://gitdiagram.com/ravisidh36/argon
- Repository: https://github.com/ravisidh36/argon

## Overview

Argon is a local-first CLI agent: a user request enters the agent loop, the selected model may request tools, and the loop executes them and continues with results until it can return a response. Its capabilities include filesystem operations, calculation, web search, and document RAG. The RAG path parses and cleans documents, chunks and embeds them, stores vectors, then retrieves and reranks candidates. The graph follows documented workflows and shown imports/calls; unsampled implementation details are represented only where the README documents them.

Main entry points: [`agent/executor.py`](https://github.com/ravisidh36/argon/blob/master/agent/executor.py) (Tool executor), [`retrieval/index_document.py`](https://github.com/ravisidh36/argon/blob/master/retrieval/index_document.py) (Document indexing), [`agent/loop.py`](https://github.com/ravisidh36/argon/blob/master/agent/loop.py) (Agent loop), [`models/endpoint_llm.py`](https://github.com/ravisidh36/argon/blob/master/models/endpoint_llm.py) (Endpoint model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent orchestration"]
  node_loop["Agent loop<br/>[loop.py]"]
  node_executor["Tool executor<br/>[executor.py]"]
end

subgraph group_models["Model integrations"]
  node_endpoint["Endpoint model<br/>[endpoint_llm.py]"]
  node_gemini["Gemini model<br/>[gemini.py]"]
  node_modelconfig["Configuration<br/>[config.py]"]
end

subgraph group_tools["Agent tools"]
  node_tooldefs["Tool definitions<br/>[__init__.py]"]
  node_filesystem["Filesystem tools<br/>[file_access.py]"]
  node_calculator["Calculator<br/>[calculator.py]"]
  node_websearch["Web search<br/>[web_search.py]"]
end

subgraph group_rag["Document retrieval"]
  node_indexing["Document indexing<br/>[index_document.py]"]
  node_parser["Document parsing"]
  node_cleaner["Text cleaning<br/>[cleaner.py]"]
  node_chunking["Chunk creation<br/>[chunking.py]"]
  node_embeddings["Text embeddings<br/>[embeddings.py]"]
  node_vectorstore[("FAISS vector store<br/>[vector_store.py]")]
  node_registry[("Document registry")]
  node_retrieval["Candidate retrieval<br/>[retrieve.py]"]
  node_reranking["Cross-encoder reranking<br/>[rerank.py]"]
end

node_user(("CLI user"))
node_cli["CLI entry<br/>[main.py]"]
node_llmservice["OpenAI-compatible endpoint"]
node_geminiservice["Gemini API"]
node_webservice["DuckDuckGo search"]

node_user -->|"submits request"| node_cli
node_cli -->|"starts and queries"| node_loop
node_cli -->|"selects model"| node_modelconfig
node_loop -->|"dispatches tools"| node_executor
node_loop -->|"requests responses"| node_endpoint
node_endpoint -->|"loads schemas"| node_tooldefs
node_endpoint -->|"sends requests"| node_llmservice
node_loop -.->|"uses common interface"| node_gemini
node_gemini -->|"sends chat messages"| node_geminiservice
node_executor -->|"dispatches operations"| node_filesystem
node_executor -->|"dispatches calculations"| node_calculator
node_executor -->|"dispatches searches"| node_websearch
node_executor -->|"dispatches indexing"| node_indexing
node_executor -->|"dispatches retrieval"| node_retrieval
node_websearch -->|"queries"| node_webservice
node_indexing -->|"parses document"| node_parser
node_indexing -->|"cleans text"| node_cleaner
node_indexing -->|"creates chunks"| node_chunking
node_indexing -->|"saves vectors"| node_vectorstore
node_indexing -->|"registers document"| node_registry
node_vectorstore -->|"embeds documents"| node_embeddings
node_retrieval -->|"loads and searches"| node_vectorstore
node_retrieval -->|"reranks candidates"| node_reranking

click node_cli "https://github.com/ravisidh36/argon/blob/master/main.py"
click node_loop "https://github.com/ravisidh36/argon/blob/master/agent/loop.py"
click node_executor "https://github.com/ravisidh36/argon/blob/master/agent/executor.py"
click node_tooldefs "https://github.com/ravisidh36/argon/blob/master/tools/__init__.py"
click node_endpoint "https://github.com/ravisidh36/argon/blob/master/models/endpoint_llm.py"
click node_gemini "https://github.com/ravisidh36/argon/blob/master/models/gemini.py"
click node_modelconfig "https://github.com/ravisidh36/argon/blob/master/config.py"
click node_filesystem "https://github.com/ravisidh36/argon/blob/master/tools/file_access.py"
click node_calculator "https://github.com/ravisidh36/argon/blob/master/tools/calculator.py"
click node_websearch "https://github.com/ravisidh36/argon/blob/master/tools/web_search.py"
click node_indexing "https://github.com/ravisidh36/argon/blob/master/retrieval/index_document.py"
click node_parser "https://github.com/ravisidh36/argon/blob/master/tools/document_understanding.py"
click node_cleaner "https://github.com/ravisidh36/argon/blob/master/retrieval/cleaner.py"
click node_chunking "https://github.com/ravisidh36/argon/blob/master/retrieval/chunking.py"
click node_embeddings "https://github.com/ravisidh36/argon/blob/master/retrieval/embeddings.py"
click node_vectorstore "https://github.com/ravisidh36/argon/blob/master/retrieval/vector_store.py"
click node_registry "https://github.com/ravisidh36/argon/blob/master/retrieval/document_registry.py"
click node_retrieval "https://github.com/ravisidh36/argon/blob/master/retrieval/retrieve.py"
click node_reranking "https://github.com/ravisidh36/argon/blob/master/retrieval/rerank.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_loop,node_executor,node_user toneBlue
class node_endpoint,node_gemini,node_modelconfig toneAmber
class node_tooldefs,node_filesystem,node_calculator,node_websearch,node_geminiservice toneMint
class node_indexing,node_parser,node_cleaner,node_chunking,node_embeddings,node_vectorstore,node_registry,node_retrieval,node_reranking toneRose
class node_cli toneTeal
class node_llmservice,node_webservice toneIndigo
```

## Components

### Agent orchestration

- [Agent loop](https://github.com/ravisidh36/argon/blob/master/agent/loop.py): `agent/loop.py`
- [Tool executor](https://github.com/ravisidh36/argon/blob/master/agent/executor.py): `agent/executor.py`

### Model integrations

- [Endpoint model](https://github.com/ravisidh36/argon/blob/master/models/endpoint_llm.py): `models/endpoint_llm.py`
- [Gemini model](https://github.com/ravisidh36/argon/blob/master/models/gemini.py): `models/gemini.py`
- [Configuration](https://github.com/ravisidh36/argon/blob/master/config.py): `config.py`

### Agent tools

- [Tool definitions](https://github.com/ravisidh36/argon/blob/master/tools/__init__.py): `tools/__init__.py`
- [Filesystem tools](https://github.com/ravisidh36/argon/blob/master/tools/file_access.py): `tools/file_access.py`
- [Calculator](https://github.com/ravisidh36/argon/blob/master/tools/calculator.py): `tools/calculator.py`
- [Web search](https://github.com/ravisidh36/argon/blob/master/tools/web_search.py): `tools/web_search.py`

### Document retrieval

- [Document indexing](https://github.com/ravisidh36/argon/blob/master/retrieval/index_document.py): `retrieval/index_document.py`
- [Document parsing](https://github.com/ravisidh36/argon/blob/master/tools/document_understanding.py): `tools/document_understanding.py`
- [Text cleaning](https://github.com/ravisidh36/argon/blob/master/retrieval/cleaner.py): `retrieval/cleaner.py`
- [Chunk creation](https://github.com/ravisidh36/argon/blob/master/retrieval/chunking.py): `retrieval/chunking.py`
- [Text embeddings](https://github.com/ravisidh36/argon/blob/master/retrieval/embeddings.py): `retrieval/embeddings.py`
- [FAISS vector store](https://github.com/ravisidh36/argon/blob/master/retrieval/vector_store.py): `retrieval/vector_store.py`
- [Document registry](https://github.com/ravisidh36/argon/blob/master/retrieval/document_registry.py): `retrieval/document_registry.py`
- [Candidate retrieval](https://github.com/ravisidh36/argon/blob/master/retrieval/retrieve.py): `retrieval/retrieve.py`
- [Cross-encoder reranking](https://github.com/ravisidh36/argon/blob/master/retrieval/rerank.py): `retrieval/rerank.py`

### Other components

- **CLI user**
- [CLI entry](https://github.com/ravisidh36/argon/blob/master/main.py): `main.py`
- **OpenAI-compatible endpoint**
- **Gemini API**
- **DuckDuckGo search**

## Connections

- CLI user → CLI entry: submits request (evidence: `README.md`)
- CLI entry → Agent loop: starts and queries (evidence: `main.py`)
- CLI entry → Configuration: selects model
- Agent loop → Tool executor: dispatches tools (evidence: `README.md`)
- Agent loop → Endpoint model: requests responses (evidence: `README.md`)
- Endpoint model → Tool definitions: loads schemas (evidence: `models/endpoint_llm.py`)
- Endpoint model → OpenAI-compatible endpoint: sends requests (evidence: `models/endpoint_llm.py`)
- Agent loop → Gemini model: uses common interface (evidence: `README.md`)
- Gemini model → Gemini API: sends chat messages (evidence: `models/gemini.py`)
- Tool executor → Filesystem tools: dispatches operations (evidence: `agent/executor.py`)
- Tool executor → Calculator: dispatches calculations (evidence: `agent/executor.py`)
- Tool executor → Web search: dispatches searches (evidence: `agent/executor.py`)
- Tool executor → Document indexing: dispatches indexing (evidence: `agent/executor.py`)
- Tool executor → Candidate retrieval: dispatches retrieval (evidence: `agent/executor.py`)
- Web search → DuckDuckGo search: queries (evidence: `tools/web_search.py`)
- Document indexing → Document parsing: parses document (evidence: `retrieval/index_document.py`)
- Document indexing → Text cleaning: cleans text (evidence: `retrieval/index_document.py`)
- Document indexing → Chunk creation: creates chunks (evidence: `retrieval/index_document.py`)
- Document indexing → FAISS vector store: saves vectors (evidence: `retrieval/index_document.py`)
- Document indexing → Document registry: registers document (evidence: `retrieval/index_document.py`)
- FAISS vector store → Text embeddings: embeds documents (evidence: `retrieval/vector_store.py`)
- Candidate retrieval → FAISS vector store: loads and searches (evidence: `retrieval/retrieve.py`)
- Candidate retrieval → Cross-encoder reranking: reranks candidates (evidence: `retrieval/retrieve.py`)
