-
Notifications
You must be signed in to change notification settings - Fork 0
Usage Guide
memory-daemon startThe daemon starts on port 50051 with database at ~/.memory-store.
memory-daemon start \
--port 50052 \
--db-path /var/lib/memory-store \
--config /etc/memory-daemon/config.tomlmemory-daemon statusOutput:
Memory daemon is running (PID: 12345)
memory-daemon stopCreate /etc/systemd/system/memory-daemon.service:
[Unit]
Description=Agent Memory Daemon
After=network.target
[Service]
Type=simple
User=memory
ExecStart=/usr/local/bin/memory-daemon start
ExecStop=/usr/local/bin/memory-daemon stop
Restart=on-failure
RestartSec=5
Environment=MEMORY_PORT=50051
Environment=MEMORY_DB_PATH=/var/lib/memory-store
Environment=MEMORY_LOG_LEVEL=info
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable memory-daemon
sudo systemctl start memory-daemon
sudo systemctl status memory-daemonCreate ~/Library/LaunchAgents/com.spillwave.memory-daemon.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.spillwave.memory-daemon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/memory-daemon</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/memory-daemon.stdout.log</string>
<key>StandardErrorPath</key>
<string>/tmp/memory-daemon.stderr.log</string>
</dict>
</plist>Load and start:
launchctl load ~/Library/LaunchAgents/com.spillwave.memory-daemon.plist
launchctl start com.spillwave.memory-daemonAll query commands connect to a running daemon.
Returns year-level TOC nodes:
memory-daemon query --endpoint http://[::1]:50051 rootOutput:
Year nodes:
toc:year:2026 - 2026 (156 events)
toc:year:2025 - 2025 (1,234 events)
memory-daemon query --endpoint http://[::1]:50051 node --node-id "toc:year:2026"Output:
Node: toc:year:2026
Title: 2026
Level: Year
Summary: Conversations about Rust development, agent memory system
Keywords: rust, memory, grpc, rocksdb
Children: 1 (toc:month:2026-01)
memory-daemon query --endpoint http://[::1]:50051 browse \
--parent-id "toc:year:2026" \
--limit 10 \
--token <continuation_token>Timestamps are milliseconds since Unix epoch:
# Get events from last hour
NOW=$(date +%s)000
HOUR_AGO=$(( $(date +%s) - 3600 ))000
memory-daemon query --endpoint http://[::1]:50051 events \
--from $HOUR_AGO \
--to $NOW \
--limit 100Output:
Events (5 of 5):
[2026-01-30 10:00:00] USER: What is Rust?
[2026-01-30 10:00:05] ASSISTANT: Rust is a systems programming language...
[2026-01-30 10:00:10] USER: How does it handle memory?
...
memory-daemon query --endpoint http://[::1]:50051 expand \
--grip-id "grip:1706600000000:01HXYZ123" \
--before 3 \
--after 3Output:
Grip: grip:1706600000000:01HXYZ123
Excerpt: "User asked about authentication"
Events Before:
[10:00:00] USER: Let's discuss security
[10:00:05] ASSISTANT: What aspect?
[10:00:10] USER: Authentication methods
Excerpt Events:
[10:00:15] USER: How do we authenticate users?
[10:00:20] ASSISTANT: We can use JWT tokens...
Events After:
[10:00:25] USER: What about refresh tokens?
[10:00:30] ASSISTANT: Refresh tokens allow...
[10:00:35] USER: Perfect, let's implement that
Admin commands access storage directly (no daemon required).
memory-daemon admin --db-path ~/.memory-store statsOutput:
Storage Statistics:
Events: 1,234
TOC Nodes: 56
Grips: 789
Outbox: 0
Disk Usage: 12.5 MB
Full compaction:
memory-daemon admin --db-path ~/.memory-store compactSpecific column family:
memory-daemon admin --db-path ~/.memory-store compact --cf eventsAvailable column families:
-
events- Raw conversation events -
toc_nodes- TOC node versions -
toc_latest- Latest version pointers -
grips- Excerpt provenance -
outbox- Pending TOC updates -
checkpoints- Job recovery state
memory-daemon admin --db-path ~/.memory-store rebuild-toc \
--from-date 2026-01-01 \
--dry-run| Variable | Description | Default |
|---|---|---|
MEMORY_PORT |
gRPC server port | 50051 |
MEMORY_DB_PATH |
RocksDB directory | ~/.memory-store |
MEMORY_LOG_LEVEL |
Logging level | info |
MEMORY_CONFIG |
Config file path | ~/.config/memory-daemon/config.toml |
Set via MEMORY_LOG_LEVEL or --log-level:
| Level | Description |
|---|---|
error |
Only errors |
warn |
Errors and warnings |
info |
Normal operation (default) |
debug |
Detailed operation |
trace |
Very verbose |
Example:
MEMORY_LOG_LEVEL=debug memory-daemon start-
Check if already running:
memory-daemon status
-
Check port availability:
lsof -i :50051
-
Check logs:
MEMORY_LOG_LEVEL=debug memory-daemon start 2>&1 | head -50
-
Verify daemon is running:
memory-daemon status
-
Check endpoint format (include
http://):# Correct memory-daemon query --endpoint http://[::1]:50051 root # Wrong memory-daemon query --endpoint [::1]:50051 root
-
Stop any running daemon:
memory-daemon stop
-
Check for stale PID files:
rm -f ~/.local/state/memory-daemon/memory-daemon.pid
-
Check current usage:
memory-daemon admin --db-path ~/.memory-store stats -
Run compaction:
memory-daemon admin --db-path ~/.memory-store compact