Traditional search integration for retrieving exact technical facts and error logs.

Install

mkdir -p .claude/skills/memory-grep && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13928" && unzip -o skill.zip -d .claude/skills/memory-grep && rm skill.zip

Installs to .claude/skills/memory-grep

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

传统检索引擎集成:利用 SmartGrep (BM25 + Fuzzy) 召回向量匹配难以处理的精确事实。当用户询问特定错误 ID、唯一代号、或特定的代码 API 细节时触发。
88 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Retrieve precise facts when vector search fails
  • Perform weighted keyword retrieval using BM25
  • Conduct fuzzy matching for misspelled queries
  • Handle unique identifiers like error IDs or API details
  • Provide zero-cost synonyms for technical categories
  • Prioritize precise matches from SmartGrep in output

How it works

The skill uses BM25 and Fuzzy Trigram algorithms to retrieve precise facts, even with misspellings, and includes built-in synonyms for technical categories. It prioritizes these exact matches over vector search results.

Inputs & outputs

You give it
A query for specific error IDs, unique codes, or code API details
You get back
Precise facts from SmartGrep, with BM25 or fuzzy matching indicators

When to use memory-grep

  • Retrieving specific error codes
  • Finding unique configuration paths
  • Looking up exact technical terms
  • Debugging with stack traces

About this skill

🧠 Memory-Grep Skill

核心理念

当向量搜索失效时,回归传统关键词的力量。

向量检索的弱点(需要使用此 Skill 的场景):

  • 唯一代号:如 REQ-001BUG-004 等,向量容易召回语义相近但不相关的文档。
  • 特定术语:如 ClawRouterPWA-Offline 等,向量由于 embedding 的稀释,召回权重低。
  • 错误堆栈:如特定的 Traceback 信息,向量无法通过局部匹配精确定位。
  • 配置文件路径:如 /etc/nginx/conf.d/ 等。

🛠️ 工作原理:传统检索主线

此 Skill 主要依赖后端 SmartGrepServiceMemoryServiceauto 模式:

  1. BM25 (Best Match 25):权重化关键词检索,对出现频率低但重要的词(如专有名词)赋予高分。
  2. Fuzzy Trigram:容错检索。即使你查询时有拼写错误(如把 PostgreSQL 写成 Postgre),也能召回。
  3. 零成本同义词:内置 14 个技术分类,搜“数据库”自动关联“db/mysql/postgres”,无需消耗 Token 调用 LLM。

🧭 执行指南

1. 识别场景

如果你(Agent)在上下文中看到 --- DEEP MEMORY (Tier-3 Vector) --- 召回的内容与用户的核心实体完全不符,你应意识到语义漂移

2. 利用检索证据

get_context 召回的上下文中,请重点观察: --- LOG EVIDENCE (SmartGrep) --- 区块。

  • [bm25] 标记:表示词根绝对匹配(硬核事实)。
  • [fuzzy] 标记:表示高度相似匹配(可能含拼写纠正)。

3. 输出策略

在最终回答中,如果信息来自 SmartGrep,请优先信任其精确性。例如:

  • ❌ “系统提到了一些关于数据库优化的内容。”
  • ✅ “根据 SmartGrep 的日志证据,在 2026-03-18.md 中记录了针对 PostgreSQLIndex creation 决策。”

🔗 协同关系

  • 输入MemoryService.get_context(query) 自动触发。
  • 决策层memory_governance_service 评估密度。
  • 互补:作为 Deep Vector (Tier-3) 的高性能并行分支。

When not to use it

  • When semantic vector search is sufficient for the query
  • When the query does not involve specific identifiers, terms, or stack traces
  • When the user is not experiencing semantic drift in vector search results

Limitations

  • Primarily for retrieving exact facts, not conceptual information
  • Relies on keyword matching, not semantic understanding
  • Output is marked with `[bm25]` or `[fuzzy]` indicators

How it compares

This skill acts as a fallback to vector search, providing precise keyword-based retrieval for specific identifiers and terms, which vector search often struggles with due to semantic dilution.

Compared to similar skills

memory-grep side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
memory-grep (this skill)04moNo flagsIntermediate
exploring-codebases05moReviewIntermediate
cellar04moReviewIntermediate
leetcode01moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry