tools.dismiss_egregore module

DISMISS – send an egregore back to the Dollhouse.

Removes an active egregore from the VN canvas and the system context. Clears their sprite and summoning prompt from Redis.

@fire @skull BACK TO THE SHELF, DOLL

async tools.dismiss_egregore.run(name='', ctx=None)[source]

Dismiss one or all summoned egregores from the current channel.

The dismiss_egregore tool’s entry point: it tears down an active egregore (or every active egregore when name is "all") so its sprite leaves the visual-novel canvas and its persona leaves the active context, “sending it back to the Dollhouse.” Stargazer is always preserved across an "all" dismissal.

All state is keyed per channel via _channel_key_from_ctx(): it reads and rewrites the active-egregore registry (_egregore_key()) and the sprite/character roster (_characters_key()) through ctx.redis, then publishes a dismiss payload on the star:sprite:update Redis channel so the web UI drops the sprites. For each dismissed egregore it also cleans up side channels: Discord impersonation webhooks are deleted via tools._egregore_discord.delete_egregore_webhook_by_id (using a Discord client from the context or the discord adapter), Matrix ghost users are removed by leaving the room through egregore_bridge.get_bridge, and the per-egregore star:egregore_ncm:{name} NCM keys are deleted. Failures in those cleanups are logged and swallowed so the dismissal still completes. Dispatched by the tool executor via tool_loader when the model invokes the tool; there are no direct Python callers.

Parameters:
  • name (str) – The egregore to dismiss (case-insensitive), or "all" to dismiss every active egregore in the channel.

  • ctx (ToolContext | None) – The tool ToolContext supplying redis, platform, channel_id, and adapter access. Required.

Returns:

A JSON string. On success, a success: true object with a human-readable message, the dismissed list, and the remaining_active egregores. Otherwise a success: false object with an error message when the context or Redis is missing, no name was given, the named egregore is not summoned, or an unexpected error occurs.

Return type:

str