Assistant Framework
The Assistant Framework is the most complex part of the dLANDiscord backend, providing the intelligence and autonomy for all agent-based operations.
🧠 Core Methodology: ReAct & Planning
The framework implements a ReAct (Reason + Act) loop within a larger Adaptive Planning cycle.
- Thinking: The agent analyzes the task and its current context.
- Action: The agent decides to call a tool or delegate to another agent.
- Observation: The result of the action is fed back into the agent's context.
- Planning: The
AdaptivePlannerevaluates if the current plan needs to be modified based on the observation (e.g., if a tool failed, it might replan with a different approach).
🗂️ Strategic Components
1. Adaptive Planner (adaptive_planner.go, planner.go)
Responsible for task decomposition. It breaks a high-level request (e.g., "Check all servers for security issues") into a tree of sub-tasks. It handles:
- Fact Retention: Storing knowledge discovered during a session.
- Hierarchical Delegation: Managing parent-child relationships between agents.
- Dynamic Replanning: Using an LLM to recover from errors by adjusting the plan tree in real-time.
2. Zombie Contexts & Persistence
Asynchronous operations (like long-running background tasks) are handled via Zombie Contexts.
ZombieParentRegistry: Ensures that even if a parent session is cleaned up or the system restarts, the results of an async task can still be delivered to the correct user.- Race-Safe Delegation: Parent metadata is cloned before spawning background goroutines.
- TTL & Cleanup: Stale async agents are cleaned up daily at 3:00 AM.
3. Mission Control (missioncontrol.go)
A centralized hub for real-time observation and administrative control. It provides:
- SSE Neural Link: Live streaming of agent "thoughts" and tool execution.
- Approval Pipeline: Manages tools and skills created by MrTool that require admin verification before going live.
- Session Debugging: Fallback mechanisms (like reading JSONL logs directly) when the observability database is corrupted.
4. Heartbeat Loops (heartbeat.go)
These are proactive background routines that trigger specific agents for system maintenance:
- Nikki Heartbeat: Regular check-ins for task board management.
- Lenore Heartbeat: Infrastructure auditing and health checks.
- CEO Heartbeat: Strategic oversight of all active projects.
🛠️ Tool System (mrtool.go)
The framework can execute over 100 different tools, ranging from system commands to API integrations.
- Go Tools: Native Go functions.
- Shell Tools: Bash/PowerShell scripts defined in
.mdfiles inassistant/prompts/tools/. - Worker Node Swarms: See AntFarm Swarm.
For detailed package documentation, see Assistant Core.