--- title: "graphd" type: entity tags: [project, lsp, code-intelligence] last_updated: 2026-04-20 --- ## Summary graphd 是 LSP/Index Engineer 智能体构建的核心 LSP 聚合守护进程,通过并发编排多个语言服务器客户端实现统一代码语义图谱管理。 ## Core Components - **LSP Client Pool**:并发管理 TypeScript、PHP、Go、Rust、Python 等语言服务器客户端 - **Graph State**:维护节点(files/symbols)和边(contains/imports/calls/refs)的内存图谱 - **HTTP Server**:提供 /graph、/nav/:symId、/stats 等 API 端点 - **WebSocket Server**:通过流式图谱差异实现实时客户端更新 - **File Watcher**:监听文件变化和 git 提交,触发增量图谱更新 ## Performance Targets | Metric | Target | |--------|--------| | /graph response | <100ms (<10k nodes) | | /nav/:symId (cached) | <20ms | | /nav/:symId (uncached) | <60ms | | WebSocket latency | <50ms | | Memory usage | <500MB | ## Architecture ```typescript interface GraphDaemon { lspClients: Map; graph: { nodes: Map; edges: Map; index: SymbolIndex }; httpServer: { '/graph': GraphResponse; '/nav/:symId': NavigationResponse; '/stats': SystemStats }; wsServer: { onConnection: WSClient; emitDiff: GraphDiff }; watcher: { onFileChange: path => void; on