Skip to content

[CORE] Build cortexd system daemon (C++ native with llama.cpp) #427

@mikejmorgan-ai

Description

@mikejmorgan-ai

Problem

Cortex currently runs as a CLI tool invoked per-command. No persistent system presence or proactive capabilities.

Solution

Create cortexd - a native C++ daemon that:

  • Runs as systemd service on boot
  • Embeds llama.cpp for local inference (no Ollama dependency)
  • Monitors system state continuously
  • Exposes Unix socket for cortex CLI
  • Provides proactive security alerts and suggestions

Architecture

┌─────────────────────────────────────────┐
│              cortex CLI                  │
│           (Python, user-facing)          │
└─────────────────┬───────────────────────┘
                  │ Unix Socket
                  ▼
┌─────────────────────────────────────────┐
│              cortexd                     │
│         (C++ daemon, systemd)            │
│  ┌─────────────────────────────────┐    │
│  │  llama.cpp (embedded inference) │    │
│  └─────────────────────────────────┘    │
│  ┌─────────────────────────────────┐    │
│  │  System Monitor (apt, dpkg, CVE)│    │
│  └─────────────────────────────────┘    │
└─────────────────────────────────────────┘

Technical Requirements

  • Single static binary preferred
  • Must start in < 1 second
  • Memory footprint < 50MB idle (< 150MB with model)
  • Logging to journald
  • Graceful shutdown handling
  • Consider sd-bus for D-Bus integration

Acceptance Criteria

  • C++ daemon compiles on Ubuntu 22.04/24.04
  • systemd service unit (cortexd.service)
  • Unix socket API (/run/cortex.sock)
  • Embedded llama.cpp inference working
  • Basic system monitoring (disk, memory, apt state)
  • CLI can communicate with daemon
  • Documentation for building and installing

Dependencies

Bounty: $200 (+ $200 bonus after funding)

Paid on merge to main.

This is a critical path item for the 'AI operating system' vision.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions