# zarazhangrui/lark-coding-agent-bridge architecture

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

- Interactive diagram: https://gitdiagram.com/zarazhangrui/lark-coding-agent-bridge
- Repository: https://github.com/zarazhangrui/lark-coding-agent-bridge

## Overview

Lark Channel Bridge connects Feishu/Lark conversations to local Claude Code or Codex CLI processes. The primary flow is message intake, access/workspace/session handling, agent execution, then streamed or final card replies; files and queued turns extend that interaction. The product also manages profiles and background services, a browser-based setup console, and optional meeting participation with transcript-driven agent responses. Edges reflect README-described behavior or relationships visible in the supplied source index and excerpts; several implementation paths were not sampled, so their internal links are omitted.

Main entry points: [`src/bot/channel.ts`](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/channel.ts) (Message channel), [`src/commands/index.ts`](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/commands/index.ts) (Chat commands), [`src/meeting/manager.ts`](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/manager.ts) (Meeting manager), [`src/bot/run-flow.ts`](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/run-flow.ts) (Run flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Chat interaction"]
  node_channel["Message channel<br/>[channel.ts]"]
  node_commands["Chat commands<br/>[index.ts]"]
  node_runflow["Run flow<br/>[run-flow.ts]"]
  node_cards["Cards and replies<br/>[run-renderer.ts]"]
  node_attachments["Media attachments<br/>[attachment.ts]"]
end

subgraph group_execution["Agent execution"]
  node_agent["Agent adapters<br/>[adapter.ts]"]
  node_capability["Agent capabilities<br/>[capability.ts]"]
  node_executor["Run executor<br/>[run-executor.ts]"]
  node_policy["Access and run policy<br/>[run-policy.ts]"]
end

subgraph group_state["Profiles and state"]
  node_sessions[("Session catalog<br/>[catalog.ts]")]
  node_workspaces[("Workspace store<br/>[store.ts]")]
  node_profile[("Profile configuration<br/>[profile-store.ts]")]
  node_paths["Application paths<br/>[app-paths.ts]"]
  node_userstate[("Local profile data")]
end

subgraph group_meetings["Meeting assistant"]
  node_meeting["Meeting manager<br/>[manager.ts]"]
  node_meetingapi["Meeting API<br/>[api.ts]"]
  node_meetingsession["Meeting session<br/>[session.ts]"]
  node_meetingflow["Meeting orchestration<br/>[orchestrator.ts]"]
end

subgraph group_operations["Setup and operations"]
  node_cli["Host CLI<br/>[index.ts]"]
  node_service["Service commands<br/>[service.ts]"]
  node_daemon["OS service adapter<br/>[service-adapter.ts]"]
  node_ui["Setup web server<br/>[server.ts]"]
  node_web["Browser console<br/>[App.tsx]"]
end

node_user(("Chat user"))
node_lark{{"Feishu / Lark"}}

node_user -->|"sends messages"| node_lark
node_lark -->|"delivers events"| node_channel
node_channel -.->|"dispatches commands"| node_commands
node_channel -->|"starts turns"| node_runflow
node_runflow -.->|"executes run"| node_executor
node_executor -->|"runs locally"| node_agent
node_agent -->|"streams results"| node_cards
node_cards -->|"updates reply"| node_lark
node_channel -->|"downloads files"| node_attachments
node_commands -->|"resolves session"| node_sessions
node_commands -->|"uses workspace"| node_workspaces
node_commands -->|"checks access"| node_policy
node_capability -->|"reads permissions"| node_profile
node_profile -->|"resolves files"| node_paths
node_paths -->|"locates state"| node_userstate
node_meeting -->|"joins meeting"| node_meetingapi
node_meeting -->|"creates session"| node_meetingsession
node_meeting -->|"ingests activity"| node_meetingsession
node_meetingflow -->|"starts agent run"| node_runflow
node_cli -->|"routes service"| node_service
node_service -->|"installs service"| node_daemon
node_cli -.->|"starts console"| node_ui
node_web -->|"calls API"| node_ui

click node_channel "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/channel.ts"
click node_commands "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/commands/index.ts"
click node_runflow "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/run-flow.ts"
click node_cards "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/card/run-renderer.ts"
click node_attachments "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/media/attachment.ts"
click node_agent "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/agent/claude/adapter.ts"
click node_capability "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/agent/capability.ts"
click node_executor "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/runtime/run-executor.ts"
click node_policy "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/policy/run-policy.ts"
click node_sessions "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/session/catalog.ts"
click node_workspaces "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/workspace/store.ts"
click node_profile "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/config/profile-store.ts"
click node_paths "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/config/app-paths.ts"
click node_meeting "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/manager.ts"
click node_meetingapi "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/api.ts"
click node_meetingsession "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/session.ts"
click node_meetingflow "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/orchestrator.ts"
click node_cli "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/cli/index.ts"
click node_service "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/cli/commands/service.ts"
click node_daemon "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/daemon/service-adapter.ts"
click node_ui "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/ui/server.ts"
click node_web "https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/web/src/App.tsx"

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_channel,node_commands,node_runflow,node_cards,node_attachments,node_user toneBlue
class node_agent,node_capability,node_executor,node_policy toneAmber
class node_sessions,node_workspaces,node_profile,node_paths,node_userstate toneMint
class node_meeting,node_meetingapi,node_meetingsession,node_meetingflow toneRose
class node_cli,node_service,node_daemon,node_ui,node_web,node_lark toneIndigo
```

## Components

### Chat interaction

- [Message channel](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/channel.ts): `src/bot/channel.ts`
- [Chat commands](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/commands/index.ts): `src/commands/index.ts`
- [Run flow](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/bot/run-flow.ts): `src/bot/run-flow.ts`
- [Cards and replies](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/card/run-renderer.ts): `src/card/run-renderer.ts`
- [Media attachments](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/media/attachment.ts): `src/media/attachment.ts`

### Agent execution

- [Agent adapters](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/agent/claude/adapter.ts): `src/agent/claude/adapter.ts`
- [Agent capabilities](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/agent/capability.ts): `src/agent/capability.ts`
- [Run executor](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/runtime/run-executor.ts): `src/runtime/run-executor.ts`
- [Access and run policy](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/policy/run-policy.ts): `src/policy/run-policy.ts`

### Profiles and state

- [Session catalog](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/session/catalog.ts): `src/session/catalog.ts`
- [Workspace store](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/workspace/store.ts): `src/workspace/store.ts`
- [Profile configuration](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/config/profile-store.ts): `src/config/profile-store.ts`
- [Application paths](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/config/app-paths.ts): `src/config/app-paths.ts`
- **Local profile data**

### Meeting assistant

- [Meeting manager](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/manager.ts): `src/meeting/manager.ts`
- [Meeting API](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/api.ts): `src/meeting/api.ts`
- [Meeting session](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/session.ts): `src/meeting/session.ts`
- [Meeting orchestration](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/meeting/orchestrator.ts): `src/meeting/orchestrator.ts`

### Setup and operations

- [Host CLI](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/cli/index.ts): `src/cli/index.ts`
- [Service commands](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/cli/commands/service.ts): `src/cli/commands/service.ts`
- [OS service adapter](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/daemon/service-adapter.ts): `src/daemon/service-adapter.ts`
- [Setup web server](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/src/ui/server.ts): `src/ui/server.ts`
- [Browser console](https://github.com/zarazhangrui/lark-coding-agent-bridge/blob/main/web/src/App.tsx): `web/src/App.tsx`

### Other components

- **Chat user**
- **Feishu / Lark**

## Connections

- Chat user → Feishu / Lark: sends messages
- Feishu / Lark → Message channel: delivers events
- Message channel → Chat commands: dispatches commands
- Message channel → Run flow: starts turns
- Run flow → Run executor: executes run
- Run executor → Agent adapters: runs locally
- Agent adapters → Cards and replies: streams results
- Cards and replies → Feishu / Lark: updates reply
- Message channel → Media attachments: downloads files
- Chat commands → Session catalog: resolves session (evidence: `src/bot/session-catalog-identity.ts`)
- Chat commands → Workspace store: uses workspace (evidence: `src/bot/session-catalog-identity.ts`)
- Chat commands → Access and run policy: checks access (evidence: `src/bot/session-catalog-identity.ts`)
- Agent capabilities → Profile configuration: reads permissions (evidence: `src/agent/capability.ts`)
- Profile configuration → Application paths: resolves files (evidence: `src/config/profile-store.ts`)
- Application paths → Local profile data: locates state (evidence: `src/config/app-paths.ts`)
- Meeting manager → Meeting API: joins meeting (evidence: `src/meeting/manager.ts`)
- Meeting manager → Meeting session: creates session (evidence: `src/meeting/manager.ts`)
- Meeting manager → Meeting session: ingests activity (evidence: `src/meeting/manager.ts`)
- Meeting orchestration → Run flow: starts agent run (evidence: `src/meeting/orchestrator.ts`)
- Host CLI → Service commands: routes service (evidence: `src/cli/index.ts`)
- Service commands → OS service adapter: installs service (evidence: `src/cli/commands/service.ts`)
- Host CLI → Setup web server: starts console
- Browser console → Setup web server: calls API
