# adaamn/twelvecorp architecture

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

- Interactive diagram: https://gitdiagram.com/adaamn/twelvecorp
- Repository: https://github.com/adaamn/twelvecorp

## Overview

TwelveCorp is a Discord bot whose main user workflow is `/ask`: a Discord interaction reaches the AI cog, which requests an answer from the service layer and returns it as an embed; the service can use web search for current information. Other user-facing branches provide mention-based chat, profile analysis, role-play, reaction-triggered translation and latency reporting. The services module centralizes model calls, while configuration supplies credentials and prompts. The README is empty; relationships below are based on the shown source, and optional web search is marked separately.

Main entry points: [`src/bot.py`](https://github.com/adaamn/twelvecorp/blob/main/src/bot.py) (Bot startup), [`src/services.py`](https://github.com/adaamn/twelvecorp/blob/main/src/services.py) (AI service layer), [`src/features/chat.py`](https://github.com/adaamn/twelvecorp/blob/main/src/features/chat.py) (Mention chat), [`src/features/profile.py`](https://github.com/adaamn/twelvecorp/blob/main/src/features/profile.py) (Profile analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Discord runtime"]
  node_discord{{"Discord platform"}}
  node_bot["Bot startup<br/>[bot.py]"]
  node_config["Bot configuration<br/>[config.py]"]
end

subgraph group_features["Bot features"]
  node_ask["Ask command<br/>[ai.py]"]
  node_chat["Mention chat<br/>[chat.py]"]
  node_profile["Profile analysis<br/>[profile.py]"]
  node_larp["Role-play<br/>[larp.py]"]
  node_translate["Reaction translation<br/>[translate.py]"]
  node_ping["Latency command<br/>[ping.py]"]
end

subgraph group_services["AI services"]
  node_services["AI service layer<br/>[services.py]"]
end

subgraph group_integrations["External services"]
  node_anthropic{{"Anthropic API"}}
  node_tavily{{"Tavily search"}}
end

node_user(("Discord user"))

node_user -->|"uses"| node_discord
node_discord -->|"starts bot"| node_bot
node_bot -->|"loads extension"| node_ask
node_bot -->|"loads extension"| node_chat
node_bot -->|"loads extension"| node_profile
node_bot -->|"loads extension"| node_larp
node_bot -->|"loads extension"| node_translate
node_bot -->|"loads extension"| node_ping
node_ask -->|"requests answer"| node_services
node_chat -->|"requests reply"| node_services
node_profile -->|"requests analysis"| node_services
node_larp -->|"requests role-play"| node_services
node_translate -->|"requests translation"| node_services
node_services -->|"reads settings"| node_config
node_bot -->|"reads token"| node_config
node_services -->|"calls model"| node_anthropic
node_services -.->|"searches web"| node_tavily
node_ask -->|"sends answer"| node_discord
node_chat -->|"reads history"| node_discord
node_chat -->|"replies"| node_discord
node_profile -->|"reads history"| node_discord
node_profile -->|"sends analysis"| node_discord
node_larp -->|"sends response"| node_discord
node_translate -->|"fetches message"| node_discord
node_translate -->|"replies with embed"| node_discord
node_ping -->|"reports latency"| node_discord

click node_bot "https://github.com/adaamn/twelvecorp/blob/main/src/bot.py"
click node_config "https://github.com/adaamn/twelvecorp/blob/main/src/config.py"
click node_ask "https://github.com/adaamn/twelvecorp/blob/main/src/features/ai.py"
click node_chat "https://github.com/adaamn/twelvecorp/blob/main/src/features/chat.py"
click node_profile "https://github.com/adaamn/twelvecorp/blob/main/src/features/profile.py"
click node_larp "https://github.com/adaamn/twelvecorp/blob/main/src/features/larp.py"
click node_translate "https://github.com/adaamn/twelvecorp/blob/main/src/features/translate.py"
click node_ping "https://github.com/adaamn/twelvecorp/blob/main/src/features/ping.py"
click node_services "https://github.com/adaamn/twelvecorp/blob/main/src/services.py"

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_discord,node_bot,node_config,node_user toneBlue
class node_ask,node_chat,node_profile,node_larp,node_translate,node_ping toneAmber
class node_services toneMint
class node_anthropic,node_tavily toneRose
```

## Components

### Discord runtime

- **Discord platform**
- [Bot startup](https://github.com/adaamn/twelvecorp/blob/main/src/bot.py): `src/bot.py`
- [Bot configuration](https://github.com/adaamn/twelvecorp/blob/main/src/config.py): `src/config.py`

### Bot features

- [Ask command](https://github.com/adaamn/twelvecorp/blob/main/src/features/ai.py): `src/features/ai.py`
- [Mention chat](https://github.com/adaamn/twelvecorp/blob/main/src/features/chat.py): `src/features/chat.py`
- [Profile analysis](https://github.com/adaamn/twelvecorp/blob/main/src/features/profile.py): `src/features/profile.py`
- [Role-play](https://github.com/adaamn/twelvecorp/blob/main/src/features/larp.py): `src/features/larp.py`
- [Reaction translation](https://github.com/adaamn/twelvecorp/blob/main/src/features/translate.py): `src/features/translate.py`
- [Latency command](https://github.com/adaamn/twelvecorp/blob/main/src/features/ping.py): `src/features/ping.py`

### AI services

- [AI service layer](https://github.com/adaamn/twelvecorp/blob/main/src/services.py): `src/services.py`

### External services

- **Anthropic API**
- **Tavily search**

### Other components

- **Discord user**

## Connections

- Discord user → Discord platform: uses
- Discord platform → Bot startup: starts bot (evidence: `src/bot.py`)
- Bot startup → Ask command: loads extension (evidence: `src/bot.py`)
- Bot startup → Mention chat: loads extension (evidence: `src/bot.py`)
- Bot startup → Profile analysis: loads extension (evidence: `src/bot.py`)
- Bot startup → Role-play: loads extension (evidence: `src/bot.py`)
- Bot startup → Reaction translation: loads extension (evidence: `src/bot.py`)
- Bot startup → Latency command: loads extension (evidence: `src/bot.py`)
- Ask command → AI service layer: requests answer (evidence: `src/features/ai.py`)
- Mention chat → AI service layer: requests reply (evidence: `src/features/chat.py`)
- Profile analysis → AI service layer: requests analysis (evidence: `src/features/profile.py`)
- Role-play → AI service layer: requests role-play (evidence: `src/features/larp.py`)
- Reaction translation → AI service layer: requests translation (evidence: `src/features/translate.py`)
- AI service layer → Bot configuration: reads settings (evidence: `src/services.py`)
- Bot startup → Bot configuration: reads token (evidence: `src/bot.py`)
- AI service layer → Anthropic API: calls model (evidence: `src/services.py`)
- AI service layer → Tavily search: searches web (evidence: `src/services.py`)
- Ask command → Discord platform: sends answer (evidence: `src/features/ai.py`)
- Mention chat → Discord platform: reads history (evidence: `src/features/chat.py`)
- Mention chat → Discord platform: replies (evidence: `src/features/chat.py`)
- Profile analysis → Discord platform: reads history (evidence: `src/features/profile.py`)
- Profile analysis → Discord platform: sends analysis (evidence: `src/features/profile.py`)
- Role-play → Discord platform: sends response (evidence: `src/features/larp.py`)
- Reaction translation → Discord platform: fetches message (evidence: `src/features/translate.py`)
- Reaction translation → Discord platform: replies with embed (evidence: `src/features/translate.py`)
- Latency command → Discord platform: reports latency (evidence: `src/features/ping.py`)
