eca icon indicating copy to clipboard operation
eca copied to clipboard

Make Compact safer

Open zikajk opened this issue 11 months ago • 7 comments

Describe the bug I called compact, Gemini decided to use clojure_scratchpad instead, so i canceled it and ECA deleted my full conversation. We should have some check that will make sure LLM really called the tool as the last step before we delete the conversation

Expected behavior Do not clear conversation until we are 100% confident that compact was successful.

Maybe it would be better to prompt LLM (instead of calling the tool) on background and return only the status / compacted block of text to the chat window so there is no risk that model will call the wrong tool etc.

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

zikajk avatar Dec 19 '25 11:12 zikajk

Hum, that's bad, but yes, I believe only cleaning the conversation after summary worked would be a nice thing

ericdallo avatar Dec 19 '25 15:12 ericdallo

What do you think about ditching the tool approach? I see some risks with current approach: a) LLM can call it based on your prompt where you don't want it to. b) LLM might not use it when it should (as experienced with Google Gemini 3 Flash) c) User can disable it by a mistake (not yet, but with enabledTools it can happen)

Is it worth the work? If not, then I think we should make sure the reported problem can't happen and we also make a and c case not possible.

zikajk avatar Dec 21 '25 08:12 zikajk

What's the other approach if not using a tool call? I feel like the tool solves some problems like give the power to LLM call it passing the specified args, following the tool description and so.

ericdallo avatar Dec 21 '25 14:12 ericdallo

OpenAI has an endpoint. Anthropic doesn't use Tool and it is part of SDK and so on. This is a nice article, not fully relevant to the problem here though. https://factory.ai/news/evaluating-compression

Tbh. I don't see an advantage in tool having a description or specified args as the compact is already some predefined prompt + optional user details (but it it is a questionable how they are really useful).

I see two reasons why tool can be bad: a) LLM will run it without user asking for it (I've never seen it, so far so good). b) LLM doesn't call it on compact (reproduced).

But in this ticket we should probably just never remove the chat if the existing tool doesn't succeed as it seems like a simpler fix.

zikajk avatar Dec 22 '25 09:12 zikajk

yeah, I think we can experiment removing the tool leaving only the prompt if that proves to work with more LLMs and keep working with existing, I'm ok with that

ericdallo avatar Dec 22 '25 13:12 ericdallo

This can also happen:

[Trace - 2026-01-16T12:37:16.103Z] Sending notification 'chat/contentReceived' Params: { "chat-id" : "03232426-663a-45a9-85da-35cf2c42958f", "role" : "system", "content" : { "type" : "text", "text" : "Compacted chat to:\n\n" } }

zikajk avatar Jan 16 '26 12:01 zikajk

Closing this as a duplicate of fixed #142

ericdallo avatar Jan 19 '26 19:01 ericdallo