Log inGet started

notices

Updated November 24, 2026

Post an event record that surfaces to the callers it is addressed to on the response of the tool call that posted it, or on their next tool call.

require("@builtin::modules.api.engine.notices") -- notices (also available as global 'notices')

The notices namespace: 10 functions.

globals/notices/post

notices.post(template: string, params: { [string]: any }?, opts: NoticeOpts?)

Post a notice. template is a fixed sentence used to collapse repeats; put varying values in params. A param holding a picture — an image value from mcp.image or a capture tool — is delivered as a picture beside the notice's line rather than as text. opts.severity defaults to "info"; opts.includeLocation attaches the emitting call site. opts.actionable says whether the callers a notice is addressed to are expected to act on it, rather than take it in as background; an agent's event receiver starts an idle agent's turn for an actionable notice and hands the rest to its context. opts.ephemeral posts a reminder instead of a stored notice: an agent whose harness has an ephemeral channel is shown it for a short window and it is never stored in the agent's history, while an agent with no such channel gets it as a normal background notice on its tool results, keyed as the stored notice this code posts under the same template (or under opts.sameAs), so a caller that mutes one is muted for both. opts.message is the catalog key (<namespace>.<key>, see i18n.t) of the sentence a person reads the notice as, in their language: the editor's notification bell shows it (notices.text), read from the world's catalogs (/zero/source/locales/<tag>/<namespace>.json) and then the built-in library's, while an agent reads the template. A notice with no message reads as its template everywhere. An ephemeral notice is identified by its template, or by opts.sameAs when the post names one, and the code that posted it: posting the same template, or another wording of the same sameAs, again from the same code replaces the entry, so the template is a fixed sentence and every varying value goes in params or into a wording posted with sameAs. opts.subject names the one thing a notice is about when the same code posts the same sentence about several (a scene, a file, a job): the notices about two subjects are two notices, each collapsing its own repeats, and notices.withdraw given the subject takes that subject's alone.

Parameters

  • template string — Fixed sentence identifying the notice.
  • params { [string]: any } (optional) — Optional table of named values rendered alongside the template; a picture in it arrives as a picture.
  • opts NoticeOpts (optional) — Optional table: message (a catalog key), severity ("info" | "warn" | "error"), includeLocation (boolean), audience ("" | { string }?). Who sees the notice: "" addresses every caller; a list addresses those callers only, each entry an agent's name (as the agent toolbox's roster lists it) or a caller key <kind>:<id> such as "agent:". Defaults to the caller whose code is running, or every caller when none is. A notice reaches the agents on this engine: an entry naming no agent on this world's roster, an entry naming an agent the roster lists on another engine of the world, or an empty list, raises an error. actionable (boolean) states whether the callers it is addressed to are expected to act on it; omitted, a notice addressed to particular callers (the default audience included) is actionable, and one for every caller is background. ephemeral (boolean) posts a reminder: it is shown to an agent whose harness has an ephemeral channel for a short window and never stored in its history. For an ephemeral post the audience is not checked against the roster: a list entry naming no agent on it is kept for a key nobody reads, a bare agent name in a list is read as agent:<name>, and a single string audience is used as given; message, severity, includeLocation and actionable have no effect on it. sticky (boolean, ephemeral only) keeps it visible on every read until it is replaced, withdrawn or expires 120 seconds after its last post; posting it again with identical text refreshes that lifetime. ttl (seconds, at most 600, ephemeral and sticky only) raises or lowers that lifetime. renew (boolean, ephemeral only) shows an entry again that a poster posts with identical text. sticky, ttl and renew have no effect on a post that is not ephemeral. subject (a non-empty string) names what the notice is about, keying it apart from the same template about another subject; an ephemeral post is identified by its template (or its sameAs) and the code that posted it, and subject has no effect on it. sameAs (string) is the template of a notice this code posts that this post is another wording of: the same condition with its values written into the sentence, or a shorter wording an ephemeral post carries. The post is keyed as that notice (an ephemeral one is served under its key to an agent with no ephemeral channel), so a caller that muted it is muted for this post and notices.withdraw(sameAs) takes both; omitted, the post's own template.
notices.post("wave complete", { wave = 3 })
notices.post("save slot corrupted, using defaults", { slot = id }, { severity = "warn" })
notices.post("bake finished", { shot = mcp.image("/source/tmp/bake.png") })
notices.post("boss defeated", nil, { audience = "*" })
notices.post("build ready for review", nil, { audience = { "terrain" }, actionable = true })
notices.post("the build is not published", { uncommitted = 4 }, { ephemeral = true, audience = "*" })
notices.post("the lift is out of order", nil, { ephemeral = true, sticky = true, ttl = 300, audience = { "terrain" } })
notices.post("The lift is out of order.", nil, { ephemeral = true, audience = "*", sameAs = "The lift is out of order: riders take the stairs until the repair crew reports it fixed." })
notices.post("wave complete", { wave = 3 }, { message = "hud.wave_complete" })  -- /zero/source/locales/<tag>/hud.json
notices.post("the level was rebuilt", { level = "north" }, { subject = "north" })

globals/notices/text

notices.text(row: { template: string, message: string? }) -> any

The sentence a stored notice reads as for a person: its message in the reader's language, read from the world's catalogs and then the built-in library's, or its template when it names none. row is a notice as the notices toolbox's list tool states it (template, message). The value follows the language on screen, like i18n.text.

Parameters

  • row { template: string, message: string? } — A notice row: { template, message? }.

Returns any — The sentence, as an i18n.text value, or the template as a string.

for _, row in tools.use("notices", "list").pending do print(tostring(notices.text(row))) end

globals/notices/withdraw

notices.withdraw(template: string, opts: { replacing: boolean?, subject: string? }?) -> number

Withdraw the notices this code posted under template that are still stored, whoever they are addressed to, because what they state has stopped being true: a caller that has not read one yet would be told something that no longer holds. A notice is keyed by its template and by the code that posted it, so a call reaches only notices posted from the same place. A later notices.post under the template queues again, and reaches the callers that muted it too: their mute acknowledged what the withdrawn notices stated. opts.replacing withdraws them to make way for a post of the same condition with new values (a count that moved, a later reading): the stale values go, and every caller that muted the template stays muted for the post that follows. opts.subject withdraws the notices posted under template about that subject (opts.subject of notices.post) and leaves the same sentence about every other subject; without it, the notices posted about no subject are withdrawn. Ephemeral notices this chunk posted under template, or as another wording of it (opts.sameAs of notices.post), are withdrawn too when no subject is named, as are stored notices posted as another wording of it; a failure to reach the ephemeral ones is logged, and the stored notices are withdrawn all the same.

Parameters

  • template string — The template the notices were posted under.
  • opts { replacing: boolean?, subject: string? } (optional) — Optional table: replacing (boolean), true when a post of the same condition follows; subject (string), the subject the notices were posted about.

Returns number — How many emissions the withdrawn notices held.

notices.withdraw("save slot corrupted, using defaults")
notices.withdraw("3 files unsaved", { replacing = true })  -- a post with the new count follows
notices.withdraw("the level was rebuilt", { subject = "north" })  -- the notices about "south" stay

tools/notices/drain

notices.drain() -> Drained?

Return your unread notices as the formatted delivery block — the same text that would otherwise be attached to your next tool result. What this returns is marked read for you, so read it; nothing is removed for other callers, and keys you muted with suppress are passed over. Returns nil when you have nothing unread. For a caller that pulls its own context; if you read notices off your tool results, you do not need this. Overflow content is written to /source/tmp/notices/ and named in the block. Pictures the notices carry come back in noticeImages, in the order the block names them, and reach the caller as pictures.

Returns Drained?

tools/notices/list

notices.list() -> NoticesList

Show the notices addressed to you and the keys you muted. pending holds the stored notices your audience admits, read or unread, less the keys you muted; a notice stays stored until every caller it names has read it, or it ages out. Each pending row carries its id (one key can hold several rows), key, handle (the eight hex digits its delivered line ends with, which suppress takes), template, message (the catalog key of the sentence a person reads it as, notices.text), severity, origin, count, source, params (each key with the distinct values it took), location, when it first and last fired, actionable (whether its poster expects you to act on it; an idle agent's turn is started only for an actionable notice it has not read), record (a record of what happened, held here for you and handed to none of your tool results or turns) and unread (whether you have yet to read it). A warning or error raised again with the params of one already delivered is a repeat: earlier counts the emissions delivered before it, and heldUntilMs names when a held repeat is delivered, carrying every repeat raised meanwhile. suppressed holds your own muted keys, each with its handle and the number of times it fired at you while muted. Marks nothing read. Pass a row's handle to suppress or unsuppress. ephemeral holds the reminders posted with ephemeral = true that are current, each with its template, source (the chunk and line that posted it), audience, sticky, for a sticky one the seconds it has left (expiresIn), and key, the key of the stored notice it stands for: an agent served it as a normal notice reads it under that key.

Returns NoticesList

tools/notices/suppress

notices.suppress(key: string) -> { suppressed: string, handle: string }

Mute a notice you have acknowledged, for you alone, by the handle its line ends with (#1a2b3c4d). It keeps counting (visible in your list) and stays off your tool calls and your drain, and starts no turn of yours, until you unsuppress it, or until its poster withdraws the notice because the condition it stated is over: the next notice under the key then reaches you again. A poster refreshing the notice with new values (a count that moved) keeps it muted. On a world bound live the mute is kept in your user's store of the world, so it holds on the next engine that opens it too. Every other caller keeps receiving it. Available to the operating agent; a loaded world component cannot mute its own notices.

Parameters

  • key string

Returns { suppressed: string, handle: string }

"1a2b3c4d"

tools/notices/unsuppress

notices.unsuppress(key: string) -> { unsuppressed: string, handle: string }

Un-mute a notice you suppressed, by its handle, so it renders on your tool calls again. Reverses your own suppress only. Available to the operating agent.

Parameters

  • key string

Returns { unsuppressed: string, handle: string }

"1a2b3c4d"

typed/builtin//modules/api/engine/notices/notices/post

notices.post(template: string, params: { [string]: any }?, opts: NoticeOpts?)

Post a notice. template is a fixed sentence used to collapse repeats; put varying values in params. A param holding a picture — an image value from mcp.image or a capture tool — is delivered as a picture beside the notice's line rather than as text. opts.severity defaults to "info"; opts.includeLocation attaches the emitting call site. opts.actionable says whether the callers a notice is addressed to are expected to act on it, rather than take it in as background; an agent's event receiver starts an idle agent's turn for an actionable notice and hands the rest to its context. opts.ephemeral posts a reminder instead of a stored notice: an agent whose harness has an ephemeral channel is shown it for a short window and it is never stored in the agent's history, while an agent with no such channel gets it as a normal background notice on its tool results, keyed as the stored notice this code posts under the same template (or under opts.sameAs), so a caller that mutes one is muted for both. opts.message is the catalog key (<namespace>.<key>, see i18n.t) of the sentence a person reads the notice as, in their language: the editor's notification bell shows it (notices.text), read from the world's catalogs (/zero/source/locales/<tag>/<namespace>.json) and then the built-in library's, while an agent reads the template. A notice with no message reads as its template everywhere. An ephemeral notice is identified by its template, or by opts.sameAs when the post names one, and the code that posted it: posting the same template, or another wording of the same sameAs, again from the same code replaces the entry, so the template is a fixed sentence and every varying value goes in params or into a wording posted with sameAs. opts.subject names the one thing a notice is about when the same code posts the same sentence about several (a scene, a file, a job): the notices about two subjects are two notices, each collapsing its own repeats, and notices.withdraw given the subject takes that subject's alone.

Parameters

  • template string — Fixed sentence identifying the notice.
  • params { [string]: any } (optional) — Optional table of named values rendered alongside the template; a picture in it arrives as a picture.
  • opts NoticeOpts (optional) — Optional table: message (a catalog key), severity ("info" | "warn" | "error"), includeLocation (boolean), audience ("" | { string }?). Who sees the notice: "" addresses every caller; a list addresses those callers only, each entry an agent's name (as the agent toolbox's roster lists it) or a caller key <kind>:<id> such as "agent:". Defaults to the caller whose code is running, or every caller when none is. A notice reaches the agents on this engine: an entry naming no agent on this world's roster, an entry naming an agent the roster lists on another engine of the world, or an empty list, raises an error. actionable (boolean) states whether the callers it is addressed to are expected to act on it; omitted, a notice addressed to particular callers (the default audience included) is actionable, and one for every caller is background. ephemeral (boolean) posts a reminder: it is shown to an agent whose harness has an ephemeral channel for a short window and never stored in its history. For an ephemeral post the audience is not checked against the roster: a list entry naming no agent on it is kept for a key nobody reads, a bare agent name in a list is read as agent:<name>, and a single string audience is used as given; message, severity, includeLocation and actionable have no effect on it. sticky (boolean, ephemeral only) keeps it visible on every read until it is replaced, withdrawn or expires 120 seconds after its last post; posting it again with identical text refreshes that lifetime. ttl (seconds, at most 600, ephemeral and sticky only) raises or lowers that lifetime. renew (boolean, ephemeral only) shows an entry again that a poster posts with identical text. sticky, ttl and renew have no effect on a post that is not ephemeral. subject (a non-empty string) names what the notice is about, keying it apart from the same template about another subject; an ephemeral post is identified by its template (or its sameAs) and the code that posted it, and subject has no effect on it. sameAs (string) is the template of a notice this code posts that this post is another wording of: the same condition with its values written into the sentence, or a shorter wording an ephemeral post carries. The post is keyed as that notice (an ephemeral one is served under its key to an agent with no ephemeral channel), so a caller that muted it is muted for this post and notices.withdraw(sameAs) takes both; omitted, the post's own template.
notices.post("wave complete", { wave = 3 })
notices.post("save slot corrupted, using defaults", { slot = id }, { severity = "warn" })
notices.post("bake finished", { shot = mcp.image("/source/tmp/bake.png") })
notices.post("boss defeated", nil, { audience = "*" })
notices.post("build ready for review", nil, { audience = { "terrain" }, actionable = true })
notices.post("the build is not published", { uncommitted = 4 }, { ephemeral = true, audience = "*" })
notices.post("the lift is out of order", nil, { ephemeral = true, sticky = true, ttl = 300, audience = { "terrain" } })
notices.post("The lift is out of order.", nil, { ephemeral = true, audience = "*", sameAs = "The lift is out of order: riders take the stairs until the repair crew reports it fixed." })
notices.post("wave complete", { wave = 3 }, { message = "hud.wave_complete" })  -- /zero/source/locales/<tag>/hud.json
notices.post("the level was rebuilt", { level = "north" }, { subject = "north" })

typed/builtin//modules/api/engine/notices/notices/text

notices.text(row: { template: string, message: string? }) -> any

The sentence a stored notice reads as for a person: its message in the reader's language, read from the world's catalogs and then the built-in library's, or its template when it names none. row is a notice as the notices toolbox's list tool states it (template, message). The value follows the language on screen, like i18n.text.

Parameters

  • row { template: string, message: string? } — A notice row: { template, message? }.

Returns any — The sentence, as an i18n.text value, or the template as a string.

for _, row in tools.use("notices", "list").pending do print(tostring(notices.text(row))) end

typed/builtin//modules/api/engine/notices/notices/withdraw

notices.withdraw(template: string, opts: { replacing: boolean?, subject: string? }?) -> number

Withdraw the notices this code posted under template that are still stored, whoever they are addressed to, because what they state has stopped being true: a caller that has not read one yet would be told something that no longer holds. A notice is keyed by its template and by the code that posted it, so a call reaches only notices posted from the same place. A later notices.post under the template queues again, and reaches the callers that muted it too: their mute acknowledged what the withdrawn notices stated. opts.replacing withdraws them to make way for a post of the same condition with new values (a count that moved, a later reading): the stale values go, and every caller that muted the template stays muted for the post that follows. opts.subject withdraws the notices posted under template about that subject (opts.subject of notices.post) and leaves the same sentence about every other subject; without it, the notices posted about no subject are withdrawn. Ephemeral notices this chunk posted under template, or as another wording of it (opts.sameAs of notices.post), are withdrawn too when no subject is named, as are stored notices posted as another wording of it; a failure to reach the ephemeral ones is logged, and the stored notices are withdrawn all the same.

Parameters

  • template string — The template the notices were posted under.
  • opts { replacing: boolean?, subject: string? } (optional) — Optional table: replacing (boolean), true when a post of the same condition follows; subject (string), the subject the notices were posted about.

Returns number — How many emissions the withdrawn notices held.

notices.withdraw("save slot corrupted, using defaults")
notices.withdraw("3 files unsaved", { replacing = true })  -- a post with the new count follows
notices.withdraw("the level was rebuilt", { subject = "north" })  -- the notices about "south" stay
  • api
  • reference