- Environment: VPS Docker setup (OpenClaw container)
- Current Issue: Cross-session amnesia - agent cannot access memory from heartbeat sessions
- Goal: Implement 10-point memory architecture from external reference
- Approach: Host-level changes guided by Claude Opus + container-level changes by Mylo
# From HOST terminal (outside Docker)
cd /path/to/openclaw/workspace
cp MEMORY.md MEMORY.md.bak.$(date +%Y%m%d)
cp AGENTS.md AGENTS.md.bak.$(date +%Y%m%d)
cp HEARTBEAT.md HEARTBEAT.md.bak.$(date +%Y%m%d)
cp SOUL.md SOUL.md.bak.$(date +%Y%m%d)
tar -czf memory_backup_$(date +%Y%m%d).tar.gz memory/- Update OpenClaw to latest version first
- Verify all sessions restart cleanly
- Confirm no context loss from update itself
Location: /home/node/.openclaw/workspace/
Files to Create:
# Active Tasks - CRASH RECOVERY FILE
**READ THIS FIRST ON EVERY SESSION START**
## Currently In Progress
<!-- Last updated: TIMESTAMP -->
- [ ] Task description here
- Started: YYYY-MM-DD HH:MM UTC
- Context: Brief context
- Next action: What needs to happen next
## Recently Completed (Last 24h)
- [x] Completed task
- Finished: YYYY-MM-DD HH:MM UTC
- Result: Brief result
## Blocked/Issues
- Issue description and resolution status# Lessons Learned
**Pattern: Document once, never repeat**
## Critical Mistakes
| Date | Mistake | Root Cause | Prevention |
|------|---------|------------|------------|
| YYYY-MM-DD | What happened | Why | How to avoid |
## Workflow Improvements
- Discovery: What worked better
- Context: When this applies# Project States
## Project Name
**Status**: active|paused|completed
**Last Updated**: TIMESTAMP
### Current State
- What's been done
- What's in progress
- What's next
### Key Files
- Path to relevant files
- External dependencies# Self-Review Log
**Review every 4 hours during active work**
## YYYY-MM-DD HH:MM UTC
### What I Did
- Activity summary
### Quality Check
- [ ] Did I verify all outputs?
- [ ] Did I update memory files?
- [ ] Did I signal completion properly?
### Improvements for Next Cycle
- What to do betterAdd to TOP of AGENTS.md:
## SESSION STARTUP PROTOCOL (CRITICAL)
**ON EVERY SESSION START - READ IN THIS ORDER**:
1. `active-tasks.md` FIRST - Resume where we left off
2. `MEMORY.md` - Curated long-term memory
3. `projects.md` - Current project states
4. Today's daily log: `memory/YYYY-MM-DD.md`
**Never ask "what were we doing" - read the files.**Current: Likely too verbose Target: Under 20 lines
# Heartbeat Checklist (Lean)
**Every 30 minutes - Quick checks only**
## 1. Task Health (30s)
- Check `active-tasks.md` for stale items (>2h)
- Mark completed items, update in-progress
## 2. Session Hygiene (30s)
- Check current session size
- If >2MB → plan archival
## 3. Self-Review (Every 4h)
- Quick check against `self-review.md` template
**Heavy work → cron jobs. Heartbeat = health checks only.**Create on HOST:
#!/bin/bash
# /opt/openclaw/session-monitor.sh
WORKSPACE="/path/to/openclaw/workspace"
ALERT_SIZE=2000000 # 2MB in bytes
MAX_SIZE=5000000 # 5MB in bytes
for jsonl in "$WORKSPACE"/*.jsonl; do
if [ -f "$jsonl" ]; then
size=$(stat -f%z "$jsonl" 2>/dev/null || stat -c%s "$jsonl" 2>/dev/null)
if [ "$size" -gt "$MAX_SIZE" ]; then
echo "ALERT: $jsonl is $(($size/1024/1024))MB - needs immediate archival"
# Could send notification to Telegram/Discord here
elif [ "$size" -gt "$ALERT_SIZE" ]; then
echo "WARNING: $jsonl is $(($size/1024/1024))MB - consider archival"
fi
fi
doneAdd to host crontab:
# Check session sizes every hour
0 * * * * /opt/openclaw/session-monitor.sh >> /var/log/openclaw/session-monitor.log 2>&1Manual process (or script):
# Archive sessions older than 7 days
find /path/to/openclaw/workspace -name "*.jsonl" -mtime +7 -exec gzip {} \;
mkdir -p /path/to/openclaw/workspace/archive/sessions
find /path/to/openclaw/workspace -name "*.jsonl.gz" -exec mv {} /path/to/openclaw/workspace/archive/sessions/ \;List all current cron jobs:
# From host
cd /path/to/openclaw/workspace && crontab -l
# Check if any OpenClaw-managed cron jobs existPrinciple: Each scheduled job should run in isolated session
Current setup likely has:
- Heartbeat every 30m
- MoltBook checks
- AgentMail checks
Verify isolation:
- Each cron job should use
sessions_spawnor equivalent - No shared context between scheduled tasks
- Each task updates
active-tasks.mdindependently
For each skill in /home/node/.openclaw/workspace/skills/:
Current format:
description: "Deploy websites"New format:
description: |
Deploy files to cPanel.
USE WHEN: uploading files, creating domains, managing hosting
DON'T USE WHEN: buying domains (use registrar skill),
managing DNS (use Cloudflare skill)Priority skills to update:
- github
- moltbook
- ralph-loop
- Specialist agent skills (strategist, decomposer, sentinel, engineer, scribe)
- gifgrep
- agentmail
From host:
# Simulate session restart
docker restart openclaw-container
# Or if using docker-compose:
docker-compose restart openclawVerify:
- Container restarts successfully
- Mylo reads
active-tasks.mdon first message - Can resume tasks without asking "what were we doing"
Test case:
- Start task in Session A (e.g., Discord)
- Update
active-tasks.md - Send message in Session B (e.g., Telegram Maintenance)
- Verify Session B knows what Session A was doing
Test case:
# Create large test file
dd if=/dev/zero of=/path/to/openclaw/workspace/test_large.jsonl bs=1M count=3
# Run monitor script
/opt/openclaw/session-monitor.sh
# Should alert about 3MB file
rm /path/to/openclaw/workspace/test_large.jsonl- Day 1: Backup + Create new memory files (Phase 2.1)
- Day 2: Update AGENTS.md startup protocol (Phase 2.2)
- Day 3: Trim HEARTBEAT.md (Phase 2.3)
- Day 4-7: Monitor stability, no other changes
- Day 8: Implement session monitoring (Phase 3)
- Day 9: Archive old sessions (Phase 3.2)
- Day 10-14: Monitor, verify no issues
- Day 15: Update skill descriptions (Phase 5)
- Day 16: Audit cron jobs (Phase 4)
- Day 17-21: Full testing (Phase 6)
| Task | Level | Who Does It |
|---|---|---|
| Create/edit memory files | Container | Mylo (via tool calls) |
| Update AGENTS.md/HEARTBEAT.md/SOUL.md | Container | Mylo (via tool calls) |
| Update skill descriptions | Container | Mylo (via tool calls) |
| Restart containers | Host | Setasoma (terminal) |
| Session monitoring script | Host | Setasoma (terminal + cron) |
| Archive old sessions | Host | Setasoma (terminal + cron) |
| Backup files | Host | Setasoma (terminal) |
| Verify isolation | Host | Setasoma (terminal) |
-
Immediate rollback: Restore from backups
cp MEMORY.md.bak.YYYYMMDD MEMORY.md # etc for other files -
Container won't start: Check logs
docker logs openclaw-container # or docker-compose logs openclaw -
Memory not loading: Verify file permissions
ls -la /path/to/openclaw/workspace/*.md # Should be readable by node user (UID 1000)
- All original files backed up with
.bak.YYYYMMDDsuffix - Can restore individual files or full memory directory
- Container restart will load previous state
- Mylo can resume tasks after session restart without asking "what were we doing"
- Cross-session context sharing works (Discord session knows what Telegram session did)
- Session sizes stay under 2MB (alerts at 2MB, critical at 5MB)
- Heartbeat completes in under 2 minutes
- All skill descriptions include USE WHEN / DON'T USE WHEN
- No data loss during implementation
- Zero downtime for critical functions
Context for Opus:
- This is for an OpenClaw AI agent named Mylo
- Mylo runs in a Docker container on a VPS
- Setasoma (human operator) has terminal access to host
- Current issue: Mylo has amnesia between sessions (can't remember what happened in heartbeat sessions)
- Solution: Implement structured memory architecture with crash recovery
Key Constraint:
- Mylo can edit files inside container via tool calls
- Setasoma must handle host-level changes (Docker restarts, cron jobs, monitoring scripts)
- Need minimal disruption to existing workflows
Priority:
- Crash recovery (active-tasks.md + AGENTS.md startup protocol)
- Session hygiene (monitoring + archival)
- Skill routing improvements