What
It could be useful, if ECA could announce into the chat session itself, that the context is "getting closed to filled", allowing the current agentic flow to potentially react on that. For example, agentic task can be prompted in that way, that `if you see that we're getting close to context compaction, pause your current work and store all the precious task details into your task.md file, so it doesn't get lost on compaction".
How - configuration (very approximate, just for the general idea)
{
"contextNotifications": {
"thresholds": [70, 85],
"template": "[eca] Context at {percent}% ({used}/{limit} tokens, compaction at {compactAt}%)."
}
}
How - approximate behavior:
- ECA evaluates the context usage after each turn.
- When the usage crosses a threshold for the first time, ECA appends one message to the conversation.
- ECA appends the message. It does not rewrite earlier content. Prompt caching stays valid.
- ECA fires each threshold one time only per chat session. After a compaction, the thresholds reset.
- Without a template, ECA appends a neutral status line only.
- Without contextNotifications, the behavior does not change. The feature is off by default.
Backstory and discussion (slack) :
https://clojurians.slack.com/archives/C093426FPUG/p1789028953654579
Notes from Akiz:
Yeah, the template should be probably handled like others. I guess we can go just with one message here. But if we want to repeat when it changes from 90% to 95% for example then I would go with the repeated message that is not part of the history (which shouldn't invalidate the cache). Both is possible. Maybe the simpler approach is enough.
Maybe wait with any code analysis until memory ships as it sounds like something it might profit from some new abstractions. I am also wondering if models will try to call eca_compact when they will see this threshold
What
It could be useful, if ECA could announce into the chat session itself, that the context is "getting closed to filled", allowing the current agentic flow to potentially react on that. For example, agentic task can be prompted in that way, that `if you see that we're getting close to context compaction, pause your current work and store all the precious task details into your task.md file, so it doesn't get lost on compaction".
How - configuration (very approximate, just for the general idea)
{ "contextNotifications": { "thresholds": [70, 85], "template": "[eca] Context at {percent}% ({used}/{limit} tokens, compaction at {compactAt}%)." } }How - approximate behavior:
Backstory and discussion (slack) :
https://clojurians.slack.com/archives/C093426FPUG/p1789028953654579
Notes from Akiz: