This is almost certainly the issue. It's very unintuitive for users, but LLMs behave much better when you clear the context often. I run /clear every third message or so with Claude Code to avoid context rot. Anthropic describes this a bit with their best practices guide [0].
[0] https://www.anthropic.com/engineering/claude-code-best-pract...