Repository navigation
explicit skill applicability and versioned metadata #4040
merof-code
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Feature request
Follow up for #2384, #2385. Solves (mostly) #3826. Advances #3862, and, incidentally, the custom-policy groundwork requested in #1766 (closed).
Would you be open to optional, deterministic applicability conditions for skills?
Problem
A skill's description can explain when its guidance is relevant, but that leaves relevance to the model after the content has already enlarged the prompt.
For many rules, applicability is already known. A rule may be relevant to only frontend, backend. And then only to a specific part of it:
Those instructions should not all consume the same prompt budget for every PR.
In a mixed PR, it should also be clear which files each instruction applies to.
Proposal: optional applicability conditions
Illustrative example:
Additionally
pr_agent.when.regex[]would allow for keyword activation parameters.A frontend-only PR would not load this skill. A controller change would select it and identify the matching files before prompt construction.
Proposed behaviour:
schemaretain existing behaviour - loaded by default.In a mixed PR, loading the correct skills may not be enough. each skill can also remain scoped to the files that triggered it. For example, controller-validation guidance should apply to matching controllers, without being interpreted as a requirement for unrelated background jobs.
Path matching along with reporting would solve #3826 and replace our ci script.
Why version the metadata?
This is version pinning, when a new kind of schema will be inevitably introduced, no changes to existing skills or code will be needed.
Or when an existing schema change is not backwards compatable.
Benefits:
id field
Currently, pr_agent records resolved issues. That is done by normalizing the response which is not deterministic.
An id would allow issues to be reported in a tuple format,
<laravel.request-validation, filepath, symbol_path>example:
<'react.rtk-query.invalidation', 'laravel/app/Http/Controllers/SomeController.php', 'SomeController.list'>In other words: longer term, this could support explicit results per skill/policy and persistent finding identities. Those would be separate extensions; this initial proposal only concerns selecting and identifying guidance.
Compatibility with existing features
This complements rather than replaces existing mechanisms:
extra_instructionsremains for global overridesFuture outlook
I see this as complementary to the planned agentic flow. The agent chooses guidance it needs, while explicit rules identifies policies maintainers want checked on every relevant change. Guaranteed to have been checked against.
Deterministic loading would be the first use of that metadata. Longer term, it could also support
all kinds of metadata that does not fit into a toml file. That is the broader direction I’d like to explore in the discussion.
Jev models and other "discriminative model"'s
Some code policies are not easily implemented by AST or linters, while being very much deterministic.
For example, a policy states: "the name of the function must accurately represent what it does". A reviewer can miss it when the MR changes only some part of the function, but the name is no longer representative. A pr_agent is much better at it, but can be lost in tons of context.
A "discriminative model" model like jev would be faster, cheaper and safer to validate policies like that. With a skill yaml format, one addition and perhaps a new schema is all it takes config wise, to label all jev-compatible policies.
All reactions