claude-code-workflow 6.3.26 → 6.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +7 -1
- package/.claude/agents/action-planning-agent.md +1 -0
- package/.claude/agents/cli-discuss-agent.md +391 -0
- package/.claude/agents/cli-execution-agent.md +2 -0
- package/.claude/agents/cli-explore-agent.md +2 -1
- package/.claude/agents/cli-lite-planning-agent.md +1 -0
- package/.claude/agents/cli-planning-agent.md +1 -0
- package/.claude/agents/code-developer.md +1 -0
- package/.claude/agents/conceptual-planning-agent.md +2 -0
- package/.claude/agents/context-search-agent.md +1 -0
- package/.claude/agents/debug-explore-agent.md +2 -0
- package/.claude/agents/doc-generator.md +1 -0
- package/.claude/agents/issue-plan-agent.md +2 -1
- package/.claude/agents/issue-queue-agent.md +2 -1
- package/.claude/agents/memory-bridge.md +2 -0
- package/.claude/agents/test-context-search-agent.md +2 -0
- package/.claude/agents/test-fix-agent.md +1 -0
- package/.claude/agents/ui-design-agent.md +2 -0
- package/.claude/agents/universal-executor.md +1 -0
- package/.claude/commands/issue/execute.md +141 -163
- package/.claude/commands/workflow/lite-lite-lite.md +798 -0
- package/.claude/commands/workflow/multi-cli-plan.md +510 -0
- package/.claude/skills/ccw/SKILL.md +262 -372
- package/.claude/skills/ccw/command.json +547 -0
- package/.claude/skills/ccw-help/SKILL.md +46 -107
- package/.claude/skills/ccw-help/command.json +511 -0
- package/.claude/skills/skill-tuning/SKILL.md +303 -0
- package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -0
- package/.claude/skills/skill-tuning/phases/actions/action-analyze-requirements.md +406 -0
- package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -0
- package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-docs.md +299 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -0
- package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -0
- package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -0
- package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -0
- package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -0
- package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -0
- package/.claude/skills/skill-tuning/phases/state-schema.md +378 -0
- package/.claude/skills/skill-tuning/specs/category-mappings.json +284 -0
- package/.claude/skills/skill-tuning/specs/dimension-mapping.md +212 -0
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -0
- package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -0
- package/.claude/skills/skill-tuning/specs/skill-authoring-principles.md +189 -0
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -0
- package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -0
- package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -0
- package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +421 -0
- package/.claude/workflows/cli-tools-usage.md +0 -41
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -1
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +2 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +5 -2
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +2 -1
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +295 -6
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +5 -5
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +166 -48
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +87 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.js +2 -2
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/scripts/IMPLEMENTATION-SUMMARY.md +226 -0
- package/ccw/scripts/QUICK-REFERENCE.md +135 -0
- package/ccw/scripts/README-memory-embedder.md +157 -0
- package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
- package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
- package/ccw/scripts/memory-embedder-example.ts +184 -0
- package/ccw/scripts/memory_embedder.py +428 -0
- package/ccw/scripts/test_memory_embedder.py +245 -0
- package/ccw/src/core/auth/csrf-middleware.ts +3 -1
- package/ccw/src/core/data-aggregator.ts +7 -2
- package/ccw/src/core/lite-scanner.ts +440 -6
- package/ccw/src/core/routes/codexlens/config-handlers.ts +12 -9
- package/ccw/src/core/routes/session-routes.ts +201 -48
- package/ccw/src/core/routes/system-routes.ts +102 -0
- package/ccw/src/core/server.ts +2 -2
- package/ccw/src/templates/dashboard-css/01-base.css +8 -0
- package/ccw/src/templates/dashboard-css/02-session.css +81 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +2442 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +157 -0
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +23 -0
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +38 -4
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +38 -13
- package/ccw/src/templates/dashboard-js/components/navigation.js +24 -4
- package/ccw/src/templates/dashboard-js/i18n.js +194 -6
- package/ccw/src/templates/dashboard-js/views/api-settings.js +32 -0
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +44 -3
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +303 -31
- package/ccw/src/templates/dashboard-js/views/history.js +44 -6
- package/ccw/src/templates/dashboard-js/views/home.js +1 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +54 -7
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1817 -4
- package/ccw/src/templates/dashboard.html +5 -0
- package/package.json +2 -1
- package/.claude/skills/ccw/index/command-capabilities.json +0 -127
- package/.claude/skills/ccw/index/intent-rules.json +0 -136
- package/.claude/skills/ccw/index/workflow-chains.json +0 -451
- package/.claude/skills/ccw/phases/actions/bugfix.md +0 -218
- package/.claude/skills/ccw/phases/actions/coupled.md +0 -194
- package/.claude/skills/ccw/phases/actions/docs.md +0 -93
- package/.claude/skills/ccw/phases/actions/full.md +0 -154
- package/.claude/skills/ccw/phases/actions/issue.md +0 -201
- package/.claude/skills/ccw/phases/actions/rapid.md +0 -104
- package/.claude/skills/ccw/phases/actions/review-fix.md +0 -84
- package/.claude/skills/ccw/phases/actions/tdd.md +0 -66
- package/.claude/skills/ccw/phases/actions/ui.md +0 -79
- package/.claude/skills/ccw/phases/orchestrator.md +0 -435
- package/.claude/skills/ccw/specs/intent-classification.md +0 -336
- package/.claude/skills/ccw-help/index/all-agents.json +0 -82
- package/.claude/skills/ccw-help/index/all-commands.json +0 -882
- package/.claude/skills/ccw-help/index/by-category.json +0 -914
- package/.claude/skills/ccw-help/index/by-use-case.json +0 -896
- package/.claude/skills/ccw-help/index/command-relationships.json +0 -160
- package/.claude/skills/ccw-help/index/essential-commands.json +0 -112
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Dimension to Spec Mapping
|
|
2
|
+
|
|
3
|
+
维度关键词到 Spec 的映射规则,用于 action-analyze-requirements 阶段的自动匹配。
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
| Phase | Usage |
|
|
8
|
+
|-------|-------|
|
|
9
|
+
| action-analyze-requirements | 维度→类别→Spec 自动匹配 |
|
|
10
|
+
| action-propose-fixes | 策略选择参考 |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Keyword → Category Mapping
|
|
15
|
+
|
|
16
|
+
基于关键词将用户描述的维度映射到问题类别。
|
|
17
|
+
|
|
18
|
+
### 中英文关键词表
|
|
19
|
+
|
|
20
|
+
| Keywords (中文) | Keywords (英文) | Primary Category | Secondary |
|
|
21
|
+
|----------------|-----------------|------------------|-----------|
|
|
22
|
+
| token, 上下文, 爆炸, 太长, 超限, 膨胀 | token, context, explosion, overflow, bloat | context_explosion | - |
|
|
23
|
+
| 遗忘, 忘记, 指令丢失, 约束消失, 目标漂移 | forget, lost, drift, constraint, goal | memory_loss | - |
|
|
24
|
+
| 状态, 数据, 格式, 不一致, 丢失, 损坏 | state, data, format, inconsistent, corrupt | dataflow_break | - |
|
|
25
|
+
| agent, 子任务, 失败, 嵌套, 调用, 协调 | agent, subtask, fail, nested, call, coordinate | agent_failure | - |
|
|
26
|
+
| 慢, 性能, 效率, token 消耗, 延迟 | slow, performance, efficiency, latency | performance | context_explosion |
|
|
27
|
+
| 提示词, prompt, 输出不稳定, 幻觉 | prompt, unstable, hallucination | prompt_quality | - |
|
|
28
|
+
| 架构, 结构, 模块, 耦合, 扩展 | architecture, structure, module, coupling | architecture | - |
|
|
29
|
+
| 错误, 异常, 恢复, 降级, 崩溃 | error, exception, recovery, crash | error_handling | agent_failure |
|
|
30
|
+
| 输出, 质量, 格式, 验证, 不完整 | output, quality, validation, incomplete | output_quality | - |
|
|
31
|
+
| 交互, 体验, 进度, 反馈, 不清晰 | interaction, ux, progress, feedback | user_experience | - |
|
|
32
|
+
| 重复, 冗余, 多处定义, 相同内容 | duplicate, redundant, multiple definitions | doc_redundancy | - |
|
|
33
|
+
| 冲突, 不一致, 定义不同, 矛盾 | conflict, inconsistent, mismatch, contradiction | doc_conflict | - |
|
|
34
|
+
|
|
35
|
+
### Matching Algorithm
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
function matchCategory(keywords) {
|
|
39
|
+
const categoryScores = {};
|
|
40
|
+
|
|
41
|
+
for (const keyword of keywords) {
|
|
42
|
+
const normalizedKeyword = keyword.toLowerCase();
|
|
43
|
+
|
|
44
|
+
for (const [category, categoryKeywords] of Object.entries(KEYWORD_MAP)) {
|
|
45
|
+
if (categoryKeywords.some(k => normalizedKeyword.includes(k) || k.includes(normalizedKeyword))) {
|
|
46
|
+
categoryScores[category] = (categoryScores[category] || 0) + 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 返回得分最高的类别
|
|
52
|
+
const sorted = Object.entries(categoryScores).sort((a, b) => b[1] - a[1]);
|
|
53
|
+
|
|
54
|
+
if (sorted.length === 0) return null;
|
|
55
|
+
|
|
56
|
+
// 如果前两名得分相同,返回多类别(需澄清)
|
|
57
|
+
if (sorted.length > 1 && sorted[0][1] === sorted[1][1]) {
|
|
58
|
+
return {
|
|
59
|
+
primary: sorted[0][0],
|
|
60
|
+
secondary: sorted[1][0],
|
|
61
|
+
ambiguous: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
primary: sorted[0][0],
|
|
67
|
+
secondary: sorted[1]?.[0] || null,
|
|
68
|
+
ambiguous: false
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Category → Taxonomy Pattern Mapping
|
|
76
|
+
|
|
77
|
+
将问题类别映射到 problem-taxonomy.md 中的检测模式。
|
|
78
|
+
|
|
79
|
+
| Category | Pattern IDs | Detection Focus |
|
|
80
|
+
|----------|-------------|-----------------|
|
|
81
|
+
| context_explosion | CTX-001, CTX-002, CTX-003, CTX-004, CTX-005 | Token 累积、内容传递模式 |
|
|
82
|
+
| memory_loss | MEM-001, MEM-002, MEM-003, MEM-004, MEM-005 | 约束传播、检查点机制 |
|
|
83
|
+
| dataflow_break | DF-001, DF-002, DF-003, DF-004, DF-005 | 状态存储、Schema 验证 |
|
|
84
|
+
| agent_failure | AGT-001, AGT-002, AGT-003, AGT-004, AGT-005, AGT-006 | 错误处理、结果验证 |
|
|
85
|
+
| prompt_quality | - | (无内置检测,需 Gemini 分析) |
|
|
86
|
+
| architecture | - | (无内置检测,需 Gemini 分析) |
|
|
87
|
+
| performance | CTX-001, CTX-003 | (复用 context 检测) |
|
|
88
|
+
| error_handling | AGT-001, AGT-002 | (复用 agent 检测) |
|
|
89
|
+
| output_quality | - | (无内置检测,需 Gemini 分析) |
|
|
90
|
+
| user_experience | - | (无内置检测,需 Gemini 分析) |
|
|
91
|
+
| doc_redundancy | DOC-RED-001, DOC-RED-002, DOC-RED-003 | 重复定义检测 |
|
|
92
|
+
| doc_conflict | DOC-CON-001, DOC-CON-002 | 冲突定义检测 |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Category → Strategy Mapping
|
|
97
|
+
|
|
98
|
+
将问题类别映射到 tuning-strategies.md 中的修复策略。
|
|
99
|
+
|
|
100
|
+
### Core Categories (有完整策略)
|
|
101
|
+
|
|
102
|
+
| Category | Available Strategies | Risk Level |
|
|
103
|
+
|----------|---------------------|------------|
|
|
104
|
+
| context_explosion | sliding_window, path_reference, context_summarization, structured_state | Low-Medium |
|
|
105
|
+
| memory_loss | constraint_injection, state_constraints_field, checkpoint_restore, goal_embedding | Low-Medium |
|
|
106
|
+
| dataflow_break | state_centralization, schema_enforcement, field_normalization | Low-Medium |
|
|
107
|
+
| agent_failure | error_wrapping, result_validation, flatten_nesting | Low-Medium |
|
|
108
|
+
| doc_redundancy | consolidate_to_ssot, centralize_mapping_config | Low-Medium |
|
|
109
|
+
| doc_conflict | reconcile_conflicting_definitions | Low |
|
|
110
|
+
|
|
111
|
+
### Extended Categories (需 Gemini 生成策略)
|
|
112
|
+
|
|
113
|
+
| Category | Available Strategies | Risk Level |
|
|
114
|
+
|----------|---------------------|------------|
|
|
115
|
+
| prompt_quality | structured_prompt, output_schema, grounding_context, format_enforcement | Low |
|
|
116
|
+
| architecture | phase_decomposition, interface_contracts, plugin_architecture, state_machine | Medium-High |
|
|
117
|
+
| performance | token_budgeting, parallel_execution, result_caching, lazy_loading | Low-Medium |
|
|
118
|
+
| error_handling | graceful_degradation, error_propagation, structured_logging, error_context | Low |
|
|
119
|
+
| output_quality | quality_gates, output_validation, template_enforcement, completeness_check | Low |
|
|
120
|
+
| user_experience | progress_tracking, status_communication, interactive_checkpoints, guided_workflow | Low |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Coverage Rules
|
|
125
|
+
|
|
126
|
+
### Satisfaction Criteria
|
|
127
|
+
|
|
128
|
+
判断"是否满足需求"的标准:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
function evaluateSatisfaction(specMatch) {
|
|
132
|
+
// 核心标准:有可用的修复策略
|
|
133
|
+
const hasFix = specMatch.strategy_match !== null &&
|
|
134
|
+
specMatch.strategy_match.strategies.length > 0;
|
|
135
|
+
|
|
136
|
+
// 辅助标准:有检测手段
|
|
137
|
+
const hasDetection = specMatch.taxonomy_match !== null;
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
satisfied: hasFix,
|
|
141
|
+
detection_available: hasDetection,
|
|
142
|
+
needs_gemini: !hasDetection // 无内置检测时需要 Gemini 分析
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Coverage Status Thresholds
|
|
148
|
+
|
|
149
|
+
| Status | Condition |
|
|
150
|
+
|--------|-----------|
|
|
151
|
+
| satisfied | coverage_rate >= 80% |
|
|
152
|
+
| partial | 50% <= coverage_rate < 80% |
|
|
153
|
+
| unsatisfied | coverage_rate < 50% |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Fallback Rules
|
|
158
|
+
|
|
159
|
+
当无法匹配到具体类别时的处理:
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
function handleUnmatchedDimension(dimension) {
|
|
163
|
+
return {
|
|
164
|
+
dimension_id: dimension.id,
|
|
165
|
+
taxonomy_match: null,
|
|
166
|
+
strategy_match: {
|
|
167
|
+
strategies: ['custom'], // Fallback to custom strategy
|
|
168
|
+
risk_levels: ['medium']
|
|
169
|
+
},
|
|
170
|
+
has_fix: true, // custom 策略视为"可满足"
|
|
171
|
+
needs_gemini_analysis: true,
|
|
172
|
+
fallback_reason: 'no_keyword_match'
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Usage Example
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
// 输入:用户描述 "skill 执行太慢,而且有时候会忘记最初的指令"
|
|
183
|
+
|
|
184
|
+
// Step 1: Gemini 拆解为维度
|
|
185
|
+
const dimensions = [
|
|
186
|
+
{ id: 'DIM-001', description: '执行太慢', keywords: ['慢', '执行'], confidence: 0.9 },
|
|
187
|
+
{ id: 'DIM-002', description: '忘记最初指令', keywords: ['忘记', '指令'], confidence: 0.85 }
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
// Step 2: 匹配类别
|
|
191
|
+
// DIM-001 → performance (慢)
|
|
192
|
+
// DIM-002 → memory_loss (忘记, 指令)
|
|
193
|
+
|
|
194
|
+
// Step 3: 匹配 Spec
|
|
195
|
+
const specMatches = [
|
|
196
|
+
{
|
|
197
|
+
dimension_id: 'DIM-001',
|
|
198
|
+
taxonomy_match: { category: 'performance', pattern_ids: ['CTX-001', 'CTX-003'], severity_hint: 'medium' },
|
|
199
|
+
strategy_match: { strategies: ['token_budgeting', 'parallel_execution'], risk_levels: ['low', 'low'] },
|
|
200
|
+
has_fix: true
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
dimension_id: 'DIM-002',
|
|
204
|
+
taxonomy_match: { category: 'memory_loss', pattern_ids: ['MEM-001', 'MEM-002'], severity_hint: 'high' },
|
|
205
|
+
strategy_match: { strategies: ['constraint_injection', 'checkpoint_restore'], risk_levels: ['low', 'low'] },
|
|
206
|
+
has_fix: true
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
// Step 4: 评估覆盖度
|
|
211
|
+
// 2/2 = 100% → satisfied
|
|
212
|
+
```
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Problem Taxonomy
|
|
2
|
+
|
|
3
|
+
Classification of skill execution issues with detection patterns and severity criteria.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
| Phase | Usage | Section |
|
|
8
|
+
|-------|-------|---------|
|
|
9
|
+
| All Diagnosis Actions | Issue classification | All sections |
|
|
10
|
+
| action-propose-fixes | Strategy selection | Fix Mapping |
|
|
11
|
+
| action-generate-report | Severity assessment | Severity Criteria |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Problem Categories
|
|
16
|
+
|
|
17
|
+
### 0. Authoring Principles Violation (P0)
|
|
18
|
+
|
|
19
|
+
**Definition**: 违反 skill 撰写首要准则(简洁高效、去除存储、上下文流转)。
|
|
20
|
+
|
|
21
|
+
**Root Causes**:
|
|
22
|
+
- 不必要的中间文件存储
|
|
23
|
+
- State schema 过度膨胀
|
|
24
|
+
- 文件中转代替上下文传递
|
|
25
|
+
- 重复数据存储
|
|
26
|
+
|
|
27
|
+
**Detection Patterns**:
|
|
28
|
+
|
|
29
|
+
| Pattern ID | Regex/Check | Description |
|
|
30
|
+
|------------|-------------|-------------|
|
|
31
|
+
| APV-001 | `/Write\([^)]*temp-|intermediate-/` | 中间文件写入 |
|
|
32
|
+
| APV-002 | `/Write\([^)]+\)[\s\S]{0,50}Read\([^)]+\)/` | 写后立即读(文件中转) |
|
|
33
|
+
| APV-003 | State schema > 15 fields | State 字段过多 |
|
|
34
|
+
| APV-004 | `/_history\s*[.=].*push|concat/` | 无限增长数组 |
|
|
35
|
+
| APV-005 | `/debug_|_cache|_temp/` in state | 调试/缓存字段残留 |
|
|
36
|
+
| APV-006 | Same data in multiple state fields | 重复存储 |
|
|
37
|
+
|
|
38
|
+
**Impact Levels**:
|
|
39
|
+
- **Critical**: 中间文件 > 5 个,严重违反原则
|
|
40
|
+
- **High**: State 字段 > 20 个,或存在文件中转
|
|
41
|
+
- **Medium**: 存在调试字段或轻微冗余
|
|
42
|
+
- **Low**: 轻微的命名不规范
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### 1. Context Explosion (P2)
|
|
47
|
+
|
|
48
|
+
**Definition**: Excessive token accumulation causing prompt size to grow unbounded.
|
|
49
|
+
|
|
50
|
+
**Root Causes**:
|
|
51
|
+
- Unbounded conversation history
|
|
52
|
+
- Full content passing instead of references
|
|
53
|
+
- Missing summarization mechanisms
|
|
54
|
+
- Agent returning full output instead of path+summary
|
|
55
|
+
|
|
56
|
+
**Detection Patterns**:
|
|
57
|
+
|
|
58
|
+
| Pattern ID | Regex/Check | Description |
|
|
59
|
+
|------------|-------------|-------------|
|
|
60
|
+
| CTX-001 | `/history\s*[.=].*push\|concat/` | History array growth |
|
|
61
|
+
| CTX-002 | `/JSON\.stringify\s*\(\s*state\s*\)/` | Full state serialization |
|
|
62
|
+
| CTX-003 | `/Read\([^)]+\)\s*[\+,]/` | Multiple file content concatenation |
|
|
63
|
+
| CTX-004 | `/return\s*\{[^}]*content:/` | Agent returning full content |
|
|
64
|
+
| CTX-005 | File length > 5000 chars without summarize | Long prompt without compression |
|
|
65
|
+
|
|
66
|
+
**Impact Levels**:
|
|
67
|
+
- **Critical**: Context exceeds model limit (128K tokens)
|
|
68
|
+
- **High**: Context > 50K tokens per iteration
|
|
69
|
+
- **Medium**: Context grows 10%+ per iteration
|
|
70
|
+
- **Low**: Potential for growth but currently manageable
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 2. Long-tail Forgetting (P3)
|
|
75
|
+
|
|
76
|
+
**Definition**: Loss of early instructions, constraints, or goals in long execution chains.
|
|
77
|
+
|
|
78
|
+
**Root Causes**:
|
|
79
|
+
- No explicit constraint propagation
|
|
80
|
+
- Reliance on implicit context
|
|
81
|
+
- Missing checkpoint/restore mechanisms
|
|
82
|
+
- State schema without requirements field
|
|
83
|
+
|
|
84
|
+
**Detection Patterns**:
|
|
85
|
+
|
|
86
|
+
| Pattern ID | Regex/Check | Description |
|
|
87
|
+
|------------|-------------|-------------|
|
|
88
|
+
| MEM-001 | Later phases missing constraint reference | Constraint not carried forward |
|
|
89
|
+
| MEM-002 | `/\[TASK\][^[]*(?!\[CONSTRAINTS\])/` | Task without constraints section |
|
|
90
|
+
| MEM-003 | Key phases without checkpoint | Missing state preservation |
|
|
91
|
+
| MEM-004 | State schema lacks `original_requirements` | No constraint persistence |
|
|
92
|
+
| MEM-005 | No verification phase | Output not checked against intent |
|
|
93
|
+
|
|
94
|
+
**Impact Levels**:
|
|
95
|
+
- **Critical**: Original goal completely lost
|
|
96
|
+
- **High**: Key constraints ignored in output
|
|
97
|
+
- **Medium**: Some requirements missing
|
|
98
|
+
- **Low**: Minor goal drift
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 3. Data Flow Disruption (P0)
|
|
103
|
+
|
|
104
|
+
**Definition**: Inconsistent state management causing data loss or corruption.
|
|
105
|
+
|
|
106
|
+
**Root Causes**:
|
|
107
|
+
- Multiple state storage locations
|
|
108
|
+
- Inconsistent field naming
|
|
109
|
+
- Missing schema validation
|
|
110
|
+
- Format transformation without normalization
|
|
111
|
+
|
|
112
|
+
**Detection Patterns**:
|
|
113
|
+
|
|
114
|
+
| Pattern ID | Regex/Check | Description |
|
|
115
|
+
|------------|-------------|-------------|
|
|
116
|
+
| DF-001 | Multiple state file writes | Scattered state storage |
|
|
117
|
+
| DF-002 | Same concept, different names | Field naming inconsistency |
|
|
118
|
+
| DF-003 | JSON.parse without validation | Missing schema validation |
|
|
119
|
+
| DF-004 | Files written but never read | Orphaned outputs |
|
|
120
|
+
| DF-005 | Autonomous skill without state-schema | Undefined state structure |
|
|
121
|
+
|
|
122
|
+
**Impact Levels**:
|
|
123
|
+
- **Critical**: Data loss or corruption
|
|
124
|
+
- **High**: State inconsistency between phases
|
|
125
|
+
- **Medium**: Potential for inconsistency
|
|
126
|
+
- **Low**: Minor naming inconsistencies
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 4. Agent Coordination Failure (P1)
|
|
131
|
+
|
|
132
|
+
**Definition**: Fragile agent call patterns causing cascading failures.
|
|
133
|
+
|
|
134
|
+
**Root Causes**:
|
|
135
|
+
- Missing error handling in Task calls
|
|
136
|
+
- No result validation
|
|
137
|
+
- Inconsistent agent configurations
|
|
138
|
+
- Deeply nested agent calls
|
|
139
|
+
|
|
140
|
+
**Detection Patterns**:
|
|
141
|
+
|
|
142
|
+
| Pattern ID | Regex/Check | Description |
|
|
143
|
+
|------------|-------------|-------------|
|
|
144
|
+
| AGT-001 | Task without try-catch | Missing error handling |
|
|
145
|
+
| AGT-002 | Result used without validation | No return value check |
|
|
146
|
+
| AGT-003 | > 3 different agent types | Agent type proliferation |
|
|
147
|
+
| AGT-004 | Nested Task in prompt | Agent calling agent |
|
|
148
|
+
| AGT-005 | Task used but not in allowed-tools | Tool declaration mismatch |
|
|
149
|
+
| AGT-006 | Multiple return formats | Inconsistent agent output |
|
|
150
|
+
|
|
151
|
+
**Impact Levels**:
|
|
152
|
+
- **Critical**: Workflow crash on agent failure
|
|
153
|
+
- **High**: Unpredictable agent behavior
|
|
154
|
+
- **Medium**: Occasional coordination issues
|
|
155
|
+
- **Low**: Minor inconsistencies
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### 5. Documentation Redundancy (P5)
|
|
160
|
+
|
|
161
|
+
**Definition**: 同一定义(如 State Schema、映射表、类型定义)在多个文件中重复出现,导致维护困难和不一致风险。
|
|
162
|
+
|
|
163
|
+
**Root Causes**:
|
|
164
|
+
- 缺乏单一真相来源 (SSOT)
|
|
165
|
+
- 复制粘贴代替引用
|
|
166
|
+
- 硬编码配置代替集中管理
|
|
167
|
+
|
|
168
|
+
**Detection Patterns**:
|
|
169
|
+
|
|
170
|
+
| Pattern ID | Regex/Check | Description |
|
|
171
|
+
|------------|-------------|-------------|
|
|
172
|
+
| DOC-RED-001 | 跨文件语义比较 | 找到 State Schema 等核心概念的重复定义 |
|
|
173
|
+
| DOC-RED-002 | 代码块 vs 规范表对比 | action 文件中硬编码与 spec 文档的重复 |
|
|
174
|
+
| DOC-RED-003 | `/interface\s+(\w+)/` 同名扫描 | 多处定义的 interface/type |
|
|
175
|
+
|
|
176
|
+
**Impact Levels**:
|
|
177
|
+
- **High**: 核心定义(State Schema, 映射表)重复
|
|
178
|
+
- **Medium**: 类型定义重复
|
|
179
|
+
- **Low**: 示例代码重复
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### 6. Token Consumption (P6)
|
|
184
|
+
|
|
185
|
+
**Definition**: Excessive token usage from verbose prompts, large state objects, or inefficient I/O patterns.
|
|
186
|
+
|
|
187
|
+
**Root Causes**:
|
|
188
|
+
- Long static prompts without compression
|
|
189
|
+
- State schema with too many fields
|
|
190
|
+
- Full content embedding instead of path references
|
|
191
|
+
- Arrays growing unbounded without sliding windows
|
|
192
|
+
- Write-then-read file relay patterns
|
|
193
|
+
|
|
194
|
+
**Detection Patterns**:
|
|
195
|
+
|
|
196
|
+
| Pattern ID | Regex/Check | Description |
|
|
197
|
+
|------------|-------------|-------------|
|
|
198
|
+
| TKN-001 | File size > 4KB | Verbose prompt files |
|
|
199
|
+
| TKN-002 | State fields > 15 | Excessive state schema |
|
|
200
|
+
| TKN-003 | `/Read\([^)]+\)\s*[\+,]/` | Full content passing |
|
|
201
|
+
| TKN-004 | `/.push\|concat(?!.*\.slice)/` | Unbounded array growth |
|
|
202
|
+
| TKN-005 | `/Write\([^)]+\)[\s\S]{0,100}Read\([^)]+\)/` | Write-then-read pattern |
|
|
203
|
+
|
|
204
|
+
**Impact Levels**:
|
|
205
|
+
- **High**: Multiple TKN-003/TKN-004 issues causing significant token waste
|
|
206
|
+
- **Medium**: Several verbose files or state bloat
|
|
207
|
+
- **Low**: Minor optimization opportunities
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### 7. Documentation Conflict (P7)
|
|
212
|
+
|
|
213
|
+
**Definition**: 同一概念在不同文件中定义不一致,导致行为不可预测和文档误导。
|
|
214
|
+
|
|
215
|
+
**Root Causes**:
|
|
216
|
+
- 定义更新后未同步其他位置
|
|
217
|
+
- 实现与文档漂移
|
|
218
|
+
- 缺乏一致性校验
|
|
219
|
+
|
|
220
|
+
**Detection Patterns**:
|
|
221
|
+
|
|
222
|
+
| Pattern ID | Regex/Check | Description |
|
|
223
|
+
|------------|-------------|-------------|
|
|
224
|
+
| DOC-CON-001 | 键值一致性校验 | 同一键(如优先级)在不同文件中值不同 |
|
|
225
|
+
| DOC-CON-002 | 实现 vs 文档对比 | 硬编码配置与文档对应项不一致 |
|
|
226
|
+
|
|
227
|
+
**Impact Levels**:
|
|
228
|
+
- **Critical**: 优先级/类别定义冲突
|
|
229
|
+
- **High**: 策略映射不一致
|
|
230
|
+
- **Medium**: 示例与实际不符
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Severity Criteria
|
|
235
|
+
|
|
236
|
+
### Global Severity Matrix
|
|
237
|
+
|
|
238
|
+
| Severity | Definition | Action Required |
|
|
239
|
+
|----------|------------|-----------------|
|
|
240
|
+
| **Critical** | Blocks execution or causes data loss | Immediate fix required |
|
|
241
|
+
| **High** | Significantly impacts reliability | Should fix before deployment |
|
|
242
|
+
| **Medium** | Affects quality or maintainability | Fix in next iteration |
|
|
243
|
+
| **Low** | Minor improvement opportunity | Optional fix |
|
|
244
|
+
|
|
245
|
+
### Severity Calculation
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
function calculateIssueSeverity(issue) {
|
|
249
|
+
const weights = {
|
|
250
|
+
impact_on_execution: 40, // Does it block workflow?
|
|
251
|
+
data_integrity_risk: 30, // Can it cause data loss?
|
|
252
|
+
frequency: 20, // How often does it occur?
|
|
253
|
+
complexity_to_fix: 10 // How hard to fix?
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
let score = 0;
|
|
257
|
+
|
|
258
|
+
// Impact on execution
|
|
259
|
+
if (issue.blocks_execution) score += weights.impact_on_execution;
|
|
260
|
+
else if (issue.degrades_execution) score += weights.impact_on_execution * 0.5;
|
|
261
|
+
|
|
262
|
+
// Data integrity
|
|
263
|
+
if (issue.causes_data_loss) score += weights.data_integrity_risk;
|
|
264
|
+
else if (issue.causes_inconsistency) score += weights.data_integrity_risk * 0.5;
|
|
265
|
+
|
|
266
|
+
// Frequency
|
|
267
|
+
if (issue.occurs_every_run) score += weights.frequency;
|
|
268
|
+
else if (issue.occurs_sometimes) score += weights.frequency * 0.5;
|
|
269
|
+
|
|
270
|
+
// Complexity (inverse - easier to fix = higher priority)
|
|
271
|
+
if (issue.fix_complexity === 'low') score += weights.complexity_to_fix;
|
|
272
|
+
else if (issue.fix_complexity === 'medium') score += weights.complexity_to_fix * 0.5;
|
|
273
|
+
|
|
274
|
+
// Map score to severity
|
|
275
|
+
if (score >= 70) return 'critical';
|
|
276
|
+
if (score >= 50) return 'high';
|
|
277
|
+
if (score >= 30) return 'medium';
|
|
278
|
+
return 'low';
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Fix Mapping
|
|
285
|
+
|
|
286
|
+
| Problem Type | Recommended Strategies | Priority Order |
|
|
287
|
+
|--------------|----------------------|----------------|
|
|
288
|
+
| **Authoring Principles Violation** | eliminate_intermediate_files, minimize_state, context_passing | 1, 2, 3 |
|
|
289
|
+
| Context Explosion | sliding_window, path_reference, context_summarization | 1, 2, 3 |
|
|
290
|
+
| Long-tail Forgetting | constraint_injection, state_constraints_field, checkpoint | 1, 2, 3 |
|
|
291
|
+
| Data Flow Disruption | state_centralization, schema_enforcement, field_normalization | 1, 2, 3 |
|
|
292
|
+
| Agent Coordination | error_wrapping, result_validation, flatten_nesting | 1, 2, 3 |
|
|
293
|
+
| **Token Consumption** | prompt_compression, lazy_loading, output_minimization, state_field_reduction | 1, 2, 3, 4 |
|
|
294
|
+
| **Documentation Redundancy** | consolidate_to_ssot, centralize_mapping_config | 1, 2 |
|
|
295
|
+
| **Documentation Conflict** | reconcile_conflicting_definitions | 1 |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Cross-Category Dependencies
|
|
300
|
+
|
|
301
|
+
Some issues may trigger others:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Context Explosion ──→ Long-tail Forgetting
|
|
305
|
+
(Large context causes important info to be pushed out)
|
|
306
|
+
|
|
307
|
+
Data Flow Disruption ──→ Agent Coordination Failure
|
|
308
|
+
(Inconsistent data causes agents to fail)
|
|
309
|
+
|
|
310
|
+
Agent Coordination Failure ──→ Context Explosion
|
|
311
|
+
(Failed retries add to context)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
When fixing, address in this order:
|
|
315
|
+
1. **P0 Data Flow** - Foundation for other fixes
|
|
316
|
+
2. **P1 Agent Coordination** - Stability
|
|
317
|
+
3. **P2 Context Explosion** - Efficiency
|
|
318
|
+
4. **P3 Long-tail Forgetting** - Quality
|