session-reflection
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSession Reflection
会话复盘
Value: Feedback -- every user intervention is a signal that the system
prompt is incomplete. Turning corrections into durable instructions creates
compound improvement across sessions.
价值: 反馈——每一次用户干预都表明系统提示存在不完善之处。将纠正措施转化为长期有效的指令可以跨会话实现复合式改进。
Purpose
用途
Teaches agents to analyze session history for recurring corrections, generate
project-specific instructions that prevent known failure modes, and maintain
working state that survives context compaction and crashes. Transforms reactive
corrections into proactive prevention.
教会Agent分析会话历史中反复出现的纠正情况,生成项目专属的指令以避免已知故障模式,同时维护可在上下文压缩和崩溃后留存的工作状态。将被动纠正转化为主动预防。
Practices
实践
Reflection Triggers
复盘触发时机
Reflect after: milestones (PR merged, feature complete), 3+ repeated
corrections from the user, session restart or crash recovery, every 5
completed tasks, and on explicit user request. Do not wait for a "good time"
-- reflect when triggered.
在以下场景后进行复盘:里程碑达成(PR合并、功能开发完成)、用户累计3次及以上重复纠正、会话重启或崩溃恢复、每完成5个任务,以及用户明确提出要求时。不要等待「合适的时机」——触发时立即复盘。
Analyze Session History
分析会话历史
Examine conversation history, git log, memory files, WORKING_STATE.md, and
session logs. Categorize each user intervention into one of five types:
- Correction: Agent did the wrong thing (instruction gap)
- Repetition: Agent was told the same thing again (emphasis gap)
- Role Redirect: Agent stepped outside its role (boundary gap)
- Frustration Escalation: User became more forceful (decay problem)
- Workaround: User did it themselves (skill gap)
See for detailed categorization and
prioritization.
references/analysis-framework.md检查对话历史、git log、内存文件、WORKING_STATE.md与会话日志。将每一次用户干预归入以下五个类型之一:
- 纠正:Agent执行了错误操作(指令缺口)
- 重复:用户重复告知Agent同一内容(强调缺口)
- 角色重定向:Agent超出了自身角色边界(边界缺口)
- 挫败感升级:用户语气变得更加强硬(衰减问题)
- 变通方案:用户自行完成了操作(技能缺口)
详细分类与优先级说明请参考。
references/analysis-framework.mdGenerate or Refine Project Instructions
生成或优化项目指令
Route project-specific directives into the appropriate instruction file
based on content type. There is no separate system prompt file — everything
flows from CLAUDE.md → AGENTS.md → .team/coordinator-instructions.md:
- CLAUDE.md — Session management (startup procedure, compaction recovery, state tracking), harness-specific configuration
- AGENTS.md — General project rules, dos/don'ts, coding conventions, workflow configuration
- .team/coordinator-instructions.md — Coordinator/pipeline-controller role distinctions, build pre-flight gates, spawn discipline, domain review checklists
Refinement rules: add new items for new gaps, promote advisory to structural
when gaps recur, rewrite ambiguous items for clarity. Never remove items
until the gap is confirmed solved across 3+ sessions. See
for writing patterns and
for harness-specific file routing.
references/system-prompt-patterns.mdreferences/launcher-templates.md根据内容类型将项目专属的指令归入对应的指令文件。没有单独的系统提示文件——所有内容的流转路径为CLAUDE.md → AGENTS.md → .team/coordinator-instructions.md:
- CLAUDE.md —— 会话管理(启动流程、压缩恢复、状态追踪)、运行环境专属配置
- AGENTS.md —— 通用项目规则、注意事项、编码规范、工作流配置
- .team/coordinator-instructions.md —— 协调器/流水线控制器角色区分、构建前置检查、生成规则、领域评审checklist
优化规则:为新的缺口新增条目,缺口反复出现时将建议性内容升级为结构化内容,重写模糊条目提升清晰度。在3个以上会话均确认缺口已解决之前,不要删除任何条目。编写模式请参考,运行环境专属文件路由规则请参考。
references/system-prompt-patterns.mdreferences/launcher-templates.mdSelf-Reminder Protocol
自我提醒机制
Every 5-10 messages during long sessions, re-read: project instructions
(CLAUDE.md, AGENTS.md, coordinator-instructions.md as applicable), role
constraints, current task context, WORKING_STATE.md. Mandatory after context
compaction (you lose implicit context). This is the primary defense against
role drift in long sessions.
长会话过程中每5-10条消息,重读:项目指令(适用的CLAUDE.md、AGENTS.md、coordinator-instructions.md)、角色约束、当前任务上下文、WORKING_STATE.md。上下文压缩后必须执行(会丢失隐式上下文)。这是防止长会话中出现角色漂移的核心手段。
Working State Persistence
工作状态持久化
Maintain WORKING_STATE.md as insurance against context compaction and crashes.
Update after every significant state change. Always read before acting after
any interruption. Location: (pipeline) or project
root (standalone). See for format.
.factory/WORKING_STATE.mdreferences/working-state-schema.mdDo:
- Update on task start, phase change, decision made, blocker encountered
- Overwrite with current state (not append)
- Read FIRST after any interruption
Do not:
- Guess state from memory after a compaction or restart
- Use as a journal -- keep it concise and current
- Skip updates because "nothing important changed"
维护WORKING_STATE.md作为上下文压缩和崩溃的保险机制。每次发生重大状态变更后都要更新。任何中断后执行操作前必须优先读取该文件。存储路径:(流水线环境)或项目根目录(独立环境)。格式请参考。
.factory/WORKING_STATE.mdreferences/working-state-schema.md应当执行:
- 任务启动、阶段变更、做出决策、遇到阻塞时更新
- 用当前状态覆盖原有内容(不要追加)
- 任何中断后优先读取
禁止执行:
- 压缩或重启后凭记忆猜测状态
- 作为日志使用——保持内容简洁、实时
- 以「没有重要变更」为由跳过更新
Post-Session Learning Loop
会话后学习闭环
At session end: identify patterns from this session, update memory files,
refine project instructions if triggers were hit, archive working state.
The loop closes when the same category of intervention stops recurring. If
an intervention category persists across 3+ sessions after instruction
refinement, escalate: the gap may require a new skill or a structural
change to the workflow.
会话结束时:识别本次会话的规律、更新内存文件、如果满足触发条件则优化项目指令、归档工作状态。
当同一类干预不再反复出现时,闭环完成。如果某类干预在指令优化后仍在3个以上会话中持续出现,则需要升级处理:该缺口可能需要新增技能或对工作流进行结构性调整。
Enforcement Note
执行说明
This skill provides advisory guidance. The self-reminder protocol and working
state maintenance require agent self-discipline. On Claude Code, a
pre-tool-use hook could mechanically enforce state file reads, but no such
hook is provided by default. The reflection triggers are event-driven and
cannot be mechanically enforced. If you observe the agent drifting from its
role or repeating corrected mistakes, point out the pattern and suggest a
reflection.
本技能提供建议性指导。自我提醒机制和工作状态维护需要Agent自觉执行。在Claude Code上,工具调用前的钩子可以机械性地强制读取状态文件,但默认不提供此类钩子。复盘触发是事件驱动的,无法机械性强制执行。如果您发现Agent出现角色漂移或重复犯已纠正的错误,请指出该模式并建议进行复盘。
Verification
验证
After completing work guided by this skill, verify:
- Reflection performed at every trigger point (milestone, repeated correction, restart)
- User interventions categorized using the five-type taxonomy
- Project instructions refined with structural (not just advisory) language
- Directives routed to correct file (CLAUDE.md / AGENTS.md / coordinator-instructions.md)
- Self-reminder protocol followed (state re-read every 5-10 messages)
- WORKING_STATE.md current and accurate
- State re-read after every context compaction (not guessed)
If any criterion is not met, revisit the relevant practice before proceeding.
按照本技能指导完成工作后,请验证:
- 每个触发点(里程碑、重复纠正、重启)都执行了复盘
- 用户干预已使用五类分类法完成归类
- 项目指令已使用结构化(而非仅建议性)语言优化
- 指令已归入正确的文件(CLAUDE.md / AGENTS.md / coordinator-instructions.md)
- 遵循了自我提醒机制(每5-10条消息重读状态)
- WORKING_STATE.md内容实时且准确
- 每次上下文压缩后都重读了状态(没有猜测)
如果有任何标准未满足,请先回溯对应的实践内容再继续。
Dependencies
依赖
This skill works standalone. For enhanced workflows, it integrates with:
- memory-protocol: Persistent storage for session learnings and working state
- agent-coordination: Coordination patterns referenced in instruction generation
- pipeline: Pipeline controller benefits from self-reminder and crash recovery
- ensemble-team: Team retrospectives feed into session reflection analysis
Missing a dependency? Install with:
npx skills add jwilger/agent-skills --skill memory-protocol本技能可独立运行。如需增强工作流,可与以下工具集成:
- memory-protocol: 用于存储会话学习内容和工作状态的持久化存储
- agent-coordination: 指令生成中引用的协同模式
- pipeline: 流水线控制器可从自我提醒和崩溃恢复功能中获益
- ensemble-team: 团队复盘内容可输入到会话复盘分析中
缺少依赖?使用以下命令安装:
npx skills add jwilger/agent-skills --skill memory-protocol