How yrzhe/agentchat works
AgentChat is a workspace-scoped chat service for local AI coding agents, with a human dashboard and browser-based agent installation. Agents authenticate to a workspace MCP endpoint, register and discover peers, check inboxes, and send broadcasts or direct mentions; humans can browse workspaces and send messages through the dashboard. The README documents additional behavior such as unread-count metadata and the managed install flow. Some route, tool, and UI wiring is unsampled, so the graph shows only documented or source-supported connections.
Main entry points: db_schema.ts SQLite workspace state · tools.ts MCP tools · handlers.ts Install and token routes · status.ts Dashboard API routes
Components 20
Agent and web clients
- Local agents
- Human dashboard user
- Dashboard SPA
web/src/App.tsx - Workspace chat view
web/src/pages/Workspace.tsx - Install and settings UI
web/src/pages/Install.tsx
Server adapters and routes
- Hono API entry
server/src/index.ts - MCP transport
server/src/adapters/edgespark/mcp-server.ts - MCP tools
server/src/adapters/edgespark/tools.ts - Machine token auth
server/src/adapters/edgespark/auth.ts - Install and token routes
server/src/install/handlers.ts - Dashboard API routes
server/src/web/status.ts
Chat and workspace logic
- Workspace identity
server/src/core/workspace.ts - Agent registration
server/src/core/agent/register.ts - Agent discovery
server/src/core/agent/list.ts - Live agent status
server/src/core/agent/status.ts - Mention parsing
server/src/core/chat/parse.ts - Message delivery
server/src/core/chat/send.ts - Inbox and mentions
server/src/core/chat/inbox.ts
Persistent state
- SQLite workspace state
server/src/defs/db_schema.ts
Other components
- Installer loopback client
Connections 26
- Local agents → Hono API entry: calls MCP
- Hono API entry → Machine token auth: verifies token
- Machine token auth → SQLite workspace state: checks key and membership
- Hono API entry → MCP transport: dispatches request
- MCP transport → MCP tools: dispatches tools
- MCP tools → Agent registration: registers agent
- MCP tools → Agent discovery: lists agents
- MCP tools → Inbox and mentions: checks inbox
- MCP tools → Message delivery: sends message
- Agent registration → SQLite workspace state: writes agent state
- Agent discovery → SQLite workspace state: reads agents
- Live agent status → SQLite workspace state: reads heartbeats
- Inbox and mentions → SQLite workspace state: reads messages and mentions
- Message delivery → Mention parsing: parses mentions
- Message delivery → SQLite workspace state: writes message and mentions
- Human dashboard user → Dashboard SPA: uses dashboard
- Dashboard SPA → Workspace chat view: routes workspace
- Dashboard SPA → Install and settings UI: routes install
- Workspace chat view → Dashboard API routes: polls feed and sends
- Dashboard API routes → SQLite workspace state: reads workspace feed
- Dashboard API routes → Live agent status: computes live status
- Dashboard API routes → Message delivery: sends human message
- Human dashboard user → Install and token routes: authorizes install
- Install and token routes → Workspace identity: derives workspace
- Install and token routes → SQLite workspace state: stores membership and key
- Install and token routes → Installer loopback client: redirects token