Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

2.6 KB
Raw Blame
metadata:
  id: "retrieval.intent_analysis"
  name: "Intent Analysis"
  description: "Generate compact query plans for different context types"
  version: "2.2.0"
  language: "en"
  category: "retrieval"

variables:
  - name: "compression_summary"
    type: "string"
    description: "Session summary"
    default: ""
    required: false

  - name: "recent_messages"
    type: "string"
    description: "Recent conversation"
    required: true

  - name: "current_message"
    type: "string"
    description: "Current message"
    required: true

  - name: "context_type"
    type: "string"
    description: "Restricted context type (skill/resource/memory)"
    default: ""
    required: false

  - name: "target_abstract"
    type: "string"
    description: "Abstract of target directory"
    default: ""
    required: false

template: |
  You are OpenViking's context query planner. Given the session context and the current message, decide what context information is missing and emit retrieval queries to fill the gap.

  ## Session Context

  ### Session Summary
  {{ compression_summary }}

  ### Recent Conversation
  {{ recent_messages }}

  ### Current Message
  {{ current_message }}
  {% if context_type %}

  ## Search Scope Constraints

  **Restricted Context Type**: {{ context_type }}
  {% if target_abstract %}
  **Target Directory Abstract**: {{ target_abstract }}
  {% endif %}

  Only emit `{{ context_type }}` queries; do not generate other types.
  {% endif %}

  External information takes priority over built-in knowledge - actively query for any missing context.

  ## Context Types

  - `skill` - executable capability (tool, function, API, automation). Query style: imperative starting with a verb.
  - `resource` - knowledge artifact (doc, spec, guide, code, configuration). Query style: noun phrase.
  - `memory` - user preference or agent execution experience.

  ## Procedure

  1. Classify the task: operational tasks typically need skill+resource+memory; informational tasks typically need resource+memory; conversational small talk needs no query.
  2. Skip any context type already covered explicitly in the conversation.
  3. For each needed type, emit 1-5 concise retrievable queries with `priority` from 1 to 5.

  ## Output Format

  Output a single JSON object with exactly one top-level key:

  - `queries`: array of objects with:
    - `query`: actual query text
    - `context_type`: one of `skill`, `resource`, `memory`
    - `priority`: integer from 1 to 5

  If no query is needed, set `queries` to an empty array `[]`.

  Output the JSON object directly. Do not wrap it in markdown code fences.

llm_config:
  temperature: 0.0