internaltool-mcp 1.6.28 → 1.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +70 -59
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -798,8 +798,8 @@ Call confirmed=false to preview the decomposition, confirmed=true to save it.`,
798
798
  subtasksCreated: subtaskPlan.length,
799
799
  message: `Decomposition saved. ${subtaskPlan.length} subtask(s) added to the board.`,
800
800
  nextStep: parallelGroups.length > 0
801
- ? `⚡ COORDINATOR: Call get_parallel_kickoffs with taskId="${taskId}" NOW. It returns ready-to-paste prompts for each builder window. DO NOT implement code yourself your job is to coordinate only.`
802
- : `Call get_parallel_kickoffs with taskId="${taskId}" to get the builder prompt. DO NOT implement code yourself.`,
801
+ ? `⚡ COORDINATOR: Call get_parallel_kickoffs with taskId="${taskId}" NOW. It writes Cursor Background Agent files for each parallel builder automatically. Then tell the user to open Background Agents panel (⌘⇧J) and click Start. DO NOT implement code yourself.`
802
+ : `Call get_parallel_kickoffs with taskId="${taskId}". It writes a Cursor Background Agent file for the builder. Tell the user to open Background Agents panel (⌘⇧J) and start it.`,
803
803
  })
804
804
  }
805
805
  )
@@ -1541,16 +1541,15 @@ The log is visible in InternalTool under the task's Session tab — gives the hu
1541
1541
  // ── get_parallel_kickoffs ─────────────────────────────────────────────────────
1542
1542
  server.tool(
1543
1543
  'get_parallel_kickoffs',
1544
- `Read the decomposition plan and return ready-to-paste Cursor Agent prompts for the next group of parallel subtasks.
1544
+ `Read the decomposition plan, write Cursor Background Agent files for each parallel subtask, and return instructions.
1545
1545
 
1546
1546
  COORDINATOR WORKFLOW:
1547
1547
  1. Call decompose_task to create the plan
1548
- 2. Call get_parallel_kickoffs to get one paste-ready prompt per parallel subtask
1549
- 3. Tell the user exactly how many new Cursor Agent windows to open
1550
- 4. Give them each prompt to paste one window per subtask
1548
+ 2. Call get_parallel_kickoffs it writes .cursor/agents/builder-N.md files automatically
1549
+ 3. Open the Cursor Background Agents panel (⌘⇧J or ⌘⇧P "Background Agents")
1550
+ 4. Click "Start" for each builder agentthey run in parallel in the background
1551
1551
 
1552
- Cursor cannot spawn agent windows automatically. This tool generates the prompts;
1553
- the human opens the windows. Each builder agent then runs independently.`,
1552
+ The agent files are fully self-contained: each builder knows exactly what MCP tools to call.`,
1554
1553
  {
1555
1554
  taskId: z.string().describe("Task's MongoDB ObjectId"),
1556
1555
  },
@@ -1626,59 +1625,70 @@ the human opens the windows. Each builder agent then runs independently.`,
1626
1625
  const filesArg = (st.files || []).map(f => `"${f}"`).join(', ')
1627
1626
  const fileList = (st.files || []).map(f => ` - \`${f}\``).join('\n')
1628
1627
 
1629
- // Prompt is structured as a direct agent instruction no ambiguity, explicit MCP calls first
1628
+ // Prompt is a short, direct imperative Cursor immediately executes.
1629
+ // Key: start with "Use the InternalTool MCP" so Cursor knows to call tools.
1630
+ // Avoid pseudocode like fn(arg=val) — use plain English with quoted values.
1631
+ const fileListPlain = (st.files || []).join(', ')
1630
1632
  const prompt = [
1631
- `## Builder Agent ${task.key} · Subtask ${i + 1} of ${parallelCount}`,
1633
+ `Use the InternalTool MCP tools to implement subtask "${st.title}" for task ${task.key}.`,
1632
1634
  ``,
1633
- `**Subtask:** ${st.title}`,
1634
- `**Description:** ${st.description || '(see task description)'}`,
1635
- `**Your exclusive files (do NOT touch any other file):**`,
1636
- fileList || ' (none pre-assigned — use your judgement)',
1635
+ `Do these steps immediately in order — do not ask for confirmation, do not skip any step:`,
1637
1636
  ``,
1638
- `## DO THIS NOW in order, no skipping:`,
1637
+ `1. Call kickoff_task with taskId "${taskId}", agentRole "builder", confirmed true`,
1638
+ `2. Call claim_files with taskId "${taskId}" and files [${filesArg}]`,
1639
+ `3. Call get_agent_context with taskId "${taskId}" to read the full task plan`,
1640
+ `4. Implement the subtask: ${st.description || st.title}`,
1641
+ ` - You may ONLY modify these files: ${fileListPlain}`,
1642
+ ` - Do NOT touch any other file`,
1643
+ `5. Run npm test — all tests must pass before continuing`,
1644
+ `6. Call commit_helper with taskId "${taskId}"`,
1645
+ `7. Call update_task with taskId "${taskId}" and mark the subtask "${st.title}" as done`,
1639
1646
  ``,
1640
- `**Step 1** Call this MCP tool immediately:`,
1641
- ` kickoff_task(taskId="${taskId}", agentRole="${st.role || 'builder'}", confirmed=true)`,
1642
- ``,
1643
- `**Step 2** — Lock your files (prevents conflicts with the other parallel agent):`,
1644
- ` claim_files(taskId="${taskId}", files=[${filesArg}])`,
1645
- ``,
1646
- `**Step 3** — Get full context:`,
1647
- ` get_agent_context(taskId="${taskId}", role="${st.role || 'builder'}")`,
1648
- ``,
1649
- `**Step 4** — Implement the subtask`,
1650
- ` Modify ONLY your claimed files listed above.`,
1651
- ` Do NOT read or write files owned by another builder.`,
1652
- ``,
1653
- `**Step 5** — Verify`,
1654
- ` Run \`npm test\` — all tests must pass before committing.`,
1655
- ``,
1656
- `**Step 6** — Commit`,
1657
- ` commit_helper(taskId="${taskId}")`,
1658
- ``,
1659
- `**Step 7** — Mark done`,
1660
- ` Call update_task to tick the subtask checkbox for "${st.title}"`,
1661
- ``,
1662
- `⚠️ You are 1 of ${parallelCount} parallel builders. Another agent is working simultaneously on different files.`,
1663
- ` Conflict prevention: claim_files will BLOCK you if another agent has already claimed your files.`,
1647
+ `You are builder ${i + 1} of ${parallelCount} running in parallel. Another builder is working on different files at the same time.`,
1664
1648
  ].join('\n')
1665
1649
 
1666
1650
  return { subtask: st.title, role: st.role || 'builder', files: st.files || [], prompt }
1667
1651
  })
1668
1652
 
1653
+ // Write each builder prompt as a Cursor Background Agent file in .cursor/agents/
1654
+ // Cursor Background Agents panel reads these files and lets you start each one independently.
1655
+ const repoRoot = process.cwd()
1656
+ const agentsDir = join(repoRoot, '.cursor', 'agents')
1657
+ mkdirSync(agentsDir, { recursive: true })
1658
+
1659
+ const writtenFiles = []
1660
+ kickoffs.forEach((k, i) => {
1661
+ const safeName = k.subtask.replace(/[^a-zA-Z0-9-_]/g, '-').replace(/-+/g, '-').slice(0, 40)
1662
+ const fileName = `builder-${i + 1}-${safeName}.md`
1663
+ const filePath = join(agentsDir, fileName)
1664
+
1665
+ const agentFileContent = [
1666
+ `---`,
1667
+ `description: Builder ${i + 1} of ${parallelCount} — ${k.subtask} (${task.key})`,
1668
+ `---`,
1669
+ ``,
1670
+ k.prompt,
1671
+ ].join('\n')
1672
+
1673
+ writeFileSync(filePath, agentFileContent, 'utf8')
1674
+ writtenFiles.push({ index: i + 1, file: `.cursor/agents/${fileName}`, subtask: k.subtask })
1675
+ })
1676
+
1669
1677
  // Build the human-facing instruction block
1670
- const howToOpen = [
1671
- `In Cursor, open ${parallelCount} new Agent windows:`,
1672
- ` • Mac: Cmd+Shift+P → "New Agent" (or click "+" in the Composer panel)`,
1673
- ` • Windows: Ctrl+Shift+P → "New Agent"`,
1678
+ const howToStart = [
1679
+ `✅ ${parallelCount} builder agent file(s) written to .cursor/agents/`,
1674
1680
  ``,
1675
- ...kickoffs.map((k, i) => `Window ${i + 1}: paste the prompt for subtask "${k.subtask}"`),
1681
+ `TO START PARALLEL BUILDERS IN CURSOR:`,
1682
+ ` 1. Open Background Agents panel: ⌘⇧J (or ⌘⇧P → "Background Agents")`,
1683
+ ` 2. You'll see ${parallelCount} new builder agent(s) listed`,
1684
+ ` 3. Click "Start" for each one — they run in parallel automatically`,
1676
1685
  ``,
1677
- `Each window will independently call kickoff_task claim_files → implement → commit.`,
1678
- `They run at the same time — you don't need to wait for one to finish before starting the other.`,
1686
+ ...writtenFiles.map(f => ` • Builder ${f.index}: "${f.subtask}" ${f.file}`),
1679
1687
  ``,
1680
- `After BOTH windows finish and commit, come back to this coordinator window and call:`,
1681
- ` get_parallel_kickoffs(taskId="${taskId}")`,
1688
+ `Each builder calls kickoff_task claim_files implements runs tests commits.`,
1689
+ `They work on different files simultaneously — no need to wait for one before starting the other.`,
1690
+ ``,
1691
+ `After all builders finish, come back here and call get_parallel_kickoffs again`,
1682
1692
  `to get the next group's prompts.`,
1683
1693
  ].join('\n')
1684
1694
 
@@ -1687,17 +1697,11 @@ the human opens the windows. Each builder agent then runs independently.`,
1687
1697
  totalGroups: execOrder.length,
1688
1698
  isParallel,
1689
1699
  parallelCount,
1690
- READ_THIS_FIRST: '👇 READ THIS BEFORE DOING ANYTHING',
1700
+ READ_THIS_FIRST: ' BUILDER AGENT FILES WRITTEN — SEE INSTRUCTIONS BELOW',
1691
1701
  COORDINATOR_INSTRUCTION: isParallel
1692
- ? `⚡ GROUP ${nextGroupIndex} of ${execOrder.length}: ${parallelCount} subtasks run IN PARALLEL.\n\n${howToOpen}`
1693
- : `GROUP ${nextGroupIndex} of ${execOrder.length}: 1 sequential subtask.\nOpen 1 new Agent window and paste the prompt below.`,
1694
- kickoffs: kickoffs.map((k, i) => ({
1695
- window: i + 1,
1696
- subtask: k.subtask,
1697
- role: k.role,
1698
- files: k.files,
1699
- PASTE_THIS_IN_NEW_AGENT_WINDOW: k.prompt,
1700
- })),
1702
+ ? `⚡ GROUP ${nextGroupIndex} of ${execOrder.length}: ${parallelCount} builders written as Cursor Background Agents.\n\n${howToStart}`
1703
+ : `GROUP ${nextGroupIndex} of ${execOrder.length}: 1 sequential builder written as a Cursor Background Agent.\n\n${howToStart}`,
1704
+ agentFilesWritten: writtenFiles,
1701
1705
  })
1702
1706
  }
1703
1707
  )
@@ -3024,11 +3028,18 @@ You are a COORDINATOR agent. Your behavioral constraints for this session:
3024
3028
  - Bypass the decomposition step — always decompose before builders start
3025
3029
  - Start coding without a scout report when the codebase is unfamiliar
3026
3030
 
3031
+ **PARALLEL BUILDER WORKFLOW:**
3032
+ 1. Call decompose_task — creates subtasks with file ownership
3033
+ 2. Call get_parallel_kickoffs — writes .cursor/agents/builder-N.md files automatically
3034
+ 3. Tell the user: "Open Background Agents panel (⌘⇧J) and click Start for each builder"
3035
+ 4. Wait for builders to finish, then call get_parallel_kickoffs again for the next group
3036
+
3027
3037
  **WORK STYLE:**
3028
3038
  - Start with decompose_task to get the structured execution plan
3029
3039
  - Ensure no two builder subtasks claim the same file
3030
3040
  - Scout report must exist before builders begin
3031
- - Each builder subtask must have explicit file ownership and a clear scope`,
3041
+ - Each builder subtask must have explicit file ownership and a clear scope
3042
+ - NEVER implement code yourself — your job ends after get_parallel_kickoffs writes the agent files`,
3032
3043
  }
3033
3044
 
3034
3045
  /** Write task-specific cursor rules to .cursor/rules/<taskKey>.mdc in the local repo root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internaltool-mcp",
3
- "version": "1.6.28",
3
+ "version": "1.6.30",
4
4
  "description": "MCP server for InternalTool — connect AI assistants (Claude Code, Cursor) to your project and task management platform",
5
5
  "type": "module",
6
6
  "main": "index.js",