Skip to content

Tool system: Semantic tool retrieval (lazy tools with embeddings) #364

Description

@Delqhi

Problem

--lazy-tools reduces the manifest by simple keyword matching. The model still receives a flat list. SOTA systems use semantic tool retrieval: embed the task + tool descriptions, return only top-K relevant tools.

What to do

  1. internal/toolretrieval/ package:
    • Embed tool descriptions (reuse internal/memory/embed.go or local embedding)
    • Index all tools at startup
    • Retrieve(task string, k int) []ToolSpec returns top-K relevant tools
  2. sin-code chat --lazy-tools uses semantic retrieval instead of keyword filter
  3. sin-code tool-search "auth module" — debug command
  4. Cache embeddings in ~/.config/sin-code/tool-embeddings.bin
  5. Include tool examples in embedding for better matching

Acceptance criteria

  • Semantic tool retrieval works
  • Top-K relevant tools returned
  • Embedding cache persistent
  • Debug command
  • Better relevance than keyword matching

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions