kortex-code
v0.1.0
Published
Kortex Code — a fast, multi-provider terminal coding agent.
Readme
Kortex Code is an AI coding agent for your local terminal. It can inspect a repository, edit files, run commands, use browser/terminal helpers, and keep durable local sessions while you choose the model and the permission level.
ktx
ktx exec "fix the failing test in ./pkg"
ktx exec --output-format stream-json < turns.jsonlWhy Kortex Code
- Use the model you want. Bring OpenAI, Anthropic, Gemini, Groq, OpenRouter, DeepSeek, Mistral, xAI, Qwen, Kimi, GitHub Models, Ollama, LM Studio, or any OpenAI-/Anthropic-compatible endpoint.
- Stay in control. File writes, shell commands, network access, and out-of-workspace writes go through Kortex Code's permission and sandbox policy.
- Works in the terminal. The TUI has model/provider pickers, image input, slash commands, live plan/tool rendering, scrollback, themes, and resume/fork support.
- Works without the TUI.
ktx execis scriptable, supports text/JSON/ stream-JSON I/O, isolated worktrees, spec-first runs, and meaningful exit codes for CI. - Keeps context local. Sessions are stored on disk, searchable, resumable, and never uploaded as telemetry by Kortex Code.
- Extensible when you need it. Use MCP servers, skills, plugins, hooks, and specialist subagents from the same CLI.
Install
npm
npm install -g kortex-code
ktxThe npm package installs a small wrapper plus the matching Kortex Code binary for your platform from GitHub Releases. It supports Linux, macOS, and Windows on x64 and arm64.
Install scripts
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/omarciopaullino/kortex-code/main/scripts/install.sh | bashWindows PowerShell:
irm https://raw.githubusercontent.com/omarciopaullino/kortex-code/main/scripts/install.ps1 | iexFrom source
Source builds require Go 1.25+.
git clone https://github.com/omarciopaullino/kortex-code.git
cd kortex-code
go run ./cmd/ktxRelease installers and the npm wrapper require published GitHub Release assets. If you are testing before the first public release, build from source:
go build -o ktx ./cmd/ktxOn Linux, build the sandbox helper too if you want native sandboxing:
go build -o ktx-linux-sandbox ./cmd/zero-linux-sandbox
go build -o ktx-seccomp ./cmd/zero-seccomp # optional compatibility wrapperPut ktx and ktx-linux-sandbox in the same directory on PATH
(~/.local/bin is a good default). macOS does not need an extra helper binary.
Windows source builds can use the main ktx.exe as their sandbox helper; release
archives still ship standalone Windows helper executables.
More install details: docs/INSTALL.md.
First Run
Start the TUI:
ktxThe setup wizard helps you pick a provider and model. You can also configure providers from the command line:
ktx setup
ktx providers list
ktx models list
ktx doctorFor API providers, set the matching environment variable before setup or enter the key in the wizard:
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=...
export GEMINI_API_KEY=...For local models, run Ollama or LM Studio and then use ktx setup or
ktx providers detect.
Daily Use
Interactive TUI
ktxUseful controls:
| Control | Action |
|---|---|
| Enter | send the prompt |
| / | open slash-command suggestions |
| Shift+Tab | cycle permission mode |
| Ctrl+B | show/hide the sidebar |
| Ctrl+C | cancel or exit |
Common slash commands:
| Command | Purpose |
|---|---|
| /model, /provider | switch the active model/provider |
| /spec, /plan | draft and review a plan before building |
| /image | attach an image for vision-capable models |
| /resume, /rewind | continue or roll back local sessions |
| /compact, /context | manage context usage |
| /permissions, /tools | inspect available tools and policy |
| /add-dir | allow an extra write directory for this session |
| /theme, /doctor, /config | adjust appearance and inspect setup |
Headless exec
ktx exec "explain internal/agent/loop.go"
ktx exec --model claude-sonnet-4.5 "refactor the config loader"
ktx exec --use-spec "add rate limiting to the API client"
ktx exec --worktree "try the migration in an isolated worktree"
ktx exec --resume
ktx exec --fork <session-id> "try the other approach"Programmatic use:
ktx exec --input-format stream-json --output-format stream-json < turns.jsonlThe stream-JSON contract is documented in docs/STREAM_JSON_PROTOCOL.md.
Safety Model
Kortex Code is designed to make side effects visible.
- Workspace reads are allowed by default.
- File writes are limited to the workspace unless you grant another directory.
- Shell commands, network access, destructive commands, and elevated actions are permission-gated.
--add-dir <path>and/add-dir <path>grant additional write roots without giving the agent the whole filesystem.- Unsafe/autonomous modes are explicit opt-ins.
- Secrets are redacted from tool output and logs where Kortex Code controls the surface.
Example:
ktx --add-dir ../docs-site
ktx exec --add-dir ../shared "update both repos"Sandbox behavior can be inspected with:
ktx sandbox policy
ktx sandbox grants listWeb And Local Control
Kortex Code includes local file/search/edit/shell tools, web_fetch for public URLs,
and MCP support for additional tools.
For local dev servers, use shell commands such as curl through exec_command
so the normal sandbox and permission policy applies. Long-running commands stay
attached to a background terminal session and can be listed or stopped from the
TUI.
The npm package also includes browser and terminal helper packages used by local
browser/terminal tools. Source builds can use the same helpers when they are on
PATH or configured in Kortex Code's local-control settings.
Common Commands
ktx interactive TUI
ktx exec one-shot or scripted agent run
ktx setup first-run provider setup
ktx auth OAuth/login helpers for supported providers
ktx models model registry and capabilities
ktx providers provider profiles and detection
ktx doctor setup, key, and connectivity checks
ktx context context-budget report
ktx repo-map deterministic repository map
ktx repo-info local repository summary
ktx search | find search local session history
ktx sessions inspect, resume, fork, and rewind sessions
ktx spec manage spec-mode drafts
ktx specialist manage specialist subagents
ktx skills manage markdown instruction skills
ktx plugins manage plugins
ktx hooks manage lifecycle hooks
ktx mcp manage MCP servers and tools
ktx serve --mcp expose Kortex Code tools over MCP stdio
ktx sandbox inspect sandbox policy and grants
ktx worktrees prepare isolated git worktrees
ktx verify detect and run local verification checks
ktx changes inspect and commit local git changes
ktx usage token usage and estimated cost
ktx cron scheduled agent jobs
ktx update check for newer releasesAppearance And Accessibility
| Control | Effect |
|---|---|
| NO_COLOR=<anything> | disables color output |
| KTX_THEME=<name> | selects the startup theme (auto, dark, light, or a color theme like dracula, nord, gruvbox, tokyo-night, catppuccin, one-dark, solarized-dark, rose-pine, everforest, solarized-light) |
| --theme <name> | selects the TUI theme from the CLI (same names) |
| /theme | opens the theme picker inside the TUI (live preview; /theme <name> switches directly) |
| KTX_NO_FADE=1 | disables streaming fade animation |
Meaning does not rely on color alone; diffs, permissions, and statuses also use text or glyph markers.
Development
go test ./...
go run ./cmd/zero-release build
go run ./cmd/zero-release smoke
go run ./cmd/zero-perf-benchCross-compile examples:
go run ./cmd/zero-release build --goos linux --goarch amd64
go run ./cmd/zero-release build --goos windows --goarch amd64 --output dist/ktx.exeDocumentation
Contributing
Contributions are welcome. Read CONTRIBUTING.md, run the relevant tests, and open a focused pull request.
Security reports should follow SECURITY.md.
License
Kortex Code is released under the MIT License.
