TTA.dev

TTA Architecture Overview

This document provides an overview of the Therapeutic Text Adventure (TTA) architecture.

System Architecture

The TTA project is built with a modular architecture that separates concerns and allows for easy extension. The main components are:

┌─────────────────────────────────────────────────────────────────┐
│                           TTA System                            │
└─────────────────────────────────────────────────────────────────┘
                                  │
                                  ▼
┌─────────────────────────────────────────────────────────────────┐
│                           Game Engine                           │
├─────────────┬─────────────┬─────────────┬─────────────┬─────────┤
│  Game Loop  │  Game State │  Commands   │    Input    │ Output  │
└─────────────┴─────────────┴─────────────┴─────────────┴─────────┘
                                  │
                 ┌────────────────┼────────────────┐
                 │                │                │
                 ▼                ▼                ▼
┌───────────────────┐  ┌───────────────────┐  ┌───────────────────┐
│   Agent System    │  │    Tool System    │  │  Knowledge Graph  │
├───────────────────┤  ├───────────────────┤  ├───────────────────┤
│  Input Processor  │  │    Look Tool      │  │     Locations     │
│ Narrative Generator│  │    Move Tool     │  │       Items       │
└───────────────────┘  │   Examine Tool    │  │     Characters    │
          │            │    Talk Tool      │  └───────────────────┘
          │            │  Inventory Tool   │            │
          │            └───────────────────┘            │
          │                      │                      │
          └──────────┬───────────┘                      │
                     │                                   │
                     ▼                                   ▼
┌───────────────────┐  ┌───────────────────┐  ┌───────────────────┐
│    Model System   │  │    MCP System    │  │      Neo4j        │
├───────────────────┤  ├───────────────────┤  ├───────────────────┤
│   Model Manager   │  │  Server Manager  │  │  Graph Database   │
│ Transformers API  │  │  Agent Adapters  │  │                   │
└───────────────────┘  └───────────────────┘  └───────────────────┘

Component Descriptions

Core Components

Game Engine

Agent System

Tool System

Knowledge Graph

Model System

MCP System

Data Flow

Standard Game Flow

  1. User enters a command in the game loop
  2. Input processor analyzes the command to determine intent
  3. Command processor executes the appropriate tool based on the intent
  4. Tools interact with the knowledge graph to retrieve or update data
  5. Narrative generator creates a response based on the tool result
  6. Game loop displays the response to the user

MCP Integration Flow

  1. AI assistant connects to MCP servers
  2. AI assistant calls MCP tools or accesses MCP resources
  3. MCP server routes requests to the appropriate agent or component
  4. Agent or component processes the request and returns a response
  5. MCP server returns the response to the AI assistant
  6. AI assistant uses the response to generate text for the user

Design Principles

The TTA architecture follows these key design principles:

  1. Separation of Concerns: Each component has a specific responsibility.
  2. Modularity: Components can be developed and tested independently.
  3. Extensibility: New agents, tools, and models can be added without changing existing code.
  4. Testability: Components are designed to be easily testable.
  5. Configurability: System behavior can be configured through environment variables.

Technology Stack