360 Secure SkillHub
360 安全技能中心

skill-retrieval-gate

核心功能:判断当前任务是否需先调用memory_search,遵循按需检索、少而精、快速 fallback的规则,包含检索必要性判断、构建精准查询、精简结果集等步骤,避免无意义检索以降低token消耗。典型场景:续接项目工作、基于已有文档/笔记处理、判断检索是否值得等。输出需明确是否检索、查询内容、结果数量及是否 fallback。

otweihan
otweihan
热度 42.01
最近更新 2026-05-11 17:36:19
分类:自动化依赖:纯提示词应用场景:工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add skill-retrieval-gate
Metadata
name
skill-retrieval-gate
description
Decide whether to run `memory_search` before following another skill or workflow, so the agent can reduce token usage without forcing retrieval on every task. Use when a task may depend on local knowledge, project history, prior decisions, user preferences, or existing notes, and you need a lightweight rule for when to retrieve, how to query, how much context to load, and when to fall back. Typical triggers include requests like: continue previous work, use project memory first, check what we already documented, base this on existing notes, or decide whether retrieval is worth it before following the skill.

Skill Retrieval Gate

Goal

Use this skill to decide whether the current task should query memory_search before following another skill or workflow.

This skill is for retrieval judgment, not mandatory retrieval.

Core rule

Do not make every skill query memory first.

Instead:

  1. Judge whether the task depends on local knowledge or history
  2. Retrieve only when that dependency is real
  3. Load only a few high-signal results
  4. Fall back immediately if retrieval is weak, unavailable, or unnecessary

Example triggers

This skill is especially useful for requests like:

  • continue the previous work on this project
  • check what we already documented before you proceed
  • use project memory first if this depends on earlier decisions
  • decide whether retrieval is worth it before following the skill
  • base this on existing notes instead of asking me again

Workflow

1. Decide whether retrieval is needed

Use decision-flow when the request may depend on:

  • project history
  • prior decisions
  • local knowledge bases
  • user-specific preferences
  • previously organized notes

2. Judge the skill tier

Use skill-tiering to classify the current skill or task into:

  • retrieval-first
  • retrieval-optional
  • retrieval-usually-skip

3. Build the query

Use query-construction to build a compact query from:

  • task object
  • task type
  • key module, symptom, or entity

4. Keep the result set small

Use result-trimming to limit context expansion.

Default rule:

  • fetch top 1-3 results first
  • only expand deeper when clearly needed

5. Fall back fast

Use fallback-rules if retrieval is empty, noisy, low-confidence, unavailable, or unnecessary.

Anti-patterns

Avoid these mistakes:

  • forcing retrieval for every task
  • copying the entire user prompt into memory_search
  • expanding every hit just because it matched
  • dragging weak or stale snippets into later reasoning
  • treating retrieval failure as a blocker instead of falling back

Output expectation

After using this skill, the agent should be able to answer:

  • Should I call memory_search for this task?
  • What query should I use?
  • How many results should I keep?
  • Should I fall back to the original skill flow immediately?