2026 OpenClaw Active Memory & Sub-Agents on Remote Physical Macs: MEMORY.md Migration, Write-Heat & JSONL Audits Aligned to Gateway Sandbox—7×24 Long-Session Runbook (Config Snippets + FAQ)
Platform teams running OpenClaw 7×24 long sessions on rented remote physical Macs routinely hit three failures: MEMORY.md drifting from sub-agent working directories, write-heat saturating SSDs, and gateway sandbox JSONL that cannot be joined to host-side logs. This article gives two decision matrices, a seven-step reproducible runbook, paste-ready config, three sign-off thresholds, and an FAQ—plus links for JSONL backup discipline and always-on automation on the same hardware class.
1. Scope & who this is for
Assume OpenClaw is already on macOS with a gateway, and you use or plan Active Memory (durable working memory across turns) plus sub-agents (separate processes and often different cwd for tools). Out of scope: cloud vendor APIs and model routing quotas—here we only cover path contracts, flush cadence, audit fields, and sandbox allowlists.
Bottom line: keep MEMORY.md (or your chosen equivalent) at an absolute path declared in config; sub-agents update only through that path or a controlled RPC; tame write-heat with half-life plus batched flush; mint requestId at the gateway edge so JSONL inside and outside the sandbox uses one field name. For unattended reliability and JSONL rotation, pair this runbook with OpenClaw gateway scheduled backup and JSONL observability on remote Mac 7×24 and the end-to-end automation patterns in 24/7 OpenClaw AI agent flows on ZoneMac physical nodes.
2. Pain points
- Constraint: relative paths × multiple cwds. Sub-agents started from a repo subfolder write
MEMORY.mddeep in that subtree while the parent still reads the old location—path split, not mysterious amnesia. - Hidden cost: write-heat is write amplification. Fsync-heavy full rewrites each turn, combined with audit JSONL, can peg
iowaiton 7×24 hosts before business traffic does. - Stability & audit: two writers, two trees. When the sandbox blocks host paths, sub-agents land audit files under private dirs and host
jqjoins fail—usually requestId and writable-path policy were never unified.
3. Decision matrices
Use these before rollout to agree where memory lives and how aggressively you flush to disk.
| Memory carrier | Best fit | Primary risk |
|---|---|---|
| Single MEMORY.md | Small teams, human diff, fewer than a few thousand entries | Concurrent write conflicts; single-file size tails |
| Sharded files (topic or session) | Long sessions needing LRU and archives | Index and cross-file reference maintenance |
| External vector index only | Retrieval-first recall, gateway off-host | Network partition—degrade path must be pre-defined |
| Write-heat strategy | Disk friendliness | Consistency risk |
|---|---|---|
| Full rewrite every turn | Low | Low |
| Threshold + time-window batch flush | High | Crash window may drop last batch (add WAL or dual-write) |
| High-value events only | Highest | Bad prompts under-record context |
4. Config snippets (sandbox-aligned)
Illustrative JSON—field names must match your pinned OpenClaw version. The non-negotiables are absolute paths, allowlists, and requestId propagation.
{
"memory": {
"path": "/Users/ocagent/workspace/MEMORY.md",
"encoding": "utf-8",
"flush": { "maxEvents": 32, "intervalMs": 5000, "halfLifeRounds": 12 }
},
"subagents": {
"defaultCwd": "/Users/ocagent/workspace",
"inheritEnv": ["OPENCLAW_REQUEST_ID", "MEMORY_PATH"]
},
"gateway": {
"auditJsonl": "/Users/ocagent/logs/gateway-audit.jsonl",
"sandbox": {
"writable": [
"/Users/ocagent/workspace/.sandbox/scratch",
"/Users/ocagent/logs/sandbox-audit.jsonl"
]
}
}
}
In your launchd plist, export MEMORY_PATH and OPENCLAW_REQUEST_ID (or have a gateway wrapper set them per request) so SSH foreground runs do not diverge from unattended daemons.
5. Seven-step runbook (remote physical Mac)
- Freeze authoritative paths. Document MEMORY file, audit JSONL, and sandbox scratch as absolutes on the runbook cover—no split between wiki and code comments.
- Migrate MEMORY.md. Copy under maintenance or read-only mode, verify with
diff, stampmigratedAtmetadata in the header block. - Normalize sub-agent cwd. Force
defaultCwdto the main workspace or pass an explicit memory flag equivalent. - Turn on JSONL schema. Agree on
ts,level,requestId,actor,memoryOp,durationMsfor gateway and children. - Sandbox acceptance. Probes: writes outside the allowlist fail and emit
denylines; successes stay insidewritable. - Tune write-heat. When moving from per-turn full flush to windowed batches, replay a 24 h conversation script and watch
iostatplus JSONL growth. - Replay join. Outer-join host and sandbox JSONL on
requestIdwithjq; any missing pair blocks production promotion.
6. Cite-ready thresholds
- Batch flush starter window: about 3–8 s or 16–32 events, whichever hits first; lengthen with half-life for very long sessions.
- Audit JSONL rotation: split near 128–256 MB so object-storage sync does not copy multi-gigabyte tails.
- Join SLA: in pre-prod soak, 0% missing
requestIdpairs for one hour; production alert if sustained above 0.1% excluding clock-skew buckets you document.
7. FAQ
Q: EACCES writing MEMORY.md?
A: Check ownership matches the UserName in your plist; on shared volumes confirm mount options are not root-only.
Q: Sub-agent logs say memory path resolved to … but it differs from main config?
A: Environment override order—remove stale MEMORY_PATH from shell profiles and set explicit EnvironmentVariables in launchd.
Q: JSONL lines are huge and disk explodes?
A: Do not store full prompts by default—log hashes, lengths, and model aliases; park large payloads behind object-storage pointers.
Q: Sandbox audit file is written but never collected?
A: Add the path to log-shipper allowlists or expose a read-only APFS mount to the host with a documented security review.
8. Summary: why Mac mini fits long-session memory + audit IO
Active Memory with JSONL auditing is effectively high-frequency small IO plus long-lived processes: disk quality, scheduler fairness, and power behavior determine whether your write-heat strategy actually sticks. Apple Silicon Mac mini (for example M4) pairs unified memory bandwidth with roughly ~4 W class idle power, which is ideal for silent 7×24 gateways that keep memory and logs on fast local storage.
macOS also gives you launchd, Unified Logging, and APFS snapshots so triage paths stay short when a sandbox deny line or a burst flush regression appears—complementing Gatekeeper and SIP hardening versus typical Windows malware exposure on always-on boxes.
If you are moving long sessions from a laptop to a remote physical Mac so sub-agents, gateway sandbox, and JSONL rotation share one predictable baseline, Mac mini M4 is one of the most cost-effective anchors today—then fix paths once and let the same hardware profile carry your runbook through staging and production.
Ready for a 7×24 OpenClaw node?
Rent a physical Mac mini environment on ZoneMac, lock in absolute paths and launchd plists, and run the same Active Memory + JSONL stack you validated in staging.