kenaz 0.3.18 → 0.3.19
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/core/.claude/commands/agent-worker.md +1 -1
- package/core/.claude/commands/architect.md +1 -2
- package/core/.claude/commands/spec.md +1 -1
- package/core/.claude/commands//347/224/242/345/223/201.md +1 -1
- package/core/.claude/hooks/__tests__/task-1977-dedupe-guard.test.js +8 -8
- package/core/.claude/skills/architect_agent/SKILL.md +11 -92
- package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
- package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
- package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
- package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
- package/core/.claude/skills/designer/SKILL.md +3 -6
- package/core/.claude/skills/dev_agent/SKILL.md +30 -491
- package/core/.claude/skills/developer/SKILL.md +3 -6
- package/core/.claude/skills/feature_agent/SKILL.md +3 -17
- package/core/.claude/skills/product_manager/SKILL.md +29 -1064
- package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
- package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
- package/core/.claude/skills/sre_agent/SKILL.md +3 -6
- package/core/.collaboration/README.md +2 -3
- package/core/.collaboration/core/task-api.js +5 -138
- package/core/.collaboration/docs/CLI.md +0 -2
- package/core/.failure/INDEX.yaml +6 -40
- package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
- package/core/.failure/tools/README.md +9 -227
- package/core/.formation/bifrost/launch.js +1 -6
- package/core/.formation/bifrost/launch.test.js +1 -1
- package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
- package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
- package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
- package/core/.formation/tools/dispatch.js +1 -1
- package/core/.formation/tools/loader.js +17 -140
- package/core/.formation/tools/post-complete.js +0 -31
- package/core/.rule/INDEX.yaml +0 -18
- package/core/.rule/general/agent-workflow.yaml +14 -164
- package/core/.rule/general/project-self-containment.yaml +8 -19
- package/core/.rule/general/rust-verify-target.yaml +6 -5
- package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
- package/core/.specialist/Amelia/capability.yaml +12 -12
- package/core/.specialist/Amelia/workflow.yaml +2 -2
- package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
- package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
- package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
- package/core/.specialist/Ansuz/core.yaml +6 -108
- package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
- package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
- package/core/.specialist/Ansuz/knowledge.yaml +0 -4
- package/core/.specialist/Ansuz/rule.yaml +0 -1
- package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
- package/core/.specialist/tests/runtime-discovery/README.md +1 -1
- package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
- package/core/.specialist/tools/prompt-files.test.js +1 -0
- package/core/.specialist/tools/task-bridge.js +1 -66
- package/core/.system/README.md +11 -552
- package/core/.system/collaboration/README.md +10 -174
- package/core/CLAUDE.md +1 -6
- package/core/KENAZ_CORE_VERSION +1 -1
- package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
- package/core/dev/scripts/run-rust-tests.js +9 -45
- package/core/dev/scripts/rust-verify-worktree.js +4 -4
- package/core/dev/scripts/verify-target-dir.js +6 -6
- package/core/plugins/kenaz/INVENTORY.md +8 -8
- package/core/plugins/kenaz/commands/architect.md +1 -2
- package/core/plugins/kenaz/commands/spec.md +1 -1
- package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
- package/core/plugins/kenaz/guidance.md +1 -1
- package/core/plugins/kenaz/scripts/sync.js +1 -1
- package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
- package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
- package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
- package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
- package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
- package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
- package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
- package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
- package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
- package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
- package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
- package/package.json +6 -6
- package/core/.claude/commands/archive.md +0 -24
- package/core/.claude/commands/init.md +0 -112
- package/core/.claude/commands/legacy_dev.md +0 -18
- package/core/.claude/commands/product-review.md +0 -131
- package/core/.claude/commands/strategy.md +0 -141
- package/core/.claude/commands/sunny.md +0 -1
- package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
- package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
- package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
- package/core/.claude/hooks/_substrate-paths.js +0 -95
- package/core/.claude/hooks/context-check.js +0 -51
- package/core/.claude/hooks/fatigue-check.js +0 -52
- package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
- package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
- package/core/.claude/hooks/handoff-staleness.js +0 -197
- package/core/.claude/hooks/jev-thalamus-context.js +0 -17
- package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
- package/core/.claude/hooks/lease-release.js +0 -119
- package/core/.claude/hooks/lease-touch.js +0 -96
- package/core/.claude/hooks/reflex-feedback.js +0 -5
- package/core/.claude/hooks/session-init.ps1 +0 -49
- package/core/.claude/hooks/sound-event.js +0 -70
- package/core/.claude/hooks/sound-event.sh +0 -37
- package/core/.claude/hooks/stream-delta.js +0 -169
- package/core/.claude/no-hooks.settings.json +0 -3
- package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
- package/core/.claude/skills/sunny/SKILL.md +0 -74
- package/core/.collaboration/cli/commands/assign.js +0 -39
- package/core/.collaboration/cli/commands/claim.js +0 -33
- package/core/.collaboration/cli/commands/complete.js +0 -44
- package/core/.collaboration/cli/commands/create.js +0 -110
- package/core/.collaboration/cli/commands/get.js +0 -83
- package/core/.collaboration/cli/commands/index.js +0 -52
- package/core/.collaboration/cli/commands/list.js +0 -51
- package/core/.collaboration/cli/commands/lock.js +0 -45
- package/core/.collaboration/cli/commands/rebuild.js +0 -39
- package/core/.collaboration/cli/commands/search.js +0 -61
- package/core/.collaboration/cli/commands/stats.js +0 -61
- package/core/.collaboration/cli/commands/transfer.js +0 -41
- package/core/.collaboration/cli/commands/unlock.js +0 -48
- package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
- package/core/.collaboration/cli/formatters/index.js +0 -7
- package/core/.collaboration/cli/task-cli.js +0 -46
- package/core/.collaboration/cli/utils/arg-parser.js +0 -74
- package/core/.collaboration/cli/utils/git-user.js +0 -25
- package/core/.collaboration/cli/utils/index.js +0 -9
- package/core/.collaboration/cli/utils/output.js +0 -10
- package/core/.collaboration/config/default.yaml +0 -189
- package/core/.collaboration/core/conflict-resolver.js +0 -461
- package/core/.collaboration/core/conflict-resolver.test.js +0 -389
- package/core/.collaboration/core/migrate-legacy.js +0 -260
- package/core/.collaboration/docs/API.md +0 -787
- package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
- package/core/.collaboration/docs/FAQ.md +0 -695
- package/core/.collaboration/docs/MIGRATION.md +0 -804
- package/core/.collaboration/docs/examples/README.md +0 -320
- package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
- package/core/.collaboration/docs/examples/basic-usage.js +0 -184
- package/core/.collaboration/docs/examples/team-workflow.js +0 -352
- package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
- package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
- package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
- package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
- package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
- package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
- package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
- package/core/.failure/pipeline/README.md +0 -95
- package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
- package/core/.failure/tools/USAGE_GUIDE.md +0 -323
- package/core/.failure/tools/check_failures.ps1 +0 -387
- package/core/.failure/tools/log_failure.ps1 +0 -474
- package/core/.formation/.episode-input.json +0 -10
- package/core/.formation/.merge-lock +0 -1
- package/core/.formation/lead.yaml +0 -118
- package/core/.formation/legacy.bak/designer.yaml +0 -57
- package/core/.formation/legacy.bak/pm.yaml +0 -57
- package/core/.formation/legacy.bak/qa.yaml +0 -57
- package/core/.formation/legacy.bak/review.yaml +0 -62
- package/core/.formation/legacy.bak/scheduler.yaml +0 -129
- package/core/.formation/legacy.bak/sre.yaml +0 -57
- package/core/.formation/role-map.yaml +0 -274
- package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
- package/core/.formation/roles/_shared/modules/security.yaml +0 -103
- package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
- package/core/.formation/roles/backend/role.yaml +0 -93
- package/core/.formation/roles/code_reviewer/role.yaml +0 -102
- package/core/.formation/roles/database_optimizer/role.yaml +0 -107
- package/core/.formation/roles/designer/role.yaml +0 -66
- package/core/.formation/roles/developer/role.yaml +0 -75
- package/core/.formation/roles/frontend/role.yaml +0 -134
- package/core/.formation/roles/incident_response/role.yaml +0 -89
- package/core/.formation/roles/qa/role.yaml +0 -89
- package/core/.formation/roles/security/role.yaml +0 -87
- package/core/.formation/roles/sre/role.yaml +0 -66
- package/core/.formation/skills/coordinator.yaml +0 -52
- package/core/.formation/solo/diagnosis.yaml +0 -78
- package/core/.formation/solo/strategy.yaml +0 -121
- package/core/.formation/tests/hello.txt +0 -2
- package/core/.formation/tools/coordinator.js +0 -350
- package/core/.formation/tools/jev-correction.js +0 -214
- package/core/.formation/tools/jev-correction.test.js +0 -178
- package/core/.formation/tools/log-reader.js +0 -232
- package/core/.formation/tools/revert-daemon-state.js +0 -162
- package/core/.formation/tools/test-drift.js +0 -148
- package/core/.formation/unit/heimdall.yaml +0 -96
- package/core/.formation/unit/plan.yaml +0 -67
- package/core/.formation/unit/think.yaml +0 -58
- package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
- package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
- package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
- package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
- package/core/.kenaz/muninn_episode_write.ps1 +0 -17
- package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
- package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
- package/core/.kenaz/runes_TASK_1428.json +0 -57
- package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
- package/core/.kenaz/tmp_props.json +0 -1
- package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
- package/core/.rule/MECHANIZED.md +0 -61
- package/core/.rule/general/cortex-memory-recall.yaml +0 -446
- package/core/.rule/general/pipeline.yaml +0 -246
- package/core/.rule/general/sunny-access-control.yaml +0 -60
- package/core/.rule/general/system-invariants.yaml +0 -231
- package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
- package/core/.rule/pipeline/auto-update.yaml +0 -282
- package/core/.rule/pipeline/task-execution.yaml +0 -365
- package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
- package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
- package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
- package/core/.specialist/Ansuz/workflow.yaml +0 -1225
- package/core/.specialist/experiments/rg_benchmark.js +0 -523
- package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
- package/core/.specialist/tools/jev-optional-context.js +0 -107
- package/core/.specialist/tools/jev-optional-context.test.js +0 -152
- package/core/.specialist/tools/memory-action-log.js +0 -839
- package/core/.specialist/tools/phase-gate.js +0 -3534
- package/core/.specialist/tools/phase-gate.test.js +0 -85
- package/core/.specialist/tools/precompute-runner.js +0 -444
- package/core/.specialist/tools/rule-engine.js +0 -621
- package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
- package/core/.synapse/memory-shared.json.sync +0 -1
- package/core/.system/agent-skills/README.md +0 -724
- package/core/.system/cli-tools/README.md +0 -724
- package/core/.system/cortex/MODULES.md +0 -1046
- package/core/.system/dashboard/FRONTEND.md +0 -812
- package/core/.system/dashboard/README.md +0 -737
- package/core/.system/failure/README.md +0 -723
- package/core/.system/formation/LEGACY_SKILLS.md +0 -974
- package/core/.system/formation/POST_COMPLETE.md +0 -602
- package/core/.system/formation/README.md +0 -1094
- package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
- package/core/.system/kenaz/README.md +0 -787
- package/core/.system/memory/README.md +0 -719
- package/core/.system/pipeline/README.md +0 -712
- package/core/.system/rule/README.md +0 -794
- package/core/.system/sunny/README.md +0 -476
- package/core/.system/sunny/RULES.json +0 -89
- package/core/.system/sunny/knowledge/INDEX.md +0 -37
- package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
- package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
- package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
- package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
- package/core/.system/sunny/teammates/README.md +0 -107
- package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
- package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
- package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
- package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
- package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
- package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
- package/core/.system/sunny/tools.json +0 -101
- package/core/dev/scripts/cleanup-queue.js +0 -184
- package/core/dev/scripts/cleanup_queue.js +0 -86
- package/core/dev/scripts/legacy/README.md +0 -39
- package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
- package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
- package/core/dev/scripts/matrix/CLI_README.md +0 -214
- package/core/dev/scripts/matrix/README.md +0 -310
- package/core/dev/scripts/matrix/package-lock.json +0 -4266
- package/core/dev/scripts/matrix/package.json +0 -55
- package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
- package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
- package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
- package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
- package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
- package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
- package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
- package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
- package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
- package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
- package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
- package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
- package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
- package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
- package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
- package/core/dev/scripts/matrix/src/index.ts +0 -62
- package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
- package/core/dev/scripts/matrix/src/parser.ts +0 -281
- package/core/dev/scripts/matrix/src/serializer.ts +0 -151
- package/core/dev/scripts/matrix/src/validator.ts +0 -301
- package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
- package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
- package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
- package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
- package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
- package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
- package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
- package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
- package/core/dev/scripts/matrix/tsconfig.json +0 -20
- package/core/dev/scripts/matrix/types/index.d.ts +0 -111
- package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
- package/core/dev/scripts/matrix/types/index.js +0 -8
- package/core/dev/scripts/matrix/types/index.js.map +0 -1
- package/core/dev/scripts/matrix/types/index.ts +0 -124
- package/core/dev/scripts/memory-usage-report.js +0 -152
- package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
- package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
- package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
- package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
- package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
- package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
- package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
- package/core/dev/scripts/validate_pipeline.js +0 -197
- package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
- package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
- package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
- package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
- package/core/plugins/kenaz/commands/strategy.md +0 -141
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
# .failure 失敗學習系統
|
|
2
|
-
|
|
3
|
-
## 系統概述
|
|
4
|
-
|
|
5
|
-
`.failure/` 是 Kenaz AI 專案的**失敗經驗學習系統**,記錄開發過程中的失敗模式並提供預防措施。所有 Agent 執行任務前必須檢查此系統,避免重複已知錯誤。
|
|
6
|
-
|
|
7
|
-
**設計理念**:
|
|
8
|
-
- **從失敗中學習**:記錄失敗模式、根本原因、解決方案和預防措施
|
|
9
|
-
- **將錯誤轉化為規則**:重複失敗(>2 次)提升為 `.rule/` 強制規則
|
|
10
|
-
- **建立預防檢查清單**:每個失敗都有可執行的預防步驟
|
|
11
|
-
- **支援工具化**:PowerShell + Node.js 工具腳本自動化流程
|
|
12
|
-
|
|
13
|
-
**工作流程**:
|
|
14
|
-
```
|
|
15
|
-
失敗 → 記錄到 .failure/ → 分析根因 → 如重複發生(>2 次)→ 提升為 .rule/
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 目錄結構
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
.failure/
|
|
24
|
-
├── INDEX.yaml # 失敗記錄索引與載入順序
|
|
25
|
-
├── agent-execution/ # Agent 執行失敗(空跑、無輸出、錯誤邏輯)
|
|
26
|
-
│ ├── FAIL-001-agent-no-output.yaml
|
|
27
|
-
│ ├── FAIL-004_agent_platform_specific_commands.md
|
|
28
|
-
│ └── FAIL-005_background_agent_permission_denied.md
|
|
29
|
-
├── code-quality/ # 代碼品質問題(bug、性能、可讀性)
|
|
30
|
-
├── architecture/ # 架構決策失敗(設計缺陷、技術選型錯誤)
|
|
31
|
-
│ └── FAIL-006-python-version-compatibility.yaml
|
|
32
|
-
├── pipeline/ # Pipeline 系統失敗(任務管理、佇列、統計)
|
|
33
|
-
│ └── FAIL-003-queue-pollution.yaml
|
|
34
|
-
├── data-integrity/ # 數據完整性問題(JSON 損壞、編碼錯誤)
|
|
35
|
-
│ └── FAIL-002-json-bom.yaml
|
|
36
|
-
└── tools/ # 失敗學習工具腳本
|
|
37
|
-
├── check_failures.ps1 # 檢查相關失敗模式
|
|
38
|
-
├── log_failure.ps1 # 記錄新失敗經驗
|
|
39
|
-
├── validate_json.js # 驗證 JSON 文件
|
|
40
|
-
├── fix_json.js # 修復 JSON(移除 BOM + 驗證 + 格式化)
|
|
41
|
-
├── remove_bom.js # 移除 UTF-8 BOM
|
|
42
|
-
├── check_bom.js # 批量檢查 BOM
|
|
43
|
-
├── README.md # 工具使用說明
|
|
44
|
-
└── USAGE_GUIDE.md # 詳細使用指南
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 失敗分類
|
|
50
|
-
|
|
51
|
-
| 分類 | 目錄 | 說明 | 圖標 |
|
|
52
|
-
|------|------|------|------|
|
|
53
|
-
| **Agent 執行失敗** | `agent-execution/` | Agent 空跑、無輸出、錯誤邏輯、平台特定命令失敗 | 🤖 |
|
|
54
|
-
| **代碼品質問題** | `code-quality/` | Bug、性能問題、可讀性、測試覆蓋率不足 | 💻 |
|
|
55
|
-
| **架構決策失敗** | `architecture/` | 設計缺陷、技術選型錯誤、依賴兼容性問題 | 🏗️ |
|
|
56
|
-
| **Pipeline 失敗** | `pipeline/` | 任務管理、佇列污染、統計錯誤、狀態不一致 | ⚙️ |
|
|
57
|
-
| **數據完整性問題** | `data-integrity/` | JSON 損壞、編碼錯誤(BOM)、YAML 解析失敗 | 📊 |
|
|
58
|
-
|
|
59
|
-
**失敗檔名格式**:
|
|
60
|
-
- YAML 格式:`FAIL-<ID>-<slug>.yaml`(如 `FAIL-001-agent-no-output.yaml`)
|
|
61
|
-
- Markdown 格式:`FAIL-<ID>_<slug>.md`(如 `FAIL-004_agent_platform_specific_commands.md`)
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## 嚴重程度定義
|
|
66
|
-
|
|
67
|
-
| 級別 | 說明 | 圖標 | 行動 |
|
|
68
|
-
|------|------|------|------|
|
|
69
|
-
| **Critical** 🔴 | 導致系統無法運作或數據損壞 | 🔴 | 立即修復並建立規則 |
|
|
70
|
-
| **High** 🟠 | 嚴重影響功能或效率 | 🟠 | 優先修復並記錄預防措施 |
|
|
71
|
-
| **Medium** 🟡 | 影響體驗但不阻礙功能 | 🟡 | 計劃修復並改進流程 |
|
|
72
|
-
| **Low** 🟢 | 輕微問題或不便 | 🟢 | 記錄並在適當時機優化 |
|
|
73
|
-
|
|
74
|
-
**範例分佈**(截至 2026-02-17):
|
|
75
|
-
```yaml
|
|
76
|
-
total_failures: 6
|
|
77
|
-
by_severity:
|
|
78
|
-
critical: 2 # FAIL-001(Agent 無輸出), FAIL-005(權限問題)
|
|
79
|
-
high: 4 # FAIL-002(JSON BOM), FAIL-003(佇列污染), FAIL-004(平台命令), FAIL-006(依賴問題)
|
|
80
|
-
medium: 0
|
|
81
|
-
low: 0
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Agent 使用指南
|
|
87
|
-
|
|
88
|
-
### 核心規則:AGT-005
|
|
89
|
-
|
|
90
|
-
**遵循 AGT-005 規則:失敗時必須查閱失敗經驗**(定義於 `.rule/general/agent-workflow.yaml`)
|
|
91
|
-
|
|
92
|
-
### 使用場景
|
|
93
|
-
|
|
94
|
-
#### 1. 任務開始前(預防檢查)
|
|
95
|
-
|
|
96
|
-
**必須執行**:檢查是否有相關失敗模式
|
|
97
|
-
|
|
98
|
-
```powershell
|
|
99
|
-
# 方法 1:根據任務 ID 檢查(自動載入 TASK_QUEUE.json)
|
|
100
|
-
.\.failure\tools\check_failures.ps1 -TaskID "TASK_XXX"
|
|
101
|
-
|
|
102
|
-
# 方法 2:根據 Agent 類型檢查
|
|
103
|
-
.\.failure\tools\check_failures.ps1 -AgentType "developer"
|
|
104
|
-
|
|
105
|
-
# 方法 3:根據 Scope 路徑檢查(針對特定檔案/目錄)
|
|
106
|
-
.\.failure\tools\check_failures.ps1 -ScopePath "dev/pipeline/"
|
|
107
|
-
|
|
108
|
-
# 方法 4:根據關鍵詞搜尋
|
|
109
|
-
.\.failure\tools\check_failures.ps1 -Keywords "JSON,BOM,encoding"
|
|
110
|
-
|
|
111
|
-
# 方法 5:過濾分類和嚴重程度
|
|
112
|
-
.\.failure\tools\check_failures.ps1 -Category "pipeline" -Severity "critical"
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**輸出結果**:
|
|
116
|
-
- 匹配的失敗記錄數量
|
|
117
|
-
- 每個失敗的預防檢查清單
|
|
118
|
-
- 解決方案參考
|
|
119
|
-
- 相關規則連結
|
|
120
|
-
|
|
121
|
-
**範例輸出**:
|
|
122
|
-
```
|
|
123
|
-
🔴 FAIL-002: JSON BOM 編碼問題 [high]
|
|
124
|
-
分類: data-integrity
|
|
125
|
-
|
|
126
|
-
預防檢查清單:
|
|
127
|
-
- [ ] 使用 validate_json.js 驗證 JSON 文件
|
|
128
|
-
- [ ] 檢查編輯器設置(避免 UTF-8 with BOM)
|
|
129
|
-
- [ ] 修改 JSON 後立即驗證
|
|
130
|
-
|
|
131
|
-
解決方案:
|
|
132
|
-
- 使用 fix_json.js 一鍵修復(移除 BOM + 驗證 + 格式化)
|
|
133
|
-
|
|
134
|
-
相關規則: DATA-001(數據完整性驗證)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
#### 2. 任務執行中(數據驗證)
|
|
138
|
-
|
|
139
|
-
**修改 JSON 文件後立即驗證**:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# 驗證 JSON 語法正確性
|
|
143
|
-
node .failure/tools/validate_json.js dev/pipeline/TASK_QUEUE.json
|
|
144
|
-
|
|
145
|
-
# 一鍵修復 JSON(移除 BOM + 驗證 + 重新格式化)
|
|
146
|
-
node .failure/tools/fix_json.js dev/pipeline/TASK_QUEUE.json
|
|
147
|
-
|
|
148
|
-
# 僅移除 BOM(不修改其他內容)
|
|
149
|
-
node .failure/tools/remove_bom.js dev/pipeline/TASK_QUEUE.json
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**定期維護(CI/CD 整合)**:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
# 批量檢查 BOM
|
|
156
|
-
node .failure/tools/check_bom.js dev/pipeline --recursive
|
|
157
|
-
|
|
158
|
-
# Pre-commit Hook 整合
|
|
159
|
-
# .git/hooks/pre-commit
|
|
160
|
-
#!/bin/bash
|
|
161
|
-
node .failure/tools/check_bom.js dev/pipeline --recursive || exit 1
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
#### 3. 任務失敗後(經驗記錄)
|
|
165
|
-
|
|
166
|
-
**必須執行**:記錄新失敗經驗
|
|
167
|
-
|
|
168
|
-
```powershell
|
|
169
|
-
# 方法 1:互動式模式(推薦新手)
|
|
170
|
-
.\.failure\tools\log_failure.ps1 -Interactive
|
|
171
|
-
|
|
172
|
-
# 方法 2:參數化模式(熟悉系統後使用)
|
|
173
|
-
.\.failure\tools\log_failure.ps1 `
|
|
174
|
-
-Category "pipeline" `
|
|
175
|
-
-Title "任務佇列損壞問題" `
|
|
176
|
-
-Severity "high" `
|
|
177
|
-
-TaskID "TASK_XXX"
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**自動化行為**:
|
|
181
|
-
1. 生成新的 `FAIL-XXX` ID(基於 `INDEX.yaml` 中的最大 ID)
|
|
182
|
-
2. 在對應分類目錄下建立失敗記錄文件(YAML 格式)
|
|
183
|
-
3. 自動更新 `INDEX.yaml` 的:
|
|
184
|
-
- `load_order` 列表
|
|
185
|
-
- `statistics.total_failures`
|
|
186
|
-
- `statistics.by_category`
|
|
187
|
-
- `statistics.by_severity`
|
|
188
|
-
- `last_updated` 時間戳
|
|
189
|
-
|
|
190
|
-
**驗證結果**:
|
|
191
|
-
```powershell
|
|
192
|
-
# 檢查新建立的失敗記錄
|
|
193
|
-
Get-ChildItem .failure/*/FAIL-*.yaml | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
194
|
-
|
|
195
|
-
# 驗證 INDEX.yaml 更新
|
|
196
|
-
Get-Content .failure/INDEX.yaml | Select-String "FAIL-"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## 工具詳解
|
|
202
|
-
|
|
203
|
-
### 1. check_failures.ps1(檢查失敗模式)
|
|
204
|
-
|
|
205
|
-
**用途**:任務開始前檢查相關失敗模式,執行預防措施
|
|
206
|
-
|
|
207
|
-
**功能**:
|
|
208
|
-
- 根據任務 ID 自動載入 `TASK_QUEUE.json` 詳情
|
|
209
|
-
- 根據 `agent_type` 匹配相關失敗記錄
|
|
210
|
-
- 根據 `scope_paths` 匹配相關失敗記錄
|
|
211
|
-
- 支援關鍵詞模糊搜尋
|
|
212
|
-
- 輸出預防檢查清單和解決方案參考
|
|
213
|
-
- 按嚴重程度排序顯示結果
|
|
214
|
-
|
|
215
|
-
**使用範例**:
|
|
216
|
-
```powershell
|
|
217
|
-
# 查看幫助
|
|
218
|
-
.\.failure\tools\check_failures.ps1 -Help
|
|
219
|
-
|
|
220
|
-
# 根據任務 ID 檢查
|
|
221
|
-
.\.failure\tools\check_failures.ps1 -TaskID "TASK_077"
|
|
222
|
-
|
|
223
|
-
# 根據 Agent 類型檢查
|
|
224
|
-
.\.failure\tools\check_failures.ps1 -AgentType "developer"
|
|
225
|
-
|
|
226
|
-
# 根據路徑檢查
|
|
227
|
-
.\.failure\tools\check_failures.ps1 -ScopePath "dev/pipeline/"
|
|
228
|
-
|
|
229
|
-
# 關鍵詞搜尋
|
|
230
|
-
.\.failure\tools\check_failures.ps1 -Keywords "JSON,BOM"
|
|
231
|
-
|
|
232
|
-
# 組合過濾
|
|
233
|
-
.\.failure\tools\check_failures.ps1 `
|
|
234
|
-
-Category "pipeline" `
|
|
235
|
-
-Severity "high" `
|
|
236
|
-
-AgentType "developer"
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
### 2. log_failure.ps1(記錄失敗經驗)
|
|
242
|
-
|
|
243
|
-
**用途**:任務失敗後記錄失敗經驗,自動更新索引
|
|
244
|
-
|
|
245
|
-
**功能**:
|
|
246
|
-
- 自動生成 `FAIL-XXX` ID(根據 `INDEX.yaml` 中的最大 ID)
|
|
247
|
-
- 根據分類選擇正確的目錄
|
|
248
|
-
- 使用標準模板建立 YAML 文件
|
|
249
|
-
- 自動更新 `INDEX.yaml` 的 `load_order` 和統計數據
|
|
250
|
-
- 支援互動式和參數化兩種模式
|
|
251
|
-
|
|
252
|
-
**使用範例**:
|
|
253
|
-
```powershell
|
|
254
|
-
# 查看幫助
|
|
255
|
-
.\.failure\tools\log_failure.ps1 -Help
|
|
256
|
-
|
|
257
|
-
# 互動式模式(推薦)
|
|
258
|
-
.\.failure\tools\log_failure.ps1
|
|
259
|
-
|
|
260
|
-
# 參數化模式
|
|
261
|
-
.\.failure\tools\log_failure.ps1 `
|
|
262
|
-
-Category "pipeline" `
|
|
263
|
-
-Title "任務佇列損壞問題" `
|
|
264
|
-
-Severity "high" `
|
|
265
|
-
-TaskID "TASK_088"
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
**互動式流程**:
|
|
269
|
-
1. 選擇失敗分類(agent_execution, code_quality, architecture, pipeline, data_integrity)
|
|
270
|
-
2. 輸入失敗標題
|
|
271
|
-
3. 選擇嚴重程度(critical, high, medium, low)
|
|
272
|
-
4. 輸入相關任務 ID(可選)
|
|
273
|
-
|
|
274
|
-
**輸出結果**:
|
|
275
|
-
```
|
|
276
|
-
✅ 成功建立失敗記錄: FAIL-007
|
|
277
|
-
檔案位置: .failure/pipeline/FAIL-007-task-queue-corruption.yaml
|
|
278
|
-
已更新 INDEX.yaml
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
### 3. validate_json.js(驗證 JSON 文件)
|
|
284
|
-
|
|
285
|
-
**用途**:驗證 JSON 文件完整性,檢測 BOM
|
|
286
|
-
|
|
287
|
-
**功能**:
|
|
288
|
-
- 驗證 JSON 語法正確性
|
|
289
|
-
- 檢測 BOM (Byte Order Mark)
|
|
290
|
-
- 提供錯誤診斷提示
|
|
291
|
-
|
|
292
|
-
**使用範例**:
|
|
293
|
-
```bash
|
|
294
|
-
# 驗證單個文件
|
|
295
|
-
node .failure/tools/validate_json.js dev/pipeline/TASK_QUEUE.json
|
|
296
|
-
|
|
297
|
-
# 驗證多個文件
|
|
298
|
-
node .failure/tools/validate_json.js *.json
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
**輸出結果**:
|
|
302
|
-
```
|
|
303
|
-
✅ dev/pipeline/TASK_QUEUE.json - Valid JSON (no BOM)
|
|
304
|
-
❌ dev/pipeline/CONFIG.json - Invalid JSON: Unexpected token } in JSON at position 123
|
|
305
|
-
⚠️ dev/pipeline/STATE.json - Valid JSON (BOM detected - use remove_bom.js to fix)
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
---
|
|
309
|
-
|
|
310
|
-
### 4. fix_json.js(一鍵修復 JSON)
|
|
311
|
-
|
|
312
|
-
**用途**:一鍵修復 JSON 文件(移除 BOM + 驗證 + 重新格式化)
|
|
313
|
-
|
|
314
|
-
**功能**:
|
|
315
|
-
- 自動移除 BOM
|
|
316
|
-
- 驗證 JSON 語法
|
|
317
|
-
- 重新格式化(統一縮排 2 空格)
|
|
318
|
-
- 寫回無 BOM 的 UTF-8 文件
|
|
319
|
-
|
|
320
|
-
**使用範例**:
|
|
321
|
-
```bash
|
|
322
|
-
# 修復單個文件
|
|
323
|
-
node .failure/tools/fix_json.js dev/pipeline/TASK_QUEUE.json
|
|
324
|
-
|
|
325
|
-
# 修復多個文件
|
|
326
|
-
node .failure/tools/fix_json.js dev/pipeline/*.json
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
**輸出結果**:
|
|
330
|
-
```
|
|
331
|
-
✅ dev/pipeline/TASK_QUEUE.json - Fixed (removed BOM, reformatted)
|
|
332
|
-
⚠️ dev/pipeline/CONFIG.json - Already valid (no changes needed)
|
|
333
|
-
❌ dev/pipeline/STATE.json - Invalid JSON: Unexpected token }
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
### 5. remove_bom.js(移除 BOM)
|
|
339
|
-
|
|
340
|
-
**用途**:移除 UTF-8 文件開頭的 BOM (Byte Order Mark)
|
|
341
|
-
|
|
342
|
-
**功能**:
|
|
343
|
-
- 檢測並移除 BOM (0xFEFF)
|
|
344
|
-
- 不修改其他內容
|
|
345
|
-
- 無 BOM 時不做任何操作
|
|
346
|
-
|
|
347
|
-
**使用範例**:
|
|
348
|
-
```bash
|
|
349
|
-
# 移除單個文件的 BOM
|
|
350
|
-
node .failure/tools/remove_bom.js dev/pipeline/TASK_QUEUE.json
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
**輸出結果**:
|
|
354
|
-
```
|
|
355
|
-
✅ dev/pipeline/TASK_QUEUE.json - BOM removed
|
|
356
|
-
⚠️ dev/pipeline/CONFIG.json - No BOM found
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
---
|
|
360
|
-
|
|
361
|
-
### 6. check_bom.js(批量檢查 BOM)
|
|
362
|
-
|
|
363
|
-
**用途**:批量檢查 JSON 文件是否有 BOM(用於 CI/CD 或 pre-commit hook)
|
|
364
|
-
|
|
365
|
-
**功能**:
|
|
366
|
-
- 批量檢查 JSON 文件
|
|
367
|
-
- 遞迴掃描目錄(使用 `--recursive`)
|
|
368
|
-
- 列出所有有 BOM 的文件
|
|
369
|
-
- 退出碼:0(無 BOM)或 1(檢測到 BOM)
|
|
370
|
-
|
|
371
|
-
**使用範例**:
|
|
372
|
-
```bash
|
|
373
|
-
# 檢查單個文件
|
|
374
|
-
node .failure/tools/check_bom.js dev/pipeline/TASK_QUEUE.json
|
|
375
|
-
|
|
376
|
-
# 遞迴檢查目錄中所有 JSON 文件
|
|
377
|
-
node .failure/tools/check_bom.js dev/pipeline --recursive
|
|
378
|
-
|
|
379
|
-
# Pre-commit Hook 整合
|
|
380
|
-
# .git/hooks/pre-commit
|
|
381
|
-
#!/bin/bash
|
|
382
|
-
node .failure/tools/check_bom.js dev/pipeline --recursive || exit 1
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
**輸出結果**:
|
|
386
|
-
```
|
|
387
|
-
Checking JSON files for BOM...
|
|
388
|
-
|
|
389
|
-
Found 2 files with BOM:
|
|
390
|
-
- dev/pipeline/TASK_QUEUE.json
|
|
391
|
-
- dev/pipeline/STATE.json
|
|
392
|
-
|
|
393
|
-
Recommendation: Run fix_json.js to remove BOM and reformat
|
|
394
|
-
|
|
395
|
-
Exit code: 1
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
---
|
|
399
|
-
|
|
400
|
-
## 失敗記錄範例
|
|
401
|
-
|
|
402
|
-
### FAIL-001: Agent 執行無輸出
|
|
403
|
-
|
|
404
|
-
**分類**:agent-execution
|
|
405
|
-
**嚴重程度**:Critical 🔴
|
|
406
|
-
**檔案**:`.failure/agent-execution/FAIL-001-agent-no-output.yaml`
|
|
407
|
-
|
|
408
|
-
**問題**:Agent 執行後沒有實際輸出,導致任務失敗
|
|
409
|
-
**根因**:Agent 未正確理解任務需求或工作流程
|
|
410
|
-
**解決方案**:
|
|
411
|
-
- 明確任務步驟(使用 `requirements` 和 `acceptance_criteria`)
|
|
412
|
-
- 檢查 Skill 定義(確保 Agent 理解角色和職責)
|
|
413
|
-
- 確保輸出驗證(檢查 Git commit、文件修改)
|
|
414
|
-
|
|
415
|
-
**預防措施**:
|
|
416
|
-
- [ ] 確保任務描述清晰具體
|
|
417
|
-
- [ ] 提供可驗證的驗收標準
|
|
418
|
-
- [ ] 檢查 Agent 的 Skill 定義
|
|
419
|
-
|
|
420
|
-
**相關規則**:PPL-112(驗收標準驗證)
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
### FAIL-002: JSON BOM 編碼問題
|
|
425
|
-
|
|
426
|
-
**分類**:data-integrity
|
|
427
|
-
**嚴重程度**:High 🟠
|
|
428
|
-
**檔案**:`.failure/data-integrity/FAIL-002-json-bom.yaml`
|
|
429
|
-
|
|
430
|
-
**問題**:Windows 產生的 JSON 文件帶有 BOM,導致 JSON 解析失敗
|
|
431
|
-
**根因**:Windows 編輯器預設使用 UTF-8 with BOM
|
|
432
|
-
**解決方案**:
|
|
433
|
-
- 使用 `fix_json.js` 一鍵修復(移除 BOM + 驗證 + 格式化)
|
|
434
|
-
- 或使用 `remove_bom.js` 移除 BOM
|
|
435
|
-
|
|
436
|
-
**預防措施**:
|
|
437
|
-
- [ ] 修改 JSON 文件後立即驗證(使用 `validate_json.js`)
|
|
438
|
-
- [ ] 設置編輯器預設為 UTF-8 without BOM
|
|
439
|
-
- [ ] 在 CI/CD 中整合 `check_bom.js`
|
|
440
|
-
|
|
441
|
-
**相關規則**:DATA-001(數據完整性驗證)
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
### FAIL-003: TASK_QUEUE 污染問題
|
|
446
|
-
|
|
447
|
-
**分類**:pipeline
|
|
448
|
-
**嚴重程度**:High 🟠
|
|
449
|
-
**檔案**:`.failure/pipeline/FAIL-003-queue-pollution.yaml`
|
|
450
|
-
|
|
451
|
-
**問題**:已完成任務被移到 `.memory/` 後,Multi-Agent Scheduler 又把它們加回 `TASK_QUEUE.json` 並標記為 completed
|
|
452
|
-
**根因**:Scheduler 從 `completed/` 資料夾同步任務時,會把所有歷史任務重新加入 queue
|
|
453
|
-
**解決方案**:清理時必須同時清理 `TASK_QUEUE.json` 中的 completed 任務
|
|
454
|
-
|
|
455
|
-
**預防措施**:
|
|
456
|
-
- [ ] 封存任務時同時清理 TASK_QUEUE.json
|
|
457
|
-
- [ ] 驗證 completed/ 目錄為空
|
|
458
|
-
- [ ] 執行排程器前檢查佇列狀態
|
|
459
|
-
|
|
460
|
-
**相關規則**:PPL-002(已完成任務必須封存到 .memory/)
|
|
461
|
-
**狀態**:已提升為規則(.rule/pipeline/task-execution.yaml)
|
|
462
|
-
|
|
463
|
-
---
|
|
464
|
-
|
|
465
|
-
## 與其他系統的關係
|
|
466
|
-
|
|
467
|
-
### 優先級順序
|
|
468
|
-
|
|
469
|
-
```
|
|
470
|
-
1. .rule/ (最高優先級 - 必須遵守的規則)
|
|
471
|
-
2. .failure/ (失敗經驗 - 應避免的模式)
|
|
472
|
-
3. .memory/ (經驗記錄 - 一般性筆記)
|
|
473
|
-
4. CLAUDE.md (專案指導)
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
### 升級機制
|
|
477
|
-
|
|
478
|
-
當失敗模式**重複發生(>2 次)**時,應將其提升為 `.rule/` 規則,成為強制約束。
|
|
479
|
-
|
|
480
|
-
**範例**:
|
|
481
|
-
```yaml
|
|
482
|
-
失敗: "FAIL-003: TASK_QUEUE 被 completed 任務污染"
|
|
483
|
-
↓ 重複發生 2 次
|
|
484
|
-
規則: "PPL-002: 已完成任務必須封存到 .memory/"
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
**提升標準**:
|
|
488
|
-
- **Critical 失敗**:發生 1 次即提升
|
|
489
|
-
- **High 失敗**:發生 2 次提升
|
|
490
|
-
- **Medium 失敗**:發生 3 次提升
|
|
491
|
-
- **Low 失敗**:視情況決定
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
## 執行環境要求
|
|
496
|
-
|
|
497
|
-
### PowerShell 腳本執行
|
|
498
|
-
|
|
499
|
-
由於腳本包含中文字符,需要確保 PowerShell 正確支援 UTF-8 編碼。
|
|
500
|
-
|
|
501
|
-
**推薦執行方式**(Windows PowerShell 或 PowerShell 7+):
|
|
502
|
-
|
|
503
|
-
```powershell
|
|
504
|
-
# 方法 1:直接在 Windows PowerShell 中執行
|
|
505
|
-
cd D:\repo\side\ava\KenazAI
|
|
506
|
-
.\.failure\tools\log_failure.ps1 -Help
|
|
507
|
-
|
|
508
|
-
# 方法 2:使用 PowerShell 7+(推薦)
|
|
509
|
-
pwsh -File ".failure/tools/log_failure.ps1" -Help
|
|
510
|
-
|
|
511
|
-
# 方法 3:設置編碼(Windows PowerShell 5.1)
|
|
512
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
513
|
-
chcp 65001 # 切換到 UTF-8 代碼頁
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
### 執行策略限制
|
|
517
|
-
|
|
518
|
-
```powershell
|
|
519
|
-
# 方法 1:暫時繞過執行策略
|
|
520
|
-
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
521
|
-
|
|
522
|
-
# 方法 2:使用參數執行
|
|
523
|
-
powershell -ExecutionPolicy Bypass -File ".failure/tools/log_failure.ps1" -Help
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
## 常見問題
|
|
529
|
-
|
|
530
|
-
### Q1: 執行腳本時顯示「無法辨識字元」或亂碼
|
|
531
|
-
|
|
532
|
-
**原因**:PowerShell 預設編碼不是 UTF-8,無法正確解析中文字符。
|
|
533
|
-
|
|
534
|
-
**解決方案**:
|
|
535
|
-
```powershell
|
|
536
|
-
# 使用 PowerShell 7+(推薦)
|
|
537
|
-
pwsh -File ".failure/tools/log_failure.ps1" -Help
|
|
538
|
-
|
|
539
|
-
# 或在 Windows PowerShell 5.1 中設置編碼
|
|
540
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
541
|
-
chcp 65001 # 切換到 UTF-8 代碼頁
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
---
|
|
545
|
-
|
|
546
|
-
### Q2: 執行策略阻止腳本運行
|
|
547
|
-
|
|
548
|
-
**錯誤訊息**:「因為在此系統上禁止執行指令碼」
|
|
549
|
-
|
|
550
|
-
**解決方案**:
|
|
551
|
-
```powershell
|
|
552
|
-
# 方法 1:暫時繞過執行策略
|
|
553
|
-
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
554
|
-
|
|
555
|
-
# 方法 2:使用參數執行
|
|
556
|
-
powershell -ExecutionPolicy Bypass -File ".failure/tools/log_failure.ps1" -Help
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
### Q3: 無法找到 TASK_QUEUE.json
|
|
562
|
-
|
|
563
|
-
**原因**:`check_failures.ps1` 依賴 `dev/pipeline/TASK_QUEUE.json`。
|
|
564
|
-
|
|
565
|
-
**解決方案**:
|
|
566
|
-
```powershell
|
|
567
|
-
# 確認工作目錄在專案根目錄
|
|
568
|
-
cd D:\repo\side\ava\KenazAI
|
|
569
|
-
|
|
570
|
-
# 或使用其他參數而非 -TaskID
|
|
571
|
-
.\.failure\tools\check_failures.ps1 -Keywords "JSON"
|
|
572
|
-
```
|
|
573
|
-
|
|
574
|
-
---
|
|
575
|
-
|
|
576
|
-
### Q4: INDEX.yaml 解析失敗
|
|
577
|
-
|
|
578
|
-
**原因**:YAML 格式錯誤或 BOM 問題。
|
|
579
|
-
|
|
580
|
-
**解決方案**:
|
|
581
|
-
```bash
|
|
582
|
-
# 檢查 BOM
|
|
583
|
-
node .failure/tools/check_bom.js .failure/INDEX.yaml
|
|
584
|
-
|
|
585
|
-
# 修復 BOM(注意:INDEX.yaml 不是 JSON,僅移除 BOM)
|
|
586
|
-
node .failure/tools/remove_bom.js .failure/INDEX.yaml
|
|
587
|
-
|
|
588
|
-
# 驗證 YAML 語法(需要安裝 yq)
|
|
589
|
-
yq eval .failure/INDEX.yaml
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
---
|
|
593
|
-
|
|
594
|
-
## 工作流程整合
|
|
595
|
-
|
|
596
|
-
### Agent 執行前(預防檢查)
|
|
597
|
-
|
|
598
|
-
```powershell
|
|
599
|
-
# 檢查相關失敗模式
|
|
600
|
-
$taskID = "TASK_081"
|
|
601
|
-
.\.failure\tools\check_failures.ps1 -TaskID $taskID
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
### Agent 執行中(數據驗證)
|
|
605
|
-
|
|
606
|
-
```bash
|
|
607
|
-
# 修改 JSON 文件後立即驗證
|
|
608
|
-
node .failure/tools/validate_json.js dev/pipeline/TASK_QUEUE.json
|
|
609
|
-
|
|
610
|
-
# 一鍵修復
|
|
611
|
-
node .failure/tools/fix_json.js dev/pipeline/TASK_QUEUE.json
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
### Agent 執行失敗後(經驗記錄)
|
|
615
|
-
|
|
616
|
-
```powershell
|
|
617
|
-
# 建立失敗記錄
|
|
618
|
-
.\.failure\tools\log_failure.ps1 -Interactive
|
|
619
|
-
```
|
|
620
|
-
|
|
621
|
-
### 定期維護(每週)
|
|
622
|
-
|
|
623
|
-
```powershell
|
|
624
|
-
# 檢視所有失敗記錄
|
|
625
|
-
Get-ChildItem .failure/*/FAIL-*.yaml | ForEach-Object {
|
|
626
|
-
Write-Host $_.Name -ForegroundColor Cyan
|
|
627
|
-
Select-String -Path $_.FullName -Pattern "^# \[" | Select-Object -First 1
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
# 統計失敗記錄數量
|
|
631
|
-
$stats = @{
|
|
632
|
-
Total = (Get-ChildItem .failure/*/FAIL-*.yaml).Count
|
|
633
|
-
AgentExecution = (Get-ChildItem .failure/agent-execution/*.yaml).Count
|
|
634
|
-
CodeQuality = (Get-ChildItem .failure/code-quality/*.yaml).Count
|
|
635
|
-
Architecture = (Get-ChildItem .failure/architecture/*.yaml).Count
|
|
636
|
-
Pipeline = (Get-ChildItem .failure/pipeline/*.yaml).Count
|
|
637
|
-
DataIntegrity = (Get-ChildItem .failure/data-integrity/*.yaml).Count
|
|
638
|
-
}
|
|
639
|
-
$stats | Format-Table -AutoSize
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
## 下一步計劃
|
|
645
|
-
|
|
646
|
-
以下工具尚未實作(標記為「計劃中」):
|
|
647
|
-
|
|
648
|
-
### 1. failure-report.ps1(生成失敗經驗報告)
|
|
649
|
-
|
|
650
|
-
**功能**:
|
|
651
|
-
- 統計失敗記錄數量
|
|
652
|
-
- 按分類和嚴重程度分組
|
|
653
|
-
- 列出已轉化為規則的失敗
|
|
654
|
-
- 生成 Markdown 報告
|
|
655
|
-
|
|
656
|
-
**使用範例**:
|
|
657
|
-
```powershell
|
|
658
|
-
# 生成完整報告
|
|
659
|
-
.\.failure\tools\failure-report.ps1
|
|
660
|
-
|
|
661
|
-
# 只生成特定分類的報告
|
|
662
|
-
.\.failure\tools\failure-report.ps1 -Category "pipeline"
|
|
663
|
-
|
|
664
|
-
# 輸出為 Markdown 格式
|
|
665
|
-
.\.failure\tools\failure-report.ps1 -Format "markdown" -Output "failure-report.md"
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
---
|
|
669
|
-
|
|
670
|
-
### 2. failure-to-rule.ps1(將失敗轉化為規則)
|
|
671
|
-
|
|
672
|
-
**功能**:
|
|
673
|
-
- 分析失敗記錄,建議哪些應該轉化為規則
|
|
674
|
-
- 自動生成規則文件草稿
|
|
675
|
-
- 更新失敗記錄的 `converted_to_rules` 狀態
|
|
676
|
-
- 更新 `INDEX.yaml` 統計數據
|
|
677
|
-
|
|
678
|
-
**使用範例**:
|
|
679
|
-
```powershell
|
|
680
|
-
# 檢查哪些失敗應該轉化為規則
|
|
681
|
-
.\.failure\tools\failure-to-rule.ps1 -Analyze
|
|
682
|
-
|
|
683
|
-
# 將特定失敗轉化為規則
|
|
684
|
-
.\.failure\tools\failure-to-rule.ps1 -FailureID "FAIL-003" -RuleID "PPL-002"
|
|
685
|
-
```
|
|
686
|
-
|
|
687
|
-
---
|
|
688
|
-
|
|
689
|
-
## 相關資源
|
|
690
|
-
|
|
691
|
-
| 文檔 | 路徑 |
|
|
692
|
-
|------|------|
|
|
693
|
-
| **失敗記錄索引** | `.failure/INDEX.yaml` |
|
|
694
|
-
| **工具使用說明** | `.failure/tools/README.md` |
|
|
695
|
-
| **詳細使用指南** | `.failure/tools/USAGE_GUIDE.md` |
|
|
696
|
-
| **規則系統** | `.rule/INDEX.yaml` |
|
|
697
|
-
| **Agent 工作流程** | `.rule/general/agent-workflow.yaml` |
|
|
698
|
-
| **記憶系統** | `.memory/MEMORY.md` |
|
|
699
|
-
| **CLAUDE.md 失敗學習章節** | `CLAUDE.md#失敗學習系統` |
|
|
700
|
-
|
|
701
|
-
---
|
|
702
|
-
|
|
703
|
-
## 統計數據(截至 2026-02-17)
|
|
704
|
-
|
|
705
|
-
```yaml
|
|
706
|
-
total_failures: 6
|
|
707
|
-
by_category:
|
|
708
|
-
agent_execution: 3 # FAIL-001, FAIL-004, FAIL-005
|
|
709
|
-
data_integrity: 1 # FAIL-002
|
|
710
|
-
pipeline: 1 # FAIL-003
|
|
711
|
-
architecture: 1 # FAIL-006
|
|
712
|
-
by_severity:
|
|
713
|
-
critical: 2 # FAIL-001, FAIL-005
|
|
714
|
-
high: 4 # FAIL-002, FAIL-003, FAIL-004, FAIL-006
|
|
715
|
-
medium: 0
|
|
716
|
-
low: 0
|
|
717
|
-
resolved: 5 # 已解決的失敗(有解決方案)
|
|
718
|
-
converted_to_rules: 2 # 已提升為規則(PPL-002, AGT-005)
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
---
|
|
722
|
-
|
|
723
|
-
*建立日期: 2026-02-19 | 更新: 2026-02-19*
|