Stargazer v3 — Technical Documentation

Python 3.12

Architectural Overview

Stargazer v3 is a multi-platform conversational AI bot that bridges Discord and Matrix with a shared LLM inference pipeline, extensible tool-calling framework, and a neurochemical simulation engine for affective computing.

System Architecture

The system is organized into the following layers:

Entry Point & Lifecyclemain boots the BotRunner, which manages multi-platform adapter lifecycles, message routing, and the web management GUI.

Platform Adapters — The platforms package provides a PlatformAdapter interface implemented by platforms.discord and platforms.matrix. Adapters normalize incoming messages into IncomingMessage objects and expose a uniform reply API.

Message Processing Pipelinemessage_processor is the core orchestrator. For each incoming message it:

  1. Preprocesses (URL extraction, attachment handling, multimodal parts)

  2. Resolves conversation history via conversation and message_cache

  3. Classifies and selects relevant tools via classifiers.vector_classifier

  4. Gathers RAG context from rag_system

  5. Builds the LLM prompt with prompt_context and prompt_renderer

  6. Calls the LLM via openrouter_client

  7. Postprocesses the response with response_postprocessor

Tool Frameworktools provides the ToolRegistry decorator system. Each tool file in the tools/ directory is auto-loaded by tool_loader. Tools are async callables that receive optional ToolContext for bot-internal access. The classifiers.vector_classifier selects tools per-message via semantic embedding similarity.

Neurochemical Model (NCM) — An affective computing layer that simulates neurochemical states:

Knowledge & Memory — Long-term memory and knowledge management:

Background Processing — Async agents in background_agents:

Configurationconfig loads config.yaml with environment variable overrides, supporting per-platform settings.

API Reference

Indices and tables