Skip to main content

Daemon

Run Trix as a background service for persistent connectivity and local caching.

Overview

The Trix daemon (trixd) is a background service that provides persistent connectivity, local caching, and file watching capabilities. It runs independently from the CLI and provides enhanced features for power users.

Key Features

  • Real-time Sync: Continuous synchronization with Trix API
  • Local Cache: Offline access to your memories
  • File Watching: Automatic memory ingestion from watched directories
  • IPC Socket: Local socket for application integration
  • Background Processing: Asynchronous operations without CLI blocking

Installation

Install

# Download and install the daemon
trix daemon install

# The installer will:
# 1. Download the appropriate binary for your OS
# 2. Verify SHA256 checksum
# 3. Install to system location
# 4. Register as a system service

Supported Platforms

PlatformArchitectureService Type
Linuxamd64, arm64systemd
macOSamd64 (Intel), arm64 (Apple Silicon)launchd
Windowsamd64Windows Service

The daemon is distributed separately from the CLI for security and performance reasons. It's open source and available at github.com/trixdb/trixd.

Managing the Daemon

Check Status

# Show daemon status and version
trix daemon status

# Output:
# Daemon Status: running
# Version: 1.2.3
# PID: 12345
# Uptime: 2 days, 5 hours

Start / Stop / Restart

# Start the daemon
trix daemon start

# Stop the daemon
trix daemon stop

# Restart the daemon
trix daemon restart

View Logs

# View recent logs
trix daemon logs

# Follow logs in real-time
trix daemon logs --follow

# Show last N lines
trix daemon logs --lines 100

# Platform-specific log locations:
# Linux: /var/log/trixd/trixd.log
# macOS: ~/Library/Logs/trixd/trixd.log
# Windows: %APPDATA%\trixd\logs\trixd.log

Updating the Daemon

# Check for updates
trix daemon update --check

# Update to latest version
trix daemon update

# The updater will:
# 1. Check GitHub for latest release
# 2. Download and verify new binary
# 3. Stop the service
# 4. Replace the binary
# 5. Restart the service

# Force update even if version is current
trix daemon update --force

The daemon auto-updates are planned for future releases. For now, manually check for updates periodically with trix daemon update --check.

Uninstalling

# Uninstall the daemon
trix daemon uninstall

# This will:
# 1. Stop the service
# 2. Unregister from system services
# 3. Remove the binary
# 4. Optionally remove config and cache

# Skip confirmation
trix daemon uninstall --yes

Uninstalling removes the daemon but keeps your configuration and local cache by default. Use --purge to remove everything.

Configuration

Configuration File

The daemon uses a separate configuration file:

  • Linux: ~/.config/trixd/config.yaml
  • macOS: ~/Library/Application Support/trixd/config.yaml
  • Windows: %APPDATA%\trixd\config.yaml

Configuration Options

# ~/.config/trixd/config.yaml

api_url: https://api.trixdb.com
api_key: your-api-key

# Cache settings
cache:
  enabled: true
  max_size: 1GB
  ttl: 24h

# Sync settings
sync:
  enabled: true
  interval: 30s
  auto_retry: true

# File watching
watch:
  enabled: false
  directories:
    - ~/Documents/notes
    - ~/Projects/wiki
  patterns:
    - "*.md"
    - "*.txt"
  exclude:
    - ".git"
    - "node_modules"

# IPC socket
socket:
  enabled: true
  path: /tmp/trixd.sock  # Unix socket path

Daemon Features

Local Caching

The daemon maintains a local cache of your memories for offline access:

  • Automatic sync with API
  • Configurable cache size and TTL
  • Intelligent cache eviction
  • Works seamlessly with CLI commands

File Watching

Automatically ingest memories from watched directories:

  • Monitor directories for new/modified files
  • Pattern-based filtering (*.md, *.txt, etc.)
  • Automatic memory creation
  • Tag extraction from file metadata

IPC Socket

Applications can connect to the daemon via a local socket:

  • Fast local communication
  • No network round-trips
  • Perfect for editor plugins and integrations
  • JSON-based protocol

Troubleshooting

Daemon won't start

  • Check logs: trix daemon logs
  • Verify API credentials are configured
  • Ensure no other instance is running
  • Check permissions on config directory

High CPU/memory usage

  • Reduce sync interval in config
  • Decrease cache size limit
  • Disable file watching if not needed
  • Check logs for errors or loops

Cache not updating

  • Verify sync is enabled in config
  • Check network connectivity
  • Restart daemon: trix daemon restart
  • Check API key validity

File watching not working

  • Verify watch directories exist
  • Check file patterns match your files
  • Ensure daemon has read permissions
  • Check exclude patterns aren't too broad

Next Steps