How knockoutez/wigolo works
Purpose and runtime surface
Wigolo is a local-first web-intelligence engine for AI agents: search, fetch, crawl, structured extraction, cache, similarity, research, autonomous gathering, diff, and watch. It runs primarily as a Node.js (Node ≥20) MCP stdio server, with CLI, local HTTP/REST/MCP daemon, REPL, and SDK-facing surfaces.
• src/index.ts
• src/server.ts
• src/cli/index.ts
Entry-point and transport boundary
The core server registers tool schemas and returns agent-oriented result contracts. MCP is the default in-process/stdin-out transport; serve adds HTTP REST (/v1/{tool}), OpenAPI, and remote MCP/SSE. The daemon layer owns binding, health checks, proxying, authentication, request limits, target validation, and loopback-safe defaults.
• src/server/tool-schemas.ts
• src/daemon/http-server.ts
• src/daemon/rest/router.ts
Tool orchestration layer
Thin tool handlers are the shared control boundary used by MCP, REST, CLI, and REPL. They dispatch into domain pipelines rather than duplicating behavior across transports. CLI commands handle setup, warmup, health/doctor, agent configuration, daemon lifecycle, and interactive operation; the REPL supports shell/NDJSON workflows.
• src/tools/search.ts
• src/tools/fetch.ts
• src/tools/research.ts
• src/repl/shell.ts
Retrieval and ranking pipeline
Search fans queries across direct public-engine adapters, optionally uses SearXNG/hybrid routing, then canonicalizes, filters, deduplicates, fuses, reranks, and builds evidence-bearing responses. Search output preserves citations, source spans, quality/freshness signals, engine health, and degradation warnings. Search providers and plugin-defined engines form an extension boundary.
• src/search/core/orchestrator.ts
• src/search/hybrid/router.ts
• src/search/rerank.ts
• src/search/engines/
Web acquisition, crawling, and extraction
Fetch routes URLs through escalating HTTP, TLS-hardened, and Playwright/browser paths based on observable challenge, hydration, and content signals. It handles sessions/actions, clearance reuse, politeness, and browser pooling before producing page content. Crawl builds on acquisition with sitemap/robots support, traversal, rate limiting, deduplication, and optional vector indexing. Extraction converts fetched HTML/PDF content into cleaned Markdown, metadata, structured data, site-specific outputs, and schema-constrained records.
• src/fetch/router.ts
• src/crawl/crawler.ts
• src/extraction/pipeline.ts
• src/extraction/v1/routed.ts
Local state and on-device intelligence
Persistent local storage under the user data directory supports fetched-content/query caching, domain routing knowledge, crawl ETags, diff/watch records, and vector search. SQLite migrations and sqlite-vec provide the storage boundary. Embeddings, reranking, and background indexing are local/lazy-loaded; semantic cache and find-similar combine vector, lexical, crawl, and live-web signals.
• src/cache/db.ts
• src/cache/sqlite-vec-store.ts
• src/embedding/embed.ts
• src/search/find-similar.ts
Higher-level agent workflows and optional services
Research decomposes questions, retrieves/fetches sources, validates citations, and renders a brief or synthesized report. The autonomous agent similarly plans, executes, ranks, and logs a bounded gather loop. LLM use is optional and isolated behind provider selection/adapters: Anthropic, Gemini, OpenAI, Groq, local Ollama, or custom OpenAI-compatible backends. Secrets are managed through key-store/keychain abstractions. Optional infrastructure includes locally bootstrapped SearXNG, Playwright/browser engines, Docker deployment, webhooks for watch, and external public search engines.
• src/research/pipeline.ts
• src/agent/pipeline.ts
• src/integrations/cloud/llm/select.ts
• src/security/key-store.ts
Main entry points: search.ts Tool handlers · pipeline.ts Research pipeline · orchestrator.ts Search orchestration · router.ts Fetch router
Components 22
Runtime surfaces
- MCP server · Default stdio server for agent tools.
src/index.ts - CLI
src/cli/index.ts - HTTP daemon · Owns binding, auth, limits, proxying, and target safety.
src/daemon/http-server.ts - REST and remote MCP · Serves REST tools, OpenAPI, and MCP/SSE.
src/daemon/rest/router.ts - REPL · Shell and NDJSON workflows.
src/repl/shell.ts
Core orchestration
- Tool contracts · Registers agent-oriented tool schemas and result contracts.
src/server/tool-schemas.ts - Tool handlers · Shared dispatch layer across all transports.
src/tools/search.ts
Retrieval and acquisition
- Search orchestration · Fans out, canonicalizes, filters, deduplicates, fuses, and produces cited results.
src/search/core/orchestrator.ts - Hybrid search routing · Optionally selects SearXNG or hybrid search paths.
src/search/hybrid/router.ts - Search engines and plugins · Public-engine adapters and plugin-defined engines.
src/search/engines - Reranking
src/search/rerank.ts - Fetch router · Escalates among HTTP, hardened TLS, and browser acquisition.
src/fetch/router.ts - Crawler · Traverses with sitemap, robots, rate limiting, deduplication, and optional indexing.
src/crawl/crawler.ts - Extraction pipeline · Converts HTML/PDF into Markdown, metadata, structured and schema-constrained records.
src/extraction/pipeline.ts
Local intelligence
- SQLite local store · Caches content and queries; stores routing knowledge, ETags, diff/watch, and vectors.
src/cache/db.ts - Vector store
src/cache/sqlite-vec-store.ts - Local embeddings · Lazy-loaded embeddings, reranking, and background indexing.
src/embedding/embed.ts - Find similar · Combines vector, lexical, crawl, and live-web signals.
src/search/find-similar.ts
Agent workflows
- Research pipeline · Decomposes questions, validates citations, and renders briefs or reports.
src/research/pipeline.ts - Autonomous gatherer · Runs a bounded plan, execute, rank, and log loop.
src/agent/pipeline.ts - Optional LLM providers · Isolated adapters for cloud, Ollama, and compatible backends.
src/integrations/cloud/llm/select.ts - Secret store · Key-store and keychain abstractions for provider credentials.
src/security/key-store.ts
Connections 24
- MCP server → Tool contracts: registers
- Tool contracts → Tool handlers: invokes
- CLI → Tool handlers: uses
- REPL → Tool handlers: uses
- HTTP daemon → REST and remote MCP: hosts
- REST and remote MCP → Tool handlers: dispatches
- Tool handlers → Search orchestration: search
- Tool handlers → Fetch router: fetch
- Tool handlers → Research pipeline: research
- Search orchestration → Hybrid search routing: routes queries
- Hybrid search routing → Search engines and plugins: selects
- Search orchestration → Reranking: ranks results
- Fetch router → Extraction pipeline: supplies content
- Crawler → Fetch router: acquires pages
- Crawler → Vector store: indexes optionally
- Extraction pipeline → SQLite local store: caches content
- SQLite local store → Vector store: stores vectors
- Local embeddings → Vector store: indexes
- Find similar → Vector store: queries
- Research pipeline → Search orchestration: retrieves evidence
- Research pipeline → Fetch router: reads sources
- Research pipeline → Optional LLM providers: optionally synthesizes
- Autonomous gatherer → Research pipeline: uses retrieval loop
- Optional LLM providers → Secret store: loads credentials