fix(rules-injector): respect claude_code config for user rule loading
When claude_code integration is disabled in oh-my-opencode.json, the rules-injector now skips loading rules from ~/.claude/rules/ to prevent Claude Code-specific instructions from leaking into non-Claude agents (e.g., GPT-5.4 Sisyphus), which causes agent hallucination. Also adds ~/.sisyphus/rules/ and ~/.opencode/rules/ as OpenCode-native user rule directories that are always searched regardless of config. Fixes #2920 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ const TRACKED_TOOLS = ["read", "write", "edit", "multiedit"];
|
||||
export function createRulesInjectorHook(
|
||||
ctx: PluginInput,
|
||||
modelCacheState?: { anthropicContext1MEnabled: boolean },
|
||||
options?: { skipClaudeUserRules?: boolean },
|
||||
) {
|
||||
const truncator = createDynamicTruncator(ctx, modelCacheState);
|
||||
const { getSessionCache, clearSessionCache } = createSessionCacheStore();
|
||||
@@ -39,6 +40,9 @@ export function createRulesInjectorHook(
|
||||
workspaceDirectory: ctx.directory,
|
||||
truncator,
|
||||
getSessionCache,
|
||||
ruleFinderOptions: options?.skipClaudeUserRules
|
||||
? { skipClaudeUserRules: true }
|
||||
: undefined,
|
||||
});
|
||||
|
||||
const toolExecuteAfter = async (
|
||||
|
||||
Reference in New Issue
Block a user