This guide covers installing Kcode from source, preparing the development environment, configuring PATH, validating the checkout, and setting up optional LM Studio/local OpenAI-compatible model support.
Kcode is a Rust project. You need:
- Git;
- Rust stable toolchain;
- a Unicode-capable terminal;
- platform build tools;
- network access for crates and provider/local model endpoints.
Recommended developer tools:
ripgrepfor fast source search;python3for docs validation;pkg-configand SSL headers on Linux;- WSL2 for Windows development if native Rust tooling is inconvenient.
Use rustup unless your environment has a managed Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustc --version
cargo --versiongit clone https://github.com/icedmoca/kcode.git
cd kcode
cargo build --releaseDebug build:
cargo build
cargo runRelease binary path:
target/release/kcodeFor a one-session PATH update:
export PATH="$PWD/target/release:$PATH"For persistent shell use, add the absolute path to your shell profile:
export PATH="/absolute/path/to/kcode/target/release:$PATH"Then reload:
exec "$SHELL" -lFrom a remote checkout path:
curl -fsSL https://raw.githubusercontent.com/icedmoca/kcode/main/install.sh | bash
exec "$SHELL" -l
kcodeFrom a local clone:
./install.sh
kcodeInspect install.sh before running it if you are operating in a constrained or security-sensitive environment.
Install typical build dependencies. Debian/Ubuntu example:
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev git curl python3Install Xcode Command Line Tools:
xcode-select --installThen install Rust and build normally.
WSL2 is recommended. Build inside the Linux environment. If interacting with Windows-hosted LM Studio, see the WSL networking notes below.
After installation:
cargo fmt --check
cargo check --lib
python3 scripts/validate_docs.pyFocused subsystem checks:
cargo test --lib operational_repair_learning
cargo test --lib adaptive_cognition
cargo test --lib local_modelProvider-specific credentials are adapter-dependent. General rules:
- never commit secrets;
- prefer built-in auth/account flows when available;
- keep provider smoke tests cheap;
- record provider/model IDs when diagnosing failures;
- treat account failover behavior as provider-specific.
Kcode includes local model diagnostics for LM Studio and other OpenAI-compatible local servers.
- Open LM Studio.
- Download or select a chat/instruct model.
- Load the model.
- Start the local server.
- Confirm the base URL. LM Studio commonly uses:
http://127.0.0.1:1234/v1
Inside the TUI:
/kcode-local-model
The command checks /v1/models and /v1/chat/completions, then reports endpoint health, model availability, and a small completion smoke test.
cargo run --bin kcode-bench -- \
--local-provider lmstudio \
--local-url http://127.0.0.1:1234/v1 \
--local-model '<model-id-from-lm-studio>'For sidecar support, prioritize:
- fast inference;
- good summarization;
- coding/log familiarity;
- reliable instruction following;
- context length appropriate for log compression.
A smaller fast model can be better as a sidecar than a huge slow model because the sidecar's job is often compression and support, not primary reasoning.
| Symptom | Likely cause | Fix |
|---|---|---|
| Connection refused | Server stopped or wrong port | Start server and verify URL |
| No models listed | No model loaded | Load model in LM Studio |
| Timeout | Model too large or hardware saturated | Try smaller quantization/model |
| Bad answers | Weak local model | Use sidecar for summaries, not final reasoning |
| WSL cannot connect | Windows/WSL networking boundary | Use Windows host IP or adjust firewall |
If Kcode runs in WSL and LM Studio runs on Windows, 127.0.0.1 may not always point where you expect. Try:
cat /etc/resolv.confor inspect the Windows host IP visible from WSL. Then pass the URL explicitly to benchmark commands.
Validate docs after changes:
python3 scripts/validate_docs.py --write-inventory
python3 scripts/validate_docs.pyCommit generated inventory updates with the code changes that caused them.