# kyaguya/project-akira architecture

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

- Interactive diagram: https://gitdiagram.com/kyaguya/project-akira
- Repository: https://github.com/kyaguya/project-akira

## Overview

Project Akira is a modular Discord bot for campus task management, CTF monitoring and coordination, and AI-assisted queries, with a separate read-only dashboard API. Discord users invoke commands or post campus announcements; the bot’s cogs handle interactions, services apply domain logic, and SQLite stores operational state. CTF Radar also fetches public event data and supports war rooms; the API exposes protected summaries. README capabilities are included, but unsampled cog internals and wiring are not inferred beyond documented or indexed references.

Main entry points: [`services/ctf_service.py`](https://github.com/kyaguya/project-akira/blob/main/services/ctf_service.py) (CTF coordination), [`cogs/ai_companion.py`](https://github.com/kyaguya/project-akira/blob/main/cogs/ai_companion.py) (AI companion), [`bot.py`](https://github.com/kyaguya/project-akira/blob/main/bot.py) (Bot lifecycle), [`cogs/campus.py`](https://github.com/kyaguya/project-akira/blob/main/cogs/campus.py) (Campus commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Bot lifecycle<br/>[bot.py]"]
  node_admin["Admin commands<br/>[admin.py]"]
  node_persona["Persona status<br/>[persona_status.py]"]
  node_api["Dashboard API<br/>[server.py]"]
end

subgraph group_campus["Campus workflow"]
  node_campus_cog["Campus commands<br/>[campus.py]"]
  node_campus_service["Campus tasks<br/>[campus_service.py]"]
  node_gemini["Gemini helper<br/>[gemini_helper.py]"]
  node_ai_cog["AI companion<br/>[ai_companion.py]"]
end

subgraph group_ctf["CTF radar"]
  node_ctf_cog["CTF commands<br/>[ctf.py]"]
  node_ctf_service["CTF coordination<br/>[ctf_service.py]"]
  node_ctftime["CTFtime scraper<br/>[ctftime_scraper.py]"]
end

subgraph group_platform["Data and integrations"]
  node_security["Input and URL safety<br/>[security.py]"]
  node_job_scraper["Job scraper<br/>[job_scraper.py]"]
  node_health["Scraper health<br/>[health.py]"]
  node_database[("SQLite state<br/>[db.py]")]
end

node_discord_users(("Discord users"))
node_api_clients(("Dashboard clients"))
node_ctftime_service["CTFtime"]
node_ai_provider["AI provider"]

node_discord_users -->|"use commands"| node_bot
node_bot -->|"opens state"| node_database
node_bot -->|"creates tracker"| node_health
node_bot -->|"starts server"| node_api
node_discord_users -->|"manage tasks"| node_campus_cog
node_campus_cog -->|"manage task data"| node_campus_service
node_campus_cog -->|"sanitize input"| node_security
node_campus_cog -->|"generate text"| node_gemini
node_ai_cog -->|"harden input"| node_security
node_ai_cog -->|"read task data"| node_campus_service
node_ai_cog -->|"read CTF data"| node_ctf_service
node_ai_cog -.->|"query AI"| node_ai_provider
node_campus_service -->|"read and write"| node_database
node_discord_users -->|"monitor events"| node_ctf_cog
node_ctf_cog -->|"coordinate events"| node_ctf_service
node_ctf_cog -->|"fetch events"| node_ctftime
node_ctf_service -->|"fetch and filter"| node_ctftime
node_ctf_service -->|"read and write"| node_database
node_ctftime -->|"fetch events"| node_ctftime_service
node_ctftime -->|"report health"| node_health
node_job_scraper -.->|"report health"| node_health
node_health -->|"record status"| node_database
node_api_clients -->|"request dashboard"| node_api
node_api -->|"read task summaries"| node_campus_service
node_api -->|"read CTF summaries"| node_ctf_service
node_discord_users -.->|"administer bot"| node_admin
node_discord_users -.->|"check persona"| node_persona

click node_bot "https://github.com/kyaguya/project-akira/blob/main/bot.py"
click node_admin "https://github.com/kyaguya/project-akira/blob/main/cogs/admin.py"
click node_persona "https://github.com/kyaguya/project-akira/blob/main/cogs/persona_status.py"
click node_campus_cog "https://github.com/kyaguya/project-akira/blob/main/cogs/campus.py"
click node_campus_service "https://github.com/kyaguya/project-akira/blob/main/services/campus_service.py"
click node_gemini "https://github.com/kyaguya/project-akira/blob/main/modules/ai/gemini_helper.py"
click node_ai_cog "https://github.com/kyaguya/project-akira/blob/main/cogs/ai_companion.py"
click node_security "https://github.com/kyaguya/project-akira/blob/main/modules/security.py"
click node_ctf_cog "https://github.com/kyaguya/project-akira/blob/main/cogs/ctf.py"
click node_ctf_service "https://github.com/kyaguya/project-akira/blob/main/services/ctf_service.py"
click node_ctftime "https://github.com/kyaguya/project-akira/blob/main/scrapers/ctftime_scraper.py"
click node_job_scraper "https://github.com/kyaguya/project-akira/blob/main/scrapers/job_scraper.py"
click node_health "https://github.com/kyaguya/project-akira/blob/main/scrapers/health.py"
click node_database "https://github.com/kyaguya/project-akira/blob/main/database/db.py"
click node_api "https://github.com/kyaguya/project-akira/blob/main/api/server.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_bot,node_admin,node_persona,node_api,node_discord_users,node_api_clients toneBlue
class node_campus_cog,node_campus_service,node_gemini,node_ai_cog toneAmber
class node_ctf_cog,node_ctf_service,node_ctftime toneMint
class node_security,node_job_scraper,node_health,node_database toneRose
class node_ctftime_service,node_ai_provider toneIndigo
```

## Components

### Bot runtime

- [Bot lifecycle](https://github.com/kyaguya/project-akira/blob/main/bot.py): `bot.py`
- [Admin commands](https://github.com/kyaguya/project-akira/blob/main/cogs/admin.py): `cogs/admin.py`
- [Persona status](https://github.com/kyaguya/project-akira/blob/main/cogs/persona_status.py): `cogs/persona_status.py`
- [Dashboard API](https://github.com/kyaguya/project-akira/blob/main/api/server.py): `api/server.py`

### Campus workflow

- [Campus commands](https://github.com/kyaguya/project-akira/blob/main/cogs/campus.py): `cogs/campus.py`
- [Campus tasks](https://github.com/kyaguya/project-akira/blob/main/services/campus_service.py): `services/campus_service.py`
- [Gemini helper](https://github.com/kyaguya/project-akira/blob/main/modules/ai/gemini_helper.py): `modules/ai/gemini_helper.py`
- [AI companion](https://github.com/kyaguya/project-akira/blob/main/cogs/ai_companion.py): `cogs/ai_companion.py`

### CTF radar

- [CTF commands](https://github.com/kyaguya/project-akira/blob/main/cogs/ctf.py): `cogs/ctf.py`
- [CTF coordination](https://github.com/kyaguya/project-akira/blob/main/services/ctf_service.py): `services/ctf_service.py`
- [CTFtime scraper](https://github.com/kyaguya/project-akira/blob/main/scrapers/ctftime_scraper.py): `scrapers/ctftime_scraper.py`

### Data and integrations

- [Input and URL safety](https://github.com/kyaguya/project-akira/blob/main/modules/security.py): `modules/security.py`
- [Job scraper](https://github.com/kyaguya/project-akira/blob/main/scrapers/job_scraper.py): `scrapers/job_scraper.py`
- [Scraper health](https://github.com/kyaguya/project-akira/blob/main/scrapers/health.py): `scrapers/health.py`
- [SQLite state](https://github.com/kyaguya/project-akira/blob/main/database/db.py): `database/db.py`

### Other components

- **Discord users**
- **Dashboard clients**
- **CTFtime**
- **AI provider**

## Connections

- Discord users → Bot lifecycle: use commands (evidence: `README.md`)
- Bot lifecycle → SQLite state: opens state (evidence: `bot.py`)
- Bot lifecycle → Scraper health: creates tracker (evidence: `bot.py`)
- Bot lifecycle → Dashboard API: starts server (evidence: `bot.py`)
- Discord users → Campus commands: manage tasks (evidence: `README.md`)
- Campus commands → Campus tasks: manage task data (evidence: `cogs/campus.py`)
- Campus commands → Input and URL safety: sanitize input (evidence: `cogs/campus.py`)
- Campus commands → Gemini helper: generate text (evidence: `cogs/campus.py`)
- AI companion → Input and URL safety: harden input (evidence: `cogs/ai_companion.py`)
- AI companion → Campus tasks: read task data (evidence: `cogs/ai_companion.py`)
- AI companion → CTF coordination: read CTF data (evidence: `cogs/ai_companion.py`)
- AI companion → AI provider: query AI (evidence: `README.md`)
- Campus tasks → SQLite state: read and write (evidence: `services/campus_service.py`)
- Discord users → CTF commands: monitor events (evidence: `README.md`)
- CTF commands → CTF coordination: coordinate events (evidence: `cogs/ctf.py`)
- CTF commands → CTFtime scraper: fetch events (evidence: `cogs/ctf.py`)
- CTF coordination → CTFtime scraper: fetch and filter (evidence: `services/ctf_service.py`)
- CTF coordination → SQLite state: read and write (evidence: `services/ctf_service.py`)
- CTFtime scraper → CTFtime: fetch events (evidence: `scrapers/ctftime_scraper.py`)
- CTFtime scraper → Scraper health: report health (evidence: `scrapers/ctftime_scraper.py`)
- Job scraper → Scraper health: report health (evidence: `scrapers/job_scraper.py`)
- Scraper health → SQLite state: record status (evidence: `scrapers/health.py`)
- Dashboard clients → Dashboard API: request dashboard (evidence: `README.md`)
- Dashboard API → Campus tasks: read task summaries (evidence: `api/server.py`)
- Dashboard API → CTF coordination: read CTF summaries (evidence: `api/server.py`)
- Discord users → Admin commands: administer bot (evidence: `README.md`)
- Discord users → Persona status: check persona (evidence: `README.md`)
