Kolega Code
A terminal coding agent where the model writes its own multi-agent workflows.
Kolega Code is a local-first terminal coding agent. For work that is too broad for one agent loop, its Gigacode engine has the model write a Python program that orchestrates multiple sub-agents. The runtime then executes that program.
Gigacode: model-authored orchestration
For a repo-wide review, a migration, or a plan with independent workstreams, the model writes an orchestration program instead of delegating workers one at a time. The program can combine parallel phases, pipelines, adversarial verification, judge panels, and synthesis gates to fit the task. The runtime saves the script so it can be inspected and run again.
Claude Code uses the same model-authored approach for its dynamic workflows (ultracode). Kolega Code provides an open, provider-agnostic implementation whose runtime source is available in this repository.
The runtime journals each completed agent call to disk. Resume is content-keyed
rather than positional: when you use resume_from_run_id, calls with unchanged
semantic inputs replay from the journal at zero token cost. This still works if
the script was edited or reordered, and it works across sessions and process
restarts.
Read how gigacode works for the architecture, or an unedited model-authored workflow with its full provenance and execution record.
How it works
The model investigates your repo, then writes a Python program against a small
runtime API (agent, parallel, pipeline, phase, budget). The runtime
enforces concurrency caps, an agent-count backstop, and token-budget accounting.
It dispatches typed sub-agents, including read-only investigators, coders, and
browser agents, whose activity streams into the TUI's sub-agent inspector.
As the run progresses, the runtime writes the script, per-call results, transcripts, and final result to disk. An interrupted or budget-capped run keeps its journal and can be resumed, with unchanged calls replaying free. The mechanics, guarantees, and limitations are documented in how-gigacode-works.md.
The rest of the agent
Gigacode is off by default. Enable it with /gigacode on. For focused changes,
use Kolega Code as an ordinary terminal coding agent:
- Plan/Build modes: read-only Plan mode for investigation and a reviewable
task list, Build mode to implement (
Shift+Tabto switch). In Plan mode, workflow sub-agents are forced read-only too. - Repo tools: read and search code, create files, apply precise edits, and inspect session changes/diffs.
- Terminal execution: run shell commands with streamed output and project-level permission controls.
- Web search and browsing: DuckDuckGo by default with no key; Firecrawl, Tavily, and SearXNG configurable; direct URL fetch; a Playwright-powered browser agent for interactive sites.
- MCP servers: connect
streamable_http,sse, andstdioMCP servers (including OAuth-enabled HTTP servers) as permission-gated tools. - Interactive or scriptable: Textual TUI with queued follow-ups, one-shot
kolega-code askwith JSON output, session list/export/resume,doctor. - Extensibility: agent skills, project prompt-template overrides (docs), lifecycle hooks, persistent project permission rules.
- Local-first state: sessions, settings, permissions, OAuth tokens, and API-key settings stay on your machine with restrictive permissions where applicable.
Quick start
1. Install with the script:
curl -fsSL https://kolega.dev/install-kolega-code.sh | sh
Or with uv (or pip):
uv tool install kolega-code
# or: pip install kolega-code
Verify the install:
kolega-code --version
2. Start a session in your project:
kolega-code .
3. Connect a model. Complete the first-run wizard with ChatGPT sign-in or an
API key. Later, open Settings from the sidebar or with /settings. Use
Shift+Tab to switch between Plan and Build mode, or run /gigacode on
when a task is broad enough for fan-out.
Resume a previous conversation:
kolega-code . --resume # latest session
kolega-code . --resume <id> # a specific Resume ID from `sessions list`
Two ways to use it
| Mode | Command | Best for |
|---|---|---|
| Interactive TUI | kolega-code . |
Day-to-day development, exploration, orchestration |
| One-shot | kolega-code ask "…" |
Scripting, automation, quick questions, CI |
Helper commands for sessions and setup:
kolega-code ask "summarize this repository" --project .
kolega-code sessions list --project .
kolega-code doctor --project .
Models and routing
Kolega Code can route models by role. You can use a strong long-context model
for the main loop, a faster model for utility calls, and a dedicated model for
extended thinking. Per-agent-role overrides are available for planning,
building, investigation, general, and browser agents. A Gigacode workflow can
also pin cheaper models to individual calls with model_override, allowing one
model to write the orchestration while cheaper models run its agents.
Supported model providers:
- Anthropic
- OpenAI API
- OpenAI via ChatGPT subscription sign-in
- Groq
- Together.ai
- Fireworks.ai
- xAI / Grok
- DashScope / Qwen
- OpenRouter (gateway to 250+ tool-capable models)
- Moonshot / Kimi
- DeepSeek
- Z.AI / GLM Coding Plan
- Kimi Coding Plan
- Ollama Cloud
- local Llama
With a paid ChatGPT plan (Plus, Pro, or Business), /login chatgpt runs
OpenAI models without a separate API key; tokens are stored locally (chmod 600)
and refreshed automatically. See
Sign in with ChatGPT.
Web search backends include DuckDuckGo (the default, with no key), Firecrawl,
Tavily, and self-hosted SearXNG. Choose one in Settings or with
KOLEGA_CODE_WEB_SEARCH_BACKEND.
See Providers & Models
for model IDs, role configuration, API-key variables, and thinking-effort options.
Configuration
Set provider, model, and API keys from onboarding or the Settings editor, or via environment variables and flags for non-interactive use:
export KOLEGA_CODE_PROVIDER=deepseek
export DEEPSEEK_API_KEY=...
kolega-code ask "summarize this repository" --project . --provider deepseek --model deepseek-v4-pro
API key variables only provide credentials. Pick a provider and model explicitly
or save them in Settings. Local session state lives under your platform's state
directory unless KOLEGA_CODE_STATE_DIR is set. See the
Configuration docs
for the full story.
Requirements
- Python 3.11+
- An API key, ChatGPT sign-in, or local model for at least one supported model provider
- A terminal that supports a modern TUI (most do)
Documentation
This repo includes the Gigacode architecture document and an unedited model-authored example workflow.
Full documentation lives at kolega-ai.github.io/kolega-code:
Project resources
Contributing
Contributions are welcome. See CONTRIBUTING.md for local setup, running the test suite, and building the docs site. Please report security issues privately per SECURITY.md.
License
Released under the Apache License 2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kolega_code-0.26.6.tar.gz.
File metadata
- Download URL: kolega_code-0.26.6.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc21ce72d20bd149d9f87ea2a21415ab406f7b7e1766211b6524b3a2b349418
|
|
| MD5 |
25344869ece669dcc585a858d77cbe48
|
|
| BLAKE2b-256 |
0fa0d6b70f84c6c6e722324501b74d3b9cfea598b37d1500fcdef39832711dfd
|
Provenance
The following attestation bundles were made for kolega_code-0.26.6.tar.gz:
Publisher:
release.yml on kolega-ai/kolega-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kolega_code-0.26.6.tar.gz -
Subject digest:
4fc21ce72d20bd149d9f87ea2a21415ab406f7b7e1766211b6524b3a2b349418 - Sigstore transparency entry: 2332505625
- Sigstore integration time:
-
Permalink:
kolega-ai/kolega-code@61d6011d1410a343bb7e8db61db751b7544e4593 -
Branch / Tag:
refs/tags/v0.26.6 - Owner: https://github.com/kolega-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@61d6011d1410a343bb7e8db61db751b7544e4593 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kolega_code-0.26.6-py3-none-any.whl.
File metadata
- Download URL: kolega_code-0.26.6-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85a50ba53d33f34f8f1271cf7c73b8be835d220d778b2324f86d911063881623
|
|
| MD5 |
22e0e0ac23da168f8757a8d5da4a3db4
|
|
| BLAKE2b-256 |
f146df94571de7dbf86e966b11504bfb43236b4c48fefccf7f5a910add986a78
|
Provenance
The following attestation bundles were made for kolega_code-0.26.6-py3-none-any.whl:
Publisher:
release.yml on kolega-ai/kolega-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kolega_code-0.26.6-py3-none-any.whl -
Subject digest:
85a50ba53d33f34f8f1271cf7c73b8be835d220d778b2324f86d911063881623 - Sigstore transparency entry: 2332505681
- Sigstore integration time:
-
Permalink:
kolega-ai/kolega-code@61d6011d1410a343bb7e8db61db751b7544e4593 -
Branch / Tag:
refs/tags/v0.26.6 - Owner: https://github.com/kolega-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@61d6011d1410a343bb7e8db61db751b7544e4593 -
Trigger Event:
push
-
Statement type: