Glob patterns in rules, again

I’ve seen many threads here on this topic, and yet could not find a solution.

I want a very simple request: to have rules attached to some file types (globs). For example, I want to have some rules for documentation in doc/*.txt and different rules for code src/**/*.py.

I tried glob patterns, and it just does not work. The only way I see rules applied is when alwaysApply: true However, all the rules are applied to every file, which isn’t what I want.

It looks like a very fundamental feature, and “glob” and “Apply to Specific files” indicate that it was intended to work as I want, but it just does not! (for me).

Does someone have a simple working example of how to set this up? Thanks!

Why do you want to use individual rules for individual file types?

My project uses several programming languages. For each of them, I have specific rules. Rules from one language do not apply to another.

Try to make something similar to Chapter 4 of Agent Compass in your main rules.

This would be a workaround: loading all rules for all cases into one prompt. It wastes tokens and makes it less precise. I am trying to use a built-in feature which seems to be designed to do exactly what I want, but it seems to be broken. Or I do not understand how to configure it properly.

If I recall correctly, the entire Agent Compass weighs ~1700 tokens. But everything is in one place and it’s easier to manage. Don’t give to Agent too many rules that are too precise.