Loading editor...
import Anthropic from '@anthropic-ai/sdk';
import { tools, runTool } from './tools';
const client = new Anthropic();
const messages = [{ role: 'user', content: 'The price test is failing, fix it' }];
while (true) {
const response = await client.messages.create({
model: 'claude-sonnet-5-5',
max_tokens: 8000,
system: 'You are a coding agent. Use the tools to read, run and change code.',
tools,
messages,
});
messages.push({ role: 'assistant', content: response.content });
// No tool call means the model has its answer
if (response.stop_reason !== 'tool_use') break;
const results = [];
for (const block of response.content) {
if (block.type !== 'tool_use') continue;
const output = await runTool(block.name, block.input);
results.push({ type: 'tool_result', tool_use_id: block.id, content: output });
}
messages.push({ role: 'user', content: results });
}runTool is where the harness does its work: it runs the command, reads the file and returns the output as text. Claude Code has dozens of tools, permission prompts and a terminal UI around this loop. The loop itself doesn't change.Loading editor...
{
"name": "Edit",
"description": "Replace old_string with new_string in a file. old_string must appear in the file exactly once.",
"input_schema": {
"type": "object",
"properties": {
"file_path": { "type": "string" },
"old_string": { "type": "string" },
"new_string": { "type": "string" }
},
"required": ["file_path", "old_string", "new_string"]
}
}src/price.ts from the session above. Pick a preset or type your own:old_string from memory is a gamble. When an edit fails, the error goes back to the model as text, it reads the file again and retries. That's 2 more requests./clear in Claude Code. The old task's files and test output only take space.Focus on customers and sales while we handle product delivery. Hire a dedicated AI maker or a whole product team.