# test2628/claude-test-for-fun- architecture

> Architecture diagram of the GitHub repository test2628/claude-test-for-fun-, 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/test2628/claude-test-for-fun-
- Repository: https://github.com/test2628/claude-test-for-fun-

## Overview

Claude Code is a terminal-based software engineering assistant. The main workflow is user input in the CLI, command and tool orchestration, model requests and tool execution, then rendered responses and persisted session history. The README documents additional tool, permission, command, MCP/LSP, IDE bridge, plugin, and remote-session capabilities. The excerpts and source index support only selected internal links; unsampled subsystems are represented without speculative call edges.

Main entry points: [`src/bootstrap/state.ts`](https://github.com/test2628/claude-test-for-fun-/blob/main/src/bootstrap/state.ts) (Session state), [`src/ink/components/App.tsx`](https://github.com/test2628/claude-test-for-fun-/blob/main/src/ink/components/App.tsx) (Terminal UI), [`src/QueryEngine.ts`](https://github.com/test2628/claude-test-for-fun-/blob/main/src/QueryEngine.ts) (LLM query engine), [`src/tools`](https://github.com/test2628/claude-test-for-fun-/tree/main/src/tools) (Tool execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interaction"]
  node_app["Terminal UI<br/>[App.tsx]"]
  node_commands["Slash commands<br/>[commands.ts]"]
end

subgraph group_agent["Agent runtime"]
  node_messages["Conversation messages<br/>[messages.ts]"]
  node_query["Query pipeline<br/>[query.ts]"]
  node_engine["LLM query engine<br/>[QueryEngine.ts]"]
  node_tooltypes["Tool contracts<br/>[Tool.ts]"]
  node_toolrun["Tool execution"]
  node_permissions["Tool permissions"]
end

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

subgraph group_state["State and services"]
  node_session["Session state<br/>[state.ts]"]
  node_transcripts[("Session transcripts<br/>[sessionStorage.ts]")]
  node_config[("Configuration<br/>[config.ts]")]
  node_debug["Diagnostics logging<br/>[debug.ts]"]
  node_logging["Application logging<br/>[log.ts]"]
  node_slowops["Slow operation tracking<br/>[slowOperations.ts]"]
end

node_user(("Terminal user"))

node_user -->|"interacts"| node_app
node_user -->|"invokes commands"| node_commands
node_commands -.->|"provides commands"| node_app
node_app -->|"initializes state"| node_session
node_app -.->|"loads sessions"| node_transcripts
node_app -.->|"renders messages"| node_messages
node_messages -->|"formats context"| node_query
node_query -->|"calls"| node_engine
node_engine -->|"requests completions"| node_api
node_engine -->|"dispatches tools"| node_tooltypes
node_engine -.->|"runs tools"| node_toolrun
node_toolrun -.->|"checks access"| node_permissions
node_toolrun -.->|"uses MCP tools"| node_mcp
node_toolrun -.->|"uses language services"| node_lsp
node_query -->|"compacts context"| node_transcripts
node_session -->|"tracks sessions"| node_transcripts
node_session -->|"resets settings cache"| node_config
node_bridge -.->|"manages sessions"| node_session
node_remote -->|"manages remote sessions"| node_session
node_plugins -.->|"reads plugin settings"| node_config
node_debug -->|"reads session ID"| node_session
node_slowops -->|"logs slow operations"| node_debug
node_logging -.->|"reports errors"| node_debug

click node_app "https://github.com/test2628/claude-test-for-fun-/blob/main/src/ink/components/App.tsx"
click node_commands "https://github.com/test2628/claude-test-for-fun-/blob/main/src/commands.ts"
click node_messages "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/messages.ts"
click node_query "https://github.com/test2628/claude-test-for-fun-/blob/main/src/query.ts"
click node_engine "https://github.com/test2628/claude-test-for-fun-/blob/main/src/QueryEngine.ts"
click node_tooltypes "https://github.com/test2628/claude-test-for-fun-/blob/main/src/Tool.ts"
click node_toolrun "https://github.com/test2628/claude-test-for-fun-/tree/main/src/tools"
click node_permissions "https://github.com/test2628/claude-test-for-fun-/tree/main/src/hooks/toolPermission"
click node_session "https://github.com/test2628/claude-test-for-fun-/blob/main/src/bootstrap/state.ts"
click node_transcripts "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/sessionStorage.ts"
click node_config "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/config.ts"
click node_api "https://github.com/test2628/claude-test-for-fun-/tree/main/src/services/api"
click node_mcp "https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/mcp/MCPConnectionManager.tsx"
click node_lsp "https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/lsp/LSPServerManager.ts"
click node_bridge "https://github.com/test2628/claude-test-for-fun-/blob/main/src/bridge/bridgeMain.ts"
click node_plugins "https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/plugins/PluginInstallationManager.ts"
click node_remote "https://github.com/test2628/claude-test-for-fun-/blob/main/src/remote/RemoteSessionManager.ts"
click node_debug "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/debug.ts"
click node_logging "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/log.ts"
click node_slowops "https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/slowOperations.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_app,node_commands,node_user toneBlue
class node_messages,node_query,node_engine,node_tooltypes,node_toolrun,node_permissions toneAmber
class node_api,node_mcp,node_lsp,node_bridge,node_plugins,node_remote toneMint
class node_session,node_transcripts,node_config,node_debug,node_logging,node_slowops toneRose
```

## Components

### CLI interaction

- [Terminal UI](https://github.com/test2628/claude-test-for-fun-/blob/main/src/ink/components/App.tsx): `src/ink/components/App.tsx`
- [Slash commands](https://github.com/test2628/claude-test-for-fun-/blob/main/src/commands.ts): `src/commands.ts`

### Agent runtime

- [Conversation messages](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/messages.ts): `src/utils/messages.ts`
- [Query pipeline](https://github.com/test2628/claude-test-for-fun-/blob/main/src/query.ts): `src/query.ts`
- [LLM query engine](https://github.com/test2628/claude-test-for-fun-/blob/main/src/QueryEngine.ts): `src/QueryEngine.ts`
- [Tool contracts](https://github.com/test2628/claude-test-for-fun-/blob/main/src/Tool.ts): `src/Tool.ts`
- [Tool execution](https://github.com/test2628/claude-test-for-fun-/tree/main/src/tools): `src/tools`
- [Tool permissions](https://github.com/test2628/claude-test-for-fun-/tree/main/src/hooks/toolPermission): `src/hooks/toolPermission`

### Integrations

- [Anthropic API](https://github.com/test2628/claude-test-for-fun-/tree/main/src/services/api): `src/services/api`
- [MCP connections](https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/mcp/MCPConnectionManager.tsx): `src/services/mcp/MCPConnectionManager.tsx`
- [Language servers](https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/lsp/LSPServerManager.ts): `src/services/lsp/LSPServerManager.ts`
- [IDE bridge](https://github.com/test2628/claude-test-for-fun-/blob/main/src/bridge/bridgeMain.ts): `src/bridge/bridgeMain.ts`
- [Plugin management](https://github.com/test2628/claude-test-for-fun-/blob/main/src/services/plugins/PluginInstallationManager.ts): `src/services/plugins/PluginInstallationManager.ts`
- [Remote sessions](https://github.com/test2628/claude-test-for-fun-/blob/main/src/remote/RemoteSessionManager.ts): `src/remote/RemoteSessionManager.ts`

### State and services

- [Session state](https://github.com/test2628/claude-test-for-fun-/blob/main/src/bootstrap/state.ts): `src/bootstrap/state.ts`
- [Session transcripts](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/sessionStorage.ts): `src/utils/sessionStorage.ts`
- [Configuration](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/config.ts): `src/utils/config.ts`
- [Diagnostics logging](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/debug.ts): `src/utils/debug.ts`
- [Application logging](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/log.ts): `src/utils/log.ts`
- [Slow operation tracking](https://github.com/test2628/claude-test-for-fun-/blob/main/src/utils/slowOperations.ts): `src/utils/slowOperations.ts`

### Other components

- **Terminal user**

## Connections

- Terminal user → Terminal UI: interacts
- Terminal user → Slash commands: invokes commands
- Slash commands → Terminal UI: provides commands
- Terminal UI → Session state: initializes state (evidence: `src/ink/components/App.tsx`)
- Terminal UI → Session transcripts: loads sessions
- Terminal UI → Conversation messages: renders messages
- Conversation messages → Query pipeline: formats context (evidence: `src/query.ts`)
- Query pipeline → LLM query engine: calls (evidence: `src/QueryEngine.ts`)
- LLM query engine → Anthropic API: requests completions (evidence: `src/QueryEngine.ts`)
- LLM query engine → Tool contracts: dispatches tools (evidence: `src/QueryEngine.ts`)
- LLM query engine → Tool execution: runs tools (evidence: `src/QueryEngine.ts`)
- Tool execution → Tool permissions: checks access
- Tool execution → MCP connections: uses MCP tools
- Tool execution → Language servers: uses language services
- Query pipeline → Session transcripts: compacts context (evidence: `src/query.ts`)
- Session state → Session transcripts: tracks sessions (evidence: `src/utils/sessionStorage.ts`)
- Session state → Configuration: resets settings cache (evidence: `src/bootstrap/state.ts`)
- IDE bridge → Session state: manages sessions
- Remote sessions → Session state: manages remote sessions (evidence: `src/remote/RemoteSessionManager.ts`)
- Plugin management → Configuration: reads plugin settings
- Diagnostics logging → Session state: reads session ID (evidence: `src/utils/debug.ts`)
- Slow operation tracking → Diagnostics logging: logs slow operations (evidence: `src/utils/slowOperations.ts`)
- Application logging → Diagnostics logging: reports errors
