Thank you for your interest in contributing. This document covers everything you need to build, test, and extend the engine.
| Requirement | Minimum Version | Notes |
|---|---|---|
| CMake | 3.20 | cmake --version |
| Ninja | 1.11 | Recommended generator (faster incremental builds) |
| MSVC | 19.44 (VS 2022) | Windows primary target; GCC/Clang also supported |
| vcpkg | latest | Package manager; set VCPKG_ROOT environment variable |
| OpenSSL | 3.x | TLS support for live OpenAI streaming (vcpkg install openssl) |
| spdlog | 1.12+ | Structured logging (vcpkg install spdlog) |
| yaml-cpp | 0.8+ | Config file parsing (vcpkg install yaml-cpp) |
| GTest | 1.14+ | Unit and integration tests (vcpkg install gtest) |
| nlohmann-json | 3.11+ | SSE JSON parsing (vcpkg install nlohmann-json) |
| hiredis | optional | Redis deduplication backend (vcpkg install hiredis) |
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"On Windows (PowerShell):
cmake -B build -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"To enable TLS (required for live OpenAI streaming), OpenSSL must be found by CMake. The build system detects it automatically via find_package(OpenSSL QUIET) and defines LLMQUANT_TLS_ENABLED when found.
cmake --build build --config Release --parallelcmake -B build-debug -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build-debug --parallelctest --test-dir build -VOr to run only specific test suites:
ctest --test-dir build -V -R "RiskManager"The test executable is also runnable directly:
# Windows
./build/Release/tests.exe
# Linux/macOS
./build/testsAll 1,491 tests must pass before any pull request is merged. Zero failures, zero new warnings.
- Formatter:
clang-formatwith the.clang-formatfile at the repo root (if absent, use Google style as a baseline). - No exceptions in hot path: All functions on the token-processing critical path (
process_semantic_weight,map_token_to_weight,evaluate, the read loop inLLMStreamClient) must not throw. Use return values (bool,std::optional, or result structs) for error signalling. - Thread safety: Document thread-safety contracts in Doxygen class comments. Every class comment must state what methods are safe to call concurrently.
- No raw owning pointers: Use
std::unique_ptrorstd::shared_ptrfor heap ownership. Raw pointers are acceptable only for non-owning observer references. - Atomics for stats: All observable counters must be
std::atomicso that monitoring-thread reads are safe. - Header guards: Use
#pragma once. No#ifndef/#defineguards. - Namespace: All production code lives in
namespace llmquant. Tests may use anonymous or test-scoped namespaces.
Follow these steps to add a new semantic token category (e.g. a new directional word "capitulate"):
Open src/LLMAdapter.cpp and find initialize_default_mappings(). Add a new entry:
add_token_mapping("capitulate", SemanticWeight{
.sentiment_score = -0.7, // bearish
.confidence_score = 0.8,
.volatility_score = 0.5,
.directional_bias = -0.6,
});Choose values in [-1.0, 1.0] for sentiment, volatility, and directional_bias; [0.0, 1.0] for confidence.
Open tests/test_llm_adapter.cpp (or the appropriate test file) and add a test case:
TEST(LLMAdapterTest, CapitulateMapsToNegativeBias) {
LLMAdapter adapter;
auto w = adapter.map_token_to_weight("capitulate");
EXPECT_LT(w.directional_bias, 0.0);
EXPECT_GT(w.confidence_score, 0.5);
}Run the engine without an API key:
./build/Release/LLMTokenStreamQuantEngine --no-colorModify main.cpp temporarily to inject "capitulate" into the in-memory token list and confirm the signal pipeline produces the expected BIAS/VOL output.
Add the new token to the appropriate row in the "Token-to-Signal Mapping" table in README.md.
cmake --build build --config Release && ctest --test-dir build -VZero failures required.
-
ctest --test-dir build -Vpasses with zero failures - No new compiler warnings under
-Wall -Wextra -Werror(or/W4 /WXon MSVC) - New public functions have Doxygen
/** @brief ... */comments - Thread-safety contract documented for any new class
-
README.mdupdated if a user-visible feature was added -
CHANGELOG.mdentry added under[Unreleased]
Install pre-commit hooks with: pip install pre-commit && pre-commit install