claw-c
Health Warn
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Pass
- Code scan — Scanned 2 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
This tool is a terminal-based AI coding assistant, similar to Claude Code, but reimplemented entirely in C. It connects to various Large Language Models (LLMs) to process prompts and execute actions locally on your machine.
Security Assessment
Overall risk: High. While the automated code scan found no dangerous patterns or hardcoded secrets, the tool's core functionality requires extreme caution. By design, it makes external network requests to third-party LLM providers, transmitting your prompts and potentially your code. Most critically, it features a built-in `bash` tool that directly executes shell commands generated by the AI. A misconfigured prompt, a hallucinated command, or a compromised API response could easily lead to arbitrary code execution or unauthorized file modifications on your system. Additionally, user API keys are stored locally in a plain text configuration file.
Quality Assessment
The project is highly active, with its last code push occurring today. However, it suffers from extremely low community visibility, evidenced by only 5 GitHub stars. Because there is no license file included, the legal terms of use, modification, and distribution are technically undefined, making it unsuitable for professional or commercial environments.
Verdict
Use with extreme caution: while it is a functional and novel project, the combination of unvetted AI-generated shell execution, unrestricted network access, and a lack of licensing makes this inappropriate for sensitive environments.
Claude Code reimplemented in pure C — the lowest level it's ever been done
claw-c
_
___| | __ ___ __ ___
/ __| |/ _` \ \ /\ / /___ / __|
| (__| | (_| |\ V V /|___|| (__
\___|_|\__,_| \_/\_/ \___|
AI coding agent in your terminal. Pure C. No bloat.
me building an HTTP client from scratch instead of linking libcurl
install
git clone https://github.com/apoorvdarshan/claw-c.git
cd claw-c && ./install.sh
that's it. builds, installs to ~/.local/bin/claw-c, adds to PATH. on macOS it auto-installs mbedTLS via brew. on linux you need mbedTLS 4.x first.
then from anywhere:
claw-c
first run asks you to pick a provider and enter your key. config saved to ~/.claw-c/config.json. next time just type claw-c.
$ claw-c
Welcome to claw-c! Let's get you set up.
1 anthropic (claude-sonnet-4-6, claude-opus-4-6)
2 openai (gpt-4o, o3, o4-mini)
3 gemini (gemini-2.5-flash, gemini-2.5-pro)
4 groq (llama-3.3-70b-versatile)
5 xai (grok-3)
6 openrouter (any model)
7 ollama (local, no key needed)
...
Pick a provider [1-10]: 3
Model [gemini-2.5-flash]:
API key: AIza...
Config saved to ~/.claw-c/config.json
to change provider/model/key: claw-c --setup or /setup inside the REPL.
what it does
you type a prompt. claw-c talks to the LLM. the LLM can run commands, read/write/edit files, search code — claw-c executes it all, feeds results back, and loops until the task is done. just like claude code but ~3500 lines of C.
$ claw-c
gemini | gemini-2.5-flash | main
> write hello.c that prints "built by claw-c", compile and run it
── write_file ──
/tmp/hello.c
Wrote 81 bytes to /tmp/hello.c
── bash ──
$ cc /tmp/hello.c -o /tmp/hello && /tmp/hello
built by claw-c
Done.
> find all functions with "parse" in their name
── grep ──
/parse/
c/src/json.c:228:json_value_t *json_parse(const char *src, size_t len) {
c/src/sse.c:27:static int parse_frame(const char *frame, ...) {
...
> /quit
tools
6 built-in tools, same as claude code:
| tool | what it does |
|---|---|
bash |
shell commands via /bin/sh -c (120s timeout, 512KB cap) |
read_file |
read file with line numbers |
write_file |
create/overwrite file (auto-creates parent dirs) |
edit_file |
find-and-replace exact string match |
glob |
recursive file pattern matching (*.c, src/**/*.h) |
grep |
recursive regex search with line numbers |
providers
auto-detected from model name. 10 providers, 3 API formats built from scratch.
| provider | models | env var |
|---|---|---|
| Anthropic | claude-* |
ANTHROPIC_API_KEY |
| OpenAI | gpt-* o1-* o3-* o4-* |
OPENAI_API_KEY |
| Gemini | gemini-* |
GEMINI_API_KEY |
| xAI | grok-* |
XAI_API_KEY |
| Groq | llama* mixtral* |
GROQ_API_KEY |
| Together | deepseek* qwen* |
TOGETHER_API_KEY |
| OpenRouter | any (-p openrouter) |
OPENROUTER_API_KEY |
| Ollama | any (-p ollama) |
none |
| Minimax | -p minimax |
MINIMAX_API_KEY |
| Kimi | moonshot* |
MOONSHOT_API_KEY |
usage
claw-c # REPL (uses saved config)
claw-c "find all TODO comments" # one-shot
claw-c -m gpt-4o -k sk-... "explain this" # override model/key
claw-c -p ollama -m llama3.2 "hello" # local
claw-c -p openai -b my-server:8080 "hi" # custom endpoint
claw-c --setup # change provider/model/key
flags: -m MODEL -k KEY -p PROVIDER -b HOST:PORT -h -v --setup
repl: /help /status /clear /setup /quit
keys: Ctrl-C cancel Ctrl-D exit Up/Down history
how it works
prompt → JSON request (per provider format)
→ raw TCP socket → TLS handshake → HTTP/1.1 POST
→ SSE stream → text printed live
→ tool calls? → execute (fork/exec, file I/O, regex)
→ feed results back → loop until done (max 25 turns)
everything from scratch: JSON parser, HTTP client, SSE streaming, TLS (via mbedTLS). no curl, no libevent, no external JSON lib.
reads CLAUDE.md from your project (walks up to git root). shows git branch + status in context.
tokens streaming through the hand-rolled SSE parser
source
c/src/
claw.h all types + declarations (single header)
strbuf.c dynamic string buffer
json.c recursive descent JSON parser/serializer
tls.c raw POSIX TCP + mbedTLS 4.x TLS
http.c HTTP/1.1 with chunked streaming
sse.c SSE event parser
api.c multi-provider API client (3 format families)
tools.c 6 tools: bash, read, write, edit, glob, grep
agent.c agent loop with tool execution
terminal.c raw mode REPL with history
main.c CLI, config, onboarding, CLAUDE.md, git context
build from source
brew install mbedtls # macOS
cd c && make # dynamic
make static # portable static binary
make install # → ~/.local/bin/claw-c
disclaimer
this repo was originally cloned from ultraworkers/claw-code (a Rust/Python reimplementation of Claude Code). i stripped all of that out and rewrote the whole thing from scratch in pure C — different language, different architecture, different code. the Rust implementation was used as a behavioral reference to understand how the agent loop, tool system, and API streaming should work.
not Claude Code. not affiliated with Anthropic, OpenAI, Google, or any provider. hobby project. use at your own risk — this thing runs shell commands.
ownership / affiliation
- this repository does not claim ownership of the original Claude Code source material.
- this repository is not affiliated with, endorsed by, or maintained by Anthropic.
author
Apoorv Darshan
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found