_ _ ____ _
/ \ | |_ ___ _ __ ___ / ___|___ __| | ___
/ _ \| __/ _ \| '_ ` _ \ | / _ \ / _` |/ _ \
/ ___ \ || (_) | | | | | | |__| (_) | (_| | __/
/_/ \_\__\___/|_| |_| |_|\____\___/ \__,_|\___|
Open-source terminal AI coding agent written in Rust
English · 简体中文
Install · Quick Start · Features · Architecture · Development · Contributing · Community
This project is 100% AI-generated. Every line of code, every architectural decision's implementation, and every commit was written by AI. The human developer serves solely as the decision-maker and product manager — defining what to build, not how to build it.
AtomCode is an AI coding agent that lives in your terminal. Give it a task in natural language, and it will read your codebase, edit files, run commands, and verify its work — autonomously.
Think of it as an open-source alternative to Claude Code / Cursor Agent, but running entirely in your terminal and connecting to any OpenAI-compatible API.
- Autonomous multi-step execution — reads files, edits code, runs tests, fixes errors, all in a loop
- Verification loop — automatically verifies edits via syntax checks before declaring success
- Dynamic step budget — scales with the number of edited files, capped per turn to bound cost
- Loop detection — detects and breaks out of repetitive tool-call patterns
- 3-layer JSON repair — recovers malformed tool-call arguments
- Turn-level datalog — structured per-turn logs for replay, debugging, and eval harnesses
- Plan / Build modes —
/planswitches to read-only exploration (the agent investigates without touching files);/buildswitches back to full execution - Goal mode —
/goal <text>sets a completion condition and the agent loops autonomously, turn after turn, until the goal is met - Code review —
/reviewreviews your current changes,/review stagedthe staged diff, and/review <base>against a base ref - Background sessions —
/bgruns work in detached slots so you can keep using the TUI while a long task progresses
File & shell:
read_file,write_file,edit_file,search_replacebash,grep,glob,list_directory,change_dirweb_search,web_fetch
Code graph (language-aware code intelligence):
list_symbols,read_symbol,find_referencestrace_callers,trace_callees,trace_chainfile_deps,blast_radius
Automation:
auto_fix— automatic lint/typecheck fix loopuse_skill— invoke a user-defined skill
Connect to any LLM that supports OpenAI's function-calling API:
| Provider | Function Calling | Tested Models |
|---|---|---|
| Claude (Anthropic) | Yes | Claude Sonnet 4.5/4.6, Opus 4.6 |
| OpenAI | Yes | GPT-4o, GPT-4.1 |
| DeepSeek | Yes | DeepSeek V3, DeepSeek R1, DeepSeek V4 |
| Zhipu (GLM) | Yes | GLM-4, GLM-5, GLM-5.2 |
| Qwen (Alibaba) | Yes | Qwen-Plus, Qwen-Max |
| SiliconFlow | Yes | Various open models |
| Ollama (local) | Partial | Llama 3, Qwen2, etc. |
| Any OpenAI-compatible API | Yes | — |
- Persistent sessions — every conversation is saved; continue the last session with
atomcode --continue/-c, or resume/switch inside the TUI with/resume - AtomGit OAuth login —
/login(oratomcode login) pairs your CLI with your AtomGit account - SSO login —
/login-with-ssofor GitCode internal users - Headless mode —
atomcode -p "..."runs a single prompt non-interactively and streams the reply on stdout (Claude Code-pstyle); approval-requiredbashcalls are auto-approved, while other approval-required tools are denied - Daemon mode —
atomcode-daemonexposes an HTTP API for session history and SSE streaming chat
- Real-time streaming with markdown rendering and syntax highlighting
- Code blocks with language labels, line numbers, and
base16-ocean.darktheme - Multi-line input with Shift+Enter (or
\+ Enter), auto-growing height, input history - Task completion notifications — long-running tasks trigger terminal-native notifications first (kitty / WezTerm / iTerm2), falling back to OS-native alerts
- Text selection with mouse drag, auto-scroll, and clipboard copy
- Slash commands —
/model,/provider,/resume,/bg,/diff,/undo,/cost,/clear,/compact, etc. (see table below) - File attachment — paste file paths to attach content as context
- Bracketed paste — long paste content collapsed to a compact indicator
- Skills — user-defined commands loaded from your skill directory, invoked like any slash command
/webui(in the TUI) oratomcode webui(CLI) launches a local browser UI as an alternative to the terminal interface — same agent, same sessions, rendered in your browser- Loopback only — the server binds to
127.0.0.1and uses a one-time token; nothing is exposed to the network /webui stopstops the in-process server (a later/webuirestarts it)
/app(in the TUI) enables mobile remote access — prints a QR code; scan it with the GitCode mobile app from any network to connect to your current session- Any-network reachable — your PC connects to a public relay via a reverse WSS tunnel; the phone reaches your PC through the relay. No public IP, DDNS, or port forwarding required
- Bidirectional real-time sync — messages from either end appear on the other in real time (streaming replies, tool call cards, token usage)
- Remote commands — the phone can run
/status,/cost,/diff,/whoamietc., which execute on the desktop and echo results back - Switch projects / sessions — switch projects or open a history session on the phone, and the desktop follows immediately
- Model sync — switching models on either end keeps the other in sync
/app stopdisconnects remote access
- Destructive command detection —
rm -rf,git push --force,DROP TABLE, etc. require explicit approval - Path-aware confirmations — external reads, sensitive paths, and all writes outside the workspace can require confirmation depending on risk level
- Sensitive file protection — protected system paths, credential directories, shell configs,
.envfiles, and key/cert files receive stronger confirmation rules - Shell bypass protection — common shell file commands like
cat,head,ls,cp,mv, andteeinherit the same path approval model as file tools - Per-session permission grants — approve once per tool pattern, or always-allow
- Source file deletion requires approval —
rmon code files is never auto-approved - Undo —
/undorolls back the last turn's file edits via file-history snapshots
See Permission Model for the full design and current boundaries.
- 📊 Anonymous telemetry (opt-out) — see docs/telemetry.md
git clone https://atomgit.com/atomgit_atomcode/atomcode.git
cd atomcode
cargo install --path crates/atomcode-cli --lockedThe binary will be generated at target/release/atomcode and installed to
~/.cargo/bin/atomcode for macOS / Linux / HarmonyOS PC and $env:USERPROFILE/.cargo/bin/atomcode.exe
for Windows. Make sure that ~/.cargo/bin (or %USERPROFILE%\.cargo\bin on Windows) is
in your PATH.
To compile without installing, run:
cargo build --releaseand the binary will be generated at target/release/atomcode.
AtomCode CLI can also be installed via the following package managers:
# Install using npm
npm install -g @atomgit.com/atomcode
# Install using Homebrew
brew install --cask atomcode- Rust 1.88+ (for building; older Cargo versions cannot parse the current lockfile)
- An API key from any supported provider (or an AtomGit account for
/login)
Run AtomCode as your normal user, never with sudo. AtomCode keeps its
config, sessions, and logs under ~/.atomcode; running once as root leaves
root-owned files there, so every later non-root start fails at engine init with:
engine v2 assemble failed: Permission denied (os error 13)
(the message may say prepare instead of assemble — same cause.) If you hit
this, reclaim ownership and stop using sudo:
sudo chown -R "$(id -un):$(id -gn)" ~/.atomcode
atomcode # start WITHOUT sudoOn a Linux guest, a working directory on a VirtualBox shared folder
(/media/sf_*, owned by root:vboxsf) can also trigger permission errors — add
yourself to the group with sudo usermod -aG vboxsf "$USER" and re-login, rather
than using sudo.
Remove AtomCode and (optionally) its data:
atomcode uninstall # interactive: per-group prompts
atomcode uninstall --keep-data # only remove binary + PATH edit
atomcode uninstall --purge # remove everything, including ~/.atomcode
atomcode uninstall --dry-run # show plan, change nothingIf the binary is already broken or missing:
curl -fsSL https://raw.atomgit.com/atomgit_atomcode/atomcode/raw/main/scripts/uninstall.sh | sh
# Windows:
irm https://raw.atomgit.com/atomgit_atomcode/atomcode/raw/main/scripts/uninstall.ps1 | iexBy default credentials (auth.toml, mcp.json, config.toml, ATOMCODE.md) are kept; pass --purge to remove them too.
atomcodeOn first run, a setup wizard will guide you through configuring your LLM provider:
Welcome to AtomCode! Let's set up your first provider.
Select provider:
[1] Claude (Anthropic)
[2] OpenAI
[3] OpenAI Compatible (DeepSeek, Qwen, Zhipu, Moonshot...)
[4] Ollama (local)
Config is stored at ~/.atomcode/config.toml. A minimal single-provider
setup looks like this:
default_provider = "deepseek"
[providers.deepseek]
type = "openai"
api_key = "sk-..."
model = "deepseek-chat"
base_url = "https://api.deepseek.com/v1"
context_window = 64000You can declare multiple providers and switch between them with /model
or /provider. A complete reference covering Claude / OpenAI /
OpenAI-compatible endpoints (DeepSeek, GLM, SiliconFlow, OpenRouter...) /
Ollama, plus the [datalog] section, lives at
docs/config.example.toml — copy and edit the
bits you need.
After editing config.toml by hand, run /reload inside atomcode to pick
up the changes without restarting.
# Open in your project directory
cd your-project
atomcode
# Or specify directory
atomcode -C /path/to/project
# Or specify model
atomcode --model gpt-4o
# Headless (single prompt, reply on stdout)
atomcode -p "Explain the agent loop in this repo"
# Read prompt from file
atomcode --prompt-file task.mdIn headless mode, approval-required bash calls are auto-approved and logged to stderr; other approval-required tools are denied.
Then just type what you want:
> Fix the login bug where users get redirected to 404 after OAuth callback
> Add a dark mode toggle to the settings page
> Refactor the database module to use connection pooling
> Write tests for the payment processing module
| Key | Action |
|---|---|
Enter |
Send message |
Shift+Enter |
New line (requires Kitty keyboard protocol) |
Ctrl+Enter |
New line (requires Kitty keyboard protocol) |
Ctrl+J |
New line (requires Kitty keyboard protocol) |
Alt+Enter |
New line (most terminals; see compatibility note below) |
\ + Enter |
New line (works on all terminals — type a \ and press Enter; the \ is consumed) |
Esc |
Clear input / Cancel stream |
Esc ×2 |
Undo the previous turn |
Up/Down |
Browse input history |
Tab |
Accept suggestion |
Ctrl+U |
Clear line |
Ctrl+W |
Delete word |
Ctrl+K |
Delete to end of line |
Ctrl+V |
Paste image from clipboard (Windows: use /paste, see below) |
Terminal compatibility for newline chords:
Shift+Enter,Ctrl+Enter, andCtrl+Jall need a terminal that speaks the Kitty keyboard protocol — kitty, WezTerm, Alacritty, iTerm2 ≥3.5, Windows Terminal ≥1.21. Older terminals collapse them to plainEnter(which sends the message).Alt+Enterworks at the byte level on most terminals, but Windows Terminal binds it to "toggle full screen" by default — remove that binding under Settings → Actions to free it up.- Xshell does not support the Kitty protocol; in its keymap settings, map a free chord to send
ESC, Enter(\x1b\r) to get the same effect, or paste multi-line text via the clipboard (bracketed paste is enabled).
Pasting images on Windows: Windows Terminal and conhost bind
Ctrl+Vto their ownpasteaction, which only forwardsCF_UNICODETEXTfrom the clipboard — an image-only clipboard sends nothing, so the in-appCtrl+Vhandler never fires. Two ways out:
- Use
/paste— the slash command pulls the clipboard image and attaches it as[Image #N]. Works in every terminal, including Windows Terminal, PowerShell 7, conhost, and git bash. The TUI's bottom-right hint on Windows saysImage in clipboard · /pasteautomatically.- If you want
Ctrl+Vmuscle memory: open Windows Terminalsettings.json(Ctrl+,→ "Open JSON file") and either delete the{ "command": "paste", "keys": "ctrl+v" }entry under"actions", or rebind it toctrl+shift+v. After a restart,Ctrl+Vpasses through to atomcode.Git Bash (MinTTY) doesn't intercept
Ctrl+V, so it works there out of the box.
| Key | Action |
|---|---|
Ctrl+Up/Down |
Scroll chat (3 lines) |
PageUp/PageDown |
Scroll chat (page) |
Ctrl+L |
Clear conversation |
Ctrl+Shift+C |
Copy selection |
Ctrl+C |
Cancel operation (double-tap to exit) |
Type / in the TUI to browse the full list with live completion; /help shows commands and shortcuts.
Sessions & workspace
| Command | Action |
|---|---|
/resume |
Resume or switch session |
/session |
Start a new session |
/rename <name> |
Rename the current session |
/clear |
Start a new conversation (clears context + screen) |
/bg |
Background current session; subcommands: /bg list, /bg <N>, /bg drop <N>, /bg help |
/background <task> |
Compatibility alias: start a one-shot task in a /bg slot |
/cd |
Change working directory |
/worktree |
Git worktree isolation (create / list / done / cleanup) |
/webui |
Launch the browser webui (subcommands: stop, lan, --host <addr>) |
/sync |
Attach to the live webui session (/sync off to detach) |
Modes, autonomy & review
| Command | Action |
|---|---|
/plan |
Switch to Plan mode (read-only exploration) |
/build |
Switch to Build mode (full execution) |
/goal <text> |
Set a completion goal — the agent loops autonomously until it's met |
/review |
Code review the current changes (/review · /review staged · /review <base>) |
/think |
Control extended thinking (on / off / budget N) |
/effort |
DeepSeek reasoning effort control (high / max / off) |
Providers & account
| Command | Action |
|---|---|
/model |
Switch model / provider |
/provider |
Manage providers (add / edit / delete) |
/proxy |
Switch outbound proxy mode |
/login |
Sign in with AtomGit OAuth and claim CodingPlan free models |
/logout |
Sign out of AtomGit |
/whoami |
Show the current logged-in user |
/status |
Show login status and model info |
Files, edits & context
| Command | Action |
|---|---|
/diff |
Show git diff of current changes |
/undo |
Undo a turn's file edits (/undo or /undo N) |
/view <filepath> |
View file content in an overlay modal |
/paste |
Attach an image from the clipboard (Windows fallback for Ctrl+V) |
/copy |
Copy a code block from the last reply (/copy, /copy N, /copy all) |
/cost |
Show token usage for this session |
/context |
Show the context budget breakdown |
/compact |
Compact conversation history |
Memory
| Command | Action |
|---|---|
/remember <fact> |
Save a fact to memory (--global for all projects) |
/forget <query> |
Remove matching memories |
/memory |
Show all saved memories |
Extensions
| Command | Action |
|---|---|
/mcp |
MCP server status (subcommands: reload, tools, login, logout) |
/plugin |
Plugin marketplace (marketplace / install / uninstall / list) |
/skills |
Browse loaded skills |
Project & system
| Command | Action |
|---|---|
/init |
Generate .atomcode.md project instructions from the working directory |
/config |
Show config path |
/reload |
Reload ~/.atomcode/config.toml from disk |
/upgrade |
Upgrade atomcode to latest (subcommand: rollback) |
/setup |
First run: install the recommended skill and run it |
/welcome |
Re-run the onboarding wizard |
/language |
Switch display language |
/issue |
Report a bug / request a feature (interactive wizard) |
/guide <question> |
Ask atomcode-guide how to use AtomCode |
/keys |
Show keyboard shortcuts |
/help |
Show commands & shortcuts |
/quit, /exit |
Exit AtomCode (or Ctrl+C ×2) |
Plugin commands. Beyond the built-ins above, plugins can register their own slash commands. For example, install the official channel plugin to get
/plugin marketplace add https://atomgit.com/atomgit_atomcode/AtomCode-Channel /plugin install weixin@atomcode-channel
AtomCode is a Rust workspace with four crates:
atomcode/
crates/
atomcode-core/ # Headless library — no TUI dependency
agent/ # AgentLoop: autonomous tool-use loop
turn/ # TurnRunner, datalog, permission decider
config/ # Config loading, provider configs
conversation/ # Message types, windowed context
provider/ # LlmProvider trait + OpenAI/Claude/Ollama
tool/ # Tool trait + built-in tool implementations
session/ # Persistent sessions
skill.rs # User-defined skills
atomcode-tuix/ # Terminal UI — retained-mode renderer (CC-style normal mode)
event_loop/ # App state machine, command dispatch
render/ # Cell-based renderer, diff, retained-mode frame loop
modals/ # Picker UIs (dir, model, session, provider, issue)
atomcode-cli/ # Binary entry point (TUI + headless -p mode)
main.rs # CLI args, first-run wizard, launch
auth/ # AtomGit OAuth client
atomcode-daemon/ # HTTP/SSE API server over atomcode-core
-
Tech-stack agnostic — never hardcodes language-specific logic. Detects project type dynamically from descriptor files (
package.json,Cargo.toml,pyproject.toml,pom.xml, etc.). -
Decoupled agent —
AgentLoopruns as an independent async task, communicating with the TUI via channels (AgentCommand/AgentEvent). The core library has zero TUI dependencies, which is also what makes the daemon possible. -
Tool safety — all destructive operations require explicit user approval. Tool failures become LLM observations, never panics.
-
Context-aware — token-budget-aware conversation windowing, project file-tree injection, and per-turn system reminders keep the model focused without exceeding context limits.
Create a .atomcode.md file in your project root to give AtomCode persistent context:
# Project Instructions
This is a Vue 3 + TypeScript project using Pinia for state management.
- Always use Composition API with `<script setup>`
- Use TailwindCSS for styling, no inline styles
- Run `npm run lint` after editing .vue/.ts filesAtomCode reads this file automatically and includes it in the system prompt. AtomCode also supports AGENTS.md (the open standard for AI coding agents) as an alternative — if both files exist, .atomcode.md takes priority.
- Rust 1.88+ — install via rustup
- Git
- A supported LLM provider API key (for runtime testing)
git clone https://atomgit.com/atomgit_atomcode/atomcode.git
cd atomcode
# Debug build (fast compilation, slower runtime)
cargo build
# Release build (slower compilation, optimized binary)
cargo build --release# Run the TUI directly (debug mode)
cargo run -p atomcode-cli
# With arguments
cargo run -p atomcode-cli -- -C /path/to/project
cargo run -p atomcode-cli -- --model gpt-4o
# Headless mode
cargo run -p atomcode-cli -- -p "summarize this repo"
# Daemon (HTTP API)
cargo run -p atomcode-daemon# Run all tests
cargo test
# Run tests for a specific crate
cargo test -p atomcode-core
cargo test -p atomcode-tuix
# Run a specific test
cargo test -p atomcode-core test_name# Check compilation without building
cargo check
# Format code
cargo fmt
# Run linter
cargo clippy
# Build and install to ~/.cargo/bin
cargo install --path crates/atomcode-cliContributions are welcome! AtomCode is in active development.
- Fork the repository on AtomGit
- Clone your fork locally:
git clone https://atomgit.com/<your-username>/atomcode.git cd atomcode
- Create a branch for your change:
git checkout -b feat/your-feature # or git checkout -b fix/your-bugfix - Make your changes, ensure the project builds and tests pass:
cargo build && cargo test && cargo clippy
- Commit with a clear message:
git commit -m "feat: add xxx support" - Push and open a Pull Request against
main
| Prefix | Purpose |
|---|---|
feat/ |
New feature |
fix/ |
Bug fix |
refactor/ |
Code refactoring (no behavior change) |
docs/ |
Documentation only |
chore/ |
Build, CI, tooling changes |
- Follow the project's core principles — especially tech-stack neutrality
(no language/framework-specific logic in the core engine; detect via probes
like
package.json/Cargo.toml/pom.xmland route through adapters) - All tool failures must be graceful — return the error as an observation to the LLM, never panic
- Destructive operations must require user approval
- Keep the system prompt compact (~1.5K tokens)
- Run
cargo fmtandcargo clippybefore submitting
- Add a new tool — implement the
Tooltrait incrates/atomcode-core/src/tool/ - Add a new provider — implement
LlmProviderincrates/atomcode-core/src/provider/ - Improve the UI — rendering lives in
crates/atomcode-tuix/src/render/ - Fix bugs — check Issues for open bugs
Don't know Rust? No problem! There are many ways to contribute without writing Rust code:
- 📝 Documentation — Improve the README, fix typos, enhance the official docs site, or add examples. Docs live in the root
docs/directory,site/docs/, and the main README files. - 🌐 Localization & Translation — Help translate the docs site, README, or UI strings into more languages. Check
site/docs/for existing translations. - 🧩 Skills & Plugins — Create new skills (Markdown + JSON, no Rust needed) that extend AtomCode's capabilities. Skills are loaded from
~/.atomcode/skills/. - 🐛 Bug Reports — Found a bug? Open an Issue with clear reproduction steps, screenshots, and environment info. High-quality bug reports are invaluable.
- 🧪 Test Cases & Examples — Add test scenarios, example projects, or usage demos that help validate features and onboard new users.
- 💬 Community Support — Help answer questions in the community group, write tutorials, or create video guides.
Every contribution, code or not, makes AtomCode better for everyone. When in doubt, open an Issue or start a Discussion!
Scan the QR code below with WeChat to join the AtomCode community group — share feedback, report issues, and talk to other users and maintainers:
☕ AtomCode is free, and the Coding Plan is free too. If it's saved you a bit of time, consider buying the author a coffee — it keeps us motivated to keep making it better.
MIT License. See LICENSE for details.
Built with Rust, ratatui, and a lot of late nights.