跳到正文
  1. 技能速查
  2. 汇报、复盘、越用越顺
  3. /pstack:reflect

/pstack:reflect

按需点名

一句话做完一件事,让三个审阅者读对话、提改进建议,你批准了才改。

什么时候用
某次任务太慢、走了弯路,想下次别再犯。
这样说
/pstack:reflect 这次太慢了,把学到的记下来,下次别再重复。

用它和不用它

同一件事,直接跟 AI 说,和点名用 /pstack:reflect,AI 的做法不一样:

直接说用 /pstack:reflect
发现问题就直接改技能文件列出接受、拒绝、待办三份清单,等你批准才改
一次性的小事也当成经验记下只留能长期用的经验,琐碎的对话直接跳过
跨项目翻遍所有聊天记录只在当前工作区的会话目录里找这次对话

文档写了什么

原文分 6 节,约 950 个英文单词,中文译文约 1350 字,读完约 4 分钟。点一节直接跳到全文。

开头说明用途:从这次对话里挖出能长期用的经验,改进技能。琐碎的对话、已有技能管住的情况就跳过。

  1. 1找到当前的对话记录按所用工具找到这次对话的记录文件,用开头那句话确认,不跨项目乱翻。
  2. 2同时派出三个审阅者同时派出判断、工具、发散三个帮手 AI,模型按 pstack 设置文件或默认值来选。
  3. 3综合再派一个帮手 AI 核对引用,汇总成接受、拒绝、待办三份清单。
  4. 4检查能不能用结构来保证能用 lint、脚本或运行时检查管住的条目,从接受挪到待办。
  5. 5应用待办直接提交到任务跟踪,接受的改动等你批准,改在技能副本上,不开 PR 也不推送。
  6. 6给用户总结用短清单收尾:改了哪些技能、新建了什么、提交了哪些待办、丢掉了什么及原因。

看写法亮点读全文

写法亮点

挑了几句原文:每句让 AI 做什么、为什么这样写管用、你写提示词时怎么借来用。

  1. 用一句短话划掉一类

    One-offs are not learnings.

    一次性的事不算经验。

    让 AI
    它只记以后还会用上的经验,一次碰巧的意外不会写进技能。
    为什么管用
    这么短的一句排除,挡住了最常见的误判:把偶然当成规律。
    借来用
    让 AI 总结项目时加一句:「只写以后还会遇到的问题,这次碰巧的不算。」
  2. 把批准设成硬关卡

    wait for explicit approval before applying any Accepted edit

    等到用户明确批准,才应用任何一条 Accepted 的修改

    让 AI
    它先把所有建议摆给你看,只改你点了头的那些。
    为什么管用
    「明确批准」「任何一条」两处把话说死,AI 就不会觉得小改动可以先改了再说。
    借来用
    让 AI 改文件前说:「先把要改的地方列给我,我回复『可以』之前,一个字都别动。」
  3. 先问能不能自动挡住

    Move any Accepted item that a lint rule, script, metadata flag, or runtime check would enforce more reliably to Backlog.

    如果某条 Accepted 的条目,用 lint 规则、脚本、元数据标记或运行时检查来强制执行会更可靠,就把它挪到 Backlog。

    让 AI
    能用脚本或检查自动拦住的问题,它不写成一句提醒,而是放进待办,留着做成自动检查。
    为什么管用
    这句话让 AI 先问「这条靠人记住可靠吗」,把规则引向更可靠的形式。
    借来用
    整理注意事项时说:「哪条能用表格公式自动检查,就别写成提醒,告诉我该加什么公式。」
  4. 给输出一个现成模板

    Short list, no preamble:

    简短列表,不要开场白:

    让 AI
    最后的总结按固定的四类列出,你一眼就看到改了什么、丢了什么。
    为什么管用
    直接给出每一行的格式和占位符,AI 照着填,不会自由发挥成一篇长汇报。
    借来用
    要进度时给个格式:「按这个回我:『已完成:…… 没做的:……(原因)』。」

全文

AI 读到的就是这份 SKILL.md。可以看中文、看原文,或者一段一段对照着看。

descriptionSpawn three parallel review subagents over the active transcript, surface learnings, and route each to a concrete edit on an existing skill. Use when the user says reflect.

description派出三个并行的审阅帮手 AI,去读当前的对话记录,找出值得记下的经验,再把每条经验对应到某个现有技能上的一处具体修改。用户说 reflect 时使用。

Reflect

Reflect(复盘)

Mine the current conversation for durable learnings, then route them into skill edits.

从当前对话里挖出能长期用的经验,然后把它们变成对技能的修改。

Invoke when the user says "reflect" or "/pstack:reflect". Skip when the conversation is trivial, off-topic, or already covered by an existing skill the parent followed correctly. One-offs are not learnings.

用户说「reflect」或「/pstack:reflect」时调用。对话很琐碎、跑题,或者已经有现有技能覆盖、而主 AI 也正确照做了,就跳过。一次性的事不算经验。

1. Locate the active transcript

1. 找到当前的对话记录

Before fanning out, find this conversation's transcript in the active workspace's session directory. Do not glob across every project's directory. That crosses workspace boundaries and reads private chats from unrelated projects.

分头派出帮手 AI 之前,先在当前工作区的会话目录里,找到这段对话的记录。不要在所有项目的目录里一起通配查找。那样会越过工作区的边界,读到无关项目里的私人对话。

Where the transcript lives depends on your harness:

对话记录放在哪,取决于你所用的工具:

  • Cursor: the agent-transcripts/ directory the system prompt names.
  • Cursor: 系统提示词里写明的那个 agent-transcripts/ 目录。
ls -t <agent-transcripts>/*.jsonl <agent-transcripts>/*/*.jsonl <agent-transcripts>/*/subagents/*.jsonl 2>/dev/null | head -10
ls -t <agent-transcripts>/*.jsonl <agent-transcripts>/*/*.jsonl <agent-transcripts>/*/subagents/*.jsonl 2>/dev/null | head -10

That covers the legacy flat (<id>.jsonl), current nested (<id>/<id>.jsonl), and subagent (<parent>/subagents/<child>.jsonl) layouts. For each candidate, read the first JSONL line. Take the file whose message.content[0].text contains the conversation's opening user prompt.

  • Claude Code: ~/.claude/projects/<slug>/<session-id>.jsonl, where <slug> is the workspace path with every character that isn't a letter or digit turned into "-".
  • Pi: ~/.pi/agent/sessions/--<slug>--/*.jsonl, where <slug> is the workspace path with the leading slash dropped and each "/" turned into "-".
  • Codex: ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl. Keep only files whose first line has payload.cwd equal to the workspace path.
  • Other harnesses: check the harness's session directory for this workspace.

这覆盖了旧的平铺结构(<id>.jsonl)、现在的嵌套结构(<id>/<id>.jsonl)和帮手 AI 的结构(<parent>/subagents/<child>.jsonl)。对每个候选文件,读它的第一行 JSONL。选 message.content[0].text 里包含这段对话开头那条用户提示词的那个文件。

  • Claude Code: ~/.claude/projects/<slug>/<session-id>.jsonl,其中 <slug> 是工作区路径,把每个不是字母或数字的字符都换成「-」。
  • Pi: ~/.pi/agent/sessions/--<slug>--/*.jsonl,其中 <slug> 是工作区路径,去掉开头的斜杠,再把每个「/」换成「-」。
  • Codex: ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl。只保留第一行的 payload.cwd 等于工作区路径的文件。
  • 其他工具: 查看该工具为这个工作区准备的会话目录。

Outside Cursor, take the newest candidates first and confirm one by finding the conversation's opening user prompt in its first user message. If none matches, pass a tight digest of the session instead.

在 Cursor 以外,先看最新的候选文件,在它的第一条用户消息里找到这段对话开头的用户提示词,以此确认是哪一个。如果一个都对不上,就改为传一份精简的会话摘要。

2. Spawn three reviewers in parallel

2. 同时派出三个审阅者

One message, three Task calls, subagent_type: generalPurpose, agent mode (readonly: false). Reviewers need MCP access to look up the tickets, chat threads, and observability traces the transcript references, and readonly strips MCPs.

一条消息,三个 Task 调用,subagent_type: generalPurpose,agent 模式(readonly: false)。审阅者需要 MCP 权限,去查对话记录里提到的工单、聊天线程和可观测性追踪记录,而只看不改模式会拿掉 MCP。

Other harnesses. The spawns in this skill use Cursor's Task tool. In another harness, use its subagent tool: Agent in Claude Code (subagent_type: general-purpose), task in OpenCode (subagent_type: general), spawn_agent in Codex. Keep the prompt and the model. Drop parameters your tool doesn't have. If your harness has no subagent tool, as in Pi without an extension, run each role yourself, one after another.

其他工具。 这个技能里派帮手 AI 用的是 Cursor 的 Task 工具。在别的工具里,用它自己派帮手 AI 的工具:Claude Code 里是 Agent(subagent_type: general-purpose),OpenCode 里是 task(subagent_type: general),Codex 里是 spawn_agent。提示词和模型保持不变。你的工具没有的参数,就去掉。如果你所用的工具没有派帮手 AI 的功能,比如没装扩展的 Pi,就自己一个接一个地扮演每个角色。

Each reviewer and the synthesizer name a role line in the pstack settings file (~/.cursor/rules/pstack-models.mdc in Cursor, ~/.claude/rules/pstack-models.md in Claude Code, ~/.agents/pstack-models.md in other harnesses) and a default. Set model to that line's value, or to the default if the file or the line is missing. Leave model unset when the value is auto or inherit-parent. If your subagent tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message or your harness's model list. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section of the poteto-mode skill.

每个审阅者和综合者,都对应 pstack 设置文件里的一行角色配置(Cursor 里是 ~/.cursor/rules/pstack-models.mdc,Claude Code 里是 ~/.claude/rules/pstack-models.md,其他工具里是 ~/.agents/pstack-models.md),外加一个默认值。把 model 设成那一行的值;文件或那一行不存在时,设成默认值。值是 auto 或 inherit-parent 时,不设 model。如果你派帮手 AI 的工具不接受某个模型名,就用默认值,并说出来。如果它连默认值也不接受,就从它的报错信息或你所用工具的模型列表里,选同一系列里最接近的有效模型名。每个帮手 AI 的推理强度,以及用快速还是标准速度,按 poteto-mode 技能里 Subagents 那一节,根据任务来选。

Lens Role line Default model Prompt template
Judgment reflect judgment, divergent, synthesizer claude-opus-5-5-xhigh references/judgment-reviewer.md
Tooling reflect tooling grok-4.7-xhigh-fast references/tooling-reviewer.md
Divergent reflect judgment, divergent, synthesizer claude-opus-5-5-xhigh references/divergent-reviewer.md
视角 角色配置行 默认 model 提示词模板
判断 reflect judgment, divergent, synthesizer claude-opus-5-5-xhigh references/judgment-reviewer.md
工具 reflect tooling grok-4.7-xhigh-fast references/tooling-reviewer.md
发散 reflect judgment, divergent, synthesizer claude-opus-5-5-xhigh references/divergent-reviewer.md

Pass each template verbatim, substituting the transcript path or digest where marked. Reviewers return findings in the Task response body.

每个模板都原样传过去,只在标记的地方换上对话记录的路径或摘要。审阅者在 Task 的返回内容里交回发现。

3. Synthesize

3. 综合

One Task call, subagent_type: generalPurpose, model from the reflect judgment, divergent, synthesizer line (default claude-opus-5-5-xhigh), agent mode (readonly: false). It spot-verifies citations through MCP, and readonly strips MCPs. Pass references/synthesizer.md verbatim, with each reviewer's full output inlined where marked. It returns an Accepted / Rejected / Backlog list.

一个 Task 调用,subagent_type: generalPurpose,model 取自 reflect judgment, divergent, synthesizer 那一行(默认 claude-opus-5-5-xhigh),agent 模式(readonly: false)。它会通过 MCP 抽查引用,而只看不改模式会拿掉 MCP。把 references/synthesizer.md 原样传过去,在标记的地方嵌入每个审阅者的完整输出。它返回一份 Accepted / Rejected / Backlog(采纳 / 驳回 / 待办池)清单。

4. Structural enforcement check

4. 检查能不能用结构来保证

Move any Accepted item that a lint rule, script, metadata flag, or runtime check would enforce more reliably to Backlog. See the encode-lessons-in-structure principle skill.

如果某条 Accepted 的条目,用 lint 规则、脚本、元数据标记或运行时检查来强制执行会更可靠,就把它挪到 Backlog。参见 encode-lessons-in-structure 原则技能。

5. Apply

5. 应用

Present the synthesizer's full Accepted / Rejected / Backlog output and wait for explicit approval before applying any Accepted edit. The user picks the subset and may redirect routings. Skill changes affect every future agent in the org. Do not auto-apply.

把综合者完整的 Accepted / Rejected / Backlog 输出展示出来,等到用户明确批准,才应用任何一条 Accepted 的修改。用户会挑其中一部分,也可能改掉某些条目的去向。技能的改动会影响组织里以后的每一个 AI。不要自动应用。

File each Backlog item to your team's devex or backlog tracker without waiting. Only the Accepted list waits for approval.

每条 Backlog 条目,不用等,直接提交到你们团队的 devex 或待办跟踪系统。只有 Accepted 清单要等批准。

Never edit a skill under plugins/cache/. Before approval, show its destination: .cursor/skills/<skill>/ or ~/.cursor/skills/<skill>/ in Cursor, or your harness's project or user skill folder, such as .claude/skills/<skill>/ or ~/.agents/skills/<skill>/. After approval, copy the skill folder there and edit the copy. Never open a PR or push.

绝不修改 plugins/cache/ 下的技能。批准之前,先给出它要放到哪里:Cursor 里是 .cursor/skills/<skill>/ 或 ~/.cursor/skills/<skill>/,或者你所用工具的项目或用户技能文件夹,比如 .claude/skills/<skill>/ 或 ~/.agents/skills/<skill>/。批准之后,把技能文件夹复制过去,改那份副本。绝不开 PR,也不 push。

Follow each approved row's Routing exactly:

每条已批准的条目,都严格按它的 Routing(去向)执行:

  • Trivial existing-skill edit (a one-line bullet, a tightened sentence, a stale fact corrected): the parent does it directly.
  • Substantive existing-skill edit (a new section, a new pattern table, more than ~10 lines): hand to your harness's skill-authoring skill and run its draft / test / iterate loop. That is create-skill in Cursor (built in) or Anthropic's skill-creator. If you have neither, follow the Agent Skills format at agentskills.io. "create-skill" below means whichever of these you use.
  • tune description: <skill path> (the skill exists but didn't trigger when it should have): hand to create-skill and run its description-optimization loop.
  • new skill via create-skill: <kebab-name>: hand creation to create-skill. Do not invent the shape ad hoc.
  • 对现有技能的小改动(加一条要点、收紧一句话、更正一个过时的事实):主 AI 直接改。
  • 对现有技能的大改动(新加一节、新加一张模式表、超过大约 10 行):交给你所用工具的技能编写技能,走它的起草 / 测试 / 迭代流程。在 Cursor 里是 create-skill(内置),或者 Anthropic 的 skill-creator。两个都没有,就按 agentskills.io 上的 Agent Skills 格式来。下面说的「create-skill」,指你用的那一个。
  • tune description: <skill path>(技能存在,但该触发的时候没有触发):交给 create-skill,走它的描述优化流程。
  • new skill via create-skill: <kebab-name>:把新建交给 create-skill。不要临时自己发明它的样子。

If your environment ships a SKILL.md validator, run it on every touched skill before declaring done.

如果你的环境带有 SKILL.md 校验器,在宣布完成之前,对每个改过的技能都跑一遍。

6. Summarize for the user

6. 给用户总结

Short list, no preamble:

简短列表,不要开场白:

  • Edits applied: <skill path>. What changed, one line each.
  • New skills created: <skill path>. One line each (rare).
  • Backlog filed to the devex tracker: <issue title> (<tags>). One line each.
  • Dropped: one line per rejected finding + reason from the synthesizer.
  • 已应用的修改:<skill path>。改了什么,每条一行。
  • 新建的技能:<skill path>。每条一行(很少见)。
  • 已提交到 devex 跟踪系统的 Backlog:<issue title>(<tags>)。每条一行。
  • 丢掉的:每条被驳回的发现一行,附上综合者给的理由。

原文作者 Lauren Tan(poteto),MIT 许可。译文由本站翻译,核对到 pstack 镜像 97de40d。 在 GitHub 上看

本站是 pstack 的非官方入门教程,不是官方文档;pstack 由 poteto 开发,命令和行为以官方仓库为准。教程原始源码见 GitHub。

由 airali部署,基于小小东的 MIT 授权教程改编。