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,131 +0,0 @@
|
|
|
1
|
-
# /product-review - Automated Project Review Mode (English alias)
|
|
2
|
-
|
|
3
|
-
> This is an English alias for `/產品檢視` to avoid PowerShell encoding issues.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
This command is used for automated self-enhancement iteration. When all development tasks are completed, this command is automatically called to review the project status and decide the next step.
|
|
7
|
-
|
|
8
|
-
## Execution Steps
|
|
9
|
-
|
|
10
|
-
Please execute the project review analysis according to the following steps:
|
|
11
|
-
|
|
12
|
-
### 1. Read Required Files
|
|
13
|
-
- Read `.claude/skills/product_manager/SKILL.md` to adopt the Product Manager role
|
|
14
|
-
- Read `dev/PRODUCT_SPEC.md` to understand product specifications (if not exists, read `dev/PRODUCT_SPEC_FOR_AI_template.md`)
|
|
15
|
-
- Read `dev/pipeline/PROGRESS.md` to understand current progress
|
|
16
|
-
- List `dev/pipeline/completed/` directory to understand completed tasks
|
|
17
|
-
|
|
18
|
-
### 2. Project Gap Analysis
|
|
19
|
-
Analyze based on the read information:
|
|
20
|
-
1. **Feature Coverage**: Compare the feature requirements in PRODUCT_SPEC with completed tasks
|
|
21
|
-
2. **Core Feature Check**: Confirm whether all P0/P1 core features have been implemented
|
|
22
|
-
3. **Test Coverage**: Check if there are sufficient test tasks
|
|
23
|
-
4. **Quality Check**: Whether QA verification or optimization tasks are needed
|
|
24
|
-
|
|
25
|
-
### 3. Decision Output
|
|
26
|
-
**Important Constraints**:
|
|
27
|
-
- Must strictly follow PRODUCT_SPEC, cannot add features randomly
|
|
28
|
-
- Only add features that are clearly defined in PRODUCT_SPEC but not yet implemented
|
|
29
|
-
- Project completion criteria: All core features (P0/P1) in PRODUCT_SPEC have been implemented
|
|
30
|
-
|
|
31
|
-
Based on the analysis results, make one of the following decisions:
|
|
32
|
-
|
|
33
|
-
#### Decision A: Need to Continue Development
|
|
34
|
-
If there are core features in PRODUCT_SPEC that have not been implemented:
|
|
35
|
-
1. Create new tasks in `dev/pipeline/tasks/`
|
|
36
|
-
2. Update `dev/pipeline/PROGRESS.md`
|
|
37
|
-
3. Write status file:
|
|
38
|
-
|
|
39
|
-
```json
|
|
40
|
-
// dev/pipeline/SELF_ENHANCEMENT_STATUS.json
|
|
41
|
-
{
|
|
42
|
-
"status": "continue",
|
|
43
|
-
"decision": "Add development tasks",
|
|
44
|
-
"reason": "There are unfinished core features in PRODUCT_SPEC: [list features]",
|
|
45
|
-
"new_tasks": ["TASK_XXX", "TASK_YYY"],
|
|
46
|
-
"timestamp": "ISO timestamp format"
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
#### Decision B: Need Testing/QA
|
|
51
|
-
If core features are implemented but lack testing:
|
|
52
|
-
1. Create QA test tasks in `dev/pipeline/tasks/`
|
|
53
|
-
2. Update `dev/pipeline/PROGRESS.md`
|
|
54
|
-
3. Write status file:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
{
|
|
58
|
-
"status": "continue",
|
|
59
|
-
"decision": "Add testing tasks",
|
|
60
|
-
"reason": "Core features completed, quality verification needed",
|
|
61
|
-
"new_tasks": ["TASK_XXX_QA"],
|
|
62
|
-
"timestamp": "ISO timestamp format"
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
#### Decision C: Project Completed
|
|
67
|
-
If all core features in PRODUCT_SPEC are implemented with basic testing:
|
|
68
|
-
1. Write status file:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"status": "complete",
|
|
73
|
-
"decision": "Project completed",
|
|
74
|
-
"reason": "All core features (P0/P1) in PRODUCT_SPEC have been implemented, project has reached deliverable state",
|
|
75
|
-
"summary": {
|
|
76
|
-
"total_completed": number,
|
|
77
|
-
"core_features": ["list of completed core features"]
|
|
78
|
-
},
|
|
79
|
-
"timestamp": "ISO timestamp format"
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### Decision D: Project Completed with Suggestions
|
|
84
|
-
If PRODUCT_SPEC core features are completed, but AI identifies optimization opportunities or extensible features (outside PRODUCT_SPEC scope):
|
|
85
|
-
1. **Do not automatically create tasks** (because they are outside PRODUCT_SPEC scope)
|
|
86
|
-
2. Write status file, record suggestions for user reference:
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{
|
|
90
|
-
"status": "complete_with_suggestions",
|
|
91
|
-
"decision": "Project completed with optimization suggestions",
|
|
92
|
-
"reason": "PRODUCT_SPEC core features implemented, following are additional optimization suggestions",
|
|
93
|
-
"summary": {
|
|
94
|
-
"total_completed": number,
|
|
95
|
-
"core_features": ["list of completed core features"]
|
|
96
|
-
},
|
|
97
|
-
"suggestions": [
|
|
98
|
-
{
|
|
99
|
-
"type": "optimization/feature/enhancement",
|
|
100
|
-
"title": "Suggestion name",
|
|
101
|
-
"description": "Detailed description",
|
|
102
|
-
"priority": "P2/P3",
|
|
103
|
-
"effort": "low/medium/high"
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
"next_action": "Suggest user evaluate and manually run /產品 to add requirements",
|
|
107
|
-
"timestamp": "ISO timestamp format"
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
> **Note**: This decision is still considered "complete", scheduler will end. Suggestions are for user reference only and will not be automatically executed.
|
|
112
|
-
|
|
113
|
-
### 4. Output Format
|
|
114
|
-
After completion, output a brief summary:
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
========================================
|
|
118
|
-
Project Review Analysis Complete
|
|
119
|
-
========================================
|
|
120
|
-
Decision: [continue/complete/complete_with_suggestions]
|
|
121
|
-
Reason: [brief explanation]
|
|
122
|
-
New Tasks: [if any]
|
|
123
|
-
Optimization Suggestions: [if any, list count]
|
|
124
|
-
========================================
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Notes
|
|
128
|
-
- This command is designed for automated scheduling
|
|
129
|
-
- No user interaction required, proceed directly with analysis and decision
|
|
130
|
-
- Strictly follow PRODUCT_SPEC, cannot imagine new features
|
|
131
|
-
- Status file `SELF_ENHANCEMENT_STATUS.json` is the key dependency for the scheduler script
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# /strategy - 策略智庫團隊
|
|
2
|
-
|
|
3
|
-
調用 Strategy Team 進行設計思考、方案討論、決策建議。
|
|
4
|
-
|
|
5
|
-
## 用法
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
/strategy "您的問題或需求"
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 範例
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# 架構決策
|
|
15
|
-
/strategy "我們應該使用單體架構還是微服務架構?"
|
|
16
|
-
|
|
17
|
-
# 技術選型
|
|
18
|
-
/strategy "資料庫應該選擇 PostgreSQL 還是 MongoDB?"
|
|
19
|
-
|
|
20
|
-
# 功能評估
|
|
21
|
-
/strategy "這個 AI 助手功能值得開發嗎?需要投入多少資源?"
|
|
22
|
-
|
|
23
|
-
# 方案設計
|
|
24
|
-
/strategy "如何設計一個可擴展到千萬用戶的系統?"
|
|
25
|
-
|
|
26
|
-
# 風險分析
|
|
27
|
-
/strategy "重構代碼庫有哪些潛在風險?如何緩解?"
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 團隊特色
|
|
31
|
-
|
|
32
|
-
- 🧠 **7 個專業成員**:產品、技術、UX、商業、創新、風險、策略
|
|
33
|
-
- 💬 **成員互相討論**:就像真實的策略會議
|
|
34
|
-
- 🤝 **與您互動**:主動提問、澄清需求
|
|
35
|
-
- 📊 **方案對比**:提供 2-3 個可行方案
|
|
36
|
-
- ⚖️ **權衡分析**:清楚說明每個方案的優缺點
|
|
37
|
-
|
|
38
|
-
## 輸出
|
|
39
|
-
|
|
40
|
-
1. **問題分析**
|
|
41
|
-
2. **團隊討論摘要**(成員之間的對話)
|
|
42
|
-
3. **2-3 個方案選項**
|
|
43
|
-
4. **建議報告**(包含推薦方案與理由)
|
|
44
|
-
5. **風險分析與緩解策略**
|
|
45
|
-
6. **下一步行動計劃**
|
|
46
|
-
|
|
47
|
-
## 執行時間
|
|
48
|
-
|
|
49
|
-
- 人類預估:8-16 小時(策略會議 + 分析 + 報告)
|
|
50
|
-
- Agent 預估:20-30 分鐘(AI 討論與分析)
|
|
51
|
-
- 效率提升:約 30 倍
|
|
52
|
-
|
|
53
|
-
## 調用邏輯
|
|
54
|
-
|
|
55
|
-
當用戶執行 `/strategy` 時:
|
|
56
|
-
|
|
57
|
-
1. 讀取 Strategy Agent Skill 定義
|
|
58
|
-
2. 啟動策略分析流程
|
|
59
|
-
3. 多視角獨立分析
|
|
60
|
-
4. 向用戶提問(使用 AskUserQuestion)
|
|
61
|
-
5. 設計 2-3 個方案
|
|
62
|
-
6. 提出建議報告
|
|
63
|
-
7. 記錄決策過程
|
|
64
|
-
|
|
65
|
-
## 團隊成員
|
|
66
|
-
|
|
67
|
-
| 成員 | 視角 | 關注點 |
|
|
68
|
-
|------|------|--------|
|
|
69
|
-
| Strategy Lead | 整合 | 協調、綜合、達成共識 |
|
|
70
|
-
| Product Strategist | 產品 | 用戶價值、功能優先級 |
|
|
71
|
-
| Technical Architect | 技術 | 可行性、架構設計 |
|
|
72
|
-
| UX Strategist | UX | 用戶體驗、交互設計 |
|
|
73
|
-
| Business Analyst | 商業 | ROI、成本效益 |
|
|
74
|
-
| Innovation Specialist | 創新 | 新技術、突破性方案 |
|
|
75
|
-
| Risk Analyst | 風險 | 風險識別、緩解策略 |
|
|
76
|
-
|
|
77
|
-
## 適用場景
|
|
78
|
-
|
|
79
|
-
✅ **推薦使用**:
|
|
80
|
-
- 面對複雜決策(架構、技術選型)
|
|
81
|
-
- 需要多視角分析
|
|
82
|
-
- 需要評估商業價值
|
|
83
|
-
- 需要風險分析
|
|
84
|
-
- 需要創新方案
|
|
85
|
-
|
|
86
|
-
❌ **不推薦使用**:
|
|
87
|
-
- 已有明確方案(直接用執行團隊)
|
|
88
|
-
- 簡單 Bug 修復
|
|
89
|
-
- 緊急問題(需要快速響應)
|
|
90
|
-
- 日常維護工作
|
|
91
|
-
|
|
92
|
-
## 與其他團隊的區別
|
|
93
|
-
|
|
94
|
-
| 特性 | Strategy Team | Developer/Backend Team |
|
|
95
|
-
|------|---------------|----------------------|
|
|
96
|
-
| 職責 | 設計思考、方案建議 | 代碼實現、功能開發 |
|
|
97
|
-
| 輸出 | 建議報告、方案文檔 | 代碼、Git commits |
|
|
98
|
-
| 時間 | 20-30 分鐘 | 5-15 分鐘 |
|
|
99
|
-
| 價值 | 決策支援、風險規避 | 快速執行、交付功能 |
|
|
100
|
-
|
|
101
|
-
## 範例輸出
|
|
102
|
-
|
|
103
|
-
```markdown
|
|
104
|
-
# 建議報告:資料庫選型
|
|
105
|
-
|
|
106
|
-
## Executive Summary
|
|
107
|
-
建議使用 PostgreSQL + Redis 組合方案,平衡性能、可擴展性與成本。
|
|
108
|
-
|
|
109
|
-
## Options
|
|
110
|
-
|
|
111
|
-
### 選項 1:PostgreSQL + Redis(推薦)⭐
|
|
112
|
-
優點:成熟穩定、團隊熟悉、成本可控
|
|
113
|
-
缺點:垂直擴展有上限
|
|
114
|
-
ROI:高
|
|
115
|
-
|
|
116
|
-
### 選項 2:MongoDB + ElasticSearch
|
|
117
|
-
優點:水平擴展能力強
|
|
118
|
-
缺點:學習成本高、複雜查詢較弱
|
|
119
|
-
ROI:中
|
|
120
|
-
|
|
121
|
-
### 選項 3:Supabase(雲原生)
|
|
122
|
-
優點:運維成本低、快速上線
|
|
123
|
-
缺點:雲服務依賴、長期成本高
|
|
124
|
-
ROI:中
|
|
125
|
-
|
|
126
|
-
## Recommendation
|
|
127
|
-
推薦選項 1,理由:
|
|
128
|
-
1. 符合團隊技能
|
|
129
|
-
2. 可擴展到千萬級
|
|
130
|
-
3. 成本最優
|
|
131
|
-
|
|
132
|
-
## Next Steps
|
|
133
|
-
1. 建立 PostgreSQL PoC
|
|
134
|
-
2. 設計 Schema
|
|
135
|
-
3. 建立監控策略
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
**建立日期**: 2026-02-09
|
|
141
|
-
**適用版本**: Claude Code v1.0+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
讀取並遵循 `.claude/skills/sunny/SKILL.md` 中的指示。
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# /產品檢視 - 自動化專案檢視模式
|
|
2
|
-
|
|
3
|
-
## 用途
|
|
4
|
-
此指令用於自動化排程的自我增強迭代。當所有開發任務完成後,自動呼叫此指令檢視專案狀態並決定下一步。
|
|
5
|
-
|
|
6
|
-
## 執行步驟
|
|
7
|
-
|
|
8
|
-
請按照以下步驟執行專案檢視分析:
|
|
9
|
-
|
|
10
|
-
### 1. 讀取必要文件
|
|
11
|
-
- 讀取 `.claude/skills/product_manager/SKILL.md` 採用產品經理角色
|
|
12
|
-
- 讀取 `dev/PRODUCT_SPEC.md` 了解產品規格(若不存在則讀取 `dev/PRODUCT_SPEC_FOR_AI_template.md`)
|
|
13
|
-
- 讀取 `dev/pipeline/PROGRESS.md` 了解目前進度
|
|
14
|
-
- 列出 `dev/pipeline/completed/` 目錄了解已完成任務
|
|
15
|
-
|
|
16
|
-
### 2. 專案差距分析
|
|
17
|
-
根據讀取的資訊進行分析:
|
|
18
|
-
1. **功能覆蓋率**:比對 PRODUCT_SPEC 中的功能需求與已完成任務
|
|
19
|
-
2. **核心功能檢查**:確認 P0/P1 核心功能是否都已實現
|
|
20
|
-
3. **測試覆蓋**:檢查是否有足夠的測試任務
|
|
21
|
-
4. **品質檢查**:是否需要 QA 驗證或優化任務
|
|
22
|
-
|
|
23
|
-
### 3. 決策輸出
|
|
24
|
-
**重要限制**:
|
|
25
|
-
- 必須緊貼 PRODUCT_SPEC,不可天馬行空新增功能
|
|
26
|
-
- 只新增 PRODUCT_SPEC 中明確定義但尚未實現的功能
|
|
27
|
-
- 專案完成標準:PRODUCT_SPEC 中所有核心功能 (P0/P1) 已實現
|
|
28
|
-
|
|
29
|
-
根據分析結果,做出以下決策之一:
|
|
30
|
-
|
|
31
|
-
#### 決策 A:需要繼續開發
|
|
32
|
-
如果 PRODUCT_SPEC 中有尚未實現的核心功能:
|
|
33
|
-
1. 在 `dev/pipeline/tasks/` 建立新任務
|
|
34
|
-
2. 更新 `dev/pipeline/PROGRESS.md`
|
|
35
|
-
3. 寫入狀態文件:
|
|
36
|
-
|
|
37
|
-
```json
|
|
38
|
-
// dev/pipeline/SELF_ENHANCEMENT_STATUS.json
|
|
39
|
-
{
|
|
40
|
-
"status": "continue",
|
|
41
|
-
"decision": "新增開發任務",
|
|
42
|
-
"reason": "PRODUCT_SPEC 中尚有未完成的核心功能:[列出功能]",
|
|
43
|
-
"new_tasks": ["TASK_XXX", "TASK_YYY"],
|
|
44
|
-
"timestamp": "ISO 時間格式"
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
#### 決策 B:需要測試/QA
|
|
49
|
-
如果核心功能已實現但缺乏測試:
|
|
50
|
-
1. 在 `dev/pipeline/tasks/` 建立 QA 測試任務
|
|
51
|
-
2. 更新 `dev/pipeline/PROGRESS.md`
|
|
52
|
-
3. 寫入狀態文件:
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"status": "continue",
|
|
57
|
-
"decision": "新增測試任務",
|
|
58
|
-
"reason": "核心功能已完成,需要進行品質驗證",
|
|
59
|
-
"new_tasks": ["TASK_XXX_QA"],
|
|
60
|
-
"timestamp": "ISO 時間格式"
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
#### 決策 C:專案已完成
|
|
65
|
-
如果 PRODUCT_SPEC 中所有核心功能已實現且有基本測試:
|
|
66
|
-
1. 寫入狀態文件:
|
|
67
|
-
|
|
68
|
-
```json
|
|
69
|
-
{
|
|
70
|
-
"status": "complete",
|
|
71
|
-
"decision": "專案已完成",
|
|
72
|
-
"reason": "PRODUCT_SPEC 中所有核心功能 (P0/P1) 已實現,專案達到可交付狀態",
|
|
73
|
-
"summary": {
|
|
74
|
-
"total_completed": 數字,
|
|
75
|
-
"core_features": ["已完成的核心功能列表"]
|
|
76
|
-
},
|
|
77
|
-
"timestamp": "ISO 時間格式"
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
#### 決策 D:專案已完成但有優化建議
|
|
82
|
-
如果 PRODUCT_SPEC 核心功能已完成,但 AI 判斷有優化空間或可延伸的功能(不在 PRODUCT_SPEC 範圍內):
|
|
83
|
-
1. **不自動建立任務**(因為超出 PRODUCT_SPEC 範圍)
|
|
84
|
-
2. 寫入狀態文件,記錄建議供用戶參考:
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"status": "complete_with_suggestions",
|
|
89
|
-
"decision": "專案已完成,有優化建議",
|
|
90
|
-
"reason": "PRODUCT_SPEC 核心功能已實現,以下為額外優化建議",
|
|
91
|
-
"summary": {
|
|
92
|
-
"total_completed": 數字,
|
|
93
|
-
"core_features": ["已完成的核心功能列表"]
|
|
94
|
-
},
|
|
95
|
-
"suggestions": [
|
|
96
|
-
{
|
|
97
|
-
"type": "optimization/feature/enhancement",
|
|
98
|
-
"title": "建議名稱",
|
|
99
|
-
"description": "詳細說明",
|
|
100
|
-
"priority": "P2/P3",
|
|
101
|
-
"effort": "low/medium/high"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"next_action": "建議用戶評估後,可手動執行 /產品 新增需求",
|
|
105
|
-
"timestamp": "ISO 時間格式"
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
> **注意**:此決策仍視為「完成」,排程將結束。建議內容僅供用戶參考,不會自動執行。
|
|
110
|
-
|
|
111
|
-
### 4. 輸出格式
|
|
112
|
-
執行完成後,輸出簡短摘要:
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
========================================
|
|
116
|
-
專案檢視分析完成
|
|
117
|
-
========================================
|
|
118
|
-
決策:[continue/complete/complete_with_suggestions]
|
|
119
|
-
原因:[簡短說明]
|
|
120
|
-
新增任務:[如有]
|
|
121
|
-
優化建議:[如有,列出建議數量]
|
|
122
|
-
========================================
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## 注意事項
|
|
126
|
-
- 此指令專為自動化排程設計
|
|
127
|
-
- 不需要與用戶互動,直接進行分析和決策
|
|
128
|
-
- 嚴格遵循 PRODUCT_SPEC,不可自行發想新功能
|
|
129
|
-
- 狀態文件 `SELF_ENHANCEMENT_STATUS.json` 是排程腳本的關鍵依據
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Smoke tests for substrate-path detection (TASK_1434; TASK_2335 dropped the pulse-before-* hooks).
|
|
4
|
-
*
|
|
5
|
-
* Run: node .claude/hooks/__tests__/substrate.test.js
|
|
6
|
-
*
|
|
7
|
-
* Hooks are exercised through the one remaining hook that consumes substrate paths.
|
|
8
|
-
* Hooks are spawned as child processes with mock JSON stdin — no server needed
|
|
9
|
-
* (Dashboard offline → hooks fall through to deterministic non-server logic).
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
const assert = require('assert');
|
|
14
|
-
const { execSync } = require('child_process');
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
|
|
18
|
-
const HOOKS_DIR = path.join(__dirname, '..');
|
|
19
|
-
let passed = 0;
|
|
20
|
-
let failed = 0;
|
|
21
|
-
|
|
22
|
-
function ok(label, val) {
|
|
23
|
-
if (val) {
|
|
24
|
-
console.log(` ✓ ${label}`);
|
|
25
|
-
passed++;
|
|
26
|
-
} else {
|
|
27
|
-
console.error(` ✗ ${label}`);
|
|
28
|
-
failed++;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
// Shared helper: spawn a hook with JSON stdin, return parsed stdout JSON
|
|
34
|
-
// ---------------------------------------------------------------------------
|
|
35
|
-
function runHook(hookFile, jsonInput, envOverrides = {}) {
|
|
36
|
-
const hookPath = path.join(HOOKS_DIR, hookFile);
|
|
37
|
-
const env = { ...process.env, ...envOverrides };
|
|
38
|
-
// Clear advisory mode by default so we get 'ask' on substrate
|
|
39
|
-
if (!('ANSUZ_HOOK_MODE' in envOverrides)) {
|
|
40
|
-
delete env.ANSUZ_HOOK_MODE;
|
|
41
|
-
}
|
|
42
|
-
const result = execSync(`node "${hookPath}"`, {
|
|
43
|
-
input: JSON.stringify(jsonInput),
|
|
44
|
-
timeout: 6000,
|
|
45
|
-
env,
|
|
46
|
-
});
|
|
47
|
-
return JSON.parse(result.toString());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// 1. _substrate-paths.js — SUBSTRATE_PATH_RE and isSubstratePath
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
console.log('\n--- _substrate-paths.js ---');
|
|
54
|
-
const { isSubstratePath } = require('../_substrate-paths');
|
|
55
|
-
|
|
56
|
-
// substrate triggers
|
|
57
|
-
ok('.claude/agents/test.md → substrate', isSubstratePath('.claude/agents/test.md'));
|
|
58
|
-
ok('.claude/hooks/turn-context.js → substrate', isSubstratePath('.claude/hooks/turn-context.js'));
|
|
59
|
-
ok('.specialist/Ansuz/ → substrate', isSubstratePath('.specialist/Ansuz/'));
|
|
60
|
-
ok('.specialist/Ansuz/concepts/c.yaml → substrate', isSubstratePath('.specialist/Ansuz/concepts/c.yaml'));
|
|
61
|
-
ok('.specialist/Ansuz/phases/p0.yaml → substrate', isSubstratePath('.specialist/Ansuz/phases/p0.yaml'));
|
|
62
|
-
ok('.specialist/Ansuz/guards/L-005.yaml → substrate', isSubstratePath('.specialist/Ansuz/guards/L-005.yaml'));
|
|
63
|
-
ok('.specialist/Ansuz/elixir.yaml → substrate', isSubstratePath('.specialist/Ansuz/elixir.yaml'));
|
|
64
|
-
ok('.rule/general/synapse.yaml → substrate', isSubstratePath('.rule/general/synapse.yaml'));
|
|
65
|
-
ok('.failure/FAIL-001.yaml → substrate', isSubstratePath('.failure/FAIL-001.yaml'));
|
|
66
|
-
|
|
67
|
-
// non-substrate
|
|
68
|
-
ok('src/foo.ts → NOT substrate', !isSubstratePath('src/foo.ts'));
|
|
69
|
-
ok('dashboard/build/ → NOT substrate', !isSubstratePath('dashboard/build/'));
|
|
70
|
-
ok('.claude/settings.json → NOT substrate', !isSubstratePath('.claude/settings.json'));
|
|
71
|
-
ok('null → NOT substrate', !isSubstratePath(null));
|
|
72
|
-
ok('empty → NOT substrate', !isSubstratePath(''));
|
|
73
|
-
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
// 4. synapse-first-investigation.js
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
console.log('\n--- synapse-first-investigation.js ---');
|
|
78
|
-
|
|
79
|
-
// Helper: parse additionalContext from investigation hook output
|
|
80
|
-
// Isolated project dir: the hook's 5-minute same-command dedupe reads the
|
|
81
|
-
// project's telemetry file, so running this suite twice within 5 minutes
|
|
82
|
-
// against the real repo silenced the ls nudges and failed the asserts.
|
|
83
|
-
const INVESTIGATION_PROJ = fs.mkdtempSync(path.join(require('os').tmpdir(), 'substrate-nudge-'));
|
|
84
|
-
fs.mkdirSync(path.join(INVESTIGATION_PROJ, '.kenaz', 'specialist'), { recursive: true });
|
|
85
|
-
fs.writeFileSync(path.join(INVESTIGATION_PROJ, '.kenaz', 'project.yaml'), 'name: substrate-fixture\n');
|
|
86
|
-
function runInvestigationHook(cmd) {
|
|
87
|
-
const input = { toolInput: { command: cmd } };
|
|
88
|
-
return runHook('synapse-first-investigation.js', input, { CLAUDE_PROJECT_DIR: INVESTIGATION_PROJ });
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 4a. ls -la .specialist/Ansuz/ → NO nudge (the substrate/pulse nudge is gone)
|
|
92
|
-
const lsSubstrateResult = runInvestigationHook('ls -la .specialist/Ansuz/');
|
|
93
|
-
ok('ls .specialist/Ansuz/ → no nudge',
|
|
94
|
-
!lsSubstrateResult.hookSpecificOutput.additionalContext);
|
|
95
|
-
|
|
96
|
-
// 4b. ls -la dashboard/build/ → NO nudge
|
|
97
|
-
const lsNonSubstrateResult = runInvestigationHook('ls -la dashboard/build/');
|
|
98
|
-
ok('ls dashboard/build/ → NO nudge',
|
|
99
|
-
!lsNonSubstrateResult.hookSpecificOutput.additionalContext);
|
|
100
|
-
|
|
101
|
-
// 4c. cat .specialist/Ansuz/elixir.yaml → NO nudge (2026-09-23: reading a file
|
|
102
|
-
// you already chose is not investigation; pulse cannot replace its content)
|
|
103
|
-
const catSubstrateResult = runInvestigationHook('cat .specialist/Ansuz/elixir.yaml');
|
|
104
|
-
ok('cat substrate file → no nudge',
|
|
105
|
-
!catSubstrateResult.hookSpecificOutput.additionalContext);
|
|
106
|
-
|
|
107
|
-
// 4d. A symbol grep over source → LSP nudge (kenaz_lsp_*), no removed tool names
|
|
108
|
-
const grepSymbolResult = runInvestigationHook('grep -rn "resolveBootPolicy" .formation/');
|
|
109
|
-
const grepAdditional = grepSymbolResult.hookSpecificOutput.additionalContext || '';
|
|
110
|
-
ok('symbol grep → LSP nudge mentions kenaz_lsp_references',
|
|
111
|
-
grepAdditional.includes('kenaz_lsp_references') && !/synapse_(pulse|search|context|impact)/.test(grepAdditional));
|
|
112
|
-
|
|
113
|
-
// ---------------------------------------------------------------------------
|
|
114
|
-
// Summary
|
|
115
|
-
// ---------------------------------------------------------------------------
|
|
116
|
-
console.log(`\n${'─'.repeat(48)}`);
|
|
117
|
-
console.log(`Passed: ${passed} Failed: ${failed}`);
|
|
118
|
-
if (failed > 0) {
|
|
119
|
-
process.exit(1);
|
|
120
|
-
} else {
|
|
121
|
-
console.log('✓ All substrate hook tests passed');
|
|
122
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Shared substrate path definitions for Claude Code hooks.
|
|
6
|
-
*
|
|
7
|
-
* "Substrate" = specialist behavior-critical files. Edits/reads of these
|
|
8
|
-
* paths reshape Ansuz/specialist reflex behavior and MUST trigger a pulse
|
|
9
|
-
* reminder regardless of SKIP_PATTERNS (which treats .yaml/.md/.json as
|
|
10
|
-
* non-source config).
|
|
11
|
-
*
|
|
12
|
-
* Matched paths:
|
|
13
|
-
* .claude/agents/** — agent definitions
|
|
14
|
-
* .claude/hooks/** — hook scripts (this directory)
|
|
15
|
-
* .specialist/{name}/** — all specialist files (concepts, phases, guards,
|
|
16
|
-
* elixir/kernel/skill yaml, tools)
|
|
17
|
-
* .rule/** — rule library (highest-priority rules)
|
|
18
|
-
* .failure/** — failure learning system
|
|
19
|
-
*
|
|
20
|
-
* Note: .specialist/{name}/ root (any depth) is included because listing or
|
|
21
|
-
* modifying the specialist directory directly is substrate investigation.
|
|
22
|
-
* This means .specialist/Ansuz/tools/session.js also triggers — intentional,
|
|
23
|
-
* as session.js drives core Ansuz behavior.
|
|
24
|
-
*
|
|
25
|
-
* Worktree awareness (TASK_1762, layout updated in TASK_1777):
|
|
26
|
-
* Worktrees live at <repoParent>/.kenaz-worktrees/<repoName>/wt-<id>/
|
|
27
|
-
* (legacy pre-TASK_1777 layout: <repo>/.formation/worktrees/wt-<id>/). When a worktree-
|
|
28
|
-
* isolated agent edits a file inside its own worktree (e.g.
|
|
29
|
-
* /repo/.formation/worktrees/wt-abc/.specialist/tools/session.js), the
|
|
30
|
-
* absolute path contains a worktree-prefix segment before the substrate
|
|
31
|
-
* pattern. This must NOT be treated as main-repo substrate — the agent is
|
|
32
|
-
* editing its own workspace. Strip the worktree prefix before matching.
|
|
33
|
-
*/
|
|
34
|
-
const SUBSTRATE_PATH_RE =
|
|
35
|
-
/(?:^|\/)(?:\.claude\/(?:agents|hooks)\/|\.specialist(?:\/[^/]+)?\/|\.rule\/|\.failure\/)/;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Worktree prefix pattern (applied to forward-slash-normalized paths).
|
|
39
|
-
* Matches the portion of a path up to and including the worktree directory.
|
|
40
|
-
* Two layouts (TASK_1777):
|
|
41
|
-
* - sibling (current): `/parent/.kenaz-worktrees/<repoName>/wt-abc123-456/`
|
|
42
|
-
* - legacy in-repo: `/repo/.formation/worktrees/wt-abc123-456/`
|
|
43
|
-
* Relative forms (`.kenaz-worktrees/<name>/wt-…/`, `.formation/worktrees/wt-…/`) also match.
|
|
44
|
-
*
|
|
45
|
-
* The `wt-` prefix is enforced by worktree-create.js (makeWtName), so this
|
|
46
|
-
* pattern reliably identifies worktree-internal paths.
|
|
47
|
-
*
|
|
48
|
-
* Design: uses `(?:^|/)` so it matches both:
|
|
49
|
-
* - absolute: `/repo/.formation/worktrees/wt-xxx/…`
|
|
50
|
-
* - relative: `.formation/worktrees/wt-xxx/…`
|
|
51
|
-
*/
|
|
52
|
-
const WORKTREE_PREFIX_RE = /(?:^|\/)(?:\.formation\/worktrees|\.kenaz-worktrees\/[^/]+)\/(wt-[^/]+)\//;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Strip the worktree prefix from a forward-slash-normalized path if present,
|
|
56
|
-
* leaving only the repo-relative portion. Returns the original path unchanged
|
|
57
|
-
* if it is not a worktree-internal path.
|
|
58
|
-
*
|
|
59
|
-
* Example:
|
|
60
|
-
* /repo/.formation/worktrees/wt-abc/.specialist/tools/session.js
|
|
61
|
-
* → .specialist/tools/session.js
|
|
62
|
-
*/
|
|
63
|
-
function stripWorktreePrefix(filePath) {
|
|
64
|
-
const normalized = filePath.replace(/\\/g, '/');
|
|
65
|
-
const m = normalized.match(WORKTREE_PREFIX_RE);
|
|
66
|
-
if (!m) return normalized;
|
|
67
|
-
// m.index = position of the leading separator (or 0 for relative path)
|
|
68
|
-
// m[0] = the full matched segment including the trailing /
|
|
69
|
-
return normalized.slice(m.index + m[0].length);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function isSubstratePath(filePath) {
|
|
73
|
-
if (!filePath) return false;
|
|
74
|
-
const normalized = filePath.replace(/\\/g, '/');
|
|
75
|
-
// Worktree-internal paths are NEVER main-repo substrate (TASK_1762).
|
|
76
|
-
// When a worktree-isolated agent edits files inside its own worktree
|
|
77
|
-
// (even files like .specialist/tools/session.js), those are the agent's
|
|
78
|
-
// own workspace — not the main repo's behavior-critical substrate.
|
|
79
|
-
// The substrate guard exists to protect the MAIN REPO's specialist files
|
|
80
|
-
// from inadvertent modification, not to block agents from doing their job.
|
|
81
|
-
if (isWorktreeInternalPath(normalized)) return false;
|
|
82
|
-
return SUBSTRATE_PATH_RE.test(normalized);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Returns true if the filePath is inside a worktree directory.
|
|
87
|
-
* Used by callers that need to know whether they're operating on a worktree-
|
|
88
|
-
* internal file (e.g. to adjust reminder messaging).
|
|
89
|
-
*/
|
|
90
|
-
function isWorktreeInternalPath(filePath) {
|
|
91
|
-
if (!filePath) return false;
|
|
92
|
-
return WORKTREE_PREFIX_RE.test(filePath.replace(/\\/g, '/'));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
module.exports = { SUBSTRATE_PATH_RE, WORKTREE_PREFIX_RE, isSubstratePath, isWorktreeInternalPath, stripWorktreePrefix };
|