Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development Setup

Get started contributing to ReasonKit.

Prerequisites

  • Rust 1.75+ (install via rustup)
  • Git for version control
  • LLM API key (Anthropic, OpenAI, or OpenRouter)

Optional:

  • Python 3.10+ for Python bindings
  • Node.js 18+ for documentation site
  • Docker for containerized development

Quick Start

# Clone the repository
git clone https://github.com/reasonkit/reasonkit-core.git
cd reasonkit-core

# Install dependencies and build
cargo build

# Run tests
cargo test

# Run the CLI
cargo run -- think "Test question"

Environment Setup

API Keys

# Set your API key
export ANTHROPIC_API_KEY="sk-ant-..."
# OR
export OPENAI_API_KEY="sk-..."
# OR
export OPENROUTER_API_KEY="sk-or-..."

IDE Setup

VS Code

Recommended extensions:

  • rust-analyzer
  • CodeLLDB (for debugging)
  • Even Better TOML
  • Error Lens
// .vscode/settings.json
{
  "rust-analyzer.check.command": "clippy",
  "rust-analyzer.cargo.features": "all"
}

JetBrains (RustRover/IntelliJ)

Install Rust plugin and configure:

  • Toolchain: Use rustup default
  • Cargo features: all

Git Hooks

# Install pre-commit hooks
./scripts/install-hooks.sh

# Manual hook installation
cp hooks/pre-commit .git/hooks/
chmod +x .git/hooks/pre-commit

Project Structure

reasonkit-core/
├── src/
│   ├── lib.rs           # Library entry point
│   ├── main.rs          # CLI entry point
│   ├── thinktools/      # ThinkTool implementations
│   │   ├── mod.rs
│   │   ├── gigathink.rs
│   │   ├── laserlogic.rs
│   │   ├── bedrock.rs
│   │   ├── proofguard.rs
│   │   ├── brutalhonesty.rs
│   │   └── powercombo.rs
│   ├── profiles/        # Reasoning profiles
│   ├── providers/       # LLM provider implementations
│   ├── output/          # Output formatters
│   └── config/          # Configuration handling
├── tests/               # Integration tests
├── benches/             # Benchmarks
├── docs/                # Documentation (mdBook)
└── examples/            # Example usage

Development Workflow

Building

# Debug build
cargo build

# Release build (optimized)
cargo build --release

# Build with all features
cargo build --all-features

Testing

# Run all tests
cargo test

# Run specific test
cargo test test_gigathink

# Run tests with output
cargo test -- --nocapture

# Run integration tests
cargo test --test integration

# Run with coverage
cargo llvm-cov

Linting

# Run clippy
cargo clippy -- -D warnings

# Format code
cargo fmt

# Check formatting
cargo fmt -- --check

Benchmarks

# Run benchmarks
cargo bench

# Run specific benchmark
cargo bench gigathink

Documentation

# Build Rust docs
cargo doc --open

# Build mdBook docs
cd docs && mdbook serve

Running Locally

CLI

# Run directly
cargo run -- think "Your question here"

# With profile
cargo run -- think "Question" --profile deep

# With specific tool
cargo run -- gigathink "Question"

As Library

# Run example
cargo run --example basic_usage

# Run with release optimizations
cargo run --release --example full_analysis

Docker Development

# Build image
docker build -t reasonkit-dev .

# Run container
docker run -it \
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
  -v $(pwd):/app \
  reasonkit-dev

# Run tests in container
docker run reasonkit-dev cargo test

Debugging

VS Code

// .vscode/launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "lldb",
      "request": "launch",
      "name": "Debug CLI",
      "cargo": {
        "args": ["build", "--bin=rk-core"],
        "filter": {
          "name": "rk-core",
          "kind": "bin"
        }
      },
      "args": ["think", "Test question"],
      "cwd": "${workspaceFolder}"
    }
  ]
}

Logging

# Enable debug logging
RUST_LOG=debug cargo run -- think "question"

# Trace level for maximum detail
RUST_LOG=trace cargo run -- think "question"

Common Issues

“API key not found”

# Verify key is set
echo $ANTHROPIC_API_KEY

# Or use .env file
cp .env.example .env
# Edit .env with your key

Build failures

# Update Rust
rustup update

# Clean and rebuild
cargo clean && cargo build

# Update dependencies
cargo update

Tests failing

# Run with verbose output
cargo test -- --nocapture

# Check if API key is valid
rk-core providers test anthropic

Next Steps