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,446 +0,0 @@
|
|
|
1
|
-
# .rule/general/cortex-memory-recall.yaml
|
|
2
|
-
# Cortex 記憶回想規則 - Agent 何時使用 RAG 語義搜尋 vs 傳統搜尋
|
|
3
|
-
# 優先級:此規則凌駕於 CLAUDE.md 和 .claude/skills/ 中的定義
|
|
4
|
-
|
|
5
|
-
_meta:
|
|
6
|
-
category: "general"
|
|
7
|
-
priority: 1
|
|
8
|
-
applies_to:
|
|
9
|
-
- "ai_agent"
|
|
10
|
-
last_updated: "2026-02-13"
|
|
11
|
-
created_by: "基於 11 場景對比測試(RAG vs Grep/Glob/Symbols)的實證數據"
|
|
12
|
-
|
|
13
|
-
rules:
|
|
14
|
-
# =============================================================================
|
|
15
|
-
# CTX-001: Cortex 記憶回想觸發條件
|
|
16
|
-
# =============================================================================
|
|
17
|
-
- id: "CTX-001"
|
|
18
|
-
title: "Cortex 記憶回想觸發條件"
|
|
19
|
-
description: |
|
|
20
|
-
定義 Agent 何時應使用 Cortex RAG 語義搜尋(cortex_search)進行記憶回想。
|
|
21
|
-
Cortex 適合「理解性」查詢,不適合「精確性」查詢。
|
|
22
|
-
severity: "must"
|
|
23
|
-
rationale: "基於實測數據,RAG 在語義理解場景顯著優於傳統搜尋"
|
|
24
|
-
|
|
25
|
-
# 必須使用 Cortex RAG 的場景
|
|
26
|
-
must_use_cortex:
|
|
27
|
-
- trigger: "任務開始前的上下文建立"
|
|
28
|
-
tool: "cortex_context 或 cortex_overview"
|
|
29
|
-
description: |
|
|
30
|
-
開始新任務時,先用 cortex_context 獲取專案結構,
|
|
31
|
-
再用 cortex_search 搜尋任務相關的代碼片段。
|
|
32
|
-
example:
|
|
33
|
-
query: "用戶認證 API 設計"
|
|
34
|
-
purpose: "找到現有的認證相關代碼和設計決策"
|
|
35
|
-
|
|
36
|
-
- trigger: "歷史決策回溯(為什麼)"
|
|
37
|
-
tool: "cortex_search"
|
|
38
|
-
description: |
|
|
39
|
-
當需要理解「為什麼這樣設計」「之前做過什麼決定」時,
|
|
40
|
-
RAG 能從 .memory/, .kenaz/, CLAUDE.md 中找到設計理由。
|
|
41
|
-
example:
|
|
42
|
-
query: "為什麼選擇 Leader + Worker 團隊模式"
|
|
43
|
-
expected_score: ">= 0.65"
|
|
44
|
-
|
|
45
|
-
- trigger: "跨模組架構理解"
|
|
46
|
-
tool: "cortex_search"
|
|
47
|
-
description: |
|
|
48
|
-
當任務涉及多個模組的交互關係時,RAG 能跨文件找到
|
|
49
|
-
interface 定義、規則、實現代碼之間的關聯。
|
|
50
|
-
example:
|
|
51
|
-
query: "task queue dependency resolver parallel execution"
|
|
52
|
-
expected_score: ">= 0.60"
|
|
53
|
-
|
|
54
|
-
- trigger: "概念/語義搜尋(特別是中文)"
|
|
55
|
-
tool: "cortex_search"
|
|
56
|
-
description: |
|
|
57
|
-
當查詢是自然語言描述而非精確關鍵字時,RAG 的語義理解
|
|
58
|
-
能找到概念相關但用詞不同的文件。
|
|
59
|
-
example:
|
|
60
|
-
query: "失敗經驗學習機制 如何從錯誤中學習"
|
|
61
|
-
expected_score: ">= 0.65"
|
|
62
|
-
|
|
63
|
-
- trigger: "探索不熟悉的功能區域"
|
|
64
|
-
tool: "cortex_search + cortex_symbols"
|
|
65
|
-
description: |
|
|
66
|
-
當 Agent 對某個功能區域不熟悉時,先用 cortex_search
|
|
67
|
-
找到相關代碼片段,再用 cortex_symbols 定位具體函數。
|
|
68
|
-
example:
|
|
69
|
-
query: "團隊成員之間的通信機制"
|
|
70
|
-
|
|
71
|
-
- trigger: "失敗模式檢索(AGT-005 增強)"
|
|
72
|
-
tool: "cortex_search"
|
|
73
|
-
description: |
|
|
74
|
-
當任務失敗需要查閱失敗經驗時,除了讀取 .failure/INDEX.yaml,
|
|
75
|
-
也可用 cortex_search 搜尋語義相關的失敗記錄。
|
|
76
|
-
example:
|
|
77
|
-
query: "JSON 解析失敗 BOM 編碼問題"
|
|
78
|
-
|
|
79
|
-
- trigger: "代碼關聯與依賴分析"
|
|
80
|
-
tool: "cortex_search"
|
|
81
|
-
description: |
|
|
82
|
-
當需要理解某個組件/模組的依賴關係、調用者、相關文件時,
|
|
83
|
-
RAG 能一次返回源碼、調用者、型別定義等跨文件關聯。
|
|
84
|
-
比 Grep 多次查詢再拼湊高效得多。
|
|
85
|
-
example:
|
|
86
|
-
query: "TerminalPanel 依賴哪些 hooks 和 context"
|
|
87
|
-
|
|
88
|
-
- trigger: "尋找設計模式/最佳實踐"
|
|
89
|
-
tool: "cortex_search"
|
|
90
|
-
description: |
|
|
91
|
-
當需要找到專案中的複用規則、設計模式、最佳實踐文件時,
|
|
92
|
-
RAG 能從 .rule/、.agents/skills/、.kenaz/ 中找到相關規範。
|
|
93
|
-
Grep 只能匹配字面量,無法理解「複用模式」等概念。
|
|
94
|
-
example:
|
|
95
|
-
query: "可複用的 React hook 自定義 hooks pattern"
|
|
96
|
-
|
|
97
|
-
# 禁止使用 Cortex RAG 的場景
|
|
98
|
-
must_not_use_cortex:
|
|
99
|
-
- trigger: "精確字串/正則搜尋"
|
|
100
|
-
use_instead: "Grep"
|
|
101
|
-
description: |
|
|
102
|
-
當查詢是精確字串、配置值、正則表達式時,
|
|
103
|
-
RAG 的語義搜尋會返回無關結果(測試得分 0.44)。
|
|
104
|
-
examples:
|
|
105
|
-
- "hnsw:space.*cosine"
|
|
106
|
-
- "embedding_model.*bge-m3"
|
|
107
|
-
- "import.*SentenceTransformer"
|
|
108
|
-
- "TODO|FIXME|HACK"
|
|
109
|
-
|
|
110
|
-
- trigger: "文件名/路徑查找"
|
|
111
|
-
use_instead: "Glob"
|
|
112
|
-
description: |
|
|
113
|
-
當需要找到特定文件或匹配文件模式時,
|
|
114
|
-
Glob 精確且即時,RAG 會返回構建產物噪音。
|
|
115
|
-
examples:
|
|
116
|
-
- "**/*.test.ts"
|
|
117
|
-
- "**/TerminalPanel*"
|
|
118
|
-
- "src/components/**/*.tsx"
|
|
119
|
-
|
|
120
|
-
- trigger: "精確符號定位(函數、類名)"
|
|
121
|
-
use_instead: "cortex_symbols"
|
|
122
|
-
description: |
|
|
123
|
-
當已知函數名/類名,需要找到定義位置時,
|
|
124
|
-
cortex_symbols 返回精確的 file:line 和簽名。
|
|
125
|
-
examples:
|
|
126
|
-
- "run_ctags → ctags_runner.py:84"
|
|
127
|
-
- "GitSyncManager → git_sync.py:76"
|
|
128
|
-
- "useMediaQuery → use-media-query.ts:10"
|
|
129
|
-
|
|
130
|
-
- trigger: "已知文件路徑,需要讀取內容"
|
|
131
|
-
use_instead: "Read"
|
|
132
|
-
description: |
|
|
133
|
-
如果已經知道要讀取哪個文件,直接 Read。
|
|
134
|
-
不要先搜尋再讀取。
|
|
135
|
-
|
|
136
|
-
- trigger: "統計/計數查詢"
|
|
137
|
-
use_instead: "Grep (count mode)"
|
|
138
|
-
description: |
|
|
139
|
-
統計某個模式出現的次數(如 useState 使用次數),
|
|
140
|
-
Grep count 模式更準確。
|
|
141
|
-
|
|
142
|
-
- trigger: "枚舉型查詢(列出所有 X)"
|
|
143
|
-
use_instead: "Grep (pattern mode)"
|
|
144
|
-
description: |
|
|
145
|
-
當需要列出所有自定義 hooks、所有 API endpoints、所有 interface 時,
|
|
146
|
-
Grep 精確模式匹配更適合枚舉。RAG 語義搜尋會混入噪音。
|
|
147
|
-
examples:
|
|
148
|
-
- "export function use[A-Z] → 列出所有自定義 hooks"
|
|
149
|
-
- "app.get\\(|app.post\\( → 列出所有 API routes"
|
|
150
|
-
- "export interface → 列出所有 interface"
|
|
151
|
-
|
|
152
|
-
# =============================================================================
|
|
153
|
-
# CTX-002: 搜尋工具選擇決策樹
|
|
154
|
-
# =============================================================================
|
|
155
|
-
- id: "CTX-002"
|
|
156
|
-
title: "搜尋工具選擇決策樹"
|
|
157
|
-
description: |
|
|
158
|
-
Agent 遇到搜尋需求時,按此決策樹選擇最佳工具。
|
|
159
|
-
遵循「精確優先,語義補充」原則。
|
|
160
|
-
severity: "should"
|
|
161
|
-
rationale: "避免用錯工具浪費 token 和時間"
|
|
162
|
-
|
|
163
|
-
decision_tree: |
|
|
164
|
-
查詢需求
|
|
165
|
-
│
|
|
166
|
-
├── 知道精確文件路徑?
|
|
167
|
-
│ └── YES → Read(直接讀取)
|
|
168
|
-
│
|
|
169
|
-
├── 知道文件名/模式?
|
|
170
|
-
│ └── YES → Glob(文件發現)
|
|
171
|
-
│
|
|
172
|
-
├── 知道精確字串/正則?
|
|
173
|
-
│ └── YES → Grep(精確匹配)
|
|
174
|
-
│
|
|
175
|
-
├── 知道函數名/類名?
|
|
176
|
-
│ └── YES → cortex_symbols(符號定位)
|
|
177
|
-
│
|
|
178
|
-
├── 需要理解「為什麼」或「怎麼運作」?
|
|
179
|
-
│ └── YES → cortex_search(語義搜尋)
|
|
180
|
-
│
|
|
181
|
-
├── 需要跨模組/跨文件的關聯理解?
|
|
182
|
-
│ └── YES → cortex_search(語義搜尋)
|
|
183
|
-
│
|
|
184
|
-
├── 需要專案整體結構?
|
|
185
|
-
│ └── YES → cortex_context / cortex_overview
|
|
186
|
-
│
|
|
187
|
-
└── 其他
|
|
188
|
-
└── 先 Grep,結果太多或不精確 → cortex_search
|
|
189
|
-
|
|
190
|
-
# ==========================================================================
|
|
191
|
-
# content_type 過濾器(語法糖,大幅提升搜尋精度)
|
|
192
|
-
# ==========================================================================
|
|
193
|
-
content_type_filter:
|
|
194
|
-
description: |
|
|
195
|
-
cortex_search 支援 content_type 參數,自動轉換為 file_path 前綴過濾。
|
|
196
|
-
善用此參數可大幅減少噪音、提升結果相關性。
|
|
197
|
-
mapping:
|
|
198
|
-
rule: ".rule/ 目錄下的規則文件"
|
|
199
|
-
memory: ".memory/ 目錄下的記憶文件"
|
|
200
|
-
doc: "docs/ 目錄下的文檔"
|
|
201
|
-
code: "排除 .rule/, .memory/, .failure/, docs/(只搜代碼)"
|
|
202
|
-
usage_examples:
|
|
203
|
-
- scenario: "尋找相關規則"
|
|
204
|
-
query: "React hook 複用規則"
|
|
205
|
-
content_type: "rule"
|
|
206
|
-
benefit: "只搜 .rule/,避免代碼和文檔噪音"
|
|
207
|
-
- scenario: "尋找實際代碼實現"
|
|
208
|
-
query: "task queue parallel execution"
|
|
209
|
-
content_type: "code"
|
|
210
|
-
benefit: "排除規則和文檔,只返回源碼"
|
|
211
|
-
- scenario: "回顧歷史決策"
|
|
212
|
-
query: "選擇 Leader Worker 模式的原因"
|
|
213
|
-
content_type: "memory"
|
|
214
|
-
benefit: "只搜 .memory/,精準命中經驗記錄"
|
|
215
|
-
best_practice: |
|
|
216
|
-
1. 知道要找規則 → content_type=rule
|
|
217
|
-
2. 知道要找代碼 → content_type=code
|
|
218
|
-
3. 知道要找經驗 → content_type=memory
|
|
219
|
-
4. 不確定在哪 → 不加 content_type(全域搜尋)
|
|
220
|
-
|
|
221
|
-
tool_summary:
|
|
222
|
-
cortex_search:
|
|
223
|
-
strength: "語義理解、概念搜尋、跨模組關聯、歷史決策"
|
|
224
|
-
weakness: "精確匹配差、技術術語弱"
|
|
225
|
-
best_score_range: "0.60-0.70"
|
|
226
|
-
noise_threshold: "< 0.50 的結果通常是噪音"
|
|
227
|
-
tip: "善用 content_type 參數(rule/code/memory/doc)可大幅提升精度"
|
|
228
|
-
|
|
229
|
-
cortex_symbols:
|
|
230
|
-
strength: "精確符號定位、函數簽名、file:line 定位"
|
|
231
|
-
weakness: "只能按名稱搜尋,不支援語義"
|
|
232
|
-
best_for: "已知函數/類名時的快速定位"
|
|
233
|
-
|
|
234
|
-
cortex_context:
|
|
235
|
-
strength: "專案結構概覽、目錄樹、核心類型"
|
|
236
|
-
weakness: "大型專案會自動切換到精簡模式"
|
|
237
|
-
best_for: "開始新任務前的上下文建立"
|
|
238
|
-
|
|
239
|
-
cortex_overview:
|
|
240
|
-
strength: "專案級概覽、模組關係、技術棧"
|
|
241
|
-
weakness: "首次生成較慢(需要 Map-Reduce)"
|
|
242
|
-
best_for: "理解整個專案架構"
|
|
243
|
-
|
|
244
|
-
grep:
|
|
245
|
-
strength: "精確匹配、正則、配置值、統計計數"
|
|
246
|
-
weakness: "不理解語義、結果無排序"
|
|
247
|
-
best_for: "精確字串/模式搜尋"
|
|
248
|
-
|
|
249
|
-
glob:
|
|
250
|
-
strength: "文件名匹配、即時、無噪音"
|
|
251
|
-
weakness: "只能按文件名搜尋"
|
|
252
|
-
best_for: "文件發現和定位"
|
|
253
|
-
|
|
254
|
-
# =============================================================================
|
|
255
|
-
# CTX-003: 任務階段性記憶回想
|
|
256
|
-
# =============================================================================
|
|
257
|
-
- id: "CTX-003"
|
|
258
|
-
title: "任務階段性記憶回想"
|
|
259
|
-
description: |
|
|
260
|
-
定義 Agent 在任務執行的不同階段,應如何使用 Cortex 進行記憶回想。
|
|
261
|
-
與 AGT-001(記憶點優先載入)和 AGT-004(任務前置流程)整合。
|
|
262
|
-
severity: "should"
|
|
263
|
-
rationale: "確保 Agent 在正確的時機獲取正確深度的知識"
|
|
264
|
-
|
|
265
|
-
phases:
|
|
266
|
-
- phase: "Phase 0: 任務接收(補充 AGT-004)"
|
|
267
|
-
timing: "收到任務需求時"
|
|
268
|
-
actions:
|
|
269
|
-
- tool: "cortex_context"
|
|
270
|
-
purpose: "獲取專案結構和核心類型(自動判斷全量/RAG)"
|
|
271
|
-
required: false
|
|
272
|
-
condition: "Agent 對專案結構不熟悉時"
|
|
273
|
-
- tool: "cortex_search"
|
|
274
|
-
purpose: "搜尋任務相關的已有代碼和設計決策"
|
|
275
|
-
required: false
|
|
276
|
-
condition: "任務涉及已有功能的修改或擴展時"
|
|
277
|
-
example_query: "用戶認證 API 設計"
|
|
278
|
-
|
|
279
|
-
- phase: "Phase 1: 設計決策"
|
|
280
|
-
timing: "需要做技術選型或架構決策時"
|
|
281
|
-
actions:
|
|
282
|
-
- tool: "cortex_search"
|
|
283
|
-
purpose: "搜尋過去的設計決策和架構模式"
|
|
284
|
-
required: true
|
|
285
|
-
example_query: "為什麼選擇 React Query 而非 SWR"
|
|
286
|
-
- tool: "cortex_search"
|
|
287
|
-
purpose: "搜尋 .memory/ 和 .kenaz/ 中的經驗記錄"
|
|
288
|
-
required: true
|
|
289
|
-
example_query: "狀態管理最佳實踐"
|
|
290
|
-
|
|
291
|
-
- phase: "Phase 2: 實現開發"
|
|
292
|
-
timing: "實際寫代碼時"
|
|
293
|
-
actions:
|
|
294
|
-
- tool: "cortex_symbols"
|
|
295
|
-
purpose: "定位需要修改的函數/類"
|
|
296
|
-
required: false
|
|
297
|
-
condition: "需要修改已有代碼時"
|
|
298
|
-
- tool: "Grep"
|
|
299
|
-
purpose: "查找精確的 import 路徑、配置值"
|
|
300
|
-
required: false
|
|
301
|
-
- tool: "cortex_search"
|
|
302
|
-
purpose: "查找相似組件/模式作為參考"
|
|
303
|
-
required: false
|
|
304
|
-
condition: "需要開發類似功能時"
|
|
305
|
-
|
|
306
|
-
- phase: "Phase 3: 問題排查"
|
|
307
|
-
timing: "遇到錯誤或 Bug 時"
|
|
308
|
-
actions:
|
|
309
|
-
- tool: "cortex_search"
|
|
310
|
-
purpose: "搜尋 .failure/ 中的相關失敗經驗"
|
|
311
|
-
required: true
|
|
312
|
-
example_query: "JSON 解析失敗 BOM 編碼"
|
|
313
|
-
- tool: "Grep"
|
|
314
|
-
purpose: "定位錯誤訊息出現的位置"
|
|
315
|
-
required: false
|
|
316
|
-
|
|
317
|
-
- phase: "Phase 4: 任務完成"
|
|
318
|
-
timing: "任務完成後"
|
|
319
|
-
actions:
|
|
320
|
-
- tool: "cortex_search"
|
|
321
|
-
purpose: "驗證新代碼與現有架構是否一致"
|
|
322
|
-
required: false
|
|
323
|
-
condition: "修改了核心模組時"
|
|
324
|
-
|
|
325
|
-
# =============================================================================
|
|
326
|
-
# CTX-004: 搜尋品質保障
|
|
327
|
-
# =============================================================================
|
|
328
|
-
- id: "CTX-004"
|
|
329
|
-
title: "搜尋品質保障"
|
|
330
|
-
description: |
|
|
331
|
-
定義如何判斷搜尋結果品質,以及何時應切換到其他工具。
|
|
332
|
-
severity: "should"
|
|
333
|
-
rationale: "避免 Agent 使用低品質搜尋結果做出錯誤決策"
|
|
334
|
-
|
|
335
|
-
quality_thresholds:
|
|
336
|
-
high_confidence: ">= 0.65"
|
|
337
|
-
acceptable: "0.55 - 0.65"
|
|
338
|
-
low_confidence: "0.45 - 0.55"
|
|
339
|
-
noise: "< 0.45"
|
|
340
|
-
|
|
341
|
-
actions_by_quality:
|
|
342
|
-
- range: ">= 0.65"
|
|
343
|
-
action: "直接使用結果"
|
|
344
|
-
description: "高信心度,結果高度相關"
|
|
345
|
-
|
|
346
|
-
- range: "0.55 - 0.65"
|
|
347
|
-
action: "可參考,但建議交叉驗證"
|
|
348
|
-
description: "中等信心度,可能部分相關"
|
|
349
|
-
|
|
350
|
-
- range: "0.45 - 0.55"
|
|
351
|
-
action: "切換到 Grep/Glob 重新搜尋"
|
|
352
|
-
description: "低信心度,結果可能不相關"
|
|
353
|
-
|
|
354
|
-
- range: "< 0.45"
|
|
355
|
-
action: "忽略結果,使用精確搜尋"
|
|
356
|
-
description: "噪音,應完全忽略"
|
|
357
|
-
|
|
358
|
-
fallback_strategy: |
|
|
359
|
-
當 cortex_search 結果不佳時:
|
|
360
|
-
1. 嘗試重新措辭查詢(更具體或更通用)
|
|
361
|
-
2. 切換到 cortex_symbols(如果查詢含函數/類名)
|
|
362
|
-
3. 切換到 Grep(如果查詢含精確字串)
|
|
363
|
-
4. 使用 cortex_context 獲取全局結構後,再針對性搜尋
|
|
364
|
-
|
|
365
|
-
known_limitations:
|
|
366
|
-
- issue: "構建產物噪音"
|
|
367
|
-
description: ".next/ 和其他構建目錄的文件會被索引,導致重複結果"
|
|
368
|
-
workaround: "忽略路徑中包含 .next/, dist/, build/, target/ 的結果"
|
|
369
|
-
|
|
370
|
-
- issue: "純英文技術術語搜尋偏弱"
|
|
371
|
-
description: "bge-m3 對純英文技術術語的語義理解不如中文概念搜尋"
|
|
372
|
-
workaround: "技術術語搜尋優先用 Grep 或 cortex_symbols"
|
|
373
|
-
|
|
374
|
-
- issue: "大 chunk 拆分可能影響上下文完整性"
|
|
375
|
-
description: "超過 1024 tokens 的 chunk 被拆分為多個 part"
|
|
376
|
-
workaround: "搜尋到 part N 時,考慮也讀取相鄰的 part"
|
|
377
|
-
|
|
378
|
-
# =============================================================================
|
|
379
|
-
# 與其他規則的整合
|
|
380
|
-
# =============================================================================
|
|
381
|
-
integration:
|
|
382
|
-
with_AGT_001:
|
|
383
|
-
description: |
|
|
384
|
-
AGT-001 要求先讀取 .memory/CONTEXT.md。
|
|
385
|
-
CTX-001 補充:讀取 CONTEXT.md 後,可用 cortex_search
|
|
386
|
-
搜尋任務相關的深度知識。
|
|
387
|
-
|
|
388
|
-
with_AGT_004:
|
|
389
|
-
description: |
|
|
390
|
-
AGT-004 定義任務前置流程。
|
|
391
|
-
CTX-003 的 Phase 0 補充 AGT-004 的 Context 獲取階段,
|
|
392
|
-
加入 Cortex 語義搜尋步驟。
|
|
393
|
-
|
|
394
|
-
with_AGT_005:
|
|
395
|
-
description: |
|
|
396
|
-
AGT-005 要求失敗時查閱 .failure/。
|
|
397
|
-
CTX-001 補充:除了讀取 .failure/INDEX.yaml,
|
|
398
|
-
還可用 cortex_search 語義搜尋相關失敗經驗。
|
|
399
|
-
|
|
400
|
-
with_pipeline:
|
|
401
|
-
description: |
|
|
402
|
-
Pipeline 任務執行(PPL-101~112)過程中,
|
|
403
|
-
CTX-003 的四個階段分別對應任務的不同執行步驟。
|
|
404
|
-
|
|
405
|
-
# =============================================================================
|
|
406
|
-
# 快速參考(Agent 檢查清單)
|
|
407
|
-
# =============================================================================
|
|
408
|
-
quick_reference:
|
|
409
|
-
use_cortex_search_when:
|
|
410
|
-
- "需要理解「為什麼」某個功能這樣設計"
|
|
411
|
-
- "需要找到跨多個模組的相關代碼"
|
|
412
|
-
- "用中文描述想找的功能/概念"
|
|
413
|
-
- "需要從 .memory/ 或 .failure/ 中找到經驗記錄"
|
|
414
|
-
- "探索不熟悉的代碼區域"
|
|
415
|
-
- "需要找到相似的實現模式作為參考"
|
|
416
|
-
- "理解組件/模組的依賴關係和調用者"
|
|
417
|
-
- "尋找設計模式、最佳實踐、複用規則"
|
|
418
|
-
- "跨文件的代碼關聯(如 WebSocket 相關的所有代碼)"
|
|
419
|
-
|
|
420
|
-
content_type_cheat_sheet:
|
|
421
|
-
"找規則/規範": "content_type=rule"
|
|
422
|
-
"找源代碼": "content_type=code"
|
|
423
|
-
"找經驗/決策": "content_type=memory"
|
|
424
|
-
"找文檔": "content_type=doc"
|
|
425
|
-
"不確定": "不加 content_type"
|
|
426
|
-
|
|
427
|
-
use_grep_when:
|
|
428
|
-
- "查找精確字串(配置值、import 路徑)"
|
|
429
|
-
- "使用正則表達式搜尋"
|
|
430
|
-
- "統計某個模式的出現次數"
|
|
431
|
-
- "查找 TODO/FIXME 標記"
|
|
432
|
-
- "枚舉型查詢(列出所有自定義 hooks、所有 API routes)"
|
|
433
|
-
|
|
434
|
-
use_cortex_symbols_when:
|
|
435
|
-
- "知道函數名或類名,需要找定義位置"
|
|
436
|
-
- "需要查看函數簽名"
|
|
437
|
-
- "列出某個文件中的所有符號"
|
|
438
|
-
|
|
439
|
-
use_glob_when:
|
|
440
|
-
- "知道文件名或部分名稱"
|
|
441
|
-
- "按副檔名搜尋(*.tsx, *.py)"
|
|
442
|
-
- "查找目錄結構"
|
|
443
|
-
|
|
444
|
-
use_read_when:
|
|
445
|
-
- "已經知道精確的文件路徑"
|
|
446
|
-
- "需要讀取完整文件內容"
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
# Pipeline 系統規則
|
|
2
|
-
# 定義任務管理、佇列、統計的標準規範
|
|
3
|
-
|
|
4
|
-
_meta:
|
|
5
|
-
version: "1.0.0"
|
|
6
|
-
category: "general"
|
|
7
|
-
last_updated: "2026-02-05"
|
|
8
|
-
description: |
|
|
9
|
-
Pipeline 系統的核心規則,確保任務管理的一致性和可追溯性。
|
|
10
|
-
|
|
11
|
-
# ============================================================
|
|
12
|
-
# PPL-001: 統計數據必須累積制
|
|
13
|
-
# ============================================================
|
|
14
|
-
PPL-001:
|
|
15
|
-
title: "統計數據必須採用累積制"
|
|
16
|
-
severity: must
|
|
17
|
-
applies_to: [ai_agent, human_developer]
|
|
18
|
-
|
|
19
|
-
description: |
|
|
20
|
-
TASK_QUEUE.json 的統計數據必須反映**整體專案進度**,
|
|
21
|
-
而非僅當前佇列狀態。
|
|
22
|
-
|
|
23
|
-
rationale: |
|
|
24
|
-
- Agent 需要了解專案的整體進度(已完成多少任務)
|
|
25
|
-
- 只顯示當前佇列會誤導 Agent 認為專案剛開始
|
|
26
|
-
- 累積統計幫助評估專案成熟度和風險
|
|
27
|
-
|
|
28
|
-
rules:
|
|
29
|
-
- id: "PPL-001.1"
|
|
30
|
-
rule: "`total` 必須包含所有任務(佇列 + 已完成)"
|
|
31
|
-
example: "total = 52 (2 pending + 50 completed)"
|
|
32
|
-
|
|
33
|
-
- id: "PPL-001.2"
|
|
34
|
-
rule: "`completed` 必須從 .memory/COMPLETED_TASKS.json 計算"
|
|
35
|
-
example: "completed = 50"
|
|
36
|
-
|
|
37
|
-
- id: "PPL-001.3"
|
|
38
|
-
rule: "`pending/in_progress/blocked` 反映當前佇列狀態"
|
|
39
|
-
example: "pending = 2 (只計算 tasks 陣列中的 pending 任務)"
|
|
40
|
-
|
|
41
|
-
- id: "PPL-001.4"
|
|
42
|
-
rule: "metadata 必須包含 `completed_archive` 指向封存位置"
|
|
43
|
-
example: 'metadata.completed_archive = ".memory/COMPLETED_TASKS.json"'
|
|
44
|
-
|
|
45
|
-
correct_example: |
|
|
46
|
-
{
|
|
47
|
-
"statistics": {
|
|
48
|
-
"total": 52,
|
|
49
|
-
"pending": 2,
|
|
50
|
-
"in_progress": 0,
|
|
51
|
-
"blocked": 0,
|
|
52
|
-
"completed": 50,
|
|
53
|
-
"cancelled": 0
|
|
54
|
-
},
|
|
55
|
-
"metadata": {
|
|
56
|
-
"completed_archive": ".memory/COMPLETED_TASKS.json"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
incorrect_example: |
|
|
61
|
-
{
|
|
62
|
-
"statistics": {
|
|
63
|
-
"total": 2, // ❌ 只計算當前佇列
|
|
64
|
-
"completed": 0 // ❌ 忽略已完成任務
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
# ============================================================
|
|
69
|
-
# PPL-002: 已完成任務必須封存
|
|
70
|
-
# ============================================================
|
|
71
|
-
PPL-002:
|
|
72
|
-
title: "已完成任務必須封存到 .memory/"
|
|
73
|
-
severity: must
|
|
74
|
-
applies_to: [ai_agent, human_developer]
|
|
75
|
-
|
|
76
|
-
description: |
|
|
77
|
-
TASK_QUEUE.json 只保留 active 任務(pending/in_progress/blocked),
|
|
78
|
-
已完成任務必須移到 .memory/COMPLETED_TASKS.json。
|
|
79
|
-
|
|
80
|
-
rationale: |
|
|
81
|
-
- 保持 TASK_QUEUE.json 精簡,提升載入和解析效率
|
|
82
|
-
- 已完成任務的元數據仍需保留以供查詢和統計
|
|
83
|
-
- 避免 Scheduler 重複載入已完成任務
|
|
84
|
-
|
|
85
|
-
rules:
|
|
86
|
-
- id: "PPL-002.1"
|
|
87
|
-
rule: "TASK_QUEUE.json 的 tasks 陣列只包含 active 任務"
|
|
88
|
-
definition: "active = pending | in_progress | blocked"
|
|
89
|
-
|
|
90
|
-
- id: "PPL-002.2"
|
|
91
|
-
rule: "completed 任務移動流程"
|
|
92
|
-
steps:
|
|
93
|
-
- "從 dev/pipeline/tasks/ 移到 dev/pipeline/completed/"
|
|
94
|
-
- "從 TASK_QUEUE.json tasks 陣列移除"
|
|
95
|
-
- "新增到 .memory/COMPLETED_TASKS.json"
|
|
96
|
-
- "更新 statistics.completed 計數"
|
|
97
|
-
|
|
98
|
-
- id: "PPL-002.3"
|
|
99
|
-
rule: "定期執行清理腳本"
|
|
100
|
-
frequency: "當 TASK_QUEUE.json 中有 completed 任務時"
|
|
101
|
-
|
|
102
|
-
cleanup_script: |
|
|
103
|
-
const data = JSON.parse(fs.readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8'));
|
|
104
|
-
const completed = JSON.parse(fs.readFileSync('.memory/COMPLETED_TASKS.json', 'utf8'));
|
|
105
|
-
|
|
106
|
-
// 只保留 active 任務
|
|
107
|
-
data.tasks = data.tasks.filter(t =>
|
|
108
|
-
['pending', 'in_progress', 'blocked'].includes(t.status)
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
// 更新統計
|
|
112
|
-
data.statistics = {
|
|
113
|
-
total: data.tasks.length + completed.length,
|
|
114
|
-
pending: data.tasks.filter(t => t.status === 'pending').length,
|
|
115
|
-
in_progress: data.tasks.filter(t => t.status === 'in_progress').length,
|
|
116
|
-
blocked: data.tasks.filter(t => t.status === 'blocked').length,
|
|
117
|
-
completed: completed.length,
|
|
118
|
-
cancelled: 0
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
# ============================================================
|
|
122
|
-
# PPL-003: COMPLETED_TASKS.json 格式規範
|
|
123
|
-
# ============================================================
|
|
124
|
-
PPL-003:
|
|
125
|
-
title: "已完成任務封存格式規範"
|
|
126
|
-
severity: must
|
|
127
|
-
applies_to: [ai_agent, human_developer]
|
|
128
|
-
|
|
129
|
-
description: |
|
|
130
|
-
.memory/COMPLETED_TASKS.json 必須包含足夠的元數據,
|
|
131
|
-
以便查詢和分析歷史任務。
|
|
132
|
-
|
|
133
|
-
required_fields:
|
|
134
|
-
- field: "id"
|
|
135
|
-
type: "string"
|
|
136
|
-
example: "TASK_075"
|
|
137
|
-
|
|
138
|
-
- field: "title"
|
|
139
|
-
type: "string"
|
|
140
|
-
example: "Agents Page 組件化重構"
|
|
141
|
-
|
|
142
|
-
- field: "priority"
|
|
143
|
-
type: "string"
|
|
144
|
-
example: "P1"
|
|
145
|
-
|
|
146
|
-
- field: "agent_type"
|
|
147
|
-
type: "string"
|
|
148
|
-
example: "frontend"
|
|
149
|
-
|
|
150
|
-
- field: "source"
|
|
151
|
-
type: "string"
|
|
152
|
-
example: "User Request - Code Architecture"
|
|
153
|
-
|
|
154
|
-
- field: "estimated_hours"
|
|
155
|
-
type: "number"
|
|
156
|
-
example: 3
|
|
157
|
-
|
|
158
|
-
- field: "complexity"
|
|
159
|
-
type: "string"
|
|
160
|
-
example: "medium"
|
|
161
|
-
|
|
162
|
-
- field: "source_file"
|
|
163
|
-
type: "string"
|
|
164
|
-
example: "TASK_075_agents_page_component_refactor.yaml"
|
|
165
|
-
|
|
166
|
-
optional_fields:
|
|
167
|
-
- "completed_at"
|
|
168
|
-
- "description"
|
|
169
|
-
- "scope_paths"
|
|
170
|
-
|
|
171
|
-
format_example: |
|
|
172
|
-
[
|
|
173
|
-
{
|
|
174
|
-
"id": "TASK_075",
|
|
175
|
-
"title": "Agents Page 組件化重構",
|
|
176
|
-
"priority": "P1",
|
|
177
|
-
"agent_type": "frontend",
|
|
178
|
-
"source": "User Request",
|
|
179
|
-
"estimated_hours": 3,
|
|
180
|
-
"complexity": "medium",
|
|
181
|
-
"source_file": "TASK_075_agents_page_component_refactor.yaml"
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
|
|
185
|
-
# ============================================================
|
|
186
|
-
# PPL-004: Scheduler 同步規則
|
|
187
|
-
# ============================================================
|
|
188
|
-
PPL-004:
|
|
189
|
-
title: "Scheduler 只從 tasks/ 同步"
|
|
190
|
-
severity: must
|
|
191
|
-
applies_to: [ai_agent]
|
|
192
|
-
|
|
193
|
-
description: |
|
|
194
|
-
Multi-Agent Scheduler 同步任務時,只應從 dev/pipeline/tasks/
|
|
195
|
-
讀取,不應從 completed/ 同步歷史任務。
|
|
196
|
-
|
|
197
|
-
rationale: |
|
|
198
|
-
- 避免將已完成任務重新加入佇列
|
|
199
|
-
- 防止統計數據污染
|
|
200
|
-
- 保持 TASK_QUEUE.json 精簡
|
|
201
|
-
|
|
202
|
-
rules:
|
|
203
|
-
- id: "PPL-004.1"
|
|
204
|
-
rule: "Scheduler 啟動時只掃描 tasks/ 目錄"
|
|
205
|
-
path: "dev/pipeline/tasks/*.yaml"
|
|
206
|
-
|
|
207
|
-
- id: "PPL-004.2"
|
|
208
|
-
rule: "忽略 completed/ 目錄"
|
|
209
|
-
path: "dev/pipeline/completed/*.yaml"
|
|
210
|
-
|
|
211
|
-
- id: "PPL-004.3"
|
|
212
|
-
rule: "任務完成後立即移動文件"
|
|
213
|
-
steps:
|
|
214
|
-
- "mv dev/pipeline/tasks/TASK_XXX.yaml dev/pipeline/completed/"
|
|
215
|
-
- "從 TASK_QUEUE.json 移除該任務"
|
|
216
|
-
|
|
217
|
-
# ============================================================
|
|
218
|
-
# PPL-005: PROGRESS.md 精簡原則
|
|
219
|
-
# ============================================================
|
|
220
|
-
PPL-005:
|
|
221
|
-
title: "PROGRESS.md 只保留必要資訊"
|
|
222
|
-
severity: should
|
|
223
|
-
applies_to: [ai_agent, human_developer]
|
|
224
|
-
|
|
225
|
-
description: |
|
|
226
|
-
PROGRESS.md 應簡潔明瞭,避免冗長的歷史記錄。
|
|
227
|
-
詳細歷史資料應查詢 .memory/COMPLETED_TASKS.json。
|
|
228
|
-
|
|
229
|
-
required_sections:
|
|
230
|
-
- section: "Statistics"
|
|
231
|
-
content: "累積統計數據(含完成率)"
|
|
232
|
-
|
|
233
|
-
- section: "Current Queue"
|
|
234
|
-
content: "當前待處理和執行中任務"
|
|
235
|
-
|
|
236
|
-
- section: "Recent Activity"
|
|
237
|
-
content: "最近 5-10 條活動記錄"
|
|
238
|
-
|
|
239
|
-
- section: "Notes"
|
|
240
|
-
content: "封存位置、文件結構說明"
|
|
241
|
-
|
|
242
|
-
max_length: "100 lines"
|
|
243
|
-
|
|
244
|
-
deprecated_sections:
|
|
245
|
-
- "完整歷史任務列表(改用 .memory/COMPLETED_TASKS.json)"
|
|
246
|
-
- "詳細依賴圖(過於複雜,改用任務文件內的 dependencies)"
|