Skip to main content
LongMem provides a command-line interface to manage the memory daemon and interact with your AI’s persistent memory.

Quick Reference

CommandDescription
longmem startStart the memory daemon
longmem stopStop the memory daemon
longmem statusCheck daemon status and version
longmem statsView memory statistics
longmem logsView daemon logs
longmem exportExport memory to JSON or Markdown
longmem --tuiLaunch interactive setup wizard
longmem --versionShow version information
longmem --helpShow help message

Command Structure

All longmem commands follow this pattern:
longmem [command] [options]

Help Text

Run longmem --help to see the built-in help:
longmem - Persistent memory for AI coding assistants

Usage:
  longmem [command] [options]

Commands:
  start       Start the memory daemon
  stop        Stop the memory daemon
  status      Check daemon status
  stats       Show memory statistics
  logs        View recent daemon logs
  export      Export memory to JSON/Markdown
  daemon      Run daemon directly (for debugging)
  mcp         Run MCP server directly (for debugging)
  hook        Run hook directly (for debugging)
  --tui       Launch setup wizard
  --version   Show version
  --help      Show this help

Examples:
  longmem                  # Launch setup wizard
  longmem start            # Start daemon
  longmem status           # Check if daemon is running
  longmem export > backup.json
  longmem export --format markdown --days 30 > report.md

Common Workflows

First-time Setup

# Run the interactive setup wizard
longmem --tui

# Start the daemon
longmem start

# Verify it's running
longmem status

Daily Operations

# Check daemon status
longmem status

# View memory statistics
longmem stats

# View recent logs
longmem logs -n 100

# Export recent memory
longmem export --days 7 > recent.json

Troubleshooting

# View logs
longmem logs

# Follow logs in real-time
longmem logs -f

# Restart daemon
longmem stop
longmem start

Debugging Commands

These commands are available for advanced debugging:
  • longmem daemon - Run daemon in foreground (see console output)
  • longmem mcp - Run MCP server directly
  • longmem hook - Run hook directly
These are typically not needed for normal operation.

Exit Codes

  • 0 - Success
  • 1 - Error occurred
For longmem status, exit code 0 means daemon is running, 1 means stopped.

Build docs developers (and LLMs) love