# githpriyanshu23/clawde_code architecture

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

- Interactive diagram: https://gitdiagram.com/githpriyanshu23/clawde_code
- Repository: https://github.com/githpriyanshu23/clawde_code

## Overview

Claude Code is a terminal-based software engineering assistant. The main workflow is user input in the CLI, command or prompt handling, model queries, permission-checked tool execution, and results rendered in the terminal; sessions and configuration preserve state. The README also documents MCP/LSP integrations, IDE bridging, remote sessions, agent capabilities, and persistent memory. The excerpts and source index support only some relationships, so uncertain links are omitted rather than inferred.

Main entry points: [`src/tools`](https://github.com/githpriyanshu23/clawde_code/tree/main/src/tools) (Agent tools), [`src/QueryEngine.ts`](https://github.com/githpriyanshu23/clawde_code/blob/main/src/QueryEngine.ts) (Model query engine), [`src/commands.ts`](https://github.com/githpriyanshu23/clawde_code/blob/main/src/commands.ts) (CLI commands), [`src/utils/sessionStorage.ts`](https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/sessionStorage.ts) (Session persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["CLI interaction"]
  node_cli["CLI commands<br/>[commands.ts]"]
  node_terminal["Terminal UI<br/>[ink.ts]"]
  node_prompt["Prompt processing<br/>[query.ts]"]
end

subgraph group_agent["Assistant runtime"]
  node_query["Model query engine<br/>[QueryEngine.ts]"]
  node_tooltypes["Tool contracts<br/>[Tool.ts]"]
  node_tools["Agent tools"]
  node_permissions["Tool permissions"]
  node_messages["Conversation messages<br/>[messages.ts]"]
  node_tasks["Task management"]
end

subgraph group_state["Session and state"]
  node_state["Runtime state<br/>[state.ts]"]
  node_sessions[("Session persistence<br/>[sessionStorage.ts]")]
  node_config[("Configuration<br/>[config.ts]")]
  node_memory[("Persistent memory")]
end

subgraph group_integrations["Integrations"]
  node_mcp["MCP connections"]
  node_lsp["Language servers"]
  node_bridge["IDE bridge<br/>[bridgeMain.ts]"]
  node_remote["Remote sessions"]
end

node_user(("Terminal user"))
node_anthropic{{"Anthropic API"}}
node_filesystem[("Local filesystem")]
node_ide(("IDE extension"))

node_user -->|"invokes commands"| node_cli
node_user -.->|"enters prompts"| node_terminal
node_cli -.->|"presents interface"| node_terminal
node_cli -.->|"handles input"| node_prompt
node_prompt -->|"starts queries"| node_query
node_query -->|"calls API"| node_anthropic
node_query -->|"dispatches tools"| node_tools
node_query -->|"processes messages"| node_messages
node_query -->|"uses contracts"| node_tooltypes
node_tools -->|"checks authorization"| node_permissions
node_tools -->|"reads and writes"| node_filesystem
node_cli -->|"restores sessions"| node_sessions
node_sessions -->|"stores transcripts"| node_filesystem
node_sessions -->|"reads session state"| node_state
node_cli -.->|"registers settings"| node_config
node_tasks -.->|"tracks runtime state"| node_state
node_tools -.->|"manages tasks"| node_tasks
node_tools -.->|"invokes MCP tools"| node_mcp
node_tools -.->|"uses language services"| node_lsp
node_ide -->|"exchanges messages"| node_bridge
node_bridge -.->|"runs sessions"| node_state
node_remote -->|"manages sessions"| node_sessions
node_tools -.->|"uses memory"| node_memory
node_query -.->|"returns responses"| node_terminal

click node_cli "https://github.com/githpriyanshu23/clawde_code/blob/main/src/commands.ts"
click node_terminal "https://github.com/githpriyanshu23/clawde_code/blob/main/src/ink.ts"
click node_prompt "https://github.com/githpriyanshu23/clawde_code/blob/main/src/query.ts"
click node_query "https://github.com/githpriyanshu23/clawde_code/blob/main/src/QueryEngine.ts"
click node_tooltypes "https://github.com/githpriyanshu23/clawde_code/blob/main/src/Tool.ts"
click node_tools "https://github.com/githpriyanshu23/clawde_code/tree/main/src/tools"
click node_permissions "https://github.com/githpriyanshu23/clawde_code/tree/main/src/hooks/toolPermission"
click node_messages "https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/messages.ts"
click node_state "https://github.com/githpriyanshu23/clawde_code/blob/main/src/bootstrap/state.ts"
click node_sessions "https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/sessionStorage.ts"
click node_config "https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/config.ts"
click node_tasks "https://github.com/githpriyanshu23/clawde_code/tree/main/src/tasks"
click node_memory "https://github.com/githpriyanshu23/clawde_code/tree/main/src/memdir"
click node_mcp "https://github.com/githpriyanshu23/clawde_code/blob/main/src/services/mcp/MCPConnectionManager.tsx"
click node_lsp "https://github.com/githpriyanshu23/clawde_code/blob/main/src/services/lsp/LSPServerManager.ts"
click node_bridge "https://github.com/githpriyanshu23/clawde_code/blob/main/src/bridge/bridgeMain.ts"
click node_remote "https://github.com/githpriyanshu23/clawde_code/blob/main/src/remote/RemoteSessionManager.ts"

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_prompt,node_user toneBlue
class node_query,node_tooltypes,node_tools,node_permissions,node_messages,node_tasks,node_filesystem toneAmber
class node_state,node_sessions,node_config,node_memory,node_anthropic toneMint
class node_mcp,node_lsp,node_bridge,node_remote toneRose
class node_ide toneIndigo
```

## Components

### CLI interaction

- [CLI commands](https://github.com/githpriyanshu23/clawde_code/blob/main/src/commands.ts): `src/commands.ts`
- [Terminal UI](https://github.com/githpriyanshu23/clawde_code/blob/main/src/ink.ts): `src/ink.ts`
- [Prompt processing](https://github.com/githpriyanshu23/clawde_code/blob/main/src/query.ts): `src/query.ts`

### Assistant runtime

- [Model query engine](https://github.com/githpriyanshu23/clawde_code/blob/main/src/QueryEngine.ts): `src/QueryEngine.ts`
- [Tool contracts](https://github.com/githpriyanshu23/clawde_code/blob/main/src/Tool.ts): `src/Tool.ts`
- [Agent tools](https://github.com/githpriyanshu23/clawde_code/tree/main/src/tools): `src/tools`
- [Tool permissions](https://github.com/githpriyanshu23/clawde_code/tree/main/src/hooks/toolPermission): `src/hooks/toolPermission`
- [Conversation messages](https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/messages.ts): `src/utils/messages.ts`
- [Task management](https://github.com/githpriyanshu23/clawde_code/tree/main/src/tasks): `src/tasks`

### Session and state

- [Runtime state](https://github.com/githpriyanshu23/clawde_code/blob/main/src/bootstrap/state.ts): `src/bootstrap/state.ts`
- [Session persistence](https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/sessionStorage.ts): `src/utils/sessionStorage.ts`
- [Configuration](https://github.com/githpriyanshu23/clawde_code/blob/main/src/utils/config.ts): `src/utils/config.ts`
- [Persistent memory](https://github.com/githpriyanshu23/clawde_code/tree/main/src/memdir): `src/memdir`

### Integrations

- [MCP connections](https://github.com/githpriyanshu23/clawde_code/blob/main/src/services/mcp/MCPConnectionManager.tsx): `src/services/mcp/MCPConnectionManager.tsx`
- [Language servers](https://github.com/githpriyanshu23/clawde_code/blob/main/src/services/lsp/LSPServerManager.ts): `src/services/lsp/LSPServerManager.ts`
- [IDE bridge](https://github.com/githpriyanshu23/clawde_code/blob/main/src/bridge/bridgeMain.ts): `src/bridge/bridgeMain.ts`
- [Remote sessions](https://github.com/githpriyanshu23/clawde_code/blob/main/src/remote/RemoteSessionManager.ts): `src/remote/RemoteSessionManager.ts`

### Other components

- **Terminal user**
- **Anthropic API**
- **Local filesystem**
- **IDE extension**

## Connections

- Terminal user → CLI commands: invokes commands
- Terminal user → Terminal UI: enters prompts
- CLI commands → Terminal UI: presents interface
- CLI commands → Prompt processing: handles input
- Prompt processing → Model query engine: starts queries (evidence: `src/QueryEngine.ts`)
- Model query engine → Anthropic API: calls API
- Model query engine → Agent tools: dispatches tools (evidence: `src/QueryEngine.ts`)
- Model query engine → Conversation messages: processes messages (evidence: `src/QueryEngine.ts`)
- Model query engine → Tool contracts: uses contracts (evidence: `src/QueryEngine.ts`)
- Agent tools → Tool permissions: checks authorization
- Agent tools → Local filesystem: reads and writes
- CLI commands → Session persistence: restores sessions (evidence: `src/commands.ts`)
- Session persistence → Local filesystem: stores transcripts (evidence: `src/utils/sessionStorage.ts`)
- Session persistence → Runtime state: reads session state (evidence: `src/utils/sessionStorage.ts`)
- CLI commands → Configuration: registers settings
- Task management → Runtime state: tracks runtime state
- Agent tools → Task management: manages tasks
- Agent tools → MCP connections: invokes MCP tools
- Agent tools → Language servers: uses language services
- IDE extension → IDE bridge: exchanges messages
- IDE bridge → Runtime state: runs sessions
- Remote sessions → Session persistence: manages sessions (evidence: `src/remote/RemoteSessionManager.ts`)
- Agent tools → Persistent memory: uses memory
- Model query engine → Terminal UI: returns responses
