Cortex
Overview
Section titled “Overview”Cortex — the Nexus router and orchestrator. Receives user input, classifies intent via semantic signals, routes to the appropriate cognitive module, enforces trust/permissions through Aegis, logs to Chronicle, and stores interactions in Engram.
- Version:
0.1.0 - Class:
Cortex
ScoredIntent
Section titled “ScoredIntent”| Field | Type | Default |
|---|---|---|
name | str | — |
module | str | — |
score | float | — |
signals | list[str] | field(default_factory=list) |
Intent
Section titled “Intent”| Field | Type | Default |
|---|---|---|
name | str | — |
module | str | — |
description | str | — |
patterns | list[re.Pattern] | — |
semantic_signals | list[str] | — |
set_workspace_config(self, config: 'WorkspaceConfig | None') -> None
Section titled “set_workspace_config(self, config: 'WorkspaceConfig | None') -> None”Load (or clear) routing pins from the active workspace config.
Called by the workspace switcher when a workspace is activated or
deactivated. Passing None clears all pins.
The pins are consulted in :meth:_select_module before the
semantic scoring engine, so a pin bypasses Cortex’s intent
classifier for the specified intents / categories.
set_llm(self, llm_fn) -> None
Section titled “set_llm(self, llm_fn) -> None”Set the LLM inference function used by modules and fallback classification.
register_module(self, module: NexusModule) -> None
Section titled “register_module(self, module: NexusModule) -> None”register_builtin_manifests(self) -> None
Section titled “register_builtin_manifests(self) -> None”Register every built-in module’s manifest with Aegis.
Called once at kernel boot. Idempotent — registering the same manifest twice overwrites the dict entry but does not duplicate any DB rows (Aegis seeds trust only if the row is at 0.0).
async unregister_module(self, name: str) -> None
Section titled “async unregister_module(self, name: str) -> None”list_modules(self) -> list[str]
Section titled “list_modules(self) -> list[str]”get_module(self, name: str) -> NexusModule | None
Section titled “get_module(self, name: str) -> NexusModule | None”Public module lookup (used by Sigil to read Sentry state).
async initialize_modules(self) -> None
Section titled “async initialize_modules(self) -> None”Call on_load for all registered modules with kernel context.
attach_emergency_bypass(self) -> None
Section titled “attach_emergency_bypass(self) -> None”Give EMERGENCY-priority Pulse messages a routing bypass.
Emergency broadcasts (Sigil detections) skip intent classification and the trust floor entirely: they are logged to Chronicle and, when the payload requests it and the kill switch allows, dispatched straight to Specter for an adversarial read. Idempotent.
async process(self, message: str) -> str
Section titled “async process(self, message: str) -> str”Route a user message to the appropriate module and return the response.