Skip to content

The open source coding agent.

TypeScript

load `OPENCODE_CONFIG_DIR` AGENTS.md into the system prompt (#7115)

Thomas Gormley630476afc0f5
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index f9ac12a2bbd..dc180bee886 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -15,6 +15,7 @@ import PROMPT_ANTHROPIC_SPOOF from "./prompt/anthropic_spoof.txt"
import PROMPT_CODEX from "./prompt/codex.txt"
import type { Provider } from "@/provider/provider"
+import { Flag } from "@/flag/flag"
export namespace SystemPrompt {
export function header(providerID: string) {
@@ -66,6 +67,10 @@ export namespace SystemPrompt {
path.join(os.homedir(), ".claude", "CLAUDE.md"),
]
+ if (Flag.OPENCODE_CONFIG_DIR) {
+ GLOBAL_RULE_FILES.push(path.join(Flag.OPENCODE_CONFIG_DIR, "AGENTS.md"))
+ }
+
export async function custom() {
const config = await Config.get()
const paths = new Set<string>()