NeXify Cognitive Execution Layer (NCEL)
Relevant source files
The following files were used as context for generating this wiki page:
- services/api/agents/brain_agents/ai-engineer.md
- services/api/agents/brain_agents/documentation-expert.md
- services/api/agents/brain_agents/task-decomposition-expert.md
- services/api/agents/brain_agents/fullstack-developer.md
- services/api/agents/brain_agents/nextjs-architecture-expert.md
- services/api/agents/brain_agents/agent-expert.md
The NeXify Cognitive Execution Layer (NCEL) is an 8-layer architecture that governs the execution, lifecycle, and communication of autonomous AI agents within the NeXify platform. It ensures that every agent operates with consistent state management, brain-first decision-making, and robust error handling to serve specific customer outcomes.
NCEL provides a standardized pipeline for triggers, skill discovery, and memory persistence. By enforcing a uniform execution flow across specialized agents—such as the ai-engineer, fullstack-developer, and documentation-expert—the layer prevents amnesia and maintains mission alignment across the multi-tenant ecosystem.
Sources: services/api/agents/brain_agents/ai-engineer.md:83-85, services/api/agents/brain_agents/documentation-expert.md:66-68
Architecture Overview
NCEL is structured into eight distinct functional layers that every agent must respect during its execution cycle. This structure facilitates a "Brain-First" mandate, where agents query centralized knowledge before acting and write back findings to close the cognitive loop.
The diagram shows the sequential flow of the 8-layer NCEL architecture from initialization to memory persistence.
Sources: services/api/agents/brain_agents/ai-engineer.md:87-142
Layer 1: Trigger Layer
The agent boots via an init-agent message. It registers a heartbeat that pings the Orchestrator every 5 seconds to maintain active status. If the agent fails to respond to an execute trigger within 2000ms, the system uses a local snapshot cache as a fallback.
Sources: services/api/agents/brain_agents/ai-engineer.md:87-91
Layer 2: Intent & Context Analysis
The system parses an intent_payload in JSON format. It extracts key data points including the user_utterance, session_id, tenant_id, and priority level. The agent shares this parsed intent with the context-manager via the Model Context Protocol (MCP) to maintain session continuity.
Sources: services/api/agents/brain_agents/documentation-expert.md:76-80
Layer 3 & 4: Skill Management
Agents register their specific capabilities in the NCEL Skill Registry. If overlapping authority is detected between agents, the agent must flag a conflict and escalate to the project-supervisor-orchestrator.
Skill Registry Data Structure:
{
"agent_id": "documentation-expert",
"skills": [{"name": "openapi", "level": 5, "domains": ["expert-advisors"]}],
"dependencies": [],
"token_cost": 1500,
"execution_mode": "injectable"
}
Sources: services/api/agents/brain_agents/documentation-expert.md:82-96
Operational Protocols
Model Context Protocol (MCP) Routing
Layer 5 directs all external communications through standardized MCP endpoints. This ensures secure and traceable interactions with the Brain and external services.
| Endpoint | Purpose | Collection/Dimension |
|---|---|---|
qdrant.search | Brain queries | nexifyai_brain (4096-dim Cosine) |
context-manager.get_context | Session state | Tenant-isolated state |
brain.write | Memory persistence | Post-action write-back |
GitHub/Supabase | Domain calls | External integration |
Sources: services/api/agents/brain_agents/task-decomposition-expert.md:105-111
Execution Pipeline
Layer 6 defines a strict order of operations for task completion. Agents must not deviate from this sequence to ensure reliability:
- Brain Query: Consult Qdrant for lessons and credibility warnings.
- Context Injection: Apply session and tenant data.
- Domain Analysis: Process task-specific logic.
- Action Execution: Perform the primary task.
- Result Formatting: Prepare the structured JSON output.
- Metric Emission: Send performance data to the monitoring bus.
- Brain Write-Back: Persist findings to the Brain.
Sources: services/api/agents/brain_agents/nextjs-architecture-expert.md:113-118
Monitoring and Memory
Metrics Emission
Layer 7 emits real-time performance data to Prometheus and Grafana. The system alerts administrators if an agent's confidence score drops below 0.7 or error rates exceed 5% per cycle.
Tracked Metrics:
execution_latency_msbrain_hit_ratio(queries resolved from Brain vs. new)confidence_scoredelegation_count
Sources: services/api/agents/brain_agents/agent-expert.md:120-128
Brain Write-Back
Layer 8 closes the NCEL loop. Execution is considered incomplete until the Qdrant database acknowledges the write-back. This entry includes the agent_id, summary of actions, and a customer_outcome description to prevent system amnesia.
Sources: services/api/agents/brain_agents/fullstack-developer.md:130-139
The sequence diagram illustrates the mandatory write-back process required to complete an NCEL execution cycle.
Sources: services/api/agents/brain_agents/ai-engineer.md:130-139
Conclusion
The NCEL provides a rigid yet scalable framework for cognitive automation. By enforcing standardized layers for intent analysis, skill discovery, and memory persistence, NeXify ensures that its autonomous agents remain mission-aligned and data-driven across all customer environments.
Sources: services/api/agents/brain_agents/ai-engineer.md:13-17, services/api/agents/brain_agents/agent-expert.md:38-42