知识召回技能 - 从四层存储查询历史知识并注入当前会话上下文
Recalls historical knowledge from four storage layers to refresh context and avoid repeating past mistakes.
npx claudepluginhub cuipengfei/promptsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
从四层存储查询历史知识,并注入当前会话上下文。
用户可能感到烦躁,因为:
处理方式: 先主动道歉,再展示召回结果。
用户只是想查询历史记录:
处理方式: 直接展示召回结果,不假设用户沮丧。
用户调用 /recall 无参数:
处理方式: 展示所有四层的简洁摘要。
与 auto-extract 存储层完全对应:
| 层级 | 核心问题 | 特性 |
|---|---|---|
| Layer 1: 用户配置 | "每个会话都需要知道什么?" | 跨项目、身份性、自动加载 |
| Layer 2: 项目根配置 | "这个项目整体需要知道什么?" | 项目级、版本控制 |
| Layer 3: 子模块配置 | "这个子模块需要知道什么?" | 子模块特定、就近原则 |
| Layer 4: 情境记忆 | "特定情境下需要召回什么?" | 情境性、按需查询 |
查询前必须先探测,不假设任何特定文件、工具或服务存在。
扫描用户级配置文件,检测是否存在:
~/.claude/CLAUDE.md检测到哪个查询哪个。不存在则跳过该层。
扫描项目根目录,检测以下文件是否存在:
{repo}/AGENTS.md{repo}/CLAUDE.md{repo}/.claude/CLAUDE.md所有检测到的文件均参与查询。
扫描项目中子目录里已存在的配置文件(AGENTS.md 或 CLAUDE.md)。
探测方式: 搜索 {repo}/**/AGENTS.md 和 {repo}/**/CLAUDE.md(排除根目录,排除 node_modules 等)。
如果有相关参数(如 /recall oc-tweaks 发布),优先查询语义最近的子模块配置。
按优先级探测可用的记忆后端:
{repo}/.opencode/memory/、{repo}/.memory/)或全局是否存在 memory 目录(含 *.md 文件)。有则用 Read 操作查询。.memory/ 目录: 使用项目内的 .memory/ 目录(如果存在)。原则: 探测到什么用什么。不要求用户安装任何额外依赖。
分析用户为什么调用 /recall:
如果用户提供了参数(如 /recall 代码风格),用它们作为主要关键词。
如果参数类似"我不知道/你看看/refresh",视为场景 3(主动刷新):四层都查,每层展示最相关的 2-3 条。
1. 读取探测到的用户级配置文件
2. 按 section 标题匹配关键词
3. 提取相关段落
1. 读取探测到的项目根配置文件(可能有多个)
2. 按 section 标题匹配关键词
3. 提取相关段落
1. 读取探测到的子模块配置文件
2. 优先查询与关键词语义最近的子模块
3. 提取相关段落
根据探测到的后端类型执行对应查询:
按层级分组展示结果:
## 召回结果
### L1 用户配置(来自 {探测到的文件名})
找到 X 条相关内容:
- **[Section 标题]**: [相关内容摘要]
### L2 项目根配置(来自 {探测到的文件名})
找到 X 条相关内容:
- **[Section 标题]**: [相关内容摘要]
### L3 子模块配置(来自 {探测到的文件名})
找到 X 条相关内容:
- **[Section 标题]**: [相关内容摘要]
### L4 情境记忆(来自 {探测到的后端描述})
找到 X 条相关记录:
- **[主题]**: [内容摘要]
---
**应用到当前情况**: 基于这些召回,我会...
如果同一主题在多层命中,视为存储不一致:必须显式标注来源并提醒清理。
根据触发场景调整响应:
| 场景 | 响应开头 |
|---|---|
| 沮丧 | "抱歉让你重复了。我回顾了之前的记录..." |
| 常规 | "我查询了历史记录,找到以下相关内容..." |
| 刷新 | "以下是当前相关的知识摘要..." |
如果用户提供了主题(如 /recall 代码风格):
如果没有提供主题:
如果某层已有足够相关内容:
我查询了四层数据源,但没有找到与 "[主题]" 相关的记录。
已搜索:
- L1 用户配置 - {文件名或"未检测到"} - 无匹配
- L2 项目根配置 - {文件名或"未检测到"} - 无匹配
- L3 子模块配置 - {文件名或"未检测到"} - 无匹配
- L4 情境记忆 - {后端描述或"无可用后端"} - 无匹配
可能原因:
- 这个话题还没有被学习过
- 尝试使用不同的关键词
你能告诉我具体是什么情况吗?
跳过该层并继续查询下一层,在结果中注明"未检测到"。
L4 情境记忆:无可用后端,仅查询了配置文件层。
跳过 Layer 3,不报错。在结果中注明"无子模块配置"。
| auto-extract 存储层 | knowledge-fetch 查询层 | 核心问题 |
|---|---|---|
| L1 用户配置 | L1 用户配置 | "每个会话都需要知道什么?" |
| L2 项目根配置 | L2 项目根配置 | "这个项目整体需要知道什么?" |
| L3 子模块配置 | L3 子模块配置 | "这个子模块需要知道什么?" |
| L4 情境记忆 | L4 情境记忆 | "特定情境下需要召回什么?" |
边界原则:
确保双向一致:学习时分类到哪层,召回时就从哪层查询。
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.