# harshadcse/local-coding-agent architecture

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

- Interactive diagram: https://gitdiagram.com/harshadcse/local-coding-agent
- Repository: https://github.com/harshadcse/local-coding-agent

## Overview

Local Coding Agent is an offline coding assistant: a developer asks about a project, requests a guarded code change, or reviews a file against supplied standards. The principal workflow runs from the VS Code chat through the local HTTP server into retrieval or the LangGraph edit loop; edits return as proposals for user approval. Indexing, standards review, project tools, and local-model access are distinct supporting stages. The README documents the product flow; sampled source confirms key Python and extension connections, but not every server route or internal step.

Main entry points: [`agent/server.py`](https://github.com/harshadcse/local-coding-agent/blob/main/agent/server.py) (HTTP API), [`agent/graph.py`](https://github.com/harshadcse/local-coding-agent/blob/main/agent/graph.py) (Edit agent loop), [`agent/cli.py`](https://github.com/harshadcse/local-coding-agent/blob/main/agent/cli.py) (Command line), [`agent/retriever.py`](https://github.com/harshadcse/local-coding-agent/blob/main/agent/retriever.py) (Search and rerank)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["VS Code experience"]
  node_chat["Chat interface<br/>[chatView.ts]"]
  node_api["HTTP client<br/>[api.ts]"]
  node_server_control["Server control<br/>[server.ts]"]
  node_proposal_ui["Proposal review<br/>[proposals.ts]"]
end

subgraph group_service["Local agent service"]
  node_http_server["HTTP API<br/>[server.py]"]
  node_cli["Command line<br/>[cli.py]"]
end

subgraph group_knowledge["Project knowledge"]
  node_project_index["Project indexer<br/>[indexer.py]"]
  node_index_store[("Chunk index<br/>[indexer.py]")]
  node_retrieval["Search and rerank<br/>[retriever.py]"]
end

subgraph group_editing["Editing and review"]
  node_agent_loop["Edit agent loop<br/>[graph.py]"]
  node_editor["Edit safeguards<br/>[editor.py]"]
  node_standards["Standards review<br/>[standards.py]"]
end

subgraph group_model["Local model and tools"]
  node_project_tools["Project tools<br/>[tools.py]"]
  node_ollama_client["Ollama client<br/>[llm.py]"]
end

node_developer(("Developer"))
node_ollama["Ollama"]
node_project_files[("Project files")]
node_analyzer["Project analyzer"]

node_developer -->|"asks or edits"| node_chat
node_chat -->|"sends requests"| node_api
node_api -->|"calls HTTP API"| node_http_server
node_server_control -->|"starts process"| node_http_server
node_chat -->|"shows proposal"| node_proposal_ui
node_proposal_ui -->|"offers approval"| node_developer
node_developer -->|"runs commands"| node_cli
node_http_server -->|"starts indexing"| node_project_index
node_project_index -->|"embeds chunks"| node_ollama_client
node_project_index -->|"saves chunks"| node_index_store
node_retrieval -->|"searches chunks"| node_index_store
node_retrieval -->|"embeds and reranks"| node_ollama_client
node_http_server -->|"answers with search"| node_retrieval
node_http_server -->|"requests edit"| node_agent_loop
node_agent_loop -->|"retrieves context"| node_retrieval
node_agent_loop -->|"generates edits"| node_ollama_client
node_agent_loop -->|"applies guarded edits"| node_editor
node_editor -->|"reads and writes"| node_project_files
node_agent_loop -->|"verifies changes"| node_project_tools
node_project_tools -->|"runs checks"| node_analyzer
node_http_server -->|"reviews files"| node_standards
node_standards -->|"checks with model"| node_ollama_client
node_standards -->|"uses project tools"| node_project_tools
node_project_tools -->|"reads project"| node_project_files
node_ollama_client -->|"sends model requests"| node_ollama
node_http_server -->|"checks model status"| node_ollama
node_cli -->|"indexes projects"| node_project_index
node_cli -->|"answers questions"| node_retrieval
node_cli -->|"runs edits"| node_agent_loop
node_cli -->|"checks standards"| node_standards

click node_chat "https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/chatView.ts"
click node_api "https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/api.ts"
click node_server_control "https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/server.ts"
click node_proposal_ui "https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/proposals.ts"
click node_http_server "https://github.com/harshadcse/local-coding-agent/blob/main/agent/server.py"
click node_cli "https://github.com/harshadcse/local-coding-agent/blob/main/agent/cli.py"
click node_project_index "https://github.com/harshadcse/local-coding-agent/blob/main/agent/indexer.py"
click node_index_store "https://github.com/harshadcse/local-coding-agent/blob/main/agent/indexer.py"
click node_retrieval "https://github.com/harshadcse/local-coding-agent/blob/main/agent/retriever.py"
click node_agent_loop "https://github.com/harshadcse/local-coding-agent/blob/main/agent/graph.py"
click node_editor "https://github.com/harshadcse/local-coding-agent/blob/main/agent/editor.py"
click node_standards "https://github.com/harshadcse/local-coding-agent/blob/main/agent/standards.py"
click node_project_tools "https://github.com/harshadcse/local-coding-agent/blob/main/agent/tools.py"
click node_ollama_client "https://github.com/harshadcse/local-coding-agent/blob/main/agent/llm.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_chat,node_api,node_server_control,node_proposal_ui toneBlue
class node_http_server,node_cli,node_project_files toneAmber
class node_project_index,node_index_store,node_retrieval toneMint
class node_agent_loop,node_editor,node_standards toneRose
class node_project_tools,node_ollama_client,node_developer,node_ollama,node_analyzer toneIndigo
```

## Components

### VS Code experience

- [Chat interface](https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/chatView.ts): `vscode-extension/src/chatView.ts`
- [HTTP client](https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/api.ts): `vscode-extension/src/api.ts`
- [Server control](https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/server.ts): `vscode-extension/src/server.ts`
- [Proposal review](https://github.com/harshadcse/local-coding-agent/blob/main/vscode-extension/src/proposals.ts): `vscode-extension/src/proposals.ts`

### Local agent service

- [HTTP API](https://github.com/harshadcse/local-coding-agent/blob/main/agent/server.py): `agent/server.py`
- [Command line](https://github.com/harshadcse/local-coding-agent/blob/main/agent/cli.py): `agent/cli.py`

### Project knowledge

- [Project indexer](https://github.com/harshadcse/local-coding-agent/blob/main/agent/indexer.py): `agent/indexer.py`
- [Chunk index](https://github.com/harshadcse/local-coding-agent/blob/main/agent/indexer.py): `agent/indexer.py`
- [Search and rerank](https://github.com/harshadcse/local-coding-agent/blob/main/agent/retriever.py): `agent/retriever.py`

### Editing and review

- [Edit agent loop](https://github.com/harshadcse/local-coding-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Edit safeguards](https://github.com/harshadcse/local-coding-agent/blob/main/agent/editor.py): `agent/editor.py`
- [Standards review](https://github.com/harshadcse/local-coding-agent/blob/main/agent/standards.py): `agent/standards.py`

### Local model and tools

- [Project tools](https://github.com/harshadcse/local-coding-agent/blob/main/agent/tools.py): `agent/tools.py`
- [Ollama client](https://github.com/harshadcse/local-coding-agent/blob/main/agent/llm.py): `agent/llm.py`

### Other components

- **Developer**
- **Ollama**
- **Project files**
- **Project analyzer**

## Connections

- Developer → Chat interface: asks or edits (evidence: `README.md`)
- Chat interface → HTTP client: sends requests (evidence: `vscode-extension/src/chatView.ts`)
- HTTP client → HTTP API: calls HTTP API (evidence: `vscode-extension/src/api.ts`)
- Server control → HTTP API: starts process (evidence: `vscode-extension/src/server.ts`)
- Chat interface → Proposal review: shows proposal (evidence: `vscode-extension/src/chatView.ts`)
- Proposal review → Developer: offers approval (evidence: `README.md`)
- Developer → Command line: runs commands (evidence: `agent/cli.py`)
- HTTP API → Project indexer: starts indexing (evidence: `agent/server.py`)
- Project indexer → Ollama client: embeds chunks (evidence: `agent/indexer.py`)
- Project indexer → Chunk index: saves chunks (evidence: `agent/indexer.py`)
- Search and rerank → Chunk index: searches chunks (evidence: `README.md`)
- Search and rerank → Ollama client: embeds and reranks (evidence: `agent/retriever.py`)
- HTTP API → Search and rerank: answers with search (evidence: `README.md`)
- HTTP API → Edit agent loop: requests edit (evidence: `README.md`)
- Edit agent loop → Search and rerank: retrieves context (evidence: `agent/graph.py`)
- Edit agent loop → Ollama client: generates edits (evidence: `agent/graph.py`)
- Edit agent loop → Edit safeguards: applies guarded edits (evidence: `agent/graph.py`)
- Edit safeguards → Project files: reads and writes (evidence: `agent/editor.py`)
- Edit agent loop → Project tools: verifies changes (evidence: `agent/graph.py`)
- Project tools → Project analyzer: runs checks (evidence: `agent/tools.py`)
- HTTP API → Standards review: reviews files (evidence: `agent/server.py`)
- Standards review → Ollama client: checks with model (evidence: `agent/standards.py`)
- Standards review → Project tools: uses project tools (evidence: `agent/standards.py`)
- Project tools → Project files: reads project (evidence: `agent/tools.py`)
- Ollama client → Ollama: sends model requests (evidence: `agent/llm.py`)
- HTTP API → Ollama: checks model status (evidence: `agent/server.py`)
- Command line → Project indexer: indexes projects (evidence: `agent/cli.py`)
- Command line → Search and rerank: answers questions (evidence: `agent/cli.py`)
- Command line → Edit agent loop: runs edits (evidence: `agent/cli.py`)
- Command line → Standards review: checks standards (evidence: `agent/cli.py`)
