longmem start command starts the memory daemon process in the background.
Syntax
What It Does
When you runlongmem start, the CLI:
- Checks if daemon is already running - Uses health check to avoid duplicate processes
- Locates the daemon binary - Looks for
longmemdin the bin directory or falls back todaemon.js - Spawns the daemon - Starts as a detached background process
- Waits for startup - Pauses 1.5 seconds for daemon to initialize
- Verifies health - Confirms daemon is responding to requests
Output
Successful Start
Already Running
Installation Missing
Failed to Start
Under the Hood
The daemon runs as a detached process with:- stdio: All streams redirected to
/dev/null(logs go to~/.longmem/logs/daemon.log) - detached: Yes - runs independently of parent process
- unref: Yes - allows parent to exit without waiting
~/.longmem/bin/longmemd(installed binary), or~/.longmem/daemon.js(script fallback)
Health Check
The start command performs health checks by sending requests to:~/.longmem/config.json).
Exit Codes
0- Daemon started successfully or already running1- Failed to start daemon or daemon binary not found
Troubleshooting
Daemon fails to start
Check the daemon logs:- Port already in use
- Database corruption
- Missing configuration file
Process exists but not responding
If the daemon process is running but not responding to health checks:Permission errors
Ensure the~/.longmem directory has correct permissions:
What Happens After Start
Once started, the daemon:- Creates PID file at
~/.longmem/longmem.pid - Opens SQLite database at
~/.longmem/longmem.db - Starts HTTP server on configured port (default: 5939)
- Begins processing compression queue after 5 seconds
- Listens for MCP tool calls and hook observations
Related Commands
longmem stop- Stop the daemonlongmem status- Check if daemon is runninglongmem logs- View daemon logs