Improve rules
- Take an inspiration from Github Copilot, which supports this:
---
applyTo: "**"
excludeAgent: "code-review"
---
We could use excludeBehavior and onlyBehavior instead.
- First we must find the best way how to deal with
applyTo: Should it be only system instructions added to system-prompt, e.g.?If you are going to work with any file matching this pattern: <applyTo>, ensure you have read <path to the rule file> at least once in this session.
This is in some ways simillar to: https://github.com/editor-code-assistant/eca/issues/141
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Interesting, Didn't know there were other AI clients with heavy rules support like Cursor. I think this is a duplicate of #26 ?
I think we could startwith your idea, seems easier to support indeed
Ah, yes, it is.
We can start like this: rules are applied only when the file is added (@) or its path (#) is referenced in the prompt. I am not so sure about AGENTS.md, but that would make sense as well. We could also profit from @cursor. I have been told today that this is how Copilot in VSCode works.
So what about chaning this ticket to just support behavior in Rules definition and keep rest for your ticket?
Sounds good!
@zikajk should we close this one? I believe we should walk to a path where skills should be used instead of rules, WDYT?
I don't think so. I want to take a deeper look into dynamic load (which should work same for nested AGENTS.md). Rules still have value if you have project rules that should be applied to some folder IMO.
@ericdallo Good news, it is not hard and there is no magic :-) .
It works like this. There are two scenarios.
First - You reference a file via @ or #:
- If the regex in Rules matches the path, it is added to the system prompt and it stays there.
Second - Tool:
- When (and only!)
eca_read_file,eca_write_fileandeca_edit_filetouch a file - Eca will check if the path matches the regex in the rule
- If it does, then it is added to the system prompt and it stays there until the session ends (it stays even after compact).
- Yes, it means that the first read/edit/write on the file won't know about the rule. But every file is usually read first, so it is not a big deal.
I believe it works same for nested AGENTS.md which means - when there are any agents.md in any directories above the referenced / touched file, then they are added to the system instructions. Personally, I would improve rules but I don't think that nested AGENTS.md is something being really used. WDYT?
I feel like agents.md and nested agents are more used than eca rules, but we don't have metrics for that. Even so, your suggestion looks good enough to try, not a high prior as I hear no users talking about rules lately
Done - in a different and probably better way - in 0.130.0 https://github.com/editor-code-assistant/eca/commit/e53bd1e43fe8c1f10dff6180cc07429f3a6b3be5