@apmantza/greedysearch-pi
v1.6.0
Published
Pi extension: multi-engine AI search (Perplexity, Bing Copilot, Google AI) via browser automation — NO API KEYS needed. Extracts answers with sources, optional Gemini synthesis. Grounded AI answers from real browser interactions.
Readme
GreedySearch for Pi
Pi extension that adds greedy_search, deep_research, and coding_task tools — multi-engine AI search via browser automation. NO API KEYS needed.
Fans out queries to Perplexity, Bing Copilot, and Google AI simultaneously. Returns AI-synthesized answers with deduped sources. Streams progress as each engine completes.
Forked from GreedySearch-claude.
Quick Note
No API keys required — this tool uses Chrome DevTools Protocol (CDP) to interact with search engines directly through a browser. It launches its own isolated Chrome instance, so it won't interfere with your main browser session.
Install
pi install npm:@apmantza/greedysearch-piOr directly from git:
pi install git:github.com/apmantza/GreedySearch-piQuick Start
Once installed, Pi gains a greedy_search tool with three depth levels.
greedy_search({ query: "What's new in React 19?", depth: "standard" })Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| query | string | required | The search question |
| engine | string | "all" | all, perplexity, bing, google, gemini |
| depth | string | "standard" | fast (1 engine), standard (3 engines + synthesis), deep (3 + fetch + synthesis + confidence) |
| fullAnswer | boolean | false | Return complete answer (~3000+ chars) vs truncated preview (~300 chars) |
Depth Levels
| Depth | Engines | Synthesis | Source Fetch | Time | Best For |
|-------|---------|-----------|--------------|------|----------|
| fast | 1 | — | — | 15-30s | Quick lookup, single perspective |
| standard | 3 | ✅ | — | 30-90s | Default — balanced speed/quality |
| deep | 3 | ✅ | ✅ (top 5) | 60-180s | Research that matters — architecture decisions |
Engines (for fast mode)
| Engine | Alias | Best for |
|--------|-------|----------|
| all | — | All 3 engines — but for fast single-engine, pick one below |
| perplexity | p | Technical Q&A, code explanations, documentation |
| bing | b | Recent news, Microsoft ecosystem |
| google | g | Broad coverage, multiple perspectives |
| gemini | gem | Google's AI with different training data |
Streaming Progress
When using engine: "all", the tool streams progress as each engine completes:
**Searching...** ⏳ perplexity · ⏳ bing · ⏳ google
**Searching...** ✅ perplexity done · ⏳ bing · ⏳ google
**Searching...** ✅ perplexity done · ✅ bing done · ⏳ google
**Searching...** ✅ perplexity done · ✅ bing done · ✅ google doneDeep Research Mode
For research that matters — architecture decisions, library comparisons — use depth: "deep":
greedy_search({ query: "best auth patterns for SaaS in 2026", depth: "deep" })Deep mode: 3 engines + source fetching (top 5) + synthesis + confidence scores. ~60-180s but returns grounded synthesis with fetched evidence.
Standard vs Deep:
standard(default): 3 engines + synthesis. Good for most research.deep: Same + fetches source content for grounded answers. Use when the answer really matters.
Legacy: deep_research tool still works — aliases to greedy_search with depth: "deep".
Full vs Short Answers
Default mode returns ~300 char summaries to save tokens. Use fullAnswer: true for complete responses:
greedy_search({ query: "explain the React compiler", engine: "perplexity", fullAnswer: true })Examples
Quick lookup (fast):
greedy_search({ query: "How to use async await in Python", depth: "fast", engine: "perplexity" })Compare tools (standard):
greedy_search({ query: "Prisma vs Drizzle in 2026", depth: "standard" })Deep research (architecture decision):
greedy_search({ query: "Best practices for monorepo structure", depth: "deep" })Debug an error:
greedy_search({ query: "Error: Cannot find module 'react-dom/client' Next.js 15", depth: "standard" })Requirements
- Chrome — must be installed. The extension auto-launches a dedicated Chrome instance on port 9222 with its own isolated profile and DevTools port file, separate from your main browser session.
- Node.js 22+ — for built-in
fetchand WebSocket support.
Setup (first time)
To pre-launch the dedicated GreedySearch Chrome instance:
node ~/.pi/agent/git/GreedySearch-pi/launch.mjsStop it when done:
node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --killCheck status:
node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --statusTesting
Run the test suite to verify everything works:
./test.sh # full suite (~3-4 min)
./test.sh quick # skip parallel tests (~1 min)
./test.sh parallel # parallel race condition tests onlyTests verify:
- Single engine mode (perplexity, bing, google)
- Sequential "all" mode searches
- Parallel "all" mode (5 concurrent searches) — detects tab race conditions
- Synthesis mode with Gemini
Troubleshooting
"Chrome not found"
Set the path explicitly:
export CHROME_PATH="/path/to/chrome""CDP timeout" or "Chrome may have crashed"
Restart GreedySearch Chrome:
node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --kill
node ~/.pi/agent/git/GreedySearch-pi/launch.mjsGoogle / Bing "verify you're human"
The extension auto-clicks verification buttons and Cloudflare Turnstile challenges using broad keyword matching — resilient to variations like "Verify you are human" or localised button text. For hard CAPTCHAs (image puzzles), solve manually in the Chrome window that opens.
Parallel searches failing
Each search creates a fresh isolated browser tab that is closed after completion, allowing safe parallel execution without tab state conflicts.
Search hangs
Chrome may be unresponsive. Restart it with launch.mjs --kill then launch.mjs.
Sources are empty or junk links
Sources are now extracted by regex-parsing Markdown links ([title](url)) from the clipboard text captured after each engine responds — not from DOM selectors that break when the engine's UI updates. If sources are empty, the engine's clipboard copy didn't include formatted links (Bing Copilot currently falls into this category).
How It Works
index.ts— Pi extension, registersgreedy_searchtool with streaming progresssearch.mjs— CLI runner, spawns extractors in parallel, emitsPROGRESS:events to stderrlaunch.mjs— launches dedicated Chrome on port 9222 with isolated profileextractors/— per-engine CDP scrapers (Perplexity, Bing Copilot, Google AI, Gemini)cdp.mjs— Chrome DevTools Protocol CLI for browser automationskills/greedy-search/SKILL.md— skill file that guides the model on when/how to use greedy_search
Changelog
v1.6.0 (2026-03-29)
- Merged deep_research into greedy_search — new
depthparameter:fast(1 engine),standard(3 engines + synthesis),deep(3 engines + fetch + synthesis + confidence) - Simpler API — one tool with clear speed/quality tradeoffs instead of separate tools with overlapping flags
- Backward compatible —
deep_researchstill works as alias,--synthesizeand--deep-researchflags still function - Updated documentation — README and skill docs now use
depthparameter throughout
v1.5.1 (2026-03-29)
- Fixed npm package — added
.pi-lens/and test files to.npmignore
v1.5.0 (2026-03-29)
- Code extraction fixed —
coding_tasknow uses clipboard interception to preserve markdown code blocks (was losing them via DOM scraping) - Chrome targeting hardened — all tools now consistently target the dedicated GreedySearch Chrome via
CDP_PROFILE_DIR, preventing fallback to user's main Chrome session - Shared utilities — extracted ~220 lines of duplicate code from extractors into
common.mjs(cdp wrapper, tab management, clipboard interception) - Documentation leaner — skill documentation reduced 61% (180 → 70 lines) while preserving all decision-making info
- NO API KEYS — updated messaging to emphasize this works via browser automation, no API keys needed
v1.4.2 (2026-03-25)
- Fresh isolated tabs — each search now always creates a new
about:blanktab viaTarget.createTargetand refreshes the CDP page cache immediately after, preventing SPA navigation failures and stale DOM state from prior queries - Regex-based citation extraction — all extractors (Perplexity, Bing, Gemini) now parse sources from clipboard Markdown links (
[title](url)) instead of DOM selectors that break on UI updates - Relaxed verification detection —
consent.mjsnow uses broad keyword matching (includes('verify'),includes('human')) instead of anchored regexes, correctly catching button text variants like "Verify you are human" across Cloudflare, Microsoft, and generic modals
v1.4.1
- Fixed parallel synthesis — multiple
greedy_searchcalls withsynthesize: truenow run safely in parallel. Each search creates a fresh Gemini tab that gets cleaned up after synthesis, preventing tab conflicts and "Uncaught" errors.
v1.4.0
- Grounded synthesis — Gemini now receives a normalized source registry with stable source IDs, agreement summaries, caveats, and cited claims
- Real deep research — top sources are fetched before synthesis so deep research answers are grounded in fetched evidence, not just engine summaries
- Richer source metadata — source output now includes canonical URLs, domains, source types, per-engine attribution, and confidence metadata
- Cleaner tab lifecycle — temporary Perplexity, Bing, and Google tabs are closed after each fan-out search, and synthesis finishes on the Gemini tab
- Isolated Chrome targeting — GreedySearch now refuses to fall back to your normal Chrome session, preventing stray remote-debugging prompts
License
MIT
