kenaz 0.3.18 → 0.3.20
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__/arms.test.js +41 -0
- package/core/.formation/tools/__tests__/diagnose-bug.test.js +10 -0
- package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
- package/core/.formation/tools/arms.js +48 -0
- package/core/.formation/tools/dispatch.js +24 -15
- package/core/.formation/tools/kenaz-stats.js +32 -8
- package/core/.formation/tools/kenaz-stats.test.js +15 -2
- package/core/.formation/tools/loader.js +17 -140
- package/core/.formation/tools/post-complete.js +0 -31
- package/core/.formation/tools/prompt.js +16 -1
- package/core/.formation/tools/prompt.test.js +20 -0
- 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/ansuz-boot-fast.js +7 -4
- package/core/.specialist/tools/ansuz-boot-fast.test.js +10 -3
- 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/peer-identity-e2e.js +402 -0
- package/core/dev/scripts/peer-identity-e2e.md +47 -0
- package/core/dev/scripts/relay-admin.js +94 -0
- package/core/dev/scripts/relay-admin.test.js +131 -0
- 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/README.md +10 -0
- 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/hooks/kenaz-hook.js +2 -1
- package/core/plugins/kenaz/hooks/sdk-gate.js +9 -0
- package/core/plugins/kenaz/scripts/kenaz.test.js +15 -3
- package/core/plugins/kenaz/scripts/sync.js +1 -1
- package/core/plugins/kenaz/scripts/ygg.js +8 -0
- package/core/plugins/kenaz/scripts/ygg.test.js +72 -0
- 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/core/plugins/kenaz-peer/hooks/register.test.ts +32 -0
- package/core/plugins/kenaz-peer/hooks/register.ts +9 -0
- 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,787 +0,0 @@
|
|
|
1
|
-
# .kenaz - Kenaz AI 主記憶與文檔工具
|
|
2
|
-
|
|
3
|
-
> **系統級配置** | 路徑:`.kenaz/` | 建立日期:2026-02-11
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 系統概述
|
|
8
|
-
|
|
9
|
-
`.kenaz/` 是 Kenaz AI 的**系統級核心配置目錄**,提供跨專案共享的知識庫與文檔管理工具:
|
|
10
|
-
|
|
11
|
-
**核心組件**:
|
|
12
|
-
```
|
|
13
|
-
┌─────────────────────────────────────────────────────────┐
|
|
14
|
-
│ .kenaz/ 系統 │
|
|
15
|
-
│ │
|
|
16
|
-
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
17
|
-
│ │ 主記憶系統 │ │ 文檔工具集 │ │ Cortex 配置 │ │
|
|
18
|
-
│ │ main-memory/ │ │ docs/ │ │ cortex.yaml │ │
|
|
19
|
-
│ │ │ │ │ │ │ │
|
|
20
|
-
│ │ • 跨專案知識 │ │ • 統一索引 │ │ • RAG 引擎 │ │
|
|
21
|
-
│ │ • 唯讀繼承 │ │ • TypeScript │ │ • 優先級設定 │ │
|
|
22
|
-
│ │ • 結構化索引 │ │ • 搜尋工具 │ │ • 向量權重 │ │
|
|
23
|
-
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
24
|
-
└─────────────────────────────────────────────────────────┘
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**與專案記憶的關係**:
|
|
28
|
-
- `.kenaz/main-memory/` — 跨專案共享(唯讀,開發者維護)
|
|
29
|
-
- `.memory/` — 專案專屬(讀寫,Agent 自動生成)
|
|
30
|
-
- 優先級:專案記憶 > 主記憶 > 系統預設
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 目錄結構
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
.kenaz/
|
|
38
|
-
├── README.md # 本文件(系統級入口)
|
|
39
|
-
├── cortex.yaml # Cortex RAG 引擎配置
|
|
40
|
-
│
|
|
41
|
-
├── main-memory/ # 主記憶系統(跨專案知識庫)
|
|
42
|
-
│ ├── README.md # 主記憶系統說明
|
|
43
|
-
│ ├── registry.json # 記憶索引(26 條記憶)
|
|
44
|
-
│ ├── version.yaml # 版本與變更日誌
|
|
45
|
-
│ │
|
|
46
|
-
│ ├── knowledge/ # 通用軟體開發知識
|
|
47
|
-
│ │ ├── patterns/ # 設計模式、架構模式
|
|
48
|
-
│ │ ├── solutions/ # 常見問題解決方案
|
|
49
|
-
│ │ └── references/ # 技術參考文檔
|
|
50
|
-
│ │
|
|
51
|
-
│ └── kenaz/ # Kenaz AI 系統專屬知識
|
|
52
|
-
│ ├── system/ # 系統架構與設計
|
|
53
|
-
│ ├── pipeline/ # 開發流程與任務管理
|
|
54
|
-
│ ├── rules/ # 規則系統設計
|
|
55
|
-
│ ├── cortex/ # RAG 引擎與檢索
|
|
56
|
-
│ └── memory-system/ # 記憶系統架構
|
|
57
|
-
│
|
|
58
|
-
└── docs/ # 統一文檔系統
|
|
59
|
-
├── INDEX.md # 人類可讀總覽(57 個文檔)
|
|
60
|
-
├── registry.json # Agent 用機器索引(7 個系統)
|
|
61
|
-
├── schema.json # JSON Schema 定義
|
|
62
|
-
│
|
|
63
|
-
└── tools/ # 文檔工具集(TypeScript)
|
|
64
|
-
├── src/
|
|
65
|
-
│ ├── registry.ts # 核心邏輯
|
|
66
|
-
│ ├── search.ts # 混合搜尋引擎
|
|
67
|
-
│ ├── cli.ts # CLI 命令
|
|
68
|
-
│ └── types.ts # 型別定義
|
|
69
|
-
├── dist/ # 編譯輸出
|
|
70
|
-
├── README.md # 工具使用指南
|
|
71
|
-
├── GIT_HOOK_GUIDE.md # Git Hook 自動更新
|
|
72
|
-
└── RAG_INTEGRATION_GUIDE.md # RAG 整合指南
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 主記憶系統 (.kenaz/main-memory/)
|
|
78
|
-
|
|
79
|
-
### 系統概述
|
|
80
|
-
|
|
81
|
-
主記憶系統是 Kenaz AI 的**跨專案共享知識庫**,提供:
|
|
82
|
-
|
|
83
|
-
- ✅ **跨專案知識共享** - 所有 Kenaz AI 專案可存取相同的核心知識
|
|
84
|
-
- ✅ **優先級繼承** - 專案記憶 > 主記憶 > 系統預設
|
|
85
|
-
- ✅ **唯讀設計** - 僅開發者手動更新,避免知識污染
|
|
86
|
-
- ✅ **結構化索引** - `registry.json` 提供完整元數據
|
|
87
|
-
|
|
88
|
-
### 知識結構(三層架構)
|
|
89
|
-
|
|
90
|
-
主記憶包含 **26 條記憶**,分為兩大類別:
|
|
91
|
-
|
|
92
|
-
#### 1. Knowledge(通用知識) - 8 條
|
|
93
|
-
|
|
94
|
-
| 子類別 | 說明 | 範例 |
|
|
95
|
-
|--------|------|------|
|
|
96
|
-
| **patterns/** | 設計模式、協作模式 | Leader-Worker 協作模式、Scope Path 衝突檢測 |
|
|
97
|
-
| **solutions/** | 常見問題解決方案 | JSON BOM 問題修復、團隊調用標準流程 |
|
|
98
|
-
| **references/** | 技術參考文檔 | PPL 規則參考、API 文檔連結 |
|
|
99
|
-
|
|
100
|
-
**核心記憶範例**:
|
|
101
|
-
- `K-PAT-001`: JSON BOM 編碼問題模式
|
|
102
|
-
- `K-PAT-002`: Leader-Worker 協作模式
|
|
103
|
-
- `K-PAT-003`: Scope Path 衝突檢測模式
|
|
104
|
-
- `K-SOL-001`: JSON BOM 問題解決方案
|
|
105
|
-
- `K-SOL-002`: 團隊調用標準流程
|
|
106
|
-
|
|
107
|
-
#### 2. Kenaz(系統專屬知識) - 18 條
|
|
108
|
-
|
|
109
|
-
| 子類別 | 說明 | 範例 |
|
|
110
|
-
|--------|------|------|
|
|
111
|
-
| **system/** | 系統架構與設計 | 雙軌制任務系統 |
|
|
112
|
-
| **pipeline/** | 開發流程與任務管理 | 任務執行流程、任務粒度標準、Feature ID 系統 |
|
|
113
|
-
| **rules/** | 規則系統設計 | 規則優先級系統、GEN-007 專案自包含原則 |
|
|
114
|
-
| **cortex/** | RAG 引擎與檢索 | RAG 引擎概覽、Cortex 系統架構 |
|
|
115
|
-
| **memory-system/** | 記憶系統架構 | 三層記憶架構設計 |
|
|
116
|
-
|
|
117
|
-
**核心記憶範例**:
|
|
118
|
-
- `KZ-SYS-001`: 雙軌制任務系統(新系統 vs 舊系統)
|
|
119
|
-
- `KZ-PPL-001`: 任務執行完整流程(12 步開發流程)
|
|
120
|
-
- `KZ-RULE-001`: 規則優先級系統設計
|
|
121
|
-
- `KZ-RULE-002`: GEN-007 專案自包含原則
|
|
122
|
-
- `KZ-CORTEX-001`: Cortex RAG 引擎概覽
|
|
123
|
-
|
|
124
|
-
### 記憶索引文件
|
|
125
|
-
|
|
126
|
-
| 文件 | 用途 |
|
|
127
|
-
|------|------|
|
|
128
|
-
| `registry.json` | 完整記憶索引(包含 ID、標題、標籤、路徑、類別) |
|
|
129
|
-
| `version.yaml` | 版本資訊與變更日誌 |
|
|
130
|
-
| `README.md` | 主記憶系統說明 |
|
|
131
|
-
|
|
132
|
-
### 與 Cortex 整合
|
|
133
|
-
|
|
134
|
-
主記憶透過 `.kenaz/cortex.yaml` 整合到 Kenaz Cortex RAG 引擎:
|
|
135
|
-
|
|
136
|
-
```yaml
|
|
137
|
-
# cortex.yaml - 優先級繼承機制
|
|
138
|
-
priority_order:
|
|
139
|
-
- level: 1
|
|
140
|
-
name: "專案記憶"
|
|
141
|
-
path: ".memory/"
|
|
142
|
-
|
|
143
|
-
- level: 2
|
|
144
|
-
name: "主記憶"
|
|
145
|
-
path: ".kenaz/main-memory/"
|
|
146
|
-
|
|
147
|
-
- level: 3
|
|
148
|
-
name: "系統預設"
|
|
149
|
-
path: "internal"
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**索引權重配置**:
|
|
153
|
-
```yaml
|
|
154
|
-
categories:
|
|
155
|
-
- path: "kenaz/rules/"
|
|
156
|
-
weight: 1.0
|
|
157
|
-
priority: "critical"
|
|
158
|
-
|
|
159
|
-
- path: "knowledge/patterns/"
|
|
160
|
-
weight: 1.0
|
|
161
|
-
priority: "high"
|
|
162
|
-
|
|
163
|
-
- path: "kenaz/cortex/"
|
|
164
|
-
weight: 0.8
|
|
165
|
-
priority: "medium"
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 存取控制
|
|
169
|
-
|
|
170
|
-
- **讀取權限**:所有 Agent、所有開發者
|
|
171
|
-
- **寫入權限**:僅開發者手動更新
|
|
172
|
-
- **理由**:主記憶為穩定的核心知識,避免自動修改導致知識污染
|
|
173
|
-
|
|
174
|
-
### 更新流程(開發者)
|
|
175
|
-
|
|
176
|
-
1. 在對應類別目錄建立 Markdown 文件
|
|
177
|
-
2. 撰寫記憶內容(包含標題、標籤、描述、範例)
|
|
178
|
-
3. 更新 `registry.json` 新增索引條目
|
|
179
|
-
4. 更新 `version.yaml` 記錄變更
|
|
180
|
-
5. 建立 Git commit
|
|
181
|
-
|
|
182
|
-
**範例**:
|
|
183
|
-
```bash
|
|
184
|
-
# 新增通用模式
|
|
185
|
-
touch .kenaz/main-memory/knowledge/patterns/003_new_pattern.md
|
|
186
|
-
|
|
187
|
-
# 更新索引
|
|
188
|
-
vim .kenaz/main-memory/registry.json
|
|
189
|
-
|
|
190
|
-
# 記錄變更
|
|
191
|
-
vim .kenaz/main-memory/version.yaml
|
|
192
|
-
|
|
193
|
-
# 提交
|
|
194
|
-
git add .kenaz/main-memory/
|
|
195
|
-
git commit -m "Add K-PAT-003: New Pattern"
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## 文檔工具系統 (.kenaz/docs/)
|
|
201
|
-
|
|
202
|
-
### 系統概述
|
|
203
|
-
|
|
204
|
-
`.kenaz/docs/` 是 Kenaz AI 的 **統一文檔入口系統**,提供:
|
|
205
|
-
|
|
206
|
-
- ✅ **分散式文檔管理** - 各系統保留自己的 `docs/`,統一註冊到 registry
|
|
207
|
-
- ✅ **雙格式支援** - `INDEX.md`(人類可讀) + `registry.json`(Agent 可用)
|
|
208
|
-
- ✅ **TypeScript 工具集** - `kenaz-docs` CLI + TypeScript API
|
|
209
|
-
- ✅ **RAG 整合** - 自動同步到 Kenaz Cortex
|
|
210
|
-
|
|
211
|
-
### 架構設計
|
|
212
|
-
|
|
213
|
-
```
|
|
214
|
-
.kenaz/docs/ # 統一文檔入口(系統級)
|
|
215
|
-
├── registry.json # Agent 用:機器可讀的索引
|
|
216
|
-
├── INDEX.md # 人類用:可讀性高的總覽
|
|
217
|
-
├── schema.json # JSON Schema 定義
|
|
218
|
-
└── tools/ # 文檔工具集(TypeScript)
|
|
219
|
-
├── src/
|
|
220
|
-
│ ├── registry.ts # 核心邏輯(DocsRegistry 類)
|
|
221
|
-
│ ├── search.ts # 混合搜尋引擎(精確匹配 + 索引搜尋)
|
|
222
|
-
│ ├── field-extractor.ts # YAML 欄位提取器(extractedFields)
|
|
223
|
-
│ ├── cli.ts # CLI 命令(search, list, get, index, validate, stats)
|
|
224
|
-
│ └── types.ts # 型別定義
|
|
225
|
-
└── dist/ # 編譯輸出
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### 分散式文檔架構
|
|
229
|
-
|
|
230
|
-
各系統保留自己的文檔,統一註冊到 `.kenaz/docs/registry.json`:
|
|
231
|
-
|
|
232
|
-
```
|
|
233
|
-
kenaz-cortex/docs/ # RAG 引擎文檔(14 個文檔)
|
|
234
|
-
dev/pipeline/docs/ # Pipeline 文檔(4 個文檔)
|
|
235
|
-
dashboard/docs/ # Dashboard 文檔(5 個文檔)
|
|
236
|
-
.failure/ # 失敗學習系統文檔(9 個文檔)
|
|
237
|
-
.rule/ # 規則系統文檔(17 個文檔)
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### 文檔索引統計(截至 2026-02-17)
|
|
241
|
-
|
|
242
|
-
| 系統 | 文檔數 | 優先級 | 說明 |
|
|
243
|
-
|------|--------|--------|------|
|
|
244
|
-
| **Kenaz Cortex** | 14 | 🔴 critical | RAG engine for semantic code search |
|
|
245
|
-
| **Rule System** | 17 | 🔴 critical | Project rules, coding standards, and guidelines |
|
|
246
|
-
| **Pipeline System** | 4 | 🟠 high | Task management and workflow orchestration |
|
|
247
|
-
| **Failure Learning System** | 9 | 🟠 high | Historical failure patterns and prevention strategies |
|
|
248
|
-
| **Docs System** | 6 | 🟠 high | Unified documentation registry |
|
|
249
|
-
| **Dashboard** | 5 | 🟡 medium | Web UI for project management |
|
|
250
|
-
| **Project Core** | 2 | 🔴 critical | CLAUDE.md and other root-level guides |
|
|
251
|
-
|
|
252
|
-
**總計**:7 個系統,57 個文檔
|
|
253
|
-
|
|
254
|
-
### TypeScript 工具集
|
|
255
|
-
|
|
256
|
-
#### CLI 命令
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
# 安裝與建置
|
|
260
|
-
cd .kenaz/docs/tools
|
|
261
|
-
npm install
|
|
262
|
-
npm run build
|
|
263
|
-
|
|
264
|
-
# 搜尋文檔
|
|
265
|
-
kenaz-docs search "cortex api"
|
|
266
|
-
kenaz-docs search "authentication" --system=kenaz-cortex --type=api
|
|
267
|
-
|
|
268
|
-
# 列出所有文檔
|
|
269
|
-
kenaz-docs list
|
|
270
|
-
kenaz-docs list --system=kenaz-cortex
|
|
271
|
-
|
|
272
|
-
# 獲取文檔內容
|
|
273
|
-
kenaz-docs get kenaz-cortex/docs/README.md
|
|
274
|
-
|
|
275
|
-
# 重建索引
|
|
276
|
-
kenaz-docs index --rebuild
|
|
277
|
-
|
|
278
|
-
# 驗證文檔
|
|
279
|
-
kenaz-docs validate
|
|
280
|
-
|
|
281
|
-
# 查看統計
|
|
282
|
-
kenaz-docs stats
|
|
283
|
-
kenaz-docs stats --by-system --by-type
|
|
284
|
-
|
|
285
|
-
# 同步到 RAG
|
|
286
|
-
kenaz-docs sync --to-rag
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
#### TypeScript API
|
|
290
|
-
|
|
291
|
-
```typescript
|
|
292
|
-
import { DocsRegistry, searchDocs, getDoc } from '.kenaz/docs/tools';
|
|
293
|
-
|
|
294
|
-
// 載入註冊表
|
|
295
|
-
const registry = DocsRegistry.load();
|
|
296
|
-
|
|
297
|
-
// 搜尋文檔
|
|
298
|
-
const results = registry.search('cortex api', {
|
|
299
|
-
system: 'kenaz-cortex',
|
|
300
|
-
type: 'api'
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// 獲取特定文檔
|
|
304
|
-
const doc = registry.getDocument('kenaz-cortex/docs/API_REFERENCE.md');
|
|
305
|
-
|
|
306
|
-
// 列出所有系統
|
|
307
|
-
const systems = registry.listSystems();
|
|
308
|
-
|
|
309
|
-
// 統計資訊
|
|
310
|
-
const stats = registry.stats();
|
|
311
|
-
console.log(`總共 ${stats.total_documents} 個文檔`);
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### 搜尋引擎設計
|
|
315
|
-
|
|
316
|
-
**混合搜尋策略**(`search.ts`):
|
|
317
|
-
|
|
318
|
-
1. **Phase 1**: 精確 ID 匹配(`extractedFields`)— score=100
|
|
319
|
-
- 搜尋 `ruleIds: ["GEN-007"]`、`taskIds: ["TASK_001"]`、`agentIds: ["backend_lead"]`
|
|
320
|
-
|
|
321
|
-
2. **Phase 2**: `searchableContent` 索引搜尋 — score=50
|
|
322
|
-
- 預建索引(標題 + 描述 + 標籤)
|
|
323
|
-
|
|
324
|
-
3. **Phase 3**: 全文搜尋 Fallback(可選)— score=20
|
|
325
|
-
- 未實現,預留給未來擴展
|
|
326
|
-
|
|
327
|
-
**特殊功能**:
|
|
328
|
-
- **欄位提取器**(`field-extractor.ts`):自動從 YAML 文檔提取嵌套字段(如 `.rule/` 的 `rules[].id`)
|
|
329
|
-
- **去重與排序**:按 score 排序並去重
|
|
330
|
-
- **最小評分過濾**:`minScore` 參數控制結果品質
|
|
331
|
-
- **結果數量限制**:`limit` 參數控制返回數量
|
|
332
|
-
|
|
333
|
-
### 文檔類型
|
|
334
|
-
|
|
335
|
-
| 類型 | 說明 | 範例 |
|
|
336
|
-
|------|------|------|
|
|
337
|
-
| **tutorial** | 快速開始指南 | Quick Start, Installation |
|
|
338
|
-
| **guide** | 深入使用指南 | System Overview, Best Practices |
|
|
339
|
-
| **reference** | 參考文檔 | API Reference, CLI Commands |
|
|
340
|
-
| **api** | API 文檔 | Team API, Cortex API |
|
|
341
|
-
| **example** | 實際範例 | Usage Examples, Code Samples |
|
|
342
|
-
| **troubleshooting** | 故障排除 | Common Issues, FAQ |
|
|
343
|
-
|
|
344
|
-
### 文檔規範(Frontmatter)
|
|
345
|
-
|
|
346
|
-
所有 Markdown 文檔應包含 YAML frontmatter:
|
|
347
|
-
|
|
348
|
-
```markdown
|
|
349
|
-
---
|
|
350
|
-
type: guide # tutorial|guide|reference|api|example|troubleshooting
|
|
351
|
-
title: 文檔標題
|
|
352
|
-
description: 簡短描述
|
|
353
|
-
tags: [tag1, tag2, tag3]
|
|
354
|
-
audience: all # agent|developer|user|all
|
|
355
|
-
language: zh-TW # 可選
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
# 文檔內容...
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Git Hook 自動更新
|
|
362
|
-
|
|
363
|
-
`.git/hooks/pre-commit`:
|
|
364
|
-
|
|
365
|
-
```bash
|
|
366
|
-
#!/bin/bash
|
|
367
|
-
if git diff --cached --name-only | grep -E '\.(md|markdown)$' > /dev/null; then
|
|
368
|
-
echo "檢測到文檔變更,更新索引..."
|
|
369
|
-
cd .kenaz/docs/tools && npm run build
|
|
370
|
-
node dist/cli.js index --auto
|
|
371
|
-
git add ../../registry.json
|
|
372
|
-
fi
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
**詳細指南**:`.kenaz/docs/tools/GIT_HOOK_GUIDE.md`
|
|
376
|
-
|
|
377
|
-
### 與 RAG 整合
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# 同步所有文檔到 RAG
|
|
381
|
-
kenaz-docs sync --to-rag
|
|
382
|
-
|
|
383
|
-
# 增量同步(只同步變更)
|
|
384
|
-
kenaz-docs sync --to-rag --incremental
|
|
385
|
-
|
|
386
|
-
# 強制全量同步
|
|
387
|
-
kenaz-docs sync --to-rag --force
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
**詳細指南**:`.kenaz/docs/tools/RAG_INTEGRATION_GUIDE.md`
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
## Cortex 配置 (cortex.yaml)
|
|
395
|
-
|
|
396
|
-
### 配置概述
|
|
397
|
-
|
|
398
|
-
`cortex.yaml` 定義 Kenaz Cortex RAG 引擎的主記憶整合策略。
|
|
399
|
-
|
|
400
|
-
### 完整配置
|
|
401
|
-
|
|
402
|
-
```yaml
|
|
403
|
-
version: "1.0.0"
|
|
404
|
-
description: "Kenaz Cortex RAG 引擎配置 - 整合主記憶系統"
|
|
405
|
-
|
|
406
|
-
# 記憶整合設定
|
|
407
|
-
memory_integration:
|
|
408
|
-
enabled: true
|
|
409
|
-
main_memory_path: ".kenaz/main-memory/"
|
|
410
|
-
registry_file: ".kenaz/main-memory/registry.json"
|
|
411
|
-
|
|
412
|
-
# 優先級順序(數字越小優先級越高)
|
|
413
|
-
priority_order:
|
|
414
|
-
- level: 1
|
|
415
|
-
name: "專案記憶"
|
|
416
|
-
path: ".memory/"
|
|
417
|
-
description: "當前專案專屬知識"
|
|
418
|
-
|
|
419
|
-
- level: 2
|
|
420
|
-
name: "主記憶"
|
|
421
|
-
path: ".kenaz/main-memory/"
|
|
422
|
-
description: "跨專案共享核心知識"
|
|
423
|
-
|
|
424
|
-
- level: 3
|
|
425
|
-
name: "系統預設"
|
|
426
|
-
path: "internal"
|
|
427
|
-
description: "Claude Code 內建知識"
|
|
428
|
-
|
|
429
|
-
# 索引設定
|
|
430
|
-
indexing:
|
|
431
|
-
include_main_memory: true
|
|
432
|
-
main_memory_weight: 0.8 # 主記憶權重(相對於專案記憶 1.0)
|
|
433
|
-
|
|
434
|
-
# 各類別的權重與優先級
|
|
435
|
-
categories:
|
|
436
|
-
- path: "kenaz/rules/"
|
|
437
|
-
weight: 1.0
|
|
438
|
-
priority: "critical"
|
|
439
|
-
|
|
440
|
-
- path: "knowledge/patterns/"
|
|
441
|
-
weight: 1.0
|
|
442
|
-
priority: "high"
|
|
443
|
-
|
|
444
|
-
- path: "knowledge/solutions/"
|
|
445
|
-
weight: 1.0
|
|
446
|
-
priority: "high"
|
|
447
|
-
|
|
448
|
-
- path: "kenaz/pipeline/"
|
|
449
|
-
weight: 0.9
|
|
450
|
-
priority: "high"
|
|
451
|
-
|
|
452
|
-
- path: "kenaz/cortex/"
|
|
453
|
-
weight: 0.8
|
|
454
|
-
priority: "medium"
|
|
455
|
-
|
|
456
|
-
- path: "knowledge/references/"
|
|
457
|
-
weight: 0.7
|
|
458
|
-
priority: "medium"
|
|
459
|
-
|
|
460
|
-
# 搜尋設定
|
|
461
|
-
search:
|
|
462
|
-
enable_main_memory: true
|
|
463
|
-
max_results_per_source:
|
|
464
|
-
project_memory: 5
|
|
465
|
-
main_memory: 3
|
|
466
|
-
|
|
467
|
-
result_merging:
|
|
468
|
-
strategy: "priority_weighted"
|
|
469
|
-
deduplicate: true
|
|
470
|
-
|
|
471
|
-
# 查詢接口
|
|
472
|
-
query_interface:
|
|
473
|
-
methods:
|
|
474
|
-
- name: "search_memory"
|
|
475
|
-
scope: ["project", "main", "system"]
|
|
476
|
-
description: "搜尋所有層級的記憶"
|
|
477
|
-
|
|
478
|
-
- name: "search_main_memory"
|
|
479
|
-
scope: ["main"]
|
|
480
|
-
description: "僅搜尋主記憶(Kenaz 系統知識)"
|
|
481
|
-
|
|
482
|
-
- name: "search_project_memory"
|
|
483
|
-
scope: ["project"]
|
|
484
|
-
description: "僅搜尋專案記憶"
|
|
485
|
-
|
|
486
|
-
# 存取控制
|
|
487
|
-
access_control:
|
|
488
|
-
read:
|
|
489
|
-
main_memory: "all_agents"
|
|
490
|
-
project_memory: "project_agents"
|
|
491
|
-
|
|
492
|
-
write:
|
|
493
|
-
main_memory: "manual_only"
|
|
494
|
-
project_memory: "agents"
|
|
495
|
-
|
|
496
|
-
update_policy:
|
|
497
|
-
main_memory: "開發者手動更新,避免知識污染"
|
|
498
|
-
project_memory: "Agent 可自動更新"
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
### 關鍵配置解讀
|
|
502
|
-
|
|
503
|
-
#### 優先級繼承
|
|
504
|
-
|
|
505
|
-
```
|
|
506
|
-
Agent 查詢 Cortex
|
|
507
|
-
↓
|
|
508
|
-
1. 專案記憶 (.memory/) - 最高優先級
|
|
509
|
-
↓
|
|
510
|
-
2. 主記憶 (.kenaz/main-memory/) - 中等優先級
|
|
511
|
-
↓
|
|
512
|
-
3. 系統預設 (Claude Code 內建) - 最低優先級
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
#### 權重策略
|
|
516
|
-
|
|
517
|
-
- **kenaz/rules/**(critical):權重 1.0(最高)
|
|
518
|
-
- **knowledge/patterns/**(high):權重 1.0
|
|
519
|
-
- **kenaz/pipeline/**(high):權重 0.9
|
|
520
|
-
- **kenaz/cortex/**(medium):權重 0.8
|
|
521
|
-
- **knowledge/references/**(medium):權重 0.7
|
|
522
|
-
|
|
523
|
-
#### 搜尋結果限制
|
|
524
|
-
|
|
525
|
-
- 專案記憶最多返回 5 條
|
|
526
|
-
- 主記憶最多返回 3 條
|
|
527
|
-
- 使用 `priority_weighted` 策略合併結果
|
|
528
|
-
- 自動去重
|
|
529
|
-
|
|
530
|
-
---
|
|
531
|
-
|
|
532
|
-
## Agent 使用指南
|
|
533
|
-
|
|
534
|
-
### 1. 查詢主記憶(任務開始前)
|
|
535
|
-
|
|
536
|
-
**目的**:了解 Kenaz AI 系統設計、開發流程、規則系統等核心知識。
|
|
537
|
-
|
|
538
|
-
```bash
|
|
539
|
-
# 搜尋主記憶(關於規則系統)
|
|
540
|
-
node .kenaz/docs/tools/dist/cli.js search "規則優先級"
|
|
541
|
-
|
|
542
|
-
# 搜尋主記憶(關於 Pipeline)
|
|
543
|
-
node .kenaz/docs/tools/dist/cli.js search "任務執行流程"
|
|
544
|
-
|
|
545
|
-
# 搜尋主記憶(關於 Team 系統)
|
|
546
|
-
node .kenaz/docs/tools/dist/cli.js search "Leader-Worker 模式"
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
**Cortex 接口**(如果可用):
|
|
550
|
-
```
|
|
551
|
-
cortex_search(query="規則優先級", scope=["main"])
|
|
552
|
-
cortex_search(query="任務執行流程", scope=["main"])
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
### 2. 查詢文檔系統(開發過程中)
|
|
556
|
-
|
|
557
|
-
**目的**:查找 API 文檔、操作指南、故障排除。
|
|
558
|
-
|
|
559
|
-
```bash
|
|
560
|
-
# 搜尋所有文檔
|
|
561
|
-
kenaz-docs search "cortex api"
|
|
562
|
-
|
|
563
|
-
# 按系統過濾
|
|
564
|
-
kenaz-docs search "authentication" --system=kenaz-cortex
|
|
565
|
-
|
|
566
|
-
# 按類型過濾
|
|
567
|
-
kenaz-docs search "" --type=api
|
|
568
|
-
|
|
569
|
-
# 列出特定系統的所有文檔
|
|
570
|
-
kenaz-docs list --system=pipeline-system
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
### 3. Agent 自動載入策略
|
|
574
|
-
|
|
575
|
-
Cortex 按以下層級自動載入知識:
|
|
576
|
-
|
|
577
|
-
```
|
|
578
|
-
Agent 查詢 Cortex
|
|
579
|
-
↓
|
|
580
|
-
Layer 1: 規則層(.rule/, CLAUDE.md, .failure/)
|
|
581
|
-
↓
|
|
582
|
-
Layer 1.5: 記憶層(.memory/ + .kenaz/main-memory/)
|
|
583
|
-
↓
|
|
584
|
-
Layer 2-4: 架構層、智能檢索層、全局驗證層
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
**智能載入規則**:
|
|
588
|
-
- P0/P1 任務:載入 15-20 條記憶(包含主記憶 3 條)
|
|
589
|
-
- P2/P3 任務:載入 10 條記憶(包含主記憶 2 條)
|
|
590
|
-
- 簡單任務:載入 5 條記憶(包含主記憶 1 條)
|
|
591
|
-
|
|
592
|
-
---
|
|
593
|
-
|
|
594
|
-
## 與其他系統的關係
|
|
595
|
-
|
|
596
|
-
### 優先級順序
|
|
597
|
-
|
|
598
|
-
```
|
|
599
|
-
1. .rule/* ← 最高優先級(所有人必須遵守的規則)
|
|
600
|
-
2. .kenaz/main-memory/* ← 中等優先級(跨專案核心知識)
|
|
601
|
-
3. .memory/* ← 專案優先級(專案專屬經驗)
|
|
602
|
-
4. CLAUDE.md ← 專案指導(工作流程)
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
### 與專案記憶的關係
|
|
606
|
-
|
|
607
|
-
| 層級 | 位置 | 性質 | 維護方式 | 適用範圍 |
|
|
608
|
-
|------|------|------|---------|---------|
|
|
609
|
-
| **主記憶** | `.kenaz/main-memory/` | 唯讀、全局 | 開發者手動更新 | 所有 Kenaz AI 專案 |
|
|
610
|
-
| **專案記憶** | `.memory/` | 讀寫、專案專屬 | Agent 自動生成 + 開發者審查 | 當前專案 |
|
|
611
|
-
|
|
612
|
-
**查詢規則**:專案記憶優先,主記憶補充。
|
|
613
|
-
|
|
614
|
-
### 與 Cortex RAG 的關係
|
|
615
|
-
|
|
616
|
-
- 主記憶作為 **Layer 1.5** 整合到 Cortex
|
|
617
|
-
- 使用 ChromaDB 進行向量存儲
|
|
618
|
-
- 支持語義檢索和混合排名
|
|
619
|
-
- 配置由 `cortex.yaml` 定義
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
## 維護指南
|
|
624
|
-
|
|
625
|
-
### 更新主記憶
|
|
626
|
-
|
|
627
|
-
1. 在 `.kenaz/main-memory/<category>/<subcategory>/` 建立 Markdown 文件
|
|
628
|
-
2. 撰寫記憶內容(標題、標籤、描述、範例)
|
|
629
|
-
3. 更新 `registry.json` 新增索引條目
|
|
630
|
-
4. 更新 `version.yaml` 記錄變更
|
|
631
|
-
5. 建立 Git commit
|
|
632
|
-
|
|
633
|
-
### 更新文檔索引
|
|
634
|
-
|
|
635
|
-
```bash
|
|
636
|
-
# 手動重建索引
|
|
637
|
-
cd .kenaz/docs/tools
|
|
638
|
-
npm run build
|
|
639
|
-
node dist/cli.js index --rebuild
|
|
640
|
-
|
|
641
|
-
# 驗證索引
|
|
642
|
-
node dist/cli.js validate
|
|
643
|
-
```
|
|
644
|
-
|
|
645
|
-
### 配置 Git Hook 自動更新
|
|
646
|
-
|
|
647
|
-
```bash
|
|
648
|
-
# 執行自動配置腳本
|
|
649
|
-
bash .kenaz/docs/tools/GIT_HOOK_GUIDE.md
|
|
650
|
-
```
|
|
651
|
-
|
|
652
|
-
### 同步到 Cortex RAG
|
|
653
|
-
|
|
654
|
-
```bash
|
|
655
|
-
# 同步所有文檔
|
|
656
|
-
kenaz-docs sync --to-rag
|
|
657
|
-
|
|
658
|
-
# 增量同步
|
|
659
|
-
kenaz-docs sync --to-rag --incremental
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
---
|
|
663
|
-
|
|
664
|
-
## 統計數據(截至 2026-02-17)
|
|
665
|
-
|
|
666
|
-
### 主記憶系統
|
|
667
|
-
|
|
668
|
-
```yaml
|
|
669
|
-
main_memory:
|
|
670
|
-
total_memories: 26
|
|
671
|
-
knowledge: 8 # 通用軟體開發知識
|
|
672
|
-
kenaz: 18 # Kenaz AI 系統專屬知識
|
|
673
|
-
|
|
674
|
-
by_category:
|
|
675
|
-
patterns: 4
|
|
676
|
-
solutions: 3
|
|
677
|
-
references: 1
|
|
678
|
-
system: 1
|
|
679
|
-
pipeline: 4
|
|
680
|
-
rules: 4
|
|
681
|
-
cortex: 2
|
|
682
|
-
memory-system: 1
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
### 文檔系統
|
|
686
|
-
|
|
687
|
-
```yaml
|
|
688
|
-
docs_system:
|
|
689
|
-
total_systems: 7
|
|
690
|
-
total_documents: 57
|
|
691
|
-
|
|
692
|
-
by_system:
|
|
693
|
-
kenaz-cortex: 14
|
|
694
|
-
rule-system: 17
|
|
695
|
-
pipeline-system: 4
|
|
696
|
-
failure-learning: 9
|
|
697
|
-
docs-system: 6
|
|
698
|
-
dashboard: 5
|
|
699
|
-
project-core: 2
|
|
700
|
-
|
|
701
|
-
by_type:
|
|
702
|
-
guide: 34
|
|
703
|
-
reference: 17
|
|
704
|
-
api: 6
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
---
|
|
708
|
-
|
|
709
|
-
## 相關文檔
|
|
710
|
-
|
|
711
|
-
### 主記憶系統
|
|
712
|
-
|
|
713
|
-
| 文檔 | 路徑 | 說明 |
|
|
714
|
-
|------|------|------|
|
|
715
|
-
| **主記憶 README** | `.kenaz/main-memory/README.md` | 主記憶系統完整說明 |
|
|
716
|
-
| **記憶索引** | `.kenaz/main-memory/registry.json` | 26 條記憶的完整索引 |
|
|
717
|
-
| **版本日誌** | `.kenaz/main-memory/version.yaml` | 變更歷史與版本資訊 |
|
|
718
|
-
|
|
719
|
-
### 文檔工具系統
|
|
720
|
-
|
|
721
|
-
| 文檔 | 路徑 | 說明 |
|
|
722
|
-
|------|------|------|
|
|
723
|
-
| **文檔總覽** | `.kenaz/docs/INDEX.md` | 人類可讀的文檔索引 |
|
|
724
|
-
| **文檔索引** | `.kenaz/docs/registry.json` | Agent 用機器索引 |
|
|
725
|
-
| **工具使用指南** | `.kenaz/docs/tools/README.md` | CLI 與 TypeScript API 使用說明 |
|
|
726
|
-
| **Git Hook 指南** | `.kenaz/docs/tools/GIT_HOOK_GUIDE.md` | 自動更新索引配置 |
|
|
727
|
-
| **RAG 整合指南** | `.kenaz/docs/tools/RAG_INTEGRATION_GUIDE.md` | Cortex RAG 整合說明 |
|
|
728
|
-
|
|
729
|
-
### Cortex 配置
|
|
730
|
-
|
|
731
|
-
| 文檔 | 路徑 | 說明 |
|
|
732
|
-
|------|------|------|
|
|
733
|
-
| **Cortex 配置** | `.kenaz/cortex.yaml` | RAG 引擎配置文件 |
|
|
734
|
-
| **專案記憶指南** | `.system/memory/README.md` | 專案記憶系統說明 |
|
|
735
|
-
| **Cortex 整合指南** | `.memory/CORTEX_GUIDE.md` | Cortex 系統整合指南 |
|
|
736
|
-
|
|
737
|
-
---
|
|
738
|
-
|
|
739
|
-
## 常見問題(FAQ)
|
|
740
|
-
|
|
741
|
-
### Q1: 主記憶和專案記憶有什麼區別?
|
|
742
|
-
|
|
743
|
-
**A**:
|
|
744
|
-
- **主記憶** (`.kenaz/main-memory/`):跨專案共享,開發者維護,唯讀
|
|
745
|
-
- **專案記憶** (`.memory/`):專案專屬,Agent 自動生成,讀寫
|
|
746
|
-
|
|
747
|
-
查詢時專案記憶優先。
|
|
748
|
-
|
|
749
|
-
### Q2: 如何更新主記憶?
|
|
750
|
-
|
|
751
|
-
**A**: 主記憶僅開發者手動更新:
|
|
752
|
-
1. 在 `.kenaz/main-memory/` 對應目錄建立 Markdown 文件
|
|
753
|
-
2. 更新 `registry.json` 新增索引條目
|
|
754
|
-
3. 更新 `version.yaml` 記錄變更
|
|
755
|
-
4. 建立 Git commit
|
|
756
|
-
|
|
757
|
-
### Q3: 文檔工具需要安裝嗎?
|
|
758
|
-
|
|
759
|
-
**A**: 是,需要安裝 Node.js 依賴:
|
|
760
|
-
```bash
|
|
761
|
-
cd .kenaz/docs/tools
|
|
762
|
-
npm install
|
|
763
|
-
npm run build
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
### Q4: 如何搜尋文檔?
|
|
767
|
-
|
|
768
|
-
**A**:
|
|
769
|
-
```bash
|
|
770
|
-
# CLI 方式
|
|
771
|
-
kenaz-docs search "cortex api"
|
|
772
|
-
|
|
773
|
-
# TypeScript API 方式
|
|
774
|
-
import { searchDocs } from '.kenaz/docs/tools';
|
|
775
|
-
const results = searchDocs('cortex api');
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
### Q5: Cortex 配置可以修改嗎?
|
|
779
|
-
|
|
780
|
-
**A**: 可以,但需謹慎:
|
|
781
|
-
- 優先級順序不建議修改(會影響記憶繼承)
|
|
782
|
-
- 權重可以根據專案需求調整
|
|
783
|
-
- 搜尋結果數量可以調整(注意 token 使用)
|
|
784
|
-
|
|
785
|
-
---
|
|
786
|
-
|
|
787
|
-
*建立日期: 2026-02-11 | 更新: 2026-02-19*
|