Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(claude): keep ~/.claude/rules out of isolated bot turns too

Gökhan Köse73f90abe828b
diff --git a/docs/custom-mcp-servers.md b/docs/custom-mcp-servers.md
index ee725cb3d3..3baafaf953 100644
--- a/docs/custom-mcp-servers.md
+++ b/docs/custom-mcp-servers.md
@@ -447,19 +447,19 @@ the servers above, its integrations (computer, browser, agents, phone), and
its own project's `<cwd>/.mcp.json`. By default it does **not** inherit this
machine's Claude Code setup — the MCP servers and claude.ai connectors in your
user or local Claude config, your skills and agents, your hooks, and your
-personal `~/.claude/CLAUDE.md`. Those were being mounted into every turn of
-every bot (one measured desktop added 407 tools, ~10k tokens per model call)
-and were reachable by the bot. Codex bots, by contrast, have always read the
-MCP servers in `~/.codex/config.toml`, which is why the two engines looked
-different.
+personal `~/.claude/CLAUDE.md` and `~/.claude/rules`. Those were being mounted
+into every turn of every bot (one measured desktop added 407 tools, ~10k tokens
+per model call) and were reachable by the bot. Codex bots, by contrast, have
+always read the MCP servers in `~/.codex/config.toml`, which is why the two
+engines looked different.
If you want Claude bots to see your own Claude Code MCP servers too, switch on
**Also use my Claude Code MCP servers** at the top of Plugins → MCP servers.
With it on, every Claude bot also loads the servers and connectors from your
Claude Code config on every message; skills, hooks and the personal
-`CLAUDE.md` still stay out. More tools means more tokens per message, so keep
-it off unless you need those servers — the recommended way to give a bot a
-server is still this page or the bot project's `.mcp.json`.
+`CLAUDE.md` and rules still stay out. More tools means more tokens per
+message, so keep it off unless you need those servers — the recommended way
+to give a bot a server is still this page or the bot project's `.mcp.json`.
**Also use my Claude Code skills**, just below it, gives Claude bots the skills
in your own `~/.claude/skills` and nothing else from your setup. OpenMausBot
diff --git a/server/drivers/claude.test.ts b/server/drivers/claude.test.ts
index 3c06fc1c5e..3be764a12c 100644
--- a/server/drivers/claude.test.ts
+++ b/server/drivers/claude.test.ts
@@ -44,6 +44,8 @@ import * as localInject from "./local-inject.ts";
import { DEFER_TOOLS_ENV } from "./agents-claude-defer.ts";
import { OWN_MCP_HTTP_ENV } from "./own-mcp-http.ts";
+const personalMemory = () => [join(homedir(), ".claude", "CLAUDE.md"), join(homedir(), ".claude", "rules", "**")];
+
const FAKE_CLI = join(dirname(fileURLToPath(import.meta.url)), "..", "testing", "fake-claude-cli.ts");
const dumpedPid = (dump: string): number => JSON.parse(readFileSync(dump, "utf8")).pid;
@@ -1796,7 +1798,7 @@ describe("ClaudeDriver turns (fake CLI)", () => {
expect(seen.settings.permissions).toEqual({ deny: ["Read(./.env)"] });
expect(seen.settings.env).toMatchObject({ GUARD_LEVEL: "strict", ENABLE_TOOL_SEARCH: "true" });
expect(seen.settings).not.toHaveProperty("model");
- expect(seen.settings.claudeMdExcludes).toEqual([join(homedir(), ".claude", "CLAUDE.md")]);
+ expect(seen.settings.claudeMdExcludes).toEqual(personalMemory());
});
it("keeps an MCP output limit the bot's settings set instead of the automatic one", async () => {
@@ -1893,7 +1895,7 @@ describe("ClaudeDriver turns (fake CLI)", () => {
const seen = JSON.parse(readFileSync(dump, "utf8"));
expect(seen.argv).toContain("--strict-mcp-config");
expect(seen.argv[seen.argv.indexOf("--setting-sources") + 1]).toBe("project");
- expect(seen.settings.claudeMdExcludes).toEqual([join(homedir(), ".claude", "CLAUDE.md")]);
+ expect(seen.settings.claudeMdExcludes).toEqual(personalMemory());
// A bot's memory is OpenMausBot's: the CLI's per-folder one would split notes by thread and break the cached prompt.
expect(seen.settings.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY).toBe("1");
});
@@ -2051,7 +2053,7 @@ describe("ClaudeDriver turns (fake CLI)", () => {
await instance.adapter.sendTurn({ threadId: "t-auth-settings", text: "hi" });
await recorder.until((e) => e.type === "turn.completed");
const seen = JSON.parse(readFileSync(dump, "utf8"));
- expect(seen.settings).toEqual({ claudeMdExcludes: [join(homedir(), ".claude", "CLAUDE.md")], apiKeyHelper: settings.apiKeyHelper, env: { ANTHROPIC_BASE_URL: settings.env.ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN: "synthetic-token", ENABLE_TOOL_SEARCH: "true", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" } });
+ expect(seen.settings).toEqual({ claudeMdExcludes: personalMemory(), apiKeyHelper: settings.apiKeyHelper, env: { ANTHROPIC_BASE_URL: settings.env.ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN: "synthetic-token", ENABLE_TOOL_SEARCH: "true", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" } });
expect(seen.argv[seen.argv.indexOf("--setting-sources") + 1]).toBe("project");
expect(JSON.stringify(seen.argv)).not.toContain("synthetic");
const settingsPath = seen.argv[seen.argv.indexOf("--settings") + 1];
@@ -2162,7 +2164,7 @@ describe("ClaudeDriver turns (fake CLI)", () => {
await instance.adapter.sendTurn({ threadId: "t-auth-explicit", text: "hi" });
await recorder.until((e) => e.type === "turn.completed");
const seen = JSON.parse(readFileSync(dump, "utf8"));
- expect(seen.settings).toEqual({ claudeMdExcludes: [join(homedir(), ".claude", "CLAUDE.md")], env: { ENABLE_TOOL_SEARCH: "true", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" } });
+ expect(seen.settings).toEqual({ claudeMdExcludes: personalMemory(), env: { ENABLE_TOOL_SEARCH: "true", CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1" } });
expect(seen.env.ANTHROPIC_API_KEY).toBe("workspace-key");
expect(seen.env.ANTHROPIC_BASE_URL).toBeUndefined();
expect(readClaudeAuthSettings({ HOME: scratch, CLAUDE_CONFIG_DIR: join(scratch, "other-account") })).toEqual({});
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index 95bdb015d1..6a861046ff 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -1177,8 +1177,8 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
}
// Every MCP server without alwaysLoad loads on demand behind ToolSearch (claude-tool-search.ts).
const own: Record<string, unknown> = { ...authSettings, env: { ...authSettings.env, ENABLE_TOOL_SEARCH: toolSearch, ...(isolated ? CLAUDE_OWN_MEMORY_OFF : {}) } };
- // Project-only settings still find the personal memory via ancestors when the bot lives under HOME.
- if (isolated) own.claudeMdExcludes = [join(homedir(), ".claude", "CLAUDE.md")];
+ // Project-only settings still find the personal memory and rules via ancestors when the bot lives under HOME.
+ if (isolated) own.claudeMdExcludes = [join(homedir(), ".claude", "CLAUDE.md"), join(homedir(), ".claude", "rules", "**")];
if (hooks) own.hooks = claudeHookSettings(HOOK_HELPER_PATH);
if (turn.guestConfined) own.permissions = GUEST_CLAUDE_PERMISSIONS;
// Approvals and browser credentials expire at the turn boundary; native background workers and cron jobs must not outlive it.