This is the #1 problem everyone hits. Here's what actually works:
→ Your core files (MEMORY.md, SOUL.md, IDENTITY.md) need to be TIGHT. Under 200 lines for memory. If those files are messy, everything downstream gets messy fast.
→ Lower your context window. Don't let it balloon to max. 200K is plenty. When it compacts at 50-60K, you lose quality.
→ Reduce how many past messages it loads. Default in Slack is 30 — I dropped mine to 10. Most tasks complete within 10 messages.
→ Have it SAVE work before it compacts. This is huge. Train it to write progress to a file before the context gets wiped.
Think of it like this: your agent's memory is a whiteboard. A small, clean whiteboard beats a massive cluttered one every time.
The people who get frustrated with AI agents almost always have a file problem, not a model problem. Either you need a file, it's in the wrong place, or the info is in the wrong file.