You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
12
12
13
13
---
14
14
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 🗣️
16
29
17
-
-**True Agentic Tool Loop:** Context-aware routing and recursive API calls.
-`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.
25
40
26
41
## 🏗️ Architecture Design
27
42
@@ -57,7 +72,7 @@ claw-cpp-public/
57
72
│ ├── client.cpp/hpp # HTTPS logic via cpp-httplib
58
73
│ └── types.hpp # Rich API content block modeling (Variant)
0 commit comments