Skip to content

Semantic skill discovery via find_skills tool for 8B model and external agents #1051

Closed

Description

@malibio

Overview

Expose find_skills(query) as an explicit agent tool for the 8B model and external Claude agents (via ACP/MCP). This supplements the push-based skill injection from #1050 with a pull-based mechanism for models capable of meta-reasoning about their own capability gaps. This is Phase 4 of ADR-030.

Problem Statement

The push-based skill injection pipeline (#1050) uses pattern matching + semantic search at the system layer to detect intent and inject skills. This works well for common patterns but has gaps:

  • Novel or ambiguous requests may not match any pattern
  • The filler-stripped fallback query may not be semantically close to any skill description
  • External Claude agents (via ACP) have no way to discover available skills
  • The 8B model is capable of meta-reasoning but has no mechanism to request specific capabilities

Proposed Solution

find_skills tool

A new tool available to:

  • The 8B model (when selected as active model)
  • External agents via MCP tool exposure
  • NOT the 3B model (meta-reasoning unreliable at this scale)
{
  "name": "find_skills",
  "description": "Search for agent skills by describing what you need to accomplish. Returns skill descriptions with available tools and guidance.",
  "parameters": {
    "query": { "type": "string", "description": "What you need to accomplish" },
    "limit": { "type": "integer", "default": 3 }
  }
}

Returns skill descriptions + tool whitelists. The agent then self-adopts the skill's context for the current turn.

Confidence-based routing

When an agent calls find_skills:

  • If top result similarity > 0.8 → return full skill with prompts and tool whitelist
  • If 0.6-0.8 → return skill description only (let agent decide)
  • If < 0.6 → return "no matching skill found, proceed with general capabilities"

Telemetry

Log all find_skills calls with:

  • Query text
  • Top match skill ID + similarity score
  • Whether the agent adopted the skill
  • Turn outcome (success/failure)

This data identifies where new skills are needed and where existing skill descriptions should be improved.

MCP exposure

Register find_skills as an MCP tool so external Claude agents can discover and adopt NodeSpace skills during ACP sessions.

Acceptance Criteria

  • find_skills tool implemented in agent tools module
  • Tool available only to 8B model (gated by model capability check)
  • Tool exposed via MCP for external agents
  • Confidence-based routing with configurable thresholds
  • Skill adoption: agent can inject returned skill context into current turn
  • Telemetry logging: query, match, score, adoption, outcome
  • System prompt guidance for 8B: "When you don't know how to accomplish a task, use find_skills"
  • Integration with existing push-based pipeline (push takes priority, find_skills as fallback)
  • Tests: tool execution, confidence routing, MCP exposure, model gating
  • Code passes bun run quality:fix
  • Tests pass (bun run test:all)

Technical Specifications

Reference Files (post-#1050)

  • Tool implementation: packages/agent/src/local_agent/tools.rs (add find_skills tool)
  • MCP handler: packages/core/src/mcp/handlers/ (new skills handler)
  • Skill pipeline: packages/agent/src/skill_pipeline.rs (extend with pull-based path)
  • Model capability check: packages/agent/src/local_agent/model_manager.rs (model metadata)
  • Telemetry: packages/agent/src/telemetry.rs (new, or extend existing logging)

Interaction with Push-Based Pipeline

User Message
  → [1] Push-based: intent extraction + skill search (from #1050)
  → [2] If push found skill → use it (skip find_skills)
  → [3] If push found nothing → agent turn begins with all tools + find_skills
  → [4] Agent may call find_skills → skill injected for remainder of turn

Push-based injection always takes priority. find_skills activates only when heuristics miss.

ADR Reference

Dependencies

Non-Goals

  • LLM-based intent classification (separate future work)
  • Skill chaining / pairs_with relationships (future)
  • Agent spawning from skills (future — depends on multi-agent architecture)
  • Exposing find_skills to 3B model

Metadata

Metadata

Assignees

Labels

aiarchitectureenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions