Plugins can now drop a card into a chat without spending a model turn

Your plugin watches CI. A build fails at 02:14, and the useful thing to do is simple: put a small card in the chat that says which job failed, with a link. Instead, the plugin has to inject a user message — “call the ci_status tool for job 4417” — which wakes the model, spends a full turn, and leaves a fake user message in the transcript. The person wanted a notification. You paid for a conversation.
ctx.post_card, merged in #157177, is the missing primitive. A plugin can put a card into a conversation from its own background thread, with no session bound and no model turn, and the card is durable: it is in the session history after a reload.
What a card is
A card is plain data:
result = ctx.post_card(
{
"id": "sugg_8f2c1a",
"text": "Hermes thinks deploy-checklist could help your team.",
"directive": {"name": "wisdom-share", "attrs": {"id": "sugg_8f2c1a"}},
},
session_key=session_key,
)
textis required, 1 to 2,000 characters. It is what every surface that cannot render the plugin’s own component shows.directiveis optional. It names a transcript directive the plugin’s Desktop half registers, andattrsis a flat string map (at most 16 keys, 2,048 characters in total).idis optional. Posting the same id with the same card is a no-op (status: "duplicate"); posting it with a different card is refused (card_conflict). Cards are never edited — the plugin’s component renders current state for that id.
There is also await ctx.apost_card(...) for callers already on the gateway’s event loop.
What the model sees
Almost nothing, deliberately. The row’s model-facing content is a single core-authored line:
[<plugin_id> posted a card <card_id>]
Both values are validated and capped, and the line is built by core, not by the plugin. The card’s text, directive and attrs live in display_metadata and in a new plugin.card event; model history strips persistence metadata, and memory-provider egress strips the card fields before on_session_end() or on_pre_compress() sees them. So the model knows that a card exists and never reads it — which also means a card cannot be used to smuggle instructions into context.
Where it shows up
| Surface | What the person sees |
|---|---|
| Desktop | the plugin’s directive component inline in the transcript, or the text as a system row |
| Ink TUI, Web dashboard chat, classic CLI | the text as a system line |
| Messaging platforms | core records the row; the plugin sends its own native card through its adapter |
Ordering is the same FIFO a local cron result uses: an idle session shows the card immediately, a running turn finishes first, and a message the person sent before the card runs before it. Posting a card does not stop the session’s background review or plugin forks, because no turn starts.
Errors, receipts and the honest uncertainty
post_card and apost_card never raise. Refusals come back as data:
no_conversation— no target resolved and no session bound in the calling context.group_not_allowed— cards are private-chat only.consent_required,invalid_target,card_conflict— the capability gate, a bad target, or a reused id with different content.gateway_unavailable,cancelled,timeout— and these are marked"certain": false. The card may have landed even though no receipt reached you. Do not inject a fallback turn; retry the same id and unchanged card to recover the durable duplicate receipt.
That last rule is the one to internalize. Treat a definite refusal as “no card”, but never assume an uncertain result means nothing happened — otherwise retries post twice.
Receipts come from the atomic admission, not from a read before it: queued, duplicate and card_conflict are the admission’s own created-versus-existing outcome. Posts per plugin and session are serialized, and only the post that created the row spends a rate-limit slot, so an exact replay is answered as duplicate even when the window is full.
Wiring it into a plugin
The API is gated by a capability, conversation.cards, sitting beside llm.session_fork. Its consent copy says what it does: the model is told a card was posted and never sees its text. Limits are deliberate — the plugin’s own profile only, private chats only, existing sessions only, capped size and attrs, and a per-session rate limit.
Keep the call in one small function that returns plain data, because the card shape and result codes are marked experimental and may change. Under plugins.isolation: host, post_card and apost_card exist but raise PluginHostUnsupported (a RuntimeError), the same way post_message and fork_session do — the card is admitted on the gateway’s event loop into a session the Hermes process owns.
If what you want is a progress line that updates while work runs, ctx.post_message with an editable handle is still the right tool: it edits a message in place on platforms that support edits, and falls back to sending a new one where they do not. post_card is for the finished, durable artifact.
Why this is more than a convenience
Plugin authors have been paying a model turn for every notification because there was no other way to write into a conversation. That shaped plugin design: batch your notifications, or accept the cost, or post somewhere outside the chat. A display-only card breaks the trade-off — background work can report to the same place the conversation lives, and the model’s context stays untouched.
For more plugin plumbing, our turn origin notes explain how a plugin knows which session it is serving, and the OAuth redirect scopes guide covers the consent side. The v0.23.5 rollup has the rest of the window.