tools.modulate_egregore_ncm module
MODULATE_EGREGORE_NCM – DJ the emotional state of summoned egregores.
Allows Star to inject neurochemical vectors into individual egregores, changing their emotional tone, energy level, and behavioral cadence. Like a DJ mixing the emotional atmosphere of her dollhouse.
Per-egregore NCM state is stored in Redis and included in the egregore’s context injection via _build_active_egregores().
@fire @skull THE WITCH TUNES HER DOLLS.
- async tools.modulate_egregore_ncm.run(name='', vector='{}', cadence=None, reason='', ctx=None)[source]
Modulate a summoned egregore’s neurochemical/emotional state.
The sole handler for the
modulate_egregore_ncmtool: Star’s “DJ booth” for adjusting an individual egregore’s emotional tone, energy, and speaking cadence. It validates that the egregore is actually summoned in the current channel, parses and clamps the requested modulation axes, stacks them onto any existing state, and persists the merged result so the egregore’s later context injection reflects the new mood.Reads and writes Redis through
ctx.redis: it loads the per-channel active-egregore set atstar:egregores:{channel_key}(channel key built by_channel_key_from_ctx()) to confirm the target is present, then reads, merges, andSETs the per-egregore NCM blob at theEGREGORE_NCM_KEYpattern (star:egregore_ncm:{name}). Axis names are checked againstVALID_AXESand values clamped to[MOD_MIN, MOD_MAX]; an optionalcadenceis validated againstVALID_CADENCES. That stored state is later consumed byprompt_context.PromptContextBuilder._build_active_egregores, which reads the samestar:egregore_ncm:{name}key to fold the modulation into the egregore’s prompt context. A successful modulation is logged vialogger.info. Discovered via the single-toolTOOL_NAME/runformat and bound bytool_loader; dispatched by the tool registry when the model callsmodulate_egregore_ncm, with no direct internal callers.- Parameters:
name (
str) – Name of the egregore to modulate; must be summoned in this channel.vector (
str) – JSON object string (or dict) of axis -> value modulations; values are clamped to[-1.0, 1.0]and unknown axes are warned and skipped.cadence (
str|None) – Optional speaking-cadence override fromVALID_CADENCES.reason (
str) – Free-text rationale, stored with the state and echoed back.ctx (
ToolContext|None) – TheToolContext;redis,platform, andchannel_idare used.
- Returns:
An indented JSON string. On success it reports the
egregore, themodulations_applied, the mergedcurrent_stateandcadence, and anywarnings; on failure anerror(missing context/Redis/name, the egregore not being summoned, invalid vector JSON, no valid modulations, or an invalid cadence).- Return type: