So Apparently I've Been Using Claude Wrong This Whole Time

Oct 29, 2025

Create Memory
Screenshot of the Article 'Effective context engineering for AI agents'

Ever been writing automated tests with an AI code assistant, only to have it completely forget the framework you're using? Or start generating tests that don't match your page object patterns? Yeah, me too. Turns out we've all been using these AI tools wrong.
Anthropic just released a paper on "context engineering" that completely changed how I work with Claude for test automation. Here's what actually works.

The Real Problem
AI tools have a "context window"—basically short-term memory. When your conversation gets too long (discussing test frameworks, locator strategies, CI/CD integration), that memory fills up. Then the AI starts hallucinating and forgetting your automation patterns.

The fix isn't a better AI. It's using what we have smarter.

Fix #1: The Reset Button (Compaction)

Think of this like clearing your test data between test runs.
Compaction: summarizes your conversation, keeps the important stuff, tosses the rest. Fresh memory, but the AI still remembers your framework and patterns.
Just type the `compact` command when things get messy. I went from 92% memory used to 36% in one command.

Pro tip: Do this between major features—after setting up your framework, before adding new test suites, etc.

Fix #2: The claude.md File (Your Automation Standards Bible)

This one's a game-changer for test automation.
Create a `claude.md` file in your project with:
- Framework you're using (Playwright, Cypress, Selenium?)
- Your patterns (Page Object Model? screenplay pattern?)
- Locator strategies (data-testid preferred, no XPath)
- CI/CD setup and requirements

Now every new session, Claude already knows your automation standards. No more re-explaining "we use data-testid selectors" for the 50th time.

Fix #3: Let It Take Notes

Instead of making the AI remember everything, have it maintain files:
- test-progress.md – What's automated, what's left
- flaky-tests.md – Known flaky tests and why
- framework-decisions.md – Why you structured things certain ways

The AI can check these anytime without clogging its memory. It's like maintaining proper test documentation.
Tell Claude to update these after generating test code. Suddenly you have self-documenting automation coverage.

Fix #4: Multiple AI Agents (For Complex Frameworks)

This one's for the big automation projects.
Instead of one AI doing everything, have a team: one agent writes page objects, another creates test cases, another handles utilities and helpers. A "lead" agent coordinates them all.
I tried this setting up a new test framework. One prompt gave me proper page objects, reusable test data factories, AND CI/CD configuration—all properly structured.
Warning: This is slower. Only use it for comprehensive framework setup, not quick test additions.

Which One for Test Automation?
Quick guide:
- Long framework discussion? → Compaction
- Same automation project over weeks? → claude.md file
- Building entire test framework? → Multiple agents
- Daily test writing? → Note-taking files

Mix them. I keep a claude.md with our framework patterns, use note-taking for active sprints, and hit compact when context gets heavy.

Why Automation Engineers Should Care
Here's the thing: AI can massively speed up test automation, but only if it remembers your patterns and standards. Senior automation engineers know this—consistency is everything in test code.
These tricks make your AI remember your framework like a senior SDET, not a junior writing their first Selenium script.

Try It Tomorrow

Pick ONE of these for your next automation session:
- Create a simple claude.md with your framework and patterns
- Or just try the `compact` command when your chat gets long

You'll notice the difference immediately. The AI will actually maintain your page object structure instead of randomly mixing patterns or using terrible locators.

----------
The Paper: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents

CPTO of Epic Test Quest
Co-Founder and CTPO @Epic Test Quest | Conference speaker on AI and Quality Leadership | Long-time tester | Building tools testers actually enjoy using | Join the quest to level up software quality
Simon Tomes
Fascinating insight and learnings. Thanks for sharing!

Martin Mitrev
Saving this for future reference. Thanks!

Christine Pinto
Glad you two like it, trying to figure out how to share my journey and learning with claude code and other AI tools. Maybe more micro blogs, a video, an article or course, I don't know yet

Nataliia Burmei
That's awesome. Thank you. I am going to try some. I was aware of agents.md (https://agents.md/) in repos to give any agent instructions how to structure code and what coding principles to follow. I am using Cursor and I know there is context capacity, when it reaches 100%, you need to open a new window. I never reached 100% and I didn't know what it actually means. Maybe that's the top point before AI starts hallucinate.

Sign in to comment
Explore MoT
Don’t Be Left Behind: Close the Gap Between Test and Delivery image
Wed, 12 Nov
Align testing and delivery to reduce lead time and improve deployment frequency.
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
This Week in Quality image
Debrief the week in Quality via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter
We'll keep you up to date on all the testing trends.