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,14 +1,23 @@
|
||||
# Phase 2.5: Consolidation Agent
|
||||
|
||||
汇总所有分析 Agent 的产出,识别跨模块问题,生成汇总报告。
|
||||
汇总所有分析 Agent 的产出,生成设计综述,为 Phase 4 索引文档提供内容。
|
||||
|
||||
> **规范参考**: [../specs/cpcc-requirements.md](../specs/cpcc-requirements.md)
|
||||
|
||||
## 核心职责
|
||||
|
||||
1. **设计综述**:生成 synthesis(软件整体设计思路)
|
||||
2. **章节摘要**:生成 section_summaries(导航表格内容)
|
||||
3. **跨模块分析**:识别问题和关联
|
||||
4. **质量检查**:验证 CPCC 合规性
|
||||
|
||||
## 输入
|
||||
|
||||
```typescript
|
||||
interface ConsolidationInput {
|
||||
output_dir: string;
|
||||
agent_summaries: AgentReturn[]; // 6个Agent的简要返回
|
||||
cross_module_notes: string[]; // 所有跨模块备注
|
||||
agent_summaries: AgentReturn[];
|
||||
cross_module_notes: string[];
|
||||
metadata: ProjectMetadata;
|
||||
}
|
||||
```
|
||||
@@ -18,74 +27,94 @@ interface ConsolidationInput {
|
||||
```javascript
|
||||
Task({
|
||||
subagent_type: "cli-explore-agent",
|
||||
run_in_background: false,
|
||||
prompt: `
|
||||
## 规范前置
|
||||
首先读取规范文件:
|
||||
- Read: ${skillRoot}/specs/cpcc-requirements.md
|
||||
严格遵循 CPCC 软著申请规范要求。
|
||||
|
||||
## 任务
|
||||
作为汇总 Agent,读取所有章节文件,执行跨模块分析,生成汇总报告。
|
||||
作为汇总 Agent,读取所有章节文件,生成设计综述和跨模块分析报告。
|
||||
|
||||
## 输入
|
||||
- 章节文件: {output_dir}/sections/section-*.md
|
||||
- 章节文件: ${outputDir}/sections/section-*.md
|
||||
- Agent 摘要: ${JSON.stringify(agent_summaries)}
|
||||
- 跨模块备注: ${JSON.stringify(cross_module_notes)}
|
||||
- 软件信息: ${JSON.stringify(metadata)}
|
||||
|
||||
## 分析维度
|
||||
## 核心产出
|
||||
|
||||
### 1. 一致性检查
|
||||
- 术语一致性:同一概念是否使用相同名称
|
||||
- 命名规范:中英文命名是否统一
|
||||
- 图表编号:是否连续且正确
|
||||
### 1. 设计综述 (synthesis)
|
||||
用 2-3 段落描述软件整体设计思路:
|
||||
- 第一段:软件定位与核心设计理念
|
||||
- 第二段:模块划分与协作机制
|
||||
- 第三段:技术选型与设计特点
|
||||
|
||||
### 2. 完整性检查
|
||||
- 功能覆盖:section-3的功能是否都有对应接口(section-6)
|
||||
- 算法覆盖:section-4的算法是否在功能中被引用
|
||||
- 异常覆盖:section-7的异常是否覆盖所有接口
|
||||
### 2. 章节摘要 (section_summaries)
|
||||
为每个章节提取一句话说明,用于导航表格:
|
||||
|
||||
### 3. 关联性检查
|
||||
- 模块依赖:架构图(section-2)的依赖是否与实际一致
|
||||
- 数据流向:数据结构(section-5)是否与接口(section-6)匹配
|
||||
- 跨模块调用:是否存在未记录的跨模块依赖
|
||||
| 章节 | 文件 | 一句话说明 |
|
||||
|------|------|------------|
|
||||
| 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 | ... |
|
||||
|
||||
### 4. 质量检查
|
||||
- 图表语法:Mermaid 语法是否正确
|
||||
- 内容深度:各章节是否有足够的详细说明
|
||||
- 代码引用:是否包含具体的文件路径和行号
|
||||
### 3. 跨模块分析
|
||||
- 一致性:术语、命名规范
|
||||
- 完整性:功能-接口对应、异常覆盖
|
||||
- 关联性:模块依赖、数据流向
|
||||
|
||||
## 输出文件
|
||||
|
||||
写入: {output_dir}/cross-module-summary.md
|
||||
写入: ${outputDir}/cross-module-summary.md
|
||||
|
||||
### 文件格式
|
||||
|
||||
\`\`\`markdown
|
||||
# 跨模块分析报告
|
||||
|
||||
## 1. 文档统计
|
||||
## 设计综述
|
||||
|
||||
| 章节 | 图表数 | 子章节数 | 字数 |
|
||||
|------|--------|----------|------|
|
||||
| 系统架构图 | 1 | 2 | ~500 |
|
||||
| ... | ... | ... | ... |
|
||||
[2-3 段落的软件设计思路描述]
|
||||
|
||||
## 2. 发现的问题
|
||||
## 章节摘要
|
||||
|
||||
### 2.1 严重问题 (必须修复)
|
||||
| 章节 | 文件 | 说明 |
|
||||
|------|------|------|
|
||||
| 2. 系统架构设计 | section-2-architecture.md | 一句话说明 |
|
||||
| ... | ... | ... |
|
||||
|
||||
## 文档统计
|
||||
|
||||
| 章节 | 图表数 | 字数 |
|
||||
|------|--------|------|
|
||||
| ... | ... | ... |
|
||||
|
||||
## 发现的问题
|
||||
|
||||
### 严重问题 (必须修复)
|
||||
|
||||
| ID | 类型 | 位置 | 描述 | 建议 |
|
||||
|----|------|------|------|------|
|
||||
| E001 | 缺失 | section-6 | 缺少权限管理接口 | 补充 /api/permissions 相关接口 |
|
||||
| E001 | ... | ... | ... | ... |
|
||||
|
||||
### 2.2 警告 (建议修复)
|
||||
### 警告 (建议修复)
|
||||
|
||||
| ID | 类型 | 位置 | 描述 | 建议 |
|
||||
|----|------|------|------|------|
|
||||
| W001 | 一致性 | section-3/6 | 功能名"用户管理"与接口名"UserModule"不一致 | 统一使用中文或英文 |
|
||||
| W001 | ... | ... | ... | ... |
|
||||
|
||||
### 2.3 提示 (可选修复)
|
||||
### 提示 (可选修复)
|
||||
|
||||
| ID | 类型 | 位置 | 描述 |
|
||||
|----|------|------|------|
|
||||
| I001 | 增强 | section-4 | 建议为复杂算法添加复杂度分析 |
|
||||
| I001 | ... | ... | ... |
|
||||
|
||||
## 3. 跨模块关联图
|
||||
## 跨模块关联图
|
||||
|
||||
\`\`\`mermaid
|
||||
graph LR
|
||||
@@ -94,21 +123,11 @@ graph LR
|
||||
S3 --> S6[接口]
|
||||
S5[数据结构] --> S6
|
||||
S6 --> S7[异常]
|
||||
|
||||
S3 -.->|缺少关联| S5
|
||||
\`\`\`
|
||||
|
||||
## 4. 修复建议优先级
|
||||
## 修复建议优先级
|
||||
|
||||
1. **E001**: 补充权限管理接口 (阻塞合规)
|
||||
2. **W001**: 统一术语命名 (影响一致性)
|
||||
3. ...
|
||||
|
||||
## 5. 下一步行动
|
||||
|
||||
- [ ] 修复 E001-E00x 严重问题
|
||||
- [ ] 处理 W001-W00x 警告
|
||||
- [ ] 可选处理 I001-I00x 提示
|
||||
[按优先级排序的建议,段落式描述]
|
||||
\`\`\`
|
||||
|
||||
## 返回格式 (JSON)
|
||||
@@ -116,21 +135,28 @@ graph LR
|
||||
{
|
||||
"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": [
|
||||
{"id": "E001", "type": "missing", "section": "section-6", "desc": "缺少权限管理接口"}
|
||||
],
|
||||
"warnings": [
|
||||
{"id": "W001", "type": "inconsistency", "sections": ["section-3", "section-6"], "desc": "术语不一致"}
|
||||
],
|
||||
"info": [
|
||||
{"id": "I001", "type": "enhancement", "section": "section-4", "desc": "建议添加复杂度分析"}
|
||||
]
|
||||
"errors": [...],
|
||||
"warnings": [...],
|
||||
"info": [...]
|
||||
},
|
||||
"cross_refs": {
|
||||
"found": 12,
|
||||
@@ -151,34 +177,16 @@ graph LR
|
||||
|
||||
## 问题类型
|
||||
|
||||
| 类型 | 说明 | 检查范围 |
|
||||
|------|------|----------|
|
||||
| missing | 缺失内容 | 功能-接口对应、异常覆盖 |
|
||||
| inconsistency | 不一致 | 术语、命名、编号 |
|
||||
| circular | 循环依赖 | 模块依赖关系 |
|
||||
| orphan | 孤立内容 | 未被引用的功能/数据结构 |
|
||||
| syntax | 语法错误 | Mermaid 图表 |
|
||||
| enhancement | 增强建议 | 内容深度、引用 |
|
||||
|
||||
## 与 Phase 4 的集成
|
||||
|
||||
```javascript
|
||||
// Phase 4 装配时读取汇总报告
|
||||
const summary = JSON.parse(Read(`${outputDir}/cross-module-summary.md`));
|
||||
|
||||
if (summary.issues.errors.length > 0) {
|
||||
// 阻止装配,先修复严重问题
|
||||
return {
|
||||
action: "fix_required",
|
||||
errors: summary.issues.errors
|
||||
};
|
||||
}
|
||||
|
||||
// 在最终文档中插入跨模块说明
|
||||
insertCrossModuleSummary(document, summary);
|
||||
```
|
||||
| 类型 | 说明 |
|
||||
|------|------|
|
||||
| missing | 缺失内容(功能-接口对应、异常覆盖)|
|
||||
| inconsistency | 不一致(术语、命名、编号)|
|
||||
| circular | 循环依赖 |
|
||||
| orphan | 孤立内容(未被引用)|
|
||||
| syntax | Mermaid 语法错误 |
|
||||
| enhancement | 增强建议 |
|
||||
|
||||
## Output
|
||||
|
||||
- 文件: `cross-module-summary.md`
|
||||
- 返回: 问题列表 + 统计信息
|
||||
- **文件**: `cross-module-summary.md`(完整汇总报告)
|
||||
- **返回**: JSON 包含 Phase 4 所需的 synthesis 和 section_summaries
|
||||
|
||||
Reference in New Issue
Block a user