reflect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Reflect

反思功能

Mine the current conversation for durable learnings, then route them into skill edits.
从当前对话中提炼可复用的经验,然后将这些经验转化为对Skill的修改。

When to invoke

调用时机

  • The user said "reflect" or "/reflect".
  • A complex task (5+ tool calls) just landed cleanly and the recipe is worth keeping.
  • The agent hit dead ends, found the working path, and the path generalizes.
  • The user corrected the agent's approach mid-task.
  • A non-trivial workflow emerged that isn't captured anywhere.
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'或'/reflect'。
  • 一个复杂任务(调用工具5次及以上)顺利完成,且其流程值得留存。
  • Agent陷入过死胡同,之后找到了可行路径,且该路径具有通用性。
  • 用户在任务进行中纠正了Agent的处理方式。
  • 出现了未被任何现有Skill覆盖的重要工作流程。
当对话内容琐碎、偏离主题,或者已被父Agent正确遵循的现有Skill覆盖时,请跳过此功能。单次偶发的内容不属于可复用经验。

Process

执行流程

1. Locate the active transcript

1. 定位当前对话记录

The parent finds its own transcript file before fanning out. The system prompt names the active workspace's
agent-transcripts/
directory; use that path. Do not glob across
~/.cursor/projects/*/
. That crosses workspace boundaries and reads private chats from unrelated projects.
bash
ls -t <agent-transcripts>/*.jsonl <agent-transcripts>/*/*.jsonl <agent-transcripts>/*/subagents/*.jsonl 2>/dev/null | head -10
Three transcript layouts: legacy flat (
<id>.jsonl
), current nested (
<id>/<id>.jsonl
), and subagent (
<parent>/subagents/<child>.jsonl
).
For each candidate, read the first JSONL line and check that
message.content[0].text
contains the conversation's opening user prompt. Take the matching path. If no path resolves, write a tight digest of the session and pass that instead.
父Agent在生成子代理前需找到自身的对话记录文件。系统提示中会指定当前工作区的
agent-transcripts/
目录,请使用该路径。不要遍历
~/.cursor/projects/*/
,这会跨越工作区边界,读取无关项目的私密对话。
bash
ls -t <agent-transcripts>/*.jsonl <agent-transcripts>/*/*.jsonl <agent-transcripts>/*/subagents/*.jsonl 2>/dev/null | head -10
对话记录有三种格式:旧版扁平格式(
<id>.jsonl
)、当前嵌套格式(
<id>/<id>.jsonl
)和子代理格式(
<parent>/subagents/<child>.jsonl
)。
对于每个候选文件,读取第一行JSONL内容,检查
message.content[0].text
是否包含对话的初始用户提示。选择匹配的路径。如果没有找到匹配路径,则生成会话的精简摘要并使用该摘要。

2. Spawn three reviewers in parallel

2. 并行生成三个审核子代理

One message, three
Task
calls,
subagent_type: generalPurpose
, explicit
model:
on each, agent mode (
readonly: false
). Reviewers need MCP access for context lookups (tickets, chat threads, observability traces referenced in the transcript); readonly strips MCPs. The prompt forbids file writes; the parent applies edits.
Lens
model
Prompt template
Judgmentyour configured reflect-judgment model (default
claude-opus-4-8-thinking-xhigh
)
references/judgment-reviewer.md
Toolingyour configured reflect-tooling model (default
composer-2.5-fast
)
references/tooling-reviewer.md
Divergentyour configured reflect-judgment model (default
claude-opus-4-8-thinking-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
调用,设置
subagent_type: generalPurpose
,为每个调用明确指定
model:
,Agent模式设为
readonly: false
。审核子代理需要MCP访问权限来查询上下文(对话记录中引用的工单、聊天线程、可观测性追踪数据);readonly模式会移除MCP权限。提示中禁止文件写入操作,由父Agent执行修改。
视角
model
提示模板
判断你配置的reflect-judgment模型(默认
claude-opus-4-8-thinking-xhigh
references/judgment-reviewer.md
工具使用你配置的reflect-tooling模型(默认
composer-2.5-fast
references/tooling-reviewer.md
发散思考你配置的reflect-judgment模型(默认
claude-opus-4-8-thinking-xhigh
references/divergent-reviewer.md
原样传递每个模板,在标记位置替换为对话记录路径或摘要。审核子代理会在
Task
响应体中返回审核结果。

3. Synthesize

3. 结果合成

One
Task
call,
subagent_type: generalPurpose
, using your configured reflect-judgment model (default
claude-opus-4-8-thinking-xhigh
), agent mode (
readonly: false
). The synthesizer's quality check includes spot-verifying citations, which can require MCP access; readonly strips MCPs. Use
references/synthesizer.md
verbatim, with each reviewer's full output inlined where marked. The synthesizer returns a structured Accepted / Rejected / Backlog list.
发起一次
Task
调用,设置
subagent_type: generalPurpose
,使用你配置的reflect-judgment模型(默认
claude-opus-4-8-thinking-xhigh
),Agent模式设为
readonly: false
。合成子代理的质量检查包括抽查引用内容,这可能需要MCP访问权限;readonly模式会移除MCP权限。原样使用
references/synthesizer.md
模板,在标记位置内联每个审核子代理的完整输出。合成子代理会返回结构化的「已接受/已拒绝/待办」列表。

4. Structural enforcement check

4. 结构合规性检查

Sanity-check the synthesizer's Accepted list. For any item that would be enforced more reliably by a lint rule, script, metadata flag, or runtime check, move it from Accepted to Backlog. The synthesizer already applies this criterion; this is a final pass before edits land. See the encode-lessons-in-structure principle skill.
对合成子代理返回的「已接受」列表进行合理性检查。对于任何可以通过lint规则、脚本、元数据标记或运行时检查更可靠执行的项,将其从「已接受」移至「待办」。合成子代理已应用此标准,这是执行修改前的最终检查。请参考encode-lessons-in-structure原则Skill。

5. Apply

5. 执行修改

Before applying any Accepted edit, present the synthesizer's full Accepted/Rejected/Backlog output to the user and wait for explicit approval. The user picks which subset to apply and may redirect routings. Skill changes affect every future agent in the org; do not auto-apply.
Backlog items file to whatever devex / backlog tracker your team uses automatically. Those are tracker submissions, not skill edits. Only the Accepted list waits for approval.
For each approved Accepted item, follow the Routing field exactly:
  • Trivial existing-skill edit (a one-line bullet, a tightened sentence, a stale fact corrected): parent does directly.
  • Substantive existing-skill edit (a new section, a new pattern table, more than ~10 lines): hand to Cursor's built-in
    create-skill
    skill and run its draft / test / iterate loop.
  • 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.
If your environment ships a SKILL.md validator, run it on every touched skill before declaring done. Skip this step if it doesn't.
在执行任何「已接受」的修改前,向用户展示合成子代理的完整「已接受/已拒绝/待办」输出,并等待用户明确批准。用户可以选择要执行的子集,也可以重新指定修改路径。Skill的变更会影响组织内所有未来的Agent,请勿自动执行。
待办项会自动提交到团队使用的devex/待办事项追踪系统中。这些是追踪系统提交项,而非Skill修改。只有「已接受」列表需要等待批准。
对于每个获得批准的「已接受」项,严格按照Routing字段执行:
  • 对现有Skill的微小修改(单行项目符号、语句精简、过时事实修正):由父Agent直接执行。
  • 对现有Skill的重大修改(新增章节、新增模式表、修改内容约10行以上):交给Cursor内置的
    create-skill
    Skill,并运行其草稿/测试/迭代流程。
  • tune description: <skill path>
    (Skill已存在但未在应触发时触发):交给
    create-skill
    Skill,并运行其描述优化流程。
  • new skill via create-skill: <kebab-name>
    :将创建任务交给
    create-skill
    Skill。请勿自行设计Skill结构。
如果你的环境提供SKILL.md验证器,请在完成前对所有被修改的Skill运行验证。如果没有则跳过此步骤。

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:
    <skill path>
    。每项用一行说明(少见)。
  • 已提交到devex追踪系统的待办项:
    <issue title>
    <tags>
    )。每项用一行说明。
  • 已舍弃:每个被拒绝的结果加一行说明,附上合成子代理给出的原因。