@claude-flow/cli 3.7.0-alpha.8 → 3.7.0-alpha.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/github/release-manager.md +2 -2
- package/.claude/agents/github/release-swarm.md +1 -1
- package/.claude/agents/github/repo-architect.md +2 -2
- package/.claude/agents/github/swarm-pr.md +1 -1
- package/.claude/agents/github/workflow-automation.md +2 -2
- package/.claude/commands/github/code-review-swarm.md +1 -1
- package/.claude/commands/github/issue-tracker.md +3 -3
- package/.claude/commands/github/release-manager.md +5 -3
- package/.claude/commands/github/release-swarm.md +1 -1
- package/.claude/commands/github/repo-architect.md +2 -2
- package/.claude/commands/github/swarm-issue.md +4 -1
- package/.claude/commands/github/swarm-pr.md +6 -3
- package/.claude/commands/github/sync-coordinator.md +3 -1
- package/.claude/commands/github/workflow-automation.md +2 -2
- package/.claude/helpers/github-safe.js +95 -60
- package/.claude/helpers/github-setup.sh +26 -9
- package/.claude/helpers/hook-handler.cjs +12 -4
- package/.claude/helpers/statusline.cjs +31 -2
- package/.claude/helpers/statusline.js +35 -4
- package/.claude/settings.json +1 -1
- package/.claude/skills/dual-mode/README.md +71 -0
- package/.claude/skills/dual-mode/dual-collect.md +103 -0
- package/.claude/skills/dual-mode/dual-coordinate.md +85 -0
- package/.claude/skills/dual-mode/dual-spawn.md +81 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +0 -11
- package/.claude/skills/flow-nexus-platform/SKILL.md +2 -5
- package/.claude/skills/flow-nexus-swarm/SKILL.md +0 -6
- package/.claude/skills/github-code-review/SKILL.md +2 -17
- package/.claude/skills/github-multi-repo/SKILL.md +4 -16
- package/.claude/skills/github-project-management/SKILL.md +18 -33
- package/.claude/skills/github-release-management/SKILL.md +4 -21
- package/.claude/skills/github-workflow-automation/SKILL.md +8 -26
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
- package/.claude/skills/sparc-methodology/SKILL.md +2 -11
- package/.claude/skills/stream-chain/SKILL.md +0 -3
- package/.claude/skills/swarm-advanced/SKILL.md +2 -5
- package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
- package/.claude/skills/verification-quality/SKILL.md +120 -78
- package/README.md +57 -38
- package/bin/cli.js +15 -2
- package/bin/mcp-server.js +1 -1
- package/dist/src/__probe.d.ts +2 -0
- package/dist/src/__probe.d.ts.map +1 -0
- package/dist/src/__probe.js +5 -0
- package/dist/src/__probe.js.map +1 -0
- package/dist/src/commands/agent-wasm.js +2 -2
- package/dist/src/commands/agent-wasm.js.map +1 -1
- package/dist/src/commands/benchmark-cosign.d.ts +29 -0
- package/dist/src/commands/benchmark-cosign.d.ts.map +1 -0
- package/dist/src/commands/benchmark-cosign.js +222 -0
- package/dist/src/commands/benchmark-cosign.js.map +1 -0
- package/dist/src/commands/benchmark-verify.d.ts +21 -0
- package/dist/src/commands/benchmark-verify.d.ts.map +1 -0
- package/dist/src/commands/benchmark-verify.js +202 -0
- package/dist/src/commands/benchmark-verify.js.map +1 -0
- package/dist/src/commands/daemon.d.ts +20 -0
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +366 -7
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +224 -46
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.d.ts.map +1 -1
- package/dist/src/commands/embeddings.js +18 -9
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +25 -7
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +56 -29
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +21 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +128 -3
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/start.js +1 -1
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/swarm.js +1 -1
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts.map +1 -1
- package/dist/src/commands/task.js +8 -4
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/config-adapter.js +1 -1
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +61 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +1 -0
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +133 -0
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts +1 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +19 -2
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/mcp-generator.js +4 -4
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +84 -19
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +75 -31
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +30 -0
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +18 -5
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +12 -0
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +38 -5
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-execute-core.d.ts +3 -2
- package/dist/src/mcp-tools/agent-execute-core.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-execute-core.js +157 -83
- package/dist/src/mcp-tools/agent-execute-core.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +119 -11
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +101 -24
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +6 -6
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/autopilot-tools.js +10 -10
- package/dist/src/mcp-tools/autopilot-tools.js.map +1 -1
- package/dist/src/mcp-tools/browser-session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/browser-session-tools.js +18 -7
- package/dist/src/mcp-tools/browser-session-tools.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +23 -23
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +12 -12
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +6 -6
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +7 -7
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +8 -8
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +10 -10
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +5 -5
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.js +21 -21
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-consensus-runtime.d.ts +149 -0
- package/dist/src/mcp-tools/hive-consensus-runtime.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-consensus-runtime.js +296 -0
- package/dist/src/mcp-tools/hive-consensus-runtime.js.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +53 -9
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts +2 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +179 -46
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
- package/dist/src/mcp-tools/managed-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/managed-agent-tools.js +357 -0
- package/dist/src/mcp-tools/managed-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +499 -68
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +6 -6
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +6 -6
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +4 -4
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.js +27 -11
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +34 -9
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +130 -6
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +28 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +80 -9
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +91 -18
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +55 -7
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +5 -5
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +11 -11
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.js +11 -11
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +118 -10
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ann-router-registry.d.ts +61 -0
- package/dist/src/memory/ann-router-registry.d.ts.map +1 -0
- package/dist/src/memory/ann-router-registry.js +72 -0
- package/dist/src/memory/ann-router-registry.js.map +1 -0
- package/dist/src/memory/diskann-registry.d.ts +56 -0
- package/dist/src/memory/diskann-registry.d.ts.map +1 -0
- package/dist/src/memory/diskann-registry.js +88 -0
- package/dist/src/memory/diskann-registry.js.map +1 -0
- package/dist/src/memory/memory-bridge.d.ts +4 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +49 -8
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +12 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -1
- package/dist/src/memory/memory-initializer.js +98 -19
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -1
- package/dist/src/memory/sona-optimizer.js +3 -0
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/parser.d.ts +9 -0
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/parser.js +11 -0
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +15 -4
- package/dist/src/plugins/store/discovery.d.ts.map +1 -1
- package/dist/src/plugins/store/discovery.js +40 -18
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +4 -1
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +6 -6
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts +20 -1
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -1
- package/dist/src/services/headless-worker-executor.js +91 -13
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts +92 -2
- package/dist/src/services/worker-daemon.d.ts.map +1 -1
- package/dist/src/services/worker-daemon.js +431 -16
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -8
- package/.claude/agents/core/coder.md +0 -453
- package/.claude/agents/core/researcher.md +0 -369
- package/.claude/agents/core/reviewer.md +0 -520
- package/.claude/agents/core/tester.md +0 -512
- package/.claude/agents/goal/goal-planner.md +0 -73
- package/.claude/agents/v3/adr-architect.md +0 -184
- package/.claude/agents/v3/memory-specialist.md +0 -995
- package/.claude/agents/v3/security-auditor.md +0 -771
- package/.claude/agents/v3/sparc-orchestrator.md +0 -182
- package/.claude/commands/flow-nexus/app-store.md +0 -124
- package/.claude/commands/flow-nexus/challenges.md +0 -120
- package/.claude/commands/flow-nexus/login-registration.md +0 -65
- package/.claude/commands/flow-nexus/neural-network.md +0 -134
- package/.claude/commands/flow-nexus/payments.md +0 -116
- package/.claude/commands/flow-nexus/sandbox.md +0 -83
- package/.claude/commands/flow-nexus/swarm.md +0 -87
- package/.claude/commands/flow-nexus/user-tools.md +0 -152
- package/.claude/commands/flow-nexus/workflow.md +0 -115
- package/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
- package/.claude/skills/aidefence-scan.md +0 -151
- package/.claude/skills/aidefence.yaml +0 -297
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
- package/.claude/skills/performance-analysis/SKILL.md +0 -563
- package/.claude/skills/secure-review.md +0 -181
- package/.claude/skills/worker-benchmarks/skill.md +0 -135
- package/.claude/skills/worker-integration/skill.md +0 -154
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.js +0 -643
- package/dist/src/ruvector/flash-attention.js.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -206
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.js +0 -626
- package/dist/src/ruvector/moe-router.js.map +0 -1
- package/dist/src/services/event-stream.d.ts +0 -25
- package/dist/src/services/event-stream.d.ts.map +0 -1
- package/dist/src/services/event-stream.js +0 -27
- package/dist/src/services/event-stream.js.map +0 -1
- package/dist/src/services/loop-worker-runner.d.ts +0 -16
- package/dist/src/services/loop-worker-runner.d.ts.map +0 -1
- package/dist/src/services/loop-worker-runner.js +0 -34
- package/dist/src/services/loop-worker-runner.js.map +0 -1
- package/dist/src/services/runtime-capabilities.d.ts +0 -22
- package/dist/src/services/runtime-capabilities.d.ts.map +0 -1
- package/dist/src/services/runtime-capabilities.js +0 -45
- package/dist/src/services/runtime-capabilities.js.map +0 -1
|
@@ -571,7 +571,7 @@ function assessCommandRisk(command) {
|
|
|
571
571
|
// MCP Tool implementations - return raw data for direct CLI use
|
|
572
572
|
export const hooksPreEdit = {
|
|
573
573
|
name: 'hooks_pre-edit',
|
|
574
|
-
description: 'Get context and agent suggestions before editing a file',
|
|
574
|
+
description: 'Get context and agent suggestions before editing a file Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
575
575
|
inputSchema: {
|
|
576
576
|
type: 'object',
|
|
577
577
|
properties: {
|
|
@@ -613,7 +613,7 @@ export const hooksPreEdit = {
|
|
|
613
613
|
};
|
|
614
614
|
export const hooksPostEdit = {
|
|
615
615
|
name: 'hooks_post-edit',
|
|
616
|
-
description: 'Record editing outcome for learning',
|
|
616
|
+
description: 'Record editing outcome for learning Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
617
617
|
inputSchema: {
|
|
618
618
|
type: 'object',
|
|
619
619
|
properties: {
|
|
@@ -667,7 +667,7 @@ export const hooksPostEdit = {
|
|
|
667
667
|
};
|
|
668
668
|
export const hooksPreCommand = {
|
|
669
669
|
name: 'hooks_pre-command',
|
|
670
|
-
description: 'Assess risk before executing a command',
|
|
670
|
+
description: 'Assess risk before executing a command Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
671
671
|
inputSchema: {
|
|
672
672
|
type: 'object',
|
|
673
673
|
properties: {
|
|
@@ -705,7 +705,7 @@ export const hooksPreCommand = {
|
|
|
705
705
|
};
|
|
706
706
|
export const hooksPostCommand = {
|
|
707
707
|
name: 'hooks_post-command',
|
|
708
|
-
description: 'Record command execution outcome',
|
|
708
|
+
description: 'Record command execution outcome Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
709
709
|
inputSchema: {
|
|
710
710
|
type: 'object',
|
|
711
711
|
properties: {
|
|
@@ -761,7 +761,7 @@ export const hooksPostCommand = {
|
|
|
761
761
|
};
|
|
762
762
|
export const hooksRoute = {
|
|
763
763
|
name: 'hooks_route',
|
|
764
|
-
description: 'Get a 3-tier routing recommendation for a task: Tier 1 (Agent Booster, 0ms / $0 — for var-to-const, add-types, etc.), Tier 2 (Haiku — simple), Tier 3 (Sonnet/Opus — complex). Use this BEFORE spawning an agent to avoid sending simple transforms to Sonnet. Native tools have no equivalent — Claude Code does not introspect its own model-selection cost. Returns the recommended model + a `[AGENT_BOOSTER_AVAILABLE]` literal when the WASM bypass applies.',
|
|
764
|
+
description: 'Get a 3-tier routing recommendation for a task: Tier 1 (Agent Booster, 0ms / $0 — for var-to-const, add-types, etc.), Tier 2 (Haiku — simple), Tier 3 (Sonnet/Opus — complex). Use this BEFORE spawning an agent to avoid sending simple transforms to Sonnet. Native tools have no equivalent — Claude Code does not introspect its own model-selection cost. Returns the recommended model + a `[AGENT_BOOSTER_AVAILABLE]` literal when the WASM bypass applies. Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
765
765
|
inputSchema: {
|
|
766
766
|
type: 'object',
|
|
767
767
|
properties: {
|
|
@@ -937,7 +937,7 @@ export const hooksRoute = {
|
|
|
937
937
|
};
|
|
938
938
|
export const hooksMetrics = {
|
|
939
939
|
name: 'hooks_metrics',
|
|
940
|
-
description: 'View learning metrics dashboard',
|
|
940
|
+
description: 'View learning metrics dashboard Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
941
941
|
inputSchema: {
|
|
942
942
|
type: 'object',
|
|
943
943
|
properties: {
|
|
@@ -1002,7 +1002,7 @@ export const hooksMetrics = {
|
|
|
1002
1002
|
};
|
|
1003
1003
|
export const hooksList = {
|
|
1004
1004
|
name: 'hooks_list',
|
|
1005
|
-
description: 'List all registered hooks',
|
|
1005
|
+
description: 'List all registered hooks Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1006
1006
|
inputSchema: {
|
|
1007
1007
|
type: 'object',
|
|
1008
1008
|
properties: {},
|
|
@@ -1049,7 +1049,7 @@ export const hooksList = {
|
|
|
1049
1049
|
};
|
|
1050
1050
|
export const hooksPreTask = {
|
|
1051
1051
|
name: 'hooks_pre-task',
|
|
1052
|
-
description: 'Record task start and get agent suggestions with intelligent model routing (ADR-026)',
|
|
1052
|
+
description: 'Record task start and get agent suggestions with intelligent model routing (ADR-026) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1053
1053
|
inputSchema: {
|
|
1054
1054
|
type: 'object',
|
|
1055
1055
|
properties: {
|
|
@@ -1147,7 +1147,7 @@ export const hooksPreTask = {
|
|
|
1147
1147
|
};
|
|
1148
1148
|
export const hooksPostTask = {
|
|
1149
1149
|
name: 'hooks_post-task',
|
|
1150
|
-
description: 'Record task completion for learning',
|
|
1150
|
+
description: 'Record task completion for learning Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1151
1151
|
inputSchema: {
|
|
1152
1152
|
type: 'object',
|
|
1153
1153
|
properties: {
|
|
@@ -1299,7 +1299,7 @@ export const hooksPostTask = {
|
|
|
1299
1299
|
// Explain hook - transparent routing explanation
|
|
1300
1300
|
export const hooksExplain = {
|
|
1301
1301
|
name: 'hooks_explain',
|
|
1302
|
-
description: 'Explain routing decision with full transparency',
|
|
1302
|
+
description: 'Explain routing decision with full transparency Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1303
1303
|
inputSchema: {
|
|
1304
1304
|
type: 'object',
|
|
1305
1305
|
properties: {
|
|
@@ -1377,7 +1377,7 @@ export const hooksExplain = {
|
|
|
1377
1377
|
// Pretrain hook - repository analysis for intelligence bootstrap
|
|
1378
1378
|
export const hooksPretrain = {
|
|
1379
1379
|
name: 'hooks_pretrain',
|
|
1380
|
-
description: 'Analyze repository to bootstrap intelligence (4-step pipeline)',
|
|
1380
|
+
description: 'Analyze repository to bootstrap intelligence (4-step pipeline) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1381
1381
|
inputSchema: {
|
|
1382
1382
|
type: 'object',
|
|
1383
1383
|
properties: {
|
|
@@ -1394,14 +1394,44 @@ export const hooksPretrain = {
|
|
|
1394
1394
|
// (readdirSync/statSync already imported statically at the top.)
|
|
1395
1395
|
const extCounts = {};
|
|
1396
1396
|
let filesAnalyzed = 0;
|
|
1397
|
+
// #1953: separate budget for code files. The old code gated the
|
|
1398
|
+
// import-pattern extraction on `filesAnalyzed <= 50`, which counts
|
|
1399
|
+
// EVERY directory entry (including .md/.yaml/.db/.log). In any
|
|
1400
|
+
// markdown/docs-heavy repo, the depth-first walker burned through the
|
|
1401
|
+
// 50-file budget on non-code files before reaching any source — so
|
|
1402
|
+
// `patternsExtracted: 0` even when hundreds of `.ts`/`.js` files existed.
|
|
1403
|
+
let codeFilesScanned = 0;
|
|
1397
1404
|
let totalLines = 0;
|
|
1398
1405
|
const maxDepth = depth === 'shallow' ? 2 : depth === 'deep' ? 6 : 4;
|
|
1399
1406
|
const patterns = [];
|
|
1407
|
+
// #1953: recurse into directories that typically contain code first
|
|
1408
|
+
// (`src/`, `apps/`, `packages/`, `lib/`, `crates/`, `workers/`, `server/`)
|
|
1409
|
+
// before docs / specs / planning dirs, so the import-extraction budget
|
|
1410
|
+
// is spent on the highest-signal directories even in mixed repos.
|
|
1411
|
+
const CODE_DIR_PREFIXES = new Set([
|
|
1412
|
+
'src', 'apps', 'packages', 'lib', 'crates', 'workers',
|
|
1413
|
+
'server', 'backend', 'frontend', 'app', 'cli', 'core',
|
|
1414
|
+
]);
|
|
1415
|
+
const scoreEntry = (name) => {
|
|
1416
|
+
if (CODE_DIR_PREFIXES.has(name))
|
|
1417
|
+
return 0;
|
|
1418
|
+
// Deprioritise common docs / output directories.
|
|
1419
|
+
if (/^(docs?|specs?|_.*|examples?|samples?|out|build|target|coverage|tests?)$/.test(name))
|
|
1420
|
+
return 2;
|
|
1421
|
+
return 1;
|
|
1422
|
+
};
|
|
1400
1423
|
const scan = (dir, currentDepth) => {
|
|
1401
1424
|
if (currentDepth > maxDepth)
|
|
1402
1425
|
return;
|
|
1403
1426
|
try {
|
|
1404
1427
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
1428
|
+
// Sort: code-likely dirs first, files mixed in by name, deprioritised
|
|
1429
|
+
// dirs last. Stable for deterministic test behaviour.
|
|
1430
|
+
entries.sort((a, b) => {
|
|
1431
|
+
const sa = a.isDirectory() ? scoreEntry(a.name) : 1;
|
|
1432
|
+
const sb = b.isDirectory() ? scoreEntry(b.name) : 1;
|
|
1433
|
+
return sa - sb;
|
|
1434
|
+
});
|
|
1405
1435
|
for (const entry of entries) {
|
|
1406
1436
|
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist')
|
|
1407
1437
|
continue;
|
|
@@ -1415,15 +1445,18 @@ export const hooksPretrain = {
|
|
|
1415
1445
|
extCounts[ext] = (extCounts[ext] || 0) + 1;
|
|
1416
1446
|
filesAnalyzed++;
|
|
1417
1447
|
// For code files, count lines and extract imports
|
|
1418
|
-
if (['.ts', '.js', '.py', '.go', '.rs', '.java'].includes(ext)) {
|
|
1448
|
+
if (['.ts', '.js', '.tsx', '.jsx', '.mjs', '.cjs', '.py', '.go', '.rs', '.java'].includes(ext)) {
|
|
1419
1449
|
try {
|
|
1420
1450
|
const content = readFileSync(full, 'utf-8');
|
|
1421
1451
|
const lines = content.split('\n');
|
|
1422
1452
|
totalLines += lines.length;
|
|
1423
|
-
//
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1453
|
+
// #1953: gate on the code-file count, not every-file count.
|
|
1454
|
+
// Also widened the per-file scan window from 30 → 80 lines:
|
|
1455
|
+
// modern TS files often have license headers + JSDoc + type
|
|
1456
|
+
// imports before the first `import` statement.
|
|
1457
|
+
if (++codeFilesScanned <= 50) {
|
|
1458
|
+
for (const line of lines.slice(0, 80)) {
|
|
1459
|
+
if (line.startsWith('import ') || line.startsWith('from ') || (line.startsWith('const ') && line.includes('require('))) {
|
|
1427
1460
|
const trimmed = line.trim();
|
|
1428
1461
|
if (trimmed.length < 120 && !patterns.includes(trimmed))
|
|
1429
1462
|
patterns.push(trimmed);
|
|
@@ -1455,6 +1488,17 @@ export const hooksPretrain = {
|
|
|
1455
1488
|
patternsStored = patterns.length;
|
|
1456
1489
|
}
|
|
1457
1490
|
catch { /* AgentDB not available */ }
|
|
1491
|
+
// #1847: when the corpus contains files but no patterns were extracted
|
|
1492
|
+
// (typical for Markdown vaults), make the source-code-only extraction
|
|
1493
|
+
// contract explicit so users don't conclude the hook system is broken.
|
|
1494
|
+
const SUPPORTED_EXTRACTION_EXTS = ['.ts', '.js', '.tsx', '.jsx', '.mjs', '.cjs', '.py', '.go', '.rs', '.java'];
|
|
1495
|
+
let note;
|
|
1496
|
+
if (filesAnalyzed > 0 && patterns.length === 0) {
|
|
1497
|
+
const codeFileCount = SUPPORTED_EXTRACTION_EXTS.reduce((sum, ext) => sum + (extCounts[ext] ?? 0), 0);
|
|
1498
|
+
note = codeFileCount === 0
|
|
1499
|
+
? `No source-code patterns found. hooks_pretrain extracts import/require lines from ${SUPPORTED_EXTRACTION_EXTS.join('/')} files only — Markdown/text/asset corpora produce zero patterns by design. This is not a hook-system failure; live trajectories and statusline are independent.`
|
|
1500
|
+
: `Found ${codeFileCount} source-code file(s) but extracted zero import/require patterns. They may be empty, generated, or use non-standard module syntax.`;
|
|
1501
|
+
}
|
|
1458
1502
|
return {
|
|
1459
1503
|
success: true,
|
|
1460
1504
|
_real: true,
|
|
@@ -1467,14 +1511,21 @@ export const hooksPretrain = {
|
|
|
1467
1511
|
patternsExtracted: patterns.length,
|
|
1468
1512
|
patternsStored,
|
|
1469
1513
|
fileTypes: Object.entries(extCounts).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([ext, count]) => ({ ext, count })),
|
|
1514
|
+
// #1847: explicit extraction contract so callers can tell pretrain
|
|
1515
|
+
// patterns apart from live trajectories and hook statusline state.
|
|
1516
|
+
sources: {
|
|
1517
|
+
extractedFrom: SUPPORTED_EXTRACTION_EXTS,
|
|
1518
|
+
scope: 'pretrain-only (live trajectories + statusline are tracked separately)',
|
|
1519
|
+
},
|
|
1470
1520
|
},
|
|
1521
|
+
...(note ? { note } : {}),
|
|
1471
1522
|
};
|
|
1472
1523
|
},
|
|
1473
1524
|
};
|
|
1474
1525
|
// Build agents hook - generate optimized agent configs
|
|
1475
1526
|
export const hooksBuildAgents = {
|
|
1476
1527
|
name: 'hooks_build-agents',
|
|
1477
|
-
description: 'Generate optimized agent configurations from pretrain data',
|
|
1528
|
+
description: 'Generate optimized agent configurations from pretrain data Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1478
1529
|
inputSchema: {
|
|
1479
1530
|
type: 'object',
|
|
1480
1531
|
properties: {
|
|
@@ -1537,7 +1588,7 @@ export const hooksBuildAgents = {
|
|
|
1537
1588
|
// Transfer hook - transfer patterns from another project
|
|
1538
1589
|
export const hooksTransfer = {
|
|
1539
1590
|
name: 'hooks_transfer',
|
|
1540
|
-
description: 'Transfer learned patterns from another project',
|
|
1591
|
+
description: 'Transfer learned patterns from another project Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1541
1592
|
inputSchema: {
|
|
1542
1593
|
type: 'object',
|
|
1543
1594
|
properties: {
|
|
@@ -1619,7 +1670,7 @@ export const hooksTransfer = {
|
|
|
1619
1670
|
// Session start hook - auto-starts daemon
|
|
1620
1671
|
export const hooksSessionStart = {
|
|
1621
1672
|
name: 'hooks_session-start',
|
|
1622
|
-
description: 'Initialize a new session and auto-start daemon',
|
|
1673
|
+
description: 'Initialize a new session and auto-start daemon Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1623
1674
|
inputSchema: {
|
|
1624
1675
|
type: 'object',
|
|
1625
1676
|
properties: {
|
|
@@ -1762,7 +1813,7 @@ export const hooksSessionStart = {
|
|
|
1762
1813
|
// Session end hook - stops daemon
|
|
1763
1814
|
export const hooksSessionEnd = {
|
|
1764
1815
|
name: 'hooks_session-end',
|
|
1765
|
-
description: 'End current session, stop daemon, and persist state',
|
|
1816
|
+
description: 'End current session, stop daemon, and persist state Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1766
1817
|
inputSchema: {
|
|
1767
1818
|
type: 'object',
|
|
1768
1819
|
properties: {
|
|
@@ -1849,7 +1900,7 @@ export const hooksSessionEnd = {
|
|
|
1849
1900
|
// Session restore hook
|
|
1850
1901
|
export const hooksSessionRestore = {
|
|
1851
1902
|
name: 'hooks_session-restore',
|
|
1852
|
-
description: 'Restore a previous session',
|
|
1903
|
+
description: 'Restore a previous session Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1853
1904
|
inputSchema: {
|
|
1854
1905
|
type: 'object',
|
|
1855
1906
|
properties: {
|
|
@@ -1891,7 +1942,7 @@ export const hooksSessionRestore = {
|
|
|
1891
1942
|
// Notify hook - cross-agent notifications
|
|
1892
1943
|
export const hooksNotify = {
|
|
1893
1944
|
name: 'hooks_notify',
|
|
1894
|
-
description: 'Send cross-agent notification',
|
|
1945
|
+
description: 'Send cross-agent notification Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1895
1946
|
inputSchema: {
|
|
1896
1947
|
type: 'object',
|
|
1897
1948
|
properties: {
|
|
@@ -1930,7 +1981,7 @@ export const hooksNotify = {
|
|
|
1930
1981
|
// Init hook - initialize hooks in project
|
|
1931
1982
|
export const hooksInit = {
|
|
1932
1983
|
name: 'hooks_init',
|
|
1933
|
-
description: 'Initialize hooks in project with .claude/settings.json',
|
|
1984
|
+
description: 'Initialize hooks in project with .claude/settings.json Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1934
1985
|
inputSchema: {
|
|
1935
1986
|
type: 'object',
|
|
1936
1987
|
properties: {
|
|
@@ -1968,7 +2019,7 @@ export const hooksInit = {
|
|
|
1968
2019
|
// Intelligence hook - RuVector intelligence system
|
|
1969
2020
|
export const hooksIntelligence = {
|
|
1970
2021
|
name: 'hooks_intelligence',
|
|
1971
|
-
description: 'RuVector intelligence system status (shows REAL metrics from memory store)',
|
|
2022
|
+
description: 'RuVector intelligence system status (shows REAL metrics from memory store) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
1972
2023
|
inputSchema: {
|
|
1973
2024
|
type: 'object',
|
|
1974
2025
|
properties: {
|
|
@@ -2109,7 +2160,7 @@ export const hooksIntelligence = {
|
|
|
2109
2160
|
// Intelligence reset hook
|
|
2110
2161
|
export const hooksIntelligenceReset = {
|
|
2111
2162
|
name: 'hooks_intelligence-reset',
|
|
2112
|
-
description: 'Reset intelligence learning state',
|
|
2163
|
+
description: 'Reset intelligence learning state Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2113
2164
|
inputSchema: {
|
|
2114
2165
|
type: 'object',
|
|
2115
2166
|
properties: {},
|
|
@@ -2176,7 +2227,7 @@ export const hooksIntelligenceReset = {
|
|
|
2176
2227
|
// Intelligence trajectory hooks - REAL implementation using activeTrajectories
|
|
2177
2228
|
export const hooksTrajectoryStart = {
|
|
2178
2229
|
name: 'hooks_intelligence_trajectory-start',
|
|
2179
|
-
description: 'Begin SONA trajectory for reinforcement learning',
|
|
2230
|
+
description: 'Begin SONA trajectory for reinforcement learning Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2180
2231
|
inputSchema: {
|
|
2181
2232
|
type: 'object',
|
|
2182
2233
|
properties: {
|
|
@@ -2237,7 +2288,7 @@ export const hooksTrajectoryStart = {
|
|
|
2237
2288
|
};
|
|
2238
2289
|
export const hooksTrajectoryStep = {
|
|
2239
2290
|
name: 'hooks_intelligence_trajectory-step',
|
|
2240
|
-
description: 'Record step in trajectory for reinforcement learning',
|
|
2291
|
+
description: 'Record step in trajectory for reinforcement learning Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2241
2292
|
inputSchema: {
|
|
2242
2293
|
type: 'object',
|
|
2243
2294
|
properties: {
|
|
@@ -2290,7 +2341,7 @@ export const hooksTrajectoryStep = {
|
|
|
2290
2341
|
};
|
|
2291
2342
|
export const hooksTrajectoryEnd = {
|
|
2292
2343
|
name: 'hooks_intelligence_trajectory-end',
|
|
2293
|
-
description: 'End trajectory and trigger SONA learning with EWC++',
|
|
2344
|
+
description: 'End trajectory and trigger SONA learning with EWC++ Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2294
2345
|
inputSchema: {
|
|
2295
2346
|
type: 'object',
|
|
2296
2347
|
properties: {
|
|
@@ -2434,7 +2485,7 @@ export const hooksTrajectoryEnd = {
|
|
|
2434
2485
|
// Pattern store/search hooks - REAL implementation using storeEntry
|
|
2435
2486
|
export const hooksPatternStore = {
|
|
2436
2487
|
name: 'hooks_intelligence_pattern-store',
|
|
2437
|
-
description: 'Store pattern in ReasoningBank (HNSW-indexed)',
|
|
2488
|
+
description: 'Store pattern in ReasoningBank (HNSW-indexed) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2438
2489
|
inputSchema: {
|
|
2439
2490
|
type: 'object',
|
|
2440
2491
|
properties: {
|
|
@@ -2516,7 +2567,7 @@ export const hooksPatternStore = {
|
|
|
2516
2567
|
};
|
|
2517
2568
|
export const hooksPatternSearch = {
|
|
2518
2569
|
name: 'hooks_intelligence_pattern-search',
|
|
2519
|
-
description: 'Search patterns using REAL vector search (HNSW when available, brute-force fallback)',
|
|
2570
|
+
description: 'Search patterns using REAL vector search (HNSW when available, brute-force fallback) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2520
2571
|
inputSchema: {
|
|
2521
2572
|
type: 'object',
|
|
2522
2573
|
properties: {
|
|
@@ -2625,7 +2676,7 @@ export const hooksPatternSearch = {
|
|
|
2625
2676
|
// Intelligence stats hook
|
|
2626
2677
|
export const hooksIntelligenceStats = {
|
|
2627
2678
|
name: 'hooks_intelligence_stats',
|
|
2628
|
-
description: 'Get RuVector intelligence layer statistics',
|
|
2679
|
+
description: 'Get RuVector intelligence layer statistics Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2629
2680
|
inputSchema: {
|
|
2630
2681
|
type: 'object',
|
|
2631
2682
|
properties: {
|
|
@@ -2828,7 +2879,7 @@ export const hooksIntelligenceStats = {
|
|
|
2828
2879
|
// Intelligence learn hook
|
|
2829
2880
|
export const hooksIntelligenceLearn = {
|
|
2830
2881
|
name: 'hooks_intelligence_learn',
|
|
2831
|
-
description: 'Force immediate SONA learning cycle with EWC++ consolidation',
|
|
2882
|
+
description: 'Force immediate SONA learning cycle with EWC++ consolidation Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2832
2883
|
inputSchema: {
|
|
2833
2884
|
type: 'object',
|
|
2834
2885
|
properties: {
|
|
@@ -2899,7 +2950,7 @@ export const hooksIntelligenceLearn = {
|
|
|
2899
2950
|
// Intelligence attention hook
|
|
2900
2951
|
export const hooksIntelligenceAttention = {
|
|
2901
2952
|
name: 'hooks_intelligence_attention',
|
|
2902
|
-
description: 'Compute attention-weighted similarity using MoE/Flash/Hyperbolic',
|
|
2953
|
+
description: 'Compute attention-weighted similarity using MoE/Flash/Hyperbolic Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
2903
2954
|
inputSchema: {
|
|
2904
2955
|
type: 'object',
|
|
2905
2956
|
properties: {
|
|
@@ -3311,7 +3362,7 @@ function detectWorkerTriggers(text) {
|
|
|
3311
3362
|
// Worker list tool
|
|
3312
3363
|
export const hooksWorkerList = {
|
|
3313
3364
|
name: 'hooks_worker-list',
|
|
3314
|
-
description: 'List all 12 background workers with status and capabilities',
|
|
3365
|
+
description: 'List all 12 background workers with status and capabilities Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3315
3366
|
inputSchema: {
|
|
3316
3367
|
type: 'object',
|
|
3317
3368
|
properties: {
|
|
@@ -3354,7 +3405,7 @@ export const hooksWorkerList = {
|
|
|
3354
3405
|
// Worker dispatch tool
|
|
3355
3406
|
export const hooksWorkerDispatch = {
|
|
3356
3407
|
name: 'hooks_worker-dispatch',
|
|
3357
|
-
description: 'Dispatch a background worker for analysis/optimization tasks',
|
|
3408
|
+
description: 'Dispatch a background worker for analysis/optimization tasks Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3358
3409
|
inputSchema: {
|
|
3359
3410
|
type: 'object',
|
|
3360
3411
|
properties: {
|
|
@@ -3424,16 +3475,37 @@ export const hooksWorkerDispatch = {
|
|
|
3424
3475
|
activeWorkers.set(workerId, worker);
|
|
3425
3476
|
// Determine honest status
|
|
3426
3477
|
let reportedStatus;
|
|
3427
|
-
let note;
|
|
3478
|
+
let note = '';
|
|
3428
3479
|
if (!daemonAlive) {
|
|
3429
3480
|
reportedStatus = 'no-daemon';
|
|
3430
3481
|
note = 'No worker daemon detected. Run `claude-flow daemon start` to enable real worker execution. The dispatch was recorded in-process but no actual work will run.';
|
|
3431
3482
|
}
|
|
3432
3483
|
else if (background) {
|
|
3433
|
-
//
|
|
3434
|
-
//
|
|
3435
|
-
|
|
3436
|
-
|
|
3484
|
+
// #1845: write a durable queue file the daemon polls every 5s. Until
|
|
3485
|
+
// 3.7.0-alpha.11 the dispatch only updated a process-local Map that
|
|
3486
|
+
// the daemon (separate process) could never see, so `queued` was a
|
|
3487
|
+
// lie. The queue file makes it real and inspectable on disk.
|
|
3488
|
+
const queueDir = join(cwd, '.claude-flow', 'daemon-queue');
|
|
3489
|
+
const queuePath = join(queueDir, `${workerId}.json`);
|
|
3490
|
+
let queueWritten = false;
|
|
3491
|
+
try {
|
|
3492
|
+
if (!existsSync(queueDir))
|
|
3493
|
+
mkdirSync(queueDir, { recursive: true });
|
|
3494
|
+
writeFileSync(queuePath, JSON.stringify({ workerId, trigger, context, priority, enqueuedAt: new Date().toISOString() }, null, 2));
|
|
3495
|
+
queueWritten = true;
|
|
3496
|
+
}
|
|
3497
|
+
catch (err) {
|
|
3498
|
+
// Filesystem error — fall back to mcp-only status so we never
|
|
3499
|
+
// claim queued without proof.
|
|
3500
|
+
note = `Daemon detected (pid ${daemonPid}) but queue write to ${queuePath} failed: ${err.message}. Worker recorded in-process only; use \`ruflo daemon trigger -w ${trigger}\` to run synchronously.`;
|
|
3501
|
+
}
|
|
3502
|
+
if (queueWritten) {
|
|
3503
|
+
reportedStatus = 'queued';
|
|
3504
|
+
note = `Worker queued for daemon (pid ${daemonPid}) at ${queuePath}. Daemon polls every 5s; processed entries move to .claude-flow/daemon-queue/.processed/. Poll hooks_worker-status until status === "completed".`;
|
|
3505
|
+
}
|
|
3506
|
+
else {
|
|
3507
|
+
reportedStatus = 'mcp-only';
|
|
3508
|
+
}
|
|
3437
3509
|
}
|
|
3438
3510
|
else {
|
|
3439
3511
|
// Synchronous mode without a runner — be honest about it
|
|
@@ -3467,7 +3539,7 @@ export const hooksWorkerDispatch = {
|
|
|
3467
3539
|
// Worker status tool
|
|
3468
3540
|
export const hooksWorkerStatus = {
|
|
3469
3541
|
name: 'hooks_worker-status',
|
|
3470
|
-
description: 'Get status of a specific worker or all active workers',
|
|
3542
|
+
description: 'Get status of a specific worker or all active workers Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3471
3543
|
inputSchema: {
|
|
3472
3544
|
type: 'object',
|
|
3473
3545
|
properties: {
|
|
@@ -3524,7 +3596,7 @@ export const hooksWorkerStatus = {
|
|
|
3524
3596
|
// Worker detect tool - detect triggers from prompt
|
|
3525
3597
|
export const hooksWorkerDetect = {
|
|
3526
3598
|
name: 'hooks_worker-detect',
|
|
3527
|
-
description: 'Detect worker triggers from user prompt (for UserPromptSubmit hook)',
|
|
3599
|
+
description: 'Detect worker triggers from user prompt (for UserPromptSubmit hook) Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3528
3600
|
inputSchema: {
|
|
3529
3601
|
type: 'object',
|
|
3530
3602
|
properties: {
|
|
@@ -3603,7 +3675,7 @@ async function getModelRouterInstance() {
|
|
|
3603
3675
|
// Model route tool - intelligent model selection
|
|
3604
3676
|
export const hooksModelRoute = {
|
|
3605
3677
|
name: 'hooks_model-route',
|
|
3606
|
-
description: 'Route task to optimal Claude model (haiku/sonnet/opus) based on complexity',
|
|
3678
|
+
description: 'Route task to optimal Claude model (haiku/sonnet/opus) based on complexity Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3607
3679
|
inputSchema: {
|
|
3608
3680
|
type: 'object',
|
|
3609
3681
|
properties: {
|
|
@@ -3649,7 +3721,7 @@ export const hooksModelRoute = {
|
|
|
3649
3721
|
// Model route outcome - record outcome for learning
|
|
3650
3722
|
export const hooksModelOutcome = {
|
|
3651
3723
|
name: 'hooks_model-outcome',
|
|
3652
|
-
description: 'Record model routing outcome for learning',
|
|
3724
|
+
description: 'Record model routing outcome for learning Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3653
3725
|
inputSchema: {
|
|
3654
3726
|
type: 'object',
|
|
3655
3727
|
properties: {
|
|
@@ -3684,7 +3756,7 @@ export const hooksModelOutcome = {
|
|
|
3684
3756
|
// Model router stats
|
|
3685
3757
|
export const hooksModelStats = {
|
|
3686
3758
|
name: 'hooks_model-stats',
|
|
3687
|
-
description: 'Get model routing statistics',
|
|
3759
|
+
description: 'Get model routing statistics Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3688
3760
|
inputSchema: {
|
|
3689
3761
|
type: 'object',
|
|
3690
3762
|
properties: {},
|
|
@@ -3721,7 +3793,7 @@ function analyzeComplexityFallback(task) {
|
|
|
3721
3793
|
// Worker cancel tool
|
|
3722
3794
|
export const hooksWorkerCancel = {
|
|
3723
3795
|
name: 'hooks_worker-cancel',
|
|
3724
|
-
description: 'Cancel a running worker',
|
|
3796
|
+
description: 'Cancel a running worker Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',
|
|
3725
3797
|
inputSchema: {
|
|
3726
3798
|
type: 'object',
|
|
3727
3799
|
properties: {
|
|
@@ -3760,8 +3832,69 @@ export const hooksWorkerCancel = {
|
|
|
3760
3832
|
};
|
|
3761
3833
|
},
|
|
3762
3834
|
};
|
|
3835
|
+
// #1916: the `ruflo hooks teammate-idle` / `ruflo hooks task-completed` CLI
|
|
3836
|
+
// subcommands (Agent Teams hooks) referenced unregistered tools. Minimal
|
|
3837
|
+
// acknowledgement handlers with the shapes the CLI expects — auto-assignment
|
|
3838
|
+
// and pattern-learning are delegated to the task-queue consumer / intelligence
|
|
3839
|
+
// pipeline (a tracked #1916 follow-up).
|
|
3840
|
+
export const hooksTeammateIdle = {
|
|
3841
|
+
name: 'hooks_teammate-idle',
|
|
3842
|
+
description: 'Agent Teams hook — fired when a teammate agent finishes its turn; reports whether a pending task can be auto-assigned. Use when native Task is wrong because you have a persistent multi-agent team with a shared task list and want idle workers picked up automatically rather than re-spawning subagents. For a one-shot Task, native Task is fine. (Auto-assignment is delegated to the task-queue consumer — this acknowledges the event today.)',
|
|
3843
|
+
category: 'hooks',
|
|
3844
|
+
inputSchema: {
|
|
3845
|
+
type: 'object',
|
|
3846
|
+
properties: {
|
|
3847
|
+
teammateId: { type: 'string', description: 'ID of the idle teammate' },
|
|
3848
|
+
teamName: { type: 'string', description: 'Team name' },
|
|
3849
|
+
autoAssign: { type: 'boolean', description: 'Auto-assign a pending task if available' },
|
|
3850
|
+
checkTaskList: { type: 'boolean', description: 'Consult the shared task list' },
|
|
3851
|
+
timestamp: { type: 'number', description: 'Event timestamp (ms)' },
|
|
3852
|
+
},
|
|
3853
|
+
},
|
|
3854
|
+
handler: async (input) => {
|
|
3855
|
+
const teammateId = String(input.teammateId ?? '');
|
|
3856
|
+
return {
|
|
3857
|
+
success: true,
|
|
3858
|
+
teammateId,
|
|
3859
|
+
action: 'waiting',
|
|
3860
|
+
pendingTasks: 0,
|
|
3861
|
+
message: 'teammate-idle acknowledged; auto-assignment requires the task-queue consumer (#1916 follow-up)',
|
|
3862
|
+
};
|
|
3863
|
+
},
|
|
3864
|
+
};
|
|
3865
|
+
export const hooksTaskCompleted = {
|
|
3866
|
+
name: 'hooks_task-completed',
|
|
3867
|
+
description: 'Agent Teams hook — fired when a task is marked complete; records completion and (eventually) trains patterns + notifies the team lead. Use when native TodoWrite is wrong because the work was a persisted, agent-assigned task whose outcome should feed cross-session learning and team coordination. For an in-session checklist tick, native TodoWrite is fine. (Pattern-learning is delegated to the intelligence pipeline — this records the completion today.)',
|
|
3868
|
+
category: 'hooks',
|
|
3869
|
+
inputSchema: {
|
|
3870
|
+
type: 'object',
|
|
3871
|
+
properties: {
|
|
3872
|
+
taskId: { type: 'string', description: 'ID of the completed task' },
|
|
3873
|
+
teammateId: { type: 'string', description: 'Teammate that completed it' },
|
|
3874
|
+
success: { type: 'boolean', description: 'Whether the task succeeded' },
|
|
3875
|
+
quality: { type: 'number', description: 'Quality score 0-1' },
|
|
3876
|
+
trainPatterns: { type: 'boolean', description: 'Feed the outcome to the learning pipeline' },
|
|
3877
|
+
notifyLead: { type: 'boolean', description: 'Notify the team lead' },
|
|
3878
|
+
},
|
|
3879
|
+
required: ['taskId'],
|
|
3880
|
+
},
|
|
3881
|
+
handler: async (input) => {
|
|
3882
|
+
const taskId = String(input.taskId ?? '');
|
|
3883
|
+
const quality = typeof input.quality === 'number' ? input.quality : (input.success === false ? 0 : 1);
|
|
3884
|
+
return {
|
|
3885
|
+
success: true,
|
|
3886
|
+
taskId,
|
|
3887
|
+
patternsLearned: 0,
|
|
3888
|
+
leadNotified: input.notifyLead === true,
|
|
3889
|
+
metrics: { duration: 0, quality, learningUpdates: 0 },
|
|
3890
|
+
note: 'completion recorded; pattern-learning is delegated to the intelligence pipeline (#1916 follow-up)',
|
|
3891
|
+
};
|
|
3892
|
+
},
|
|
3893
|
+
};
|
|
3763
3894
|
// Export all hooks tools
|
|
3764
3895
|
export const hooksTools = [
|
|
3896
|
+
hooksTeammateIdle,
|
|
3897
|
+
hooksTaskCompleted,
|
|
3765
3898
|
hooksPreEdit,
|
|
3766
3899
|
hooksPostEdit,
|
|
3767
3900
|
hooksPreCommand,
|