knowledge-consolidation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Knowledge Consolidation

知识整合

Persist valuable knowledge from AI conversations into structured documents.
将AI对话中有价值的知识持久化保存为结构化文档。

When to Invoke

触发时机

Proactive (AI self-invoke):
  • Starting new session after substantial prior work
  • Accumulated debugging/architecture/pattern knowledge worth preserving
  • Resolved non-trivial issues with reusable insights
Skip when:
  • Simple Q&A with no novel insights
  • Trivial changes with nothing worth preserving
主动触发(AI自动调用):
  • 在完成大量前期工作后开启新会话
  • 积累了值得留存的调试/架构/模式相关知识
  • 解决了具有可复用见解的复杂问题
以下情况跳过触发:
  • 无新颖见解的简单问答
  • 无留存价值的微小变更

Workflow

工作流程

Step 1: Detect AI IDE Type

步骤1:检测AI IDE类型

Check project root for AI IDE indicator directory:
Environment IndicatorAI TypeStorage Path
.trae/
dir or TraeAI/TraeCN env
trae-cn
.trae/knowledges/
.claude/
dir or Claude Code env
claude-code
.claude/knowledges/
.cursor/
dir
cursor
.cursor/knowledges/
.windsurf/
dir
windsurf
.windsurf/knowledges/
检查项目根目录下的AI IDE标识目录:
环境标识AI类型存储路径
.trae/
目录或TraeAI/TraeCN环境
trae-cn
.trae/knowledges/
.claude/
目录或Claude Code环境
claude-code
.claude/knowledges/
.cursor/
目录
cursor
.cursor/knowledges/
.windsurf/
目录
windsurf
.windsurf/knowledges/

Step 2: Identify Consolidation Candidates

步骤2:筛选知识整合候选内容

Scan conversation for knowledge worth preserving:
  • Debug sessions with root cause analysis
  • Architecture decisions with rationale
  • Code patterns discovered or established
  • Configuration knowledge (build, env, tooling)
  • API integration insights
  • Workflow improvements
  • Lessons learned from issues
扫描会话内容,筛选值得留存的知识:
  • 包含根因分析的调试会话
  • 带有决策依据的架构方案
  • 已发现或确立的代码模式
  • 配置相关知识(构建、环境、工具链)
  • API集成见解
  • 工作流程优化方案
  • 从问题中总结的经验教训

Step 3: Classify Knowledge Type

步骤3:知识类型分类

Select appropriate type based on content:
TypeWhen to Use
debug
Bug fixes, crash analysis, error resolution
architecture
System design, module structure, dependencies
pattern
Reusable code patterns, idioms, best practices
config
Build settings, environment, tooling setup
api
API design, integration, protocol details
workflow
Development processes, procedures
lesson
Post-mortems, retrospectives, project insights
reference
Technical specs, schema docs, standards
See knowledge-types.md for detailed guidance on each type.
根据内容选择合适的类型:
类型使用场景
debug
漏洞修复、崩溃分析、错误排查
architecture
系统设计、模块结构、依赖关系
pattern
可复用代码模式、编程范式、最佳实践
config
构建设置、环境配置、工具链搭建
api
API设计、集成实现、协议细节
workflow
开发流程、操作规范
lesson
事后复盘、经验总结、项目洞察
reference
技术规范、Schema文档、标准约定
各类型的详细说明请参考knowledge-types.md

Step 4: Generate Document Path

步骤4:生成文档路径

Run path generation script:
bash
{skill_root}/scripts/get-knowledge-path.sh \
  -r <project_root> -a <ai_type> -t <type> -n <filename>
Output format:
{project_root}/{ai_path}/knowledges/{YYYYMMDD}_{seq}_{type}_{filename}.md
运行路径生成脚本:
bash
{skill_root}/scripts/get-knowledge-path.sh \
  -r <project_root> -a <ai_type> -t <type> -n <filename>
输出格式:
{project_root}/{ai_path}/knowledges/{YYYYMMDD}_{seq}_{type}_{filename}.md

Step 5: Write Knowledge Document

步骤5:撰写知识文档

Create document using template:
markdown
undefined
使用模板创建文档:
markdown
undefined

{Title}

{标题}

Type: {type} Date: {YYYY-MM-DD} Context: {Brief context}
类型: {type} 日期: {YYYY-MM-DD} 背景概述: {简短背景}

Summary

内容摘要

{2-3 sentence summary}
{2-3句话的摘要}

Background

详细背景

{Situation/problem/context}
{场景/问题/背景}

Details

详细内容

{Technical content, code snippets, analysis}
{技术内容、代码片段、分析过程}

Key Takeaways

核心要点

{Bullet points of actionable insights}
{可执行见解的要点列表}

Related

相关链接

{Links to related files or knowledge entries}
undefined
{相关文件或知识条目的链接}
undefined

Step 6: Confirm with User

步骤6:向用户确认

📚 Knowledge Consolidated:
- File: {path}
- Type: {type}
- Topic: {title}

Summary: {brief summary}
📚 Knowledge Consolidated:
- File: {path}
- Type: {type}
- Topic: {title}

Summary: {brief summary}

Resources

资源列表

ResourcePurpose
scripts/get-knowledge-path.sh
Generate timestamped file path
references/knowledge-types.md
Detailed type selection guide
assets/knowledge.md.template
Document template
examples/debug-session.md
Complete workflow example
资源路径用途
scripts/get-knowledge-path.sh
生成带时间戳的文件路径
references/knowledge-types.md
详细的类型选择指南
assets/knowledge.md.template
知识文档模板
examples/debug-session.md
完整工作流程示例