Skip to content

Modules & Agents

NEXUS has two kinds of intelligence: 26 modules (persistent intelligence components) and 25 agents (task specialists with graduated sovereignty). Both share a common base. Every module is a subclass of NexusModule. The interface is minimal by design.

from nexus.module import NexusModule
class MyModule(NexusModule):
name = "my_module"
description = "One sentence describing what this module does."
version = "1.0.0"
async def handle(self, message: str, context: dict) -> str:
return f"Echo: {message}"

Three class attributes are required, one is optional:

AttributeTypeDescription
namestrUnique identifier used for routing, trust tracking, and audit logs
descriptionstrHuman-readable description shown in nexus status
versionstrSemantic version string
requires_networkboolDefault False. Set True for modules that connect to external endpoints. Aegis enforces a separate --network consent gate for these modules, and Chronicle logs every outbound data event.

Modules can optionally implement two lifecycle methods:

async def on_load(self, context: dict) -> None:
"""Called once when the module is enabled. Set up subscriptions here."""
await context["pulse"].subscribe("file.*", self._on_file_event)
async def on_unload(self, context: dict) -> None:
"""Called when the module is disabled via `nexus deny`. Clean up here."""
await context["pulse"].unsubscribe("file.*", self._on_file_event)

on_load and on_unload are not abstract: they default to no-ops. Only implement them if the module needs setup or teardown.

Every call to handle(), on_load(), and on_unload() receives a context dictionary with references to all kernel components:

KeyTypeDescription
context["llm"]LLMClientHTTP client for the configured llama.cpp server
context["engram"]EngramThree-tier memory store (working, episodic, semantic)
context["chronicle"]ChronicleAppend-only audit log, queryable
context["pulse"]PulseAsync pub/sub event bus

Modules access kernel services only through this context. They do not import kernel classes directly. This keeps modules testable in isolation, pass a mock context and the module has no external dependencies.

Six modules subscribe to cortex.response Pulse events in their on_load() hook to automatically collect data from the conversation flow:

ModuleWhat It CollectsSource
PrismCross-domain observationsEvery module response, tagged by module name
SerendipityFocus areas + knowledge entriesUser messages and module responses
CipherSource profiles + claimsModule outputs with auto-assigned trust scores
AtlasTemporal factsExtracts subject from user query, stores response as fact
WeaveContact mentions + interactionsProper nouns detected in user messages
LegacyDecision recordsResponses from Council, Ethical Prism, and Autonomic

These modules require no manual data entry. They build their internal stores passively from system activity, becoming more useful the longer NEXUS runs.

The 25 agents extend NexusModule through AgentModule, which adds graduated sovereignty. Agents start as passive skills and earn autonomy through demonstrated reliability.

from nexus.agents.base import AgentModule, TrustTier
class MyAgent(AgentModule):
name = "my_agent"
description = "What this agent does."
version = "1.0.0"
watch_events = ["relevant.event"] # Pulse topics at MONITOR+
coordination_targets = ["other_agent"] # Agents to coordinate with at SOVEREIGN
async def analyze(self, message: str, context: dict) -> str:
"""Core logic. Runs at every trust level."""
return f"Analysis: {message}"
async def suggest(self, message: str, context: dict) -> str:
"""Proactive suggestions. ADVISOR+ trust."""
return "You might also want to check..."
async def monitor(self, event: dict, context: dict) -> str | None:
"""Background event watching. MONITOR+ trust."""
return "Detected anomaly in event stream"
async def coordinate(self, analysis_result: str, context: dict) -> str:
"""Cross-agent routing. SOVEREIGN trust only."""
cortex = context.get("cortex")
return await cortex.route("other_agent", analysis_result, context)
TierScoreBehavior
SKILL0-24User invokes explicitly. No initiative.
ADVISOR25-49Suggests actions when relevant context detected.
MONITOR50-74Proactively watches Pulse events and reports findings.
AUTONOMOUS75-99Acts within defined boundaries without asking.
SOVEREIGN100Coordinates with other agents independently.

Trust is tracked by Aegis and can be revoked at any time. The AgentModule.handle() method routes through these tiers automatically, agents only implement the tier-specific methods they support.

The 51 components are grouped by functional tier. Modules use NexusModule, agents use AgentModule.

TierComponentsInterface
PerceptionOracle, SentryNexusModule
IntelligenceAtlas, Prism, CipherNexusModule
ActionWraith, Echo, Sigil, Herald, WeaveNexusModule
AdvancedSpecter, Serendipity, ForgeNexusModule
OrchestrationCouncil, AutonomicNexusModule
NetworkCollective, LegacyNexusModule
DifferentiationDream Loop, Adversarial, Tripwire, Provenance, Sandbox, Symbiosis, Consciousness, Ethical PrismNexusModule
Agents (Code)Vex, Arbiter, Carve, Remedy, Scaffold, Axiom, RuneAgentModule
Agents (Data)Flux, Vigil, Gauge, Quarry, LoomAgentModule
Agents (Business)Ledger, Tally, Mint, Redline, MandateAgentModule
Agents (Content)Scribe, Kindle, Thesis, CompassAgentModule
Agents (Ops)Bastion, Dispatch, Sentinel, MnemonicAgentModule
CommunityUser-contributedNexusModule
CoreGeneralNexusModule

A complete, functional module with LLM usage, memory storage, and Pulse event emission:

from nexus.module import NexusModule
class SummaryModule(NexusModule):
name = "summary"
description = "Summarizes text using the local LLM and stores it in episodic memory."
version = "1.0.0"
async def handle(self, message: str, context: dict) -> str:
# Call the LLM
prompt = f"Summarize the following in two sentences:\n\n{message}"
summary = await context["llm"].complete(prompt)
# Store in episodic memory for later retrieval
await context["engram"].store_episodic(
source=self.name,
content=summary,
tags=["summary"],
)
# Notify other modules
await context["pulse"].publish("summary.created", {"text": summary})
return summary

To register routing keywords so Cortex dispatches messages to this module, add an entry to Cortex._MODULE_KEYWORDS:

_MODULE_KEYWORDS = {
...
"summary": ["summarize", "tldr", "brief", "overview"],
}

See Building a Module for the full step-by-step guide including tests.