Repository navigation
Skill exclusion text: penalize retrieval score on what a skill is not for (closes #2268, closes #3076) - #3105
Conversation
Pragmatic Code Review — PR #3105Review Type: Initial Review (no prior reviews or comments on the PR) SummaryA small, well-contained change. Requirements Check#2268 (exclusion mechanism)
#3076 (the failing case)
Existing installs: Code Review Findings🟢 1. The score-invariance test compares 3-decimal strings and could pass vacuously📁 let a = graph_editing(scored_ranking(&with, &with_ns, query, 8).await);
let b = graph_editing(scored_ranking(&without, &without_ns, query, 8).await);
if a != b { changed.push(query); }
🟢 2. The
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed (aba2192)✅ Addressed
⏭️ Skipped
🧪 Live retrieval suite 13/13, penalty unit tests 8/8, push check passed. Re-review: not needed. The changes are test precision, comments and one test literal. No production logic changed. |
… for (closes #2268, closes #3076) "remove the resolved tickets" ranked Graph Editing (0.855) above Node Deletion (0.841) on Graph Editing's "mark it resolved", and since delete_node is offered only from the winning candidate, the deletion was silently withheld. The request differs from "mark incident resolved" only in the verb, which the embedding barely weights: every description rewording that lowered Graph Editing on one lowered it equally on the other. A skill may now carry an optional `exclusion` (core skill schema field). find_skills embeds it in the description's own name+text shape, scores it against the query, and applies a margin penalty: score - 1.0 * max(0, exclusion_score - score) A query closer to the description than to the exclusion keeps its score exactly, so the exclusion costs a skill nothing on requests it serves; plain subtraction would lower it everywhere and through the routing score bars, which read the adjusted score. find_skills scores a pool larger than the registry before truncating to K, since a penalty can promote a skill from below the cut. The query is embedded once and shared by the skill search, the schema search and exclusion scoring. Graph Editing is seeded with "Remove them, delete them, get rid of them, purge them." Measured on the locked model: Node Deletion first on "remove the resolved tickets" by +0.047; all completion-state scores unchanged; one cost, "remove the due date from the launch task" -0.009 (still top 3). Longer phrasings also lowered unrelated updates by 0.02-0.035, so exclusions are pinned to measured skills. Live guards: remove_requests_mentioning_a_state_route_node_deletion, removing_a_field_still_reaches_graph_editing, graph_editing_exclusion_leaves_completion_state_scores_unchanged; "remove the resolved tickets" added to the resolved rank-1 test. All 13 live retrieval tests pass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… limits - graph_editing_exclusion_leaves_completion_state_scores_unchanged now compares raw f64 confidences and requires Graph Editing present on both sides; the 3-decimal ranking strings hid penalties below 0.0005 and let None == None pass. Scores are bit-identical with and without the exclusion on all seven completion-state requests. - SKILL_RERANK_POOL's doc states when promotion is exact (registry within the pool, all skills surviving the typed search's KNN window). - rerank_with_exclusions notes the single-chunk assumption behind scoring an exclusion at full density. - The weighted-margin unit test asserts a literal (0.81), not the formula. Skipped: double SkillProperties decode (the typed SkillNode follow-up replaces that decoder); synchronous exclusion embedding and the per-query warning on embed failure (reviewer: no action; cached, and the query embedding would fail first). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
aba2192 to
e61ebdf
Compare
Closes #2268, closes #3076.
Problem
"remove the resolved tickets" ranked Graph Editing 0.855 > Node Deletion 0.841 in Stage-2 retrieval on Graph Editing's "mark it resolved".
delete_nodeis offered only from the winning candidate, so the deletion was silently withheld. On the production stack, E4B found both tickets and replied "node search completed" without deleting anything.The request differs from "mark incident resolved" only in the verb, which the embedding barely weights. About 30 description and title rewordings were swept: every one that lowered Graph Editing on the deletion request lowered it by the same amount on the completion-state guards. The best left "mark incident resolved" 0.003 from falling out of the top 3. Measurements are in #2268.
Change
A skill may carry an optional
exclusion, a new coreskillschema field describing what the skill is not for.find_skills:SKILL_RERANK_POOL), because a penalty can promote a skill from below the K cutname\n\ntextshape and applies a margin penalty:score − 1.0 · max(0, exclusion_score − score)The margin form means a query closer to the description than to the exclusion keeps its score exactly. Plain subtraction would lower the skill on every query and push it through the score bars.
Graph Editing is seeded with
"Remove them, delete them, get rid of them, purge them.". The composite-score formula and a cosine helper are shared from the store so the exclusion is scored on the same scale as the KNN results.Measured (locked nomic model, full seeded registry)
The exclusion wording matters. Two longer phrasings also lowered "mark the outage report done" or "record that we decided to use Postgres" by 0.02–0.035. Embedding the exclusion bare (without the name) lowered completion requests too. So exclusions are pinned to measured skills (
only_measured_skills_carry_an_exclusion).Tests
live_skill_retrieval_stability.rs):remove_requests_mentioning_a_state_route_node_deletion: rank 1 on every repremoving_a_field_still_reaches_graph_editinggraph_editing_exclusion_leaves_completion_state_scores_unchanged: identical scores with and without the exclusion, not just the same rankdeletion_requests_mentioning_resolved_route_node_deletioncargo nextestfor core/agent/cli: 3190 run, all pass afterbun run skill:gen(the CLI help text now listsexclusion)Related, filed separately
list_conflictseven when Node Deletion wins retrieval (a model-level pull that retrieval can't fix)skilla typedSkillNodemodel; this PR addsexclusionto the existingSkillPropertiesbag decoder🤖 Generated with Claude Code