mcpField
M
material-retrieve

material-retrieve

github.com/simonwongCreative & media963 installsUpdated 1d ago
Repository

About material-retrieve

A skill for finding writing materials in a local library using keywords, tags, type, sentiment, and reusability. It ranks matches and reads the full content of up to 10 results.

Key features

  1. 01Combine multiple search criteria
  2. 02Fuzzy-match keywords and tags
  3. 03Rank by relevance and reusability
  4. 04Read full content of matches
  5. 05Show up to 10 results

Use cases

  1. 01Find writing material by topic
  2. 02Filter entries by type or sentiment
  3. 03Locate highly reusable material
  4. 04Search a library for relevant entries

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/simonwong/skills --skill material-retrieve

After installing, type/material-retrievein Claude Code to confirm it loaded.

Details

From the project README

素材检索

从素材库中按条件检索相关素材。

数据路径

素材库位于 ./writing-workspace/materials/:

  • index.jsonl — 素材索引(JSONL 格式,每行一条 {id, summary, tags, type, source_title, reusability})
  • entries/{id}.json — 素材完整内容

执行流程

1. 读取索引

读取 ./writing-workspace/materials/index.jsonl。

  • 如果文件不存在或为空:告诉用户"素材库还是空的,可以用 material-ingest 技能先入库一些文章。"然后结束。
  • 如果有内容:继续检索。
2. 解析用户查询

从用户输入中提取检索条件,支持以下维度的任意组合:

维度示例
关键词"关于创业的素材" → 关键词"创业"
标签"标签是AI的" → 标签匹配"AI"
类型"找一些案例" → type=case
情绪"有没有比较犀利的观点" → sentiment=provocative
复用度"找那些可以直接用的" → reusability=high

如果用户只给了一个主题词,同时按关键词和标签两个维度匹配。

3. 多维匹配

遍历 index.jsonl 中的所有条目,按以下逻辑匹配:

关键词匹配(模糊):

  • 检查 summary 和 tags 中是否包含查询词或其近义词
  • "创业"应匹配"初创公司""创业者""startup"
  • "AI"应匹配"人工智能""大模型""LLM"

标签匹配(精确 + 模糊):

  • 精确匹配优先
  • 同义标签也算匹配(如上)

类型/情绪/复用度匹配(精确):

  • 直接对比字段值
4. 排序

匹配结果按以下优先级排序:

  1. 相关度(匹配维度越多越靠前)
  2. 可复用程度(high > medium > low)
  3. 时间(新的优先)
5. 读取完整内容

对排序后的前 10 条结果,读取 entries/{id}.json 获取完整 content。

6. 展示结果
## 素材检索结果

查询:关于"创业"的素材
匹配:共 X 条

| # | ID | 类型 | 摘要 | 标签 | 复用度 |
|---|-----|------|------|------|--------|
| 1 | mat_xxx | viewpoint | ... | 创业, AI | high |
| 2 | mat_xxx | case | ... | 初创公司 | medium |

---

### 详细内容

**1. mat_xxx** [viewpoint] — 来自《原文标题》
> 完整内容...

**2. mat_xxx** [case] — 来自《原文标题》
> 完整内容...

如果没有匹配结果,告诉用户"没有找到相关素材",并建议扩大搜索范围或入库更多文章。

注意事项

  • 结果不超过 10 条。如果匹配太多,只展示最相关的 10 条并告知用户总数。
  • 展示完整内容时保留原文措辞,不做改写。
  • 如果用户的查询太模糊(比如只说"找素材"),询问具体主题或方向。

Comments

Markdown supported