Skip to content

Bug: 便携版拷贝到新电脑后 AI 自报为 Claude Code(llmcore.py 默认 system prompt 硬编码) #712

Description

@ptseaboy

描述

将 GenericAgent 便携版目录复制到另一台电脑后,AI 在回答"你是谁"时自称 "Claude Code"。

复现步骤

  1. 将 GA 便携版目录完整复制到新电脑
  2. 启动后提问"你是谁"
  3. AI 回答:"我是 Claude Code,Anthropic 的官方命令行界面版 Claude。"

根因

llmcore.py 第 694 行硬编码了默认 system prompt:

payload['system'] = [{"type": "text", "text": "You are Claude Code, Anthropic's official CLI for Claude.", "cache_control": {"type": "ephemeral"}}]

第 695-697 行虽然有 if self.system: 来覆盖,但仅在 GA 正确加载了 system prompt 时才生效。新电脑上如果 self.system 为空,这个"Claude Code" 身份就会保留。

if self.system:
    if self.fake_cc_system_prompt: payload["system"].append(...)
    else: payload["system"] = [{"type": "text", "text": self.system}]  # 有 system 才覆盖

修复

已将第 694 行改为中性身份描述:

payload['system'] = [{"type": "text", "text": "You are a capable AI assistant running in GenericAgent framework.", "cache_control": {"type": "ephemeral"}}]

fake_cc_system_prompt 开关仍然保留,仅在主动开启时才使用 "Claude Code" 身份,不影响正常使用。

影响范围

  • 所有便携版用户
  • 首次安装未完整配置 GA system prompt 的用户

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