How to fix agent harness code written for older models with /claude-api harness-audit in Claude Code
Claude Code 2.1.335 (December 3) added /claude-api harness-audit. It finds harness code in your Claude API agent that was written for older models and proposes fixes as a diff. The changelog names loop limits, sub-agents, context management, injected reminders and session-start code.
- Check your version.
claude --version
- Open Claude Code in your agent's project folder and type the command.
/claude-api harness-audit
- Read the diff and apply only the parts you accept.
Instructions for older models left in prompts, skills and tool descriptions are the job of /claude-api prompt-audit (2.1.221 or later). Since 2.1.335, prompt-audit also flags broad ask-first rules, always-delegate instructions and "treat earlier answers as done" lines. harness-audit isn't in the skills docs' subcommand table yet; it appears only in the changelog.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.