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,378 @@
|
|
|
1
|
+
# State Schema
|
|
2
|
+
|
|
3
|
+
Defines the state structure for skill-tuning orchestrator.
|
|
4
|
+
|
|
5
|
+
## State Structure
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface TuningState {
|
|
9
|
+
// === Core Status ===
|
|
10
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
11
|
+
started_at: string; // ISO timestamp
|
|
12
|
+
updated_at: string; // ISO timestamp
|
|
13
|
+
|
|
14
|
+
// === Target Skill Info ===
|
|
15
|
+
target_skill: {
|
|
16
|
+
name: string; // e.g., "software-manual"
|
|
17
|
+
path: string; // e.g., ".claude/skills/software-manual"
|
|
18
|
+
execution_mode: 'sequential' | 'autonomous';
|
|
19
|
+
phases: string[]; // List of phase files
|
|
20
|
+
specs: string[]; // List of spec files
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// === User Input ===
|
|
24
|
+
user_issue_description: string; // User's problem description
|
|
25
|
+
focus_areas: string[]; // User-specified focus (optional)
|
|
26
|
+
|
|
27
|
+
// === Diagnosis Results ===
|
|
28
|
+
diagnosis: {
|
|
29
|
+
context: DiagnosisResult | null;
|
|
30
|
+
memory: DiagnosisResult | null;
|
|
31
|
+
dataflow: DiagnosisResult | null;
|
|
32
|
+
agent: DiagnosisResult | null;
|
|
33
|
+
docs: DocsDiagnosisResult | null; // 文档结构诊断
|
|
34
|
+
token_consumption: DiagnosisResult | null; // Token消耗诊断
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// === Issues Found ===
|
|
38
|
+
issues: Issue[];
|
|
39
|
+
issues_by_severity: {
|
|
40
|
+
critical: number;
|
|
41
|
+
high: number;
|
|
42
|
+
medium: number;
|
|
43
|
+
low: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// === Fix Management ===
|
|
47
|
+
proposed_fixes: Fix[];
|
|
48
|
+
applied_fixes: AppliedFix[];
|
|
49
|
+
pending_fixes: string[]; // Fix IDs pending application
|
|
50
|
+
|
|
51
|
+
// === Iteration Control ===
|
|
52
|
+
iteration_count: number;
|
|
53
|
+
max_iterations: number; // Default: 5
|
|
54
|
+
|
|
55
|
+
// === Quality Metrics ===
|
|
56
|
+
quality_score: number; // 0-100
|
|
57
|
+
quality_gate: 'pass' | 'review' | 'fail';
|
|
58
|
+
|
|
59
|
+
// === Orchestrator State ===
|
|
60
|
+
completed_actions: string[];
|
|
61
|
+
current_action: string | null;
|
|
62
|
+
action_history: ActionHistoryEntry[];
|
|
63
|
+
|
|
64
|
+
// === Error Handling ===
|
|
65
|
+
errors: ErrorEntry[];
|
|
66
|
+
error_count: number;
|
|
67
|
+
max_errors: number; // Default: 3
|
|
68
|
+
|
|
69
|
+
// === Output Paths ===
|
|
70
|
+
work_dir: string;
|
|
71
|
+
backup_dir: string;
|
|
72
|
+
|
|
73
|
+
// === Final Report (consolidated output) ===
|
|
74
|
+
final_report: string | null; // Markdown summary generated on completion
|
|
75
|
+
|
|
76
|
+
// === Requirement Analysis (新增) ===
|
|
77
|
+
requirement_analysis: RequirementAnalysis | null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface RequirementAnalysis {
|
|
81
|
+
status: 'pending' | 'completed' | 'needs_clarification';
|
|
82
|
+
analyzed_at: string;
|
|
83
|
+
|
|
84
|
+
// Phase 1: 维度拆解
|
|
85
|
+
dimensions: Dimension[];
|
|
86
|
+
|
|
87
|
+
// Phase 2: Spec 匹配
|
|
88
|
+
spec_matches: SpecMatch[];
|
|
89
|
+
|
|
90
|
+
// Phase 3: 覆盖度
|
|
91
|
+
coverage: {
|
|
92
|
+
total_dimensions: number;
|
|
93
|
+
with_detection: number; // 有 taxonomy pattern
|
|
94
|
+
with_fix_strategy: number; // 有 tuning strategy (满足判断标准)
|
|
95
|
+
coverage_rate: number; // 0-100%
|
|
96
|
+
status: 'satisfied' | 'partial' | 'unsatisfied';
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// Phase 4: 歧义
|
|
100
|
+
ambiguities: Ambiguity[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface Dimension {
|
|
104
|
+
id: string; // e.g., "DIM-001"
|
|
105
|
+
description: string; // 关注点描述
|
|
106
|
+
keywords: string[]; // 关键词
|
|
107
|
+
inferred_category: string; // 推断的问题类别
|
|
108
|
+
confidence: number; // 置信度 0-1
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface SpecMatch {
|
|
112
|
+
dimension_id: string;
|
|
113
|
+
taxonomy_match: {
|
|
114
|
+
category: string; // e.g., "context_explosion"
|
|
115
|
+
pattern_ids: string[]; // e.g., ["CTX-001", "CTX-003"]
|
|
116
|
+
severity_hint: string;
|
|
117
|
+
} | null;
|
|
118
|
+
strategy_match: {
|
|
119
|
+
strategies: string[]; // e.g., ["sliding_window", "path_reference"]
|
|
120
|
+
risk_levels: string[];
|
|
121
|
+
} | null;
|
|
122
|
+
has_fix: boolean; // 满足性判断核心
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface Ambiguity {
|
|
126
|
+
dimension_id: string;
|
|
127
|
+
type: 'multi_category' | 'vague_description' | 'conflicting_keywords';
|
|
128
|
+
description: string;
|
|
129
|
+
possible_interpretations: string[];
|
|
130
|
+
needs_clarification: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface DiagnosisResult {
|
|
134
|
+
status: 'completed' | 'skipped' | 'failed';
|
|
135
|
+
issues_found: number;
|
|
136
|
+
severity: 'critical' | 'high' | 'medium' | 'low' | 'none';
|
|
137
|
+
execution_time_ms: number;
|
|
138
|
+
details: {
|
|
139
|
+
patterns_checked: string[];
|
|
140
|
+
patterns_matched: string[];
|
|
141
|
+
evidence: Evidence[];
|
|
142
|
+
recommendations: string[];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface DocsDiagnosisResult extends DiagnosisResult {
|
|
147
|
+
redundancies: Redundancy[];
|
|
148
|
+
conflicts: Conflict[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface Redundancy {
|
|
152
|
+
id: string; // e.g., "DOC-RED-001"
|
|
153
|
+
type: 'state_schema' | 'strategy_mapping' | 'type_definition' | 'other';
|
|
154
|
+
files: string[]; // 涉及的文件列表
|
|
155
|
+
description: string; // 冗余描述
|
|
156
|
+
severity: 'high' | 'medium' | 'low';
|
|
157
|
+
merge_suggestion: string; // 合并建议
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface Conflict {
|
|
161
|
+
id: string; // e.g., "DOC-CON-001"
|
|
162
|
+
type: 'priority' | 'mapping' | 'definition';
|
|
163
|
+
files: string[]; // 涉及的文件列表
|
|
164
|
+
key: string; // 冲突的键/概念
|
|
165
|
+
definitions: {
|
|
166
|
+
file: string;
|
|
167
|
+
value: string;
|
|
168
|
+
location?: string;
|
|
169
|
+
}[];
|
|
170
|
+
resolution_suggestion: string; // 解决建议
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface Evidence {
|
|
174
|
+
file: string;
|
|
175
|
+
line?: number;
|
|
176
|
+
pattern: string;
|
|
177
|
+
context: string;
|
|
178
|
+
severity: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface Issue {
|
|
182
|
+
id: string; // e.g., "ISS-001"
|
|
183
|
+
type: 'context_explosion' | 'memory_loss' | 'dataflow_break' | 'agent_failure' | 'token_consumption';
|
|
184
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
185
|
+
priority: number; // 1 = highest
|
|
186
|
+
location: {
|
|
187
|
+
file: string;
|
|
188
|
+
line_start?: number;
|
|
189
|
+
line_end?: number;
|
|
190
|
+
phase?: string;
|
|
191
|
+
};
|
|
192
|
+
description: string;
|
|
193
|
+
evidence: string[];
|
|
194
|
+
root_cause: string;
|
|
195
|
+
impact: string;
|
|
196
|
+
suggested_fix: string;
|
|
197
|
+
related_issues: string[]; // Issue IDs
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface Fix {
|
|
201
|
+
id: string; // e.g., "FIX-001"
|
|
202
|
+
issue_ids: string[]; // Issues this fix addresses
|
|
203
|
+
strategy: FixStrategy;
|
|
204
|
+
description: string;
|
|
205
|
+
rationale: string;
|
|
206
|
+
changes: FileChange[];
|
|
207
|
+
risk: 'low' | 'medium' | 'high';
|
|
208
|
+
estimated_impact: string;
|
|
209
|
+
verification_steps: string[];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
type FixStrategy =
|
|
213
|
+
| 'context_summarization' // Add context compression
|
|
214
|
+
| 'sliding_window' // Implement sliding context window
|
|
215
|
+
| 'structured_state' // Convert to structured state passing
|
|
216
|
+
| 'constraint_injection' // Add constraint propagation
|
|
217
|
+
| 'checkpoint_restore' // Add checkpointing mechanism
|
|
218
|
+
| 'schema_enforcement' // Add data contract validation
|
|
219
|
+
| 'orchestrator_refactor' // Refactor agent coordination
|
|
220
|
+
| 'state_centralization' // Centralize state management
|
|
221
|
+
| 'prompt_compression' // Extract static text, use templates
|
|
222
|
+
| 'lazy_loading' // Pass paths instead of content
|
|
223
|
+
| 'output_minimization' // Return minimal structured JSON
|
|
224
|
+
| 'state_field_reduction' // Audit and consolidate state fields
|
|
225
|
+
| 'custom'; // Custom fix
|
|
226
|
+
|
|
227
|
+
interface FileChange {
|
|
228
|
+
file: string;
|
|
229
|
+
action: 'create' | 'modify' | 'delete';
|
|
230
|
+
old_content?: string;
|
|
231
|
+
new_content?: string;
|
|
232
|
+
diff?: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface AppliedFix {
|
|
236
|
+
fix_id: string;
|
|
237
|
+
applied_at: string;
|
|
238
|
+
success: boolean;
|
|
239
|
+
backup_path: string;
|
|
240
|
+
verification_result: 'pass' | 'fail' | 'pending';
|
|
241
|
+
rollback_available: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface ActionHistoryEntry {
|
|
245
|
+
action: string;
|
|
246
|
+
started_at: string;
|
|
247
|
+
completed_at: string;
|
|
248
|
+
result: 'success' | 'failure' | 'skipped';
|
|
249
|
+
output_files: string[];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface ErrorEntry {
|
|
253
|
+
action: string;
|
|
254
|
+
message: string;
|
|
255
|
+
timestamp: string;
|
|
256
|
+
recoverable: boolean;
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Initial State Template
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"status": "pending",
|
|
265
|
+
"started_at": null,
|
|
266
|
+
"updated_at": null,
|
|
267
|
+
"target_skill": {
|
|
268
|
+
"name": null,
|
|
269
|
+
"path": null,
|
|
270
|
+
"execution_mode": null,
|
|
271
|
+
"phases": [],
|
|
272
|
+
"specs": []
|
|
273
|
+
},
|
|
274
|
+
"user_issue_description": "",
|
|
275
|
+
"focus_areas": [],
|
|
276
|
+
"diagnosis": {
|
|
277
|
+
"context": null,
|
|
278
|
+
"memory": null,
|
|
279
|
+
"dataflow": null,
|
|
280
|
+
"agent": null,
|
|
281
|
+
"docs": null,
|
|
282
|
+
"token_consumption": null
|
|
283
|
+
},
|
|
284
|
+
"issues": [],
|
|
285
|
+
"issues_by_severity": {
|
|
286
|
+
"critical": 0,
|
|
287
|
+
"high": 0,
|
|
288
|
+
"medium": 0,
|
|
289
|
+
"low": 0
|
|
290
|
+
},
|
|
291
|
+
"proposed_fixes": [],
|
|
292
|
+
"applied_fixes": [],
|
|
293
|
+
"pending_fixes": [],
|
|
294
|
+
"iteration_count": 0,
|
|
295
|
+
"max_iterations": 5,
|
|
296
|
+
"quality_score": 0,
|
|
297
|
+
"quality_gate": "fail",
|
|
298
|
+
"completed_actions": [],
|
|
299
|
+
"current_action": null,
|
|
300
|
+
"action_history": [],
|
|
301
|
+
"errors": [],
|
|
302
|
+
"error_count": 0,
|
|
303
|
+
"max_errors": 3,
|
|
304
|
+
"work_dir": null,
|
|
305
|
+
"backup_dir": null,
|
|
306
|
+
"final_report": null,
|
|
307
|
+
"requirement_analysis": null
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## State Transition Diagram
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
┌─────────────┐
|
|
315
|
+
│ pending │
|
|
316
|
+
└──────┬──────┘
|
|
317
|
+
│ action-init
|
|
318
|
+
↓
|
|
319
|
+
┌─────────────┐
|
|
320
|
+
┌──────────│ running │──────────┐
|
|
321
|
+
│ └──────┬──────┘ │
|
|
322
|
+
│ │ │
|
|
323
|
+
diagnosis │ ┌────────────┼────────────┐ │ error_count >= 3
|
|
324
|
+
actions │ │ │ │ │
|
|
325
|
+
│ ↓ ↓ ↓ │
|
|
326
|
+
│ context memory dataflow │
|
|
327
|
+
│ │ │ │ │
|
|
328
|
+
│ └────────────┼────────────┘ │
|
|
329
|
+
│ │ │
|
|
330
|
+
│ ↓ │
|
|
331
|
+
│ action-verify │
|
|
332
|
+
│ │ │
|
|
333
|
+
│ ┌───────────┼───────────┐ │
|
|
334
|
+
│ │ │ │ │
|
|
335
|
+
│ ↓ ↓ ↓ │
|
|
336
|
+
│ quality iterate apply │
|
|
337
|
+
│ gate=pass (< max) fix │
|
|
338
|
+
│ │ │ │ │
|
|
339
|
+
│ │ └───────────┘ │
|
|
340
|
+
│ ↓ ↓
|
|
341
|
+
│ ┌─────────────┐ ┌─────────────┐
|
|
342
|
+
└→│ completed │ │ failed │
|
|
343
|
+
└─────────────┘ └─────────────┘
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## State Update Rules
|
|
347
|
+
|
|
348
|
+
### Atomicity
|
|
349
|
+
All state updates must be atomic - read current state, apply changes, write entire state.
|
|
350
|
+
|
|
351
|
+
### Immutability
|
|
352
|
+
Never mutate state in place. Always create new state object with changes.
|
|
353
|
+
|
|
354
|
+
### Validation
|
|
355
|
+
Before writing state, validate against schema to prevent corruption.
|
|
356
|
+
|
|
357
|
+
### Timestamps
|
|
358
|
+
Always update `updated_at` on every state change.
|
|
359
|
+
|
|
360
|
+
```javascript
|
|
361
|
+
function updateState(workDir, updates) {
|
|
362
|
+
const currentState = JSON.parse(Read(`${workDir}/state.json`));
|
|
363
|
+
|
|
364
|
+
const newState = {
|
|
365
|
+
...currentState,
|
|
366
|
+
...updates,
|
|
367
|
+
updated_at: new Date().toISOString()
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// Validate before write
|
|
371
|
+
if (!validateState(newState)) {
|
|
372
|
+
throw new Error('Invalid state update');
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
Write(`${workDir}/state.json`, JSON.stringify(newState, null, 2));
|
|
376
|
+
return newState;
|
|
377
|
+
}
|
|
378
|
+
```
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Centralized category mappings for skill-tuning analysis and fix proposal",
|
|
4
|
+
"categories": {
|
|
5
|
+
"authoring_principles_violation": {
|
|
6
|
+
"pattern_ids": ["APV-001", "APV-002", "APV-003", "APV-004", "APV-005", "APV-006"],
|
|
7
|
+
"severity_hint": "critical",
|
|
8
|
+
"strategies": ["eliminate_intermediate_files", "minimize_state", "context_passing"],
|
|
9
|
+
"risk_levels": ["low", "low", "low"],
|
|
10
|
+
"detection_focus": "Intermediate files, state bloat, file relay patterns",
|
|
11
|
+
"priority_order": [1, 2, 3]
|
|
12
|
+
},
|
|
13
|
+
"context_explosion": {
|
|
14
|
+
"pattern_ids": ["CTX-001", "CTX-002", "CTX-003", "CTX-004", "CTX-005"],
|
|
15
|
+
"severity_hint": "high",
|
|
16
|
+
"strategies": ["sliding_window", "path_reference", "context_summarization", "structured_state"],
|
|
17
|
+
"risk_levels": ["low", "low", "low", "medium"],
|
|
18
|
+
"detection_focus": "Token accumulation, content passing patterns",
|
|
19
|
+
"priority_order": [1, 2, 3, 4]
|
|
20
|
+
},
|
|
21
|
+
"memory_loss": {
|
|
22
|
+
"pattern_ids": ["MEM-001", "MEM-002", "MEM-003", "MEM-004", "MEM-005"],
|
|
23
|
+
"severity_hint": "high",
|
|
24
|
+
"strategies": ["constraint_injection", "state_constraints_field", "checkpoint_restore", "goal_embedding"],
|
|
25
|
+
"risk_levels": ["low", "low", "low", "medium"],
|
|
26
|
+
"detection_focus": "Constraint propagation, checkpoint mechanisms",
|
|
27
|
+
"priority_order": [1, 2, 3, 4]
|
|
28
|
+
},
|
|
29
|
+
"dataflow_break": {
|
|
30
|
+
"pattern_ids": ["DF-001", "DF-002", "DF-003", "DF-004", "DF-005"],
|
|
31
|
+
"severity_hint": "critical",
|
|
32
|
+
"strategies": ["state_centralization", "schema_enforcement", "field_normalization"],
|
|
33
|
+
"risk_levels": ["medium", "low", "low"],
|
|
34
|
+
"detection_focus": "State storage, schema validation",
|
|
35
|
+
"priority_order": [1, 2, 3]
|
|
36
|
+
},
|
|
37
|
+
"agent_failure": {
|
|
38
|
+
"pattern_ids": ["AGT-001", "AGT-002", "AGT-003", "AGT-004", "AGT-005", "AGT-006"],
|
|
39
|
+
"severity_hint": "high",
|
|
40
|
+
"strategies": ["error_wrapping", "result_validation", "flatten_nesting"],
|
|
41
|
+
"risk_levels": ["low", "low", "medium"],
|
|
42
|
+
"detection_focus": "Error handling, result validation",
|
|
43
|
+
"priority_order": [1, 2, 3]
|
|
44
|
+
},
|
|
45
|
+
"prompt_quality": {
|
|
46
|
+
"pattern_ids": [],
|
|
47
|
+
"severity_hint": "medium",
|
|
48
|
+
"strategies": ["structured_prompt", "output_schema", "grounding_context", "format_enforcement"],
|
|
49
|
+
"risk_levels": ["low", "low", "medium", "low"],
|
|
50
|
+
"detection_focus": null,
|
|
51
|
+
"needs_gemini_analysis": true,
|
|
52
|
+
"priority_order": [1, 2, 3, 4]
|
|
53
|
+
},
|
|
54
|
+
"architecture": {
|
|
55
|
+
"pattern_ids": [],
|
|
56
|
+
"severity_hint": "medium",
|
|
57
|
+
"strategies": ["phase_decomposition", "interface_contracts", "plugin_architecture", "state_machine"],
|
|
58
|
+
"risk_levels": ["medium", "medium", "high", "medium"],
|
|
59
|
+
"detection_focus": null,
|
|
60
|
+
"needs_gemini_analysis": true,
|
|
61
|
+
"priority_order": [1, 2, 3, 4]
|
|
62
|
+
},
|
|
63
|
+
"performance": {
|
|
64
|
+
"pattern_ids": ["CTX-001", "CTX-003"],
|
|
65
|
+
"severity_hint": "medium",
|
|
66
|
+
"strategies": ["token_budgeting", "parallel_execution", "result_caching", "lazy_loading"],
|
|
67
|
+
"risk_levels": ["low", "low", "low", "low"],
|
|
68
|
+
"detection_focus": "Reuses context explosion detection",
|
|
69
|
+
"priority_order": [1, 2, 3, 4]
|
|
70
|
+
},
|
|
71
|
+
"error_handling": {
|
|
72
|
+
"pattern_ids": ["AGT-001", "AGT-002"],
|
|
73
|
+
"severity_hint": "medium",
|
|
74
|
+
"strategies": ["graceful_degradation", "error_propagation", "structured_logging", "error_context"],
|
|
75
|
+
"risk_levels": ["low", "low", "low", "low"],
|
|
76
|
+
"detection_focus": "Reuses agent failure detection",
|
|
77
|
+
"priority_order": [1, 2, 3, 4]
|
|
78
|
+
},
|
|
79
|
+
"output_quality": {
|
|
80
|
+
"pattern_ids": [],
|
|
81
|
+
"severity_hint": "medium",
|
|
82
|
+
"strategies": ["quality_gates", "output_validation", "template_enforcement", "completeness_check"],
|
|
83
|
+
"risk_levels": ["low", "low", "low", "low"],
|
|
84
|
+
"detection_focus": null,
|
|
85
|
+
"needs_gemini_analysis": true,
|
|
86
|
+
"priority_order": [1, 2, 3, 4]
|
|
87
|
+
},
|
|
88
|
+
"user_experience": {
|
|
89
|
+
"pattern_ids": [],
|
|
90
|
+
"severity_hint": "low",
|
|
91
|
+
"strategies": ["progress_tracking", "status_communication", "interactive_checkpoints", "guided_workflow"],
|
|
92
|
+
"risk_levels": ["low", "low", "low", "low"],
|
|
93
|
+
"detection_focus": null,
|
|
94
|
+
"needs_gemini_analysis": true,
|
|
95
|
+
"priority_order": [1, 2, 3, 4]
|
|
96
|
+
},
|
|
97
|
+
"token_consumption": {
|
|
98
|
+
"pattern_ids": ["TKN-001", "TKN-002", "TKN-003", "TKN-004", "TKN-005"],
|
|
99
|
+
"severity_hint": "medium",
|
|
100
|
+
"strategies": ["prompt_compression", "lazy_loading", "output_minimization", "state_field_reduction", "sliding_window"],
|
|
101
|
+
"risk_levels": ["low", "low", "low", "low", "low"],
|
|
102
|
+
"detection_focus": "Verbose prompts, excessive state fields, full content passing, unbounded arrays, redundant I/O",
|
|
103
|
+
"priority_order": [1, 2, 3, 4, 5]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"keywords": {
|
|
107
|
+
"chinese": {
|
|
108
|
+
"token": "context_explosion",
|
|
109
|
+
"上下文": "context_explosion",
|
|
110
|
+
"爆炸": "context_explosion",
|
|
111
|
+
"太长": "context_explosion",
|
|
112
|
+
"超限": "context_explosion",
|
|
113
|
+
"膨胀": "context_explosion",
|
|
114
|
+
"遗忘": "memory_loss",
|
|
115
|
+
"忘记": "memory_loss",
|
|
116
|
+
"指令丢失": "memory_loss",
|
|
117
|
+
"约束消失": "memory_loss",
|
|
118
|
+
"目标漂移": "memory_loss",
|
|
119
|
+
"状态": "dataflow_break",
|
|
120
|
+
"数据": "dataflow_break",
|
|
121
|
+
"格式": "dataflow_break",
|
|
122
|
+
"不一致": "dataflow_break",
|
|
123
|
+
"丢失": "dataflow_break",
|
|
124
|
+
"损坏": "dataflow_break",
|
|
125
|
+
"agent": "agent_failure",
|
|
126
|
+
"子任务": "agent_failure",
|
|
127
|
+
"失败": "agent_failure",
|
|
128
|
+
"嵌套": "agent_failure",
|
|
129
|
+
"调用": "agent_failure",
|
|
130
|
+
"协调": "agent_failure",
|
|
131
|
+
"慢": "performance",
|
|
132
|
+
"性能": "performance",
|
|
133
|
+
"效率": "performance",
|
|
134
|
+
"延迟": "performance",
|
|
135
|
+
"提示词": "prompt_quality",
|
|
136
|
+
"输出不稳定": "prompt_quality",
|
|
137
|
+
"幻觉": "prompt_quality",
|
|
138
|
+
"架构": "architecture",
|
|
139
|
+
"结构": "architecture",
|
|
140
|
+
"模块": "architecture",
|
|
141
|
+
"耦合": "architecture",
|
|
142
|
+
"扩展": "architecture",
|
|
143
|
+
"错误": "error_handling",
|
|
144
|
+
"异常": "error_handling",
|
|
145
|
+
"恢复": "error_handling",
|
|
146
|
+
"降级": "error_handling",
|
|
147
|
+
"崩溃": "error_handling",
|
|
148
|
+
"输出": "output_quality",
|
|
149
|
+
"质量": "output_quality",
|
|
150
|
+
"验证": "output_quality",
|
|
151
|
+
"不完整": "output_quality",
|
|
152
|
+
"交互": "user_experience",
|
|
153
|
+
"体验": "user_experience",
|
|
154
|
+
"进度": "user_experience",
|
|
155
|
+
"反馈": "user_experience",
|
|
156
|
+
"不清晰": "user_experience",
|
|
157
|
+
"中间文件": "authoring_principles_violation",
|
|
158
|
+
"临时文件": "authoring_principles_violation",
|
|
159
|
+
"文件中转": "authoring_principles_violation",
|
|
160
|
+
"state膨胀": "authoring_principles_violation",
|
|
161
|
+
"token消耗": "token_consumption",
|
|
162
|
+
"token优化": "token_consumption",
|
|
163
|
+
"产出简化": "token_consumption",
|
|
164
|
+
"冗长": "token_consumption",
|
|
165
|
+
"精简": "token_consumption"
|
|
166
|
+
},
|
|
167
|
+
"english": {
|
|
168
|
+
"token": "context_explosion",
|
|
169
|
+
"context": "context_explosion",
|
|
170
|
+
"explosion": "context_explosion",
|
|
171
|
+
"overflow": "context_explosion",
|
|
172
|
+
"bloat": "context_explosion",
|
|
173
|
+
"forget": "memory_loss",
|
|
174
|
+
"lost": "memory_loss",
|
|
175
|
+
"drift": "memory_loss",
|
|
176
|
+
"constraint": "memory_loss",
|
|
177
|
+
"goal": "memory_loss",
|
|
178
|
+
"state": "dataflow_break",
|
|
179
|
+
"data": "dataflow_break",
|
|
180
|
+
"format": "dataflow_break",
|
|
181
|
+
"inconsistent": "dataflow_break",
|
|
182
|
+
"corrupt": "dataflow_break",
|
|
183
|
+
"agent": "agent_failure",
|
|
184
|
+
"subtask": "agent_failure",
|
|
185
|
+
"fail": "agent_failure",
|
|
186
|
+
"nested": "agent_failure",
|
|
187
|
+
"call": "agent_failure",
|
|
188
|
+
"coordinate": "agent_failure",
|
|
189
|
+
"slow": "performance",
|
|
190
|
+
"performance": "performance",
|
|
191
|
+
"efficiency": "performance",
|
|
192
|
+
"latency": "performance",
|
|
193
|
+
"prompt": "prompt_quality",
|
|
194
|
+
"unstable": "prompt_quality",
|
|
195
|
+
"hallucination": "prompt_quality",
|
|
196
|
+
"architecture": "architecture",
|
|
197
|
+
"structure": "architecture",
|
|
198
|
+
"module": "architecture",
|
|
199
|
+
"coupling": "architecture",
|
|
200
|
+
"error": "error_handling",
|
|
201
|
+
"exception": "error_handling",
|
|
202
|
+
"recovery": "error_handling",
|
|
203
|
+
"crash": "error_handling",
|
|
204
|
+
"output": "output_quality",
|
|
205
|
+
"quality": "output_quality",
|
|
206
|
+
"validation": "output_quality",
|
|
207
|
+
"incomplete": "output_quality",
|
|
208
|
+
"interaction": "user_experience",
|
|
209
|
+
"ux": "user_experience",
|
|
210
|
+
"progress": "user_experience",
|
|
211
|
+
"feedback": "user_experience",
|
|
212
|
+
"intermediate": "authoring_principles_violation",
|
|
213
|
+
"temp": "authoring_principles_violation",
|
|
214
|
+
"relay": "authoring_principles_violation",
|
|
215
|
+
"verbose": "token_consumption",
|
|
216
|
+
"minimize": "token_consumption",
|
|
217
|
+
"compress": "token_consumption",
|
|
218
|
+
"simplify": "token_consumption",
|
|
219
|
+
"reduction": "token_consumption"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"category_labels": {
|
|
223
|
+
"context_explosion": "Context Explosion",
|
|
224
|
+
"memory_loss": "Long-tail Forgetting",
|
|
225
|
+
"dataflow_break": "Data Flow Disruption",
|
|
226
|
+
"agent_failure": "Agent Coordination Failure",
|
|
227
|
+
"prompt_quality": "Prompt Quality",
|
|
228
|
+
"architecture": "Architecture",
|
|
229
|
+
"performance": "Performance",
|
|
230
|
+
"error_handling": "Error Handling",
|
|
231
|
+
"output_quality": "Output Quality",
|
|
232
|
+
"user_experience": "User Experience",
|
|
233
|
+
"authoring_principles_violation": "Authoring Principles Violation",
|
|
234
|
+
"token_consumption": "Token Consumption",
|
|
235
|
+
"custom": "Custom"
|
|
236
|
+
},
|
|
237
|
+
"category_labels_chinese": {
|
|
238
|
+
"context_explosion": "Context Explosion",
|
|
239
|
+
"memory_loss": "Long-tail Forgetting",
|
|
240
|
+
"dataflow_break": "Data Flow Disruption",
|
|
241
|
+
"agent_failure": "Agent Coordination Failure",
|
|
242
|
+
"prompt_quality": "Prompt Quality",
|
|
243
|
+
"architecture": "Architecture Issues",
|
|
244
|
+
"performance": "Performance Issues",
|
|
245
|
+
"error_handling": "Error Handling",
|
|
246
|
+
"output_quality": "Output Quality",
|
|
247
|
+
"user_experience": "User Experience",
|
|
248
|
+
"authoring_principles_violation": "Authoring Principles Violation",
|
|
249
|
+
"token_consumption": "Token Consumption Optimization",
|
|
250
|
+
"custom": "Other Issues"
|
|
251
|
+
},
|
|
252
|
+
"category_descriptions": {
|
|
253
|
+
"context_explosion": "Token accumulation causing prompt size to grow unbounded",
|
|
254
|
+
"memory_loss": "Early instructions or constraints lost in later phases",
|
|
255
|
+
"dataflow_break": "State data inconsistency between phases",
|
|
256
|
+
"agent_failure": "Sub-agent call failures or abnormal results",
|
|
257
|
+
"prompt_quality": "Vague prompts causing unstable outputs",
|
|
258
|
+
"architecture": "Improper phase division or module structure",
|
|
259
|
+
"performance": "Slow execution or high token consumption",
|
|
260
|
+
"error_handling": "Incomplete error recovery mechanisms",
|
|
261
|
+
"output_quality": "Output validation or completeness issues",
|
|
262
|
+
"user_experience": "Interaction or feedback clarity issues",
|
|
263
|
+
"authoring_principles_violation": "Violation of skill authoring principles",
|
|
264
|
+
"token_consumption": "Excessive token usage from verbose prompts, large state objects, or redundant I/O patterns",
|
|
265
|
+
"custom": "Requires custom analysis"
|
|
266
|
+
},
|
|
267
|
+
"fix_priority_order": {
|
|
268
|
+
"P0": ["dataflow_break", "authoring_principles_violation"],
|
|
269
|
+
"P1": ["agent_failure"],
|
|
270
|
+
"P2": ["context_explosion", "token_consumption"],
|
|
271
|
+
"P3": ["memory_loss"]
|
|
272
|
+
},
|
|
273
|
+
"cross_category_dependencies": {
|
|
274
|
+
"context_explosion": ["memory_loss"],
|
|
275
|
+
"dataflow_break": ["agent_failure"],
|
|
276
|
+
"agent_failure": ["context_explosion"]
|
|
277
|
+
},
|
|
278
|
+
"fallback": {
|
|
279
|
+
"strategies": ["custom"],
|
|
280
|
+
"risk_levels": ["medium"],
|
|
281
|
+
"has_fix": true,
|
|
282
|
+
"needs_gemini_analysis": true
|
|
283
|
+
}
|
|
284
|
+
}
|