# yeswearebot/yesimbot architecture

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

- Interactive diagram: https://gitdiagram.com/yeswearebot/yesimbot
- Repository: https://github.com/yeswearebot/yesimbot

## Overview

YesImBot is a Koishi-based group-chat AI runtime. Its documented inbound workflow admits a session, translates it into a canonical message/event, routes it to a channel runtime, decides whether to wait or run an agent turn, then passively delivers output. The README also documents extensible models, tools, memory, workspace, search, scheduling, stickers, and a console. Edges follow explicit README statements or shown caller/import references; unsampled subsystem links are omitted where wiring is not evidenced.

Main entry points: [`packages/agent-runtime/src/agent.ts`](https://github.com/yeswearebot/yesimbot/blob/v4/packages/agent-runtime/src/agent.ts) (Agent Turn Engine), [`core/src/runtimes/index.ts`](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/index.ts) (Runtime Manager), [`core/src/messengers/index.ts`](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/messengers/index.ts) (Session Gateway), [`core/src/channels/index.ts`](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/channels/index.ts) (Channel Resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Koishi Gateway"]
  node_messenger["Session Gateway<br/>[index.ts]"]
  node_translators["Platform Translators<br/>[onebot.ts]"]
  node_canonical["Message and Event Records<br/>[index.ts]"]
  node_output["Passive Delivery<br/>[output.ts]"]
end

subgraph group_runtime["Agent Runtime"]
  node_agent["Agent Turn Engine<br/>[agent.ts]"]
  node_will["Will Decision<br/>[will.ts]"]
  node_runtime_mgr["Runtime Manager<br/>[index.ts]"]
  node_prompt["Prompt Assembly<br/>[prompt.ts]"]
  node_models["Model Registry<br/>[index.ts]"]
end

subgraph group_extensions["Agent Extensions"]
  node_routing["Will Policy<br/>[routing.ts]"]
  node_workspace["Workspace and Skills<br/>[workspace.ts]"]
  node_command["Command Bridge<br/>[execution.ts]"]
  node_mcp["MCP Client<br/>[transports.ts]"]
  node_search["Web Search<br/>[index.ts]"]
  node_memos["MemOS Memory<br/>[client.ts]"]
  node_chat_learning["Chat Learning<br/>[index.ts]"]
  node_brain[("Global Brain<br/>[store.ts]")]
  node_schedule["Scheduling<br/>[scheduler.ts]"]
  node_sticker["Sticker Manager<br/>[store.ts]"]
  node_onebot_tools["OneBot Tools<br/>[forward.ts]"]
  node_console["Web Console<br/>[panel.ts]"]
end

subgraph group_providers["Model Providers"]
  node_providers_api["LLM Providers<br/>[index.ts]"]
end

subgraph group_support["Channel Services"]
  node_channels["Channel Resources<br/>[index.ts]"]
  node_history[("Channel History<br/>[index.ts]")]
  node_resources[("Assets and Artifacts<br/>[index.ts]")]
end

node_koishi(("Koishi Sessions"))

node_koishi -->|"receives sessions"| node_messenger
node_messenger -->|"resolves channel"| node_channels
node_messenger -->|"selects translator"| node_translators
node_translators -->|"produces records"| node_canonical
node_messenger -->|"routes records"| node_runtime_mgr
node_runtime_mgr -.->|"dispatches turns"| node_agent
node_agent -.->|"requests decision"| node_will
node_will -.->|"uses policy"| node_routing
node_runtime_mgr -.->|"manages history"| node_history
node_runtime_mgr -.->|"loads channel state"| node_channels
node_agent -.->|"assembles prompt"| node_prompt
node_agent -.->|"invokes model"| node_models
node_models -.->|"selects provider"| node_providers_api
node_runtime_mgr -.->|"delivers output"| node_output
node_channels -.->|"provides resources"| node_resources
node_agent -.->|"loads tools"| node_workspace
node_agent -.->|"loads tools"| node_command
node_agent -.->|"loads tools"| node_mcp
node_agent -.->|"loads tools"| node_search
node_agent -.->|"loads tools"| node_memos
node_agent -.->|"extends behavior"| node_chat_learning
node_agent -.->|"loads tools"| node_brain
node_agent -.->|"loads tools"| node_schedule
node_agent -.->|"loads tools"| node_sticker
node_agent -.->|"loads tools"| node_onebot_tools
node_console -.->|"adds WebUI"| node_koishi

click node_messenger "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/messengers/index.ts"
click node_translators "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/platforms/onebot.ts"
click node_canonical "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/messages/index.ts"
click node_channels "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/channels/index.ts"
click node_agent "https://github.com/yeswearebot/yesimbot/blob/v4/packages/agent-runtime/src/agent.ts"
click node_will "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/agents/will.ts"
click node_routing "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/will-policy/src/routing.ts"
click node_runtime_mgr "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/index.ts"
click node_prompt "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/prompt.ts"
click node_models "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/models/index.ts"
click node_providers_api "https://github.com/yeswearebot/yesimbot/blob/v4/providers/openai/src/index.ts"
click node_output "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/output.ts"
click node_history "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/conversations/index.ts"
click node_resources "https://github.com/yeswearebot/yesimbot/blob/v4/core/src/resources/index.ts"
click node_workspace "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/workspace/src/workspace.ts"
click node_command "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/command-bridge/src/execution.ts"
click node_mcp "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/mcp-client/src/transports.ts"
click node_search "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/search-service/src/index.ts"
click node_memos "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/memos-client/src/client.ts"
click node_chat_learning "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/chat-learning/src/index.ts"
click node_brain "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/global-brain/src/store.ts"
click node_schedule "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/schedule/src/scheduler.ts"
click node_sticker "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/sticker-manager/src/store.ts"
click node_onebot_tools "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/onebot-utils/src/forward.ts"
click node_console "https://github.com/yeswearebot/yesimbot/blob/v4/plugins/console/src/panel.ts"

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_messenger,node_translators,node_canonical,node_output toneBlue
class node_agent,node_will,node_runtime_mgr,node_prompt,node_models toneAmber
class node_routing,node_workspace,node_command,node_mcp,node_search,node_memos,node_chat_learning,node_brain,node_schedule,node_sticker,node_onebot_tools,node_console toneMint
class node_providers_api toneRose
class node_channels,node_history,node_resources,node_koishi toneIndigo
```

## Components

### Koishi Gateway

- [Session Gateway](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/messengers/index.ts): `core/src/messengers/index.ts`
- [Platform Translators](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/platforms/onebot.ts): `core/src/platforms/onebot.ts`
- [Message and Event Records](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/messages/index.ts): `core/src/messages/index.ts`
- [Passive Delivery](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/output.ts): `core/src/runtimes/output.ts`

### Agent Runtime

- [Agent Turn Engine](https://github.com/yeswearebot/yesimbot/blob/v4/packages/agent-runtime/src/agent.ts): `packages/agent-runtime/src/agent.ts`
- [Will Decision](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/agents/will.ts): `core/src/agents/will.ts`
- [Runtime Manager](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/index.ts): `core/src/runtimes/index.ts`
- [Prompt Assembly](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/runtimes/prompt.ts): `core/src/runtimes/prompt.ts`
- [Model Registry](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/models/index.ts): `core/src/models/index.ts`

### Agent Extensions

- [Will Policy](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/will-policy/src/routing.ts): `plugins/will-policy/src/routing.ts`
- [Workspace and Skills](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/workspace/src/workspace.ts): `plugins/workspace/src/workspace.ts`
- [Command Bridge](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/command-bridge/src/execution.ts): `plugins/command-bridge/src/execution.ts`
- [MCP Client](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/mcp-client/src/transports.ts): `plugins/mcp-client/src/transports.ts`
- [Web Search](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/search-service/src/index.ts): `plugins/search-service/src/index.ts`
- [MemOS Memory](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/memos-client/src/client.ts): `plugins/memos-client/src/client.ts`
- [Chat Learning](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/chat-learning/src/index.ts): `plugins/chat-learning/src/index.ts`
- [Global Brain](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/global-brain/src/store.ts): `plugins/global-brain/src/store.ts`
- [Scheduling](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/schedule/src/scheduler.ts): `plugins/schedule/src/scheduler.ts`
- [Sticker Manager](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/sticker-manager/src/store.ts): `plugins/sticker-manager/src/store.ts`
- [OneBot Tools](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/onebot-utils/src/forward.ts): `plugins/onebot-utils/src/forward.ts`
- [Web Console](https://github.com/yeswearebot/yesimbot/blob/v4/plugins/console/src/panel.ts): `plugins/console/src/panel.ts`

### Model Providers

- [LLM Providers](https://github.com/yeswearebot/yesimbot/blob/v4/providers/openai/src/index.ts): `providers/openai/src/index.ts`

### Channel Services

- [Channel Resources](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/channels/index.ts): `core/src/channels/index.ts`
- [Channel History](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/conversations/index.ts): `core/src/conversations/index.ts`
- [Assets and Artifacts](https://github.com/yeswearebot/yesimbot/blob/v4/core/src/resources/index.ts): `core/src/resources/index.ts`

### Other components

- **Koishi Sessions**

## Connections

- Koishi Sessions → Session Gateway: receives sessions (evidence: `README.md`)
- Session Gateway → Channel Resources: resolves channel (evidence: `core/src/messengers/index.ts`)
- Session Gateway → Platform Translators: selects translator (evidence: `README.md`)
- Platform Translators → Message and Event Records: produces records (evidence: `README.md`)
- Session Gateway → Runtime Manager: routes records (evidence: `core/src/messengers/index.ts`)
- Runtime Manager → Agent Turn Engine: dispatches turns
- Agent Turn Engine → Will Decision: requests decision
- Will Decision → Will Policy: uses policy
- Runtime Manager → Channel History: manages history
- Runtime Manager → Channel Resources: loads channel state
- Agent Turn Engine → Prompt Assembly: assembles prompt
- Agent Turn Engine → Model Registry: invokes model
- Model Registry → LLM Providers: selects provider
- Runtime Manager → Passive Delivery: delivers output
- Channel Resources → Assets and Artifacts: provides resources (evidence: `core/src/channels/index.ts`)
- Agent Turn Engine → Workspace and Skills: loads tools
- Agent Turn Engine → Command Bridge: loads tools
- Agent Turn Engine → MCP Client: loads tools
- Agent Turn Engine → Web Search: loads tools
- Agent Turn Engine → MemOS Memory: loads tools
- Agent Turn Engine → Chat Learning: extends behavior
- Agent Turn Engine → Global Brain: loads tools
- Agent Turn Engine → Scheduling: loads tools
- Agent Turn Engine → Sticker Manager: loads tools
- Agent Turn Engine → OneBot Tools: loads tools
- Web Console → Koishi Sessions: adds WebUI
