Skip to content

feat: add /search command powered by WarpGrep AI code search#4883

Draft
bhaktatejas922 wants to merge 3 commits intoAider-AI:mainfrom
bhaktatejas922:feat/warpgrep-search
Draft

feat: add /search command powered by WarpGrep AI code search#4883
bhaktatejas922 wants to merge 3 commits intoAider-AI:mainfrom
bhaktatejas922:feat/warpgrep-search

Conversation

@bhaktatejas922
Copy link

Summary

Adds a /search command that uses WarpGrep to perform AI-powered semantic code search. WarpGrep is an RL-trained search subagent that runs in an isolated context window, performing up to 8 parallel tool calls per turn across 4 turns, returning only relevant code spans.

Instead of writing regex patterns, describe what you're looking for in natural language:

/search Find where billing invoices are emailed to customers
/search How does the authentication middleware validate JWT tokens
/search Where is the database connection pool configured

How it works

  1. User runs /search <query>
  2. WarpGrep searches the codebase in its own context window (grep, read, list_dir)
  3. Returns precise (file, start_line, end_line) spans with only the relevant code
  4. Results are added to the chat context (following the /web pattern)
  5. User is offered to add result files as editable

Changes

  • aider/warpgrep.py (new) - WarpGrepClient implementing the multi-turn WarpGrep protocol with local ripgrep execution (Python grep fallback)
  • aider/commands.py - Added cmd_search method (auto-registers as /search)
  • aider/args.py - Added --warpgrep-api-key CLI argument
  • tests/basic/test_warpgrep.py (new) - 21 unit tests covering XML parsing, repo structure generation, finish parsing, and mock HTTP

Configuration

Set one of:

  • --warpgrep-api-key YOUR_KEY
  • WARPGREP_API_KEY=...
  • MORPH_API_KEY=...

Get a free API key at morphllm.com ($10/month free compute included).

Test plan

  • 21 unit tests passing
  • Manual test with a real repo and API key
  • Verify /search appears in /help output

Adds a new /search command that uses the WarpGrep API to intelligently
search the codebase. The integration follows the multi-turn protocol:
builds repo structure, sends queries, executes tool calls (ripgrep,
read, list_directory) locally, and returns relevant code spans.

- aider/warpgrep.py: WarpGrepClient with multi-turn search protocol
- aider/commands.py: /search command following cmd_web pattern
- aider/args.py: --warpgrep-api-key CLI argument
- tests/basic/test_warpgrep.py: 21 unit tests covering parsing,
  tool execution, and mock HTTP flows
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

- _exec_read now parses the 'lines' parameter (e.g. "1-50,75-80")
  instead of always reading the entire file
- _build_repo_structure produces a proper tree hierarchy instead of
  a flat file list
- _tree excludes common non-source dirs (node_modules, __pycache__, etc.)
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.

2 participants