Find relevant code across large codebases in seconds using morph-warp-grep. Minimal setup: import the tool and run. Requires rg (ripgrep) installed and available on PATH when using the local provider.
Requires rg (ripgrep) installed and available on PATH when using the local provider.
Why use Warp-Grep?
@swyx and @cognition pin P(breaking_flow) at +10% every 1s. For coding applications this means speed is important when the human is in the loop.
Quick Start
Anthropic
OpenAI
Vercel AI SDK
Direct (no agent)
import Anthropic from '@anthropic-ai/sdk';
import { createAnthropicWarpGrepTool } from '@morphllm/morphsdk/tools/warp_grep';
const anthropic = new Anthropic();
const grepTool = createAnthropicWarpGrepTool({ repoRoot: '.' });
const response = await anthropic.messages.create({
model: 'claude-sonnet-4-5-20250929',
max_tokens: 12000,
tools: [grepTool],
messages: [{ role: 'user', content: 'Find authentication middleware' }]
});
Pricing
| Type | Price |
| Input | $0.30 per 1M tokens |
| Output | $0.30 per 1M tokens |
Override the default tool description to tailor it for your use case:
Anthropic
OpenAI
Vercel AI SDK
import { createAnthropicWarpGrepTool } from '@morphllm/morphsdk/tools/warp_grep';
const grepTool = createAnthropicWarpGrepTool({
repoRoot: '.',
description: 'Use this tool when you know what you are looking for in the codebase. A fast and accurate tool that can search for all relevant context in a codebase.'
});
Optional: Customize provider
Use a custom provider to have your agent backend run remote grep and remote read on sandboxes like E2B, Modal, Daytona, and similar platforms.
import { CommandExecProvider, createOpenAIWarpGrepTool } from '@morphllm/morphsdk/tools/warp_grep';
const provider = new CommandExecProvider({
run: async (cmd, args, options) => {
// Run ripgrep inside a sandbox/container/remote host
return await execRemote(cmd, args, options); // { stdout, stderr, exitCode }
},
pathMap: (local) => `/app/${local}`,
cwd: '/app',
excludes: ['node_modules', '.git']
});
const grepTool = createOpenAIWarpGrepTool({ repoRoot: '.', provider });