Clawcode
Open-source, terminal-native AI coding agent with multi-provider support, structured diffs, and persistent memory
Install / Use
/learn @sarhan44/ClawcodeREADME
ClawCode CLI
CLI coding agent (ClawCode) that uses Azure OpenAI, Groq, or Google Gemini to plan and apply code changes. It scans your project (respecting .gitignore), sends minimal context to the LLM, and applies structured patches with backups and confirmation. Persistent memory (global + per-project session) survives restarts and model switches.
- Website: https://clawcode.vercel.app/
- Documentation: https://clawcode.vercel.app/docs
Requirements
- Node.js >= 18
- At least one AI provider configured (Azure OpenAI, Groq, or Google Gemini)
Installation
Install into user space (no sudo, no global npm). Requires Node.js >= 18.
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/sarhan44/clawcode/main/install.sh | bash
Windows (PowerShell):
iwr https://raw.githubusercontent.com/sarhan44/clawcode/main/install.ps1 -useb | iex
Then run:
clawcode
On first run, ClawCode will guide you through configuring an AI provider. You can also run clawcode config any time to add/update providers.
ClawCode interactive UI: logo, project/provider info, activity feed, status bar, and task input.
Commands
| Command | Description |
|--------|-------------|
| clawcode | Open the interactive TUI (default). Select project and provider, then enter tasks. |
| clawcode config | Add or update AI provider credentials (API keys, endpoints). |
| clawcode shell | Start REPL mode with clawcode> prompt. Use :exit, :provider, :project, :help. |
| clawcode "task" | Run a single task in the current directory (no TUI). |
| clawcode --dir <path> "task" | Run a task in the specified project directory. |
Options
| Option | Description |
|--------|-------------|
| --dir <path> | Project root directory (default: current directory). |
| --provider <name> | Force provider: azure | groq | gemini. |
| --dry-run | Show plan and diff only; do not apply patches or run commands. |
| --yes, -y | Skip confirmation prompts (apply patches and run commands automatically). |
| --debug | Show detailed errors. |
| --version, -v | Print version. |
| --help, -h | Show help. |
Examples
# Open TUI (default)
clawcode
# Configure providers
clawcode config
# Single task in current directory
clawcode "Add error handling to login"
# Task in another directory
clawcode --dir ./my-app "Fix typo in README"
# Use a specific provider and skip confirmations
clawcode --provider groq "Refactor auth module" --yes
# Preview changes only
clawcode --dry-run "Add unit tests"
Configuration
Provider credentials are stored in ~/.clawcode/config.json.
To configure or update providers, run:
clawcode config
ClawCode currently does not load provider credentials from .env files or environment variables. Use onboarding or clawcode config to manage providers.
Usage
Default: interactive TUI
clawcode
Shows the ClawCode logo and header, then prompts for project directory and AI provider (or uses recent/cached choices). The TUI shows an activity feed, status bar (mode, iteration, model, memory), and the clawcode ❯ input. Enter a task and press Enter to run.
Single task (no TUI)
clawcode "Add a unit test for the login function"
clawcode --dir /path/to/repo "Refactor auth module"
Runs the task once with confirmations (unless --yes). Use for scripts or one-off runs.
REPL mode
clawcode shell
Persistent prompt; enter tasks one per line. Commands: :exit, :provider, :project, :clear, :help.
Flow
- Scan – Lists text files under the project root, respecting
.gitignoreand built-in ignore patterns. - Select – Picks a small set of relevant files (by task keywords and size) so only minimal context is sent.
- Plan – Sends task + file list + selected file contents to the chosen LLM; expects a single JSON object:
analysis– short explanationfiles_to_edit–[{ path, reason }]patches–[{ file, operation: "replace", find, replace }]commands– optional shell commands to run after edits
- Review – Shows analysis, files to edit, and a diff of all patches (in TUI or console).
- Confirm – Asks to apply patches (and optionally run commands), unless
--yes. - Apply – Backs up touched files to
.coding-agent-backups/, then applies patches and, if confirmed, runs commands. Session memory is updated for the project.
Project layout
cli.ts– CLI entry, args, env, and flow (config, REPL, UI, task)agent/– Runner, file selector, executor, eventsllm/– Provider dispatch, Azure/Groq/Gemini clients, prompts, plan parsingconfig/– Config dir, provider registry, typesmemory/– Global and per-project session memoryui/– Ink TUI (App, Logo, Header, ActivityFeed, StatusBar, InputPrompt, DiffView)utils/– Scanner (gitignore-aware), backup, patch, diff
See ARCHITECTURE.md for detailed logic and algorithms.
Safety
- Backups are written to
.coding-agent-backups/before any edit. - Patches are applied only after you confirm (unless
--yes). - Commands are run only after a second confirmation (unless
--yes). - Use
--dry-runto see the plan and diff without applying anything.
Uninstall
Removes the binary and config (including providers and recent projects). Optionally remove the PATH line from your shell config.
macOS / Linux:
rm -rf ~/.clawcode
To stop your shell from looking for clawcode, edit ~/.zshrc or ~/.bashrc and remove the line that contains .clawcode/bin.
Windows (PowerShell):
Remove-Item -Recurse -Force $HOME\.clawcode
To remove from PATH: Settings → System → About → Advanced system settings → Environment Variables → User variables → Path → delete the %USERPROFILE%\.clawcode\bin entry.
Contributing
Contributions are welcome! Please open issues or submit pull requests.
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
109.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
async-pr-review
100.4kTrigger this skill when the user wants to start an asynchronous PR review, run background checks on a PR, or check the status of a previously started async PR review.
