Unified CortexOS orchestrator connecting all modules for end-to-end intelligent agent workflows.
Central orchestrator that combines:
- Brain Core (planning & execution)
- Memory Core (short & long-term)
- Scheduler Core (task scheduling)
- Tool Registry (execution tools)
- All repositories (data persistence)
const result = await cortex.executeTask('Research AI trends', userId, {
priority: 'high',
useMemory: true, // Retrieve relevant context
storeMemory: true, // Store execution results
parentTaskId: 123 // Optional subtask
});Workflow:
- Retrieve relevant memories (short + long-term)
- Create task with context
- Schedule execution with priority
- Process task through brain
- Store results in memory
- Return task and steps
const { taskId, jobId } = await cortex.executeDelayedTask(
'Send reminder',
userId,
300000 // 5 minutes
);const { jobId, scheduleId } = await cortex.executeRecurringTask(
'daily-backup',
'Backup database',
userId,
'0 2 * * *' // 2 AM daily
);const memories = await cortex.searchMemory(userId, 'Python skills', {
shortTermCount: 5,
longTermCount: 10,
type: 'skill'
});const memoryId = await cortex.storeSkill(
userId,
'Python',
'Expert in Python programming and data science'
);const result = await cortex.executeTool(
'browser',
{ action: 'navigate', url: 'https://example.com' },
userId,
taskId
);const status = await cortex.getSystemStatus();
// {
// queue: { waiting: 5, active: 2, completed: 100, failed: 3, delayed: 1 },
// tasks: { pending: 10, executing: 2, completed: 50, failed: 1 },
// tools: 3,
// timestamp: '2024-01-01T00:00:00.000Z'
// }POST /api/cortex/execute- Execute task with full workflowPOST /api/cortex/execute-delayed- Schedule delayed taskPOST /api/cortex/execute-recurring- Schedule recurring taskGET /api/cortex/task/:taskId- Get task status with logs
POST /api/cortex/memory/search- Search memoriesPOST /api/cortex/skill- Store skill
POST /api/cortex/tool- Execute tool
GET /api/cortex/status- Get system statusPOST /api/cortex/shutdown- Graceful shutdown
- Automatically retrieves relevant memories
- Builds context from short and long-term memory
- Enhances task planning with historical data
- Stores execution results
- Builds knowledge base over time
- Improves future task execution
- 4-level priority system (low, normal, high, critical)
- Queue-based execution
- Fair scheduling
- All operations logged
- Task-level audit trail
- User-scoped tracking
- Memory optional (can disable)
- Fallback mechanisms
- Error handling at each layer
// 1. Execute task with memory
const result = await cortex.executeTask(
'Analyze competitor websites',
userId,
{ useMemory: true, storeMemory: true }
);
// 2. Task automatically:
// - Retrieves relevant past analyses
// - Creates execution plan
// - Schedules with priority
// - Executes using tools (browser)
// - Stores results in memory
// 3. Check status
const status = await cortex.getTaskStatus(result.task.id);
// 4. Search related memories
const memories = await cortex.searchMemory(
userId,
'competitor analysis'
);
// 5. Store learned skill
await cortex.storeSkill(
userId,
'Competitive Analysis',
'Ability to analyze competitor websites and extract insights'
);61 tests passing:
- Task execution workflows
- Memory integration
- Priority handling
- Delayed and recurring tasks
- Tool execution
- System status
- Error handling
Each component can be used independently or together
Queue-based execution supports high load
Easy to add new tools, memory types, or execution strategies
Comprehensive logging and status tracking
Permission-based execution, RLS policies, audit trails
- Concurrent task processing (5 workers)
- Memory retrieval optimized (configurable counts)
- Queue-based async execution
- Connection pooling (PostgreSQL, Redis)
Phase 6 - Connectors:
- WhatsApp integration
- Gmail integration
- Telegram integration
- Slack integration
- Custom webhook connectors
Phase 7 - Learning Engine:
- skill.md loader
- Validation system
- Self-improvement workflows
Phase 8 - UI Canvas:
- Dynamic canvas interface
- Real-time updates
- Agent-controlled UI