# Results of commands that worked, that saved a message with an unconfirmed notice,
# or that were interrupted. Each entry: the command, its exit code, the key set, and
# every value that is not an echo of the fixture. Echoed row and address fields:
# ack_at, body, created_at, id, in_reply_to, name, notification_finished_at,
# notification_started_at, recipient, retired_at, sender, seq, session_id, socket, url,
# wait_returned_at, workspace.

# Peers

## a native peer
$ htalk --db DATABASE peer add carol --harness claude --session CAROL_SESSION --workspace WORKSPACE
exit 0
keys: harness, name, retired_at, session_id, socket, url, workspace
harness = "claude"

## a pull peer
$ htalk --db DATABASE peer add helper --harness generic --delivery pull
exit 0
keys: delivery, harness, name, retired_at, session_id, socket, url, workspace
delivery = "pull"
harness = "generic"

## check a live Claude session
$ htalk --db DATABASE peer check alice
exit 0
keys: harness, retired_at, session_id, socket, workspace
harness = "claude"

## check a saved Codex CLI session
$ htalk --db DATABASE peer check bob
exit 0
keys: harness, metadata_source, retired_at, runtime_status, session_id, transport, workspace
harness = "codex"
metadata_source = "CODEX_HOME/state_5.sqlite"
runtime_status = "unknown"
transport = "codex_cli_queue"

## check an OpenCode session
$ htalk --db DATABASE peer check muse
exit 0
keys: authenticated, harness, retired_at, runtime_status, server_version, session_id, transport, url, workspace
authenticated = false
harness = "opencode"
runtime_status = "idle"
server_version = "1.18.30"
transport = "opencode_http_prompt_async"

## check a pull peer
$ htalk --db DATABASE peer check helper
exit 0
keys: delivery, detail, harness, name, retired_at, status
delivery = "pull"
detail = "No native presence check; recipient must poll inbox."
harness = "generic"
status = "pull_only"

## retire a peer
$ htalk --db DATABASE peer retire carol
exit 0
keys: harness, name, retired_at, session_id, socket, url, workspace
harness = "claude"

## list active peers
$ htalk --db DATABASE peer list
exit 0
keys: peers[{delivery, harness, name, retired_at, session_id, socket, url, workspace} | {harness, name, retired_at, session_id, socket, url, workspace}], retired_hidden
peers[0].harness = "claude"
peers[1].harness = "codex"
peers[2].delivery = "pull"
peers[2].harness = "generic"
peers[3].harness = "opencode"
retired_hidden = 1

## register a retired peer again
$ htalk --db DATABASE peer add carol --harness claude --session CAROL_SESSION --workspace WORKSPACE
exit 0
keys: harness, name, next_action, recovery{restore}, retired_at, session_id, socket, url, workspace
harness = "claude"
next_action = "Peer carol is retired, and peer add does not change that. If this session should get new requests again, use recovery.restore."
recovery.restore = "htalk --db DATABASE peer restore carol"

## restore a peer
$ htalk --db DATABASE peer restore carol
exit 0
keys: harness, name, retired_at, session_id, socket, url, workspace
harness = "claude"

## list every peer
$ htalk --db DATABASE peer list --all
exit 0
keys: peers[{delivery, harness, name, retired_at, session_id, socket, url, workspace} | {harness, name, retired_at, session_id, socket, url, workspace}]
peers[0].harness = "claude"
peers[1].harness = "codex"
peers[2].harness = "claude"
peers[3].delivery = "pull"
peers[3].harness = "generic"
peers[4].harness = "opencode"

## discover sessions
$ htalk --db DATABASE peer discover --workspace WORKSPACE --opencode-url OPENCODE_URL
exit 0
keys: scope, sessions[{harness, pid, runtime_status, session_id, source, workspace}], sources[{detail, error, harness, path, source, status} | {detail, error, harness, source, status, url, version} | {detail, harness, next_action, socket, source, status} | {detail, harness, path, scope, source, status} | {harness, source, status}]
scope = "Current local client environment and the listed endpoints only. Unavailable sources do not prove there are no sessions."
sessions[0].harness = "claude"
sessions[0].pid = 424200
sessions[0].runtime_status = "running"
sessions[0].source = "claude_agents"
sources[0].harness = "claude"
sources[0].source = "claude_agents"
sources[0].status = "ok"
sources[1].detail = "file_not_found"
sources[1].harness = "codex"
sources[1].next_action = "Check the running Codex app-server socket and permissions, or pass --codex-socket. Embedded clients without a socket are outside this source's coverage."
sources[1].source = "codex_app_server"
sources[1].status = "unavailable"
sources[2].detail = "file_not_found"
sources[2].harness = "codex"
sources[2].path = "CODEX_HOME/thread-writer-locks"
sources[2].scope = "CLI writers visible in this Linux process namespace."
sources[2].source = "codex_writer_locks"
sources[2].status = "unavailable"
sources[3].detail = null
sources[3].error = "recipient_not_in_opencode_server"
sources[3].harness = "opencode"
sources[3].source = "opencode_server"
sources[3].status = "unavailable"
sources[3].version = "1.18.30"
sources[4].detail = null
sources[4].error = "opencode_saved_metadata_missing"
sources[4].harness = "opencode"
sources[4].path = "HOME/.local/share/opencode/opencode.db"
sources[4].source = "opencode_saved"
sources[4].status = "unavailable"

## prepare the mailbox
$ htalk --db DATABASE migrate
exit 0
keys: resolved_path, schema_version, state
resolved_path = "DATABASE"
schema_version = 3
state = "ready"

# A request and its answer

## send, the notice was submitted
$ htalk --db DATABASE --as helper send alice --id REQUEST_ID --message 'Invented question'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = "claude_socket_bytes_written"
reply = null
state = "saved"
submission = "submitted"

## the same send again
$ htalk --db DATABASE --as helper send alice --id REQUEST_ID --message 'Invented question'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = false
notification_detail = "claude_socket_bytes_written"
reply = null
state = "saved"
submission = "submitted"

## the recipient's inbox
$ htalk --db DATABASE --as alice inbox
exit 0
keys: actor_source, messages[{ack_at, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission}], omitted, total
actor_source = "option"
messages[0].notification_detail = "claude_socket_bytes_written"
messages[0].reply = null
messages[0].state = "saved"
messages[0].submission = "submitted"
omitted = 0
total = 1

## the recipient shows the request
$ htalk --db DATABASE --as alice show REQUEST_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_detail = "claude_socket_bytes_written"
reply = null
state = "saved"
submission = "submitted"

## the recipient acknowledges; Claude has no notice removal
$ htalk --db DATABASE --as alice ack REQUEST_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_cleanup{detail, status}, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_cleanup.detail = "client_has_no_notification_removal"
notification_cleanup.status = "unsupported"
notification_detail = "claude_socket_bytes_written"
reply = null
state = "saved"
submission = "submitted"

## reply to a pull peer
$ htalk --db DATABASE --as alice reply REQUEST_ID --message 'Invented answer'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = "pull_only"
reply = null
state = "saved"
submission = "not_submitted"

## wait returns the answer
$ htalk --db DATABASE --as helper wait REQUEST_ID --seconds 0
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_detail, recipient, reply{ack_at, body, created_at, id, in_reply_to, notification_detail, recipient, sender, seq, submission}, sender, seq, state, submission
actor_source = "option"
notification_detail = "claude_socket_bytes_written"
reply.notification_detail = "pull_only"
reply.submission = "not_submitted"
state = "reply_received"
submission = "submitted"

## the sender's outgoing list
$ htalk --db DATABASE --as helper sent
exit 0
keys: actor_source, messages[{ack_at, body_bytes, body_preview, created_at, id, in_reply_to, notification_detail, recipient, reply{ack_at, body_bytes, body_preview, created_at, id, in_reply_to, notification_detail, recipient, sender, seq, submission}, sender, seq, state, submission}], omitted, total
actor_source = "option"
messages[0].body_bytes = 17
messages[0].body_preview = "Invented question"
messages[0].notification_detail = "claude_socket_bytes_written"
messages[0].reply.body_bytes = 15
messages[0].reply.body_preview = "Invented answer"
messages[0].reply.notification_detail = "pull_only"
messages[0].reply.submission = "not_submitted"
messages[0].state = "reply_received"
messages[0].submission = "submitted"
omitted = 0
total = 1

## the sender acknowledges the answer
$ htalk --db DATABASE --as helper ack REPLY_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_cleanup{detail, status}, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_cleanup.detail = "pull_only"
notification_cleanup.status = "skipped"
notification_detail = "pull_only"
reply = null
state = "saved"
submission = "not_submitted"

## the request after its answer was read
$ htalk --db DATABASE --as helper show REQUEST_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_detail, recipient, reply{ack_at, body, created_at, id, in_reply_to, notification_detail, recipient, sender, seq, submission}, sender, seq, state, submission
actor_source = "option"
notification_detail = "claude_socket_bytes_written"
reply.notification_detail = "pull_only"
reply.submission = "not_submitted"
state = "reply_received"
submission = "submitted"

## an answer the recipient's wait returned
$ htalk --db DATABASE --as alice show REPLY_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_detail = "returned_by_recipient_wait"
reply = null
state = "saved"
submission = "not_submitted"

# Notification outcomes and cleanup

## send, queued by the Codex CLI
$ htalk --db DATABASE --as helper send bob --id QUEUED_ID --message 'Invented task'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = "codex_cli_queued:QUEUE_ID"
reply = null
state = "saved"
submission = "submitted"

## acknowledge, the queued notice is removed
$ htalk --db DATABASE --as bob ack QUEUED_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_cleanup{queue_id, status}, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_cleanup.queue_id = "QUEUE_ID"
notification_cleanup.status = "removed"
notification_detail = "codex_cli_queued:QUEUE_ID"
reply = null
state = "saved"
submission = "submitted"

## acknowledge again, the notice is already gone
$ htalk --db DATABASE --as bob ack QUEUED_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_cleanup{queue_id, status}, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_cleanup.queue_id = "QUEUE_ID"
notification_cleanup.status = "absent"
notification_detail = "codex_cli_queued:QUEUE_ID"
reply = null
state = "saved"
submission = "submitted"

## send without a notice
$ htalk --db DATABASE --as helper send bob --id QUIET_ID --message 'Poll for this' --no-notify
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = null
reply = null
state = "saved"
submission = "not_submitted"

## acknowledge a message that had no notice
$ htalk --db DATABASE --as bob ack QUIET_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_cleanup{detail, status}, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
notification_cleanup.detail = "no_confirmed_queue_receipt"
notification_cleanup.status = "skipped"
notification_detail = null
reply = null
state = "saved"
submission = "not_submitted"

## wait ends without an answer
$ htalk --db DATABASE --as helper wait QUIET_ID --seconds 0
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission, wait_ended
actor_source = "option"
notification_detail = null
reply = null
state = "saved"
submission = "not_submitted"
wait_ended = "timeout"

## acknowledge while the sender is still submitting
$ htalk --db DATABASE --as bob ack QUIET_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, next_action, notification_cleanup{detail, status}, notification_detail, recipient, recovery{retry_notification_cleanup, show}, reply, sender, seq, state, submission
actor_source = "option"
next_action = "Read the message with recovery.show. Acknowledging a question leaves it open until you reply. Acknowledgment is saved. After submission finishes, use recovery.retry_notification_cleanup to retry removal. If the sending process stopped before saving its completion receipt, cleanup can remain pending indefinitely; htalk cannot reconstruct the missing receipt. Never repeat an uncertain notification."
notification_cleanup.detail = "notification_submission_has_no_completion_receipt"
notification_cleanup.status = "pending"
notification_detail = null
recovery.retry_notification_cleanup = "htalk --db DATABASE --as bob ack QUIET_ID"
recovery.show = "htalk --db DATABASE --as bob show QUIET_ID"
reply = null
state = "saved"
submission = "submission_unknown"

## acknowledge when Codex state cannot be verified
$ htalk --db DATABASE --as bob ack QUEUED_ID
exit 0
keys: ack_at, actor_source, body, created_at, id, in_reply_to, next_action, notification_cleanup{detail, status}, notification_detail, recipient, recovery{retry_notification_cleanup, show}, reply, sender, seq, state, submission
actor_source = "option"
next_action = "Read the message with recovery.show. Acknowledging a question leaves it open until you reply. Acknowledgment is saved. After submission finishes, use recovery.retry_notification_cleanup to retry removal. Verify the registered Codex address and native access. If sandbox restrictions prevented cleanup, use your client's normal approval flow before retrying. Never repeat an uncertain notification."
notification_cleanup.detail = "recipient_not_in_codex_state"
notification_cleanup.status = "unavailable"
notification_detail = "codex_cli_queued:QUEUE_ID"
recovery.retry_notification_cleanup = "htalk --db DATABASE --as bob ack QUEUED_ID"
recovery.show = "htalk --db DATABASE --as bob show QUEUED_ID"
reply = null
state = "saved"
submission = "submitted"

## send to an OpenCode session
$ htalk --db DATABASE --as helper send muse --message 'Invented prompt'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = "opencode_prompt_async_accepted"
reply = null
state = "saved"
submission = "submitted"

## send, the recipient's client is not running
$ htalk --db DATABASE --as helper send carol --message 'Anyone there?'
exit 2
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, next_action, notification_detail, recipient, recovery{show, wait}, reply, sender, seq, state, submission
actor_source = "option"
created = true
next_action = "Use recovery.wait to wait again on this saved request, or recovery.show to inspect it. Never repeat an uncertain notification."
notification_detail = "recipient_unavailable"
recovery.show = "htalk --db DATABASE --as helper show UUID"
recovery.wait = "htalk --db DATABASE --as helper wait UUID --seconds 45"
reply = null
state = "saved"
submission = "not_submitted"

## reply to a retired peer
$ htalk --db DATABASE --as helper reply LATE_ID --message 'Late answer'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission
actor_source = "option"
created = true
notification_detail = "recipient_retired"
reply = null
state = "saved"
submission = "not_submitted"

# Pages

## an inbox page with more behind it
$ htalk --db DATABASE --as bob inbox --limit 1
exit 0
keys: actor_source, messages[{ack_at, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission}], next_page, omitted, total
actor_source = "option"
messages[0].notification_detail = "codex_cli_queued:QUEUE_ID"
messages[0].reply = null
messages[0].state = "saved"
messages[0].submission = "submitted"
next_page = "htalk --db DATABASE --as bob inbox --limit 1 --after-seq 3"
omitted = 1
total = 2

## an outgoing page with more behind it
$ htalk --db DATABASE --as helper sent --limit 1 --bodies
exit 0
keys: actor_source, messages[{ack_at, body, created_at, id, in_reply_to, notification_detail, recipient, reply, sender, seq, state, submission}], next_page, omitted, total
actor_source = "option"
messages[0].notification_detail = "recipient_retired"
messages[0].reply = null
messages[0].state = "saved"
messages[0].submission = "not_submitted"
next_page = "htalk --db DATABASE --as helper sent --limit 1 --before-seq 8 --bodies"
omitted = 5
total = 6

# Interruption

## Ctrl-C during wait
$ htalk --db DATABASE --as helper wait QUEUED_ID --seconds 45
exit 130
keys: actor_source, message_id, next_action, persistence, recovery{inbox, peers, sent, show}, state
actor_source = "option"
message_id = "QUEUED_ID"
next_action = "Use the listed recovery commands to inspect the known ID or find saved messages. Do not resend."
persistence = "unknown"
recovery.inbox = "htalk --db DATABASE --as helper inbox"
recovery.peers = "htalk --db DATABASE peer list"
recovery.sent = "htalk --db DATABASE --as helper sent"
recovery.show = "htalk --db DATABASE --as helper show QUEUED_ID"
state = "interrupted"

## Ctrl-C while the notice is being submitted
$ htalk --db DATABASE --as helper send bob --id STUCK_ID --message 'Invented task'
exit 130
keys: actor_source, message_id, next_action, persistence, recovery{inbox, peers, sent, show}, state
actor_source = "option"
message_id = "STUCK_ID"
next_action = "Use the listed recovery commands to inspect the known ID or find saved messages. Do not resend."
persistence = "saved"
recovery.inbox = "htalk --db DATABASE --as helper inbox"
recovery.peers = "htalk --db DATABASE peer list"
recovery.sent = "htalk --db DATABASE --as helper sent"
recovery.show = "htalk --db DATABASE --as helper show STUCK_ID"
state = "interrupted"

## the same send after the interruption
$ htalk --db DATABASE --as helper send bob --id STUCK_ID --message 'Invented task'
exit 0
keys: ack_at, actor_source, body, created, created_at, id, in_reply_to, next_action, notification_detail, recipient, recovery{show, wait}, reply, sender, seq, state, submission
actor_source = "option"
created = false
next_action = "Use recovery.wait to wait again on this saved request, or recovery.show to inspect it. Never repeat an uncertain notification."
notification_detail = null
recovery.show = "htalk --db DATABASE --as helper show STUCK_ID"
recovery.wait = "htalk --db DATABASE --as helper wait STUCK_ID --seconds 45"
reply = null
state = "saved"
submission = "submission_unknown"

## Ctrl-C while an acknowledged notice is being removed
$ htalk --db DATABASE --as bob ack NOTICED_ID
exit 130
keys: actor_source, message_id, next_action, persistence, recovery{inbox, peers, retry_notification_cleanup, sent, show}, state
actor_source = "option"
message_id = "NOTICED_ID"
next_action = "Use the listed recovery commands to inspect the known ID or find saved messages. Do not resend. Use recovery.retry_notification_cleanup to finish acknowledgment and queue cleanup."
persistence = "unknown"
recovery.inbox = "htalk --db DATABASE --as bob inbox"
recovery.peers = "htalk --db DATABASE peer list"
recovery.retry_notification_cleanup = "htalk --db DATABASE --as bob ack NOTICED_ID"
recovery.sent = "htalk --db DATABASE --as bob sent"
recovery.show = "htalk --db DATABASE --as bob show NOTICED_ID"
state = "interrupted"

# Catalogue

## publish a profile
$ htalk --db DATABASE --as helper catalog publish --config CATALOG bob --name Reviewer --role 'Check requested work' --device-name 'Known device'
exit 0
keys: device_id, generation, mailbox_id, profile_id, sender, state
device_id = "UUID"
generation = "UUID"
mailbox_id = "UUID"
profile_id = "PROFILE_ID"
state = "published"

## the published catalogue
$ htalk catalog export --config CATALOG
exit 0
keys: device_id, device_name, generation, mailbox_id, profiles[{binding_id, binding_state, delivery, display_name, harness, peer_name, profile_id, role, runtime_status}], schema_version, sender
device_id = "UUID"
device_name = "Known device"
generation = "UUID"
mailbox_id = "UUID"
profiles[0].binding_id = "UUID"
profiles[0].binding_state = "current"
profiles[0].delivery = "native"
profiles[0].display_name = "Reviewer"
profiles[0].harness = "codex"
profiles[0].peer_name = "bob"
profiles[0].profile_id = "PROFILE_ID"
profiles[0].role = "Check requested work"
profiles[0].runtime_status = "unknown"
schema_version = 1

## withdraw a profile
$ htalk catalog unpublish --config CATALOG PROFILE_ID
exit 0
keys: profile_id, state
profile_id = "PROFILE_ID"
state = "unpublished"

## discover with no known device
$ htalk catalog discover --trust TRUST --via ssh
exit 0
keys: devices[], scope, sources[{source, status, via}]
scope = "Snapshot from explicitly pinned SSH IPv4 addresses. No multicast or Tailscale discovery. Reachability is not agent liveness."
sources[0].source = "ssh"
sources[0].status = "ok"
sources[0].via = "ssh"
