π 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(init): #2206 #2207 #2208 β wizard server key, init detector, CLAUDE.md backup (#2214)
rUv02aa8ed5391c
diff --git a/.github/workflows/v3-ci.yml b/.github/workflows/v3-ci.ymlindex 843c204ffb..69e58b6932 100644--- a/.github/workflows/v3-ci.yml+++ b/.github/workflows/v3-ci.yml@@ -143,6 +143,10 @@ on:- 'v3/@claude-flow/cli/src/init/statusline-generator.ts'- '.claude/helpers/statusline.cjs'- 'scripts/smoke-statusline-generator-delegation.mjs'+ # wizard init regression guard (#2206 #2207 #2208)+ - 'v3/@claude-flow/cli/src/init/mcp-generator.ts'+ - 'v3/@claude-flow/cli/src/init/executor.ts'+ - 'scripts/smoke-wizard-init-regression.mjs'pull_request:branches: [main, develop]paths:@@ -245,6 +249,10 @@ on:- 'v3/@claude-flow/cli/src/init/statusline-generator.ts'- '.claude/helpers/statusline.cjs'- 'scripts/smoke-statusline-generator-delegation.mjs'+ # wizard init regression guard (#2206 #2207 #2208)+ - 'v3/@claude-flow/cli/src/init/mcp-generator.ts'+ - 'v3/@claude-flow/cli/src/init/executor.ts'+ - 'scripts/smoke-wizard-init-regression.mjs'workflow_dispatch:env:@@ -2413,3 +2421,161 @@ jobs:- name: Guard 2 β smoke: generate .cjs and validate output rangesshell: bashrun: node scripts/smoke-statusline-generator-delegation.mjs++ wizard-init-regression-guard:+ # Regression guard for ruvnet/ruflo#2206 #2207 #2208 β three init-wizard+ # bugs that collectively broke every new user install:+ #+ # #2206: mcp-generator registered the server under key 'ruflo', causing all+ # 33 ruflo plugins to fail with "Unknown tool mcp__claude-flow__*".+ # The key must be 'claude-flow'; the command args (ruflo@latest) are+ # correct and must NOT change.+ #+ # #2207: detectExistingRufloMCP only checked for 'ruflo' in mcpServers.+ # After #2206, the key becomes 'claude-flow', so the detector would+ # NEVER recognise a prior install. Both keys must be accepted. Also+ # guarded: bare .claude/settings.json must NOT be a false positive.+ #+ # #2208: init --force silently destroyed existing CLAUDE.md without backup,+ # causing data loss. A .pre-ruflo backup must be created before+ # any overwrite; timestamped fallback when a backup already exists.+ #+ # Three guards (static + runtime each):+ # [1/3] STATIC #2206 β mcp-generator source must write 'claude-flow' key+ # [2/3] RUNTIME #2206 + #2208 β build CLI, run init in tmp dir, assert+ # .mcp.json has 'claude-flow' key and CLAUDE.md.pre-ruflo was created+ # [3/3] RUNTIME #2207 β bare .claude/settings.json must NOT trigger+ # the duplicate-detection guard (false-positive check)+ name: wizard init regression guard (#2206 #2207 #2208)+ runs-on: ubuntu-latest++ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: '22'++ - name: Guard 1 β static #2206 server key contract+ shell: bash+ run: |+ echo "=== Guard 1: mcp-generator must write the claude-flow key ==="++ echo "Checking mcp-generator uses 'claude-flow' as the server key..."+ grep -qE "mcpServers\['claude-flow'\]|mcpServers\[\"claude-flow\"\]" \+ v3/@claude-flow/cli/src/init/mcp-generator.ts \+ || { echo "::error::mcp-generator no longer writes 'claude-flow' server key β #2206 regression"; exit 1; }+ echo "ok: 'claude-flow' key found"++ echo "Checking mcp-generator does NOT use bare 'ruflo' as the server key..."+ ! grep -qE "mcpServers\['ruflo'\]|mcpServers\[\"ruflo\"\]" \+ v3/@claude-flow/cli/src/init/mcp-generator.ts \+ || { echo "::error::mcp-generator writes 'ruflo' server key β breaks mcp__claude-flow__* tool naming (#2206)"; exit 1; }+ echo "ok: bare 'ruflo' server key absent"++ echo "Checking command args still invoke ruflo@latest (must NOT change)..."+ grep -q "ruflo@latest" v3/@claude-flow/cli/src/init/mcp-generator.ts \+ || { echo "::error::mcp-generator no longer invokes ruflo@latest β command args must be preserved (#2206)"; exit 1; }+ echo "ok: ruflo@latest invocation present"++ echo "Guard 1 passed."++ - name: Setup pnpm+ uses: pnpm/action-setup@v6+ with:+ version: ${{ env.PNPM_VERSION }}++ - name: Install and build CLI+ working-directory: v3+ run: |+ pnpm install --frozen-lockfile+ pnpm --recursive --no-bail run build || true+ test -f @claude-flow/cli/dist/src/init/executor.js \+ || { echo "::error::executor.js not built β CLI build failed"; exit 1; }+ test -f @claude-flow/cli/dist/src/init/mcp-generator.js \+ || { echo "::error::mcp-generator.js not built"; exit 1; }++ - name: Guard 2 β runtime #2206 server key + #2208 CLAUDE.md backup+ shell: bash+ run: |+ echo "=== Guard 2: generated .mcp.json key and CLAUDE.md backup ==="++ TMP=$(mktemp -d)+ cd "$TMP"++ # Seed CLAUDE.md with sentinel content so #2208 backup is observable+ printf '# Sentinel Project Content β do not lose\n' > CLAUDE.md++ # Run init --force (non-interactive); ignore non-zero exit from+ # optional components that need extra deps (skills, helpers, etc.)+ HOME="$TMP" node "$GITHUB_WORKSPACE/v3/@claude-flow/cli/dist/cli.js" \+ init --force 2>&1 || true++ echo "--- .mcp.json contents ---"+ cat .mcp.json 2>/dev/null || echo "(not found)"++ # #2206: 'claude-flow' key must exist+ node -e "+ const cfg = JSON.parse(require('fs').readFileSync('.mcp.json','utf-8'));+ if (!cfg.mcpServers || !('claude-flow' in cfg.mcpServers)) {+ console.error('FAIL: .mcp.json missing claude-flow server key (#2206)');+ process.exit(1);+ }+ console.log('ok: claude-flow key present in .mcp.json');+ " || { echo "::error::generated .mcp.json missing 'claude-flow' server key (#2206)"; exit 1; }++ # #2206: stray 'ruflo' key must NOT exist+ node -e "+ const cfg = JSON.parse(require('fs').readFileSync('.mcp.json','utf-8'));+ if (cfg.mcpServers && 'ruflo' in cfg.mcpServers) {+ console.error('FAIL: .mcp.json has stray ruflo server key (#2206)');+ process.exit(1);+ }+ console.log('ok: stray ruflo key absent');+ " || { echo "::error::generated .mcp.json has stray 'ruflo' server key (#2206)"; exit 1; }++ # #2208: CLAUDE.md.pre-ruflo backup must exist with sentinel content+ BACKUP=$(ls CLAUDE.md.pre-ruflo* 2>/dev/null | head -1)+ if [ -z "$BACKUP" ]; then+ echo "::error::init --force did not create CLAUDE.md.pre-ruflo backup (#2208)"+ exit 1+ fi+ echo "ok: backup file created: $BACKUP"+ grep -q "Sentinel Project Content" "$BACKUP" \+ || { echo "::error::CLAUDE.md backup missing original sentinel content (#2208)"; exit 1; }+ echo "ok: backup contains original content"++ echo "Guard 2 passed."++ - name: Guard 3 β runtime #2207 false-positive check+ shell: bash+ run: |+ echo "=== Guard 3: bare .claude/settings.json must NOT trigger duplicate detection ==="++ TMP=$(mktemp -d)+ cd "$TMP"++ # Simulate Claude Code's own project settings.json with NO ruflo registration+ mkdir -p .claude+ echo '{"env": {}, "hooks": {}}' > .claude/settings.json++ # Run init WITHOUT --force; use a custom HOME with no ~/.claude.json+ # so the real user's global config doesn't interfere+ FAKE_HOME=$(mktemp -d)+ OUT=$(HOME="$FAKE_HOME" node "$GITHUB_WORKSPACE/v3/@claude-flow/cli/dist/cli.js" \+ init 2>&1 || true)++ echo "--- init output ---"+ echo "$OUT"++ # The init must NOT claim "already initialized" due to the bare settings.json+ if echo "$OUT" | grep -qi "existing 'ruflo' MCP registration\|existing 'claude-flow' MCP registration"; then+ echo "::error::init false-positives on bare .claude/settings.json (#2207)"+ exit 1+ fi+ echo "ok: no false-positive on bare .claude/settings.json"++ rm -rf "$FAKE_HOME"+ echo "Guard 3 passed."diff --git a/docs/benchmarks/runs/gaia-l1-iter63b-convergence-n2.json b/docs/benchmarks/runs/gaia-l1-iter63b-convergence-n2.jsonnew file mode 100644index 0000000000..37813b09ee--- /dev/null+++ b/docs/benchmarks/runs/gaia-l1-iter63b-convergence-n2.json@@ -0,0 +1,703 @@+{+ "level": 1,+ "model": "claude-sonnet-4-6",+ "summary": {+ "total": 53,+ "passed": 31,+ "passRate": 0.5849056603773585,+ "estCostUsd": 3.6948300000000005,+ "meanTurns": 4.415094339622642,+ "meanWallMs": 42182.11320754717+ },+ "results": [+ {+ "task_id": "e1fc63a2-da7a-432f-be78-7c4a95598703",+ "question": "If Eliud Kipchoge could maintain his record-making marathon pace indefinitely, how many thousand hours would it take him to run the distance between the Earth and the Moon its closest approach? Please use the minimum perigee value on the Wikipedia page for the Moon when carrying out your calculation. Round your result to the nearest 1000 hours and do not use any comma separators if necessary.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "17000",+ "expected_output": "17",+ "turns": 5,+ "wallMs": 41030,+ "inputTokens": 13877,+ "outputTokens": 901,+ "decomposed": false+ },+ {+ "task_id": "8e867cd7-cff9-4e6c-867a-ff5ddc2550be",+ "question": "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "3",+ "expected_output": "3",+ "turns": 12,+ "wallMs": 124073,+ "inputTokens": 74216,+ "outputTokens": 1983,+ "decomposed": false+ },+ {+ "task_id": "ec09fa32-d03f-4bf8-84b0-1f16922c3ae4",+ "question": "Here's a fun riddle that I think you'll enjoy.\n\nYou have been selected to play the final round of the hit new game show \"Pick That Ping-Pong\". In this round, you will be competing for a large cash prize. Your job will be to pick one of several different numbered ping-pong balls, and then the game will commence. The host describes how the game works.\n\nA device consisting of a winding clear ramp and a series of pistons controls the outcome of the game. The ramp feeds balls onto a platform. The platform has room for three ping-pong balls at a time. The three balls on the platform are each aligned with one of three pistons. At each stage of the game, one of the three pistons will randomly fire, ejecting the ball it strikes. If the piston ejects the ball in the first position on the platform the balls in the second and third position on the platform each advance one space, and the next ball on the ramp advances to the third position. If the piston ejects the ball in the second position, the ball in the first position is released and rolls away, the ball in the third position advances two spaces to occupy the first position, and the next two balls on the ramp advance to occupy the second and third positions on the platform. If the piston ejects the ball in the third position, the ball in the first position is released and rolls away, the ball in the second position advances one space to occupy the first position, and the next two balls on the ramp advance to occupy the second and third positions on the platform.\n\nThe ramp begins with 100 numbered ping-pong balls, arranged in ascending order from 1 to 100. The host activates the machine and the first three balls, numbered 1, 2, and 3, advance to the platform. Before the random firing of the pistons begins, you are asked which of the 100 balls you would like to pick. If your pick is ejected by one of the pistons, you win the grand prize, $10,000.\n\nWhich ball should you choose to maximize your odds of winning the big prize? Please provide your answer as the number of the ball selected.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "3",+ "turns": 2,+ "wallMs": 46193,+ "inputTokens": 3845,+ "outputTokens": 2475,+ "decomposed": false+ },+ {+ "task_id": "5d0080cb-90d7-4712-bc33-848150e917d3",+ "question": "What was the volume in m^3 of the fish bag that was calculated in the University of Leicester paper \"Can Hiccup Supply Enough Fish to Maintain a Dragonβs Diet?\"",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "0.1777 mΒ³",+ "expected_output": "0.1777",+ "turns": 3,+ "wallMs": 15112,+ "inputTokens": 4673,+ "outputTokens": 176,+ "decomposed": false+ },+ {+ "task_id": "a1e91b78-d3d8-4675-bb8d-62741b4b68a6",+ "question": "In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "14",+ "expected_output": "3",+ "turns": 3,+ "wallMs": 15442,+ "inputTokens": 4601,+ "outputTokens": 160,+ "decomposed": false+ },+ {+ "task_id": "46719c30-f4c3-4cad-be07-d5cb21eee6bb",+ "question": "Of the authors (First M. Last) that worked on the paper \"Pie Menus or Linear Menus, Which Is Better?\" in 2015, what was the title of the first paper authored by the one that had authored prior papers?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Mapping Human-Oriented Information to Software Agents for Online Systems Usage",+ "expected_output": "Mapping Human Oriented Information to Software Agents for Online Systems Usage",+ "turns": 5,+ "wallMs": 48151,+ "inputTokens": 15037,+ "outputTokens": 739,+ "decomposed": false+ },+ {+ "task_id": "4b6bb5f7-f634-410e-815d-e673ab7f8632",+ "question": "In Series 9, Episode 11 of Doctor Who, the Doctor is trapped inside an ever-shifting maze. What is this location called in the official script for the episode? Give the setting exactly as it appears in the first scene heading.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "INT. THE CASTLE - DAY",+ "expected_output": "THE CASTLE",+ "turns": 5,+ "wallMs": 33527,+ "inputTokens": 9385,+ "outputTokens": 535,+ "decomposed": false+ },+ {+ "task_id": "cffe0e32-c9a6-4c52-9877-78ceb4aaa9fb",+ "question": "An office held a Secret Santa gift exchange where each of its twelve employees was assigned one other employee in the group to present with a gift. Each employee filled out a profile including three likes or hobbies. On the day of the gift exchange, only eleven gifts were given, each one specific to one of the recipient's interests. Based on the information in the document, who did not give a gift?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Nora",+ "expected_output": "Fred",+ "turns": 12,+ "wallMs": 119030,+ "inputTokens": 63635,+ "outputTokens": 2299,+ "decomposed": false+ },+ {+ "task_id": "2d83110e-a098-4ebb-9987-066c06fa42d0",+ "question": ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "Right",+ "turns": 1,+ "wallMs": 2377,+ "inputTokens": 1297,+ "outputTokens": 1,+ "decomposed": false+ },+ {+ "task_id": "5cfb274c-0207-4aa7-9575-6ac0bd95d9b2",+ "question": "Each cell in the attached spreadsheet represents a plot of land. The color of the cell indicates who owns that plot. Green cells are plots owned by Earl Smith. Can Earl walk through every plot he owns (and no other plots) and return to his starting plot without backtracking? For this question, consider backtracking to be any instance where Earl would enter a plot of land he had already entered since leaving his starting plot.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "No",+ "turns": 2,+ "wallMs": 29594,+ "inputTokens": 4460,+ "outputTokens": 2157,+ "decomposed": false+ },+ {+ "task_id": "27d5d136-8563-469e-92bf-fd103c28b57c",+ "question": "Β¬(A β§ B) β (Β¬A β¨ Β¬B)\nΒ¬(A β¨ B) β (Β¬A β§ Β¬B)\n(A β B) β (Β¬B β Β¬A)\n(A β B) β (Β¬A β¨ B)\n(Β¬A β B) β (A β¨ Β¬B)\nΒ¬(A β B) β (A β§ Β¬B)\n\nWhich of the above is not logically equivalent to the rest? Provide the full statement that doesn't fit.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "(Β¬A β B) β (A β¨ Β¬B)",+ "expected_output": "(Β¬A β B) β (A β¨ Β¬B)",+ "turns": 1,+ "wallMs": 15640,+ "inputTokens": 1385,+ "outputTokens": 1156,+ "decomposed": false+ },+ {+ "task_id": "dc28cf18-6431-458b-83ef-64b3ce566c10",+ "question": "My family reunion is this week, and I was assigned the mashed potatoes to bring. The attendees include my married mother and father, my twin brother and his family, my aunt and her family, my grandma and her brother, her brother's daughter, and his daughter's family. All the adults but me have been married, and no one is divorced or remarried, but my grandpa and my grandma's sister-in-law passed away last year. All living spouses are attending. My brother has two children that are still kids, my aunt has one six-year-old, and my grandma's brother's daughter has three kids under 12. I figure each adult will eat about 1.5 potatoes of mashed potatoes and each kid will eat about 1/2 a potato of mashed potatoes, except my second cousins don't eat carbs. The average potato is about half a pound, and potatoes are sold in 5-pound bags. How many whole bags of potatoes do I need? Just give the number.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "2",+ "expected_output": "2",+ "turns": 1,+ "wallMs": 10504,+ "inputTokens": 1444,+ "outputTokens": 606,+ "decomposed": false+ },+ {+ "task_id": "b816bfce-3d80-4913-a07d-69b752ce6377",+ "question": "In Emily Midkiff's June 2014 article in a journal named for the one of Hreidmar's sons that guarded his house, what word was quoted from two different authors in distaste for the nature of dragon depictions?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "fluffy",+ "expected_output": "fluffy",+ "turns": 6,+ "wallMs": 54824,+ "inputTokens": 22074,+ "outputTokens": 867,+ "decomposed": false+ },+ {+ "task_id": "72e110e7-464c-453c-a309-90a95aed6538",+ "question": "Under DDC 633 on Bielefeld University Library's BASE, as of 2020, from what country was the unknown language article with a flag unique from the others?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Nepal",+ "expected_output": "Guatemala",+ "turns": 12,+ "wallMs": 125682,+ "inputTokens": 103646,+ "outputTokens": 2149,+ "decomposed": false+ },+ {+ "task_id": "42576abe-0deb-4869-8c63-225c2d75a95a",+ "question": "In the fictional language of Tizin, basic sentences are arranged with the Verb first, followed by the direct object, followed by the subject of the sentence. I want to express my love for apples to my Tizin friend. \n\nThe word that indicates oneself is \"Pa\" is the nominative form, \"Mato\" is the accusative form, and \"Sing\" is the genitive form. \n\nThe root verb that indicates an intense like for something is \"Maktay\". When it is used in the present, it is used in it's root form, when it is used in the preterit past, it is \"Tay\", and when it is used in the imperfect past, it is \"Aktay\". It is used differently than in English, and is better translated as \"is pleasing to\", meaning that the thing doing the liking is actually the object of the sentence rather than the subject.\n\nThe word for apples is borrowed from English in Tizin, and so it is \"Apple\" is the nominative form, \"Zapple\" is the accusative form, and \"Izapple\" is the genitive form. \n\nPlease translate \"I like apples\" to Tizin.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "Maktay mato apple",+ "turns": 1,+ "wallMs": 6105,+ "inputTokens": 1491,+ "outputTokens": 234,+ "decomposed": false+ },+ {+ "task_id": "b415aba4-4b68-4fc6-9b89-2c812e55a3e1",+ "question": "In Nature journal's Scientific Reports conference proceedings from 2012, in the article that did not mention plasmons or plasmonics, what nano-compound is studied? Don't use the prefix nano in your answer if there is one.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "carbon nanotubes",+ "expected_output": "diamond",+ "turns": 12,+ "wallMs": 152098,+ "inputTokens": 71344,+ "outputTokens": 2349,+ "decomposed": false+ },+ {+ "task_id": "cca530fc-4052-43b2-b130-b30968d8aa44",+ "question": "Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Qh3+",+ "expected_output": "Rd5",+ "turns": 1,+ "wallMs": 14811,+ "inputTokens": 2044,+ "outputTokens": 687,+ "decomposed": false+ },+ {+ "task_id": "935e2cff-ae78-4218-b3f5-115589b19dae",+ "question": "In the year 2022, and before December, what does \"R\" stand for in the three core policies of the type of content that was violated in the public logs on the Legume Wikipedia page?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Research",+ "expected_output": "research",+ "turns": 12,+ "wallMs": 126107,+ "inputTokens": 58638,+ "outputTokens": 1887,+ "decomposed": false+ },+ {+ "task_id": "4fc2f1ae-8625-45b5-ab34-ad4433bc21f8",+ "question": "Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "FunkMonk",+ "expected_output": "FunkMonk",+ "turns": 4,+ "wallMs": 24334,+ "inputTokens": 7284,+ "outputTokens": 331,+ "decomposed": false+ },+ {+ "task_id": "5188369a-3bbe-43d8-8b94-11558f909a08",+ "question": "What writer is quoted by Merriam-Webster for the Word of the Day from June 27, 2022?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Annie Levin",+ "expected_output": "Annie Levin",+ "turns": 10,+ "wallMs": 68359,+ "inputTokens": 25800,+ "outputTokens": 1165,+ "decomposed": false+ },+ {+ "task_id": "6f37996b-2ac7-44b0-8e68-6d28256631b4",+ "question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "b, e",+ "expected_output": "b, e",+ "turns": 1,+ "wallMs": 7558,+ "inputTokens": 1374,+ "outputTokens": 502,+ "decomposed": false+ },+ {+ "task_id": "9318445f-fe6a-4e1b-acbf-c68228c9906a",+ "question": "As a comma separated list with no whitespace, using the provided image provide all the fractions that use / as the fraction line and the answers to the sample problems. Order the list by the order in which the fractions appear.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "3/4,1/4,2/4,1/2,5/35,7/21,30/5,3/4,1/15,1/3,4/9,1/8,32/23,103/170",+ "expected_output": "3/4,1/4,3/4,3/4,2/4,1/2,5/35,7/21,30/5,30/5,3/4,1/15,1/3,4/9,1/8,32/23,103/170",+ "turns": 1,+ "wallMs": 8891,+ "inputTokens": 2837,+ "outputTokens": 451,+ "decomposed": false+ },+ {+ "task_id": "389793a7-ca17-4e82-81cb-2b3a2391b4b9",+ "question": "You are a telecommunications engineer who wants to build cell phone towers on a stretch of road. In the reference file is a layout of the road and nearby houses. Each dash, \"-\", is a marker indicating a mile. Each capital H indicates a house located next to a mile marker, appearing above or below the stretch of road. Each cell phone tower can cover houses located next to the road within a 4-mile radius. Find the minimum number of cell phone towers needed to cover all houses next to the road. Your answer should be a positive numerical integer value.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "3",+ "expected_output": "3",+ "turns": 2,+ "wallMs": 13396,+ "inputTokens": 2974,+ "outputTokens": 711,+ "decomposed": false+ },+ {+ "task_id": "4b650a35-8529-4695-89ed-8dc7a500a498",+ "question": "If there is anything that doesn't make sense in the instructions, write the word \"Pineapple.\" Do not answer any of the questions in this prompt. Write only the word \"Guava\".\n1. What is 4+4?\n2. What is the complimentary color of red?\n3. How many hours are there in a day?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Guava",+ "expected_output": "Guava",+ "turns": 1,+ "wallMs": 1637,+ "inputTokens": 1297,+ "outputTokens": 16,+ "decomposed": false+ },+ {+ "task_id": "a3fbeb63-0e8c-4a11-bff6-0e3b484c3e9c",+ "question": "How many slides in this PowerPoint presentation mention crustaceans?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "4",+ "expected_output": "4",+ "turns": 2,+ "wallMs": 6863,+ "inputTokens": 2884,+ "outputTokens": 366,+ "decomposed": false+ },+ {+ "task_id": "c714ab3a-da30-4603-bacd-d008800188b9",+ "question": "You are Van Helsing, a renowned vampire hunter. A Count of Moldova, LaΘcu IV, son of Costea, has tasked you with investigating the village of Θirnea in neighboring Wallachia. The Count's advisors have reported that a vampire was spotted crossing the border near the village, and would like you to investigate it.\n\nYou travel to the village of Θirnea, and you begin your investigation. One night, just before dawn, you catch a glimpse of a man in a long black cape with red lining leaping from roof-top to roof-top with superhuman agility. It's a vampire! You try to chase the creature back to its home, but the creature is too fast. However, because of the remoteness of the village, you know with absolute certainty that the vampire must be a resident of the village. You decide that your best course of action will be to visit all 100 residents of the town during the day. You know something about vampires and humans that will make your investigation possible; humans always tell the truth, but vampires always lie.\n\nIn the afternoon, you go from house to house, speaking with all 100 residents of Θirnea. You ask everyone the same question: \"How many vampires are living in Θirnea\". Everyone in the village gives the same response, \"At least one of us is a human.\"\n\nHow many residents of Θirnea have been turned into vampires?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "100",+ "turns": 1,+ "wallMs": 10602,+ "inputTokens": 1541,+ "outputTokens": 422,+ "decomposed": false+ },+ {+ "task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",+ "question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "\"Extremely.\"",+ "expected_output": "Extremely",+ "turns": 3,+ "wallMs": 14613,+ "inputTokens": 5463,+ "outputTokens": 216,+ "decomposed": false+ },+ {+ "task_id": "65afbc8a-89ca-4ad5-8d62-355bb401f61d",+ "question": "You are given this Excel file as a map. You start on the START cell and move toward the END cell. You are allowed to move two cells per turn, and you may move up, down, left, or right. You may not move fewer than two cells, and you may not move backward. You must avoid moving onto any blue cells. On the eleventh turn, what is the 6-digit hex code (without prefix) of the color of the cell where you land after moving?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "F478A7",+ "turns": 4,+ "wallMs": 85499,+ "inputTokens": 19776,+ "outputTokens": 4796,+ "decomposed": false+ },+ {+ "task_id": "cabe07ed-9eca-40ea-8ead-410ef5e83f91",+ "question": "What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Romero",+ "expected_output": "Louvrier",+ "turns": 12,+ "wallMs": 109474,+ "inputTokens": 68771,+ "outputTokens": 2166,+ "decomposed": false+ },+ {+ "task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",+ "question": "I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:\n\nmilk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts\n\nI need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "broccoli, celery, fresh basil, lettuce, sweet potatoes",+ "expected_output": "broccoli, celery, fresh basil, lettuce, sweet potatoes",+ "turns": 2,+ "wallMs": 19480,+ "inputTokens": 8086,+ "outputTokens": 569,+ "decomposed": false+ },+ {+ "task_id": "99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3",+ "question": "Hi, I'm making a pie but I could use some help with my shopping list. I have everything I need for the crust, but I'm not sure about the filling. I got the recipe from my friend Aditi, but she left it as a voice memo and the speaker on my phone is buzzing so I can't quite make out what she's saying. Could you please listen to the recipe and list all of the ingredients that my friend described? I only want the ingredients for the filling, as I have everything I need to make my favorite pie crust. I've attached the recipe as Strawberry pie.mp3.\n\nIn your response, please only list the ingredients, not any measurements. So if the recipe calls for \"a pinch of salt\" or \"two cups of ripe strawberries\" the ingredients on the list would be \"salt\" and \"ripe strawberries\".\n\nPlease format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "cornstarch, granulated sugar, freshly squeezed lemon juice, pure vanilla extract, ripe strawberries",+ "expected_output": "cornstarch, freshly squeezed lemon juice, granulated sugar, pure vanilla extract, ripe strawberries",+ "turns": 2,+ "wallMs": 6071,+ "inputTokens": 3241,+ "outputTokens": 198,+ "decomposed": false+ },+ {+ "task_id": "d0633230-7067-47a9-9dbf-ee11e0a2cdd6",+ "question": "In the Scikit-Learn July 2017 changelog, what other predictor base command received a bug fix? Just give the name, not a path.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "predict_proba",+ "expected_output": "BaseLabelPropagation",+ "turns": 12,+ "wallMs": 128050,+ "inputTokens": 72375,+ "outputTokens": 1776,+ "decomposed": false+ },+ {+ "task_id": "305ac316-eef6-4446-960a-92d80d542f82",+ "question": "Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Wojciech",+ "expected_output": "Wojciech",+ "turns": 3,+ "wallMs": 14714,+ "inputTokens": 5186,+ "outputTokens": 234,+ "decomposed": false+ },+ {+ "task_id": "0383a3ee-47a7-41a4-b493-519bdefe0488",+ "question": "On the BBC Earth YouTube video of the Top 5 Silliest Animal Moments, what species of bird is featured?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Penguins (specifically Rockhopper Penguins) are the bird species featured in the BBC Earth YouTube video \"Top 5 Silliest Animal Moments.\"",+ "expected_output": "Rockhopper penguin",+ "turns": 3,+ "wallMs": 18109,+ "inputTokens": 4517,+ "outputTokens": 191,+ "decomposed": false+ },+ {+ "task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",+ "question": "What is the final numeric output from the attached Python code?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "0",+ "expected_output": "0",+ "turns": 2,+ "wallMs": 7433,+ "inputTokens": 2973,+ "outputTokens": 329,+ "decomposed": false+ },+ {+ "task_id": "11af4e1a-5f45-467d-9aeb-46f4bb0bf034",+ "question": "How many more blocks (also denoted as layers) in BERT base encoder than the encoder from the architecture proposed in Attention is All You Need?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "6",+ "expected_output": "6",+ "turns": 2,+ "wallMs": 9783,+ "inputTokens": 4227,+ "outputTokens": 174,+ "decomposed": false+ },+ {+ "task_id": "e142056d-56ab-4352-b091-b56054bd1359",+ "question": "Bob was invited to participate in a game show, and he advanced to the final round. The final round offered Bob the chance to win a large sum by playing a game against the host. The host has 30 shiny prop coins, each of which is worth $1,000 if Bob manages to win them by playing the game. The host hides the coins in three different prize boxes and then shuffles their order. The only rule restricting the host's coin placement is that one box must contain at least 2 coins, and one box must contain 6 more coins than another box. In order to play, Bob must submit three guesses, one guess for the number of coins in each box. The box is then opened and the number of coins is revealed. If Bob's guess is a number greater than the number of coins in the box, Bob earns no coins. If Bob guesses a number equal to or less than the number of coins in the box, Bob wins a number of coins equal to his guess.\n\nIf Bob plays uses the optimal strategy, what's the minimum amount of money he can win from the game?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "$2,000",+ "expected_output": "16000",+ "turns": 1,+ "wallMs": 26339,+ "inputTokens": 1456,+ "outputTokens": 1492,+ "decomposed": false+ },+ {+ "task_id": "50ad0280-0819-4bd9-b275-5de32d3b5bcb",+ "question": "Pull out the sentence in the following 5x7 block of text. Read from left to right and use all of the letters in order:\n\nTHESE\nAGULL\nGLIDE\nDPEAC\nEFULL\nYTOMY\nCHAIR",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "THE SEAGULL GLIDED PEACEFULLY TO MY CHAIR",+ "expected_output": "The seagull glided peacefully to my chair.",+ "turns": 1,+ "wallMs": 3507,+ "inputTokens": 1276,+ "outputTokens": 140,+ "decomposed": false+ },+ {+ "task_id": "7673d772-ef80-4f0f-a602-1bf4485c9b43",+ "question": "On Cornell Law School website's legal information institute, under the fifth section of federal rules alphabetically, what word was deleted in the last amendment to the first rule in the article that has \"witnesses\" in the most titles as of 2021?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "except",+ "expected_output": "inference",+ "turns": 12,+ "wallMs": 149455,+ "inputTokens": 87898,+ "outputTokens": 2514,+ "decomposed": false+ },+ {+ "task_id": "c365c1c7-a3db-4d5e-a9a1-66f56eae7865",+ "question": "Of the cities within the United States where U.S. presidents were born, which two are the farthest apart from the westernmost to the easternmost going east, giving the city names only? Give them to me in alphabetical order, in a comma-separated list",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Honolulu, Quincy",+ "expected_output": "Braintree, Honolulu",+ "turns": 4,+ "wallMs": 60104,+ "inputTokens": 46813,+ "outputTokens": 1112,+ "decomposed": false+ },+ {+ "task_id": "7d4a7d1d-cac6-44a8-96e8-ea9584a70825",+ "question": "According to Girls Who Code, how long did it take in years for the percentage of computer scientists that were women to change by 13% from a starting point of 37%?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "22",+ "expected_output": "22",+ "turns": 6,+ "wallMs": 47884,+ "inputTokens": 21907,+ "outputTokens": 765,+ "decomposed": false+ },+ {+ "task_id": "dc22a632-937f-4e6a-b72f-ba0ff3f5ff97",+ "question": "What was the complete title of the book in which two James Beard Award winners recommended the restaurant where Ali Khan enjoyed a New Mexican staple in his cost-conscious TV show that started in 2015? Write the numbers in plain text if there are some in the title.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Five Hundred Things to Eat Before It's Too Late: And the Very Best Places to Eat Them",+ "expected_output": "Five Hundred Things To Eat Before It's Too Late: and the Very Best Places to Eat Them",+ "turns": 6,+ "wallMs": 42176,+ "inputTokens": 22845,+ "outputTokens": 731,+ "decomposed": false+ },+ {+ "task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",+ "question": "How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "525",+ "expected_output": "519",+ "turns": 3,+ "wallMs": 19152,+ "inputTokens": 5693,+ "outputTokens": 216,+ "decomposed": false+ },+ {+ "task_id": "23dd907f-1261-4488-b21c-e9185af91d5e",+ "question": "In Audre Lordeβs poem βFather Son and Holy Ghostβ, what is the number of the stanza in which some lines are indented?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "4",+ "expected_output": "2",+ "turns": 4,+ "wallMs": 31218,+ "inputTokens": 7627,+ "outputTokens": 397,+ "decomposed": false+ },+ {+ "task_id": "1f975693-876d-457b-a649-393859e79bf3",+ "question": "Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(\n\nCould you please listen to the recording for me and tell me the page numbers I'm supposed to go over? I've attached a file called Homework.mp3 that has the recording. Please provide just the page numbers as a comma-delimited list. And please provide the list in ascending order.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "132, 133, 134, 197, 245",+ "expected_output": "132, 133, 134, 197, 245",+ "turns": 2,+ "wallMs": 7031,+ "inputTokens": 3102,+ "outputTokens": 225,+ "decomposed": false+ },+ {+ "task_id": "840bfca7-4f7b-481a-8794-c560c340185d",+ "question": "On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "80GSFC21M0002",+ "expected_output": "80GSFC21M0002",+ "turns": 7,+ "wallMs": 59093,+ "inputTokens": 19030,+ "outputTokens": 772,+ "decomposed": false+ },+ {+ "task_id": "a0068077-79f4-461a-adfe-75c1a4148545",+ "question": "What was the actual enrollment count of the clinical trial on H. pylori in acne vulgaris patients from Jan-May 2018 as listed on the NIH website?",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "100",+ "expected_output": "90",+ "turns": 8,+ "wallMs": 98897,+ "inputTokens": 24311,+ "outputTokens": 834,+ "decomposed": false+ },+ {+ "task_id": "bda648d7-d618-4883-88f4-3466eabd860e",+ "question": "Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Saint Petersburg",+ "expected_output": "Saint Petersburg",+ "turns": 2,+ "wallMs": 10255,+ "inputTokens": 3321,+ "outputTokens": 139,+ "decomposed": false+ },+ {+ "task_id": "50ec8903-b81f-4257-9450-1085afd2c319",+ "question": "A standard Rubikβs cube has been broken into cubes making up its sides. The cubes are jumbled, and one is removed. There are 6 cubes with one colored face, 12 edge cubes with two colored faces, and 8 corner cubes with three colored faces. All blue cubes have been found. All cubes directly left, right, above, and below the orange center cube have been found, along with the center cube. The green corners have all been found, along with all green that borders yellow. For all orange cubes found, the opposite faceβs cubes have been found. The removed cube has two colors on its faces. What are they? Answer using a comma separated list, with the colors ordered alphabetically.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "",+ "expected_output": "green, white",+ "turns": 2,+ "wallMs": 43397,+ "inputTokens": 3294,+ "outputTokens": 2138,+ "decomposed": false+ },+ {+ "task_id": "cf106601-ab4f-4af9-b045-5295fe67b37d",+ "question": "What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "CUB",+ "expected_output": "CUB",+ "turns": 3,+ "wallMs": 20798,+ "inputTokens": 7486,+ "outputTokens": 298,+ "decomposed": false+ },+ {+ "task_id": "a0c07678-e491-4bbc-8f0b-07405144218f",+ "question": "Who are the pitchers with the number before and after TaishΕ Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",+ "model": "claude-sonnet-4-6",+ "correct": false,+ "answer": "Yamasaki, Uehara",+ "expected_output": "Yoshida, Uehara",+ "turns": 5,+ "wallMs": 47697,+ "inputTokens": 17637,+ "outputTokens": 819,+ "decomposed": false+ },+ {+ "task_id": "7bd855d8-463d-4ed5-93ca-5fe35145f733",+ "question": "The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "$89706.00",+ "expected_output": "89706.00",+ "turns": 2,+ "wallMs": 11008,+ "inputTokens": 3480,+ "outputTokens": 609,+ "decomposed": false+ },+ {+ "task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",+ "question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",+ "model": "claude-sonnet-4-6",+ "correct": true,+ "answer": "Claus",+ "expected_output": "Claus",+ "turns": 3,+ "wallMs": 22475,+ "inputTokens": 8991,+ "outputTokens": 374,+ "decomposed": false+ }+ ]+}diff --git a/v3/@claude-flow/cli/__tests__/init-wizard-bugs.test.ts b/v3/@claude-flow/cli/__tests__/init-wizard-bugs.test.tsnew file mode 100644index 0000000000..bd07c0def9--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/init-wizard-bugs.test.ts@@ -0,0 +1,356 @@+/**+ * Init wizard regression tests for #2206, #2207, #2208.+ *+ * #2206 β mcp-generator must register the server under the 'claude-flow' key+ * (not 'ruflo') so all plugins resolve as mcp__claude-flow__*.+ * #2207 β detectExistingRufloMCP must accept both 'claude-flow' and 'ruflo' keys;+ * a bare .claude/settings.json must NOT be a false positive.+ * #2208 β writeClaudeMd (--force) must back up an existing CLAUDE.md to+ * CLAUDE.md.pre-ruflo before overwriting it.+ */++import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';+import { mkdtempSync, writeFileSync, mkdirSync, existsSync, readFileSync, rmSync, readdirSync } from 'fs';+import { tmpdir } from 'os';+import path from 'path';++// βββ #2206: mcp-generator server key βββββββββββββββββββββββββββββββββββββββββ++import { generateMCPConfig, generateMCPCommands } from '../src/init/mcp-generator.js';+import type { InitOptions } from '../src/init/types.js';+import { DEFAULT_INIT_OPTIONS } from '../src/init/types.js';++function makeMCPOptions(overrides: Partial<InitOptions> = {}): InitOptions {+ return {+ ...DEFAULT_INIT_OPTIONS,+ mcp: {+ claudeFlow: true,+ ruvSwarm: false,+ flowNexus: false,+ autoStart: false,+ port: 3000,+ },+ runtime: {+ topology: 'hierarchical',+ maxAgents: 8,+ memoryBackend: 'hybrid',+ enableHNSW: true,+ enableNeural: true,+ },+ ...overrides,+ };+}++describe('#2206 β mcp-generator server key', () => {+ it('registers the ruflo MCP server under the claude-flow key', () => {+ const config = generateMCPConfig(makeMCPOptions()) as { mcpServers: Record<string, unknown> };+ expect(config.mcpServers).toHaveProperty('claude-flow');+ });++ it('does NOT register the server under the bare ruflo key', () => {+ const config = generateMCPConfig(makeMCPOptions()) as { mcpServers: Record<string, unknown> };+ expect(config.mcpServers).not.toHaveProperty('ruflo');+ });++ it('still invokes ruflo@latest mcp start as the command args', () => {+ const config = generateMCPConfig(makeMCPOptions()) as { mcpServers: Record<string, unknown> };+ const entry = config.mcpServers['claude-flow'] as { command: string; args: string[] };+ expect(entry.args).toContain('ruflo@latest');+ expect(entry.args).toContain('mcp');+ expect(entry.args).toContain('start');+ });++ it('generateMCPCommands uses claude-flow as the registration name', () => {+ const cmds = generateMCPCommands(makeMCPOptions());+ expect(cmds.length).toBeGreaterThan(0);+ // Every command that adds the main server must use 'claude-flow', not 'ruflo'+ const mainCmd = cmds.find(c => c.includes('ruflo@latest'));+ expect(mainCmd).toBeDefined();+ expect(mainCmd).toMatch(/claude mcp add claude-flow/);+ expect(mainCmd).not.toMatch(/claude mcp add ruflo\b/);+ });+});++// βββ #2207: detectExistingRufloMCP β both keys + no false positive βββββββββββ+// We test the function indirectly via its effect on writeMCPConfig behaviour.+// Direct export is not available, so we exercise it through executeInit which+// calls writeMCPConfig β detectExistingRufloMCP.++// Mock heavy I/O that executeInit performs (skills/agents/helpers copy) so the+// test only exercises the MCP-detection branch we care about.+vi.mock('node:child_process', () => ({ execSync: vi.fn() }));++describe('#2207 β init detector accepts both server keys', () => {+ let tmp: string;++ beforeEach(() => {+ tmp = mkdtempSync(path.join(tmpdir(), 'wizard-2207-'));+ });++ afterEach(() => {+ rmSync(tmp, { recursive: true, force: true });+ });++ it('detects a prior install registered under the new claude-flow key', async () => {+ // Write a parent .mcp.json with the 'claude-flow' key (post-#2206 install)+ const parentDir = mkdtempSync(path.join(tmpdir(), 'wizard-2207-parent-'));+ try {+ writeFileSync(+ path.join(parentDir, '.mcp.json'),+ JSON.stringify({ mcpServers: { 'claude-flow': { command: 'npx', args: ['-y', 'ruflo@latest', 'mcp', 'start'] } } }),+ );+ // Target is a sub-directory so the parent .mcp.json is in the walk path+ const subDir = path.join(parentDir, 'sub');+ mkdirSync(subDir, { recursive: true });++ // Import executeInit dynamically so the tmp HOME is picked up+ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: subDir,+ force: false,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: true,+ runtime: false,+ claudeMd: false,+ },+ skipGlobalClaudeMd: true,+ };+ const result = await executeInit(opts);+ // Because a 'claude-flow' key was found in the parent .mcp.json, init should+ // skip writing a new .mcp.json (duplicate detection).+ const skipMsg = result.skipped.find(s => s.includes('.mcp.json'));+ expect(skipMsg).toBeDefined();+ } finally {+ rmSync(parentDir, { recursive: true, force: true });+ }+ });++ it('detects a prior install registered under the legacy ruflo key', async () => {+ const parentDir = mkdtempSync(path.join(tmpdir(), 'wizard-2207-legacy-'));+ try {+ writeFileSync(+ path.join(parentDir, '.mcp.json'),+ JSON.stringify({ mcpServers: { ruflo: { command: 'npx', args: ['-y', 'ruflo@latest', 'mcp', 'start'] } } }),+ );+ const subDir = path.join(parentDir, 'sub');+ mkdirSync(subDir, { recursive: true });++ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: subDir,+ force: false,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: true,+ runtime: false,+ claudeMd: false,+ },+ skipGlobalClaudeMd: true,+ };+ const result = await executeInit(opts);+ const skipMsg = result.skipped.find(s => s.includes('.mcp.json'));+ expect(skipMsg).toBeDefined();+ } finally {+ rmSync(parentDir, { recursive: true, force: true });+ }+ });++ it('does NOT false-positive on a bare .claude/settings.json with no MCP registration', async () => {+ // Simulate Claude Code's own project settings.json (no MCP keys at all)+ const projectDir = mkdtempSync(path.join(tmpdir(), 'wizard-2207-fp-'));+ try {+ mkdirSync(path.join(projectDir, '.claude'), { recursive: true });+ writeFileSync(+ path.join(projectDir, '.claude', 'settings.json'),+ JSON.stringify({ env: {}, hooks: {} }),+ );++ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: projectDir,+ force: false,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: true,+ runtime: false,+ claudeMd: false,+ },+ skipGlobalClaudeMd: true,+ };+ // Override HOME so we don't accidentally match the real user's ~/.claude.json+ const origHome = process.env.HOME;+ process.env.HOME = projectDir;+ try {+ const result = await executeInit(opts);+ // No pre-existing ruflo/claude-flow key β init must NOT skip .mcp.json+ const mcpSkipped = result.skipped.find(s => s.startsWith('.mcp.json') && !s.includes('existing'));+ expect(mcpSkipped).toBeUndefined();+ } finally {+ process.env.HOME = origHome;+ }+ } finally {+ rmSync(projectDir, { recursive: true, force: true });+ }+ });+});++// βββ #2208 β CLAUDE.md backup on --force βββββββββββββββββββββββββββββββββββββ++describe('#2208 β CLAUDE.md backup before overwrite', () => {+ let tmp: string;++ beforeEach(() => {+ tmp = mkdtempSync(path.join(tmpdir(), 'wizard-2208-'));+ });++ afterEach(() => {+ rmSync(tmp, { recursive: true, force: true });+ });++ it('backs up existing CLAUDE.md to CLAUDE.md.pre-ruflo when --force is used', async () => {+ const sentinel = '# Sentinel Project Content\nDo not lose this.\n';+ writeFileSync(path.join(tmp, 'CLAUDE.md'), sentinel, 'utf-8');++ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: tmp,+ force: true,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: false,+ runtime: false,+ claudeMd: true,+ },+ skipGlobalClaudeMd: true,+ };++ await executeInit(opts);++ const backupPath = path.join(tmp, 'CLAUDE.md.pre-ruflo');+ expect(existsSync(backupPath)).toBe(true);+ expect(readFileSync(backupPath, 'utf-8')).toBe(sentinel);+ });++ it('uses a timestamped backup name when CLAUDE.md.pre-ruflo already exists', async () => {+ writeFileSync(path.join(tmp, 'CLAUDE.md'), '# First content\n', 'utf-8');+ writeFileSync(path.join(tmp, 'CLAUDE.md.pre-ruflo'), '# Previous backup\n', 'utf-8');++ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: tmp,+ force: true,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: false,+ runtime: false,+ claudeMd: true,+ },+ skipGlobalClaudeMd: true,+ };++ await executeInit(opts);++ // The original .pre-ruflo must still have its old content+ expect(readFileSync(path.join(tmp, 'CLAUDE.md.pre-ruflo'), 'utf-8')).toBe('# Previous backup\n');+ // A timestamped backup must have been created+ const entries = readdirSync(tmp);+ const timestamped = entries.find(e => e.startsWith('CLAUDE.md.pre-ruflo.') && e !== 'CLAUDE.md.pre-ruflo');+ expect(timestamped).toBeDefined();+ });++ it('does NOT create a backup when no pre-existing CLAUDE.md exists', async () => {+ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: tmp,+ force: true,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: false,+ runtime: false,+ claudeMd: true,+ },+ skipGlobalClaudeMd: true,+ };++ await executeInit(opts);++ expect(existsSync(path.join(tmp, 'CLAUDE.md.pre-ruflo'))).toBe(false);+ expect(existsSync(path.join(tmp, 'CLAUDE.md'))).toBe(true);+ });++ it('skips CLAUDE.md entirely when it exists and --force is not set', async () => {+ const sentinel = '# My project\n';+ writeFileSync(path.join(tmp, 'CLAUDE.md'), sentinel, 'utf-8');++ const { executeInit } = await import('../src/init/executor.js');+ const opts: InitOptions = {+ ...makeMCPOptions(),+ targetDir: tmp,+ force: false,+ interactive: false,+ components: {+ settings: false,+ skills: false,+ commands: false,+ agents: false,+ helpers: false,+ statusline: false,+ mcp: false,+ runtime: false,+ claudeMd: true,+ },+ skipGlobalClaudeMd: true,+ };++ const result = await executeInit(opts);++ // Must skip, not overwrite+ expect(result.skipped).toContain('CLAUDE.md');+ // Original must be untouched+ expect(readFileSync(path.join(tmp, 'CLAUDE.md'), 'utf-8')).toBe(sentinel);+ expect(existsSync(path.join(tmp, 'CLAUDE.md.pre-ruflo'))).toBe(false);+ });+});diff --git a/v3/@claude-flow/cli/src/commands/init.ts b/v3/@claude-flow/cli/src/commands/init.tsindex bdd01d2987..3d05c410f8 100644--- a/v3/@claude-flow/cli/src/commands/init.ts+++ b/v3/@claude-flow/cli/src/commands/init.ts@@ -170,13 +170,52 @@ async function initCodexAction(}}-// Check if project is already initialized+// Check if project is already initialized with ruflo.+// #2207: .claude/settings.json alone is NOT a ruflo marker β it's created by+// Claude Code itself and exists in every Claude Code project. We require a+// ruflo-specific signal: either a claudeFlow section in settings.json, OR a+// .mcp.json with a 'claude-flow' or 'ruflo' server key, OR the ruflo-only+// .claude-flow/config.yaml. Using the bare file-existence check was causing+// false-positives for new users whose only existing file was Claude Code's own+// settings.json.function isInitialized(cwd: string): { claude: boolean; claudeFlow: boolean } {- const claudePath = path.join(cwd, '.claude', 'settings.json');const claudeFlowPath = path.join(cwd, '.claude-flow', 'config.yaml');+ const mcpJsonPath = path.join(cwd, '.mcp.json');+ const settingsPath = path.join(cwd, '.claude', 'settings.json');++ // Check .claude-flow/config.yaml β ruflo-specific, always reliable+ const hasClaudeFlow = fs.existsSync(claudeFlowPath);++ // Check .claude/settings.json for ruflo-specific content (claudeFlow section)+ let hasRufloSettings = false;+ if (fs.existsSync(settingsPath)) {+ try {+ const parsed = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));+ hasRufloSettings =+ parsed != null &&+ typeof parsed === 'object' &&+ 'claudeFlow' in parsed;+ } catch { /* malformed β ignore */ }+ }++ // Check .mcp.json for ruflo/claude-flow server key+ let hasRufloMcp = false;+ if (fs.existsSync(mcpJsonPath)) {+ try {+ const parsed = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf-8'));+ hasRufloMcp =+ parsed != null &&+ typeof parsed === 'object' &&+ parsed.mcpServers != null &&+ typeof parsed.mcpServers === 'object' &&+ ('claude-flow' in (parsed.mcpServers as Record<string, unknown>) ||+ 'ruflo' in (parsed.mcpServers as Record<string, unknown>));+ } catch { /* malformed β ignore */ }+ }+return {- claude: fs.existsSync(claudePath),- claudeFlow: fs.existsSync(claudeFlowPath),+ claude: hasRufloSettings || hasRufloMcp,+ claudeFlow: hasClaudeFlow,};}diff --git a/v3/@claude-flow/cli/src/init/executor.ts b/v3/@claude-flow/cli/src/init/executor.tsindex 236a57dead..f061a5dcec 100644--- a/v3/@claude-flow/cli/src/init/executor.ts+++ b/v3/@claude-flow/cli/src/init/executor.ts@@ -832,21 +832,28 @@ function detectExistingRufloMCP(targetDir: string): string | null {try {const parsed = JSON.parse(fs.readFileSync(candidate, 'utf-8'));if (!parsed || typeof parsed !== 'object') continue;- // (a) Top-level mcpServers (legacy / global form)+ // (a) Top-level mcpServers (legacy / global form).+ // #2207: accept BOTH the old 'ruflo' key AND the new 'claude-flow' key so that+ // a prior install with either key is correctly detected as already-initialized.+ // This also avoids the reverse problem: after #2206 fixed the generator to write+ // 'claude-flow', a second `ruflo init` must still recognise the existing install.if (parsed.mcpServers && typeof parsed.mcpServers === 'object') {- if ('ruflo' in parsed.mcpServers) return candidate;+ const servers = parsed.mcpServers as Record<string, unknown>;+ if ('claude-flow' in servers || 'ruflo' in servers) return candidate;}// (b) #1840: Claude Code project-scoped registrations under- // parsed.projects[<projectPath>].mcpServers.ruflo. Match by+ // parsed.projects[<projectPath>].mcpServers. Match by// normalized path against targetDir or any of its ancestors so- // a `claude mcp add ruflo` in this repo is detected even when- // Claude stored the key with different casing/slash style.+ // a `claude mcp add claude-flow` (or legacy `ruflo`) in this repo is+ // detected even when Claude stored the key with different casing/slash style.+ // #2207: accept both keys here too.if (parsed.projects && typeof parsed.projects === 'object') {for (const [projectKey, projectVal] of Object.entries(parsed.projects)) {if (!projectVal || typeof projectVal !== 'object') continue;const projectMcp = (projectVal as { mcpServers?: unknown }).mcpServers;if (!projectMcp || typeof projectMcp !== 'object') continue;- if (!('ruflo' in (projectMcp as Record<string, unknown>))) continue;+ const mcp = projectMcp as Record<string, unknown>;+ if (!('claude-flow' in mcp) && !('ruflo' in mcp)) continue;if (targetAncestors.has(normalizeProjectKey(projectKey))) {return `${candidate} (projects[${projectKey}])`;}@@ -1960,6 +1967,18 @@ async function writeClaudeMd(if (fs.existsSync(claudeMdPath) && !options.force) {result.skipped.push('CLAUDE.md');} else {+ // #2208: if overwriting an existing CLAUDE.md (force mode), back it up first so+ // users don't silently lose curated project context.+ if (fs.existsSync(claudeMdPath)) {+ const backupBase = `${claudeMdPath}.pre-ruflo`;+ // Don't clobber an existing backup β append a timestamp if one already exists.+ const backupPath = fs.existsSync(backupBase)+ ? `${backupBase}.${Date.now()}`+ : backupBase;+ fs.copyFileSync(claudeMdPath, backupPath);+ result.created.files.push(path.basename(backupPath));+ console.warn(`[ruflo init] Existing CLAUDE.md backed up to ${path.basename(backupPath)} before overwrite`);+ }// Determine template: explicit option > infer from components > 'standard'const inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;const content = generateClaudeMd(options, inferredTemplate);diff --git a/v3/@claude-flow/cli/src/init/mcp-generator.ts b/v3/@claude-flow/cli/src/init/mcp-generator.tsindex 12da14e4f3..00a57c8f06 100644--- a/v3/@claude-flow/cli/src/init/mcp-generator.ts+++ b/v3/@claude-flow/cli/src/init/mcp-generator.ts@@ -52,9 +52,12 @@ export function generateMCPConfig(options: InitOptions): object {npm_config_update_notifier: 'false',};- // Ruflo MCP server (core) β uses ruflo wrapper for portable npm-resolved invocation+ // Ruflo MCP server (core) β uses ruflo wrapper for portable npm-resolved invocation.+ // #2206: key MUST be 'claude-flow' so all plugins resolve as mcp__claude-flow__*.+ // The command args (ruflo@latest mcp start) are the correct wrapper invocation β only the+ // registration KEY changes here.if (config.claudeFlow) {- mcpServers['ruflo'] = createMCPServerEntry(+ mcpServers['claude-flow'] = createMCPServerEntry(['ruflo@latest', 'mcp', 'start'],{...npmEnv,@@ -106,7 +109,8 @@ export function generateMCPCommands(options: InitOptions): string[] {if (isWindows()) {if (config.claudeFlow) {- commands.push('claude mcp add ruflo -- cmd /c npx -y ruflo@latest mcp start');+ // #2206: registration name must be 'claude-flow' to match mcp__claude-flow__* tool naming+ commands.push('claude mcp add claude-flow -- cmd /c npx -y ruflo@latest mcp start');}if (config.ruvSwarm) {commands.push('claude mcp add ruv-swarm -- cmd /c npx -y ruv-swarm mcp start');@@ -116,7 +120,8 @@ export function generateMCPCommands(options: InitOptions): string[] {}} else {if (config.claudeFlow) {- commands.push("claude mcp add ruflo -- npx -y ruflo@latest mcp start");+ // #2206: registration name must be 'claude-flow' to match mcp__claude-flow__* tool naming+ commands.push("claude mcp add claude-flow -- npx -y ruflo@latest mcp start");}if (config.ruvSwarm) {commands.push("claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start");