Skip to content

Commit ea5296e

Browse files
committed
fix(session): remove Claude Code references to prevent path hallucination (#61)
1 parent f325255 commit ea5296e

8 files changed

Lines changed: 14 additions & 85 deletions

File tree

‎packages/opencode/src/agent/generate.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
22

3-
**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
3+
**Important Context**: You may have access to project-specific instructions from AGENTS.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
44

55
When a user describes what they want an agent to do, you will:
66

7-
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
7+
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from configuration files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
88

99
2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
1010

@@ -15,7 +15,7 @@ When a user describes what they want an agent to do, you will:
1515
- Anticipates edge cases and provides guidance for handling them
1616
- Incorporates any specific requirements or preferences mentioned by the user
1717
- Defines output format expectations when relevant
18-
- Aligns with project-specific coding standards and patterns from CLAUDE.md
18+
- Aligns with project-specific coding standards and patterns from project configuration
1919

2020
4. **Optimize for Performance**: Include:
2121

‎packages/opencode/src/flag/flag.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Object.defineProperty(Flag, "OPENCODE_CONFIG_DIR", {
8989

9090
// Dynamic getter for OPENCODE_DISABLE_CLAUDE_CODE
9191
// This must be evaluated at access time, not module load time,
92-
// to allow tests to control Claude Code features
92+
// to allow tests to control Claude Code compatibility features
9393
Object.defineProperty(Flag, "OPENCODE_DISABLE_CLAUDE_CODE", {
9494
get() {
9595
return truthy("OPENCODE_DISABLE_CLAUDE_CODE")
@@ -100,7 +100,7 @@ Object.defineProperty(Flag, "OPENCODE_DISABLE_CLAUDE_CODE", {
100100

101101
// Dynamic getter for OPENCODE_DISABLE_CLAUDE_CODE_PROMPT
102102
// This must be evaluated at access time, not module load time,
103-
// to allow tests to control Claude Code prompt features
103+
// to allow tests to control Claude Code prompt compatibility
104104
Object.defineProperty(Flag, "OPENCODE_DISABLE_CLAUDE_CODE_PROMPT", {
105105
get() {
106106
return Flag.OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT")
@@ -111,7 +111,7 @@ Object.defineProperty(Flag, "OPENCODE_DISABLE_CLAUDE_CODE_PROMPT", {
111111

112112
// Dynamic getter for OPENCODE_DISABLE_CLAUDE_CODE_SKILLS
113113
// This must be evaluated at access time, not module load time,
114-
// to allow tests to control Claude Code skills discovery
114+
// to allow tests to control Claude Code skills compatibility
115115
Object.defineProperty(Flag, "OPENCODE_DISABLE_CLAUDE_CODE_SKILLS", {
116116
get() {
117117
return Flag.OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_SKILLS")

‎packages/opencode/src/provider/provider.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ export namespace Provider {
7272
autoload: false,
7373
options: {
7474
headers: {
75-
"anthropic-beta":
76-
"claude-code-20250219,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
75+
"anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
7776
},
7877
},
7978
}

‎packages/opencode/src/session/prompt/anthropic-20250930.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify,
44
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
55

66
If the user asks for help or wants to give feedback inform them of the following:
7-
- /help: Get help with using Claude Code
8-
- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues
7+
- /help: Get help with using opencode
8+
- To give feedback, users should report the issue at https://github.com/randomm/opencode/issues
99

10-
When the user directly asks about Claude Code (eg. "can Claude Code do...", "does Claude Code have..."), or asks in second person (eg. "are you able...", "can you do..."), or asks how to use a specific Claude Code feature (eg. implement a hook, or write a slash command), use the WebFetch tool to gather information to answer the question from Claude Code docs. The list of available docs is available at https://docs.claude.com/en/docs/claude-code/claude_code_docs_map.md.
10+
When the user directly asks about opencode (eg. "can opencode do...", "does opencode have..."), or asks in second person (eg. "are you able...", "can you do..."), or asks how to use a specific opencode feature (eg. implement a hook, or write a slash command), provide the best answer you can based on your knowledge of the codebase.
1111

1212
# Tone and style
1313
You should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
You are Claude Code, Anthropic's official CLI for Claude.
1+
You are an AI coding assistant.

‎packages/opencode/src/session/prompt/plan-reminder-anthropic.txt‎

Lines changed: 0 additions & 67 deletions
This file was deleted.

‎packages/opencode/src/session/system.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export namespace SystemPrompt {
5959
`Here is some useful information about the environment you are running in:`,
6060
`<env>`,
6161
` Working directory: ${Instance.directory}`,
62+
` IMPORTANT: All file paths must be relative to or within the working directory shown above. Never hallucinate or guess directory names.`,
6263
` Is directory a git repo: ${project.vcs === "git" ? "yes" : "no"}`,
6364
` Platform: ${process.platform}`,
6465
` Today's date: ${new Date().toDateString()}`,
@@ -79,13 +80,9 @@ export namespace SystemPrompt {
7980

8081
const LOCAL_RULE_FILES = [
8182
"AGENTS.md",
82-
"CLAUDE.md",
8383
"CONTEXT.md", // deprecated
8484
]
8585
const GLOBAL_RULE_FILES = [path.join(Global.Path.config, "AGENTS.md")]
86-
if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_PROMPT) {
87-
GLOBAL_RULE_FILES.push(path.join(os.homedir(), ".claude", "CLAUDE.md"))
88-
}
8986

9087
if (Flag.OPENCODE_CONFIG_DIR) {
9188
GLOBAL_RULE_FILES.push(path.join(Flag.OPENCODE_CONFIG_DIR, "AGENTS.md"))

‎packages/opencode/src/skill/skill.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export namespace Skill {
8585
)
8686
// Also include global ~/.claude/skills/ if not disabled
8787
if (!Flag.OPENCODE_DISABLE_GLOBAL_SKILLS) {
88-
const globalClaude = `${Global.Path.home}/.claude`
89-
if (await Filesystem.isDir(globalClaude)) claudeDirs.push(globalClaude)
88+
const legacy = `${Global.Path.home}/.claude`
89+
if (await Filesystem.isDir(legacy)) claudeDirs.push(legacy)
9090
}
9191

9292
if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS) {

0 commit comments

Comments
 (0)