Expand description
Nika native daemon — background services for secrets, jobs, watch, and cache.
The daemon is Nika’s optional background brain. nika run works without it,
but the daemon adds persistent features: keychain secrets, job scheduling,
file watching, and LLM response caching.
§Architecture
- Single binary:
nika daemon startuses the same binary - Unix socket IPC:
~/.nika/daemon/nika.sock - Wire format: 4-byte big-endian length + JSON payload
- tokio-native async runtime
§Crate Independence
This crate depends on nika-core only (for path constants and provider info).
It does NOT depend on nika-engine — the daemon is lightweight.
Re-exports§
pub use client::read_auth_token;pub use client::ConnectedClient;pub use client::DaemonClient;pub use error::DaemonError;pub use error::DaemonResult;pub use protocol::DaemonRequest;pub use protocol::DaemonResponse;pub use server::DaemonConfig;pub use server::DaemonServer;
Modules§
- client
- Daemon client — connects to the daemon over Unix socket.
- error
- Daemon error types.
- events
- Event bus — broadcast channel for daemon events.
- install
- Daemon auto-start installation — launchd (macOS) + systemd (Linux).
- lifecycle
- Daemon lifecycle — PID file, daemonize, signal handling.
- protocol
- IPC protocol — message types and wire format.
- server
- Daemon server — accepts connections on Unix socket and routes requests.
- services
- Daemon services — secrets, jobs, watch, cache.
- storage
- SQLite storage layer for jobs and cache.
Constants§
- NIKA_
HOME_ ENV - Environment variable to override the Nika home directory.
Functions§
- daemon_
dir - Returns the daemon directory (
~/.nika/daemon/). - daemon_
log_ path - Returns the daemon log file path (
~/.nika/daemon/nika.log). - daemon_
pid_ path - Returns the daemon PID file path (
~/.nika/daemon/nika.pid). - daemon_
socket_ path - Returns the daemon socket path (
~/.nika/daemon/nika.sock). - daemon_
token_ path - Returns the daemon auth token file path (
~/.nika/daemon/.token).