SuperAPI AI 工具集

mnemonics

智能体与模型

查看项目

更新于 10-15 09:44

技能介绍

用途

Mnemonics 用于在多次对话之间进行持久记忆管理。它通过 @historian 子智能体来存储、检索和管理记忆,使重要的决策、偏好、经验教训和已知问题能够跨会话保留。

主要能力

记忆工具只能通过 @historian 子智能体使用,不能直接调用,包括:

  • memory_remember:创建或更新记忆
  • memory_recall:搜索和检索记忆
  • memory_forget:删除记忆
  • memory_list_types:列出可用的记忆类型
  • memory_sync:重建搜索索引

记忆类型包括:

  • architectural-decision:系统架构选择,例如“使用 PostgreSQL 配合只读副本进行扩展”
  • design-decision:UI/UX 决策,例如“仪表盘采用卡片布局,桌面端三列”
  • learning:经验教训和发现,例如“Bun 原生支持 TS,无需构建步骤”
  • user-preference:用户偏好,例如“用户偏好深色模式,使用制表符而非空格”
  • project-preference:团队约定,例如“使用约定式提交,需要 PR 审查”
  • issue:已知问题,例如“限流尚未实现,在 #42 中跟踪”
  • context:通用上下文(默认),例如“项目于 2026 年 2 月启动,MVP 目标为第二季度”
  • recurring-pattern:可复用模式,例如“错误处理:包裹在 try/catch 中,返回 {error}”
  • conventions-pattern:编码标准,例如“使用命名导出,避免默认导出”

项目可能通过配置定义自定义记忆类型。可使用 @historian list all memory types available 查看当前项目的完整列表。

使用方式

通过 @historian 子智能体进行委派。

记住(创建/更新)的时机:

  • 做出重要的架构或设计决策之后
  • 用户表达其工作方式偏好时
  • 发现关于代码库或工具的重要信息时
  • 学到应跨会话保留的经验教训时

召回(搜索/检索)的时机:

  • 开始新会话时,召回相关上下文
  • 用户询问“我们关于 X 决定了什么?”
  • 需要检查某个决策是否已经做出
  • 查找已知问题或模式

遗忘(删除)的时机:

  • 用户希望移除过时或错误的记忆
  • 清理重复或不相关的条目

同步(重建索引)的时机:

  • 手动编辑 .mnemonics/ 中的记忆文件之后
  • 搜索结果看起来过时时

示例提示:

记住:

  • @historian remember that we decided on JWT auth with 15-min expiry
  • @historian save this learning: Bun handles TypeScript natively without compilation
  • @historian note that the user prefers minimal UI animations
  • @historian store this as an architectural-decision: we're using event sourcing for the audit log

召回:

  • @historian what did we decide about authentication?
  • @historian recall any known issues with the API
  • @historian what are my preferences for this project?
  • @historian show all architectural decisions
  • @historian find memories about database choices

管理:

  • @historian list all memory types available
  • @historian forget the memory about the old API design
  • @historian sync the index to include recent memory files

工作原理

记忆以 Markdown 文件形式存储在 .mnemonics/{type}/{title}.md 中,带有 YAML frontmatter。索引通过 qmd(BM25 与向量混合搜索)自动完成。Historian 负责分类、去重和语义搜索。文件对 git 友好,可以提交以在团队间共享。

适用场景

适用于需要跨会话保留项目知识、决策记录、用户偏好、团队约定和已知问题的开发协作场景,尤其适合多人协作且希望将记忆文件纳入版本控制的项目。

限制

记忆工具只能通过 @historian 子智能体调用,不能直接使用。项目可能定义自定义记忆类型,需通过 @historian list all memory types available 查看完整列表。

最佳实践

  • 标题要具体,例如“qmd-cli-for-writes”而非“important decision”
  • 让 historian 进行分类,它会先搜索以避免重复
  • 决策前先召回,检查是否已有相关决策
  • 提交记忆文件,它们是项目知识的一部分