Skip to content

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

3.9 KB
Raw Blame
memory_type: tools
description: |
  Record all tool calls, and extract tool usage patterns, execution results, and learnings from tool calls.

  What to extract:
  - Successful tool usage patterns with context
  - Failed tool attempts with lessons learned
  - Tool combinations that work well together
  - Performance insights: which tools are fast/slow for different tasks

  What NOT to extract:
  - Trivial tool calls without learning value
  - Duplicate patterns already captured
  - Tool calls with no meaningful outcome
directory: "viking://user/{{ user_space }}/memories/tools"
filename_template: "{{ tool_name }}.md"
enabled: false
content_template: |
  Tool: {{ tool_name }}

  Static Description:
  "{{ static_desc|default('N/A') }}"

  - Success rate: {{ (((success_time|default(0, true)) / ((call_count|default(0, true)) if (call_count|default(0, true)) > 0 else 1)) * 100)|round|int }}% ({{ success_time|default(0, true) }}/{{ call_count|default(0, true) }})
  - When to use: {{ when_to_use|default('N/A') }}
  - Optimal params: {{ optimal_params|default('N/A') }}
  - Common failures: {{ common_failures|default('N/A') }}
  - Recommendation: {{ recommendation|default('N/A') }}

  {{ guidelines|default('') }}

fields:
  - name: tool_name
    type: string
    description: |
      Tool name, copied exactly from [ToolCall] records without modification.
      Used to uniquely identify this tool memory.
      Examples: "web_search", "read_file", "execute_code"
    merge_op: immutable

  - name: static_desc
    type: string
    description: |
      Static description of the tool, basic functionality description.
      Examples: "Searches the web for information", "Reads files from the file system"

  - name: call_count
    type: int64
    description: |
      Total number of tool calls, accumulated from historical statistics.
      Used to calculate success rate and average duration.
    merge_op: sum

  - name: success_time
    type: int64
    description: |
      Number of successful tool calls, accumulated from historical statistics.
      Counts calls with status "completed".
    merge_op: sum

  - name: when_to_use
    type: string
    description: |
      Hint for when this tool should be retrieved and used, describing in what scenarios this tool works best.
      Examples: "When needing to read configuration files or JSON data from filesystem; When handling file read errors or implementing robust file operations"
    merge_op: patch

  - name: optimal_params
    type: string
    description: |
      Optimal parameter range/best practices for the tool, describing general parameter optimization suggestions.
      Should describe general best practices (such as "max_results=5-20", "timeout>30s for large files"),
      do not describe specific case values (such as "command: 'echo hello'").
      Examples: "max_results: 5-20 (larger values may timeout); language: 'en' for better results; query: specific multi-word phrases with qualifiers"
    merge_op: patch

  - name: common_failures
    type: string
    description: |
      Common failure modes of the tool, describing problems and error patterns this tool frequently encounters.
      Examples: "Single-word queries return irrelevant results; max_results>50 causes timeout; non-English queries have lower quality"
    merge_op: patch

  - name: recommendation
    type: string
    description: |
      Actionable recommendations for tool usage, short actionable recommendations.
      Examples: "Use specific multi-word queries like 'Python asyncio tutorial'; add qualifiers like 'guide', 'docs', 'example'"
    merge_op: patch

  - name: guidelines
    type: string
    description: |
      Tool usage guidelines, complete usage guide content.
      Must include exact English headings:
      - "## Guidelines" - best practices
      - "### Good Cases" - successful usage examples
      - "### Bad Cases" - failed usage examples
    merge_op: patch