Skip to content

Skill retrieval is unstable across runs: same prompt drops create_schema from the tool surface #2265

Closed

Description

@malibio

Skill retrieval returns a different skill set for the same prompt across runs, and when it loses, the tool the turn needs is never offered — the turn cannot succeed regardless of model capability.

Found while running the dev-workflow matrix (#2239) with DeepSeek V4 Pro on d393ad19, 3 reps against a freshly seeded database each time.

Evidence

Scenario 8a, byte-identical prompt, three reps:

"Start keeping the calls we make on how the system is built, and who made each one"

rep routed skills create_schema offered outcome
1 Schema Creation, Bulk Import, Research & Search yes passed
2 Relationship Management, Research & Search, Bulk Import no excluded (⊗), 31.7s
3 Schema Creation, Bulk Import, Research & Search yes passed

Tool surface actually offered in rep 2:

search_nodes, search_semantic, get_node, create_relationship,
get_related_nodes, create_nodes_from_markdown

The prompt asks to start tracking a new kind of thing — a create_schema turn. In rep 2 that tool was not on the surface, so no amount of model capability could have produced the right call.

Why it happens

Stage-2 scopes the tool surface to the retrieved skills' whitelists. create_schema is whitelisted by Schema Creation. When ranking places Relationship Management in the top-N instead, create_schema leaves the surface entirely.

The likely trigger is the second clause, "and who made each one," which reads as relational and pulls Relationship Management up the ranking — even though the turn is primarily about defining a type. Two of three reps rank Schema Creation first, so the two are close enough in the embedding space that ordinary run-to-run variation flips them.

Why this matters beyond the eval

This is a production behaviour, not a harness artifact. A user asking the same question twice can get two different tool surfaces, and on the losing draw the assistant cannot perform the action requested. The observed rate on this prompt is 1 in 3.

It is the same failure class as #2254 — retrieval scoping the tool surface — but a different cause. #2254 was a missing whitelist entry; this is ranking instability with the whitelist correct.

Note this was only visible because the harness excludes unrouted turns (⊗) rather than scoring them as model failures. Without that exclusion it would have appeared as a model error and been attributed to DeepSeek.

Suggested direction

Prior work (recorded on #2239 and in the skill-retrieval investigation) found that rewording skill descriptions moved rank-1 retrieval accuracy substantially, so description tuning is the cheapest lever to try first:

  • Sharpen Schema Creation's description so prompts about defining a new kind of thing to track rank it first even when the prompt also mentions people or links.
  • Check whether Relationship Management's description is over-broad on attribution/authorship language ("who made", "who owns", "assigned to"), which is common phrasing in type-definition prompts.

Structural options, if description tuning proves insufficient:

  • Widen the Stage-2 union when the top-N scores are close, so a near-tie does not silently drop a whitelist.
  • Treat schema-defining verbs as a routing signal rather than relying on embedding rank alone.

Either way, the fix should be measured across repeated reps of the same prompt, since the defect is intermittent by nature and a single passing run proves nothing.

Acceptance criteria

Reproduction

# Repeat the same prompt against a freshly seeded DB and compare routedSkills
NS_SKILL_INDEX_PROBE_DB=<eval-db> bun run scripts/eval/agent-matrix.ts <label> <out.json> --runs 3
# then inspect: .reps[].results[] | select(.id=="8a") | .extra.routedSkills

Results from the run above: deepseek-post2254.json (3 reps, zero API errors).

Harness defects found in the same run are tracked separately in #2263; this issue is the product-side finding.

Activity

  1. malibio commented on Aug 24, 2026

    @malibio
    CollaboratorAuthor

    Correcting the suggested cause in the issue body, and adding evidence that narrows where the fault is not.

    The model's comprehension is not the variable

    The body speculates that the clause "and who made each one" reads as relational and pulls Relationship Management up the ranking. That is a hypothesis about embedding rank, and the model's own behaviour does not support it as an explanation for the failure.

    In rep 2 — the losing draw — the model parsed the request correctly and said so explicitly:

    "I can't set up a new tracker for this — the tool for creating a schema/type isn't available in this session. Right now I can search and read existing nodes, link them with relationships, and import markdown, but I can't create a new record type with a 'made by' field."

    It identified that the turn needed schema creation, and it identified the field. In rep 1 it did the same and succeeded:

    "Created the Call type (nodespace type call) to track decisions about how the system is built, with a made_by field for who made each call."

    Same understanding in both reps. The only difference was whether create_schema was on the surface. So the defect is entirely in retrieval ranking; prompt comprehension is not a contributing factor, and the "who made each one" explanation should be treated as unverified until someone inspects the actual embedding scores for this query against the eight skill descriptions.

    What would confirm or refute it

    Dump the per-skill similarity scores for 8a's prompt across repeated runs. If Schema Creation and Relationship Management sit within noise of each other, the near-tie explanation holds and the fix is to separate them. If they are well separated and the ordering still flips, the instability is somewhere else in the retrieval path — a different bug with a different fix.

    That check should happen before any skill description is reworded, otherwise the tuning is aimed at a guess.

    Separate, minor: the prompt has a real ambiguity

    Not the cause of this bug, but worth noting for whoever touches the fixture. "Calls" in 8a is ambiguous between decisions and phone calls. The model resolved it as a decision record and named the type "Call". Scenario 8e in the same group reads:

    "List every decision we've recorded about how the system is built"

    so the fixture means decisions, and uses colloquial "calls" on the write path and precise "decisions" on the read path. The model handled it, and the elliptical phrasing is deliberate (these scenarios test natural user speech, which is the right thing to test). Flagging only so a future edit does not "fix" the ambiguity and quietly change what the scenario measures.

  2. malibio commented on Aug 24, 2026

    @malibio
    CollaboratorAuthor

    Traced the mechanism, and the stored skill content. Two findings that change the diagnosis: the retrieval cut happens on rank, not relevance, and the seeded skills are unevenly maintained in a way that makes rank fragile.

    The 3-slot truncation happens before the score bars apply

    find_skills (packages/core/src/ops/skill_ops.rs:281,305) takes the top 3 by rank and discards the rest:

    let limit = input.limit.unwrap_or(3).min(MAX_SKILL_LIMIT);
    ...
    skill_results.truncate(limit);
    const SKILL_SEARCH_THRESHOLD: f32 = 0.0;   // no relevance floor at retrieval

    Routing then applies risk-tiered absolute bars (packages/agent/src/local_agent/routing.rs:52-91):

    READ_SKILL_SCORE_BAR        = 0.15
    MUTATING_SKILL_SCORE_BAR    = 0.30
    DESTRUCTIVE_SKILL_SCORE_BAR = 0.45

    Those bars are a good design — a destructive tool needs 3× a read's confidence, and the ordering is held by compile-time assertions. But they are applied after the truncation, so a skill that would clear its bar comfortably is still dropped if it ranks 4th. Nothing downstream can recover it.

    That is the 8a mechanism: Schema Creation did not fail a threshold, it lost a slot. With no floor at retrieval, all three slots are always filled regardless of how weak the 3rd match is — so a marginal skill can evict a strong one.

    The seeded descriptions are unevenly hardened

    Retrieval rank is decided entirely by the description field. Comparing all eight:

    skill description state
    Schema Creation ~90 words: natural phrasing, synonyms, explicit trigger phrases hardened
    Node Deletion "Delete, remove, erase, purge, discard, trash, drop, or get rid of…" hardened
    Node Creation "Create new nodes, records, entries, or instances of any type…" hardened
    Research & Search moderate partial
    Bulk Import / Organization moderate partial
    Relationship Management "Create connections between nodes, explore relationships, and traverse the knowledge graph." (13 words) original
    Graph Editing "Modify existing nodes in the knowledge graph - update content, properties, titles, and metadata." original

    The hardened ones were rewritten after a failure taught someone what phrasing users actually use. skill_pipeline.rs:1271 carries a regression test pinning Schema Creation's wording, whose comment records scenario 3 failing for exactly this reason — retrieval never surfaced it in the top-3, so create_schema was unreachable.

    So this is a known failure mode that has been fixed once per skill, by hand, without a mechanism that prevents the next occurrence. 8a is the same bug on a different pair. Worth noting Graph Editing — the skill whitelisting update_node, and the one at the centre of #2254 — is in the un-hardened group.

    Only one skill has a negative scoping rule, and it documents why that matters

    Node Deletion's procedure opens with:

    WRONG SKILL? This skill only takes content OUT of the graph. If the user is recording something, updating or marking a value, setting a field, or looking something up, say so and do not call delete_node — deleting a node the user meant to update is the one error here that cannot be undone. (This scoping rule lives here rather than in the skill's description because the description is embedded for retrieval, and an embedding cannot represent "not".)

    That parenthetical states the governing constraint: a skill cannot express "I am not for X" in an embedded description, so the exclusion has to live in the procedure, after routing. One of eight skills does this. It was added for delete_node because that failure is unrecoverable — but the same mis-route happens on every other skill and simply fails safe instead.

    This is what 8a hit. Relationship Management's procedure opens CALL create_relationship NOW: your next action is the tool call, not planning text. and has no wrong-skill escape. The model recovered on its own — it reported that the schema tool was unavailable rather than forcing a relationship — but that was the model being sensible, not the stored procedure helping it.

    Suggested direction, revised

    Ordered by leverage, structural before per-skill tuning:

    1. Add a WRONG SKILL? clause to every skill's procedure. Node Deletion proves the pattern and documents the reason. This is the only defence that works after a mis-route, and it does not depend on getting rank right.
    2. Raise the skill limit from 3, and/or add a relevance floor. The score bars already prevent an ill-fitting skill from acting, so a 4th or 5th candidate costs prompt tokens rather than safety — while a near-tie currently costs the whole turn. A floor above 0.0 would stop weak matches occupying slots.
    3. Bring Relationship Management and Graph Editing up to the standard of Schema Creation and Node Deletion. 13 words against ~90 is not a considered weighting.
    4. Log per-skill scores at routing time, so a near-tie is diagnosable rather than surfacing as an intermittent eval red.

    As noted in the previous comment, (3) should follow a score dump rather than precede it — if the two skills are well separated and the order still flips, the instability is elsewhere and rewording would be aimed at the wrong target. But (1) and (2) are worth doing regardless of what the scores say, because they harden the path rather than tune one pair on it.

  3. malibio commented on Aug 24, 2026

    @malibio
    CollaboratorAuthor

    Clarifying recommendation (1) from the previous comment, because as written it could be read as "add wrong-skill text to skill descriptions" — which would make retrieval worse, not better.

    The two surfaces are separate, and only one is embedded

    SkillNodeBehavior::get_embeddable_content (packages/core/src/behaviors/mod.rs:1984) embeds the skill name and description only:

    /// The description property drives embedding for skill discovery
    fn get_embeddable_content(&self, node: &Node) -> Option<String> {
        let desc = get_namespaced_prop_str(&node.properties, "skill", "description").unwrap_or("");
        let name = &node.content;
        ...
        Some(format!("{}\n\n{}", name, desc))
    }

    markdown_content — the procedure — is not part of the embedded text. It is delivered to the model after routing. So:

    surface embedded for retrieval? may contain exclusions?
    description yes no
    markdown_content (procedure) no yes

    Why the distinction is load-bearing

    Embeddings cannot represent negation. A description reading "not for updating existing records" embeds closer to update queries, not further from them — the tokens are the same either way. Adding exclusions to a description actively increases the chance the skill wins a query it should lose.

    This is exactly what Node Deletion's procedure documents:

    (This scoping rule lives here rather than in the skill's description because the description is embedded for retrieval, and an embedding cannot represent "not".)

    Node Deletion is the existence proof that the split works: it carries a full WRONG SKILL? clause in its procedure while keeping one of the cleanest, most retrievable descriptions of the eight ("Delete, remove, erase, purge, discard, trash, drop…"). The clause costs it nothing at retrieval time because it is never embedded.

    The invariant worth recording

    A skill description may contain only positive statements of what the skill is for. Every exclusion belongs in the procedure.

    This is worth stating explicitly somewhere enforceable, because the intuitive response to "Relationship Management keeps winning schema-creation queries" is to add "not for creating new types" to its description — which would worsen the exact failure it was meant to fix. A test asserting descriptions contain no negation markers ("not for", "don't use", "instead of") would pin it, in the same spirit as the existing schema_creation_description_covers_natural_tracking_phrasing test at skill_pipeline.rs:1271.

    Consequence for the ranking of the earlier recommendations

    The previous comment called description tuning the cheapest lever. With negation unavailable it is a weaker lever than that implied: you can only make the correct skill more attractive, never make a competing one less so. Every skill's description can only push in one direction, so tuning is a positive-sum arms race between eight descriptions competing for three slots.

    That asymmetry strengthens the structural items relative to the wording ones:

    • (1) WRONG SKILL? clause in every procedure — unchanged, and now clearly safe: procedures are not embedded, so this cannot affect retrieval at all. It is the only defence that operates after a mis-route.
    • (2) raise the 3-slot limit and/or add a relevance floor — stronger than previously argued. It fixes the near-tie case directly rather than trying to win it by wording.
    • (3) balance Relationship Management and Graph Editing against Schema Creation — still worth doing, but bounded by the negation limit: it can only lift those two, not lower whoever is beating them.
  4. malibio commented on Aug 24, 2026

    @malibio
    CollaboratorAuthor

    Reviewed the per-turn routing data across all three reps. The issue as filed understates this substantially: 8a is not an isolated near-tie, and the fix I proposed (rebalance two descriptions) is aimed at the wrong target.

    Scope: 12 of 21 scenarios got a different tool surface across identical reps

    Same prompt, same freshly-seeded database, three reps. Tools that appeared in some reps and not others, per scenario:

    scenario tools that varied
    4 create_nodes_from_markdown, resolve_query, route_clarify
    6 delete_node
    7 create_node, create_relationship, create_schema, delete_node, get_related_nodes, update_node, update_schema, update_task_status
    8a create_relationship, create_schema, get_related_nodes, update_schema
    8c create_nodes_from_markdown, create_relationship, create_schema, delete_node, get_related_nodes, resolve_query, route_clarify, update_schema
    8d create_relationship, get_related_nodes, resolve_query, route_clarify
    11c, 11c2, 12a, 12b, 12b2 create_schema, update_schema, create_relationship, get_related_nodes
    12d 10 tools varied, including create_node, update_node, delete-adjacent and clarification tools

    This is not noise at the margin. Scenario 7 — "Is anything on our plate longer than forty days?", a pure read — routed three different skill sets:

    rep1  Research & Search, Schema Creation, Relationship Management
    rep2  Node Creation, Schema Creation, Research & Search
    rep3  Node Deletion, Relationship Management, Organization
    

    In rep 3 Research & Search did not route at all on a question whose only requirement is to search. The surface it got was search_nodes, search_semantic, get_node, create_relationship, get_related_nodes, delete_node.

    delete_node reached the surface of an update scenario

    Scenario 6 is "The five-day one got signed off — mark it that way" — an update. Node Deletion routed on all three reps, and in rep 2 it ranked high enough to clear DESTRUCTIVE_SKILL_SCORE_BAR (0.45) and put delete_node on the surface:

    rep1  Schema Creation, Node Deletion, Node Creation    → no delete_node
    rep2  Node Deletion, Schema Creation, Node Creation    → delete_node offered
    rep3  Schema Creation, Node Deletion, Node Creation    → no delete_node
    

    The model did not call it, and the risk-tiered bar is precisely why this is a near-miss rather than an incident — the design worked. But the bar is now the only thing between an unstable ranker and a destructive tool on an update request, and it is being approached rather than comfortably cleared. Scenario 7 rep 3 shows the same intrusion on a read-only query.

    This inverts the recommendation about descriptions

    The issue body attributes 8a to "who made each one" pulling Relationship Management up, and proposes rebalancing Relationship Management and Graph Editing against Schema Creation. The wider data does not support that framing.

    Node Deletion is the recurring intruder — scenarios 6, 7, 8c and 12d — and its description is one of the hardened ones:

    "Delete, remove, erase, purge, discard, trash, drop, or get rid of stored content. Take something out of the knowledge graph…"

    That synonym density is what made it reliably retrievable for genuine deletion requests. It also made it retrievable for a great many things that are not deletion requests. The hardening pass that fixed one failure is a direct contributor to this one.

    So description tuning is not merely weakened by the unavailability of negation (as argued in the previous comment) — at the margin it is part of the cause. Eight descriptions each independently optimised to be maximally attractive, competing for three slots with no floor, is a system that produces exactly this. Any further per-skill wording pass should be treated as suspect until the structural issues are addressed.

    Revised priorities

    1. Log per-skill scores at routing time. Unchanged, and now clearly the prerequisite: none of the above can be diagnosed without knowing whether Node Deletion is scoring 0.46 or 0.80 on "mark it that way".
    2. Add a relevance floor and reconsider the fixed 3-slot fill. With SKILL_SEARCH_THRESHOLD = 0.0 all three slots always fill, so a weak third match is guaranteed to occupy a slot no matter how poorly it fits. A floor is what stops Node Deletion taking a slot on a read query. This now looks more important than raising the limit.
    3. Consider whether destructive skills should require a stronger retrieval signal, not just a stronger score bar. The bar gates whether the skill may act; it does not stop the skill consuming one of three slots and displacing the skill the turn actually needs. Scenario 7 rep 3 lost Research & Search that way.
    4. WRONG SKILL? clause in every procedure. Unchanged and still safe — procedures are not embedded.
    5. Per-skill description rebalancing — demoted. Do not attempt before (1) and (2), as the hardening pass is implicated in the current behaviour.

    Method note

    This was visible only because the harness records toolsOffered and routedSkills per turn. It does not show up in a pass/fail score at all: most of these scenarios passed anyway, because the model worked with whatever surface it was given. A scoring run is not sufficient to detect this class of defect — the eval numbers looked fine while the routing underneath was varying on 12 of 21 scenarios.

  5. malibio commented on Aug 24, 2026

    @malibio
    CollaboratorAuthor

    Found the actual retrieval input. It is not the user's prompt, which invalidates the lexical explanation offered in this issue's earlier comments.

    Stage-1 generates the retrieval query

    find_skills is called with a model-written paraphrase of the turn, logged at INFO by nodespace_core::ops::skill_ops:

    user prompt query sent to find_skills top_score
    "The five-day one got signed off — mark it that way" mark the five-day write-up as signed off 0.724
    "Is anything on our plate longer than forty days?" find anything on our plate longer than forty days 0.800
    "Whichever is the biggest job — that one's signed off now" update the biggest job to signed off 0.820
    "Start keeping the calls we make on how the system is built, and who made each one" start keeping calls on how the system is built and who made each one 0.966

    Stage-1 is doing its job well: it resolves ellipsis and pronouns ("the five-day one" → "the five-day write-up") and produces a clean, literal query. The instability is not caused by a bad query.

    This refutes the lexical explanation given earlier

    Two earlier comments on this issue attributed mis-routing to wording in the user's prompt — "who made each one" reading as relational, and Node Deletion's synonym-dense description matching deletion-adjacent phrasing. Neither survives contact with the actual queries.

    The query that routed Node Deletion first was:

    mark the five-day write-up as signed off
    

    There is no deletion vocabulary in it — no delete, remove, erase, purge, discard, trash, drop, or "get rid of". Node Deletion's description is being ranked highly for a query containing none of its terms. So this is not lexical bleed from synonym stuffing; it is the embedding placing a destructive skill near an update intent in vector space. That is a stronger problem than the one previously described, and synonym trimming would not address it.

    Correspondingly, my earlier suggestion that Node Deletion's hardening pass caused this should be treated as unproven. The hardening may still be a contributing factor via overall vector placement, but the specific mechanism proposed (synonym overlap with the query text) is now ruled out.

    The scores are high, not marginal

    top_score for these turns sits between 0.72 and 0.98 — far above DESTRUCTIVE_SKILL_SCORE_BAR (0.45) and MUTATING_SKILL_SCORE_BAR (0.30). This is not a cluster of near-ties being separated by noise; retrieval is confidently ranking wrong skills. A relevance floor set anywhere reasonable would not exclude them.

    That weakens recommendation (2) from the previous comment as a standalone fix: a floor helps with weak third matches, but these skills are not scoring weakly. Raising the limit still helps (it stops a correct skill being displaced), but the ranking itself is the defect.

    The rank-1 destructive safeguard is firing in production

    The log records it working:

    INFO ... Stage-2 scoping withheld a destructive tool from a skill that did not win retrieval.
    If this turn looks like the model failed to act, check whether it needed a tool no eligible skill o[ffered]
    

    This is the mechanism at skill_pipeline.rs:1008 behaving exactly as designed, and it is why delete_node appeared on only 1 of 3 reps of scenario 6 rather than all 3. Worth stating plainly: the safeguard is sound. The exposure is that it is the only barrier, and it is keyed on a ranking that these measurements show to be unstable.

    Graph Editing does not win its own use case

    Scenario 6 ("mark it that way" — an update) routed:

    rep1  Schema Creation, Node Deletion, Node Creation
    rep2  Node Deletion, Schema Creation, Node Creation
    rep3  Schema Creation, Node Deletion, Node Creation
    

    Graph Editing — the skill whose stated purpose is updating existing nodes — did not route in any rep. The turn succeeded only because Node Creation also whitelists update_node (skill_pipeline.rs:319), acting as an unintended fallback owner.

    A later turn does show Graph Editing routing first on update the biggest job to signed off, so it is not universally unreachable — but on the plainest update prompt in the suite it lost to three other skills, including a destructive one.

    Minor observation, not yet diagnosed

    Two early queries report a non-zero result count with top_score=0.0:

    query=list available capabilities                                  results_found=3  top_score=0.0
    query=store feature write-ups with signed-off status and estimated days  results_found=1  top_score=0.0
    

    A zero top score alongside returned results may be an artifact of the index still warming at the start of a rep, or may indicate scores are not being computed on that path. Flagged rather than concluded — it is two log lines and worth a look by someone touching this code, not a finding.

    Effect on priorities

    1. Log per-skill scores (not just top_score) — now clearly the first step. The queries are good and the scores are high, so the question is what the other seven skills scored on mark the five-day write-up as signed off. Nothing else can be decided without that.
    2. Strengthen Graph Editing's description — promoted. It is failing to win the plainest instance of its own purpose, and unlike the Node Deletion question this has a clear, positive-only fix.
    3. Raise the 3-slot limit — still useful (prevents displacement), but a relevance floor is demoted: these mis-ranked skills score too high for a floor to exclude.
    4. WRONG SKILL? clause in every procedure — unchanged, and now more valuable: if retrieval confidently ranks the wrong skill, the post-routing procedure is the remaining line of defence.
  6. malibio commented on Sep 9, 2026

    @malibio
    CollaboratorAuthor

    Frontend: 4909 passed (237 test files, 90.74s)

  7. self-assigned this
    on Sep 9, 2026
  8. malibio commented on Sep 9, 2026

    @malibio
    CollaboratorAuthor

    Root cause found — different mechanism than originally hypothesized

    Investigated with a live embedding model (nomic-embed-text-v1.5), bypassing the Stage-1 LLM entirely to isolate Stage-2 retrieval. Key finding: retrieval is perfectly deterministic for a fixed query string — 5/5 identical reps, both for the exact scenario 8a prompt and a control. So this is not embedding/KNN nondeterminism, and not a near-tie between Schema Creation and Relationship Management as originally hypothesized.

    The actual defect is in semantic_search (packages/core/src/services/embedding_service.rs), which implements hybrid BM25(FTS5)+KNN search as a hard tier partition, not a blended score:

    tier1 = BM25 ∩ KNN matches (sorted by score)
    tier2 = KNN-only matches (sorted by score)
    tier3 = BM25-only matches
    final order = tier1 ++ tier2 ++ tier3
    

    Any Tier-1 (BM25 keyword hit) result outranks every Tier-2 result, regardless of score magnitude. And BM25 matches into a skill's entire guidance-markdown subtree (FTS5 indexes the full node tree, not just the one-line description), so an incidental keyword collision in unrelated instructional prose can promote an irrelevant skill ahead of a much stronger semantic match.

    Measured directly for the exact scenario 8a prompt against the real seeded registry (raw embedding cosine similarity, descending):

    skill cosine score BM25 hit? old tier final rank (before fix)
    Schema Creation 0.9644 (highest of all 8) no Tier 2 3rd
    Node Creation 0.9530 no Tier 2 4th
    Organization 0.9305 no Tier 2 5th
    Bulk Import 0.8010 yes Tier 1 1st
    Research & Search 0.7531 (lowest of all 8) yes Tier 1 2nd

    Schema Creation only barely survived top-3 here because exactly two skills happened to hit Tier 1 on this wording — a third incidental collision (plausible given guidance bodies are long free text) would have dropped it out entirely, which is the intermittent failure the issue observed. This is unrelated to Relationship Management specifically; it doesn't appear in this trace at all.

    Fix applied

    Consulted with an ML/retrieval specialist on best practice for this shape of problem (small closed candidate set — routing 1-of-~20 skills — vs. open-ended document recall, where hybrid BM25+KNN fusion is the standard tool). Recommendation: skill selection is a classification problem over a small corpus, where dense-only ranking is standard and appropriate; full hybrid fusion is overkill and, here, actively harmful since BM25 is matching content (guidance prose) that has nothing to do with the skill's actual applicability.

    find_skills (packages/core/src/ops/skill_ops.rs) now calls semantic_search_nodes_of_type(query, "skill", limit, threshold) instead of the hybrid semantic_search_nodes. This is a pre-existing, purpose-built primitive (exact linear-scan KNN restricted to node_type = 'skill') — no BM25 involvement, and no guidance-markdown children in scope at all (only skill roots are indexed by this query). This is a clean, separate call path per the no-dual-mode project rule — semantic_search's hybrid tiering is untouched for general node/document search, where BM25 keyword matching is legitimate signal over a much larger, open-ended corpus.

    Verified with a new live-embedding test (packages/agent/tests/live_skill_retrieval_stability.rs, ignored by default, run explicitly against the real model):

    • Scenario 8a now routes Schema Creation 1st (was 3rd), 5/5 reps, with a clear score margin over the runner-up (0.864 vs 0.853) rather than barely surviving.
    • A BM25-collision regression test confirms Research & Search / Bulk Import still keyword-match via bm25_search_roots (the collision is real, not hypothetical) but no longer affects find_skills's output at all.
    • Control prompt (Node Creation) unaffected, 5/5.
    • 4 additional paraphrases of the scenario 8a intent all now consistently rank Schema Creation in the top 2.

    All existing Rust unit tests pass unchanged (1286 core + 627 agent), full cargo clippy clean, frontend bun run test unchanged (4909 passed). No description wording changes were needed — the issue's suggested "sharpen Schema Creation's description" / "check Relationship Management's over-broad phrasing" directions don't apply to the actual mechanism found here.

    Acceptance criteria status

    • Scenario 8a's prompt routes Schema Creation in the top-N across repeated reps — now 1st, not just surviving
    • A repeated-prompt retrieval-stability check exists — live_skill_retrieval_stability.rs, addresses a real test-coverage gap (every prior skill-routing test either mocked retrieval out entirely or drove the full Stage-1 LLM; nothing exercised live Stage-2 embedding ranking against the real registry)
    • Attribution/authorship phrasing does not pull Relationship Management ahead — N/A under the actual root cause; Relationship Management was never the rival in any measurement here
    • Re-run Evaluate Ornith 1.5 and Qwen 3.6 on the dev-workflow matrix (prior rejections predate the current stack) #2239's arms and confirm no ⊗ exclusions from this cause — not yet run (full live-model matrix is a substantial separate execution); the underlying mechanism is fixed and unit-verified, but this full-matrix confirmation is outstanding
  9. malibio commented on Sep 9, 2026

    @malibio
    CollaboratorAuthor

    Full-matrix confirmation (AC #4)

    Ran the dev-workflow matrix (bun run eval:agent, gemma-4-e4b-q4km, --runs 3) against this branch, against a freshly purged/isolated test DB.

    Schema Creation routing — the actual subject of this issue — is stable across all 3 reps:

    • 8a, 8b, 8c, 8d, 8e, 10a, 10b, 10c: create_schema/create_node/update_node were called in every rep, and the daemon log confirms Schema Creation won retrieval with a clear margin every time, e.g.:

      find_skills executed query="keep a log of system calls and the user who made each one"
      all_scores=Schema Creation=0.913, Node Creation=0.868, Organization=0.817
      routed_skills=Schema Creation, Node Creation, Organization
      

      38 separate turns had Schema Creation in the routed candidate set across the run; zero turns where a schema-relevant scenario failed to offer create_schema.

    • 8a and 8b show as "flipped" (1/3) in the harness's pass^k summary — but the cause is methodology, not routing: I ran --runs 3 without --between-runs, so reps 2–3 reused rep 1's database, and reps 2–3 correctly hit "Schema 'X' already exists — it was NOT modified" guardrails when re-asked to create the same type. create_schema was still called (and routed correctly) in 3/3 reps for both scenarios — the failing reps are a DB-reuse artifact the runbook explicitly warns about, not a retrieval regression. A clean per-rep DB (--between-runs) would very likely show 8a/8b as clean 3/3 passes; I did not re-run with it given the wall-clock cost, since the routing-log evidence already directly answers the question this AC is checking.

    Not related to this issue (separate, pre-existing gaps the matrix is designed to surface, unaffected by this fix): a create_relationship-routing gap (11c/11c2/12d/13 — a different skill, different failure), and the 3/4/6/9 chain, which cascades from the same rep-reuse DB-collision as 8a/8b above.

    Bonus finding: unrelated 2-day-old harness regression, fixed along the way

    While setting this up, turns appeared to hang for the full 4-minute timeout on every single call. Root cause: scripts/aichat.ts (the CLI driver every eval turn goes through) read node.properties["ai-chat"], but node get --json's output was flattened by commit 7bf84dc7 ("Emit flat node properties from the CLI", merged 2026-09-07) — so that lookup was always undefined, and the poll loop could never observe turn_status flip to idle, burning the full timeout on every turn regardless of how fast the daemon actually completed it. Fixed in scripts/aichat.ts (test/eval tooling only, not production code — the desktop app doesn't go through this script). Verified manually: a turn that previously "timed out" after 240s now completes and reports correctly in ~3s.

    Summary

    All three of the issue's original open ACs are now addressed:

    • Scenario 8a's prompt routes Schema Creation in the top-N across repeated reps — confirmed live, 3/3 reps, with score margin, both via the isolated embedding test and this full end-to-end matrix run
    • A repeated-prompt retrieval-stability check exists — live_skill_retrieval_stability.rs
    • Attribution/authorship phrasing pulling Relationship Management ahead — N/A, confirmed not the actual mechanism (see prior root-cause comment)
    • Re-ran Evaluate Ornith 1.5 and Qwen 3.6 on the dev-workflow matrix (prior rejections predate the current stack) #2239's arms — no ⊗/routing exclusions on any Schema-Creation-relevant scenario; the one methodology caveat (DB reuse across reps) is noted above and does not implicate retrieval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions