Back to DevLog

Building Context Protection: How I Stopped Accidentally Wiping My AI Documentation

3 min read

Had one of those productive cowork sessions today where we tackled multiple moving pieces at once. Started with a live SEO issue on one of our plumber sites, but it turned into something way more interesting — building infrastructure to protect my AI context files.

The SEO Detective Work

Jumped into plumber.gethoneybun.com because the schema markup was completely wrong. Instead of showing up as a local plumbing business, it was outputting HoneyBun as a SoftwareApplication. Not exactly what you want when you're trying to rank for "emergency plumber near me."

The fix was straightforward once I tracked down the duplicate schema generation. Had two files fighting each other — seo.php and hb-seo-enhancements.php were both trying to output Organization schema. Classic case of "works on my machine" turning into production weirdness.

Now the schema properly outputs LocalBusiness with all the good stuff: vertical-specific @type, OfferCatalog, AggregateRating. Should help these sites actually show up in local search results.

The Real Win: Context Protection

But here's what got me excited — I finally built the infrastructure I've been thinking about for weeks. You know how when you're working with AI assistants, you end up with these crucial CLAUDE.md files that contain all your project context? And you know how easy it is to accidentally overwrite them and lose hours of carefully crafted architecture documentation?

Yeah, I was tired of that anxiety.

Built a pre-commit hook that blocks any CLAUDE.md changes over 60%. Simple bash script that diffs the staged file against HEAD and says "nope" if you're about to nuke your context. It's like version control for your AI's memory.

# The magic threshold - prevents accidental context wipes
if [ "$change_percentage" -gt 60 ]; then
  echo "🚫 CLAUDE.md change too large (${change_percentage}%)" 
  exit 1
fi

The /update-context Ritual

Also standardized my wrap-up workflow. Instead of ad-hoc context updates, I now have a /update-context command that walks through the session systematically:

  • What got built/fixed
  • Architecture decisions made
  • Current deployment status
  • Next steps

It's like having a structured retrospective built into my development flow. Turns out when you're building in public, having consistent session documentation is clutch.

What's Left

The schema fix is committed but not deployed yet — need to push it to Cloudflare Workers. And I built these pre-commit hooks but haven't actually installed them locally yet (classic developer move).

But the foundation is solid. Both repos now have proper CLAUDE.md files with architecture context, the plumbers vertical has its own dedicated documentation, and I've got guardrails to prevent context catastrophes.

Sometimes the best sessions are the ones where you fix the immediate problem but also build the infrastructure to prevent entire classes of future problems. This was one of those days.

Share this post