mcpField
S
session-intelligence-harvester

session-intelligence-harvester

github.com/panaversityAgent 工作流48 次安装
代码仓库

关于 session-intelligence-harvester

用于将工作会话中的纠正、发现和模式整理为组织知识的技能。它根据触发时机将经验分配到 RII 文件,实施更新并验证,减少相同问题再次出现。

主要功能

  1. 01识别会话中的纠正与经验
  2. 02将经验路由到相应 RII 组件
  3. 03读取目标文件并实施更新
  4. 04检查更新位置及重复内容
  5. 05创建 PHR 并提交变更

适用场景

  1. 01记录并修复格式偏差
  2. 02将新发现的失败模式转化为检查项
  3. 03把跨文件的规律写入相关 Agent 或命令文件
  4. 04将重要会话经验纳入 RII

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/panaversity/agentfactory --skill session-intelligence-harvester

安装后在 Claude Code 中输入/session-intelligence-harvester确认已加载。

详细介绍

会话智慧收集器

概述

通过在 RII 组件中实施更新,将会话中的经验转化为永久的组织智慧。在涉及纠正、发现或模式识别的高效会话后,系统地提取所学内容,将其分配到正确的组件,并应用变更。

为何重要:未编码到 RII 组件中的一次性修复问题会反复出现。Chapter N 技能格式漂移之所以发生,是因为没有检查来防止它。收集经验后,这种故障模式已编码到 4 个文件中——未来的会话将自动受益。

何时使用此技能

自动触发(主动建议收集经验):

  • 会话纠正了格式漂移(文件结构、YAML、调用方式错误)
  • 会话向编排文件添加了缺失的检查
  • 会话识别出值得预防的故障模式
  • 会话以相似的模式纠正了 3 个或更多文件
  • 创建了记录重要经验的 PHR

手动触发(用户请求):

  • “收集本次会话的经验”
  • “记录会话智慧”
  • “我们应该从这项工作中总结出什么?”
  • “根据我们的经验更新 RII”

工作流

默认执行操作:实施所有更新,而不只是提出建议。读取目标文件、进行编辑并提交变更。只有在明确提出要求时,才只给出建议而不实施。

第 1 步:会话分析

通过回答以下问题来分析会话。将分析写下来以跟踪进度:

1. CORRECTIONS MADE
   - What errors/drift were corrected?
   - What was wrong vs what is now correct?
   - Why did the error occur? (missing check, format drift, etc.)

   WHY THIS MATTERS: Understanding root cause determines which RII
   component prevents recurrence. Format drift → agent convergence
   pattern. Missing context → CLAUDE.md protocol step.

2. PATTERNS IDENTIFIED
   - What recurring patterns emerged?
   - What canonical sources were referenced?
   - What validation would have caught this earlier?

   WHY THIS MATTERS: Patterns that recur across sessions deserve
   encoding. If you referenced a canonical source, other sessions
   will need that same reference.

3. LEARNING CLASSIFICATION
   - Context-gathering gap? (CLAUDE.md)
   - Pedagogical/teaching issue? (Constitution)
   - Agent convergence pattern? (Agents)
   - Reusable workflow? (Skills)
   - Missing orchestration check? (Commands)

   WHY THIS MATTERS: Wrong routing means learnings don't trigger at
   the right time. A convergence pattern in CLAUDE.md won't help
   chapter-planner catch it during planning.
第 2 步:分配到 RII 组件

使用此路由表。将经验分配到能在恰当时机发现它们的组件:

经验类型目标组件位置添加内容触发时机
上下文收集缺口CLAUDE.mdSection I在上下文协议中添加新步骤任何平台工作之前
故障模式示例CLAUDE.mdFailure modes带有纠正措施的命名示例检测到类似情况时
教学框架ConstitutionSection IIa教学方法更新课程设计期间
Agent 收敛模式Agent 文件Convergence Patterns模式、原因及纠正措施Agent 执行期间
Agent 自我监控Agent 文件Self-Monitoring Checklist新检查项Agent 最终确定输出之前
规范来源查找多个 AgentAnalysis Questions交叉引用检查规划阶段
可复用工作流新技能.claude/skills/新的 SKILL.md用户调用技能时
编排检查命令文件Phase 0 或相关阶段新验证步骤工作流执行期间
格式规范规范来源章节课程内容权威格式教授该模式时

路由为何重要:将经验放在错误的组件中,无法防止问题再次发生。如果错误发生在 chapter-planner 执行期间,在 content-implementer.md 中添加检查将无济于事。

第 3 步:读取目标文件并生成更新

对每条已识别的经验:

  1. 读取目标文件,了解当前结构并找到准确的插入位置
  2. 生成更新内容,并附上上下文以便准确插入
  3. 跟踪进度,逐一处理多个文件
## Learning: [Brief Title]

**Type**: [Context gap | Failure mode | Convergence pattern | etc.]

**Target**: [File path]

**Current State** (after reading file):
[What's missing or incorrect - quote existing content if helpful]

**Exact Placement**:
[Which section, after which content - be specific enough to Edit]

**Content to Add**:
[Exact content, matching the file's style and format]

**Rationale**:
[Why this prevents recurrence - what will trigger this check]

**Canonical Source** (if applicable):
[Which chapter/lesson defines the authoritative format]
Step 4: 实施更新

采取行动:编辑每个目标文件。使用 Edit 工具进行修改。

每项更新:

  1. 阅读目标文件(如果尚未阅读)
  2. 找到确切的插入位置
  3. 使用 Edit 工具应用修改
  4. 验证修改已正确应用

跟踪完成情况:

Updates Progress:
- [x] CLAUDE.md - Added failure mode section
- [x] chapter-planner.md - Added convergence pattern 6
- [x] sp.loopflow.v2.md - Removed (deprecated, replaced by native Plan Mode)
- [ ] content-implementer.md - Pending
Step 5: 验证

完成前,逐项验证以下内容(确认后勾选):

- [ ] Read each target file before editing (no speculation about structure)
- [ ] Verified each learning routes to the component where it triggers at the right time
- [ ] Confirmed updates include exact placement context (not vague locations)
- [ ] Checked canonical sources exist for format-related learnings
- [ ] Searched target files to confirm no duplicate information exists
- [ ] Used imperative form for agent files, appropriate style for others
- [ ] Added cross-references where pattern appears in multiple files
- [ ] All edits applied successfully (no pending changes)
Step 6: 创建 PHR 并提交
  1. 创建 PHR,记录:

    • 学到了什么
    • 记录在哪些文件中(列出所有文件)
    • 为什么这能改进后续工作
  2. 提交更改,并使用描述性消息:

    feat(intelligence): Harvest session learnings into RII
    
    Updates:
    - [File 1]: [What was added]
    - [File 2]: [What was added]
    
    Prevents: [What failure mode this prevents]
    

RII 组件参考

CLAUDE.md 结构
Section I: Context Gathering Protocol
  - Step 1-N: Sequential context steps
  - Each step has WHAT to do and WHY it matters
  - "Find canonical source" step for pattern teaching

Failure Modes (between Section I and II):
  - Named failure examples: "FAILURE MODE: [Name] Example"
  - "What I did wrong" list
  - "What I should have done" numbered steps
  - "Result" showing what was prevented
Agent 文件结构
Analysis Questions (Section III):
  - Numbered questions with "Why this matters" explanation
  - Self-check prompt at end

Principles (Section IV):
  - Named principles with Framework + What this means + Application guidance
  - Self-check prompt

Convergence Patterns (Section VI):
  - "Generic pattern" description
  - "Why this is convergence" explanation
  - "Correction" with specific steps

Self-Monitoring Checklist (Section VIII):
  - Numbered checklist with checkmark emoji prefix
  - Each item is a verification question
命令文件结构
Phase 0: Foundation checks
  - Constitutional reading
  - Canonical source checks (for educational content)
  - Each step explains WHY

Convergence Patterns:
  - Symptom description
  - Detection method
  - Correction steps

输出格式

完成整理后,提供摘要:

## Session Intelligence Harvest Summary

**Session**: [Brief description]
**Date**: [ISO date]
**Status**: COMPLETE

### Learnings Extracted: [N]

| #   | Learning | Type   | Target | Status  |
| --- | -------- | ------ | ------ | ------- |
| 1   | [Title]  | [Type] | [File] | Applied |
| 2   | [Title]  | [Type] | [File] | Applied |

### Updates Applied

1. **[File]**: [What was added] (lines X-Y)
2. **[File]**: [What was added] (lines X-Y)

### PHR Created

- Path: [PHR path]
- Stage: [Stage]

### Canonical Sources Referenced

- [Pattern]: [Chapter X Lesson Y]

### Commit

- Hash: [commit hash]
- Message: [commit message summary]

示例

示例 1:格式偏差修正(多文件)

会话:修正技能格式,使其采用基于领域的结构

分析:

CORRECTIONS MADE:
- Wrong: .claude/skills/section-writer.md (flat file, no domain)
- Correct: .claude/skills/authoring/section-writer/SKILL.md (domain + directory structure)
- Root cause: No domain organization for skills/agents

PATTERNS IDENTIFIED:
- Skills must be in authoring/ or engineering/ domain folders
- Agents must be in authoring/ or engineering/ domain folders
- Multiple files referenced old flat structure

CLASSIFICATION:
- Failure mode → CLAUDE.md
- Convergence pattern → chapter-planner.md, content-implementer.md
- Skill structure → skill-creator, session-intelligence-harvester

已应用的更新:

  1. CLAUDE.md:更新 Agent 架构部分
  2. skill-creator:添加领域组织要求
  3. session-intelligence-harvester:更新路由表,加入领域路径
  4. 将所有技能移至 authoring/ 或 engineering/
  5. 将所有 Agent 移至 authoring/ 或 engineering/
  6. 通用技能位于 .claude/skills/
示例 2:缺少验证(单文件)

会话:发现课程没有检查 chapter-index.md 中的先修要求

分析:

CORRECTIONS MADE:
- Wrong: Started chapter work without reading chapter-index.md
- Correct: MUST read chapter-index.md first to get Part, proficiency, prerequisites
- Root cause: No mandatory step in context protocol

CLASSIFICATION:
- Context-gathering gap → CLAUDE.md Section I

已应用的更新:

  1. CLAUDE.md:添加 Step 1,要求阅读 chapter-index.md,并明确规定提取内容
示例 3:虚构事实(第 2 章事件)

会话:编写了 6 篇课程,其中包含未经验证的统计数据、日期和采用数量

分析:

CORRECTIONS MADE:
- Wrong: "50-75% time savings" for goose
- Correct: "75% of engineers save 8-10+ hours/week" (verified via Block announcement)

- Wrong: Conflated Agent Skills timeline (said single date)
- Correct: Oct 16, 2025 = Claude Code launch; Dec 18, 2025 = open standard release

- Wrong: Generic agent support lists
- Correct: Verified lists from official AAIF announcement

- Root cause: Trusted plausible-sounding data from memory instead of web verification

PATTERNS IDENTIFIED:
- Statistics, dates, and quotes MUST be web-verified before publication
- Existing factual-verifier agent was available but not used
- 50% of session time was spent fixing hallucinated facts

CLASSIFICATION:
- Critical failure mode → CLAUDE.md Failure Prevention + new section
- Process gap → Missing mandatory fact-check step

已应用的更新:

  1. CLAUDE.md:添加“内容事实核查(强制)”部分
  2. CLAUDE.md:在“失败预防”列表中添加失败模式示例
  3. 记录 factual-verifier Agent 的调用模式

自我监控

在将整理标记为完成之前,确认你已:

  • 分析会话,找出所有修正和模式
  • 对每项经验进行分类,确定正确的路由
  • 编辑前已阅读每个目标文件(不做臆测)
  • 使用 Edit 工具应用所有修改(而不只是提出修改建议)
  • 验证修改符合目标文件的风格和结构
  • 在多个文件出现相同模式时添加交叉引用
  • 创建 PHR,记录此次整理
  • 使用描述性消息提交更改
  • 生成摘要,展示已应用的所有更新

评论

支持 Markdown