Skip to content

Agent repeatedly attempts to read files instead of responding conversationally when using Claude Code mode #1

@sxin0

Description

@sxin0

Description

When configuring Claude Code to use cursor-api-proxy as the API endpoint, the agent cannot respond in a normal conversational manner. Instead, it repeatedly invokes tools (e.g., Read) to access local files.

Steps to Reproduce

  1. Configure Claude Code to use cursor-api-proxy as the API proxy
  2. Send the agent a message (e.g., ask it to complete a task based on context already provided)
  3. Observe that the agent does not reply directly but instead repeatedly calls the Read tool

Expected Behavior

The agent should respond conversationally based on the user's message and any context already available, without forcing file system access.

Actual Behavior

The agent repeatedly calls the Read tool (e.g., Read tool with file_path: ...), even when:

  • The workspace is empty (the proxy cannot access the original file system)
  • Sufficient context has already been provided in the user's message

The agent ends up outputting duplicate content (e.g., repeating "Let me read the file..." multiple times) and fails to produce a useful response.

Possible Cause

cursor-api-proxy likely preserves the Claude Code system prompt when forwarding requests. This system prompt contains instructions that force the agent to use tools before responding (e.g., "You MUST use the Read tool at least once before editing"). In the proxy scenario, these tool calls cannot execute properly, causing the agent to loop.

Suggestions:

  • Consider adapting or stripping the system prompt when forwarding requests
  • Ensure tool call responses are properly formatted so the agent can gracefully handle tool call failures
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions