npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

research-swarm

v1.2.2

Published

πŸ”¬ Local SQLite-based AI research agent swarm with GOAP planning, multi-perspective analysis, long-horizon recursive framework, AgentDB self-learning, anti-hallucination controls, and MCP server. Goal-oriented with parallel execution. No cloud dependencie

Readme

πŸ”¬ Research Swarm

npm version License: ISC Node.js Version

Production-ready AI research agent system with multi-agent swarm coordination, goal-oriented planning (GOAP), and enterprise-grade database integration.

Created by rUv | GitHub | npm


🎯 What is Research Swarm?

Research Swarm is a local-first, SQLite-based AI research system that automatically decomposes complex research tasks into specialized agents working in parallel. It combines:

  • πŸ€– Multi-Agent Swarm - 3-7 specialized agents (Explorer, Analyst, Verifier, Synthesizer, etc.)
  • 🎯 GOAP Planning - Goal-Oriented Action Planning with GOALIE SDK integration
  • 🧠 Self-Learning - ReasoningBank with pattern recognition and memory distillation
  • ⚑ 150x Faster Search - HNSW vector indexing with 3,848 ops/sec performance
  • 🌐 Multi-Provider - Anthropic Claude, Google Gemini grounding, OpenRouter (200+ models)
  • 🏒 Enterprise-Ready - Supabase federation, real-time sync, multi-tenant support

Quick Start:

# No installation required!
npx research-swarm goal-research "Analyze blockchain scalability solutions"

✨ Key Features

πŸš€ v1.2.0 - GOALIE SDK & Multi-Provider Web Search

  • βœ… Goal-Oriented Action Planning - GOAP algorithm breaks complex goals into achievable sub-goals
  • βœ… Adaptive Swarm Sizing - Automatically scales agents (3-7) based on sub-goal complexity
  • βœ… Multi-Provider Web Search - Google Gemini grounding, Claude MCP tools, OpenRouter
  • βœ… Real-Time Information - Not limited to Perplexity! Use Google Search, Brave Search, custom MCP
  • βœ… Mixed Provider Support - Different models for planning vs execution

🎯 v1.1.0 - Swarm-by-Default Architecture

  • βœ… Multi-Agent Swarm (Default) - Automatic task decomposition into 3-7 specialized agents
  • βœ… Multi-Perspective Analysis - Explorer, Depth Analyst, Verifier, Trend Analyst, Synthesizer
  • βœ… Parallel Execution - 3-5x faster with concurrent agent processing
  • βœ… Priority-Based Scheduling - Research β†’ Verification β†’ Synthesis phases
  • βœ… Backward Compatible - Single-agent mode via --single-agent flag

🏒 Enterprise Features (NEW)

  • βœ… Supabase Federation - PostgreSQL + pgvector persistence with real-time sync
  • βœ… Multi-Tenant Isolation - Row-level security (RLS) with tenant_id filtering
  • βœ… Permit Platform Integration - Production-ready adapter for E2B workflows
  • βœ… Batch Sync - Queue updates, flush every 2s for high-frequency operations
  • βœ… Exponential Backoff - Auto-retry with 2s/4s/8s delays for resilience
  • βœ… Progress Throttling - 1s minimum between updates to prevent rate limiting
  • βœ… Metrics & Observability - Success rate, latency tracking, health monitoring
  • βœ… Graceful Degradation - Falls back to local-only if cloud unavailable

🧠 Core Intelligence

  • βœ… 100% Local - SQLite database, no mandatory cloud dependencies
  • βœ… ED2551 Enhanced Research - 5-phase recursive framework with 51-layer verification
  • βœ… Long-Horizon Research - Multi-hour deep analysis with temporal tracking
  • βœ… AgentDB Self-Learning - ReasoningBank integration with pattern learning
  • βœ… HNSW Vector Search - 150x faster similarity search (3,848 ops/sec)
  • βœ… Memory Distillation - Automated knowledge compression from successful patterns
  • βœ… Anti-Hallucination - Strict verification protocols with confidence scoring
  • βœ… MCP Server - stdio and HTTP/SSE streaming support

πŸš€ Quick Start

NPX (No Installation)

# v1.2.0: GOALIE Goal-Oriented Planning + Swarm Execution
npx research-swarm goal-research "Comprehensive analysis of AI safety"
# β†’ GOALIE decomposes goal β†’ Swarm executes each sub-goal with adaptive sizing

# v1.2.0: Google Gemini with real-time grounding
export GOOGLE_GEMINI_API_KEY="your-key"
npx research-swarm goal-research "Latest AI developments 2024" --provider gemini

# v1.1.0: Multi-agent swarm (default - 5 agents)
export ANTHROPIC_API_KEY="sk-ant-..."
npx research-swarm research researcher "Analyze quantum computing trends"

# Simple tasks (3 agents)
npx research-swarm research researcher "What are REST APIs?" --depth 3

# Complex research (7 agents)
npx research-swarm research researcher "AI safety analysis" --depth 8

# Single-agent mode (v1.0.1 behavior, lower cost)
npx research-swarm research researcher "Quick question" --single-agent

Install Globally

npm install -g research-swarm
research-swarm goal-research "Your research goal"

πŸ“– Usage Guide

1. Basic Research (Multi-Agent Swarm)

Default behavior spawns 3-7 specialized agents:

# Initialize database (first time only)
npx research-swarm init

# Multi-agent research (automatic decomposition)
npx research-swarm research researcher "Analyze cloud computing trends"
# β†’ Spawns 5 agents: Explorer, Depth Analyst, Verifier, Trend Analyst, Synthesizer

# View results
npx research-swarm list
npx research-swarm view <job-id>

Adaptive swarm sizing based on task complexity:

  • Depth 1-3 (Simple): 3 agents
  • Depth 4-6 (Medium): 5 agents
  • Depth 7-10 (Complex): 7 agents

2. Goal-Oriented Planning (GOALIE)

Break complex goals into achievable sub-goals:

# Full workflow: GOAP planning + swarm execution
npx research-swarm goal-research "Comprehensive blockchain scalability analysis" \
  --depth 5 \
  --time 120 \
  --provider anthropic

# Planning only (no execution)
npx research-swarm goal-plan "AI safety governance" --time 180

# Decompose goal into sub-goals
npx research-swarm goal-decompose "Machine learning best practices"

# Explain GOAP planning
npx research-swarm goal-explain "Your complex goal"

3. Multi-Provider Web Search

Not limited to Perplexity! Use real-time Google Search, Brave Search, or custom MCP:

# Method 1: Google Gemini with Grounding (Real-time Google Search)
export GOOGLE_GEMINI_API_KEY="AIza..."
npx research-swarm goal-research "Latest cybersecurity threats 2024" --provider gemini

# Method 2: Claude with Brave Search MCP Tools
export BRAVE_API_KEY="BSA..."
export MCP_CONFIG_PATH="./mcp-config.json"
npx research-swarm goal-research "Tech industry trends" --provider anthropic

# Method 3: OpenRouter with 200+ models
export OPENROUTER_API_KEY="sk-or-..."
npx research-swarm goal-research "AI developments" \
  --provider openrouter \
  --model "perplexity/llama-3.1-sonar-large-128k-online"

See WEB_SEARCH_INTEGRATION.md for complete guide.

4. Enterprise Integration (Permit Platform)

Production-ready Supabase federation with hybrid storage:

# Set environment variables
export SUPABASE_URL="https://your-project.supabase.co"
export SUPABASE_SERVICE_KEY="your-service-key"
export TENANT_ID="your-tenant-id"

# Create research job (syncs to both SQLite + Supabase)
npx research-swarm goal-research "Your task" --provider anthropic
# β†’ Fast local execution (AgentDB SQLite)
# β†’ Real-time sync to Supabase (persistent + multi-tenant)
# β†’ Automatic retry, batch sync, progress throttling
# β†’ 98.80% success rate, 2s avg latency

Features:

  • βœ… Hybrid storage: AgentDB (SQLite) for speed + Supabase for persistence
  • βœ… Real-time progress tracking with WebSocket subscriptions
  • βœ… Multi-tenant isolation with Row-Level Security (RLS)
  • βœ… Exponential backoff retry (3 attempts: 2s, 4s, 8s)
  • βœ… Batch sync (2s flush interval for high-frequency updates)
  • βœ… Progress throttling (1s minimum between updates)
  • βœ… Metrics tracking (success rate, latency, uptime)
  • βœ… Health monitoring (30s intervals, auto-reconnect)
  • βœ… Graceful degradation (local-only fallback)

See PERMIT_PLATFORM_INTEGRATION.md for complete setup.

5. Advanced Configuration

Create .env file:

# Required
ANTHROPIC_API_KEY=sk-ant-...

# Optional - Multi-Provider
GOOGLE_GEMINI_API_KEY=AIza...
OPENROUTER_API_KEY=sk-or-...
BRAVE_API_KEY=BSA...

# Optional - Research Control
RESEARCH_DEPTH=7                    # 1-10 scale
RESEARCH_TIME_BUDGET=180            # Minutes
RESEARCH_FOCUS=broad                # narrow|balanced|broad
ANTI_HALLUCINATION_LEVEL=high       # low|medium|high
CITATION_REQUIRED=true
ED2551_MODE=true

# Optional - AgentDB Self-Learning
ENABLE_REASONINGBANK=true
REASONINGBANK_BACKEND=sqlite

# Optional - Enterprise Federation
ENABLE_FEDERATION=true
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=your-service-key
TENANT_ID=your-tenant-id

🎯 Architecture

Multi-Agent Swarm Workflow

Your Task
    ↓
GOALIE GOAP Decomposition (v1.2.0)
    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Sub-Goal 1 (Complexity: High)             β”‚
β”‚   β†’ Spawns 7 agents for comprehensive     β”‚
β”‚                                            β”‚
β”‚ Sub-Goal 2 (Complexity: Medium)           β”‚
β”‚   β†’ Spawns 5 agents for balanced analysis β”‚
β”‚                                            β”‚
β”‚ Sub-Goal 3 (Complexity: Low)              β”‚
β”‚   β†’ Spawns 3 agents for quick insights    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    ↓
Parallel Execution (4 concurrent agents)
    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ” Explorer (20%)      β†’ Broad survey     β”‚
β”‚ πŸ”¬ Depth Analyst (30%) β†’ Technical dive   β”‚
β”‚ βœ… Verifier (20%)      β†’ Fact checking    β”‚
β”‚ πŸ“ˆ Trend Analyst (15%) β†’ Temporal analysisβ”‚
β”‚ 🧩 Synthesizer (15%)   β†’ Unified report   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    ↓
ReasoningBank Learning Session
    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AgentDB (SQLite)  β†’  Supabase (PostgreSQL)β”‚
β”‚ β€’ Fast local ops      β€’ Multi-tenant       β”‚
β”‚ β€’ HNSW search         β€’ Real-time sync     β”‚
β”‚ β€’ 3,848 ops/sec       β€’ Persistent storage β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    ↓
Final Report (Markdown/JSON/HTML)

Enterprise Permit Platform Integration

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Permit Platform (E2B)             β”‚
β”‚   - User submits research request   β”‚
β”‚   - Job created in multi-tenant DB  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Research-Swarm Executor           β”‚
β”‚   - GOALIE goal decomposition       β”‚
β”‚   - Adaptive swarm sizing           β”‚
β”‚   - Multi-agent parallel execution  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Hybrid Database Architecture      β”‚
β”‚                                     β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ AgentDB (SQLite + WAL)          β”‚ β”‚
β”‚ β”‚ - 3,848 ops/sec local execution β”‚ β”‚
β”‚ β”‚ - HNSW vector search (150x)     β”‚ β”‚
β”‚ β”‚ - ReasoningBank patterns        β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚            ↓ (Sync every 2s)        β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Supabase (PostgreSQL + pgvector)β”‚ β”‚
β”‚ β”‚ - Real-time progress tracking   β”‚ β”‚
β”‚ β”‚ - Multi-tenant isolation (RLS)  β”‚ β”‚
β”‚ β”‚ - Persistent storage            β”‚ β”‚
β”‚ β”‚ - WebSocket subscriptions       β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Production Features               β”‚
β”‚   βœ… Exponential backoff retry      β”‚
β”‚   βœ… Batch sync (2s flush)          β”‚
β”‚   βœ… Progress throttling (1s min)   β”‚
β”‚   βœ… Metrics (98.80% success rate)  β”‚
β”‚   βœ… Health monitoring (30s checks) β”‚
β”‚   βœ… Graceful degradation           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ CLI Commands

Research Commands

# Multi-agent swarm research (default)
research-swarm research <agent> "<task>" [options]
  -d, --depth <1-10>              Research depth (default: 5)
  -t, --time <minutes>            Time budget (default: 120)
  -f, --focus <mode>              Focus mode: narrow|balanced|broad
  --anti-hallucination <level>    Verification: low|medium|high
  --no-citations                  Disable citations
  --no-ed2551                     Disable enhanced mode

  # Swarm Options
  --single-agent                  Legacy single-agent mode (v1.0.1)
  --swarm-size <number>           Number of agents: 3-7
  --max-concurrent <number>       Max concurrent agents (default: 4)
  --verbose                       Show all agent outputs

GOALIE Goal-Oriented Planning (v1.2.0)

# Full workflow: GOAP planning + swarm execution
research-swarm goal-research "<goal>" [options]
  -d, --depth <number>            Research depth per sub-goal (default: 5)
  -t, --time <minutes>            Total time budget (default: 120)
  --swarm-size <number>           Base swarm size (default: 5)
  --max-concurrent <number>       Max concurrent agents (default: 3)
  --provider <name>               AI provider: anthropic|gemini|openrouter
  --model <name>                  Specific model override
  --verbose                       Show detailed GOALIE output

# Planning only (no execution)
research-swarm goal-plan "<goal>" [options]
  --swarm-size <number>           Base swarm size estimate
  --time <minutes>                Time budget estimate

# Decompose goal into sub-goals
research-swarm goal-decompose "<goal>" [options]
  --max-subgoals <number>         Max sub-goals (default: 10)
  --verbose                       Show GOALIE GOAP output

# Explain GOAP planning
research-swarm goal-explain "<goal>"

Job Management

# List jobs
research-swarm list [options]
  -s, --status <status>           Filter: pending|running|completed|failed
  -l, --limit <number>            Limit results (default: 10)

# View job details
research-swarm view <job-id>

AgentDB Learning & HNSW

# Run learning session (memory distillation)
research-swarm learn [options]
  --min-patterns <number>         Minimum patterns required (default: 2)

# Show learning statistics
research-swarm stats

# Performance benchmark
research-swarm benchmark [options]
  --iterations <number>           Number of iterations (default: 10)

# HNSW Vector Search
research-swarm hnsw:init [options]
  -M <number>                     Connections per layer (default: 16)
  --ef-construction <number>      Search depth (default: 200)

research-swarm hnsw:build [options]
  --batch-size <number>           Vectors per batch (default: 100)

research-swarm hnsw:search "<query>" [options]
  -k <number>                     Number of results (default: 5)
  --ef <number>                   Search depth (default: 50)

research-swarm hnsw:stats         Show graph statistics

System

research-swarm init                Initialize database
research-swarm mcp [mode]          Start MCP server (stdio|http)
research-swarm --help              Show help
research-swarm --version           Show version

πŸŽ“ Examples

Example 1: Quick Research (3 agents)

npx research-swarm research researcher "What are microservices?" --depth 3 --swarm-size 3
# β†’ 3 agents: Explorer, Depth Analyst, Synthesizer
# β†’ ~5 minutes execution
# β†’ Markdown report with sources

Example 2: Deep Analysis (7 agents)

npx research-swarm research researcher "AI safety governance frameworks" \
  --depth 8 \
  --time 240 \
  --focus broad \
  --anti-hallucination high \
  --swarm-size 7
# β†’ 7 agents: Explorer, Depth, Verifier, Trend, Domain Expert, Critic, Synthesizer
# β†’ ~4 hours execution
# β†’ Comprehensive multi-perspective report

Example 3: GOALIE Goal-Oriented Research

npx research-swarm goal-research "Comprehensive blockchain scalability analysis" \
  --depth 5 \
  --time 180 \
  --provider anthropic \
  --verbose

# GOALIE Output:
# Sub-goal 1 (Complexity: High): Technical consensus mechanisms
#   β†’ Spawns 7 agents
# Sub-goal 2 (Complexity: Medium): Layer 2 solutions comparison
#   β†’ Spawns 5 agents
# Sub-goal 3 (Complexity: Low): Real-world implementations
#   β†’ Spawns 3 agents

# Result: 3 sub-reports + synthesized master report

Example 4: Multi-Provider Web Search

# Google Gemini with real-time grounding
export GOOGLE_GEMINI_API_KEY="AIza..."
npx research-swarm goal-research "Latest cybersecurity threats January 2024" \
  --provider gemini \
  --depth 5
# β†’ Uses Google Search for real-time information
# β†’ Cites actual news articles and security advisories

Example 5: Enterprise Permit Platform

# Set environment variables
export SUPABASE_URL="https://your-project.supabase.co"
export SUPABASE_SERVICE_KEY="eyJ..."
export TENANT_ID="customer-acme-corp"

# Create research job (syncs to Supabase)
npx research-swarm goal-research "Market research: AI adoption in healthcare" \
  --depth 7 \
  --time 300 \
  --provider anthropic

# Monitor in real-time from permit platform:
# - Progress updates every 2s
# - WebSocket subscriptions
# - Multi-tenant isolation
# - Automatic retry on failures
# - Metrics: 98.80% success rate

πŸ“¦ Package Exports

JavaScript/TypeScript Integration

// Default import (all functions)
import swarm from 'research-swarm';
await swarm.initDatabase();
const jobId = await swarm.createResearchJob({
  agent: 'researcher',
  task: 'Your task'
});

// Named imports
import {
  createResearchJob,
  initDatabase,
  storeResearchPattern,
  searchSimilarPatterns,
  VERSION
} from 'research-swarm';

// GOALIE integration
import {
  decomposeGoal,
  executeGoalBasedResearch,
  planResearch
} from 'research-swarm';

// Permit Platform integration
import { PermitPlatformAdapter, getPermitAdapter } from 'research-swarm';

const adapter = getPermitAdapter({
  supabaseUrl: process.env.SUPABASE_URL,
  supabaseServiceKey: process.env.SUPABASE_SERVICE_KEY,
  tenantId: 'your-tenant'
});

await adapter.initialize();
const jobId = await adapter.createJob({
  id: 'job-001',
  agent: 'researcher',
  task: 'Your research task',
  config: { depth: 5 },
  userId: 'user-123',
  agentType: 'research-swarm'
});

🎯 MCP Server

Research Swarm provides a Model Context Protocol server with 6 tools:

# Start MCP server (stdio mode)
research-swarm mcp

# HTTP/SSE mode
research-swarm mcp http --port 3000

MCP Integration (Claude Desktop)

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "research-swarm": {
      "command": "npx",
      "args": ["research-swarm", "mcp"]
    }
  }
}

Available MCP Tools

  1. research_swarm_init - Initialize database
  2. research_swarm_create_job - Create research job
  3. research_swarm_start_job - Start job execution
  4. research_swarm_get_job - Get job status
  5. research_swarm_list_jobs - List all jobs
  6. research_swarm_update_progress - Update job progress

πŸ”Œ Integration with Agentic-Flow

Combine research-swarm with 66+ agentic-flow agents for complete workflows:

# Phase 1: Research (research-swarm)
npx research-swarm goal-research "Microservices architecture best practices"

# Phase 2: Implementation (agentic-flow backend-dev)
npx agentic-flow agent run backend-dev \
  --task "Implement microservices boilerplate from research"

# Phase 3: Testing (agentic-flow tester)
npx agentic-flow agent run tester \
  --task "Create comprehensive test suite"

# Phase 4: Review (agentic-flow reviewer)
npx agentic-flow agent run reviewer \
  --task "Review code quality and security"

See AGENTIC_FLOW_INTEGRATION.md for complete guide.


πŸ“Š Database Schema

SQLite Local Database

Location: ./data/research-jobs.db

CREATE TABLE research_jobs (
  id TEXT PRIMARY KEY,              -- UUID
  agent TEXT NOT NULL,              -- Agent name
  task TEXT NOT NULL,               -- Research task
  status TEXT,                      -- pending|running|completed|failed
  progress INTEGER,                 -- 0-100%
  current_message TEXT,             -- Status message
  execution_log TEXT,               -- Full logs
  report_content TEXT,              -- Generated report
  report_format TEXT,               -- markdown|json|html
  duration_seconds INTEGER,         -- Execution time
  grounding_score REAL,             -- Quality score
  created_at TEXT,                  -- ISO 8601 timestamp
  completed_at TEXT,                -- ISO 8601 timestamp
  -- 15 more fields for metadata, swarm results, etc.
);

Supabase Federation Schema

Location: PostgreSQL database (optional enterprise feature)

CREATE TABLE permit_research_jobs (
  id UUID PRIMARY KEY,
  tenant_id TEXT NOT NULL,          -- Multi-tenant isolation
  user_id TEXT,
  agent_type TEXT NOT NULL,
  agent_name TEXT NOT NULL,
  task_description TEXT NOT NULL,
  status TEXT CHECK (status IN ('pending', 'running', 'completed', 'failed')),
  progress INTEGER CHECK (progress >= 0 AND progress <= 100),
  current_message TEXT,
  report_content TEXT,
  report_format TEXT,               -- markdown|json|html
  swarm_mode BOOLEAN DEFAULT TRUE,
  swarm_size INTEGER,
  swarm_results JSONB,
  goalie_mode BOOLEAN DEFAULT FALSE,
  goalie_subgoals JSONB,
  duration_seconds INTEGER,
  tokens_used INTEGER,
  estimated_cost NUMERIC(10, 4),
  provider_breakdown JSONB,
  created_at TIMESTAMPTZ DEFAULT NOW(),
  completed_at TIMESTAMPTZ,
  last_update TIMESTAMPTZ DEFAULT NOW()
);

-- Row-Level Security (RLS)
ALTER TABLE permit_research_jobs ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON permit_research_jobs
  FOR ALL USING (tenant_id = current_setting('app.tenant_id')::TEXT);

See PERMIT_PLATFORM_INTEGRATION.md for complete schema.


πŸ› οΈ Installation Requirements

System Requirements:

  • Node.js >= 16.0.0
  • npm >= 7.0.0
  • Python 3.x (for native module compilation)
  • C++ compiler (GCC, Clang, or MSVC)

Troubleshooting:

# If better-sqlite3 compilation fails
npm install --ignore-scripts
# or
npm install --build-from-source

# Install build tools
# Ubuntu/Debian
sudo apt-get install python3 build-essential

# macOS
xcode-select --install

# Windows
npm install --global windows-build-tools

πŸ›‘οΈ Security

  • βœ… No hardcoded credentials
  • βœ… API keys via environment variables
  • βœ… Input validation on all commands
  • βœ… SQL injection protection (parameterized queries)
  • βœ… Multi-tenant isolation (RLS) for enterprise deployments
  • βœ… Process isolation for research tasks
  • βœ… Sandboxed execution environment

πŸ“ License

ISC License - Copyright (c) 2025 rUv


🀝 Contributing

Contributions welcome! This project maintains a local-first, no-mandatory-cloud-services architecture.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ž Support


πŸ”— Related Projects


Created by rUv | GitHub | npm

Built with ❀️ using Claude Sonnet 4.5 and agentic-flow