← Back to Blog
Troubleshooting

Troubleshooting cloud-mem: When Your Agent Forgets

cloud-mem is great until the day your agent confidently recalls something that was true three weeks ago. Persistent memory is a force multiplier, but it fails in quiet, confusing ways: nothing crashes, the answers just get subtly wrong. This is the runbook I keep for when that happens.

#First, confirm the daemon is actually healthy

Most "memory isn't working" reports are really "the daemon isn't running." Check that before anything else.

cloud-mem status --verbose

A healthy response looks like:

● cloud-mem  running  (pid 4821, uptime 3h12m)
  index:   12,043 records   /   38.2 MB
  backend: s3://mem-store-prod   (last sync 41s ago)
  health:  OK

If last sync is minutes or hours old, your writes aren't reaching the backend — skip to Silent write failures.

#Stale recalls

The classic symptom: the agent cites a fact that was correct once and isn't anymore. Memory records reflect what was true when they were written — they don't expire on their own.

Find what it's recalling:

cloud-mem search "deploy target" --limit 10 --show-timestamps

If you see old records outranking current ones, you have two fixes:

  • Targeted: delete the specific stale records.
  • Structural: add a recency weight so newer records win ties.
# Targeted — remove a known-bad record by id
cloud-mem rm rec_8f2a91

# Structural — bias retrieval toward recent writes
cloud-mem config set retrieval.recency_halflife 14d

Rule of thumb: if a fact has a shelf life, write the date it was established into the record itself. Future-you (and the retriever) will thank you.

#Silent write failures

Writes that never reach the backend are the scariest failure because everything looks fine locally — until you restart and the memory is gone. The usual causes:

SymptomLikely causeFix
last sync keeps growingExpired backend credentialsRefresh the IAM role / token
Writes succeed, vanish on restartLocal-only buffer, no flushcloud-mem flush + enable autosync
Intermittent sync errorsThrottling on the storeBack off; check bucket request limits

Diagnose with the sync log:

cloud-mem logs --filter sync --since 1h

If you see AccessDenied, it's almost always the backing credentials. For an S3 backend, verify the role can write:

aws sts get-caller-identity
aws s3 cp ./healthcheck.txt s3://mem-store-prod/_probe/ --dryrun

Then force a flush and re-check status:

cloud-mem flush && cloud-mem status

#Runaway index size

A cloud-mem index that balloons makes every recall slower and noisier. Check the distribution before you start deleting things blindly:

cloud-mem stats --by-type --by-age

If the bulk is low-value, short-lived records, compact the index and set a retention policy so it doesn't happen again:

# One-time compaction
cloud-mem compact --dry-run      # preview first
cloud-mem compact

# Ongoing — drop ephemeral records after 90 days
cloud-mem config set retention.ephemeral 90d

#A quick triage checklist

When memory misbehaves, walk these in order:

  • cloud-mem status — is the daemon up and syncing?
  • cloud-mem logs --filter sync — any auth or throttling errors?
  • cloud-mem search — is it retrieving stale records over fresh ones?
  • cloud-mem stats — has the index grown past what's useful?

Nine times out of ten the answer is in the first two. The remaining one is usually a stale record that should have carried its own expiry date.

#Takeaway

Treat memory like any other piece of infrastructure: it has a health check, a sync pipeline, and a retention policy. When it "forgets," you're not debugging magic — you're debugging a daemon, a backend, and a ranking function, in that order.