I thought the “AI agent” hype was another layer of marketing until I started using Claude Code on daily production work. The usual advice is to write better prompts, which does not get you far in a complicated WordPress repository. Without a feedback loop you are babysitting a tool that wipes its own memory every time you close the terminal.
How well you phrase a prompt matters less than what the agent tells itself after you have logged off. So I stopped treating Claude Code as a smart chatbot and started treating it like a junior developer who gets a nightly performance review. Here is how that runs on my machine.
The Claude Code self-reflection loop
The part that wears me down is watching the same mistake come back. Claude reaches for a deprecated WooCommerce function, I correct it, and three sessions later it reaches for the same function again. So I wrote a self-reflection skill into my ~/.claude/skills/ directory.
The skill is called review-past-performance, and it makes the agent read back through the last 24 hours of logs. It looks for wrong tool calls, context it loaded and never used, and logic errors. Whatever it finds gets written into my global agents.md as a new rule.
# SKILL.md
# Description: Reviews interactions from the last 24 hours to optimize future workflows.
Review my last interactions with Claude Code from the last 24 hours.
Look for any logic gaps, unnecessary tool calling, or repeated mistakes.
Create a plan for optimization and update the local .claude/agents.md
to ensure these patterns are codified as permanent constraints.
There is a longer version of this in my guide on how to make Claude Code learn from its own mistakes, which covers the prompt wording behind autonomous debugging in more detail.
Automating the feedback loop with cron
I am not going to trigger that review by hand every morning, so a cron job does it at 2 AM. The script opens a headless Claude Code session, runs the review skill, and commits anything it changed to my internal Claude knowledge base.
#!/bin/bash
# Nightly AI Optimization Script
cd ~/Sites/my-main-project
claude run "review-past-performance" --non-interactive
git add .claude/agents.md
git commit -m "chore: ai-optimized workflow updates"
I wake up to an agent that knows more than it did the day before. It has written down, for one, that a client’s legacy codebase has a race condition in the checkout hook and that it should leave that hook alone. Notes like that save me hours of back and forth in the terminal.
Managing parallel Claude Code agents
Past about seven agents in parallel, I lose the thread. I have tried the fancier IDEs and I always come back to Warp with split panes. The “Recap” feature, which showed up recently in the official Claude Code documentation, is what keeps those panes readable.
I also let the agent ask me the questions instead of the other way around. My agents are told to keep working on their own and to stop only when an architectural decision needs a human. Working that way is what keeps the context switching from wearing me out.
If this Claude Code setup is eating hours you would rather spend shipping, I can take it off your plate. I have been wrestling with WordPress since the 4.x days.
Start with the feedback loop
Your bottleneck is a missing feedback loop, not the model’s intelligence. Write your preferences down as skills and let a cron job run the review overnight, so tomorrow’s session starts where today’s ended. The correcting I used to do by hand now happens while I am asleep.