Context
PR #1059 implemented token-based personality trimming via PromptProfile.max_personality_tokens. During review, a personality_trimming_notify setting and WsEventType.PERSONALITY_TRIMMED enum were initially added but removed because no code consumed them -- they were dead scaffolding.
This issue tracks implementing the complete notification feature as a unit.
Scope
Setting
- Add
personality_trimming_notify setting in the ENGINE namespace (boolean, default true, yaml_path="engine.personality_trimming_notify")
- Setting controls whether a WebSocket event is published when personality trimming activates
WebSocket event
- Add
WsEventType.PERSONALITY_TRIMMED = "personality.trimmed" enum member
- Decide which WS channel to publish on (likely
system or a new engine channel)
- Add
'personality.trimmed' to frontend WsEventType in web/src/api/types.ts
- If new channel: add to
WS_CHANNELS in frontend types and subscribe in the WebSocket store
Publisher
- In
AgentEngine._prepare_context, after logging PROMPT_PERSONALITY_TRIMMED, read the personality_trimming_notify setting and publish a WsEvent when enabled
- Payload:
agent_id, agent_name, task_id, before_tokens, after_tokens, max_tokens, trim_tier, budget_met
Frontend (optional, can be separate issue)
- Handle the event in the WebSocket store
- Display a toast or notification when personality trimming occurs
Tests
- Setting registration and defaults
- Publisher emits event when setting is
true
- Publisher suppresses event when setting is
false
- Frontend type sync
References
Context
PR #1059 implemented token-based personality trimming via
PromptProfile.max_personality_tokens. During review, apersonality_trimming_notifysetting andWsEventType.PERSONALITY_TRIMMEDenum were initially added but removed because no code consumed them -- they were dead scaffolding.This issue tracks implementing the complete notification feature as a unit.
Scope
Setting
personality_trimming_notifysetting in theENGINEnamespace (boolean, defaulttrue,yaml_path="engine.personality_trimming_notify")WebSocket event
WsEventType.PERSONALITY_TRIMMED = "personality.trimmed"enum membersystemor a newenginechannel)'personality.trimmed'to frontendWsEventTypeinweb/src/api/types.tsWS_CHANNELSin frontend types and subscribe in the WebSocket storePublisher
AgentEngine._prepare_context, after loggingPROMPT_PERSONALITY_TRIMMED, read thepersonality_trimming_notifysetting and publish aWsEventwhen enabledagent_id,agent_name,task_id,before_tokens,after_tokens,max_tokens,trim_tier,budget_metFrontend (optional, can be separate issue)
Tests
truefalseReferences