# gsd-build/gsd-2 architecture

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

- Interactive diagram: https://gitdiagram.com/gsd-build/gsd-2
- Repository: https://github.com/gsd-build/gsd-2

## Overview

The tree identifies GSD Pi as a coding-agent product, but the README only redirects development to GSD Pi in another repository and documents no product workflow. This map therefore follows the visible runtime subsystems: CLI/agent execution, GSD workflow state, integrations, and web access. Several important modules are indexed but unsampled; their nodes are retained, while uncertain connections are marked dashed without evidence paths.

Main entry points: [`src/resources/extensions/gsd/doctor-engine-checks.ts`](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/doctor-engine-checks.ts) (Workflow diagnostics), [`packages/pi-coding-agent/src/core/agent-session.ts`](https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/core/agent-session.ts) (Agent session), [`packages/mcp-server/src/server.ts`](https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/server.ts) (MCP server), [`src/web/bridge-service.ts`](https://github.com/gsd-build/gsd-2/blob/main/src/web/bridge-service.ts) (Web bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent runtime"]
  node_cli["CLI entry<br/>[cli.ts]"]
  node_agent_session["Agent session<br/>[agent-session.ts]"]
  node_agent_config["Agent configuration<br/>[config.ts]"]
  node_auth[("Auth storage<br/>[auth-storage.ts]")]
  node_model_provider["Model providers"]
  node_agent_tools["Agent tools"]
end

subgraph group_workflow["GSD workflows"]
  node_gsd_session["Auto workflow session<br/>[session.ts]"]
  node_custom_engine["Custom workflow engine"]
  node_workflow_state["Workflow state<br/>[state.ts]"]
  node_workflow_db[("GSD database<br/>[gsd-db.ts]")]
  node_workflow_paths["GSD paths<br/>[paths.ts]"]
  node_projections["Workflow projections"]
  node_doctor["Workflow diagnostics"]
end

subgraph group_integration["Integrations"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_mcp_session["MCP sessions<br/>[session-manager.ts]"]
  node_mcp_readers["Project readers"]
  node_mcp_workflows["Workflow tools<br/>[workflow-tools.ts]"]
  node_daemon["Daemon sessions<br/>[session-manager.ts]"]
  node_rpc["RPC client<br/>[rpc-client.ts]"]
end

subgraph group_web["Web interface"]
  node_web_bridge["Web bridge<br/>[bridge-service.ts]"]
  node_onboarding["Onboarding service"]
  node_workspace_store[("Workspace store")]
  node_web_api["Web API routes"]
end

node_user(("User"))

node_user -.->|"invokes"| node_cli
node_cli -.->|"starts"| node_agent_session
node_agent_session -.->|"requests models"| node_model_provider
node_agent_session -.->|"dispatches tools"| node_agent_tools
node_agent_config -->|"configures"| node_auth
node_gsd_session -.->|"runs workflow"| node_custom_engine
node_doctor -->|"checks"| node_workflow_db
node_doctor -->|"resolves paths"| node_workflow_paths
node_doctor -->|"derives state"| node_workflow_state
node_doctor -->|"repairs projections"| node_projections
node_mcp -->|"manages sessions"| node_mcp_session
node_mcp -->|"registers readers"| node_mcp_readers
node_mcp -->|"registers tools"| node_mcp_workflows
node_mcp_session -->|"creates client"| node_rpc
node_daemon -->|"creates client"| node_rpc
node_web_bridge -->|"uses session"| node_agent_session
node_web_bridge -->|"collects onboarding"| node_onboarding
node_web_api -->|"routes requests"| node_web_bridge
node_workspace_store -.->|"uses API"| node_web_api

click node_cli "https://github.com/gsd-build/gsd-2/blob/main/src/cli.ts"
click node_agent_session "https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/core/agent-session.ts"
click node_agent_config "https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/config.ts"
click node_auth "https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/core/auth-storage.ts"
click node_model_provider "https://github.com/gsd-build/gsd-2/tree/main/packages/pi-ai/src/providers"
click node_agent_tools "https://github.com/gsd-build/gsd-2/tree/main/packages/pi-coding-agent/src/core/tools"
click node_gsd_session "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/auto/session.ts"
click node_custom_engine "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/custom-workflow-engine.ts"
click node_workflow_state "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/state.ts"
click node_workflow_db "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/gsd-db.ts"
click node_workflow_paths "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/paths.ts"
click node_projections "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/workflow-projections.ts"
click node_doctor "https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/doctor-engine-checks.ts"
click node_mcp "https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/server.ts"
click node_mcp_session "https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/session-manager.ts"
click node_mcp_readers "https://github.com/gsd-build/gsd-2/tree/main/packages/mcp-server/src/readers"
click node_mcp_workflows "https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/workflow-tools.ts"
click node_daemon "https://github.com/gsd-build/gsd-2/blob/main/packages/daemon/src/session-manager.ts"
click node_rpc "https://github.com/gsd-build/gsd-2/blob/main/packages/rpc-client/src/rpc-client.ts"
click node_web_bridge "https://github.com/gsd-build/gsd-2/blob/main/src/web/bridge-service.ts"
click node_onboarding "https://github.com/gsd-build/gsd-2/blob/main/src/web/onboarding-service.ts"
click node_workspace_store "https://github.com/gsd-build/gsd-2/blob/main/web/lib/gsd-workspace-store.tsx"
click node_web_api "https://github.com/gsd-build/gsd-2/tree/main/web/app/api"

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_agent_session,node_agent_config,node_auth,node_model_provider,node_agent_tools,node_user toneBlue
class node_gsd_session,node_custom_engine,node_workflow_state,node_workflow_db,node_workflow_paths,node_projections,node_doctor toneAmber
class node_mcp,node_mcp_session,node_mcp_readers,node_mcp_workflows,node_daemon,node_rpc toneMint
class node_web_bridge,node_onboarding,node_workspace_store,node_web_api toneRose
```

## Components

### Agent runtime

- [CLI entry](https://github.com/gsd-build/gsd-2/blob/main/src/cli.ts): `src/cli.ts`
- [Agent session](https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/core/agent-session.ts): `packages/pi-coding-agent/src/core/agent-session.ts`
- [Agent configuration](https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/config.ts): `packages/pi-coding-agent/src/config.ts`
- [Auth storage](https://github.com/gsd-build/gsd-2/blob/main/packages/pi-coding-agent/src/core/auth-storage.ts): `packages/pi-coding-agent/src/core/auth-storage.ts`
- [Model providers](https://github.com/gsd-build/gsd-2/tree/main/packages/pi-ai/src/providers): `packages/pi-ai/src/providers`
- [Agent tools](https://github.com/gsd-build/gsd-2/tree/main/packages/pi-coding-agent/src/core/tools): `packages/pi-coding-agent/src/core/tools`

### GSD workflows

- [Auto workflow session](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/auto/session.ts): `src/resources/extensions/gsd/auto/session.ts`
- [Custom workflow engine](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/custom-workflow-engine.ts): `src/resources/extensions/gsd/custom-workflow-engine.ts`
- [Workflow state](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/state.ts): `src/resources/extensions/gsd/state.ts`
- [GSD database](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/gsd-db.ts): `src/resources/extensions/gsd/gsd-db.ts`
- [GSD paths](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/paths.ts): `src/resources/extensions/gsd/paths.ts`
- [Workflow projections](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/workflow-projections.ts): `src/resources/extensions/gsd/workflow-projections.ts`
- [Workflow diagnostics](https://github.com/gsd-build/gsd-2/blob/main/src/resources/extensions/gsd/doctor-engine-checks.ts): `src/resources/extensions/gsd/doctor-engine-checks.ts`

### Integrations

- [MCP server](https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/server.ts): `packages/mcp-server/src/server.ts`
- [MCP sessions](https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/session-manager.ts): `packages/mcp-server/src/session-manager.ts`
- [Project readers](https://github.com/gsd-build/gsd-2/tree/main/packages/mcp-server/src/readers): `packages/mcp-server/src/readers`
- [Workflow tools](https://github.com/gsd-build/gsd-2/blob/main/packages/mcp-server/src/workflow-tools.ts): `packages/mcp-server/src/workflow-tools.ts`
- [Daemon sessions](https://github.com/gsd-build/gsd-2/blob/main/packages/daemon/src/session-manager.ts): `packages/daemon/src/session-manager.ts`
- [RPC client](https://github.com/gsd-build/gsd-2/blob/main/packages/rpc-client/src/rpc-client.ts): `packages/rpc-client/src/rpc-client.ts`

### Web interface

- [Web bridge](https://github.com/gsd-build/gsd-2/blob/main/src/web/bridge-service.ts): `src/web/bridge-service.ts`
- [Onboarding service](https://github.com/gsd-build/gsd-2/blob/main/src/web/onboarding-service.ts): `src/web/onboarding-service.ts`
- [Workspace store](https://github.com/gsd-build/gsd-2/blob/main/web/lib/gsd-workspace-store.tsx): `web/lib/gsd-workspace-store.tsx`
- [Web API routes](https://github.com/gsd-build/gsd-2/tree/main/web/app/api): `web/app/api`

### Other components

- **User**

## Connections

- User → CLI entry: invokes
- CLI entry → Agent session: starts
- Agent session → Model providers: requests models
- Agent session → Agent tools: dispatches tools
- Agent configuration → Auth storage: configures (evidence: `packages/pi-coding-agent/src/core/auth-storage.ts`)
- Auto workflow session → Custom workflow engine: runs workflow
- Workflow diagnostics → GSD database: checks (evidence: `src/resources/extensions/gsd/doctor-engine-checks.ts`)
- Workflow diagnostics → GSD paths: resolves paths (evidence: `src/resources/extensions/gsd/doctor-engine-checks.ts`)
- Workflow diagnostics → Workflow state: derives state (evidence: `src/resources/extensions/gsd/doctor-engine-checks.ts`)
- Workflow diagnostics → Workflow projections: repairs projections (evidence: `src/resources/extensions/gsd/doctor-engine-checks.ts`)
- MCP server → MCP sessions: manages sessions (evidence: `packages/mcp-server/src/server.ts`)
- MCP server → Project readers: registers readers (evidence: `packages/mcp-server/src/server.ts`)
- MCP server → Workflow tools: registers tools (evidence: `packages/mcp-server/src/server.ts`)
- MCP sessions → RPC client: creates client (evidence: `packages/mcp-server/src/session-manager.ts`)
- Daemon sessions → RPC client: creates client (evidence: `packages/daemon/src/session-manager.ts`)
- Web bridge → Agent session: uses session (evidence: `src/web/bridge-service.ts`)
- Web bridge → Onboarding service: collects onboarding (evidence: `src/web/bridge-service.ts`)
- Web API routes → Web bridge: routes requests (evidence: `web/app/api/files/route.ts`)
- Workspace store → Web API routes: uses API
