Overview

Last updated: May 9, 2026

Assistant Module Overview

The assistant module is the core intelligence layer of dLANDiscord. It provides a multi-agent framework capable of reasoning, tool execution, and long-term memory management.

Architectural Summary

The module is built as a distributed agentic system where a central orchestrator (the Planner) coordinates specialized agents to fulfill user requests. It supports multiple ingress points (Discord, WhatsApp, IRC, Telegram, Web) and a wide array of tools.

Core Components

  • Planner & Adaptive Planner: The reasoning engine that decomposes tasks into steps.
  • Agent Registry: A collection of predefined personas (Nikki, Sasha, Sysadmin, etc.) with specific goals and tool sets.
  • Tool System: A dynamic framework for extending agent capabilities via shell scripts and Markdown definitions.
  • Memory & Context: A 4-tier memory hierarchy (Short-term, Project, User, System) ensuring persistent state.
  • Multi-LLM Provider: An abstraction layer supporting Ollama, Anthropic, Gemini, OpenAI, Grok, DeepSeek, and more.

Key Files & Entry Points

File Purpose
assistant/assistant.go Central entry point, RBAC, and session management.
assistant/planner.go Core ReAct loop and task planning.
assistant/adaptive_planner.go Advanced multi-step reasoning and error recovery.
assistant/webserver.go HTTP API and dashboard backend.
assistant/multillm.go LLM client abstraction and registry.

Major Relationships

graph TD
    User([User]) --> Ingress[Ingress: Discord/WhatsApp/Web]
    Ingress --> Assistant[assistant/assistant.go]
    Assistant --> Session[ChatSession]
    Session --> Planner[assistant/planner.go]
    Planner --> LLM[assistant/multillm.go]
    Planner --> Tools[assistant/ant_tools.go / prompts/tools/]
    Planner --> Memory[assistant/project_context.go]
    
    subgraph "Specialized Swarms"
        Planner --> AntFarm[assistant/antfarm.go]
        Planner --> BusinessHive[assistant/business.go]
    end

Call Chain Example: Query Processing

  1. Ingress: dwhatsapp/dwhatsapp.go calls assistant.QueryAssistantWithOptions.
  2. Session Creation: assistant.go creates a ChatSession, filtering tools by the user's role.
  3. Planning: planner.go initiates a ReAct loop. It sends the prompt to the configured LLM via multillm.go.
  4. Tool Execution: If the LLM requests a tool, planner.go executes the corresponding script and feeds the result back to the LLM.
  5. Final Response: Once the task is complete, the final answer is returned to the ingress point.

Proactive Agents (Pulse & Trigger)

The assistant operates autonomously through two proactive mechanisms:

Heartbeats (Time-Based)

  • 18 heartbeat loops wake specific agents at intervals to check for pending work
  • Examples: Nikki work loop (4h), ProjectManager (4h), Architect audits (4h/8h), RoboCop CCTV polling (2m)
  • See: Heartbeat & Triggers

Wakeups (Event-Based)

  • Unified Event Router (port 7142) responds to external triggers in near real-time
  • Sources: UniFi presence, YouTube PubSub, Home Assistant, Vonage SMS, WHMCS tickets, CCTV events, generic API
  • External systems can trigger any agent via /api/wakeup POST endpoint

Extension Points for AI Agents

  • Adding Tools: Create a new .md and .sh pair in prompts/tools/shared/ or an agent-specific folder.
  • Adding Personas: Define a new agent in prompts/agent/.
  • Adding Skills: Add a JSON manifest to prompts/agent/subagents/skills/.
  • External Import: Skills can be imported from OpenClaw/ClawHub/GitHub and converted to internal format

Cross-References