Flock is built on top of DuckDB’s extension framework using C++17. Whether you want to contribute a new provider adapter, fix a bug, or run the test suite locally, this guide covers everything you need to get from a fresh clone to a working build.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dais-polymtl/flock/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following tools are available on your system:| Tool | Version | Notes |
|---|---|---|
| CMake | 3.5+ | Required for the build system |
| C++ compiler | Any modern | GCC, Clang, or MSVC |
| Build system | Any | Ninja (preferred) or Make |
| Git | Any | Required for submodule management |
| Python 3 | 3.12+ | Optional — only needed for integration tests |
Clone and set up
Clone the repository with submodules
The DuckDB engine is vendored as a Git submodule under If you already cloned without
duckdb/. Use --recursive to fetch it in one step:--recursive, initialize the submodules manually:Build and run via the interactive script
The recommended way to build Flock is the interactive The script walks you through each stage interactively:
build_and_run.sh script. Run it from the repository root:- Prerequisite check — verifies CMake, a C++ compiler, Ninja or Make, and Git are present.
- vcpkg setup — clones and bootstraps vcpkg for dependency management, then installs
libcurlandnlohmann_json. - Build configuration — prompts you to choose Debug or Release mode and sets the appropriate CMake flags including
EXTENSION_STATIC_BUILD=1. - Compilation — runs CMake configure and then builds in parallel using all available CPU cores.
- Launch DuckDB — opens an interactive DuckDB shell with the Flock extension statically linked and ready to use.
The extension is built with
EXTENSION_STATIC_BUILD=1, meaning it is compiled directly into the DuckDB binary rather than as a separate .duckdb_extension file. You do not need to run LOAD 'flock' in the resulting DuckDB shell.Manual build steps
If you prefer full control over the build, you can invoke CMake directly after setting up vcpkg:build/release/duckdb (or build/debug/duckdb). Launch it directly — no LOAD statement required.
Project structure
The repository is organized as follows:Running tests
Flock has two test suites.- Integration tests
- Unit tests
Integration tests use Python and the Copy
duckdb Python package. They require Python 3.12+ and the pytest and dotenv packages. From the repository root:.env-example to .env and add valid API keys for the providers you want to test. Tests that require a provider not configured in .env will be skipped.Coding conventions
Read through an existing function implementation (such as
src/functions/scalar/llm_complete/) before writing new code. Consistency with existing patterns is more important than personal preference.- The project uses C++17. Keep feature usage within that standard.
- Follow the brace style, namespace structure, and include ordering used in surrounding files.
- Avoid adding new third-party dependencies without a clear justification. Existing dependencies are managed via vcpkg and declared in
vcpkg.json. - Submit small, focused pull requests with a clear description of what changes and why.
- New LLM functions must integrate with the metrics API (
src/metrics/) so that token usage and latency are tracked automatically. - Error messages should be clear and actionable — tell the user what went wrong and what they should do about it.
Adding a new provider
Provider adapters live insrc/model_manager/providers/adapters/. Each adapter implements the IProvider interface defined in src/include/flock/model_manager/providers/provider.hpp:
Create the adapter
Add
src/model_manager/providers/adapters/myprovider.cpp and the corresponding header under src/include/flock/model_manager/providers/adapters/. Use one of the existing adapters (e.g., openai.cpp) as a template.Register the provider name
Add a string constant and an enum value for your provider in
src/include/flock/model_manager/repository.hpp, then extend GetProviderType() to recognize the new name.Wire up provider construction
Update
src/model_manager/model.cpp — specifically ConstructProvider() — to instantiate your new adapter when the provider name matches.Add a handler if needed
If your provider uses a unique HTTP batching or streaming pattern, add a handler under
src/model_manager/providers/handlers/. Providers that follow standard REST patterns can reuse an existing handler.Working on the docs
The Mintlify documentation source lives indocs/ at the repository root. To preview it locally:
http://localhost:3000. When adding a new feature to Flock, update the corresponding documentation page alongside your code changes.