Skip to content

fix(worker): keep device instruction files out of threads - #214

Merged
nixuuu merged 1 commit into
devfrom
fix/thread-user-claude-md
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/thread-user-claude-md

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026

Copy link
Copy Markdown
Member

Platform threads no longer read the device owner's global instruction files. A new scratch thread on a Mac quoted the owner's ~/.claude/CLAUDE.md (rules about a plugin that the thread does not have).

Cause: Claude Code (CLI 2.1.308, Agent SDK 0.3.316) loads global user memory (~/.claude/CLAUDE.md) and CLAUDE.md files from parent directories even with settingSources: ["project", "local"]. A real-CLI capture of scratch and project threads contained both fixture texts.

Fix

  • Claude: threads pass claudeMdExcludes for the device's ~/.claude/** and for CLAUDE.md, CLAUDE.local.md, AGENTS.md and .claude/** in every directory above the workspace root. Instructions inside the workspace or repo stay. HOME and the login setup are unchanged, so macOS Keychain sign-in is not affected.
  • Codex: threads keep the real HOME, USERPROFILE and XDG paths, so git identity, SSH keys, gh and tool configs keep working in agent shells. The device's skills are left out through Codex's own skill-path settings; library skills in the isolated CODEX_HOME stay. Scratch threads use project_root_markers: [], so no AGENTS.md above them is collected.
  • Grok: threads keep the real home. An isolated GROK_HOME, the compatibility flags and [skills].ignore keep global context out. Grok's native rules and root instruction files stay.
  • Bots: unchanged; they stay fully isolated (fix(bots): isolate user homes and disable codex skills #190).

Limitations

  • Codex: a newly installed device skill is picked up only after an app-server or worker restart.
  • Grok: Claude and Cursor compatibility rules and skills are off inside projects as well.

Tests: apps/worker/src/providers/instruction-isolation.test.ts captures requests from the real Claude, Codex and Grok CLIs for scratch and project threads, using a temporary HOME with fixture files. It checks that:

  • global and ancestor instructions are absent;
  • repo instructions and assigned library instructions are present;
  • agent subprocesses see the real HOME and git identity.

Bot isolation tests pass. check:tmp: 1398 passed, 0 failed.

Docs: agent-environment.md, claude-adapter.md, codex-adapter.md, grok-adapter.md, worker-config.md.

Copy audit: no UI text changed.

Exclude Claude user memory and ancestor instructions with claudeMdExcludes while retaining HOME and login discovery. Keep Codex and Grok thread HOME, USERPROFILE and XDG paths intact so shell tools retain device configuration; private homes remain limited to bots.

Disable discovered device Codex skills with native path selectors and bound scratch root discovery. Isolate Grok configuration, disable compatibility context and memory, and ignore home-level .agents skills. Document Codex process snapshots and Grok compatibility scope limits.

Capture real CLI requests for scratch and project threads with empty and assigned instructions, verify library skills and project rules, and check thread subprocess git identity with temporary homes. Retain bot isolation coverage.
@nixuuu
nixuuu merged commit 1f50229 into dev Nov 5, 2026
9 checks passed
@nixuuu
nixuuu deleted the fix/thread-user-claude-md branch November 5, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant