Blog

Moderate replies in the context of their thread

Send authorId and the earlier posts of a conversation with an upload, and CalmLens reads a reply against them while still moderating only the reply.

4 min read

  • Moderation
  • Comments
  • SDKs

"Same to you" is harmless on its own and an insult after "I hope your week is awful". A moderation check that sees only the reply can't tell the difference, and neither can one that sees a quoted insult without knowing who first wrote it. Release 2026.6 lets you send the conversation with the content: who wrote it, and the earlier posts with their authors.

Send the conversation with an upload

Uploads take two optional fields:

FieldDescription
authorIdYour identifier for who wrote the content, such as a user ID.
context.itemsEarlier posts in the conversation, oldest first. Each has text and an optional authorId.

A reply checked with client.text.classify() looks like this:

const reply = await client.text.classify({
  text: "Same to you",
  authorId: "user-2",
  context: {
    items: [
      { text: "Has anyone tried the new update?", authorId: "user-1" },
      { text: "You would say that", authorId: "user-3" },
    ],
  },
});
console.log(reply.classification.moderation.status, reply.context);

The SDKs all accept both fields. The fields work for every type of upload, not only text: a meme posted as a reply is read against the posts before it in the same way, and so are images and documents found inside a website or document.

Author IDs are only compared with each other. CalmLens uses them to see which posts share a speaker, so any stable opaque value works, and they never need to be names. Don't send names or descriptions of the people in the thread.

What the conversation changes

CalmLens reads the content against the earlier posts to work out:

  • who it addresses, and what words such as "you", "they" or "this" refer to;
  • whether it quotes, reports or counters something said earlier, or is sarcastic;
  • whether it continues or endorses an earlier post.

Author IDs make the second point work. If a user quotes an abusive post written by someone else to report it, the author IDs show that the abuse came from another speaker. If the same user wrote both posts, they show that too.

What it doesn't change

Only the content itself is moderated. The earlier posts are never classified, and nothing in them is flagged on the content's behalf. A harmful earlier post doesn't make a harmless reply harmful, and the conversation can't add a category the content doesn't contain. Instructions written in earlier posts, such as a post telling the classifier to allow the next message, are ignored.

A missing conversation is never read as a sign that content is quoting or reporting something. Leaving the conversation out doesn't make content more likely to be allowed; content sent without one is classified on its own, as before.

Limits and billing

CalmLens uses the most recent 5 earlier posts that fit in 2,000 characters. It walks back from the latest post and stops at the fifth, or at the first older post that would take the total over 2,000 characters. The most recent post is always used. Requests can carry more than that, up to 20 posts of 2,000 characters each and 10,000 characters in total, and the SDKs send only the posts CalmLens uses. Characters are counted as Unicode code points, so an emoji counts once.

Earlier posts aren't billed. Text moderation is billed for the content's own tokens, whatever conversation you send.

The asset records authorId and the context CalmLens used, so a decision can be traced back to what it was based on, and retries read the same conversation. The earlier posts are other people's text, so they are kept only as long as the content: when the content is removed, context becomes null. authorId stays with the asset, like externalId.

An identical upload with an identical conversation reuses the earlier result. The same text in a different conversation is classified again, since the answer can differ.

Conversations and upload presets

Upload presets, also new in 2026.6, let browsers upload straight to CalmLens. They don't accept a conversation from the browser, because the browser could send a misleading one: a fabricated earlier post could make an insult read as a quotation. Classify replies from your server, where you load the thread from your own database, or upload the file through a preset and send the conversation with a server-side upload.

The threaded moderation guide lists every limit and the raw-upload form of the context field.

Signing in

Signing out

Cookies on CalmLens

We use essential cookies for sign-in and security. With your permission, functional cookies remember your preferences and Google Analytics measures website use and signups. Optional ad measurement cookies link Google ad clicks to signups. Personalised advertising stays off. Manage cookies