longmem stats command displays statistics about your AI’s memory database.
Syntax
Requirements
The daemon must be running to fetch statistics. If the daemon is stopped, you’ll see:Output
Statistics Explained
Sessions
Number of distinct coding sessions tracked. A session represents one continuous period of AI interaction, typically:- One terminal session
- One IDE window
- One conversation thread
session.start and ended with session.end.
What it means:
- Low count (0-10): New installation or infrequent use
- Medium count (10-100): Regular use over weeks
- High count (100+): Heavy use over months
Observations
Total number of individual observations stored, including:- Tool uses (file reads, edits, commands)
- AI responses
- User messages
- Hook events
- Typically grows by 100-500 per active session
- High count indicates lots of AI activity
- Observations older than 7 days may be compressed into concepts
User Observations
Subset of observations that are direct user messages (not tool uses or AI responses). What it means:- Shows how much the user is directing the AI
- Typically 10-30% of total observations
- High ratio indicates user-driven interactions
- Low ratio indicates autonomous AI work
Concepts
Number of compressed memory concepts. These are synthesized summaries created by the compression system from related observations. Examples:- “User prefers TypeScript over JavaScript”
- “Project uses Tailwind for styling”
- “Debugging CORS issue with API endpoint”
- Grows slowly (1-5 per session after compression)
- Each concept represents multiple related observations
- More concepts = richer long-term memory
Pending Compressions
Number of observations waiting to be compressed into concepts. What it means:0- All caught up, compression is working1-10- Normal during active use10-50- Queue building up, compression is lagging>50- Compression is failing or circuit breaker is open
- If pending count keeps growing over hours/days
- Check
longmem logsfor compression errors - Verify API keys are configured correctly
Understanding Your Memory Growth
Healthy Memory
- Observations per session: ~138 (normal)
- User ratio: 15% (AI-heavy, normal for coding)
- Concepts: ~3 per session (good compression)
- Pending: Very low (compression working)
Memory Issues
- Observations per session: 850 (very high)
- Concepts: Very low (compression not working)
- Pending: High (backlog building up)
- Check logs:
longmem logs - Look for compression errors
- Verify API configuration
- Consider restarting daemon
Querying Stats Directly
You can also fetch stats via HTTP:Stats in Scripts
You can parse stats in shell scripts:Exit Codes
0- Stats retrieved successfully1- Daemon not running or error fetching stats
Troubleshooting
”Daemon not running” error
Stats show “N/A”
/stats endpoint returned incomplete data. Check:
Stats request times out
If stats take >5 seconds, the request times out. This can happen if:- Database is very large (>1GB)
- Database is locked
- Daemon is under heavy load
Related Commands
longmem status- Check daemon statuslongmem export- Export full memory datalongmem logs- View daemon logs