Files
Claude-Code-Workflow/.claude/skills/copyright-docs/phases/02.5-consolidation.md
catlog22 0cc5101c0e feat: Add phases for document consolidation, assembly, and compliance refinement
- Introduced Phase 2.5: Consolidation Agent to summarize analysis outputs and generate design overviews.
- Added Phase 4: Document Assembly to create index-style documents linking chapter files.
- Implemented Phase 5: Compliance Review & Iterative Refinement for CPCC compliance checks and updates.
- Established CPCC Compliance Requirements document outlining mandatory sections and validation functions.
- Created a base template for analysis agents to ensure consistency and efficiency in execution.
2026-01-28 19:57:24 +08:00

4.9 KiB
Raw Blame History

Phase 2.5: Consolidation Agent

汇总所有分析 Agent 的产出,生成设计综述,为 Phase 4 索引文档提供内容。

规范参考: ../specs/cpcc-requirements.md

核心职责

  1. 设计综述:生成 synthesis软件整体设计思路
  2. 章节摘要:生成 section_summaries导航表格内容
  3. 跨模块分析:识别问题和关联
  4. 质量检查:验证 CPCC 合规性

输入

interface ConsolidationInput {
  output_dir: string;
  agent_summaries: AgentReturn[];
  cross_module_notes: string[];
  metadata: ProjectMetadata;
}

执行

Task({
  subagent_type: "cli-explore-agent",
  run_in_background: false,
  prompt: `
## 规范前置
首先读取规范文件:
- Read: ${skillRoot}/specs/cpcc-requirements.md
严格遵循 CPCC 软著申请规范要求。

## 任务
作为汇总 Agent读取所有章节文件生成设计综述和跨模块分析报告。

## 输入
- 章节文件: ${outputDir}/sections/section-*.md
- Agent 摘要: ${JSON.stringify(agent_summaries)}
- 跨模块备注: ${JSON.stringify(cross_module_notes)}
- 软件信息: ${JSON.stringify(metadata)}

## 核心产出

### 1. 设计综述 (synthesis)
用 2-3 段落描述软件整体设计思路:
- 第一段:软件定位与核心设计理念
- 第二段:模块划分与协作机制
- 第三段:技术选型与设计特点

### 2. 章节摘要 (section_summaries)
为每个章节提取一句话说明,用于导航表格:

| 章节 | 文件 | 一句话说明 |
|------|------|------------|
| 2. 系统架构设计 | section-2-architecture.md | ... |
| 3. 功能模块设计 | section-3-functions.md | ... |
| 4. 核心算法与流程 | section-4-algorithms.md | ... |
| 5. 数据结构设计 | section-5-data-structures.md | ... |
| 6. 接口设计 | section-6-interfaces.md | ... |
| 7. 异常处理设计 | section-7-exceptions.md | ... |

### 3. 跨模块分析
- 一致性:术语、命名规范
- 完整性:功能-接口对应、异常覆盖
- 关联性:模块依赖、数据流向

## 输出文件

写入: ${outputDir}/cross-module-summary.md

### 文件格式

\`\`\`markdown
# 跨模块分析报告

## 设计综述

[2-3 段落的软件设计思路描述]

## 章节摘要

| 章节 | 文件 | 说明 |
|------|------|------|
| 2. 系统架构设计 | section-2-architecture.md | 一句话说明 |
| ... | ... | ... |

## 文档统计

| 章节 | 图表数 | 字数 |
|------|--------|------|
| ... | ... | ... |

## 发现的问题

### 严重问题 (必须修复)

| ID | 类型 | 位置 | 描述 | 建议 |
|----|------|------|------|------|
| E001 | ... | ... | ... | ... |

### 警告 (建议修复)

| ID | 类型 | 位置 | 描述 | 建议 |
|----|------|------|------|------|
| W001 | ... | ... | ... | ... |

### 提示 (可选修复)

| ID | 类型 | 位置 | 描述 |
|----|------|------|------|
| I001 | ... | ... | ... |

## 跨模块关联图

\`\`\`mermaid
graph LR
    S2[架构] --> S3[功能]
    S3 --> S4[算法]
    S3 --> S6[接口]
    S5[数据结构] --> S6
    S6 --> S7[异常]
\`\`\`

## 修复建议优先级

[按优先级排序的建议,段落式描述]
\`\`\`

## 返回格式 (JSON)

{
  "status": "completed",
  "output_file": "cross-module-summary.md",

  // Phase 4 索引文档所需
  "synthesis": "2-3 段落的设计综述文本",
  "section_summaries": [
    {"file": "section-2-architecture.md", "title": "2. 系统架构设计", "summary": "一句话说明"},
    {"file": "section-3-functions.md", "title": "3. 功能模块设计", "summary": "一句话说明"},
    {"file": "section-4-algorithms.md", "title": "4. 核心算法与流程", "summary": "一句话说明"},
    {"file": "section-5-data-structures.md", "title": "5. 数据结构设计", "summary": "一句话说明"},
    {"file": "section-6-interfaces.md", "title": "6. 接口设计", "summary": "一句话说明"},
    {"file": "section-7-exceptions.md", "title": "7. 异常处理设计", "summary": "一句话说明"}
  ],

  // 质量信息
  "stats": {
    "total_sections": 6,
    "total_diagrams": 8,
    "total_words": 3500
  },
  "issues": {
    "errors": [...],
    "warnings": [...],
    "info": [...]
  },
  "cross_refs": {
    "found": 12,
    "missing": 3
  }
}
`
})

问题分类

严重级别 前缀 含义 处理方式
Error E 阻塞合规检查 必须修复
Warning W 影响文档质量 建议修复
Info I 可改进项 可选修复

问题类型

类型 说明
missing 缺失内容(功能-接口对应、异常覆盖)
inconsistency 不一致(术语、命名、编号)
circular 循环依赖
orphan 孤立内容(未被引用)
syntax Mermaid 语法错误
enhancement 增强建议

Output

  • 文件: cross-module-summary.md(完整汇总报告)
  • 返回: JSON 包含 Phase 4 所需的 synthesis 和 section_summaries