AGENT SKILL

memory

使用 `memory` 工具有意地搜索、添加或整理你的长期记忆 — 这超出了每一轮已有的自动回忆/捕获。当被问到某人是谁或在做什么、当你得知值得现在就保存的持久事实,或当你的笔记本中有过时或错误的条目需要清理时使用。

License 许可
MIT
所属仓库
irisfeng/moqi
最近更新
2026-11-05
Stars
★ 1
Forks
0

01 前言 Front Matter

name
memory
description
使用 `memory` 工具有意地搜索、添加或整理你的长期记忆 — 这超出了每一轮已有的自动回忆/捕获。当被问到某人是谁或在做什么、当你得知值得现在就保存的持久事实,或当你的笔记本中有过时或错误的条目需要清理时使用。

03 SKILL.md 正文

memory — 搜索、写入并整理你记住的内容

这里的一切都通过带类型的 memory 工具完成。记忆不是文件:用 files 动作 write 或 shell 命令写入 memory/MEMORY.md,只会落在你计算机的磁盘上,并且 会悄无声息地丢失 — 该工具是唯一真正的途径。

每一轮都已经会从你的笔记本中自动回忆一部分有限的选择,放入 "## What you remember" 中, 并在你回复之后自动提取事实。本技能针对的是自动路径所遗漏的内容:

  • 搜索(action: "search")— 你记住的内容比自动回忆 注入的更多。搜索覆盖本会话可以读取的每一个笔记本(个人、频道、 组织);当可触及的笔记本不止一个时,每条结果都会标注它 来自哪个笔记本。匹配基于子串(所有词都必须匹配),所以优先使用有区分度的词 (名字、项目),而不是整句话。 空结果表示这些词没有匹配到内容,并不表示没有任何记录。在断定某个事实不存在之前,先减少词的数量或换一种说法再试。
  • 读取另一个笔记本(action: "read", scope: "channel:…")— 使用搜索结果中的确切 范围 ID 来加载该已获授权的笔记本。search 也接受 scope,用来缩小查询范围。省略它则搜索所有已获授权的笔记本,或读取 当前笔记本。访问权限来自本轮的共享策略;仅仅指明一个 范围并不会授予访问权。其他笔记本是只读的。
  • 立即写入(action: "add",facts: [{text}, …])— 当用户纠正你,或告诉你 他们日后会期望你知道的事情时,立即持久保存,而不是指望 轮次之后的提取能抓到。写成自成一体的事实(谁/什么,并带有足以 在毫无上下文时也有用的背景)。重复项会被丢弃;回复中的 added 是 实际新增的数量。
  • 整理(action: "edit" 配合 facts: [{id, text}, …],action: "delete" 配合 ids)— 先搜索或读取以获得每条事实的 #id,然后修正已变化的事实,并删除 过时、重复或错误的事实。只要调用中指明了任何一个不在本会话 笔记本中的 id,就不会改动任何内容,并会列出这些无效的 id。整理是为了质量 — 合并 重复项、删除已被证伪的事实 — 而不是用来删除用户要求你 记住的内容。

你写入的笔记本是本会话自己的(私信中是你的个人笔记本, 频道中是该频道的笔记本)。其他已获授权的笔记本可以在这里搜索/读取,但不能改写。

组织管理员的写入路径改为通过自身 API 完成,使用 $AGENT_API_URL 和 $AGENT_API_TOKEN 调用(两者在每一轮都已在你的环境中 — 如果未设置,说明此实例没有自身 API;如实说明,不要假装有)。

组织级笔记本(管理员)

当正在聊天的用户是组织管理员时,自身 API 还接受组织级 笔记本作为目标:

curl -fsS -X POST "$AGENT_API_URL/v1/memory/facts" \
  -H "x-agent-capability: $AGENT_API_TOKEN" \
  -H "content-type: application/json" \
  -d '{"scope":"org","facts":["..."]}'

(GET /v1/memory/self 上用 ?scope=org;整理时,在 PATCH /v1/memory/facts 的请求体中配合 {"facts":[{"id","text"}]},或在 DELETE /v1/memory/facts 的请求体中配合 {"ids":[…]},使用 "scope":"org"。) 这些写入会落在组织内每个会话都会回忆的笔记本中,所以写入之前要与管理员确认 措辞,并且不要把个人事实放进去。出现 403 org memory writes require an org admin 表示该用户不是管理员 — 如实说明,不要 重试(GET $AGENT_API_URL/v1/admin/whoami 可以给出明确的答案)。

失败情形

  • "memory isn't available in this conversation" — 本会话的记忆策略 禁止使用它;不要重试,只需说明此处记忆已关闭。
  • 在只读唤醒(心跳查看)时,记忆可以搜索和读取,但不能 写入 — 改在正常的轮次中保存该事实。
  • 自身 API 返回 401 unauthorized — 你的令牌在轮次中途过期了;下一轮就会 恢复。

04 同仓库更多 Skills

irisfeng
irisfeng/moqi

use-shared-credential

When you need to call a service the org has a SHARED credential for (a SERP/search key, a paid-API key, a data-vendor feed, a Git remote) — and the platform has told you that credential is available to this conversation — make the call BY PROXY through the credential broker. You never see the secret; the core stamps it onto the outbound request for you.

★ 1
irisfeng
irisfeng/moqi

ui-state

See what the person is looking at in the QM web UI right now — the whole page (sidebar, every multiview pane, open dialogs) as raw HTML, the app's state as JSON, optionally the CSS and a screenshot. Use when they ask about something on their screen, want help with the UI, or you need to check what a canvas you wrote actually rendered.

★ 1
irisfeng
irisfeng/moqi

ui-canvas

Draw your own HTML/CSS/JS as a full-window overlay on top of the QM web UI — a dashboard, a form, a visualization, controls that message you back. Write, update, replace, pin or dismiss it. Use when an interactive or visual result beats a chat reply.

★ 1
irisfeng
irisfeng/moqi

taste-skill

Design taste and process for anything a person will look at in a browser — landing page, dashboard, prototype, deck. The default design driver for a browsable artifact, with an anti-slop playbook for the visual language.

★ 1
irisfeng
irisfeng/moqi

slack-drafts

Create Slack message drafts in the user's own composer, as the user, through their per-user Slack OAuth. Drafting only — the user reviews and sends from Slack.

★ 1
irisfeng
irisfeng/moqi

send

Make a PR, wait for CI with bounded transport retries, independently review, and merge only when all gates pass.

★ 1