hex_context

async hex_context.load_hex_context(redis, channel_key)

Build the full hex injection block for one channel, or “”.

For text hexes: the raw file content captured at activation, wrapped in [HEX ACTIVE: name] ... [/HEX] tags. For the chess hex: rules cheat sheet + live emoji board + turn info, prefixed with the channel-lock directive.

Best-effort by design — any failure returns “” so a broken hex can never stall prompt assembly.

Parameters:
  • redis (Any) – Async Redis client (main DB).

  • channel_key (str) – The {platform}:{channel_id} channel identifier.

Return type:

str

Returns:

The formatted injection string, or “” when no hexes are active.