Problem: A character with a consistent personality, usable memory, and natural conversation is an architecture problem before it is a prompt problem. Most implementations weld personality, memory, and transport together, so nothing can be replaced without touching everything else.
Approach: We designed a hexagonal-architecture bot with strict module boundaries: personality definition, memory, conversation handling, and API integration are separate. No module is longer than 200 lines, which keeps it readable and testable.
Technical details:
- Hexagonal architecture with explicit ports and adapters
- Agentic memory with recall, storage, and context management
- Personalisation inferred from conversation history
- OpenAI Responses API (GPT-5.4, 1M token context)
- Personality definitions swapped at runtime
- Conversation state persisted in Redis
- FastAPI server with WebSocket streaming
- 293 lines of architecture documentation
Outcome: Several personalities run on one core. Adding one means writing a module, not editing the system. A restart does not lose the conversation.
Stack: Python, FastAPI, Redis, OpenAI API, WebSocket, Hexagonal Architecture
Sandboxed plugin ran for projects/character-ai-bot and read “Character AI Bot” through the mediated API.