eca icon indicating copy to clipboard operation
eca copied to clipboard

Improve rules

Open zikajk opened this issue 1 year ago • 8 comments

  1. Take an inspiration from Github Copilot, which supports this:
---
applyTo: "**"
excludeAgent: "code-review"
---

We could use excludeBehavior and onlyBehavior instead.

  1. 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.

zikajk avatar Nov 28 '25 09:11 zikajk

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

ericdallo avatar Nov 28 '25 12:11 ericdallo

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?

zikajk avatar Nov 28 '25 16:11 zikajk

Sounds good!

ericdallo avatar Nov 28 '25 17:11 ericdallo

@zikajk should we close this one? I believe we should walk to a path where skills should be used instead of rules, WDYT?

ericdallo avatar Feb 18 '26 13:02 ericdallo

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.

zikajk avatar Feb 18 '26 14:02 zikajk

@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:

  1. When (and only!) eca_read_file, eca_write_file and eca_edit_file touch a file
  2. Eca will check if the path matches the regex in the rule
  3. If it does, then it is added to the system prompt and it stays there until the session ends (it stays even after compact).
  4. 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?

zikajk avatar Feb 20 '26 17:02 zikajk

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

ericdallo avatar Feb 23 '26 12:02 ericdallo

Done - in a different and probably better way - in 0.130.0 https://github.com/editor-code-assistant/eca/commit/e53bd1e43fe8c1f10dff6180cc07429f3a6b3be5

zikajk avatar Apr 27 '26 17:04 zikajk