The LAST free Semurg nodes EVER: the first 1,000 are free, for a limited time. After that, every node is US$139, paid once.

Blog / How-to guides

Semurg as a streaming log: topics you append to and read in order

23 October 2026 · Semurg · 3 min read · Markdown

Last checked on r11.168.20261114.da3a8f8 (14 Nov 2026): every command below ran on a fresh node of that release. The current release is r11.173.20261116.3006727 (16 Nov 2026), and the commands have not been re-checked on it yet (how)

streamingdatabasehow-to

An event log is often its own system, beside the database the events describe. In Semurg a topic lives in the same store as everything else, so an order event can carry the id of the customer record it belongs to, and both are read through the same API with the same token. A topic is a named log: you append messages, and a consumer reads everything after its cursor, in order.

A producer appends messages to a topic and each is acknowledged once it is readable; a consumer reads everything after its cursor and can wait for the next message instead of polling; a count answers in one read.Your producerA topic: an orderedlogA consumer: everythingafter its cursorWait for the nextmessageHow many messages: onereadacknowledged once readableno polling

Each block puts your token in the shell first; replace <your token> with yours.

Append messages

A message is text (values) or bytes (values_b64). One call appends up to 65536 messages and up to 64 MiB, in the order given. A topic name is up to 249 characters of letters, digits, ., _ and -.

bash
export SEMURG_API_TOKEN=<your token>
curl -sS http://localhost:4000/v1/query \
  -H "Authorization: Bearer $SEMURG_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"stream_produce","topic":"payments","values":["payment authorised","payment captured","payment settled"]}'

Expected: the sequence numbers of the first and last of the three messages, and the topic's cursor

The answer comes only after the messages are readable: a message you were told about is never missing from a read that follows.

Read in order, from a cursor

A consumer keeps the cursor it was given and asks for everything after it. max bounds one read (1024 by default, up to 65536).

bash
export SEMURG_API_TOKEN=<your token>
curl -sS http://localhost:4000/v1/query \
  -H "Authorization: Bearer $SEMURG_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"stream_read","topic":"payments","cursor":0,"max":10}'

Expected: the messages after cursor 0, each with its sequence number and its value in base64, and the cursor to ask from next

Sequence numbers start at 1, so cursor 0 reads from the beginning; pass the cursor from each answer to the next read. Values come back base64 (value_b64) whether you sent text or bytes, and count is how many messages the topic holds, not how many this read returned.

To wait for new messages instead of polling, add "wait_ms" (up to 600000): the read returns as soon as a message arrives after your cursor, or empty when the wait ends. Over the WebSocket, a subscriber is woken when a topic moves.

Count

How many messages each topic holds, for one topic or many in one call:

bash
export SEMURG_API_TOKEN=<your token>
curl -sS http://localhost:4000/v1/query \
  -H "Authorization: Bearer $SEMURG_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"stream_count","topics":["payments"]}'

Expected: the count for the payments topic

When something is refused

  • 422: a bad topic name, value, cursor, max or wait_ms, named in the message.
  • 413: more messages or bytes in one call than the bounds above; send them in more calls.
  • 503 on an append: nothing was acknowledged; send it again.
  • 501: a release without streaming.

How it behaves

  • A topic is one ordered log; many topics append side by side.
  • A consumer keeps its own cursor.

Next

What Semurg is: Give Claude Code, Cursor and your other AI agents a memory that lasts: install Semurg on your own machine in one line.

Why use it: your agent recalls the facts it needs, each with its source, instead of re-reading the project.

What it solves today: agents that forget between sessions, and data that must stay on your own machines.

This post was written with AI assistance. Every result in it is checked against a published release or record before the post goes out.

How these commands were checked

Our test farm ran each of the 3 command blocks marked runnable, exactly as written, with the answer checked against the expectation printed under it, against a fresh node of the published release r11.168.20261114.da3a8f8. A post is published only when every one of them passed there.

Related