Skip to content
All Features

Runs without a terminal.

Background Daemon

A POSIX daemon (Linux/macOS) that runs persistent services, cron-scheduled jobs, and one-shot AI tasks without requiring an open terminal. It handles process lifecycle with crash recovery, atomic state writes, PID file management, and log rotation. Schedule recurring AI tasks like dependency audits, test runs, or report generation.

See it in action

kognisant | daemon

How it works

  1. 1

    The daemon forks into the background on 'kognisant daemon start'. It maintains a PID file and responds to SIGTERM for clean shutdown.

  2. 2

    Jobs are defined with type (one-shot, scheduled, persistent) and execution config. Scheduled jobs use standard cron syntax.

  3. 3

    State is written atomically (write to temp file → rename) to prevent corruption on crash. Recovery restores the last known good state.

  4. 4

    Logs are rotated automatically. Each job gets its own log file with configurable retention.

Key capabilities

Standard cron syntax scheduling
One-shot, scheduled, and persistent job types
Crash recovery with atomic state writes
PID file management and signal handling
Per-job log files with rotation
Job status monitoring via CLI

Use cases

  • Run dependency audits weekly
  • Execute test suites on every git push
  • Generate daily reports from project data
  • Monitor external APIs for uptime
  • Run lint checks on a schedule

Commands

reference
kognisant daemon start

# Start the background daemon

kognisant daemon stop

# Stop the daemon gracefully

kognisant daemon status

# Show daemon and job status

kognisant job add --name <n> --type scheduled --cron <expr>

# Add a scheduled job

/jobs

# List background jobs in chat

Ready to try Background Daemon?