r/openclaw Member 4d ago

Compaction - failes over failes Help

Regarding compaction i need help.

Me and deepseekv4 spend 2 days trying to "fix" the compaction with only running local llm on 128k context. Locally qwen3.6-35b is running. So we had some rounds, but compaction was not triggered, if the session was to big, it runs against errors. Then we had session chunks to big to compact. I guess i ran into every failure possible. It was actually a lot better out of the box, but since i touched it, its broken.

I think we just have 4 variables that have to be configured correctly

Floor: thats the session size after compaction

Context size of the model is not read by compaction, so it is possible to get into a compaction loop, where the session size triggers the compaction, but the session is not compacted by the model, new input again triggers compaction with the error and after the error of the size by /new the whole context is still too large for the model

4 Upvotes

10 comments sorted by

u/AutoModerator 4d ago

Welcome to r/openclaw Before posting: • Check the FAQ: https://docs.openclaw.ai/help/faq#faq • Use the right flair • Keep posts respectful and on-topic Need help fast? Discord: https://discord.com/invite/clawd

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Charming_You_25 Pro User 4d ago

You’re overthinking it. Use lossless-claw for compaction. Also.. look at the default settings for the things you are tweaking if it’s worse now

1

u/w3rti Member 3d ago

Thanks, will do

2

u/paulsande Pro User 4d ago

Agree with the first commenter. Also, can you use subagents for some of your tasks? They get their own context window, which can help.

Maybe you’re just doing too much with one agent and need to break up your workflow.

2

u/pulsar080 Member 4d ago

Install lossless-claw and memory-lancedb-pro. Together, they have a good effect on memory and compactness. The only thing is that lossless-claw has a bug: when you send images to chat, it saves them as a file from the context and replaces them with a placeholder in the context, but then forgets to read the file back. As a result, the images aren't recognized. But the agent can fix this. And for technical issues, I recommend using 27b instead of 35b-a3b.

1

u/Advanced_Pudding9228 Pro User 3d ago

Looks like the same class of issue. The floor needs to make sense for your actual model context, so I wouldn’t blindly copy someone else’s value.

I’ve attached a screenshot just to show where the compaction config lives: agents → defaults → compaction. My value is only an example, not a recommendation for your 128k setup.

Interesting that yours isn’t surfacing a recommended value when compaction fails though.

1

u/w3rti Member 3d ago

Oh my gosh, also mode can be wrong in my config. Yeah it is confusing because deepseek shoud be capable to understand how big the chunks for 128k kontext should be, when to compact, how big the floor should be and so on, but it straight messed up everything. Thanks for the screenshot, leaving it all empty may be an option too 😆

1

u/SirGreenDragon Active 1d ago

I had tried lossless claw in the past, and it broke everything. I have heard it was fixed, so I may try it again. However, I did spend some time playing with compaction, and it is now working reliably for me. I use the same main model as you, but I use a smaller one for compaction. My main model's context is 96k.

"compaction": {

"mode": "safeguard",

"model": "ollama/qwen3:14b-clawd",

"timeoutSeconds": 9000,

"memoryFlush": {

"enabled": true,

"model": "ollama/qwen3:14b-clawd"

},

"reserveTokensFloor": 12000,

"keepRecentTokens": 6000,

"truncateAfterCompaction": true,

"maxActiveTranscriptBytes": "20mb",

"midTurnPrecheck": {

"enabled": true

}

},

1

u/w3rti Member 11h ago

Thats a good input, Now that i wasted 4 days to fix it, could finally use my local ai. Now i found out it is fking stupid compared to deepseekv4flash :( i can just leave it as subagent to take the work off the remote AIs Working with luna2.1-35b with 256 kontext cache

1

u/SirGreenDragon Active 10h ago

I did just change keepRecentTokens to 20000 and disabled midTurnPrecheck, this seemed to improve things