Skip to content

Skill node type with intent-driven push-based injection and tool whitelisting #1050

Closed

Description

@malibio

Overview

Introduce a skill node type that wraps tools with rich guidance and is discovered via intent-driven semantic search at the system layer. Skills scope available tools per turn via whitelisting, reducing 3B model errors. This is Phase 3 of ADR-030.

Problem Statement

Even with improved prompts (#1040) and prompt-as-nodes (#1049), the agent still sees all tools on every turn. The 3B model makes selection errors when presented with 7 tools. Tool JSON schema descriptions are too thin to guide reliable usage. There is no mechanism to provide task-specific guidance, few-shot examples, or tool restrictions based on what the user is trying to accomplish.

Proposed Solution

New node type: skill

A behavioral configuration that defines what the agent can do and how:

Properties:
  - description: string (for semantic matching — gets embedded)
  - tool_whitelist: string[] (which tools this skill can use)
  - max_iterations: integer (ReAct loop bound for this skill)
  - output_format: string (optional: "text" | "json" | "markdown")

Relationships:
  - includes -> prompt nodes (guidance, examples, constraints)

Content holds a high-level description optimized for semantic search matching.

Example skill: "Research & Search"

Content: "Search and explore the knowledge graph to find relevant information, 
          discover connections, and answer questions about stored knowledge."
tool_whitelist: ["search_semantic", "search_nodes", "get_node"]
max_iterations: 2
includes:
  → prompt: "When to use semantic vs keyword search..." (role: guidance)
  → prompt: "User: 'What do I know about X?' → search_semantic('X concepts')" (role: few-shot)

Intent-driven pre-turn pipeline

Runs in the system layer (Rust/Tauri), NOT by the model:

User Message
  → [1] Intent Extraction (pattern match → filler strip)
  → [2] Semantic Skill Search (intent query, node_type="skill")
  → [3] Confidence Threshold (>0.8 → inject, <0.8 → base agent)
  → [4] Prompt Assembly (base + skill prompts + scoped tools)
  → [5] Agent Turn

Intent extraction (pattern matching, zero inference cost)

"find duplicates|overlap|similar to each other" → "deduplicate"
"search for|find|look up|what do I know about"  → "search"
"create|make|add a new"                         → "create"
"update|change|modify|edit"                     → "update"
"relate|connect|link"                           → "relate"
"summarize|overview|recap"                      → "summarize"

Fallback: filler-stripped first sentence as raw semantic query.

Tool whitelist scoping

When a skill is active, only its whitelisted tools are included in the inference request. Model sees 2-3 focused tools instead of all 7+.

One active skill per turn. Multi-skill requests chain turns via the ReAct loop.

Playbook integration (for skill assignment)

Playbooks automate skill assignment, NOT prompt assembly:

Trigger: node_created (type: ai-chat)
Condition: trigger.node.content matches "review|audit|check"
Action: add_relationship(trigger.node → code-review-skill, "active_skill")

Acceptance Criteria

  • skill node type registered with behavior and schema
  • skill nodes get embedded (description field drives embedding)
  • Intent extraction module: pattern matching + filler stripping
  • Pre-turn skill search pipeline integrated into agent loop
  • Confidence threshold (configurable, default 0.8) with graceful fallback to base agent
  • Tool whitelist scoping: only skill's tools included in inference request
  • One active skill per turn enforcement
  • PromptAssembler extended to accept active skill and inject skill's prompt nodes
  • Seed default skill nodes: "Research & Search", "Node Creation", "Graph Editing", "Relationship Management"
  • Playbook rule examples for automated skill assignment
  • Telemetry: log intent extraction results, skill matches, confidence scores, fallbacks
  • Tests: intent extraction patterns, skill search pipeline, tool whitelist scoping, confidence threshold
  • Code passes bun run quality:fix
  • Tests pass (bun run test:all)

Technical Specifications

Reference Files (post-#1049)

  • Intent extractor: packages/agent/src/intent.rs (new)
  • Skill pipeline: packages/agent/src/skill_pipeline.rs (new)
  • Skill behavior: packages/core/src/behaviors/mod.rs (extend with skill type)
  • Agent loop integration: packages/agent/src/local_agent/agent_loop.rs (call skill pipeline pre-turn)
  • PromptAssembler extension: packages/agent/src/prompt_assembler.rs (add active_skill parameter)
  • Semantic search: Uses existing NodeEmbeddingService::search_similar() with node_type filter

Token Budget (per ADR-030)

Core identity (hardcoded):       1,500-2,000 tokens
Active skill header:               500-800 tokens
Few-shot examples (top 1-2):       400-600 tokens
Scoped tool schemas (2-3 tools):   500-800 tokens
Conversation history:            ~28,000 tokens

Default Seed Skills

Skill Tools Description
Research & Search search_semantic, search_nodes, get_node Find and explore knowledge
Node Creation create_node, get_node Create new content nodes
Graph Editing update_node, get_node Modify existing nodes
Relationship Management create_relationship, get_related_nodes, get_node Link and traverse nodes

ADR Reference

Dependencies

Non-Goals

  • find_skills as model-callable tool (Phase 4, separate issue)
  • LLM-based intent classification (deferred until pattern matching gaps identified)
  • model_preference / temperature per skill (deferred, single-model system)
  • pairs_with skill chaining hints (deferred, let agent figure it out first)

Activity

  1. added
    enhancement
    on Apr 5, 2026
  2. self-assigned this
    on Apr 6, 2026
  3. malibio commented on Apr 6, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 128 test files, 3918 tests all passing. Rust: 1130 core, 200 agent tests passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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