# zhoushoujianwork/easyeda-agent architecture

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

- Interactive diagram: https://gitdiagram.com/zhoushoujianwork/easyeda-agent
- Repository: https://github.com/zhoushoujianwork/easyeda-agent

## Overview

easyeda-agent automates EasyEDA Pro designs through an AI-facing CLI/MCP interface, a local daemon, and an in-editor connector using the official EDA API. The main workflow is request → typed action dispatch → host reads and writes → verification, with schematic, PCB, library, and delivery capabilities. The README documents the overall integration; sampled source confirms the CLI entry, connector transport/context, MCP forwarding, and selected layout/solver internals. Other domain links are documented capability-level relationships, not claims that unsampled files were inspected.

Main entry points: [`internal/app`](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/app) (Command handlers), [`extension/src/transport.ts`](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/transport.ts) (EDA connector), [`internal/app/cmd_sch.go`](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_sch.go) (Schematic operations), [`internal/app/cmd_pcb.go`](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_pcb.go) (PCB operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Agent interfaces"]
  node_mcp["MCP tools<br/>[server.mjs]"]
  node_cli["CLI<br/>[main.go]"]
end

subgraph group_runtime["Action runtime"]
  node_app["Command handlers"]
  node_daemon["Local daemon"]
  node_protocol["Typed protocol"]
  node_connector["EDA connector<br/>[transport.ts]"]
  node_actions["Typed actions<br/>[actions.ts]"]
  node_context["Project context<br/>[eda-context.ts]"]
end

subgraph group_schematic["Schematic design"]
  node_schops["Schematic operations<br/>[cmd_sch.go]"]
  node_schlayout["Schematic layout"]
  node_connectivity["Connectivity model"]
  node_schguard["Schematic checks"]
end

subgraph group_pcb["PCB design"]
  node_pcbops["PCB operations<br/>[cmd_pcb.go]"]
  node_pcblayout["PCB placement<br/>[layout.go]"]
  node_pcbsolve["PCB routing solver<br/>[geometry.go]"]
  node_pcbmodel["PCB model<br/>[model.go]"]
  node_beautify["Silkscreen and routing polish<br/>[index.ts]"]
end

subgraph group_assets["Libraries and delivery"]
  node_library["Component library<br/>[cmd_lib.go]"]
  node_blocks["Reusable circuit blocks<br/>[blocks.go]"]
  node_audit["Checks and audit"]
  node_workflow["Workflow and artifacts<br/>[workflow.go]"]
end

node_agent(("AI agent"))
node_host["EasyEDA Pro"]

node_agent -->|"requests tools"| node_mcp
node_agent -->|"requests design work"| node_cli
node_mcp -->|"forwards commands"| node_cli
node_cli -->|"enters"| node_app
node_app -.->|"uses runtime"| node_daemon
node_daemon -->|"dispatches frames"| node_protocol
node_daemon -->|"forwards typed actions"| node_connector
node_connector -->|"encodes frames"| node_protocol
node_connector -->|"dispatches actions"| node_actions
node_connector -->|"reads context"| node_context
node_connector -->|"calls official API"| node_host
node_app -->|"handles schematic commands"| node_schops
node_app -->|"handles PCB commands"| node_pcbops
node_app -->|"builds library assets"| node_library
node_app -->|"offers reusable blocks"| node_blocks
node_app -->|"runs delivery checks"| node_audit
node_app -->|"supports workflows"| node_workflow
node_schops -->|"reads connection data"| node_connectivity
node_schops -->|"plans layout"| node_schlayout
node_schops -->|"checks schematic"| node_schguard
node_pcbops -->|"searches placements"| node_pcblayout
node_pcbops -->|"solves routing"| node_pcbsolve
node_pcbsolve -->|"uses board model"| node_pcbmodel
node_pcblayout -->|"transforms board"| node_pcbmodel
node_pcbops -->|"polishes routing"| node_beautify
node_audit -->|"checks design state"| node_host
node_workflow -.->|"collects delivery evidence"| node_audit

click node_mcp "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/mcp/src/server.mjs"
click node_cli "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/cmd/easyeda/main.go"
click node_app "https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/app"
click node_daemon "https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/daemon"
click node_protocol "https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/protocol"
click node_connector "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/transport.ts"
click node_actions "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/actions.ts"
click node_context "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/eda-context.ts"
click node_schops "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_sch.go"
click node_schlayout "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/sch_layout_engine_routes.go"
click node_connectivity "https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/connectivity"
click node_schguard "https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/schguard"
click node_pcbops "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_pcb.go"
click node_pcblayout "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcblayout/layout.go"
click node_pcbsolve "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcbsolve/geometry.go"
click node_pcbmodel "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcbmodel/model.go"
click node_beautify "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/beautify/index.ts"
click node_library "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_lib.go"
click node_blocks "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/blocks/blocks.go"
click node_audit "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_audit_export.go"
click node_workflow "https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/workflow/workflow.go"

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_mcp,node_cli toneBlue
class node_app,node_daemon,node_protocol,node_connector,node_actions,node_context toneAmber
class node_schops,node_schlayout,node_connectivity,node_schguard toneMint
class node_pcbops,node_pcblayout,node_pcbsolve,node_pcbmodel,node_beautify toneRose
class node_library,node_blocks,node_audit,node_workflow,node_agent,node_host toneIndigo
```

## Components

### Agent interfaces

- [MCP tools](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/mcp/src/server.mjs): `mcp/src/server.mjs`
- [CLI](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/cmd/easyeda/main.go): `cmd/easyeda/main.go`

### Action runtime

- [Command handlers](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/app): `internal/app`
- [Local daemon](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/daemon): `internal/daemon`
- [Typed protocol](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/protocol): `internal/protocol`
- [EDA connector](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/transport.ts): `extension/src/transport.ts`
- [Typed actions](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/actions.ts): `extension/src/actions.ts`
- [Project context](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/eda-context.ts): `extension/src/eda-context.ts`

### Schematic design

- [Schematic operations](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_sch.go): `internal/app/cmd_sch.go`
- [Schematic layout](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/sch_layout_engine_routes.go): `internal/app/sch_layout_engine_routes.go`
- [Connectivity model](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/connectivity): `internal/connectivity`
- [Schematic checks](https://github.com/zhoushoujianwork/easyeda-agent/tree/main/internal/schguard): `internal/schguard`

### PCB design

- [PCB operations](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_pcb.go): `internal/app/cmd_pcb.go`
- [PCB placement](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcblayout/layout.go): `pkg/pcblayout/layout.go`
- [PCB routing solver](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcbsolve/geometry.go): `pkg/pcbsolve/geometry.go`
- [PCB model](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/pkg/pcbmodel/model.go): `pkg/pcbmodel/model.go`
- [Silkscreen and routing polish](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/extension/src/beautify/index.ts): `extension/src/beautify/index.ts`

### Libraries and delivery

- [Component library](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_lib.go): `internal/app/cmd_lib.go`
- [Reusable circuit blocks](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/blocks/blocks.go): `internal/blocks/blocks.go`
- [Checks and audit](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/app/cmd_audit_export.go): `internal/app/cmd_audit_export.go`
- [Workflow and artifacts](https://github.com/zhoushoujianwork/easyeda-agent/blob/main/internal/workflow/workflow.go): `internal/workflow/workflow.go`

### Other components

- **AI agent**
- **EasyEDA Pro**

## Connections

- AI agent → MCP tools: requests tools
- AI agent → CLI: requests design work
- MCP tools → CLI: forwards commands (evidence: `mcp/src/server.mjs`)
- CLI → Command handlers: enters (evidence: `cmd/easyeda/main.go`)
- Command handlers → Local daemon: uses runtime
- Local daemon → Typed protocol: dispatches frames (evidence: `internal/daemon/dispatch.go`)
- Local daemon → EDA connector: forwards typed actions
- EDA connector → Typed protocol: encodes frames (evidence: `extension/src/transport.ts`)
- EDA connector → Typed actions: dispatches actions (evidence: `extension/src/transport.ts`)
- EDA connector → Project context: reads context (evidence: `extension/src/transport.ts`)
- EDA connector → EasyEDA Pro: calls official API
- Command handlers → Schematic operations: handles schematic commands
- Command handlers → PCB operations: handles PCB commands
- Command handlers → Component library: builds library assets
- Command handlers → Reusable circuit blocks: offers reusable blocks
- Command handlers → Checks and audit: runs delivery checks
- Command handlers → Workflow and artifacts: supports workflows
- Schematic operations → Connectivity model: reads connection data
- Schematic operations → Schematic layout: plans layout
- Schematic operations → Schematic checks: checks schematic
- PCB operations → PCB placement: searches placements
- PCB operations → PCB routing solver: solves routing
- PCB routing solver → PCB model: uses board model (evidence: `pkg/pcbsolve/geometry.go`)
- PCB placement → PCB model: transforms board (evidence: `pkg/pcblayout/layout.go`)
- PCB operations → Silkscreen and routing polish: polishes routing
- Checks and audit → EasyEDA Pro: checks design state
- Workflow and artifacts → Checks and audit: collects delivery evidence
