astrid-daemon
The background kernel process for the Astrid OS.
In the OS model, this is the kernel running as a daemon. It boots the kernel, loads capsules via auto-discovery, binds a Unix domain socket, and serves IPC requests from frontends (CLI, Discord, web, etc.). All state — sessions, capabilities, audit logs, VFS — lives here.
How it runs
The daemon is typically spawned automatically by the CLI (astrid chat or astrid start). It can also be started directly for headless or multi-frontend deployments.
Spawned by CLI (typical)
# Ephemeral — auto-shuts down on idle after last client disconnects
# Persistent — stays running after CLI disconnects
Started directly
# Persistent mode (default)
# Ephemeral mode
# With verbose logging
Flags
| Flag | Default | Description |
|---|---|---|
-s, --session <UUID> |
00000000-... (system) |
Session ID to bind the daemon to |
-w, --workspace <PATH> |
Current directory | Workspace root directory |
--ephemeral |
false |
Auto-shutdown on idle after last client disconnects |
-v, --verbose |
false |
Enable debug-level logging |
Lifecycle
- Resolves
~/.astrid/home directory, initializes logging to~/.astrid/log/. - Boots the kernel: event bus, KV store, capability store, audit log, VFS, MCP servers.
- Binds Unix socket at
~/.astrid/run/system.sock, generates session token at~/.astrid/run/system.token. - Loads all capsules from
~/.astrid/home/{principal}/.local/capsules/and.astrid/capsules/(workspace). - Verifies
astrid-capsule-cliproxy is loaded (required for socket accept loop). - Writes readiness sentinel at
~/.astrid/run/system.ready— CLI polls for this. - Waits for SIGTERM/SIGINT, then shuts down gracefully (drains capsules, cleans up socket/token/readiness files).
Management API
Frontends send KernelRequest messages over the socket to manage the daemon:
| Request | Description |
|---|---|
GetStatus |
Returns PID, uptime, connected clients, loaded capsules |
Shutdown { reason } |
Graceful shutdown |
ListCapsules |
List loaded capsule names |
ReloadCapsules |
Hot-reload capsules from disk |
GetCommands |
List registered slash commands |
GetCapsuleMetadata |
Capsule manifests, providers, interceptors |
Development
License
Dual MIT/Apache-2.0. See LICENSE-MIT and LICENSE-APACHE.