Thanks for your interest in contributing to Kai. This guide covers what we accept, how to set up a development environment, and how to submit changes.
Have questions? Join us on Slack.
Kai is fully open source under Apache 2.0. This repo contains the core engine and CLI. The server components live in the kai-server repo.
- Bug fixes
- Performance improvements
- Determinism improvements
- Documentation improvements
- Additional language support (parsers, symbol extraction, call graphs)
- CI integration enhancements
- Test coverage improvements
- CLI UX improvements
Server and cloud contributions (authentication, multi-tenancy, hosting, RBAC, SSO, etc.) are welcome in the kai-server repo.
- Changes that introduce network dependencies into kai-core
- Breaking changes without prior discussion in an issue
- License changes
These boundaries protect the architectural separation between the core engine and server. See docs/architecture-boundary.md for details.
- All PRs require at least one maintainer approval
- PRs must pass CI before merging
- PRs must include tests if behavior changes
- PRs must preserve deterministic behavior
- PRs must not introduce prohibited dependencies (no
net/httpor cloud SDKs in kai-core)
- Check existing issues to avoid duplicating work
- For large changes, open an issue first to discuss the approach
- Keep PRs focused — one logical change per PR
- Initial review within 5 business days
- Major design discussions may take longer
- If your PR has been waiting, ping us on Slack or in the PR
Maintainers reserve the right to decline contributions that conflict with project direction, architectural boundaries, or correctness guarantees. We'll always explain why.
Kai's core promise is deterministic, reproducible results. Any change that affects the following must include regression tests:
- Graph construction or hashing
- Snapshot content or ordering
- CI plan output or test selection
- ChangeSet computation
Run the regression suite before submitting:
cd kai-cli && CGO_ENABLED=1 go test ./cmd/kai/ \
-run "TestGraph_|TestSelection_|TestFalseNeg_|TestShadow_|TestFlaky_|TestCLI_|TestPerf_" \
-v -count=1If your change produces different output for the same input, it must be discussed in an issue first.
The scripts/check-core-purity.sh script enforces these rules in CI:
- No
net/httpimports in kai-core - No cloud SDK dependencies in kai-core
- No cloud provider URLs in kai-core
- No server-specific concepts (
tenant,org_id,sso,billing) in kai-core
Run it locally before submitting:
./scripts/check-core-purity.sh- Go 1.24+
- GCC or Clang (for CGO — tree-sitter and SQLite)
- Git
# CLI
cd kai-cli
CGO_ENABLED=1 go build ./cmd/kai
# Core library
cd kai-core
CGO_ENABLED=1 go build ./...# All tests
cd kai-cli && CGO_ENABLED=1 go test ./...
cd kai-core && CGO_ENABLED=1 go test ./...
# Benchmarks
./bench/run_repos.sh --mode both -n 3kai-cli/ CLI binary (commands, CI plan, shadow mode)
kai-core/ Core engine (tree-sitter parsing, graph, snapshots)
bench/ Benchmark harness
docs/ Architecture, licensing, and reference docs
scripts/ Enforcement and utility scripts
- Follow standard Go conventions (
gofmt,go vet) - No unnecessary abstractions — simpler is better
- Tests go next to the code they test (
*_test.go) - Don't add comments that restate the code
Write clear, concise commit messages:
Fix barrel import re-export handling in extractImports
export { x } from './y' was not producing IMPORTS edges because
extractImports only handled import_statement and call_expression.
Added export_statement case with parseReexportSource helper.
- First line: imperative mood, under 72 characters
- Body: explain why, not just what
All contributions must be signed off under the Developer Certificate of Origin. This certifies that you have the right to submit the code and that it can be distributed under the Apache 2.0 license.
Add a Signed-off-by line to your commits:
git commit -s -m "Fix barrel import re-export handling"This adds a line like:
Signed-off-by: Your Name <your.email@example.com>
You can configure Git to do this automatically:
git config --global format.signoff truePRs without DCO sign-off will not be merged.
Source files should include an SPDX copyright header:
./scripts/check-copyright-headers.sh # Check
./scripts/check-copyright-headers.sh --fix # Auto-add missing headers- Fork the repository
- Create a branch from
main - Make your changes with tests
- Run
./scripts/check-core-purity.sh - Sign off your commits (
git commit -s) - Ensure CI passes:
go test ./...in each module - Open a PR against
main
Vulnerabilities should not be submitted as public issues. See SECURITY.md for responsible disclosure instructions.
- Use the bug report template for bugs
- Use the feature request template for ideas
- Include reproduction steps, expected vs actual behavior, and environment details
Open a discussion or join Slack.