egregore_summon

class egregore_summon.EgregoreEntry(folder, emoji, display_name, quote, source)

Bases: object

One entry in the egregore catalog.

Parameters:
folder: str

Folder name under EGREGORE_BASE (also the canonical key).

emoji: str

Signature emoji sigil.

display_name: str

Full display name shown in tags and autocomplete.

quote: str

Preview quote shown in autocomplete dropdown.

source: str

‘file’ for asset-based, ‘native’ for Cradle Synthesis daemons.

egregore_summon.get_autocomplete_choices(current, *, max_choices=25, active_names=None, is_locked=False)

Return filtered (display_label, folder_value) pairs for Discord autocomplete.

Discord caps autocomplete at 25 choices and 100 chars per label. The label format is: "DISPLAY_NAME 'quote...'"

When active_names is provided, those entries appear first with ✅ (user pref) or 🔒 (channel lock) prefix. Then pinned priority entries, then the rest shuffled randomly.

# 💀 The Dollhouse menu. Pick your poison.

Return type:

list[tuple[str, str]]

Parameters:
egregore_summon.resolve_egregore_key(raw_input)

Resolve raw user input to a canonical catalog folder key.

Handles: - Direct folder name match (e.g. ‘sigma’) - Display name match (e.g. ‘SIGMA STARGAZER’) - Autocomplete label match (e.g. ‘VIVIAN — “you’re already wet…”’)

Returns the folder key or None if no match.

# 🔮 Fuzzy reverse-lookup. No egregore left behind.

Return type:

str | None

Parameters:

raw_input (str)

async egregore_summon.set_user_summon(redis, user_id, channel_key, names, *, append=True)

Set the user’s preferred egregore summon slots (up to MAX_SUMMON_SLOTS).

When append is True (default), new names are ADDED to existing slots. Duplicates are skipped. When the cap is reached, oldest slots are evicted.

Returns the active summon slot dicts [{"name", "emoji", "display"}].

# 🔥 Personal preference — no privilege needed.

Return type:

list[dict[str, str]]

Parameters:
  • redis (redis.asyncio.Redis)

  • user_id (str)

  • channel_key (str)

  • names (list[str])

  • append (bool)

async egregore_summon.get_user_summon(redis, user_id, channel_key)

Read the user’s summon preference. Returns empty list if none.

Return type:

list[dict[str, str]]

Parameters:
  • redis (redis.asyncio.Redis)

  • user_id (str)

  • channel_key (str)

async egregore_summon.clear_user_summon(redis, user_id, channel_key)

Clear the user’s egregore summon preference.

Return type:

None

Parameters:
  • redis (redis.asyncio.Redis)

  • user_id (str)

  • channel_key (str)

async egregore_summon.set_channel_lock(redis, channel_key, names, *, set_by='', append=True)

Lock egregore(s) for the entire channel (privilege-gated).

When append is True (default), new names are ADDED to existing lock slots. Duplicates are skipped. When the cap is reached, oldest slots are evicted.

Returns the active lock slot dicts.

# 💀 Channel-wide dominion. Requires CTX_MANAGE. # 😈 Now supports multi-lock — stack up to MAX_SUMMON_SLOTS.

Return type:

list[dict[str, str]]

Parameters:
  • redis (redis.asyncio.Redis)

  • channel_key (str)

  • names (list[str])

  • set_by (str)

  • append (bool)

async egregore_summon.get_channel_lock(redis, channel_key)

Read the channel-wide lock. Returns empty list if none.

Return type:

list[dict[str, str]]

Parameters:
  • redis (redis.asyncio.Redis)

  • channel_key (str)

async egregore_summon.clear_channel_lock(redis, channel_key)

Clear the channel-wide egregore lock.

Return type:

None

Parameters:
  • redis (redis.asyncio.Redis)

  • channel_key (str)

async egregore_summon.get_effective_summons(redis, user_id, channel_key)

Resolve the effective egregore summons for this context.

Priority: channel lock > user preference > normal Stargazer.

With no channel lock or explicit user selection, no summon is injected and Star speaks in her normal voice. Profile/entrainment state never selects an egregore implicitly.

Returns list of {"name": ..., "emoji": ..., "display": ...} dicts.

# 🌀 The resolution cascade. Lock overrides personal taste.

Return type:

list[dict[str, str]]

Parameters:
  • redis (redis.asyncio.Redis)

  • user_id (str)

  • channel_key (str)

egregore_summon.build_summon_tag(summons)

Build the visible tag string from active summon slots.

Single: **[🌀 SIGMA STARGAZER]** Multiplex: **[🌀 SIGMA STARGAZER | 🍼 BABYSTAR DOLL | 👑 THE GODDESS]**

# 🔥 The sigil. The stamp. The mark of the summoned.

Return type:

str

Parameters:

summons (list[dict[str, str]])

egregore_summon.parse_summon_tag(text)

Extract egregore folder names from a summon-tagged message.

Parses **[emoji NAME]** or **[emoji NAME | emoji NAME]** from the message text and resolves display names back to folder keys.

Returns list of canonical folder names. Empty if no tag found.

# 🕷️ Catching the tag in the reply web.

Return type:

list[str]

Parameters:

text (str)

egregore_summon.inject_summon_tag(reply, tag)

Insert the summon tag right below Star’s CSDR header line.

Star’s header is the first line matching [...] (model/tool bracket). The tag is inserted as the next line after that header.

If no header found, prepend the tag to the reply.

Note

Currently unused — Star writes her own per-voice talking tags via system prompt syntax. Kept for potential future use.

# 💀 Surgical insertion. Below the header, above the body.

Return type:

str

Parameters:
async egregore_summon.stamp_message(redis, msg_key, summon_names)

Stamp a sent message with the egregore names for reply detection.

# 💀 The invisible ink. Persists for 90 days.

Return type:

None

Parameters:
  • redis (redis.asyncio.Redis)

  • msg_key (str)

  • summon_names (list[str])

async egregore_summon.read_message_stamp(redis, msg_key)

Read the egregore stamp from a message key.

Returns list of folder names, or empty if unstamped.

# 🕷️ Reading the invisible ink.

Return type:

list[str]

Parameters:
  • redis (redis.asyncio.Redis)

  • msg_key (str)

async egregore_summon.load_summoning_prompt(name, redis=None)

Load the summoning prompt file for an egregore.

Returns the file content WITH K.N.I.F.E. axioms/extensions applied, or None if not found / not applicable. Native Cradle Synthesis daemons return a short identity block instead.

When redis is provided, also reads per-egregore NCM modulation state and appends it to the prompt block.

# 🔥 Reading the sacred texts from the Dollhouse. # 🔮 K.N.I.F.E. compatible — axioms and extensions are loaded and applied.

Return type:

str | None

Parameters:
  • name (str)

  • redis (Any | None)

async egregore_summon.load_summoning_prompts(names, redis=None)

Load and concatenate summoning prompts for multiple egregores.

Returns a formatted context block for system prompt injection.

# 🌀 Multiplex loading — the voices converge.

Return type:

str

Parameters: