SeaGOAT Documentation

repository·main·Indexed 23 days ago

https://github.com/kantord/seagoat

SeaGOAT is a local semantic-code search engine (version 1.2.0) that combines vector embeddings via ChromaDB and ripgrep to enable semantic and regular expression-based searching of codebases. It features a client-server architecture with a CLI (`gt` or `seagoat`), a configurable server via `.seagoat.yml`, and an MCP server for integration with AI assistants like Claude Desktop.

Tokens
8.3K
Snippets
25
Records
61
Agent score
76%

What's inside SeaGOAT

  1. Understand SeaGOAT configuration types

    main

    SeaGOAT uses YAML files for configuration. Settings are merged from two sources:

    1. Global configuration files: System-wide settings. Use the command seagoat-server server-info to locate this file on your system.
    2. Project configuration files: Project-specific settings located in a file named .seagoat.yml in the root folder of your repository.

    Precedence: Project-level configuration values take precedence over global configuration values when they define the same key.

  2. Use the `search_code` tool via MCP

    main

    When the SeaGOAT MCP server is connected to an AI assistant (like Claude Desktop), the assistant gains access to the search_code tool. This tool allows the assistant to perform semantic searches against your local codebase via the running SeaGOAT server.

    You can trigger this tool by asking natural language questions such as:

    • "Search my codebase for the login authentication logic"
    • "Find code related to data processing in src/utils"
  3. Run automated tests with pytest

    main

    SeaGOAT uses pytest for automated testing. All commands should be prefixed with poetry run to ensure they execute within the project's virtual environment.

    Common Test Commands

    • Run all tests: poetry run pytest .
    • Watch mode (runs tests automatically on file save): poetry run ptw
    • Test only changed files: poetry run pytest . --testmon
    • Update snapshots: If using snapshot testing, use poetry run pytest --snapshot-update to refresh snapshots.
    # Run all tests
    poetry run pytest .
    
    # Watch mode
    poetry run ptw
    
    # Test changed files
    poetry run pytest . --testmon
    
    # Update snapshots
    poetry run pytest --snapshot-update
  4. Use the SeaGOAT CLI to query your codebase

    main

    The seagoat command allows you to perform semantic and pattern-based searches across your codebase. It uses ChromaDB and ripgrep to combine AI-driven vector queries with regular expressions.

    Note: SeaGOAT requires a Git repository to function, as it uses Git history to improve result relevance. The CLI communicates with a SeaGOAT server; if the server is not running, you will be prompted to start it using seagoat-server start {repo_path}.

    seagoat <query> [repo_path] [OPTIONS]
  5. Configure pre-commit hooks for SeaGOAT

    main

    SeaGOAT uses pre-commit to enforce code style and run automated checks before commits. It is highly recommended to install these hooks so they run automatically during your git workflow.

    To install the hooks:

    poetry run pre-commit install

    If you prefer not to use hooks, you can run all checks manually on all files using:

    poetry run pre-commit run --all-files
  6. Start the SeaGOAT-server

    main

    To boot up the server for a specific repository, use the start command. You can optionally specify a port; otherwise, a random port will be assigned. Even with a random port, the SeaGOAT CLI can automatically locate the server.

    seagoat-server start <repo_path> [--port=<custom_port>]
    • <repo_path>: Path to your Git repository.
    • --port: (Optional) Run the server on a specific port.
  7. Install SeaGOAT

    main

    To install SeaGOAT, ensure you have the following dependencies installed:

    • Python 3.11 or newer
    • ripgrep
    • bat (optional, but highly recommended for colored output)

    If bat is installed, SeaGOAT uses it to display results with color. If bat is missing but color is enabled, SeaGOAT falls back to using pygments for highlighting.

    Install SeaGOAT using pipx:

    pipx install seagoat
  8. Manually test SeaGOAT components

    main

    To test your local changes manually, run the project binaries or interactive shells through Poetry to ensure you are using the correct virtual environment.

    Manual Execution

    • Run the server: poetry run seagoat-server
    • Run the CLI tool: poetry run gt (or seagoat)
    • Interactive Python: poetry run ipython
    poetry run seagoat-server
    poetry run gt
    poetry run ipython
  9. Set up the SeaGOAT MCP Server for Claude Desktop

    main

    The SeaGOAT MCP Server allows AI assistants like Claude Desktop to perform semantic searches on your local codebase.

    Prerequisites

    1. Install SeaGOAT: Ensure SeaGOAT is installed via pipx install seagoat.
    2. Run SeaGOAT Server: The background server must be running for the repository you wish to search:
      seagoat-server start /path/to/your/repository

    Configuration

    Add the seagoat server to your claude_desktop_config.json file.

    Config File Locations:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    If installed via pipx, use the global command:

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

    Option 2: Using a Manual Path

    If the global command is not found, provide the absolute path to the seagoat-mcp executable:

    {
      "mcpServers": {
        "seagoat": {
          "command": "/Users/username/.local/pipx/venvs/seagoat/bin/seagoat-mcp",
          "args": []
        }
      }
    }

    Usage

    1. Restart Claude Desktop.
    2. Look for a plug icon indicating the server is connected.
    3. Ask Claude questions about your code. Claude will use the search_code tool to query your local SeaGOAT server.
    {
      "mcpServers": {
        "seagoat": {
          "command": "seagoat-mcp",
          "args": []
        }
      }
    }
  10. Start and Stop the SeaGOAT server

    main

    SeaGOAT requires a running server to provide fast semantic search results. The server can be run entirely locally and does not require an internet connection.

    To start the server for a specific repository:

    seagoat-server start /path/to/your/repo

    To stop the server for a specific repository:

    seagoat-server stop /path/to/your/repo
  11. Set up the SeaGOAT development environment

    main

    To develop SeaGOAT, you need to clone the repository, install dependencies using Poetry, and verify the setup with tests.

    Prerequisites

    • Git
    • Python 3.11 or newer
    • Poetry

    Setup Steps

    1. Clone the repository:
      git clone git@github.com:kantord/SeaGOAT.git
      cd SeaGOAT
    2. Install dependencies: Use Poetry to manage dependencies and create the virtual environment:
      poetry install
    3. Verify installation: Run the test suite to ensure the environment is correct:
      poetry run pytest
    git clone git@github.com:kantord/SeaGOAT.git
    cd SeaGOAT
    poetry install
    poetry run pytest
  12. Run automatic linting and formatting

    main

    SeaGOAT uses pre-commit for linting and automatic code formatting. While these run automatically during commits if hooks are installed, you can trigger them manually for the entire codebase using:

    pre-commit run --all-files

    (Note: If running via Poetry, use poetry run pre-commit run --all-files)