{"id":47740294,"url":"https://github.com/kaicontext/kai","last_synced_at":"2026-06-07T09:03:59.264Z","repository":{"id":328411370,"uuid":"1114929612","full_name":"kaicontext/kai","owner":"kaicontext","description":"Kai is a semantic analysis engine that sits on top of Git. It captures meaningful changes, generates semantic diffs, and produces safe selective CI plans.","archived":false,"fork":false,"pushed_at":"2026-05-23T06:06:32.000Z","size":37196,"stargazers_count":15,"open_issues_count":29,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-23T08:13:52.042Z","etag":null,"topics":["call-graph","cli","code-intelligence","developer-tools","golang","mcp","model-context-protocol","semantic-analysis","semantic-diff"],"latest_commit_sha":null,"homepage":"https://kaicontext.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaicontext.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-12T05:07:25.000Z","updated_at":"2026-05-23T06:06:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f44c968-72c4-4b27-aa38-0307386be484","html_url":"https://github.com/kaicontext/kai","commit_stats":null,"previous_names":["kailayerhq/kai","kaicontext/kai"],"tags_count":168,"template":false,"template_full_name":null,"purl":"pkg:github/kaicontext/kai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicontext%2Fkai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicontext%2Fkai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicontext%2Fkai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicontext%2Fkai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaicontext","download_url":"https://codeload.github.com/kaicontext/kai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicontext%2Fkai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33450407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T19:21:36.376Z","status":"ssl_error","status_checked_at":"2026-05-24T19:21:10.562Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["call-graph","cli","code-intelligence","developer-tools","golang","mcp","model-context-protocol","semantic-analysis","semantic-diff"],"created_at":"2026-04-02T23:39:57.735Z","updated_at":"2026-05-24T21:04:10.321Z","avatar_url":"https://github.com/kaicontext.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"kai.webp\" alt=\"Kai Logo\" width=\"400\"\u003e\n\u003c/p\u003e\n\n# Kai\n\n**Semantic infrastructure for code change.**\n\nKai understands what code *means* — functions, dependencies, behavior impact —\nnot just which lines changed. This semantic graph powers precise CI,\ncontext-aware IDEs, and verifiable AI coding agents.\n\n[kaicontext.com](https://kaicontext.com) · [Docs](https://docs.kaicontext.com) · [Slack](https://join.slack.com/t/kailayer/shared_invite/zt-3q8ulczwl-vkZ05GQH~kwudonmH53hGg)\n\n---\n\n## Install\n\n```bash\n# curl\ncurl -sSL https://get.kaicontext.com | sh\n\n# Homebrew\nbrew install kaicontext/kai/kai\n```\n\n## Quick Start\n\n```bash\nkai init                      # One-shot setup: graph, MCP, account, remote\nkai capture -m \"Initial\"      # Snapshot your code with a message\nkai push                      # Push to kaicontext.com\nkai diff                      # Semantic change impact\n```\n\n`kai init` runs a single, low-friction setup flow:\n\n1. **Creates the semantic graph** in `.kai/` and builds the first capture.\n2. **Imports git history** automatically (for repos with ≤1000 commits) — no prompt.\n3. **Installs git hooks** for auto-capture on commit and auto-push on `git push`.\n4. **Installs the Kai MCP server** for any detected AI coding tool (Claude Code,\n   Codex). If the `kai` MCP is already registered, it's left alone; otherwise it's\n   added automatically — no prompt.\n5. **Signs you up for kaicontext.com** in-place: asks for your email, emails you\n   a login link, you paste the token back, and Kai creates a personal org named\n   after you plus a repo for the current directory. Your first push goes out at\n   the end of init.\n\nEvery step runs by default. Press `Ctrl+C` to skip the account step if you'd\nrather stay local; everything else is automatic.\n\nFor full command reference, see [docs/cli-reference.md](docs/cli-reference.md).\n\n---\n\n## MCP Server\n\nKai ships an [MCP](https://modelcontextprotocol.io) server that gives AI coding assistants\naccess to call graphs, dependency maps, impact analysis, and test coverage.\n\n```bash\n# Claude Code\nclaude mcp add kai -- kai mcp serve\n\n# Or without installing kai (npx downloads it automatically)\nclaude mcp add kai -- npx -y kai-mcp\n```\n\nNo setup required — the server lazily initializes the semantic graph on first use.\n\n12 tools: `kai_status`, `kai_symbols`, `kai_files`, `kai_diff`, `kai_impact`, `kai_callers`, `kai_callees`, `kai_context`, `kai_dependencies`, `kai_dependents`, `kai_tests`, `kai_refresh`.\n\nSee [docs/mcp.md](docs/mcp.md) for Cursor setup, tool reference, and troubleshooting.\n\n---\n\n## Bring Your Own Model\n\nKai's agentic TUI (`kai`) uses kailab as the default LLM provider — you sign in with `kai auth login` and the server holds the upstream key. If you'd rather use your own API key (or a local model), set `KAI_PROVIDER` and the matching key.\n\nKailab credentials are still used for sync, shared safety gates, and team features when present, regardless of which LLM provider you pick.\n\n### Anthropic (direct)\n\n```bash\nexport KAI_PROVIDER=anthropic\nexport ANTHROPIC_API_KEY=sk-ant-...\nkai\n```\n\nSame wire shape and prompt-caching behavior as kailab. Costs and rate limits are billed to your Anthropic account.\n\n### OpenAI / OpenAI-compatible\n\n```bash\nexport KAI_PROVIDER=openai\nexport OPENAI_API_KEY=sk-...\nexport KAI_OPENAI_MODEL=gpt-4o\nkai\n```\n\nWorks with OpenAI, Together, Groq, OpenRouter, and any endpoint that speaks the `chat.completions` protocol. **No prompt caching** — every turn re-sends the conversation at full cost. Expect 5–10× the per-session cost of an equivalent Anthropic run.\n\n### Local models (Ollama, vLLM, LM Studio)\n\n```bash\n# `openai-compatible` (or `local`) is an alias for `openai` —\n# more honest about the fact that the endpoint isn't actually\n# OpenAI. Same wire protocol, different vendor.\nexport KAI_PROVIDER=openai-compatible\nexport KAI_OPENAI_BASE_URL=http://localhost:11434/v1\nexport KAI_OPENAI_MODEL=llama3.1:70b\nkai\n```\n\n`OPENAI_API_KEY` is optional for endpoints that don't require auth. Tool-use quality varies sharply by model — pick one that natively supports the OpenAI tool-call protocol (Llama 3.1 70B+, Qwen 2.5 32B+, Hermes-tuned models). Smaller models often emit tool calls as text, which Kai can extract with limited fidelity (set `KAI_OPENAI_TOOL_FORMAT=hermes|llama3` to opt into a specific text format).\n\n### Provider tradeoffs\n\n|                 | kailab        | Anthropic direct | OpenAI / compat | Local         |\n|-----------------|---------------|------------------|-----------------|---------------|\n| Setup           | `kai auth login` | API key       | API key         | Local server  |\n| Prompt caching  | Yes (server)  | Yes              | No              | No            |\n| Per-session cost | Lowest       | Low              | ~5–10× higher   | Free (compute) |\n| Tool-use fidelity | High        | High             | High            | Varies by model |\n| Sync + team gates | Yes         | Only if logged into kailab | Only if logged into kailab | Only if logged into kailab |\n\n### Environment variables\n\n| Variable                   | Purpose                                        |\n|----------------------------|------------------------------------------------|\n| `KAI_PROVIDER`             | `kailab` (default), `anthropic`, or `openai`. Aliases: `openai-compatible` / `oai-compat` / `local` for `openai`; `anthropic-direct` / `claude` for `anthropic`. |\n| `ANTHROPIC_API_KEY`        | Required for `anthropic`                       |\n| `KAI_ANTHROPIC_BASE_URL`   | Override Anthropic endpoint (rare)             |\n| `KAI_ANTHROPIC_MODEL`      | Override default model on Anthropic            |\n| `OPENAI_API_KEY`           | Used by `openai` (optional for local)          |\n| `KAI_OPENAI_BASE_URL`      | OpenAI-compatible endpoint URL                 |\n| `KAI_OPENAI_MODEL`         | Override default model on OpenAI               |\n| `KAI_OPENAI_TOOL_FORMAT`   | `raw` (default), `hermes`, or `llama3`         |\n| `KAI_MAX_SESSION_COST_USD` | Pause and prompt before exceeding this cap     |\n\nRun `kai auth status` to see which provider is active and whether kailab sync is connected.\n\n→ Full reference, troubleshooting, and per-provider model recommendations: [docs.kaicontext.com/bring-your-own-model](https://docs.kaicontext.com/bring-your-own-model)\n\n---\n\n## Code Reviews\n\nKai reviews are anchored to semantic changesets, not line diffs.\n\n```bash\nkai review open --title \"Add auth middleware\"   # Create a review\nkai push                                         # Push to kaicontext.com\nkai fetch --review abc123                        # Sync comments from web\nkai review comments abc123                       # View inline comments locally\n```\n\nOn the web, reviews show semantic diffs (what functions changed, not just which lines), inline commenting, and one-click merge that updates `snap.main`.\n\n---\n\n## CI Integration\n\nKai CI runs workflows defined in `.kailab/workflows/` with semantic checkout, parallel jobs, and 30-minute default timeouts.\n\n```bash\nkai ci runs                   # List CI runs\nkai ci logs 42                # View logs for run #42\nkai ci cancel 42              # Cancel a run\nkai capture -m \"Fix bug\"      # Message shows as CI run headline\n```\n\nEmail notifications on pipeline completion are sent to the snapshot author via Postmark.\n\n---\n\n## What Kai Builds\n\nFor every capture, Kai constructs a queryable semantic model:\n\n| Layer | What It Captures |\n|-------|----------------|\n| **Functions \u0026 methods** | Signatures, bodies, call graphs |\n| **Dependencies** | Module relationships, imports, data flow |\n| **Behavior changes** | What actually changed in meaning, not just text |\n| **Test coverage** | Which tests cover which source files (static + transitive) |\n\nThis graph is immutable, content-addressed, and designed for machine reasoning.\n\n---\n\n## Use Cases\n\n### Selective CI\nKai determines which tests actually need to run based on behavioral impact,\nnot file diffs. Result: 80% CI time reduction for early users.\n\n### AI Code Context\n12 MCP tools give AI assistants structured access to your codebase's\ndependency graph, call graph, impact analysis, and test coverage.\n\n### Code Reviews\nSemantic diff shows *what changed* (function added, condition modified, API changed)\ninstead of raw line diffs. Inline comments anchored to symbols, not lines.\n\n### Verified AI Agents\nAgent proposes edit → Kai validates impact →\nagent executes with proof, not generation with hope.\n\n---\n\n## Language Support\n\nKai uses [tree-sitter](https://tree-sitter.github.io/) for parsing and builds semantic graphs for 9 languages.\nEach language is validated with [end-to-end tests](kai-e2e/) against real open-source projects:\n\n| Language | Symbols | Callers/Callees | Dependencies | Tests | Impact | E2E Fixtures |\n|----------|---------|-----------------|--------------|-------|--------|-------------|\n| **Go** | functions, methods, interfaces, structs | cross-package via import aliases | Go package resolution | same-dir `_test.go` + transitive | via dependency graph | [chi](https://github.com/go-chi/chi), [lo](https://github.com/samber/lo) |\n| **Rust** | functions, structs, enums, traits, impl methods, macros | cross-file via exports | `crate::`, `super::`, `self::`, `mod`, wildcards | filename pattern matching for integration tests | via dependency graph | [just](https://github.com/casey/just), [miniserve](https://github.com/svenstaro/miniserve) |\n| **TypeScript/JavaScript** | functions, classes, methods, variables | via imports | relative + workspace resolution | `*.test.ts`, `__tests__/` patterns | via dependency graph | — |\n| **Python** | functions, classes, methods | via imports | dotted module resolution | `test_*.py`, `*_test.py` patterns | via dependency graph | — |\n| **Ruby** | methods, classes, modules | via exports | `require`, `require_relative`, Zeitwerk autoload | `*_spec.rb`, `*_test.rb` patterns | via dependency graph | — |\n| **SQL** | — | — | — | — | — | — |\n| **PHP** | functions, classes, methods | — | — | — | — | — |\n| **C#** | functions, classes, methods | — | — | — | — | — |\n\n92 E2E tests across Go, Rust, and push completeness, all passing. Run them with:\n\n```bash\ncd kai-e2e \u0026\u0026 ./scripts/run-tests.sh\n```\n\n---\n\n## Architecture\n\nKai is fully open source under Apache 2.0: core engine, CLI, and server.\nKai Cloud is the hosted version — same code, managed infrastructure.\n\n```\nkai capture → local semantic graph (SQLite)\nkai push    → kaicontext.com (Postgres + GCS)\n                ├── File viewer with search, language breakdown\n                ├── CI with SSE live updates\n                ├── Code reviews with semantic diffs\n                └── Email notifications (Postmark)\n```\n\nSee [What's Open Source vs. Kai Cloud](docs/architecture-boundary.md).\n\n---\n\n## License\n\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nSee [LICENSE](LICENSE).\n\n---\n\n## Community \u0026 Contributing\n\n- [Slack](https://join.slack.com/t/kailayer/shared_invite/zt-3q8ulczwl-vkZ05GQH~kwudonmH53hGg)\n- [Contributing guidelines](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaicontext%2Fkai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaicontext%2Fkai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaicontext%2Fkai/lists"}