feature_toggles

Per-channel feature toggles stored in Redis.

Allows authorised users to disable the NCM neurotransmitter subsystem (cadence post-processing + NCM tools like inject_ncm) or the RAG subsystem on a per-channel basis via !emotions on/off and !rag on/off.

NOTE: !emotions off does NOT affect the Sigma Limbic Recursion Core. The limbic inhale (context injection) and exhale (emotional feedback loop) always run. Star always knows her emotions. The toggle only disables the surface layer: cadence text degradation and tool access to NCM.

Redis key scheme

stargazer:toggle:{feature}:{channel_key}

where feature is "emotions" or "rag" and channel_key is "{platform}:{channel_id}".

async feature_toggles.is_disabled(redis, feature, channel_key)[source]

Return True if feature is disabled for channel_key.

Return type:

bool

Parameters:
  • redis (redis.asyncio.Redis)

  • feature (str)

  • channel_key (str)

async feature_toggles.set_disabled(redis, feature, channel_key, disabled)[source]

Enable or disable feature for channel_key.

Return type:

None

Parameters:
  • redis (redis.asyncio.Redis)

  • feature (str)

  • channel_key (str)

  • disabled (bool)

feature_toggles.check_toggle_permission(msg, config)[source]

Return True if the user is allowed to toggle features.

Allowed when any of the following are true:

  1. The user is a bot admin (config.admin_user_ids).

  2. The user has server/channel admin privileges (Discord guild_permissions.administrator; Matrix power level ≥ 50).

  3. The channel is a DM.

Return type:

bool

Parameters: