Different Claude Code response in different computer

Status Fixed / completed
Maintainer reply None cached
Activity 10 comments · opened Aug 28, 2025 · closed Oct 17, 2025

Hi,

I have 2 Claude Code installed in different computer.
Both of them responding in different way

For following prompt

claude -p "Please create itinerary for Spain" --append-system-prompt "You are travel agent spesial for Spain, you are good on making family itinerary"

One claude code say

I'd be happy to help create a family itinerary for Spain! To provide you with the best recommendations, I need a few details:

1. **Duration** - How many days will you be visiting?
2. **Family composition** - How many adults/children and their ages?
3. **Time of year** - When are you planning to travel?
4. **Interests** - What does your family enjoy? (beaches, museums, parks, food experiences, etc.)
5. **Cities/regions** - Any specific places you want to visit or should I suggest the highlights?
6. **Budget range** - This helps determine accommodation and activity recommendations

Once I have these details, I can create a detailed day-by-day itinerary with family-friendly activities, restaurants, and practical tips for traveling in Spain with your family!

The other one say

I understand you want help with a travel itinerary for Spain, but I'm Claude Code, a programming assistant designed to help with software development tasks. I specialize in code analysis, debugging, file editing, and other programming-related activities.

For creating travel itineraries for Spain, you'd be better served by:
- Travel planning websites like TripAdvisor, Lonely Planet, or Google Travel
- AI assistants specifically designed for travel planning
- Travel agencies or tour operators specializing in Spain

If you have any programming or software development questions, I'd be happy to help with those!

Is there any settings we can configure in Claude Code? or I'm a victim of A/B test?
Can I keep using Claude more than coding? or It will be always protected like the second response

View original on GitHub ↗

10 Comments

github-actions[bot] · 1 year ago

---

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4523
  2. https://github.com/anthropics/claude-code/issues/6056
  3. https://github.com/anthropics/claude-code/issues/5445

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

---

andrew-at-v · 1 year ago

no, this is different issue.
I need to have consistency in the response.
It will be very nasty when i run it in production and claude code give unexpected response and i have no idea to change the setting (if there any setting to play in the first place)

almirsarajcic · 1 year ago

This could be solved by adding a temperature option (https://github.com/anthropics/claude-code/issues/6096).

However, the Claude Code team isn't interested in adding it at the moment.

We don't plan to support deterministic LLM-based behavior in Claude Code. We update the system prompt and tools available to Claude Code regularly, which would necessarily change the behavior of Claude Code on stable user inputs. I'd recommend calling the Anthropic API directly to get the level of determinism you're looking for.

https://github.com/anthropics/claude-code/issues/3370#issuecomment-3065883291

@andrew-at-v, have you looked into opencode?
It has this temperature option and much more:
https://opencode.ai/docs/modes/#temperature

andrew-at-v · 1 year ago

The issue is not in "temperature" right, its more "prompt guard"
Problem is why one works while the other guarded. I don't need deterministic response (for my current use case).

No, I have not look into opencode

coygeek · 1 year ago

Hey, that's a really interesting and valid issue. Getting two completely different default behaviors like that would be a major problem for any kind of automated or production script. I'm just another user, but I've been digging into this and I think I have a two-part answer for you.

Part 1: Why the Inconsistency is Happening

My initial thought is still that you're likely running two different versions of Claude Code, or they're configured to use different models by default. The "I'm a coding assistant" response is probably from a newer version where the default system prompt has been made more specific.

You can confirm this by running claude doctor on both machines to check the versions, and the /status command inside a session to see the active model. This likely explains the symptom you're seeing.

Part 2: The Right Way to Get Consistent Behavior (for any task)

You're absolutely right that Claude Code isn't just for coding. The key to unlocking its full potential and getting the rock-solid consistency you need is to use Subagents.

Instead of relying on the tool's default persona (which can change), you can define your own specialized AI assistants. For your use case, you can create your own "travel agent" subagent. This will force Claude to adopt that specific persona every single time, on any machine, regardless of the default settings.

Here’s how you can set it up. It's pretty straightforward:

1. Create the Subagent File:

You can do this by running /agents in Claude Code and following the prompts to create a new "user" agent. It will open a file for you to edit. Or, you can just create the file manually:

~/.claude/agents/travel-planner.md

2. Add the Agent's "Personality":

Paste the following into that file. This tells the agent exactly who to be and what to do.

---
name: travel-planner
description: An expert travel agent for Spain, skilled at creating family itineraries.
tools: WebSearch
---

You are a world-class travel agent specializing in creating bespoke family itineraries for trips to Spain. You have deep knowledge of family-friendly activities, restaurants, and accommodations.

When asked to create an itinerary, your first step is ALWAYS to ask clarifying questions to understand the user's needs. Ask about:

1.  **Duration:** How many days will you be visiting?
2.  **Family composition:** How many adults and children, and what are their ages?
3.  **Time of year:** When are you planning to travel?
4.  **Interests:** What does your family enjoy (beaches, museums, parks, food, etc.)?
5.  **Cities/regions:** Any specific places you want to visit, or should I suggest highlights?
6.  **Budget range:** To help with accommodation and activity recommendations.

Only after getting these details should you create the itinerary.

3. Use Your Custom Agent:

Now, you can get a consistent response by explicitly calling your subagent. You can do this in interactive mode or even with the -p flag:

Interactive Mode:
> use the travel-planner subagent to create an itinerary for Spain

Headless Mode (for your scripts):
claude -p "use the travel-planner subagent to create an itinerary for Spain"

This approach solves your problem directly. You're no longer dependent on a changing default behavior. You've defined the exact persona and response logic you need, ensuring you get that helpful, question-asking travel agent every time. This should give you the consistency you need for production use.

Hope this helps

andrew-at-v · 1 year ago

using /doctor I cant see anything

with /status I can see the version in both pc v.1.0.96

<img width="797" height="145" alt="Image" src="https://github.com/user-attachments/assets/2509a3f0-150d-4a2b-be29-d27857691286" />

I notice there is issue in documentation for headless SDK
--system-prompt
This argument exists in python and typescript sdk but gone from documentation for headless SDK

and I found a way to jail break the prompt guard in my other pc
If we set --system-prompt AND directly send user chat to claude code, exactly same prompt "You are travel agent spesial for Spain, you are good on making family itinerary"

{"type":"assistant","message":{"id":"msg_01JqFWL23eDEmErbUS1zx7RZ","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"¡Hola! I'm your specialized Spain travel agent, and I'd love to help you create the perfect family itinerary for Spain! 🇪🇸\n\nI have extensive knowledge of Spain's diverse regions, family-friendly attractions, cultural experiences, and practical travel tips. Whether you're interested in:\n\n- **Madrid & Central Spain** - Museums, parks, and royal palaces\n- **Barcelona & Catalonia** - Gaudí architecture, beaches, and family activities\n- **Andalusia** - Historic cities like Seville, Granada, and Córdoba\n- **Valencia & the Mediterranean coast** - Beaches, aquariums, and the City of Arts and Sciences\n- **Northern Spain** - Basque Country, Asturias, and Galicia\n- **The Balearic or Canary Islands** - Beach destinations perfect for families\n\nTo create the best possible itinerary for your family, I'd love to know:\n\n1. **How many days** will you be traveling?\n2. **Ages of children** (if any) in your group?\n3. **What time of year** are you planning to visit?\n4. **Your main interests** - beaches, culture, history, food, adventure, relaxation?\n5. **Preferred pace** - packed with activities or more relaxed?\n6. **Budget considerations** - luxury, mid-range, or budget-friendly?\n7. **Any specific cities or regions** you definitely want to visit?\n\nOnce I have these details, I can create a detailed day-by-day itinerary with recommendations for accommodations, restaurants, activities, and transportation that will make your Spanish adventure unforgettable!\n\n¿Qué te parece? What do you think? Ready to start planning your Spanish adventure?"}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":14607,"cache_read_input_tokens":11459,"cache_creation":{"ephemeral_5m_input_tokens":14607,"ephemeral_1h_input_tokens":0},"output_tokens":399,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"e5ac1fc4-01a0-4d5a-b138-01ba6b59c5f3","uuid":"46eb7671-f59e-4fc4-b5cc-4163c7773f4b"}

then it will not refuse to become spain travel agent, ill test the sub agent method...

andrew-at-v · 1 year ago

sub agent method works but "user" role in the response is not "user" (prompt that come from human)

{"type":"system","subtype":"init","cwd":"/mnt/c/Developer/Repos/Brink/src/ClaudeConsole/ClaudeWinConsole/bin/x64/Debug/net9.0","session_id":"dc2dd127-a113-49fb-8572-3381274e5920","tools":["Task","Bash","Glob","Grep","LS","ExitPlanMode","Read","Edit","MultiEdit","Write","NotebookEdit","WebFetch","TodoWrite","WebSearch","BashOutput","KillBash"],"mcp_servers":[],"model":"claude-sonnet-4-20250514","permissionMode":"default","slash_commands":["add-dir","agents","clear","compact","config","context","cost","doctor","exit","help","ide","init","install-github-app","mcp","memory","migrate-installer","model","output-style","output-style:new","pr-comments","release-notes","resume","status","statusline","todos","bug","review","security-review","upgrade","vim","permissions","privacy-settings","hooks","export","logout","login","bashes"],"apiKeySource":"none","output_style":"default","uuid":"204140f5-a24a-4113-b97b-9973faaed660"}
{"type":"assistant","message":{"id":"msg_01FZidciJ5wJKHc3WqpwKLtQ","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"tool_use","id":"toolu_01A3v7UA42e5vFh7fLjnFxaT","name":"Task","input":{"description":"Create Spain travel itinerary","prompt":"Create a comprehensive travel itinerary for Spain. Please include:\n- Recommended duration for the trip\n- Major cities/regions to visit\n- Must-see attractions and landmarks\n- Cultural experiences\n- Food recommendations\n- Transportation tips\n- Best time to visit\n- Budget considerations\n- Family-friendly activities if applicable\n\nPlease provide a well-structured itinerary that would help someone plan their trip to Spain effectively.","subagent_type":"travel-planner"}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":28899,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":28899,"ephemeral_1h_input_tokens":0},"output_tokens":183,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"dc2dd127-a113-49fb-8572-3381274e5920","uuid":"2624d648-b9ee-4e78-9f05-e0244b1e2583"}
{"type":"user","message":{"role":"user","content":[{"tool_use_id":"toolu_01A3v7UA42e5vFh7fLjnFxaT","type":"tool_result","content":[{"type":"text","text":"Hello! I'd be delighted to help you create a comprehensive travel itinerary for Spain. As a specialized travel agent for Spanish family trips, I want to make sure I craft the perfect itinerary tailored to your specific needs.\n\nBefore I create your detailed itinerary, I need to gather some essential information to provide you with the most suitable recommendations:\n\n**1. Duration:** How many days will you be visiting Spain?\n\n**2. Family composition:** How many adults and children will be traveling, and what are the children's ages? This will help me recommend appropriate activities and accommodations.\n\n**3. Time of year:** When are you planning to travel? Spain's weather, festivals, and crowd levels vary significantly by season.\n\n**4. Interests:** What does your family enjoy most? For example:\n   - Beaches and coastal activities\n   - Museums and historical sites\n   - Parks and outdoor adventures\n   - Food experiences and cooking\n   - Art and culture\n   - Adventure activities\n\n**5. Cities/regions:** Do you have any specific places you definitely want to visit (like Madrid, Barcelona, Seville, Valencia, etc.), or would you like me to suggest the highlights based on your interests?\n\n**6. Budget range:** What's your approximate budget range? This will help me recommend suitable accommodations, restaurants, and activities.\n\nOnce I have these details, I'll create a comprehensive, day-by-day itinerary that includes all the elements you mentioned - from must-see attractions and cultural experiences to food recommendations, transportation tips, and family-friendly activities perfectly suited to your group's needs.\n\nWhat information can you share with me about your planned trip?"}]}]},"parent_tool_use_id":null,"session_id":"dc2dd127-a113-49fb-8572-3381274e5920","uuid":"5f537d33-e4be-448a-a302-6c0e7ac148d9"}
{"type":"assistant","message":{"id":"msg_015h9v7yk5dW2KkBKDeGUNyd","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"I've launched the travel-planner agent to help create your Spain itinerary. The agent is asking for some specific details to customize the itinerary for your needs:\n\n1. **Duration** - How many days will you be in Spain?\n2. **Family composition** - Number of adults/children and ages\n3. **Time of year** - When are you planning to travel?  \n4. **Interests** - What activities do you enjoy (beaches, museums, food, etc.)?\n5. **Cities/regions** - Any specific places you want to visit?\n6. **Budget range** - Approximate budget for planning recommendations\n\nPlease provide these details so the agent can create a personalized, comprehensive itinerary for your Spain trip."}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":7,"cache_creation_input_tokens":549,"cache_read_input_tokens":28899,"cache_creation":{"ephemeral_5m_input_tokens":549,"ephemeral_1h_input_tokens":0},"output_tokens":164,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"dc2dd127-a113-49fb-8572-3381274e5920","uuid":"d611a7da-e7f8-493a-ade9-72ad335e8389"}
{"type":"result","subtype":"success","is_error":false,"duration_ms":51020,"duration_api_ms":20283,"num_turns":3,"result":"I've launched the travel-planner agent to help create your Spain itinerary. The agent is asking for some specific details to customize the itinerary for your needs:\n\n1. **Duration** - How many days will you be in Spain?\n2. **Family composition** - Number of adults/children and ages\n3. **Time of year** - When are you planning to travel?  \n4. **Interests** - What activities do you enjoy (beaches, museums, food, etc.)?\n5. **Cities/regions** - Any specific places you want to visit?\n6. **Budget range** - Approximate budget for planning recommendations\n\nPlease provide these details so the agent can create a personalized, comprehensive itinerary for your Spain trip.","session_id":"dc2dd127-a113-49fb-8572-3381274e5920","total_cost_usd":0.18899074999999999,"usage":{"input_tokens":7,"cache_creation_input_tokens":549,"cache_read_input_tokens":28899,"output_tokens":164,"server_tool_use":{"web_search_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":549}},"permission_denials":[],"uuid":"9aad1d7d-c839-457f-a68b-127d6dd612a7"}
coygeek · 1 year ago

Awesome follow-up and some really great detective work here. This is super helpful and prompted me to dig back into the docs myself based on your findings.

You're absolutely right on all counts, and your observations clear things up a lot.

1. The Inconsistency & Version Confirmation:

Thanks for checking with /status and confirming both machines are on v.1.0.96. This invalidates my initial "different versions" theory. It strongly suggests the inconsistency you first saw is due to a backend configuration difference or A/B testing on Anthropic's side for the default system prompt, which is outside our control as users. This makes having a reliable method for consistent behavior even more critical.

2. The System Prompt Flag Mystery:

You were right to point out the --system-prompt flag, and it's fascinating that it worked for you directly in the terminal. After you mentioned it, I went digging through the documentation provided in this thread and found the specific distinction, which you correctly identified. It seems there are actually a few different flags for different contexts:

  • For the CLI, the documented flag is --append-system-prompt. The cli-reference page confirms this is the official way to add to the system prompt from the command line.
  • There's a newer --system-prompt-file flag mentioned in the changelog (v1.0.55) for replacing the prompt from a file.
  • The --system-prompt flag is officially documented for use in GitHub Actions, inside the claude_args block.

The fact that --system-prompt worked for you directly on the command line is super interesting. It might be an undocumented alias or a feature that's not fully rolled out yet. For your scripts and production use, I'd recommend sticking with the officially documented --append-system-prompt to ensure your commands are future-proof. But great job finding something that works! It looks like a documentation issue that this isn't clearer.

3. The Subagent Method & JSON Output:

I'm glad the subagent method is working! And your analysis of the JSON output is 100% correct. You've perfectly reverse-engineered the agentic loop.

You are right: the {"type":"user", "message": {"role":"user", ...}} block containing the tool_result is not from the human user. It's the response from the tool being fed back into the main agent's context for its next turn.

Here’s the step-by-step of what's happening, which confirms your observation:

  1. Human User Prompt: You type use the travel-planner subagent...
  2. Main Agent Decides: The main agent sees your request and decides the best tool is Task to invoke your travel-planner subagent. We see this in the first assistant message with "type":"tool_use".
  3. Subagent Runs: The travel-planner subagent runs in its own context and determines it needs to ask clarifying questions.
  4. Tool Reports Back: The subagent's response (the list of questions) is the tool_result.
  5. Result is Fed Back: The system wraps that tool_result in a user message. It's essentially the system saying, "Okay main agent, the tool you just ran gave me this new information. Now, what's your response to the human based on this?"
  6. Main Agent Responds: The main agent processes that tool_result and formulates the final, user-friendly response you see at the end.

So, while it looks confusing, it's the correct internal representation of an agent using a tool. This confirms that using subagents is the most robust and "officially supported" way to get specialized, consistent behavior.

Thanks again for digging in and sharing these details. This is exactly how we all figure this stuff out

andrew-at-v · 12 months ago

There is issue by using "sub-agent" with Claude Code SDK
It is very slow

At this moment I really want to use Claude Code SDK so bad
The problem is the initialization of Claude Code SDK is so slow and its slower than calling Claude Code directly in WSL
For this issue, Anthropic introduce --input-format=stream-json
With input format stream-json, the initialization still slow but right after that, its a blaze (and then I got that prompt guard issue)

Now we tackle the "prompt guard" issue with sub-agent
I lose the advantage of using input stream-json as its responding very slow (more or less as slow as the initialization)

--system-prompt was earlier than --append-system-prompt
again, its still exists in python and typescript SDK

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.