Skip to content

Commit 51e0673

Browse files
authored
Merge pull request #1 from Rayed-Hasan/main
docs: Update README with transparency statement
2 parents 403130d + 5e06e58 commit 51e0673

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
1-
# Claw Code (C++ Edition) 🚀
1+
# Claw Code (C++ Educational Skeleton) 🛠️🤖
22

33
![Build](https://github.com/Rayed-Hasan/claw-code-cpp/actions/workflows/build.yml/badge.svg)
44

55
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
66
![C++20](https://img.shields.io/badge/C++-20-blue.svg)
7-
![Build](https://img.shields.io/badge/build-CMake-green.svg)
87

9-
A clean-room, highly-performant C++20 reimplementation of the **Claw Code AI Agent Harness**.
10-
11-
Rather than being a simple chatbot that stops after a single reply, this is an **agentic loop architecture**. It integrates deeply with the Anthropic Messages API, sending explicit tool schemas to the model, and recursively executing local tools (like Bash and File I/O) on behalf of the AI until a task is completed.
8+
> **Transparency Note (Read First):** \
9+
> This is **not** a port of the massive 500k LOC original Claw Code repository. This is a minimal, from-scratch skeleton project built explicitly as an exercise to explore what an agentic tool-loop looks like in C++.
10+
>
11+
> Furthermore, **the C++ architecture in this repository was entirely generated by Antigravity AI** (an agentic coding tool driven by advanced LLMs) under the guidance of Rayed Hasan. It was built to see if an AI could reconstruct a basic Claude-like loop in C++20. Expectations should be matched accordingly: it's a bare-bones architectural experiment, **not** a production-ready daily driver.
1212
1313
---
1414

15-
## ⚡ Features
15+
## What Actually Is This?
16+
17+
It is the absolute **minimum viable architecture** (MVA) required for an AI agent. Most coding agents are built in TypeScript/Python. We wanted to see what it would take to compile a tool-use loop directly to a native C++ binary.
18+
19+
As noted by the community, this isn't magic. Under the hood, this is essentially a trivial HTTP loop that fetches tool requests and blindly shells out to system commands.
20+
21+
### What is included:
22+
- **The Agentic Loop:** A recursive runtime that sends prompts, parses `stop_reason: tool_use`, executes local tools, feeds results back, and repeats.
23+
- **3 Minimal Tools:**
24+
- `BashTool` (Uses `popen` to shell out. Capped at 50KB output to prevent hangs).
25+
- `FileReadTool` / `FileWriteTool`
26+
- **Interactive REPL:** A basic terminal interface.
27+
28+
## Addressing Community Feedback 🗣️
1629

17-
- **True Agentic Tool Loop:** Context-aware routing and recursive API calls.
18-
- **Interactive REPL & One-Shot:** Native slash commands (`/quit`, `/clear`, `/usage`) and one-shot prompt scripts.
19-
- **Built-in Tooling Layer:**
20-
- `BashTool`: Execute local shell scripts with configurable timeouts and output truncation guards.
21-
- `FileReadTool`: Read files up to 512KB to inspect codebases safely.
22-
- `FileWriteTool`: Write strings to files with automatic parent-directory creation.
23-
- **Native Static Binary:** Builds to a fast, statically linked binary. Zero python/npm dependencies.
24-
- **Context Compaction:** Auto-trims history past a certain turn limit to keep token window budgets low.
30+
When initially posting this concept, the hype heavily overstated the code's real capabilities. Based on very valid feedback, here is exactly what this project **lacks** and why you shouldn't use it for sensitive work yet:
31+
32+
### 1. Wait, there is ZERO permission control?
33+
**Correct.** A capable, safe AI coding tool *must* have an `allow`/`ask`/`deny` permission system. Right now, this C++ skeleton just executes whatever bash command the LLM requests, completely unconditionally. Do not run this on sensitive systems without sandboxing. Building proper CLI permission barriers is a critical next step.
34+
35+
### 2. You said it's "highly performant" and "C++20"?
36+
The phrase "highly performant" was just referring to the fact that it's a small static binary rather than spinning up a V8 Node engine. That's all. As for C++20, we just use `std::variant` to parse Anthropic's mixed `[TextBlock, ToolUseBlock]` arrays cleanly, alongside `fmt` and `nlohmann-json`. It's modern C++, but the underlying logic is incredibly basic.
37+
38+
### 3. What's next? (LSP / MCP)
39+
Shelling out to `bash` for everything is messy and error-prone. The real interesting frontier developers should explore with this kind of native C++ skeleton is integrating **LSP (Language Server Protocol)** and **MCP (Model Context Protocol)**. That would allow the agent to actually "understand" codebases rather than blindly parsing `grep` outputs.
2540

2641
## 🏗️ Architecture Design
2742

@@ -57,7 +72,7 @@ claw-cpp-public/
5772
│ ├── client.cpp/hpp # HTTPS logic via cpp-httplib
5873
│ └── types.hpp # Rich API content block modeling (Variant)
5974
├── cli/
60-
│ └── main.cpp # REPL CLI Interface & entrypoint
75+
│ └── main.cpp # REPL CLI Interface
6176
├── runtime/
6277
│ └── session.cpp/hpp # Core agentic recursion loop
6378
└── tools/
@@ -70,13 +85,15 @@ claw-cpp-public/
7085

7186
## 🚀 Getting Started
7287

88+
If you want to poke around the skeleton and experiment with C++ agent loops!
89+
7390
### Prerequisites
7491

7592
You need a C++20 compatible compiler and CMake.
7693
For Windows users, you can use Winget:
7794
```powershell
7895
winget install Kitware.CMake
79-
winget install Microsoft.VisualStudio.2022.BuildTools --override "--wait --quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
96+
winget install Microsoft.VisualStudio.2022.BuildTools
8097
winget install ShiningLight.OpenSSL # Needed for HTTPS network calls
8198
```
8299

@@ -95,21 +112,4 @@ cmake --build . --config Release
95112

96113
### Usage
97114

98-
Export your API Key to the environment:
99-
```powershell
100-
# Windows
101-
$env:ANTHROPIC_API_KEY="sk-ant-..."
102-
103-
# macOS/Linux
104-
export ANTHROPIC_API_KEY="sk-ant-..."
105-
```
106-
107-
Run the REPL:
108-
```bash
109-
./Release/claw-cpp
110-
```
111-
112-
Run a one-shot query:
113-
```bash
114-
./Release/claw-cpp prompt "List the files in this directory and tell me what they are."
115-
```
115+
Export your Anthropic API Key to the environment (`$env:ANTHROPIC_API_KEY="sk-ant-..."`), and run the built `claw-cpp` executable.

0 commit comments

Comments
 (0)