Wait for Memory Change
montycat_await_memory_changeWait until a memory changes, then return immediately when another agent or session writes, updates, or removes an entry—use it to coordinate shared memory or confirm a write landed.
Instructions
Wait until memory CHANGES — returns the moment another agent or session writes, updates, or deletes something in this memory.
This is a live subscription to the database, not a poll: it sleeps until a change actually happens and then returns immediately. Use it to coordinate with other agents sharing a scope ("tell me when someone adds to our shared memory"), or to confirm a write from another session landed. Do NOT call it in a tight loop as a substitute for searching — to find things, use montycat_semantic_search.
Returns {changes: [...], next_seq, oldest_seq, cursor_expired, timed_out}.
Each change is
{seq, key, event, value} where event is "inserted" (covers create and
update) or "removed". Pass the returned next_seq back as since_seq on
the next call to resume exactly where you left off. If the bounded buffer
has discarded part of that history, cursor_expired is true and
oldest_seq identifies the earliest retained record.
Args:
scope: Owner/user id whose memory to watch (keyspace mem_).
Use "shared" for the common keyspace — the usual choice when
coordinating between agents.
keyspace: Explicit keyspace override (advanced; bypasses scope).
timeout_sec: How long to wait before giving up (default 30). On timeout
the result is empty with timed_out: true — that is a
normal outcome, not an error.
since_seq: Resume cursor from a previous call. Omit on the first call to
watch only for changes from now on.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | ||
| keyspace | No | ||
| since_seq | No | ||
| timeout_sec | No |