The Context Layer
Relevant source files
The following files were used as context for generating this wiki page:
The Context Layer serves as the persistent state management system within the Nexus Orchestrator. It is designed to bridge the infrastructure gap by providing AI agents with a consistent and autonomous way to manage environment-specific data, agent identities, and persistent configuration files.
As one of the four core pillars of the Nexus "nervous system," the Context Layer ensures that the state is maintained across asynchronous interactions between agents and their operating environments. This allows for a "local-first" approach where context files are managed autonomously by the orchestrator daemon.
Sources: README.md:1-15
Architectural Role and Functionality
The Context Layer operates as a persistent storage and retrieval mechanism for metadata and state information required by AI agents. Its primary responsibility is the management of state and the tracking of non-human identities interacting with the system.
Key Responsibilities
- Persistent State Management: Maintaining long-term data that survives across different sessions or agent executions.
- Agent Identity Tracking: Utilizing specialized files to record and validate agents known to the system.
- Infrastructure Context: Storing SSH connectivity details and environment-specific parameters needed for autonomous orchestration.
Sources: README.md:10-20, context/AGENTS.md:1-5
Data Structures and Management
The layer relies on specific schemas to define how information is structured. Central to this is the tracking of agents and their respective permissions within the orchestrator.
Known Agents Registry
The system tracks agents using a standardized registry format. This registry allows the orchestrator to identify the "who" in every interaction, which is critical for the Governance Layer's Zero Trust security model.
| Field | Description | Importance |
|---|---|---|
| Agent ID | Unique identifier for the AI agent | Primary key for identity lookups |
| Description | Human-readable purpose of the agent | Auditing and administrative clarity |
| Trust Level | The security clearance assigned to the agent | Used by OPA for access control |
Sources: context/AGENTS.md:5-10, README.md:15-18
Context Lifecycle Flow
The following diagram illustrates how the Context Layer interacts with agents and the broader orchestration system to maintain state.
This flow shows the Context Layer acting as the intermediary between the agent's request and the physical persistence of state on the local machine.
Sources: README.md:10-15, src/nexus/core.py
Integration with Core Pillars
The Context Layer does not operate in isolation; it is deeply integrated with the Connectivity, Orchestration, and Governance layers.
Context and Connectivity
The Context Layer stores the parameters required by the MCP-based protocol. This includes host details and SSH credentials that the Connectivity Layer uses to establish agent-to-infrastructure links.
Sources: README.md:13-14, src/context/manager.py
Context and Governance
Information retrieved from context/AGENTS.md is passed to the Open Policy Agent (OPA) engine within the Governance Layer. The trust levels defined in the context are evaluated against security policies to enforce Zero Trust principles for non-human identities.
The sequence above demonstrates how the Context Layer facilitates secure execution by providing the necessary identity metadata to the Governance Layer.
Sources: README.md:15-18, context/AGENTS.md:5-10, src/context/schema.py
Conclusion
The Context Layer is the memory of the Nexus Orchestrator. By managing AGENTS.md and persistent environment states, it provides the necessary foundation for autonomous agents to operate securely and efficiently across complex infrastructure environments without losing track of their identity or operational state.
Sources: README.md:1-18