Ability to tightly constrain which files must or may be read or edited

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 6 comments · opened Mar 4, 2025 · closed May 8, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

We'd like to be able to pass in list of glob patterns (e.g. bla.txt or **/boop.md etc) that tell claude which file paths

  • _must be edited_
  • _may be edited_
  • _may be created_
  • _may be read_ (or perhaps in that case may _not_ - like .cursorignore)
  • _must be read_ (meaning they are always included in the context

Our specific usecase is non-interactive, so it'd be great if this could be passed in via CLI

View original on GitHub ↗

6 Comments

bcherny collaborator · 1 year ago

Oh interesting. Will keep this open for tracking. Would love to hear if others have similar use cases.

In general, prompting should work well for this. Have you tried just adding all of this to your prompt?

sagarspatil · 1 year ago

This is a no brainer. Please add it. Cursor implements this nicely. Maybe look at their implementation for inspiration?

lmmx · 1 year ago

I wanted to note a couple things here:

  • I read that JetBrains are going with .aiignore and this could be a nice standardised format for the 4th category of suggested controls (as opposed to proliferating standards for .cursorignore .claudeignore etc.)
  • at the 12:50 mark in Mahesh's talk at AI Engineer this week on MCP https://youtu.be/kQmXtrmQ5Zg it is mentioned during an explanation of tools/resources/prompts in the MCP framework:

> "a dynamic resource... The client application can send the application some information about the user about the file system that they're working in, and the server can interpolate that into this more complex data structure and send that back to the client application. Inside Claude for Desktop, resources manifest as attachments, so when you interact with a [MCP] server, when you click into our UI and then select a resource, it gets attached to the chat and optionally sent to the model for whatever the user is working on. Resources could also be automatically attached, you could have the model decide "Hey I see that there's this list of resources, this one is super relevant to the task we're working on right now, let me automatically attach this to the chat", or send it to the model, and then proceed from there..."

  • This seems pertinent to the other points: 'dynamic resources', i.e. I think Jonas is suggesting a feature for dynamic resource control in MCP
  • at 15 mins it is suggested that there may be "predefined rules, maybe it makes an LLM call..." which again chimes with the suggestion above

Also in case it's worth mentioning, the point of this section of the talk is that resources are application controlled (as opposed to model/user-controlled), which I imagine would determine where this would go. In the example above indeed it is the agent (CLI), but in another scenario it could also be the IDE.

inigohidalgo · 1 year ago

Absolutely critical for a next addition TBH.

Prompting is okay but we all know how it can get when context is long and it's dealing with multiple changes in one go.

Having hard-and-fast deterministic rules for context management as well as targeted edits are crucial. Without this, I will not be able to use CC for anything beyond small toy projects.

bcherny collaborator · 1 year ago

You can now do this with read/write permission rules! Would love your feedback: https://docs.anthropic.com/en/docs/claude-code/settings#permissions

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.