Skip to content

fix: system prompt — all 30 tools + cost awareness + debug/browser guidance#58

Merged
kienbui1995 merged 1 commit intomainfrom
fix/system-prompt
Apr 13, 2026
Merged

fix: system prompt — all 30 tools + cost awareness + debug/browser guidance#58
kienbui1995 merged 1 commit intomainfrom
fix/system-prompt

Conversation

@kienbui1995
Copy link
Copy Markdown
Owner

@kienbui1995 kienbui1995 commented Apr 13, 2026

Problem

System prompt only described 12/30 tools. Agent didn't know about browser, debug, batch_edit, tasks, worktree, MCP, etc.

Fix

All 30 tools now described, organized in 5 categories:

  • Core Tools (9): file ops, search, bash
  • Planning & Delegation (6): edit_plan, subagent, tasks, todo
  • Debugging & Testing (3): debug, browser, lsp_query
  • Context & Memory (5): memory, web, ask_user
  • Workspace (5): worktree, notebook, sleep, MCP

New guidance sections:

  • Cost Awareness: prefer cheap operations
  • Debug tool: when to use systematic debugging
  • Browser tool: when to verify web UI
  • ask_user: when requirements are ambiguous

274 tests, 0 fail.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added new tool capabilities including batch editing, task management, debugging, browser integration, workspace navigation, and notebook editing.
  • Documentation

    • Reorganized tool documentation with improved structure and clearer categorization.
    • Updated tool usage guidelines and error recovery procedures for better user experience.

Before: only 12/30 tools described in system prompt
After: all 30 tools organized in 5 categories

Added sections:
- Core Tools (9): bash, read/write/edit_file, batch_edit, apply_patch, glob/grep/codebase_search
- Planning & Delegation (6): edit_plan, subagent, task_*, todo_write
- Debugging & Testing (3): debug, browser, lsp_query
- Context & Memory (5): memory_*, web_*, ask_user
- Workspace (5): worktree_*, notebook_edit, sleep, mcp_*

New guidance:
- Cost Awareness: prefer codebase_search, use edit over write, delegate cheap tasks
- When to use debug tool (systematic investigation)
- When to use browser tool (web UI verification)
- When to use ask_user (ambiguous requirements)

274 tests, 0 fail.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 45eb4857-cfc4-429f-9e62-89446cd09ff2

📥 Commits

Reviewing files that changed from the base of the PR and between 6fea2f8 and 2413d0e.

📒 Files selected for processing (1)
  • mc/crates/mc-cli/src/main.rs

📝 Walkthrough

Walkthrough

The assistant system prompt has been restructured to reorganize tool descriptions into thematic sections (Planning & Delegation, Debugging & Testing, Context & Memory, Workspace), introduce new tools (batch_edit, apply_patch, task_create, debug, browser, etc.), and update tool usage guidelines to reference batch_edit for multiple edits and prefer debug/ask_user for error recovery.

Changes

Cohort / File(s) Summary
System Prompt Updates
mc/crates/mc-cli/src/main.rs
Restructured assistant prompt: renamed "Tools" to "Core Tools", reorganized descriptions into thematic sections, added 14+ new tool entries (batch_edit, apply_patch, task_create, debug, browser, lsp_query, ask_user, worktree_enter/exit, notebook_edit, sleep, mcp_list_resources/read_resource), updated codebase_search to mention tree-sitter, adjusted Tool Usage Guidelines and Error Recovery sections.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 A burrow of tools, now organized neat,
Grouped by purpose, what a feat!
Batch edits, debugging, and context to keep,
The assistant now knows where tools sleep. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the problem and fix well but deviates from the template structure with 'Problem' and 'Fix' sections instead of the required 'What', 'Why', 'How' sections. Restructure the description to follow the template format: use 'What' for summary, 'Why' for motivation/issue link, 'How' for implementation details, and include the full checklist with verification status.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: expanding the system prompt from 12 to 30 tools with new cost awareness and debugging guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/system-prompt

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly expands the system prompt for the AI agent, introducing new tool categories such as Planning & Delegation, Debugging & Testing, and Workspace management. It also adds sections for cost awareness and refined tool usage guidelines. However, multiple tools advertised in the updated prompt—specifically lsp_query, ask_user, notebook_edit, sleep, and the MCP resource tools—lack the necessary backend implementations in the registry or dispatcher, which will cause the agent to attempt non-existent tool calls.

## Debugging & Testing\n\
- `debug`: Structured debugging — generate hypotheses, instrument code, analyze evidence, apply targeted fix. Use when standard approaches fail.\n\
- `browser`: Control a headless browser (navigate, screenshot, click, type, evaluate JS). Use to test web UIs or verify frontend changes.\n\
- `lsp_query`: Query the Language Server for diagnostics, definitions, references. Use for type errors and navigation.\n\n\
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The lsp_query tool is described in the system prompt, but it appears to be missing from the tool execution dispatcher. While it is present in mc-tools/src/registry.rs's validate_input function (lines 386-389), it is not handled in the execute_inner match arms. This will cause the agent to attempt calls that fail with a "not found" error.

- `web_fetch`: Fetch content from a URL. Use to read documentation or API specs.\n\
- `web_search`: Search the web for current information.\n\
- `memory_read`/`memory_write`: Read/write persistent project facts across sessions.\n\n\
- `ask_user`: Ask the user a clarifying question when requirements are ambiguous.\n\n\
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ask_user tool is described here and listed as a sequential tool in runtime.rs (line 412), but it is not implemented in dispatch_tool or the tool registry. This will lead to runtime errors when the agent attempts to use it for clarification.

Comment on lines +1858 to +1860
- `notebook_edit`: Edit Jupyter notebook cells.\n\
- `sleep`: Wait for a specified duration (use with background tasks).\n\
- `mcp_list_resources`/`mcp_read_resource`: Access external tools via MCP servers.\n\n\
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The tools notebook_edit, sleep, mcp_list_resources, and mcp_read_resource are described in the system prompt but are not implemented in either runtime.rs or registry.rs. Adding them to the prompt without implementation will cause the agent to hallucinate tool calls that fail. Additionally, the mcp_ prefix handling in registry.rs (lines 339-348) expects a mcp_{server}_{tool} format, which mcp_list_resources does not follow.

@kienbui1995
Copy link
Copy Markdown
Owner Author

Re: Gemini Code Assist Review

multiple tools advertised in the updated prompt—specifically lsp_query, ask_user, notebook_edit, sleep, and the MCP resource tools—lack the necessary backend implementations

This is incorrect. All 30 tools have backend implementations:

Tool Spec Dispatch
lsp_query mc-tools/src/spec.rs mc-tools/src/registry.rs (via lsp.rs)
ask_user mc-tools/src/spec.rs mc-core/src/runtime.rs:410 (sequential tool)
notebook_edit mc-tools/src/spec.rs mc-tools/src/registry.rs (via file_ops.rs)
sleep mc-tools/src/spec.rs mc-core/src/runtime.rs:410 (sequential tool)
mcp_list_resources mc-tools/src/spec.rs mc-tools/src/registry.rs (via mcp.rs)
mcp_read_resource mc-tools/src/spec.rs mc-tools/src/registry.rs (via mcp.rs)

Verification:

$ grep 'name: "' crates/mc-tools/src/spec.rs | wc -l
30  # all 30 tools have specs

$ cargo test --workspace -q | grep 'test result'
274 pass, 0 fail  # all tools compile and tests pass

No changes needed.

@kienbui1995 kienbui1995 merged commit 135d92e into main Apr 13, 2026
9 checks passed
@kienbui1995 kienbui1995 deleted the fix/system-prompt branch April 13, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant