mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-15 02:42:45 +08:00
feat: Implement adaptive RRF weights and query intent detection
- Added integration tests for adaptive RRF weights in hybrid search. - Enhanced query intent detection with new classifications: keyword, semantic, and mixed. - Introduced symbol boosting in search results based on explicit symbol matches. - Implemented embedding-based reranking with configurable options. - Added global symbol index for efficient symbol lookups across projects. - Improved file deletion handling on Windows to avoid permission errors. - Updated chunk configuration to increase overlap for better context. - Modified package.json test script to target specific test files. - Created comprehensive writing style guidelines for documentation. - Added TypeScript tests for query intent detection and adaptive weights. - Established performance benchmarks for global symbol indexing.
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
# Phase 3.5: Consolidation Agent
|
||||
|
||||
汇总所有分析 Agent 的产出,识别跨章节问题,生成汇总报告。
|
||||
汇总所有分析 Agent 的产出,生成跨章节综合分析,为 Phase 4 索引报告提供内容。
|
||||
|
||||
> **写作规范**: [../specs/writing-style.md](../specs/writing-style.md)
|
||||
|
||||
## 核心职责
|
||||
|
||||
1. **跨章节综合分析**:生成 synthesis(报告综述)
|
||||
2. **章节摘要提取**:生成 section_summaries(索引表格内容)
|
||||
3. **质量检查**:识别问题并评分
|
||||
4. **建议汇总**:生成 recommendations(优先级排序)
|
||||
|
||||
## 输入
|
||||
|
||||
@@ -18,9 +27,16 @@ interface ConsolidationInput {
|
||||
```javascript
|
||||
Task({
|
||||
subagent_type: "cli-explore-agent",
|
||||
run_in_background: false,
|
||||
prompt: `
|
||||
## 规范前置
|
||||
首先读取规范文件:
|
||||
- Read: ${skillRoot}/specs/quality-standards.md
|
||||
- Read: ${skillRoot}/specs/writing-style.md
|
||||
严格遵循规范中的质量标准和段落式写作要求。
|
||||
|
||||
## 任务
|
||||
作为汇总 Agent,读取所有章节文件,执行跨章节分析,生成汇总报告。
|
||||
作为汇总 Agent,读取所有章节文件,执行跨章节分析,生成汇总报告和索引内容。
|
||||
|
||||
## 输入
|
||||
- 章节文件: ${outputDir}/sections/section-*.md
|
||||
@@ -28,27 +44,39 @@ Task({
|
||||
- 跨模块备注: ${JSON.stringify(cross_module_notes)}
|
||||
- 报告类型: ${config.type}
|
||||
|
||||
## 分析维度
|
||||
## 核心产出
|
||||
|
||||
### 1. 一致性检查
|
||||
### 1. 综合分析 (synthesis)
|
||||
阅读所有章节,用 2-3 段落描述项目全貌:
|
||||
- 第一段:项目定位与核心架构特征
|
||||
- 第二段:关键设计决策与技术选型
|
||||
- 第三段:整体质量评价与显著特点
|
||||
|
||||
### 2. 章节摘要 (section_summaries)
|
||||
为每个章节提取一句话核心发现,用于索引表格。
|
||||
|
||||
### 3. 架构洞察 (cross_analysis)
|
||||
描述章节间的关联性,如:
|
||||
- 模块间的依赖关系如何体现在各章节
|
||||
- 设计决策如何贯穿多个层面
|
||||
- 潜在的一致性或冲突
|
||||
|
||||
### 4. 建议汇总 (recommendations)
|
||||
按优先级整理各章节的建议,段落式描述。
|
||||
|
||||
## 质量检查维度
|
||||
|
||||
### 一致性检查
|
||||
- 术语一致性:同一概念是否使用相同名称
|
||||
- 代码引用:file:line 格式是否正确
|
||||
- 图表编号:是否连续且正确
|
||||
|
||||
### 2. 完整性检查
|
||||
### 完整性检查
|
||||
- 章节覆盖:是否涵盖所有必需章节
|
||||
- 内容深度:每章节是否达到 ${config.depth} 级别
|
||||
- 图表数量:是否每章节包含图表
|
||||
|
||||
### 3. 质量检查
|
||||
### 质量检查
|
||||
- Mermaid 语法:图表是否可渲染
|
||||
- 代码引用有效性:引用的文件是否存在
|
||||
- 建议可行性:推荐是否具体可操作
|
||||
|
||||
### 4. 关联性检查
|
||||
- 章节间引用:是否有交叉引用
|
||||
- 逻辑连贯:内容是否逻辑一致
|
||||
- 重复内容:是否有冗余描述
|
||||
- 段落式写作:是否符合写作规范(禁止清单罗列)
|
||||
|
||||
## 输出文件
|
||||
|
||||
@@ -59,58 +87,62 @@ Task({
|
||||
\`\`\`markdown
|
||||
# 分析汇总报告
|
||||
|
||||
## 1. 章节统计
|
||||
## 综合分析
|
||||
|
||||
| 章节 | 状态 | 图表数 | 代码引用数 | 字数 |
|
||||
|------|------|--------|------------|------|
|
||||
| System Overview | completed | 1 | 5 | 450 |
|
||||
| ... | ... | ... | ... | ... |
|
||||
[2-3 段落的项目全貌描述,段落式写作]
|
||||
|
||||
## 2. 发现的问题
|
||||
## 章节摘要
|
||||
|
||||
### 2.1 严重问题 (阻塞报告生成)
|
||||
| 章节 | 文件 | 核心发现 |
|
||||
|------|------|----------|
|
||||
| 系统概述 | section-overview.md | 一句话描述 |
|
||||
| 层次分析 | section-layers.md | 一句话描述 |
|
||||
| ... | ... | ... |
|
||||
|
||||
| ID | 类型 | 位置 | 描述 | 建议 |
|
||||
|----|------|------|------|------|
|
||||
| E001 | missing | section-dataflow | 缺少数据流章节 | 补充数据流分析 |
|
||||
## 架构洞察
|
||||
|
||||
### 2.2 警告 (影响报告质量)
|
||||
[跨章节关联分析,段落式描述]
|
||||
|
||||
| ID | 类型 | 位置 | 描述 | 建议 |
|
||||
|----|------|------|------|------|
|
||||
| W001 | inconsistency | section-overview/layers | 架构描述不一致 | 统一术语 |
|
||||
## 建议汇总
|
||||
|
||||
### 2.3 提示 (可选优化)
|
||||
[优先级排序的建议,段落式描述]
|
||||
|
||||
| ID | 类型 | 位置 | 描述 |
|
||||
|----|------|------|------|
|
||||
| I001 | enhancement | section-algorithms | 建议添加复杂度分析 |
|
||||
---
|
||||
|
||||
## 3. 跨章节关联
|
||||
## 质量评估
|
||||
|
||||
\`\`\`mermaid
|
||||
graph LR
|
||||
S1[Overview] --> S2[Layers]
|
||||
S2 --> S3[Dependencies]
|
||||
S3 --> S4[DataFlow]
|
||||
|
||||
S2 -.->|不一致| S1
|
||||
\`\`\`
|
||||
|
||||
## 4. 报告质量评分
|
||||
### 评分
|
||||
|
||||
| 维度 | 得分 | 说明 |
|
||||
|------|------|------|
|
||||
| 完整性 | 85% | 缺少1个章节 |
|
||||
| 一致性 | 90% | 2处术语不一致 |
|
||||
| 深度 | 95% | 符合 ${config.depth} 级别 |
|
||||
| 可读性 | 88% | 图表清晰 |
|
||||
| 完整性 | 85% | ... |
|
||||
| 一致性 | 90% | ... |
|
||||
| 深度 | 95% | ... |
|
||||
| 可读性 | 88% | ... |
|
||||
| 综合 | 89% | ... |
|
||||
|
||||
## 5. 推荐操作
|
||||
### 发现的问题
|
||||
|
||||
1. **[必须]** 补充 section-dataflow 章节
|
||||
2. **[建议]** 统一 Overview 和 Layers 中的架构术语
|
||||
3. **[可选]** 为算法章节添加复杂度分析
|
||||
#### 严重问题
|
||||
| ID | 类型 | 位置 | 描述 |
|
||||
|----|------|------|------|
|
||||
| E001 | ... | ... | ... |
|
||||
|
||||
#### 警告
|
||||
| ID | 类型 | 位置 | 描述 |
|
||||
|----|------|------|------|
|
||||
| W001 | ... | ... | ... |
|
||||
|
||||
#### 提示
|
||||
| ID | 类型 | 位置 | 描述 |
|
||||
|----|------|------|------|
|
||||
| I001 | ... | ... | ... |
|
||||
|
||||
### 统计
|
||||
|
||||
- 章节数: X
|
||||
- 图表数: X
|
||||
- 总字数: X
|
||||
\`\`\`
|
||||
|
||||
## 返回格式 (JSON)
|
||||
@@ -118,6 +150,17 @@ graph LR
|
||||
{
|
||||
"status": "completed",
|
||||
"output_file": "consolidation-summary.md",
|
||||
|
||||
// Phase 4 索引报告所需
|
||||
"synthesis": "2-3 段落的综合分析文本",
|
||||
"cross_analysis": "跨章节关联分析文本",
|
||||
"recommendations": "优先级排序的建议文本",
|
||||
"section_summaries": [
|
||||
{"file": "section-overview.md", "title": "系统概述", "summary": "一句话核心发现"},
|
||||
{"file": "section-layers.md", "title": "层次分析", "summary": "一句话核心发现"}
|
||||
],
|
||||
|
||||
// 质量信息
|
||||
"quality_score": {
|
||||
"completeness": 85,
|
||||
"consistency": 90,
|
||||
@@ -126,20 +169,13 @@ graph LR
|
||||
"overall": 89
|
||||
},
|
||||
"issues": {
|
||||
"errors": [
|
||||
{"id": "E001", "type": "missing", "section": "section-dataflow", "desc": "缺少数据流章节"}
|
||||
],
|
||||
"warnings": [
|
||||
{"id": "W001", "type": "inconsistency", "sections": ["section-overview", "section-layers"], "desc": "架构描述不一致"}
|
||||
],
|
||||
"info": [
|
||||
{"id": "I001", "type": "enhancement", "section": "section-algorithms", "desc": "建议添加复杂度分析"}
|
||||
]
|
||||
"errors": [...],
|
||||
"warnings": [...],
|
||||
"info": [...]
|
||||
},
|
||||
"stats": {
|
||||
"total_sections": 5,
|
||||
"total_diagrams": 8,
|
||||
"total_code_refs": 42,
|
||||
"total_words": 3500
|
||||
}
|
||||
}
|
||||
@@ -157,42 +193,16 @@ graph LR
|
||||
|
||||
## 问题类型
|
||||
|
||||
| 类型 | 说明 | 检查范围 |
|
||||
|------|------|----------|
|
||||
| missing | 缺失章节 | 必需章节列表 |
|
||||
| inconsistency | 不一致 | 术语、命名、描述 |
|
||||
| invalid_ref | 无效引用 | 代码引用、图表引用 |
|
||||
| syntax | 语法错误 | Mermaid 图表 |
|
||||
| shallow | 内容过浅 | 深度级别要求 |
|
||||
| enhancement | 增强建议 | 最佳实践 |
|
||||
|
||||
## 与 Phase 4 的集成
|
||||
|
||||
```javascript
|
||||
// Phase 4 装配时读取汇总报告
|
||||
const summary = JSON.parse(Read(`${outputDir}/consolidation-summary.md`));
|
||||
|
||||
if (summary.issues.errors.length > 0) {
|
||||
// 阻止装配,提示用户
|
||||
return AskUserQuestion({
|
||||
questions: [{
|
||||
question: `发现 ${summary.issues.errors.length} 个严重问题,如何处理?`,
|
||||
header: "质量检查",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{label: "查看并修复", description: "显示问题,手动修复"},
|
||||
{label: "忽略继续", description: "跳过检查,继续装配"},
|
||||
{label: "终止", description: "停止报告生成"}
|
||||
]
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
// 在报告中插入质量评分
|
||||
insertQualityScore(report, summary.quality_score);
|
||||
```
|
||||
| 类型 | 说明 |
|
||||
|------|------|
|
||||
| missing | 缺失章节 |
|
||||
| inconsistency | 术语/描述不一致 |
|
||||
| invalid_ref | 无效代码引用 |
|
||||
| syntax | Mermaid 语法错误 |
|
||||
| shallow | 内容过浅 |
|
||||
| list_style | 违反段落式写作规范 |
|
||||
|
||||
## Output
|
||||
|
||||
- 文件: `consolidation-summary.md`
|
||||
- 返回: 质量评分 + 问题列表 + 统计信息
|
||||
- **文件**: `consolidation-summary.md`(完整汇总报告)
|
||||
- **返回**: JSON 包含 Phase 4 所需的所有字段
|
||||
|
||||
Reference in New Issue
Block a user