- bot/Dockerfile: Add ffmpeg to reinstall line after apt-get autoremove (autoremove was sweeping up ffmpeg as 'no longer needed' after playwright install) - bot/utils/image_handling.py: Increase video analysis timeout 120s→300s, 6→3 for Tenor GIFs (GTX 1660 VRAM constraint) - bot/utils/activities.py: Add _activity_changed_at timestamp tracking, get_current_activity_label() and get_current_activity_fresh() with 30-min decay - bot/utils/cat_client.py: Pass current Discord activity to Cheshire Cat pipeline - bot/utils/llm.py: Inject current Discord activity into system prompt - cat-plugins/*: Forward Discord activity through working_memory to personality plugins - bot/persona/*/preamble.txt: Add Discord status usage guidelines for character prompts - llama-swap-rocm-config.yaml: Add qwen3.5 model entry for ComfyUI prompt generation - AGENTS.md: New project documentation file
4.1 KiB
4.1 KiB
AGENTS.md
Language & runtime
- Python 3.11 (main bot). There is no root
package.jsonor TypeScript — do not apply Node/TS tooling. uno-online/is a secondary Node.js project;miku-app/is Android/Kotlin. Both shelved features for now.
Commands
# Build and run all core services (bot, STT, llama-swap, Cheshire Cat, Qdrant)
docker compose up -d
# Run with face-detector (requires NVIDIA GPU)
docker compose --profile tools up -d
# Run only the bot (implies dependencies are already up)
docker compose up -d miku-bot
# View bot logs
docker compose logs -f miku-bot
# Rebuild bot after code changes
docker compose down miku-bot && docker compose build miku-bot && docker compose up -d miku-bot
Config
config.yaml: app settings (model names, URLs, ports, feature flags)..env: secrets only (DISCORD_BOT_TOKEN,OWNER_USER_ID,ERROR_WEBHOOK_URL).- Config is loaded by
bot/config.py(Pydantic) andbot/globals.py(bareos.getenv). Both sources matter — check both when tracing config usage. - Runtime config overrides are persisted to
bot/memory/config_runtime.yamlvia the API.
Architecture
Discord <-> bot/bot.py (discord.py)
├── on_message -> Cheshire Cat pipeline -> memory-augmented LLM response
├── utils/llm.py -> llama-swap (HTTP proxy) -> llama.cpp (NVIDIA or AMD GPU)
├── utils/voice_manager.py -> STT WebSocket (port 8766) and audio playback
├── FastAPI (port 3939, daemon thread) -> 22 route modules in bot/routes/
├── APScheduler (background tasks in globals.py)
└── utils/autonomous_engine.py -> proactive message decisions (Autonomous V2)
- The FastAPI server runs in a daemon thread inside the Discord bot process — no separate process.
bot/globals.pyholds mutable global state (scheduler, env vars,discord.Client). Module-level mutations are pervasive; be careful with import order.- llama-swap is a llama.cpp HTTP proxy with TTL-based model swapping. Two configs:
llama-swap-config.yaml(NVIDIA) andllama-swap-rocm-config.yaml(AMD).
Models (via llama-swap)
| Model key | Purpose |
|---|---|
llama3.1 |
Primary text model |
darkidol |
Uncensored model (evil mode) |
vision |
MiniCPM-V (image understanding) |
swallow |
Japanese text model |
rocinante |
12B model (AMD GPU only) |
qwen3.5 |
ComfyUI prompt generation (AMD GPU only) |
Testing & linting
- No formal test framework and no linting/formatting config. Ad-hoc scripts live in
tests/andbot/tests/. - Run ad-hoc tests however you want; there is no standard command.
Web UI color scheme (bot/static/)
- Base:
#121212body,#000log panel,#1e1e1ecode blocks,#2a2a2acards - Text:
#fffprimary,#ccclabels,#888muted,#0f0log info - Primary accent:
#61dafb(headings, links, assistant messages, active elements) - Success:
#4CAF50(active tabs, user messages, enabled toggles) - Error:
#f44336(chat errors),#ff6b6b(error logs) - Warning:
#ffd93d(warning logs) - Bot message:
#2196F3(left border) - Danger/evil:
#ff4444(overrides all accents whenbody.evil-modeis set) - Bipolar:
#9932CC(toggle active) - Blocked:
#ff9800(blocked user cards) - Evil mode toggles
body.evil-modeclass which replaces all#61dafband#4CAF50with#ff4444.
Key gotchas
bot/memory/contains persisted JSON state files and is gitignored. Do not expect these to exist in a fresh clone..envis gitignored; copy.env.exampleto.envand fill in real tokens.- Changes to
bot/moods/orbot/persona/text files take effect at runtime (loaded on demand), no rebuild needed. - Playwright browsers must be installed in the Docker image (
bot/Dockerfiledoes this viasetup_uno_playwright.sh). - Voice features require
discord-ext-voice-recvandPyNaCl— if voice fails, check these are installed. - The
miku-voiceDocker network is declared as external — it must exist beforedocker compose up.