Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(plugins): hooks per-plugin layout β€” ruflo-core install now loads hooks (#1748 Issue 1) (#1754)

rUva002ae49a606
diff --git a/plugins/ruflo-core/README.md b/plugins/ruflo-core/README.md
index 3fa7236d61..4e4666722d 100644
--- a/plugins/ruflo-core/README.md
+++ b/plugins/ruflo-core/README.md
@@ -15,7 +15,7 @@ Foundation plugin. Registers the `ruflo` MCP server (300+ tools), provides three
- **CLI Commands**: 26 commands with 140+ subcommands for agent orchestration
- **3-Tier Model Routing**: Agent Booster (WASM), Haiku, Sonnet/Opus with automatic cost optimization
- **Session Management**: Persistent sessions with cross-conversation learning
-- **Hooks System**: 17 hooks + 12 background workers for self-learning automation
+- **Hooks**: PreToolUse / PostToolUse / PreCompact / Stop wired to claude-flow's auto-routing + learning loop. Defined at `plugins/ruflo-core/hooks/hooks.json` so the per-plugin loader picks them up on `/plugin install ruflo-core@ruflo` (per-plugin layout β€” fixes #1748 Issue 1; the marketplace-root copy at `.claude-plugin/hooks/hooks.json` is preserved for `claude --plugin-dir <repo-root>` users).
## Configuration
diff --git a/plugins/ruflo-core/hooks/hooks.json b/plugins/ruflo-core/hooks/hooks.json
new file mode 100644
index 0000000000..ecaa90a6f2
--- /dev/null
+++ b/plugins/ruflo-core/hooks/hooks.json
@@ -0,0 +1,74 @@
+{
+ "hooks": {
+ "PreToolUse": [
+ {
+ "matcher": "Bash",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | npx claude-flow@alpha hooks modify-bash"
+ }
+ ]
+ },
+ {
+ "matcher": "Write|Edit|MultiEdit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | npx claude-flow@alpha hooks modify-file"
+ }
+ ]
+ }
+ ],
+ "PostToolUse": [
+ {
+ "matcher": "Bash",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true"
+ }
+ ]
+ },
+ {
+ "matcher": "Write|Edit|MultiEdit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-edit --file '{}' --format true --update-memory true"
+ }
+ ]
+ }
+ ],
+ "PreCompact": [
+ {
+ "matcher": "manual",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"πŸ”„ PreCompact Guidance:\"; echo \"πŸ“‹ IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" β€’ 54 available agents and concurrent usage patterns\"; echo \" β€’ Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" β€’ SPARC methodology workflows with batchtools optimization\"; echo \" β€’ Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"βœ… Ready for compact operation\"'"
+ }
+ ]
+ },
+ {
+ "matcher": "auto",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "/bin/bash -c 'echo \"πŸ”„ Auto-Compact Guidance (Context Window Full):\"; echo \"πŸ“‹ CRITICAL: Before compacting, ensure you understand:\"; echo \" β€’ All 54 agents available in .claude/agents/ directory\"; echo \" β€’ Concurrent execution patterns from CLAUDE.md\"; echo \" β€’ Batchtools optimization for 300% performance gains\"; echo \" β€’ Swarm coordination strategies for complex tasks\"; echo \"⚑ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"βœ… Auto-compact proceeding with full agent context\"'"
+ }
+ ]
+ }
+ ],
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true"
+ }
+ ]
+ }
+ ]
+ }
+}