kid0317/crewai_mas_demo/search-memory
Claude Code and agent skill by kid0317/crewai_mas_demo
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
搜索 XiaoPaw 的历史对话记忆。当用户询问过去发生的事、之前的偏好、历史任务结果时使用。支持语义搜索('上次那个航班')、关键字搜索('PDF转换')、混合搜索('上周的工作文件')。
Install
npx vskill@latest install kid0317/crewai_mas_demo/search-memorySKILL.md
search_memory Skill
功能说明
在 pgvector 数据库中搜索 XiaoPaw 的历史对话记忆,支持三种搜索模式的混合使用。
数据库结构
连接信息(从环境变量读取):
- DSN:
MEMORY_DB_DSN,默认postgresql://xiaopaw:xiaopaw123@localhost:5432/xiaopaw_memory
memories 表字段说明:
| 字段 | 类型 | 说明 | 搜索方式 | |
|---|---|---|---|---|
id | TEXT | 主键 | — | |
session_id | TEXT | 来源 session | 标量过滤 | |
routing_key | TEXT | 用户标识(p2p:ou_xxx) | 标量过滤 | |
user_message | TEXT | 用户原始消息 | 全文搜索 | |
assistant_reply | TEXT | 助手回复 | 展示用 | |
summary | TEXT | 一句话摘要 | 向量搜索 | |
tags | TEXT[] | 领域标签(工作/文件处理/日程/搜索/代码等) | 标量过滤 | |
created_at | TIMESTAMPTZ | 写入时间 | 标量过滤 | |
turn_ts | BIGINT | 对话时间戳(毫秒) | 标量过滤 | |
summary_vec | vector(1024) | 摘要语义向量 | 向量搜索 | |
message_vec | vector(1024) | 原始对话语义向量 | 向量搜索 | |
search_tsv | TSVECTOR | 全文索引(自动维护) | BM25近似 |
搜索策略选择
根据用户问题类型选择搜索策略:
| 场景 | 策略 | 示例 | |
|---|---|---|---|
| 语义模糊查询 | 纯向量搜索 | "上次那个航班"、"之前聊过的投资建议" | |
| 精确关键字 | 纯全文搜索 | "PDF转换"、"错误码500" | |
| 有时间/标签限制 | 混合搜索 | "上周的工作文件"、"代码相关的历史" | |
| 通用查询 | 混合搜索(推荐) | 大多数情况下混合搜索效果最好 |
调用方式
调用 scripts/search.py,通过命令行参数传入搜索条件:
参数说明
| 参数 | 必填 | 说明 | |
|---|---|---|---|
--query | 是 | 搜索意图(自然语言) | |
--tags | 否 | 标签过滤,逗号分隔(如 工作,文件处理) | |
--days | 否 | 时间范围,最近N天(如 7 表示最近一周) | |
--routing_key | 否 | 限定用户(默认不限) | |
--limit | 否 | 返回条数,默认 5 | |
--mode | 否 | 搜索模式:hybrid(默认)/ vector / fulltext |
输出格式
JSON 数组,每条记录包含:
搜索示例
示例1:语义搜索(用户问"上次那个航班")
示例2:混合搜索("上周帮我处理的文件")
示例3:全文搜索(精确关键字)
注意事项
- 搜索结果按相关性得分降序排列,取 topK
- 混合搜索得分 = 向量得分 × 0.7 + 全文得分 × 0.3
- 如果搜索结果为空,按以下顺序放宽条件重试:
- 先去掉
--days限制(时间范围可能太窄) - 再去掉
--tags限制(标签可能不匹配) - 最后切换到
--mode vector纯语义搜索(关键字可能不准)
- 如果需要查看完整回复内容,
assistant_reply字段已包含
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/search_memory/SKILL.md
Popularity
- Repository stars
- 109
- Repository forks
- 57
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kid0317/crewai_mas_demo/search-memory)