Files
wehub-resource-sync 23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:02:19 +08:00

12 KiB

V3 Hooks MCP Tools Reference

Overview

The Hooks MCP Tools provide programmatic access to the V3 hooks system through the Model Context Protocol. All tools follow ADR-005 (MCP-First API Design) conventions.

Tools

hooks/pre-edit

Get context, suggestions, and warnings before file edits.

Input Schema:

{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "description": "Absolute path to the file being edited"
    },
    "operation": {
      "type": "string",
      "enum": ["create", "modify", "delete"],
      "default": "modify"
    },
    "includeContext": {
      "type": "boolean",
      "default": true,
      "description": "Include file context and related patterns"
    },
    "includeSuggestions": {
      "type": "boolean",
      "default": true,
      "description": "Include agent suggestions"
    }
  },
  "required": ["filePath"]
}

Response:

{
  "filePath": "/path/to/file.ts",
  "operation": "modify",
  "context": {
    "fileExists": true,
    "fileType": "ts",
    "relatedFiles": ["file.test.ts", "types.ts"],
    "similarPatterns": [
      {
        "pattern": "TypeScript module implementation",
        "confidence": 0.85,
        "description": "Similar patterns found in codebase"
      }
    ]
  },
  "suggestions": [
    {
      "agent": "coder",
      "suggestion": "Use coder for this modify operation",
      "confidence": 0.87,
      "rationale": "Based on file type and operation pattern"
    }
  ],
  "warnings": []
}

hooks/post-edit

Record edit outcomes for learning. Stores trajectories in ReasoningBank.

Input Schema:

{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "description": "Absolute path to the file that was edited"
    },
    "operation": {
      "type": "string",
      "enum": ["create", "modify", "delete"],
      "default": "modify"
    },
    "success": {
      "type": "boolean",
      "description": "Whether the edit was successful"
    },
    "outcome": {
      "type": "string",
      "description": "Description of the outcome"
    },
    "metadata": {
      "type": "object",
      "description": "Additional metadata"
    }
  },
  "required": ["filePath", "success"]
}

Response:

{
  "filePath": "/path/to/file.ts",
  "operation": "modify",
  "success": true,
  "recorded": true,
  "recordedAt": "2025-01-05T12:00:00.000Z",
  "patternId": "mem_abc123"
}

hooks/pre-command

Risk assessment before command execution.

Input Schema:

{
  "type": "object",
  "properties": {
    "command": {
      "type": "string",
      "description": "Command to be executed"
    },
    "workingDirectory": {
      "type": "string",
      "description": "Working directory for command execution"
    },
    "includeRiskAssessment": {
      "type": "boolean",
      "default": true
    },
    "includeSuggestions": {
      "type": "boolean",
      "default": true
    }
  },
  "required": ["command"]
}

Response:

{
  "command": "rm -rf ./temp",
  "riskAssessment": {
    "riskLevel": "high",
    "concerns": [
      "Command is potentially destructive",
      "May result in data loss"
    ],
    "recommendations": [
      "Review command carefully",
      "Consider backing up data first",
      "Use --dry-run if available"
    ]
  },
  "suggestions": [
    {
      "type": "safety",
      "suggestion": "Add error handling with try-catch",
      "rationale": "Previous similar commands benefited from error handling"
    }
  ],
  "shouldProceed": false,
  "warnings": ["HIGH RISK: This command may be destructive"]
}

hooks/post-command

Record command execution outcomes for learning.

Input Schema:

{
  "type": "object",
  "properties": {
    "command": {
      "type": "string"
    },
    "exitCode": {
      "type": "number",
      "default": 0
    },
    "success": {
      "type": "boolean"
    },
    "output": {
      "type": "string"
    },
    "error": {
      "type": "string"
    },
    "executionTime": {
      "type": "number",
      "minimum": 0,
      "description": "Execution time in milliseconds"
    },
    "metadata": {
      "type": "object"
    }
  },
  "required": ["command", "success"]
}

Response:

{
  "command": "npm test",
  "success": true,
  "recorded": true,
  "recordedAt": "2025-01-05T12:00:00.000Z",
  "patternId": "mem_def456",
  "executionTime": 5230
}

hooks/route

Route a task to the optimal agent based on learned patterns.

Input Schema:

{
  "type": "object",
  "properties": {
    "task": {
      "type": "string",
      "description": "Task description to route"
    },
    "context": {
      "type": "string",
      "description": "Additional context about the task"
    },
    "preferredAgents": {
      "type": "array",
      "items": { "type": "string" },
      "description": "List of preferred agent types"
    },
    "constraints": {
      "type": "object",
      "description": "Routing constraints"
    },
    "includeExplanation": {
      "type": "boolean",
      "default": true
    }
  },
  "required": ["task"]
}

Response:

{
  "task": "Implement user authentication",
  "recommendedAgent": "security-auditor",
  "confidence": 0.92,
  "alternativeAgents": [
    { "agent": "coder", "confidence": 0.78 },
    { "agent": "backend-dev", "confidence": 0.75 }
  ],
  "explanation": "Based on task analysis and 15 similar historical tasks, 'security-auditor' is recommended with 92% confidence.",
  "reasoning": {
    "factors": [
      { "factor": "Task keywords match", "weight": 0.4, "value": 0.95 },
      { "factor": "Historical performance", "weight": 0.3, "value": 0.90 },
      { "factor": "Agent specialization", "weight": 0.2, "value": 0.95 },
      { "factor": "Current availability", "weight": 0.1, "value": 1.0 }
    ],
    "historicalPerformance": [
      { "agent": "security-auditor", "successRate": 0.94, "avgQuality": 0.91, "tasksSimilar": 12 }
    ]
  }
}

hooks/explain

Explain routing decision with transparency.

Input Schema:

{
  "type": "object",
  "properties": {
    "task": {
      "type": "string",
      "description": "Task description to explain routing for"
    },
    "context": {
      "type": "string"
    },
    "verbose": {
      "type": "boolean",
      "default": false,
      "description": "Include detailed reasoning"
    }
  },
  "required": ["task"]
}

Response:

{
  "task": "Fix authentication bug in login flow",
  "recommendedAgent": "debugger",
  "explanation": "Based on task analysis and 8 similar historical tasks, 'debugger' is recommended with 88% confidence.",
  "reasoning": {
    "primaryFactors": [
      "Task keyword analysis",
      "Historical performance data",
      "Agent specialization match"
    ],
    "historicalData": {
      "similarTasksCount": 8,
      "avgSuccessRate": 0.87,
      "topPerformingAgents": [
        { "agent": "debugger", "performance": 0.91 },
        { "agent": "coder", "performance": 0.82 }
      ]
    },
    "patternMatching": {
      "matchedPatterns": 5,
      "relevantPatterns": [
        { "pattern": "Bug fix workflow", "relevance": 0.89 },
        { "pattern": "Authentication handling", "relevance": 0.85 }
      ]
    }
  },
  "alternatives": [
    { "agent": "coder", "whyNotBest": "Lower confidence (78%) and less historical success on similar tasks" }
  ]
}

hooks/pretrain

Bootstrap intelligence from repository analysis.

Input Schema:

{
  "type": "object",
  "properties": {
    "repositoryPath": {
      "type": "string",
      "description": "Path to repository (defaults to current directory)"
    },
    "includeGitHistory": {
      "type": "boolean",
      "default": true
    },
    "includeDependencies": {
      "type": "boolean",
      "default": true
    },
    "maxPatterns": {
      "type": "number",
      "minimum": 1,
      "maximum": 10000,
      "default": 1000
    },
    "force": {
      "type": "boolean",
      "default": false,
      "description": "Force retraining even if data exists"
    }
  }
}

Response:

{
  "success": true,
  "repositoryPath": "/workspaces/claude-flow",
  "statistics": {
    "filesAnalyzed": 247,
    "patternsExtracted": 156,
    "commitsAnalyzed": 1523,
    "dependenciesAnalyzed": 42,
    "executionTime": 3450.5
  },
  "patterns": {
    "byCategory": {
      "code-implementation": 89,
      "testing": 34,
      "documentation": 12,
      "refactoring": 15,
      "bug-fixes": 6
    },
    "byAgent": {
      "coder": 95,
      "tester": 28,
      "reviewer": 18,
      "researcher": 10,
      "planner": 5
    }
  },
  "recommendations": [
    "Strong TypeScript patterns detected - recommend coder agent for TS tasks",
    "High test coverage patterns - tester agent performs well",
    "Consistent code review practices - reviewer agent recommended for quality checks"
  ]
}

hooks/metrics

Get learning metrics and statistics.

Input Schema:

{
  "type": "object",
  "properties": {
    "category": {
      "type": "string",
      "enum": ["all", "routing", "edits", "commands", "patterns"],
      "default": "all"
    },
    "timeRange": {
      "type": "string",
      "enum": ["hour", "day", "week", "month", "all"],
      "default": "all"
    },
    "includeDetailedStats": {
      "type": "boolean",
      "default": false
    },
    "format": {
      "type": "string",
      "enum": ["json", "summary"],
      "default": "summary"
    }
  }
}

Response:

{
  "category": "all",
  "timeRange": "all",
  "summary": {
    "totalOperations": 1547,
    "successRate": 0.89,
    "avgQuality": 0.85,
    "patternsLearned": 156
  },
  "routing": {
    "totalRoutes": 423,
    "avgConfidence": 0.84,
    "topAgents": [
      { "agent": "coder", "count": 189, "successRate": 0.91 },
      { "agent": "tester", "count": 87, "successRate": 0.88 },
      { "agent": "reviewer", "count": 65, "successRate": 0.92 }
    ]
  },
  "edits": {
    "totalEdits": 756,
    "successRate": 0.93,
    "commonPatterns": ["TypeScript modification", "Test file creation"]
  },
  "commands": {
    "totalCommands": 368,
    "successRate": 0.82,
    "avgExecutionTime": 2340,
    "commonCommands": ["npm test", "npm run build", "git status"]
  }
}

hooks/list

List registered hooks with filtering.

Input Schema:

{
  "type": "object",
  "properties": {
    "category": {
      "type": "string",
      "enum": ["all", "pre-edit", "post-edit", "pre-command", "post-command", "routing"],
      "default": "all"
    },
    "includeDisabled": {
      "type": "boolean",
      "default": false
    },
    "includeMetadata": {
      "type": "boolean",
      "default": true
    }
  }
}

Response:

{
  "hooks": [
    {
      "name": "pre-edit-validation",
      "category": "pre-edit",
      "enabled": true,
      "priority": 100,
      "executionCount": 1523,
      "lastExecuted": "2025-01-05T11:55:00.000Z",
      "metadata": {
        "version": "1.0.0",
        "reasoningBankEnabled": true
      }
    },
    {
      "name": "intelligent-routing",
      "category": "routing",
      "enabled": true,
      "priority": 100,
      "executionCount": 423,
      "lastExecuted": "2025-01-05T11:58:00.000Z",
      "metadata": {
        "version": "1.0.0",
        "reasoningBankEnabled": true,
        "agentdbEnabled": true
      }
    }
  ],
  "total": 5,
  "byCategory": {
    "pre-edit": 1,
    "post-edit": 1,
    "pre-command": 1,
    "post-command": 1,
    "routing": 1
  }
}

Tool Categories and Tags

All hooks tools are categorized and tagged for discovery:

Tool Category Tags
hooks/pre-edit hooks hooks, pre-edit, learning, reasoningbank
hooks/post-edit hooks hooks, post-edit, learning, reasoningbank
hooks/pre-command hooks hooks, pre-command, safety, risk-assessment
hooks/post-command hooks hooks, post-command, learning, reasoningbank
hooks/route hooks hooks, routing, ai, reasoningbank, learning
hooks/explain hooks hooks, routing, explanation, transparency
hooks/pretrain hooks hooks, pretraining, intelligence, reasoningbank
hooks/metrics hooks hooks, metrics, analytics, performance
hooks/list hooks hooks, list, registry

Caching

Some tools support caching for improved performance:

Tool Cacheable Cache TTL
hooks/route Yes 5000ms
hooks/explain Yes 5000ms
hooks/metrics Yes 10000ms
hooks/list Yes 5000ms