Skip to main content

Full-stack AI enablement platform

Project description

Dolphin

PyPi Version License: MIT

Blazing-fast, all-in-one semantic search for context efficiency in large codebases.

Dolphin helps humans and AI agents find the right code quickly with semantic search, rich context retrieval, and different interface options (CLI, REST API, and MCP).

Why Dolphin

  • Search for large codebases: hybrid vector + keyword retrieval keeps search fast and relevant as codebases scale.
  • All-in-one context management: indexing, chunking, metadata, snippets, and graph context in one framework.
  • Practical developer UX: use from terminal, set up with MCP, or integrate however you like.

Quick Start

1) Install

Core Installation

# install with uv (recommended)
uv pip install pb-dolphin

# ensure OPENAI_API_KEY is set as env var
export OPENAI_API_KEY="sk-your-key-here"

The accompanying MCP server is available at bunx dolphin-mcp.

Optional: Cross-Encoder Reranking (~2GB additional)

For advanced search quality improvement (+20-30% MRR):

uv pip install "pb-dolphin[reranking]"

See Advanced Features for more information.

2) Index a repository

We recommend using uv run for Python command execution.

# Initialize global knowledge store and index a repository
uv run dolphin init
uv run dolphin add-repo my-project /path/to/project

# Start API server
uv run dolphin serve

# Search your indexed code
uv run dolphin search "authentication logic"

Core Commands

  • dolphin init - Initialize configuration (auto-creates ~/.dolphin/config.toml)
  • dolphin init --repo - Create repo-specific config in current directory
  • dolphin add-repo <name> <path> - Register a repository for indexing
  • dolphin index <name> - Index a repository with language-aware chunking
  • dolphin search <query> - Search indexed code semantically (compact by default, --verbose for details, --json for scripting)
  • dolphin serve - Start REST API server (port 7777)
  • dolphin config --show - Display current configuration

Architecture

High-Level Overview

┌──────────────────────────────────────────┐
│   AI Interfaces (Claude, Continue, etc)  │
└──────────────┬───────────────────────────┘
               │ MCP Protocol
               ▼
┌──────────────────────────────────────────┐
│          Dolphin Knowledge Base          │
│  ┌─────────────┐    ┌────────────────-┐  │
│  │ MCP Bridge  │◄──►│ REST API        │  │
│  │ (TypeScript)│    │ (Python/FastAPI)│  │
│  └─────────────┘    └────────┬────────┘  │
└──────────────────────────────┼───────────┘
                               │
               ┌───────────────┴────────────┐
               ▼                            ▼
          ┌─────────┐                ┌──────────┐
          │LanceDB  │                │ SQLite   │
          │(Vectors)│                │(Metadata)│
          └─────────┘                └──────────┘

Key Features

  • File-Watch Indexing - Indexing is triggered automatically when files change by default
  • Language-Aware Chunking - Code parsing for Python, TypeScript, JavaScript, Markdown
  • Semantic Search
    • OpenAI embeddings with LanceDB vector storage
    • Hybrid approximate nn vector + BM25 keyword search with RRF scoring
    • Re-ranking with cross-encoder
    • MMR relevancy enhancement
    • Structured snippet objects with precise context
  • Interfaces
    • dolphin CLI app
    • FastAPI server with search, retrieval, and metadata endpoints
    • MCP server implementation available at bunx dolphin-mcp
  • Configuration
    • Per-repo chunking and ignore configuration

Configuration

Dolphin uses a multi-level configuration system:

  1. Repo-specific (./.dolphin/config.toml) - Optional per-repository chunking settings
  2. User-global (~/.dolphin/config.toml) - Auto-created on first use

Configuration TOMLs

Use dolphin init to initialize your global config.

# ~/.dolphin/config.toml
default_embed_model = "large"  # or "small"

[embedding]
provider = "openai"
batch_size = 100

[retrieval]
top_k = 8
score_cutoff = 0.0

To generate a repo-specific config for chunking and ignore settings, use dolphin init --repo at the repository root.

Environment Variables

# Required when using OpenAI embeddings (recommended for production)
export OPENAI_API_KEY="sk-your-openai-api-key-here"

API Key Management

For security and future-proofing, Dolphin automatically manages a KB API key for securing Knowledge Base HTTP endpoints. Running dolphin init or dolphin serve automatically creates ~/.dolphin/kb_api_key. The MCP bridge (bunx dolphin-mcp) auto-provisions the key on startup.The key is a 64-character hex string with file permissions set to 0600 (user-only)

Environment Variable Override (Advanced):

For CI/CD, testing, or remote deployments, you can override the auto-provisioned key:

export DOLPHIN_API_KEY="your-custom-key-here"
# OR
export DOLPHIN_KB_API_KEY="your-custom-key-here"

Environment variables take precedence over the file-based key.

MCP Configuration

The small companion MCP interface can be run using bun without install. Add to your favorite AI application's config:

{
  "mcpServers": {
    "dolphin": {
      "command": "bunx",
      "args": ["dolphin-mcp"]
    }
  }
}

Note: Make sure you are running the HTTP retrieval server: uv run dolphin serve

Set DOLPHIN_API_URL if your server is not running at http://127.0.0.1:7777.

Available MCP tools: search, chunk_get, file_lines, store_info, metadata_get, repos_list, health

Advanced Features

Cross-Encoder Reranking

Cross-encoder reranking improves search result relevance by re-scoring each result pairwise against the query using an ML model, leading to 20-30% improvements in search result ranking quality (Nogueira & Cho, 2019).

Performance Impact:

  • ⚠️ 2-3x slower searches - cross-encoder is compute-intensive
  • ⚠️ ~2GB install size - requires torch and sentence-transformers

Installation

uv pip install "pb-dolphin[reranking]"

Configuration

Enable in your ~/.dolphin/config.toml:

[retrieval.reranking]
enabled = true  # Enable cross-encoder reranking
model = "cross-encoder/ms-marco-MiniLM-L-6-v2"  # HuggingFace model
device = ""  # Auto-detect (CPU or CUDA if available)
batch_size = 32  # Higher = faster but more memory
candidate_multiplier = 4  # Rerank top_k × multiplier candidates
score_threshold = 0.3  # Minimum relevance score (0-1)

Restart the API server to apply changes.

File-Watching

The Dolphin server includes an integrated file watcher that keeps your Knowledge Bank synchronized in real-time.

  • Automatic: When you run dolphin serve, it automatically starts watching all registered repositories.
  • Git-Aware: The indexer respects .gitignore rules. The watcher handles Git branch switching, updating the index to match the new working tree.

Configuring Embedding Models

Dolphin uses a consistent embedding model across your repositories to simplify global search. The embedding model can be configured globally in your config.toml:

default_embed_model = "large"  # Options: "small" or "large"

Currently only OpenAI embeddings are supported.

Requirements

  • Python ≥3.12
  • OpenAI API key (for embeddings)
  • Bun (for MCP bridge)
  • Git (for repository scanning)
  • uv (for Python dependencies)

Testing

just test

See docs/TESTING.md for complete testing procedures.

Documentation

  • High-level architecture: docs/ARCHITECTURE.md
  • Testing guide: docs/TESTING.md
  • Benchmarking: docs/BENCHMARKING.md
  • Profiling: docs/PROFILING.md

Troubleshooting

Quick Diagnostics

# Check API server
curl http://127.0.0.1:7777/v1/health

# Check indexed repositories
dolphin status

# Re-index a repository
dolphin index <repo-name> --full --force

Common Issues

API not responding:

  • Start the server: dolphin serve
  • Check port conflicts: lsof -i :7777

No search results:

  • Verify repositories are indexed: dolphin status
  • Try with lower score cutoff in search parameters
  • Re-index: dolphin index <repo-name> --full --force

MCP not connecting:

  • Verify API server is running: curl http://127.0.0.1:7777/v1/health
  • Verify Bun is installed: bun --version

For detailed troubleshooting, performance tips, and development workflows, see AGENTS.md.

Publication

Versions

Current versions:

  • Python Package (PyPI): 0.2.2 - pb-dolphin
  • MCP Bridge (npm): 0.2.3 - dolphin-mcp

License

MIT License

Acknowledgments

Built with LanceDB, OpenAI, FastAPI, Bun, and lots of other tech.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pb_dolphin-0.2.2.tar.gz (226.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pb_dolphin-0.2.2-py3-none-any.whl (266.1 kB view details)

Uploaded Python 3

File details

Details for the file pb_dolphin-0.2.2.tar.gz.

File metadata

  • Download URL: pb_dolphin-0.2.2.tar.gz
  • Upload date:
  • Size: 226.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pb_dolphin-0.2.2.tar.gz
Algorithm Hash digest
SHA256 30779781b52e8ceaea5af503dde6d08ec69a5be14a5ec003eeeda9cce8354b75
MD5 6f4b169f6d680ae9691d26a8d3bffa12
BLAKE2b-256 80707f8db0f2139b5bdfdc00a90efd23bcaf1f1bf2bed1185f9ad260147f5909

See more details on using hashes here.

Provenance

The following attestation bundles were made for pb_dolphin-0.2.2.tar.gz:

Publisher: publish-kb.yml on plasticbeachllc/dolphin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pb_dolphin-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pb_dolphin-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 266.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pb_dolphin-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 156a1d9410a0f5443a9e59fb65a11013c79ff6b62d509e0d3035f3fa69aec0f3
MD5 9fe5fdbf16784a2c1d2570306a8332bd
BLAKE2b-256 6207529080ae14c4e7577d936aed1f503ccfa8b6bf7f539986c08ce8ac0243ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pb_dolphin-0.2.2-py3-none-any.whl:

Publisher: publish-kb.yml on plasticbeachllc/dolphin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page