docs: document reply-wait cursor workflow

Amolith created

Teach agent-skill consumers to capture the <sent .../> record, use
archive-id as the MAM receive cursor, avoid treating message-id as a
cursor, and fall back through recent MAM list if archive-id cannot be
resolved.

Amp-Thread-ID: https://ampcode.com/threads/T-019f2fe4-f392-7688-8b2f-8d40eb9fa4b8

Change summary

src/main.c | 11 +++++++++++
1 file changed, 11 insertions(+)

Detailed changes

src/main.c 🔗

@@ -579,6 +579,17 @@ static int _agent_skill_command(int argc, char *argv[]) {
     "archive-id is empty, the message was sent but the archive cursor was not\n"
     "resolved before timeout.\n"
     "\n"
+    "Send-then-wait-for-reply workflow:\n"
+    "  1. Capture the <sent .../> line from message chat.\n"
+    "  2. Extract its archive-id attribute. Do not use message-id as after-id;\n"
+    "     message-id is only the client stanza id.\n"
+    "  3. Run mam receive for the same JID with after-id=<archive-id>. This skips\n"
+    "     your outgoing message and waits for newer archived messages.\n"
+    "  4. If archive-id is empty, the send likely succeeded but the cursor was not\n"
+    "     resolved. Fall back to mam list over a recent time window, find the line\n"
+    "     whose message-id matches the sent message-id, then use that line's id as\n"
+    "     the receive cursor.\n"
+    "\n"
     "MAM fields for list/receive are unordered key=value terms: with=, start=,\n"
     "end=, after-id=, before-id=, ids=, max=. A bare JID is shorthand for with=.\n"
     "A second bare argument is an error. start= accepts XMPP timestamps or relative\n"