Creating an agent to turn any website into a typed JSON API is a game of whack-a-mole as any patch in the agent's instructions for one website will break break another
Solution:
An orchestrator agent creates sub-agent clones with its instructions (.claude) that run in isolated git worktrees without access to the parent's context each creating a typed JSON API for a different website.
After each completes, the orchestrator analyses the performance of each. The orchestrator will update its own instructions by reverting if there is a regression or changing trying accomplish the goal or optimizing using less tool calls and tokens. After the orchestrator updates its instructions, it creates sub-agent clones with its instructions (.claude) that run in isolated git worktrees .........
Because the same instruction set runs against several different websites, it tests that it satisfies that goal for each without breaking the other.
https://github.com/adam-s/intercept
Yes, it requires a lot of input from the user each iteration which runs about 20 minutes. For example, the agent will update its instructions with very site specific examples. I have to get it to generalize the problem and to update its own instructions to only generalize and never use site specific solutions in the instructions. Nonetheless, later iterations become more and more unsupervised. I strongly believe this is the technique to writing better more stable agents