fix: update the templates used by init to use correct claude code syntax and IO#238
fix: update the templates used by init to use correct claude code syntax and IO#238jimweller wants to merge 2 commits intoruvnet:mainfrom
Conversation
…ooks syntax and IO
|
I'll take a look later. Thanks for doing this. Feel free to join our WhatsApp group to discuss: |
|
Is seems like some mcp settings are mixed into the "features": {
"autoTopologySelection": true,
"parallelExecution": true,
"neuralTraining": true,
"bottleneckAnalysis": true,
"smartAutoSpawning": true,
"selfHealingWorkflows": true,
"crossSessionMemory": true,
"githubIntegration": true
},
"performance": {
"maxAgents": 10,
"defaultTopology": "hierarchical",
"executionStrategy": "parallel",
"tokenOptimization": true,
"cacheEnabled": true,
"telemetryLevel": "detailed"
} |
|
Similar issue in that mcpServers is not a directive for settings.json. It can get confusing fast because of the Buuuut it seems like "enabledMcpjsonServers": [
"claude-flow"
],So I think we need init to handle
PS You can easily get conflicts where claude has stored an mcp server in your user+project settings in ~/.claude.json. So that should be cleaned before experimenting with this stuff. |
|
|
…laude/settings.local.json such that the mcp servers are trusted even with --dangerously-skip-permissions
|
Hooks are working now at least. I see records in hive.db:memory_entries. Not sure if this is the PR to do it. I'll wait to talk to some people before taking it out of draft. So we need to dial this stuff in:
[start with a clean folder]
node ~/Projects/personal/claude-flow/src/cli/simple-cli.js init --force
node ~/Projects/personal/claude-flow/src/cli/simple-cli.js hive-mind init --force
[change settings.json file to @alpha version]
node ~/Projects/personal/claude-flow/src/cli/simple-cli.js hive-mind spawn "make a calculator webpage" --queenType strategic --workerTypes researcher,coder,analyst,tester --maxWorkers 5 --monitor --claude |
|
@jimweller does this fix all the agents just pemrnantly being idle? |
|
I'm not 100% certain. You can check out the branch and try the sequence from my last comment with your use case. As I spelunk the code, the flow is not super clear or consistent. It seems like "hive-mind wizard" is the happy path. And claude will try to achieve the goal even if claude-flow isn't working. So it can be really hard to tell. But before this change "hive-mind spawn" didn't seem to do anything. There's still other coherence problems like the hooks using "notification" vs "notify" or camel case vs kebab case cli switches. I'm mostly here to follow along, learn, and help where I can. |
|
Thank you for this PR! The hook format updates are definitely needed for Claude Code v1.0.51+ compatibility. ✅ What works well:
|
For me it doesn't seem to work at all when i try to use the wizard for some reason, claude code just doesn't seem to be getting prompted correctly for me. |
1 mcpServers don't go in settings.json anymore. It's not part of the schema. Claude code throws an error. It belongs in .mcp.json wth appropriate permissions in settings.local.json.https://docs.anthropic.com/en/docs/claude-code/settings#available-settings ❯ claude mcp add -s project echoMcp -- echo "Hi there"
Added stdio MCP server echoMcp with command: echo Hi there to project config
❯ cat .mcp.json
{
"mcpServers": {
"echoMcp": {
"type": "stdio",
"command": "echo",
"args": [
"Hi there"
],
"env": {}
}
}
}2 I would handle that with documentation since I would expect any developer using this tool to have jq installed.3 I'm not sure exactly where those settings go. I think they are subordinate to claude-flow. They are definitely no claude-code top level configurations that would belong on the settings.json file.I'll keep working on it as time permits and look forward to chatting about it in whatsapp. |
|
Hi @jimweller! 👋 Thank you so much for this PR! You identified the exact same hooks format issue we were working on - great minds think alike! I really appreciate you digging into the Claude Code documentation and figuring out the JSON stdin approach with Good news and timingWe just merged a similar fix a few minutes ago (commit 9f2d77f) that addresses the same compatibility issues. Our approach uses template variables instead of JSON parsing, which avoids the What I love about your PRThe Coming soonWe're working on several related improvements:
Next stepsSince we've already merged the core fix, I'll close this PR, but please know that your contribution helped validate our approach and provided valuable insights. The MCP trust configuration you added will definitely make it into the next release! Feel free to test out the latest alpha version with the migration script: npm install -g claude-flow@alpha
npx claude-flow@alpha migrate-hooksThanks again for your contribution and for helping make Claude Flow better! 🚀 |
|
closing. thanks for your help on this.. not a bot. |
|
There's one more fix in this PR you should explore. Everything after this line does not belong in settings.json. You also need to check the Cheers |
i see the same thing for my setups. One thing thats also interesting to understand better (might be my own understanding) is that its unclear if mcp servers are installed to the claude home settings and not project settings and if this might be earlier version of claude flow that has installed the mcp servers globally. Note that i am running in devdontainers but i use a shared claude home directory across those. |
I'm running in devcontainers too. And I'm cognizant of keeping ~/.claude.json and ~/.claude SUPER clean. I'm trying to keep all the claude-code and claude-flow tools isolated to the project folder I'm working in. |
The claude code hook json format seems to have changed very recently. Hook commands get a json payload from stdin. In order to populate the
npx claude-flow...commands we need to extract the fields that we need from the payload.https://docs.anthropic.com/en/docs/claude-code/hooks
The old init command was generating syntax that claude code v1.0.51 did not accept and doctor said
└ hooks
├ postCommandHook: Expected array, but received object
├ postEditHook: Expected array, but received object
├ preCommandHook: Expected array, but received object
├ preEditHook: Expected array, but received object
└ sessionEndHook: Expected array, but received object