Skip to content

Instantly share code, notes, and snippets.

@ChakshuGautam
Created December 13, 2025 09:02
Show Gist options
  • Select an option

  • Save ChakshuGautam/9bfcb8f32192ac3e59e45f96fb432642 to your computer and use it in GitHub Desktop.

Select an option

Save ChakshuGautam/9bfcb8f32192ac3e59e45f96fb432642 to your computer and use it in GitHub Desktop.
Claude Code System Prompts - The magic prefix for OAuth (from cli.js v2.0.69)
/**
* Claude Code System Prompts
* Extracted from @anthropic-ai/claude-code v2.0.69
* Source: https://unpkg.com/@anthropic-ai/claude-code/cli.js (line 188088)
*
* These prompts are validated server-side by Anthropic.
* OAuth tokens will be rejected without the correct system prompt prefix.
*/
// =============================================================================
// Original Source (cli.js lines 188085-188092, prettified)
// =============================================================================
/*
function gaQ() {
return "";
}
var haQ = "You are Claude Code, Anthropic's official CLI for Claude.",
f03 =
"You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.",
b03 = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
var vy1 = L(() => {
hX();
J4();
});
*/
// =============================================================================
// Readable Version - System Prompts
// =============================================================================
/**
* Standard Claude Code CLI prompt
* Used for direct CLI interactions
*/
const CLAUDE_CODE_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
/**
* Claude Code running within Agent SDK
* Used when Claude Code is invoked via @anthropic-ai/claude-agent-sdk
*/
const CLAUDE_CODE_AGENT_SDK_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.";
/**
* Generic Claude Agent prompt
* Used for custom agents built on the Agent SDK
*/
const CLAUDE_AGENT_PROMPT = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
// =============================================================================
// Summary
// =============================================================================
/*
| Variable | Prompt | Use Case |
|----------|-------------------------------------------------------------------------------|-------------------|
| haQ | "You are Claude Code, Anthropic's official CLI for Claude." | Standard CLI |
| f03 | "You are Claude Code, Anthropic's official CLI for Claude, running within..." | Agent SDK mode |
| b03 | "You are a Claude agent, built on Anthropic's Claude Agent SDK." | Generic agent |
The first prompt (haQ) is the "magic" prefix required for OAuth tokens to work with the API.
Without this exact prefix, the API returns:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "This credential is only authorized for use with Claude Code and cannot be used for other API requests."
}
}
*/
export { CLAUDE_CODE_PROMPT, CLAUDE_CODE_AGENT_SDK_PROMPT, CLAUDE_AGENT_PROMPT };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment