summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/flag/flag.ts5
-rw-r--r--packages/opencode/src/session/system.ts8
-rw-r--r--packages/opencode/src/skill/skill.ts35
-rw-r--r--packages/web/src/content/docs/cli.mdx3
4 files changed, 31 insertions, 20 deletions
diff --git a/packages/opencode/src/flag/flag.ts b/packages/opencode/src/flag/flag.ts
index 805da33cc..50e3cd79e 100644
--- a/packages/opencode/src/flag/flag.ts
+++ b/packages/opencode/src/flag/flag.ts
@@ -13,6 +13,11 @@ export namespace Flag {
export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy("OPENCODE_ENABLE_EXPERIMENTAL_MODELS")
export const OPENCODE_DISABLE_AUTOCOMPACT = truthy("OPENCODE_DISABLE_AUTOCOMPACT")
export const OPENCODE_DISABLE_MODELS_FETCH = truthy("OPENCODE_DISABLE_MODELS_FETCH")
+ export const OPENCODE_DISABLE_CLAUDE_CODE = truthy("OPENCODE_DISABLE_CLAUDE_CODE")
+ export const OPENCODE_DISABLE_CLAUDE_CODE_PROMPT =
+ OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT")
+ export const OPENCODE_DISABLE_CLAUDE_CODE_SKILLS =
+ OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_SKILLS")
export const OPENCODE_FAKE_VCS = process.env["OPENCODE_FAKE_VCS"]
export const OPENCODE_CLIENT = process.env["OPENCODE_CLIENT"] ?? "cli"
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index 5ab165ba2..fe8c32f03 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -62,10 +62,10 @@ export namespace SystemPrompt {
"CLAUDE.md",
"CONTEXT.md", // deprecated
]
- const GLOBAL_RULE_FILES = [
- path.join(Global.Path.config, "AGENTS.md"),
- path.join(os.homedir(), ".claude", "CLAUDE.md"),
- ]
+ const GLOBAL_RULE_FILES = [path.join(Global.Path.config, "AGENTS.md")]
+ if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_PROMPT) {
+ GLOBAL_RULE_FILES.push(path.join(os.homedir(), ".claude", "CLAUDE.md"))
+ }
if (Flag.OPENCODE_CONFIG_DIR) {
GLOBAL_RULE_FILES.push(path.join(Flag.OPENCODE_CONFIG_DIR, "AGENTS.md"))
diff --git a/packages/opencode/src/skill/skill.ts b/packages/opencode/src/skill/skill.ts
index 9d45f1688..cbc042d1e 100644
--- a/packages/opencode/src/skill/skill.ts
+++ b/packages/opencode/src/skill/skill.ts
@@ -7,6 +7,7 @@ import { Log } from "../util/log"
import { Global } from "@/global"
import { Filesystem } from "@/util/filesystem"
import { exists } from "fs/promises"
+import { Flag } from "@/flag/flag"
export namespace Skill {
const log = Log.create({ service: "skill" })
@@ -80,22 +81,24 @@ export namespace Skill {
claudeDirs.push(globalClaude)
}
- for (const dir of claudeDirs) {
- const matches = await Array.fromAsync(
- CLAUDE_SKILL_GLOB.scan({
- cwd: dir,
- absolute: true,
- onlyFiles: true,
- followSymlinks: true,
- dot: true,
- }),
- ).catch((error) => {
- log.error("failed .claude directory scan for skills", { dir, error })
- return []
- })
-
- for (const match of matches) {
- await addSkill(match)
+ if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS) {
+ for (const dir of claudeDirs) {
+ const matches = await Array.fromAsync(
+ CLAUDE_SKILL_GLOB.scan({
+ cwd: dir,
+ absolute: true,
+ onlyFiles: true,
+ followSymlinks: true,
+ dot: true,
+ }),
+ ).catch((error) => {
+ log.error("failed .claude directory scan for skills", { dir, error })
+ return []
+ })
+
+ for (const match of matches) {
+ await addSkill(match)
+ }
}
}
diff --git a/packages/web/src/content/docs/cli.mdx b/packages/web/src/content/docs/cli.mdx
index 9f3432b80..97c4a0702 100644
--- a/packages/web/src/content/docs/cli.mdx
+++ b/packages/web/src/content/docs/cli.mdx
@@ -566,6 +566,9 @@ OpenCode can be configured using environment variables.
| `OPENCODE_DISABLE_LSP_DOWNLOAD` | boolean | Disable automatic LSP server downloads |
| `OPENCODE_ENABLE_EXPERIMENTAL_MODELS` | boolean | Enable experimental models |
| `OPENCODE_DISABLE_AUTOCOMPACT` | boolean | Disable automatic context compaction |
+| `OPENCODE_DISABLE_CLAUDE_CODE` | boolean | Disable reading from `.claude` (prompt + skills) |
+| `OPENCODE_DISABLE_CLAUDE_CODE_PROMPT` | boolean | Disable reading `~/.claude/CLAUDE.md` |
+| `OPENCODE_DISABLE_CLAUDE_CODE_SKILLS` | boolean | Disable loading `.claude/skills` |
| `OPENCODE_CLIENT` | string | Client identifier (defaults to `cli`) |
| `OPENCODE_ENABLE_EXA` | boolean | Enable Exa web search tools |