Recursive Self-Improvement Loop for Agent Tooling

James Phoenix
James Phoenix

Core idea

A high-leverage loop for agentic engineering is:

  1. Let agents use your custom CLI/tools in real tasks
  2. Observe where they fail, hesitate, or misuse interfaces
  3. Convert those learnings into improved skills/instructions/tool UX
  4. Feed those improvements back into the next agent runs
  5. Repeat quickly

This creates a practical form of in-context recursive self-improvement: the system gets better at using itself through tight feedback cycles.

Why this matters

  • You improve the operating layer (skills, prompts, wrappers), not just one task outcome.
  • Reliability compounds: fewer repeated tool mistakes over time.
  • Agents become more autonomous because instructions and tool affordances become clearer and more deterministic.

Practical implementation pattern

  • Capture run telemetry: failed commands, retries, ambiguity points.
  • Maintain a small error/lesson log per tool.
  • Update skill docs + tool wrappers after each significant failure class.
  • Add explicit examples for common edge cases.
  • Re-run with the new skill context and compare failure rate.

Suggested metric stack

  • Tool-call success rate
  • Retries per task
  • Time-to-completion per workflow
  • Human intervention count
  • Recurring failure fingerprint count

Opinionated takeaway

The strongest “alpha” is not any single prompt trick — it is a disciplined loop where agent behavior continuously improves from real tool-use traces.


Source post: https://x.com/doodlestein/status/2035233207965122943
Author: Jeffrey Emanuel (@doodlestein)

Leanpub Book

Read The Meta-Engineer

A practical book on building autonomous AI systems with Claude Code, context engineering, verification loops, and production harnesses.

Continuously updated
Claude Code + agentic systems
View Book


Related reading: my field guide to context engineering, and the Context Engineering Dictionary.

Topics
Agent ReliabilityAgent SkillsAutomationDeveloper ExperienceLong Running Agents

Newsletter

Become a better AI engineer

Weekly deep dives on production AI systems, context engineering, and the patterns that compound. No fluff, no tutorials. Just what works.

Join 306K+ developers. No spam. Unsubscribe anytime.


More Insights

Cover Image for Measuring Coding Agent Leverage

Measuring Coding Agent Leverage

Token volume measures spend, not output. Leverage is what your agents turn into verified, valuable change per unit of human attention, compute, and rework, and no single number captures it. You have to triangulate from several points of view.

James Phoenix
James Phoenix
Cover Image for Using DSL Languages for LLM Harnesses

Using DSL Languages for LLM Harnesses

Unmesh Joshi’s article [DSLs Enable Reliable Use of LLMs](https://martinfowler.com/articles/llm-and-dsls.html) (martinfowler.com, July 2026) names the endgame of something I have been documenting piecemeal for a year: the smaller the language you make the model speak, the less room it has to be wrong.

James Phoenix
James Phoenix