# fei2411/deepseek-bot architecture

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

- Interactive diagram: https://gitdiagram.com/fei2411/deepseek-bot
- Repository: https://github.com/fei2411/deepseek-bot

## Overview

DS Bot is a DeepSeek Harness plugin that adds persistent Bots, group chats, and a React interface to DSH. The principal workflow is a user chatting with a Bot; Bots can coordinate with other Bots or answer through group-chat rules, using DSH sessions, models, and tools. The host also provides memory, browser access, schedules, and token-usage reporting. Relationships between the client and host are only loosely evidenced in the excerpts, so the graph avoids asserting specific API routes; several host relationships are supported by module imports or registration in the plugin entry point.

Main entry points: [`ds-bot/index.js`](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/index.js) (Plugin entry), [`ds-bot/src/host/turns.js`](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/turns.js) (Bot sessions), [`ds-bot/src/host/tools.js`](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/tools.js) (Team tools), [`ds-bot/src/host/groups.js`](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/groups.js) (Group chats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Plugin and interface"]
  node_plugin["Plugin entry<br/>[index.js]"]
  node_client["Bot interface<br/>[index.js]"]
  node_clientapi["Client API<br/>[api.js]"]
  node_usagepage["Usage view<br/>[usage-page.js]"]
end

subgraph group_bots["Bots and sessions"]
  node_session["Bot sessions<br/>[turns.js]"]
  node_roster["Bot roster<br/>[roster.js]"]
  node_models["Model selection<br/>[models.js]"]
  node_permissions["Permissions<br/>[permissions.js]"]
end

subgraph group_collaboration["Group collaboration"]
  node_groups["Group chats<br/>[groups.js]"]
  node_teamtools["Team tools<br/>[tools.js]"]
  node_mentions["Mention parsing<br/>[mentions.js]"]
end

subgraph group_capabilities["Bot capabilities and records"]
  node_memory["Bot memory<br/>[memory.js]"]
  node_browser["Bot browser<br/>[browser.js]"]
  node_schedules["Scheduled tasks<br/>[schedules.js]"]
  node_usage["Usage tracking<br/>[usage.js]"]
  node_store[("Persistent state<br/>[store.js]")]
end

node_user(("User"))
node_dsh{{"DeepSeek Harness"}}

node_user -->|"chats with"| node_client
node_client -->|"requests state"| node_clientapi
node_clientapi -.->|"calls plugin"| node_plugin
node_plugin -->|"extends"| node_dsh
node_plugin -->|"installs"| node_session
node_plugin -->|"installs"| node_roster
node_plugin -->|"installs"| node_models
node_plugin -->|"installs"| node_permissions
node_plugin -->|"installs"| node_groups
node_plugin -->|"installs"| node_teamtools
node_plugin -->|"installs"| node_memory
node_plugin -->|"installs"| node_browser
node_plugin -->|"installs"| node_schedules
node_plugin -->|"installs"| node_usage
node_session -->|"uses sessions"| node_dsh
node_session -->|"uses models and tools"| node_dsh
node_groups -->|"uses"| node_teamtools
node_groups -->|"dispatches turns"| node_session
node_teamtools -.->|"resolves mentions"| node_mentions
node_memory -->|"uses tool helpers"| node_teamtools
node_browser -->|"uses tool helpers"| node_teamtools
node_session -->|"uses schedule helpers"| node_schedules
node_usage -.->|"meters model use"| node_dsh
node_usagepage -.->|"renders usage"| node_client
node_usagepage -->|"reports tokens"| node_dsh
node_plugin -->|"configures state"| node_store
node_dsh -->|"stores data locally"| node_store

click node_plugin "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/index.js"
click node_client "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/index.js"
click node_clientapi "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/api.js"
click node_session "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/turns.js"
click node_roster "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/roster.js"
click node_models "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/models.js"
click node_permissions "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/permissions.js"
click node_groups "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/groups.js"
click node_teamtools "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/tools.js"
click node_mentions "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/shared/mentions.js"
click node_memory "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/memory.js"
click node_browser "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/browser.js"
click node_schedules "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/schedules.js"
click node_usage "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/usage.js"
click node_usagepage "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/usage-page.js"
click node_store "https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/store.js"

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_plugin,node_client,node_clientapi,node_usagepage,node_user toneBlue
class node_session,node_roster,node_models,node_permissions toneAmber
class node_groups,node_teamtools,node_mentions toneMint
class node_memory,node_browser,node_schedules,node_usage,node_store toneRose
class node_dsh toneIndigo
```

## Components

### Plugin and interface

- [Plugin entry](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/index.js): `ds-bot/index.js`
- [Bot interface](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/index.js): `ds-bot/src/client/index.js`
- [Client API](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/api.js): `ds-bot/src/client/api.js`
- [Usage view](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/client/usage-page.js): `ds-bot/src/client/usage-page.js`

### Bots and sessions

- [Bot sessions](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/turns.js): `ds-bot/src/host/turns.js`
- [Bot roster](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/roster.js): `ds-bot/src/host/roster.js`
- [Model selection](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/models.js): `ds-bot/src/host/models.js`
- [Permissions](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/permissions.js): `ds-bot/src/host/permissions.js`

### Group collaboration

- [Group chats](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/groups.js): `ds-bot/src/host/groups.js`
- [Team tools](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/tools.js): `ds-bot/src/host/tools.js`
- [Mention parsing](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/shared/mentions.js): `ds-bot/src/shared/mentions.js`

### Bot capabilities and records

- [Bot memory](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/memory.js): `ds-bot/src/host/memory.js`
- [Bot browser](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/browser.js): `ds-bot/src/host/browser.js`
- [Scheduled tasks](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/schedules.js): `ds-bot/src/host/schedules.js`
- [Usage tracking](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/usage.js): `ds-bot/src/host/usage.js`
- [Persistent state](https://github.com/fei2411/deepseek-bot/blob/main/ds-bot/src/host/store.js): `ds-bot/src/host/store.js`

### Other components

- **User**
- **DeepSeek Harness**

## Connections

- User → Bot interface: chats with
- Bot interface → Client API: requests state (evidence: `ds-bot/src/client/index.js`)
- Client API → Plugin entry: calls plugin
- Plugin entry → DeepSeek Harness: extends
- Plugin entry → Bot sessions: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Bot roster: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Model selection: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Permissions: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Group chats: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Team tools: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Bot memory: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Bot browser: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Scheduled tasks: installs (evidence: `ds-bot/index.js`)
- Plugin entry → Usage tracking: installs (evidence: `ds-bot/index.js`)
- Bot sessions → DeepSeek Harness: uses sessions
- Bot sessions → DeepSeek Harness: uses models and tools
- Group chats → Team tools: uses (evidence: `ds-bot/src/host/groups.js`)
- Group chats → Bot sessions: dispatches turns (evidence: `ds-bot/src/host/groups.js`)
- Team tools → Mention parsing: resolves mentions
- Bot memory → Team tools: uses tool helpers (evidence: `ds-bot/src/host/memory.js`)
- Bot browser → Team tools: uses tool helpers (evidence: `ds-bot/src/host/browser.js`)
- Bot sessions → Scheduled tasks: uses schedule helpers (evidence: `ds-bot/src/host/turns.js`)
- Usage tracking → DeepSeek Harness: meters model use
- Usage view → Bot interface: renders usage (evidence: `ds-bot/src/client/index.js`)
- Usage view → DeepSeek Harness: reports tokens
- Plugin entry → Persistent state: configures state (evidence: `ds-bot/index.js`)
- DeepSeek Harness → Persistent state: stores data locally
