Repository navigation
Skill-mediated tool routing: LLM-judged two-stage retrieval pipeline with clarification fallback - #1363
Conversation
…loses #1352) Replace the silent select_tools push path with the ADR-036 pull model: the model receives all tools and calls search_skills itself (Stage-1 gate), then judges candidates and emits the typed action in the same turn or clarifies. - Remove select_tools from AgentToolExecutor trait and GraphToolExecutor impl. The silent pre-inference skill search (SELECT_TOOLS_CONFIDENCE_THRESHOLD = 0.3) that scoped the tool list before the model saw anything is gone. - Remove is_baseline() from Tool — it existed only to seed select_tools baselines. - agent_loop.rs: pass the full tool list directly; no pre-filtering step. Degraded path: search_skills returns an error result when the embedding service is unavailable and the model falls through to general tools. - Update search_skills description to describe the ADR-036 two-gate flow: model judges candidates and emits the action in the same turn, or clarifies with concrete candidates. Empty result = fall through to general tools. - TOOL_STRATEGY_RULES: add CLARIFICATION CONTRACT (one clarification max, then fall through to semantic_search) and BLAST-RADIUS GATE (mutating skills require higher confidence than read-only skills). - Update prompt_assembler.rs snapshot test to match new TOOL_STRATEGY_RULES body. Happy path: 2 model turns. Clarification: 3 turns max. No silent injection. Co-Authored-By: Claude <[email protected]>
Code Review — PR #1363: Skill-Mediated Tool Routing (ADR-036)Reviewer: Principal Engineer (automated pragmatic review) Overall AssessmentThis PR correctly replaces the ADR-030 silent-push pipeline ( Requirements Validation (Issue #1352 Acceptance Criteria)
FindingsSuggested Improvements
The comment on line 144 still references This is the only remaining reference to // skill-based search_skills works as soon as the embedding model finishesNot a blocker — the code is correct — but leaving a reference to the deleted mechanism is the kind of drift that confuses future readers. Trust filtering gap (acknowledged by ADR-036 as future work, noting for completeness) ADR-036 §Trust Boundary explicitly designates the system step retrieval as "where the trust boundary is enforced" — including filtering on the NitpicksNit: The rule correctly communicates the desired behavior to the model. Since the issue explicitly rejects encoding the bar as a single self-reported scalar (small models are overconfident), this is the right approach for now. Worth a brief inline comment noting this is a prompt-level instruction until per-skill metadata is used to enforce the bar mechanically at the retrieval step (tracked in ADR-036). Nit: The old description listed "name, description, confidence (0-1), and tools." The new one adds "instructions" but omits Notes
|
Updates a comment in local_agent_service.rs that still referenced the deleted select_tools path. The executor now routes through search_skills (the model-driven pull path per ADR-036), not the old silent push method. Addresses reviewer suggestion from PR #1363. Co-Authored-By: Claude <[email protected]>
Address-Review SummaryAddressed: 1 recommendation ✅ Fixed: Stale comment in
|
…loses #1352) (#1363) Replace the silent select_tools push path with the ADR-036 pull model: the model receives all tools and calls search_skills itself (Stage-1 gate), then judges candidates and emits the typed action in the same turn or clarifies. - Remove select_tools from AgentToolExecutor trait and GraphToolExecutor impl. The silent pre-inference skill search (SELECT_TOOLS_CONFIDENCE_THRESHOLD = 0.3) that scoped the tool list before the model saw anything is gone. - Remove is_baseline() from Tool — it existed only to seed select_tools baselines. - agent_loop.rs: pass the full tool list directly; no pre-filtering step. Degraded path: search_skills returns an error result when the embedding service is unavailable and the model falls through to general tools. - Update search_skills description to describe the ADR-036 two-gate flow: model judges candidates and emits the action in the same turn, or clarifies with concrete candidates. Empty result = fall through to general tools. - TOOL_STRATEGY_RULES: add CLARIFICATION CONTRACT (one clarification max, then fall through to semantic_search) and BLAST-RADIUS GATE (mutating skills require higher confidence than read-only skills). - Update prompt_assembler.rs snapshot test to match new TOOL_STRATEGY_RULES body. Happy path: 2 model turns. Clarification: 3 turns max. No silent injection. Co-authored-by: Claude <[email protected]>
Updates a comment in local_agent_service.rs that still referenced the deleted select_tools path. The executor now routes through search_skills (the model-driven pull path per ADR-036), not the old silent push method. Addresses reviewer suggestion from PR #1363. Co-Authored-By: Claude <[email protected]>
Closes #1352