Skip to content

fix(dev): the environment's agent loads CLAUDE.md files from folders above its workspace #620

Closed

Description

@allisonmahmood

This was generated by AI during triage.

The environment's workspace lives under $XDG_DATA_HOME, which is usually inside the developer's HOME. Claude Code loads CLAUDE.md and .claude/CLAUDE.md from every folder above its working directory, and for HOME itself .claude/CLAUDE.md is the developer's personal instruction file. --setting-sources project doesn't stop it. So the agent the development guide calls "a fresh Patchy user" follows the developer's personal instructions, which skews any check of how agents behave with Patchy.

Found while triaging #592. The #563 prototype hit it first and moved its fresh agents to /tmp to avoid it. Filed by Claude Opus 5.5 in Claude Code, running in T3 Code, for Allison.

Agent Brief

Category: bug
Summary: The agent launcher excludes every instruction file from folders above its workspace, so the environment's agent loads only the workspace's own.

Current behavior:
The launcher starts Claude Code with --setting-sources project in a workspace at $XDG_DATA_HOME/patchy-dev/<label>/workspace. Claude Code still loads CLAUDE.md and .claude/CLAUDE.md from each parent folder, including the developer's ~/.claude/CLAUDE.md. Triage confirmed this on Claude Code 2.1.294: with a sentinel word in a parent folder's .claude/CLAUDE.md, a -p agent quoted it back.

Desired behavior:
The agent loads no instruction file from any folder above its workspace, wherever the environment folder lives. The workspace keeps its own Patchy project skill.

Key interfaces:

  • Claude Code's claudeMdExcludes setting: glob patterns or absolute paths of CLAUDE.md files not to load (it applies to user, project and local memory). In the same probe, --settings '{"claudeMdExcludes":[<the parent folder's CLAUDE.md and .claude/CLAUDE.md>]}' removed the sentinel. Triage verified passing it through --settings; it did not test the workspace's own .claude/settings.json.
  • The generated agent launcher.

Acceptance criteria:

  • With a sentinel in CLAUDE.md and in .claude/CLAUDE.md of a folder above the workspace, an agent started by the launcher reports neither. A one-question -p probe ("does any instruction file in your context mention a sentinel word?") is enough; say in the PR how it was run.
  • The workspace's Patchy project skill still loads.
  • The development guide's description of the agent matches what it loads.

Out of scope:

Activity

  1. added
    bug
    ready-for-agent
    area:ci
    on Oct 10, 2026
  2. added a commit that references this issue on Oct 15, 2026
    459fc94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cibugready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions