Claude Code is not open source: its licence file says "All rights reserved." If you want a coding agent whose source you can read, fork and audit, the actively developed options include OpenAI Codex CLI, Gemini CLI, OpenCode, Aider, Cline, goose, Qwen Code, Kilo Code and OpenHands. We checked each licence on the project's own repository.
There is a second way to change tools without giving anything up. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You can also connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from the chat you already work in. The Safeguard CLI is a Safeguard product, not an open-source project, and we say so plainly below.
Every fact below comes from the project's own repository, licence file or docs. There are no rankings and no benchmarks.
Is Claude Code open source?
No. Anthropic publishes a public GitHub repository for Claude Code, anthropics/claude-code, and it has an issue tracker, plugins, examples and a changelog. The LICENSE.md in that repository is one line long:
© Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service.
A public repository is not the same as an open-source licence. You can read the plugins and file issues, but the licence does not grant you the rights to modify and redistribute the tool itself. That is why people look for open-source alternatives: to inspect what the agent sends, patch it, or keep a fork they control.
What counts as open source in this guide
We used the Open Source Initiative's Open Source Definition as the bar. It has ten criteria, including free redistribution, access to source code, permission for derived works, and "No Discrimination Against Fields of Endeavor," which the OSI states as: "The license must not restrict anyone from making use of the program in a specific field of endeavor."
That sixth criterion is why some popular tools are missing from this list. Charm's Crush, for example, is a terminal coding agent whose repository lists the licence as FSL-1.1-MIT. The licence file allows broad use but excludes a "Competing Use," and grants an MIT licence only from "the second anniversary of the date we make the Software available." That is a source-available licence today, so we left it out.
Open-source Claude Code alternatives, tool by tool
Each entry covers what the tool is, how it runs, its licence and one thing to know first.
OpenAI Codex CLI
Codex CLI describes itself as "a coding agent from OpenAI that runs locally on your computer." It installs with npm, Homebrew or a standalone script, and the repository is licensed Apache-2.0. You sign in with a ChatGPT Plus, Pro, Business, Edu or Enterprise plan, or use an API key with extra setup. Before adopting it, read OpenAI's approvals page: in the CLI and IDE extension the defaults are no network access and writes limited to the active workspace, enforced at the operating system level.
Google Gemini CLI
Gemini CLI is "an open-source AI agent that brings the power of Gemini directly into your terminal," under the Apache License 2.0. You can run it once with npx @google/gemini-cli or install it with npm, Homebrew or MacPorts, then sign in with Google, a Gemini API key or Vertex AI. The thing to know: the repository states that for unpaid tier and Google One users, "Gemini CLI was replaced by Antigravity CLI on June 18th, 2026." Check which account type your team uses before standardising on it.
OpenCode
OpenCode calls itself "The open source AI coding agent," and the repository is MIT licensed. It ships a terminal UI and a desktop app in beta for macOS, Windows and Linux. Its providers page says it supports 75+ LLM providers and local models through Ollama, LM Studio and llama.cpp. Know the agents before you start: build is the default, full-access agent, while plan denies file edits by default and asks before bash commands. Our OpenCode alternatives guide goes further.
Aider
Aider lets you "pair program with LLMs" from the terminal and is licensed Apache-2.0. You install it with python -m pip install aider-install followed by aider-install, and the README says it "can connect to almost any LLM, including local models." It "automatically commits changes with sensible commit messages," so every AI edit can be inspected and undone with git. Check the release cadence first: PyPI lists version 0.86.2 on 12 February 2026, and the release before that on 13 August 2025.
Cline
Cline describes itself as "The open source coding agent in your IDE, terminal, & desktop." It runs as a VS Code extension, a JetBrains plugin, an npm-installed CLI with a headless mode for CI, a desktop app for macOS and Windows, and an SDK. The licence is Apache 2.0, with one exception the README states directly: "Currently we are not open-sourcing JetBrains plugins." Providers include Anthropic, OpenAI, Google, OpenRouter, Bedrock, Vertex, any OpenAI-compatible API, and local models through Ollama and LM Studio. The README says every file edit and terminal command requires your approval, with auto-approve as an option you can turn on.
goose
goose is "a general-purpose AI agent that runs on your machine," aimed at research, writing and data work as well as code. It ships a desktop app for macOS, Linux and Windows, a CLI and an API, is licensed Apache-2.0, and is part of the Agentic AI Foundation at the Linux Foundation. It works with 15+ providers, including Ollama for local models. The thing to know: goose's permission docs say "Autonomous Mode is applied by default," which lets it modify and delete files without approval. Switch with /mode approve or /mode smart_approve if you want prompts.
Qwen Code
Qwen Code is "The open-source AI coding agent for your terminal, editor, desktop, browser, and chat," licensed Apache-2.0. It was "originally based on Google Gemini CLI v0.8.2" and moved to independent development from v0.1. Install it with npm (Node.js 22 or later) using npm install -g @qwen-code/qwen-code@latest, Homebrew or an install script, then run qwen and use /auth to pick a provider. It supports OpenAI, Anthropic, Gemini and Qwen APIs, and "Any third-party provider or local model (Ollama / vLLM)."
Kilo Code
Kilo Code is an open-source coding agent for VS Code, JetBrains and the CLI, plus a web-based Cloud Agent. The repository is MIT licensed, and its CLI "is a fork of OpenCode, enhanced to work within the Kilo agentic engineering platform." The README says you can choose from 500+ models and switch mid-task. Know this flag before you use it in CI: kilo run --auto "auto-approves permission prompts unless a rule explicitly denies the action," and the README says "Only use it in trusted environments."
OpenHands
The OpenHands repository now presents Agent Canvas, "The self-hosted developer control center for coding agents and automations." It runs the open-source OpenHands agent by default and can also drive Claude Code, Codex and Gemini CLI. The licence file is the MIT License, copyright OpenHands contributors. The one thing to know is the runtime choice: with no sandbox, the README warns "the agent will have full access to your filesystem," while Docker modes isolate the agent and OH_CONVERSATION_RUNTIME=docker gives each conversation its own container.
T3 Code
T3 Code is different from everything above: it is not an agent but an "agent harness control surface" that drives agents already set up on your computer, including Codex, Claude Code, Cursor, OpenCode, Grok Build and Google Antigravity. It is MIT licensed and ships as a desktop app, a web app and mobile apps for iOS and Android. Note that the agents it controls keep their own licences, so pairing T3 Code with Claude Code still means running a closed-source agent. The README is frank about maturity: "Expect bugs." See our T3 Code alternatives post for more.
Open source, but archived or winding down
Three projects still show open-source licences but carry status notices you should read:
- Continue (Apache-2.0): the README says the repository "is no longer actively maintained and is read-only for all users."
- Roo Code (Apache 2.0): "This repository was archived by the owner on May 15, 2026."
- Plandex (MIT): the hosted Plandex Cloud is "Winding down as of 10/3/2025 and no longer accepting new users." The README still describes self-hosting with Docker, but does not state the open-source project's maintenance status.
You can still fork any of them. Just do it knowing you would be the maintainer.
Comparison table
Facts only, from each project's own pages. "Your machine" means the agent process and file edits run locally; your prompts still go to whichever model provider you configure.
| Tool | Interface | Licence | Models | Where the agent runs | Approval prompts |
|---|---|---|---|---|---|
| Claude Code (reference) | Terminal, IDE, desktop, web | All rights reserved, commercial terms | Claude subscription, Console or third-party providers | Your machine; cloud sessions in Anthropic VMs | Manual, acceptEdits, auto and others |
| Codex CLI | Terminal, IDE extension | Apache-2.0 | ChatGPT plans, API key, local via --oss | Your machine | Sandbox plus approval policy |
| Gemini CLI | Terminal | Apache 2.0 | Google account, Gemini API, Vertex AI | Your machine, optional sandbox | Configurable, trusted folders |
| OpenCode | Terminal UI, desktop (beta) | MIT | 75+ providers, local models | Your machine | plan asks; build full access |
| Aider | Terminal | Apache-2.0 | Most hosted and local models | Your machine | Git commit per change |
| Cline | VS Code, JetBrains, CLI, desktop, SDK | Apache 2.0 (JetBrains plugin closed) | Many providers, Ollama, LM Studio | Your machine | Edits and commands need approval |
| goose | Desktop, CLI, API | Apache-2.0 | 15+ providers, Ollama | Your machine | Autonomous by default |
| Qwen Code | Terminal, editor, desktop, browser | Apache-2.0 | OpenAI, Anthropic, Gemini, Qwen, Ollama, vLLM | Your machine | Plan, Ask Permissions, Auto-Edit, Auto, YOLO |
| Kilo Code | VS Code, JetBrains, CLI, Cloud Agent | MIT | 500+ models | Your machine or Kilo cloud | --auto for CI |
| OpenHands | Local web UI, CLI launcher | MIT | Bring your own model | Your machine, Docker, VM or cloud | Depends on runtime |
| T3 Code | Desktop, web, mobile | MIT | Uses the agents you installed | Your machine | Those of each agent it drives |
| Safeguard CLI | Terminal, plus desktop, mobile, IDE, browser, cloud | Safeguard product (not open source) | Your Claude, ChatGPT or Codex plan; /model | Scans on your machine, results uploaded | Ask, Auto (default), Yolo |
Setting up an open-source alternative, step by step
The commands below come from each project's own docs.
Step 1: take a baseline before any agent runs
Scan the repository first so you can tell later what the agent changed in your dependency risk:
safeguard scan --dir .
cp output/vuln.json baseline-vuln.json
Step 2: install the agent
Pick one and install it from the vendor's own instructions:
# OpenCode
curl -fsSL https://opencode.ai/v2/install | bash
# Codex CLI
npm install -g @openai/codex
# Aider
python -m pip install aider-install
aider-install
# Qwen Code (Node.js 22+)
npm install -g @qwen-code/qwen-code@latest
Step 3: choose a model, hosted or local
Hosted models need an account with the provider. Local models need a model server. With Ollama running, Codex can point at it directly, per OpenAI's advanced config page and Ollama's integration docs:
codex --oss --local-provider ollama
codex --oss -m gpt-oss:120b
To make Ollama the default, OpenAI's docs show this line in ~/.codex/config.toml:
oss_provider = "ollama" # or "lmstudio"
For Aider, the docs use OLLAMA_API_BASE and the ollama_chat/ prefix:
export OLLAMA_API_BASE=http://127.0.0.1:11434
OLLAMA_CONTEXT_LENGTH=8192 ollama serve
aider --model ollama_chat/your-model
Step 4: set the approval mode before the first task
In OpenCode, start in the plan agent. In goose, run /mode approve. In Codex, the read-only sandbox lets it plan and inspect without changing files. In Cline, leave auto-approve off.
Step 5: run one small task and review it
Ask for something with a clear diff, such as a dependency bump, and read it. With Aider, git log shows each change as its own commit.
Step 6: scan again and compare
safeguard scan --dir .
diff <(jq -S . baseline-vuln.json) <(jq -S . output/vuln.json)
Anything new in the second file arrived during the session. Our guide to checking what a coding agent changed walks through this in more detail.
Common mistakes when switching to an open-source agent
- Treating "public repo" as "open source." Claude Code's repository is public and its licence is "All rights reserved." Crush's FSL-1.1-MIT licence turns into MIT only two years after each release. Read the licence file, not the badge.
- Assuming the whole product is open. Cline's JetBrains plugin is not open source. Kilo Code's Cloud Agent and OpenHands Cloud are hosted services. The open part is the code in the repository.
- Starting autonomous by accident. goose applies Autonomous Mode by default. OpenCode's default
buildagent is full access. Kilo's--autoapproves prompts unless a rule denies them. - Leaving Ollama's context window at its default. Ollama's FAQ gives a default context window of 4096 tokens, Aider's docs warn that Ollama "silently discards context that exceeds the window," and Ollama's Codex page asks for at least 64k tokens.
- Plugging a Claude subscription into a third-party tool. OpenCode's providers page says plugins for using Claude Pro or Max in OpenCode exist and that "Anthropic explicitly prohibits this." Use an API key or a provider your terms allow.
- Adopting an archived project for a team rollout. Continue and Roo Code are read-only. Check the README banner and the latest release date before you commit.
- Reviewing only the diff. A diff shows which lines changed. It does not tell you that the package version the agent added has a known vulnerability. A scan does.
Do the work properly with the Safeguard CLI
The Safeguard CLI is not open source, and we will not pretend it is. It is the tool you can switch to when you want an assistant that writes code, fixes what it finds, and knows your vulnerabilities, without giving up the AI plan you already have.
Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. And if you would rather stay in Claude or ChatGPT, connect it to the Safeguard MCP server and ask about your projects from that chat.
The CLI scans code, container images and SBOMs on your own machine, sends only the results to the Safeguard platform, and includes an assistant that can fix what it finds.
Install
On macOS and Linux:
curl -fsSL https://cli.safeguard.sh/install | bash
On Windows PowerShell:
irm https://cli.safeguard.sh/install.ps1 | iex
It is a single static binary with no Node, Python or JVM needed. It runs on macOS, Linux and Windows, on x86_64 or arm64, with Windows on x86_64 only. The download page lists CLI 1.4.0 with builds for macOS Apple Silicon and Intel, Linux x86_64 and arm64, and Windows x86_64.
First session
Run safeguard with no arguments to open the interactive terminal. Type /login to sign in through the browser, then /scan . to scan the folder you are in. After that, ask in plain language:
how many critical vulns do we have
fix the lodash CVE in this repo
what's the latest file in ~/Downloads
Type @ to attach a file from the folder you started in. /resume picks up the last session in that folder.
Writing and fixing code on your machine
The assistant has tools for your local files and for your Safeguard data, and picks whichever the question needs. It can write files, edit code and run commands, with your approval. That makes it a general terminal assistant for work on your machine (find and read files, edit code, run commands) that also knows which of your dependencies are vulnerable.
This demo attaches a computer running the Safeguard CLI and a folder, asks for a fix, reviews the diff and approves the command before it runs. The demo notes that computer work from Search is available and expanding.
Click through it at your own pace, or open it full screen.
Using your Claude or ChatGPT plan
/model shows or switches the AI model. For connecting your Claude, ChatGPT or Codex plan, see the CLI docs.
To use Safeguard from Claude itself, this demo connects Claude to the Safeguard MCP server with OAuth and chooses which tools Claude can use.
Click through it at your own pace, or open it full screen.
Approvals
Tools that change things ask before they act. /permissions sets how often: Ask prompts before every action, Auto approves known actions and asks about anything new (the default), and Yolo approves everything. On a repository you care about, start with Ask.
Scanning what any agent changed
Whichever open-source agent you pick, the CLI can check its work:
safeguard scan --dir .
safeguard scan --repo https://github.com/your-org/your-repo
safeguard scan --image your-image:latest
safeguard scan --sbom ./sbom.cdx.json
safeguard validate ./sbom.cdx.json
Each scan builds an SBOM and matches it against vulnerability databases, writing JSON files such as vuln.json and license.json under ./output. safeguard validate checks CycloneDX, SPDX and VEX documents. When the local runner runs platform scan jobs, your source code never leaves the machine; only SBOMs and findings are uploaded. Policies and gates are evaluated in the platform, which also offers reachability analysis and autonomous remediation with fix PRs (off by default).
CI with safeguard exec
safeguard exec "summarise the critical findings in this repository"
That runs one non-interactive assistant turn, so you can put it after whatever agent step your pipeline runs.
One platform, every surface
Start in the terminal, continue in the desktop app (3.2.2, for Windows, macOS and Linux) to ask your supply chain anything in plain English, and check findings on your phone with the iOS and Android apps. There are IDE extensions for VS Code, JetBrains and Open VSX, a Chrome extension, and a cloud sandbox tenant against a seeded demo repo, free for seven days with no card. More in our post on the Safeguard CLI as a security-aware coding assistant.
Download Safeguard and run /scan . in the repository you work in today.
FAQ
Is Claude Code open source?
No. The LICENSE.md in Anthropic's public claude-code repository reads "© Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service."
Which open-source alternative is closest to Claude Code?
We do not rank them. Codex CLI, Gemini CLI, OpenCode, Aider and Qwen Code are terminal agents like Claude Code. Cline and Kilo Code add IDE extensions. goose and OpenCode have desktop apps. OpenHands and T3 Code are control surfaces that can drive other agents. Pick on interface, licence and approval defaults.
Can I switch to Safeguard and keep my Claude, ChatGPT or Codex plan?
Yes. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You can also connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from that chat.
Is the Safeguard CLI open source?
No. It is a Safeguard product. It is in this guide because it is the tool we build for writing and fixing code with an assistant that knows your vulnerabilities, and for checking what any open-source agent changed.
Can I use my Claude Pro or Max subscription in OpenCode?
OpenCode's own providers page says third-party plugins for this exist and that "Anthropic explicitly prohibits this." Check Anthropic's terms, or use an API key.
Do open-source agents send my code anywhere?
The agent runs on your machine, but whatever context it sends to a hosted model goes to that provider. With a local model server such as Ollama or LM Studio, prompts stay on your hardware unless you pick a cloud model. With the Safeguard local runner, source stays on your machine and only SBOMs and findings are uploaded.
Try it yourself
This walkthrough sets up the runner on your own machine: pick the platform, start it, approve it with its device code, then use the same CLI to scan from the terminal.
Click through it at your own pace, or open it full screen.
Quick check
Why is Crush not in this list of open-source alternatives?
Its licence is FSL-1.1-MIT, which excludes a Competing Use and grants an MIT licence only from the second anniversary of each release. That does not meet the Open Source Definition today.
How do you see what an agent session did to your dependency risk?
Run safeguard scan --dir . before and after the session and compare the two vuln.json files under ./output. Anything new arrived during the session.
Sources
- Claude Code repository, Anthropic
- Claude Code LICENSE.md
- Claude Code overview, Anthropic docs
- Claude Code permission modes, Anthropic docs
- Claude Code data usage, Anthropic docs
- The Open Source Definition, OSI
- Crush repository
- Crush LICENSE.md
- OpenAI Codex repository
- Codex agent approvals and security
- Codex advanced config, OSS mode
- Ollama integration docs for Codex
- Gemini CLI repository
- OpenCode repository
- OpenCode providers docs
- Aider repository
- Aider with Ollama
- Ollama FAQ
- LM Studio offline operation
- aider-chat on PyPI
- Cline repository
- goose repository
- goose permission modes
- Qwen Code repository
- Qwen Code approval modes
- Kilo Code repository
- OpenHands repository
- OpenHands LICENSE
- T3 Code repository
- Continue repository
- Roo Code repository
- Plandex repository
- Safeguard download page
- Safeguard CLI docs
- Safeguard CLI interactive terminal docs
Last reviewed: 21 October 2026.