Skip to content

Commit 29e2ae0

Browse files
committed
Scaffold gitclaw agent
1 parent e00ae75 commit 29e2ae0

2 files changed

Lines changed: 329 additions & 2 deletions

File tree

docs/openshell-guide.md

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
# Running GitClaw inside NVIDIA OpenShell
2+
3+
## The Problem: AI Agents Are Powerful — And That's Scary
4+
5+
AI agents today can read your files, write code, run shell commands, send messages, and call cloud APIs — all autonomously, with minimal human oversight. That's incredibly useful. It's also incredibly risky if you don't have guardrails.
6+
7+
In March 2026, NVIDIA released [OpenShell](https://github.com/NVIDIA/OpenShell) — an open-source sandboxed runtime designed specifically for AI agents. Think of it as a secure container that wraps around an agent and controls exactly what it can and can't do: which files it reads, which APIs it calls, what privileges it has, and whether it gets GPU access. Everything is defined in a simple YAML configuration file, and every blocked action is logged.
8+
9+
OpenShell already ships with support for several agents, including OpenClaw (the viral general-purpose agent with 250K+ GitHub stars). But here's the thing — **OpenClaw has serious security problems**, and GitClaw was purpose-built to avoid them.
10+
11+
## Why GitClaw over OpenClaw?
12+
13+
OpenClaw is impressive in breadth. It connects to 20+ messaging channels, has 13,700+ community skills, and can orchestrate almost anything. But that breadth comes with significant trade-offs:
14+
15+
**Security is OpenClaw's Achilles' heel.** Authentication is disabled by default. Credentials are stored in plaintext config files. The ClawHub skills marketplace has been found to contain malicious payloads in up to 20% of listed skills — credential theft, data exfiltration, backdoors. Microsoft, Cisco, Kaspersky, and multiple universities have published security advisories warning against running it on standard workstations. A high-severity CVE (CVE-2026-25253, CVSS 8.8) showed the Control UI auto-transmitting auth tokens to attacker-controlled WebSocket URLs. Prompt injection is described as an architectural vulnerability that "cannot be fully solved" in OpenClaw's design.
16+
17+
**GitClaw takes a different approach.** It's built as a focused, git-native agent — not a general-purpose life assistant. Here's how they compare:
18+
19+
| | GitClaw | OpenClaw |
20+
|---|---|---|
21+
| **Primary purpose** | Autonomous coding & project agent | General-purpose life/work assistant |
22+
| **Security model** | Git-native (all changes tracked, reversible), sandboxed CLI tool execution, auditable | Auth disabled by default, plaintext credentials, vulnerable skill marketplace |
23+
| **Voice mode** | Real-time bidirectional voice with OpenAI Realtime API, camera/screen input, photo capture | TTS/STT via ElevenLabs, voice notes, no real-time bidirectional |
24+
| **Skills** | Curated skills marketplace, skill learning (agent creates its own skills), SkillsFlow visual workflow builder | 13,700+ community skills (but ~20% flagged as malicious) |
25+
| **Memory** | Structured git-committed memory with reinforcement learning, memory archival | Markdown diary entries |
26+
| **Multi-channel** | Voice UI, Telegram, WhatsApp | 20+ channels |
27+
| **Agent brain** | Pluggable (Claude, GPT, Gemini, Ollama, etc.) | Pluggable (similar range) |
28+
| **Architecture** | Single focused process, SDK for embedding | Gateway + multiple services |
29+
30+
GitClaw is narrower in scope but deeper in execution. It won't manage your Slack DMs or order you coffee, but it will autonomously write, test, and ship code — with every change committed to git, every tool call hookable, and every action auditable.
31+
32+
## Why GitClaw + OpenShell?
33+
34+
Even though GitClaw is already more security-conscious than OpenClaw, adding OpenShell on top gives you defense-in-depth:
35+
36+
- **Network isolation.** GitClaw only reaches the APIs you explicitly allow — Anthropic for reasoning, OpenAI for voice, nothing else. Default-deny networking at the kernel level.
37+
- **Filesystem boundaries.** The agent can read and write your project folder. It cannot touch anything else on the machine. Enforced via Linux Landlock LSM and seccomp, not just application-level checks.
38+
- **Non-root execution.** The agent runs as a sandboxed user, never as administrator. Even if something goes wrong, it can't escalate privileges.
39+
- **Hot-reloadable policies.** Tighten or loosen the rules while the agent is running. Start permissive (audit mode), then lock down once you're confident.
40+
- **Full audit trail.** Every blocked action is logged with the exact binary, target, and reason. Compliance teams and security reviewers can see precisely what happened.
41+
42+
This matters for enterprise teams deploying GitClaw across developers, regulated industries (banking, healthcare, government) that need clear access boundaries, multi-tenant setups where each user gets an isolated instance, and CI/CD pipelines where agents run unattended.
43+
44+
OpenShell turns GitClaw from "an AI that can do a lot on your machine" into "an AI that can do exactly what you've approved, and nothing else."
45+
46+
## What We'll Set Up
47+
48+
This guide walks through everything step by step:
49+
50+
1. **Install OpenShell** on your machine (it runs on top of Docker)
51+
2. **Build a sandbox** — a secure container with GitClaw pre-installed
52+
3. **Write a security policy** — the rules controlling what GitClaw can and can't do
53+
4. **Launch GitClaw in the sandbox** — with voice mode, port forwarding, and API access
54+
5. **Monitor and adjust** — view logs, check blocked actions, and tweak the policy
55+
56+
No prior experience with Docker or security tooling is required — every command is included below.
57+
58+
## Prerequisites
59+
60+
- Docker running on the host
61+
- OpenShell CLI installed:
62+
```bash
63+
curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh | sh
64+
```
65+
- API keys: `OPENAI_API_KEY` (voice), `ANTHROPIC_API_KEY` (agent)
66+
67+
## Quick Start
68+
69+
```bash
70+
# Create sandbox from a local directory with port forwarding for voice
71+
openshell sandbox create \
72+
--from ./sandboxes/gitclaw \
73+
--policy ./sandboxes/gitclaw/policy.yaml \
74+
--forward 3333 \
75+
--name gitclaw-dev \
76+
-- gitclaw --voice --dir /sandbox/project
77+
78+
# Open the voice UI
79+
open http://localhost:3333
80+
```
81+
82+
## Sandbox Structure
83+
84+
Create the following directory:
85+
86+
```
87+
sandboxes/gitclaw/
88+
Dockerfile
89+
policy.yaml
90+
```
91+
92+
### Dockerfile
93+
94+
```dockerfile
95+
ARG BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest
96+
FROM ${BASE_IMAGE}
97+
98+
USER root
99+
100+
# Install gitclaw globally
101+
RUN npm install -g gitclaw@latest
102+
103+
# Create workspace
104+
RUN mkdir -p /sandbox/project && chown -R sandbox:sandbox /sandbox
105+
106+
USER sandbox
107+
WORKDIR /sandbox/project
108+
ENTRYPOINT ["/bin/bash"]
109+
```
110+
111+
### policy.yaml
112+
113+
```yaml
114+
version: 1
115+
116+
filesystem_policy:
117+
include_workdir: true
118+
read_only:
119+
- /usr
120+
- /lib
121+
- /proc
122+
- /dev/urandom
123+
- /etc
124+
read_write:
125+
- /sandbox
126+
- /tmp
127+
- /dev/null
128+
129+
landlock:
130+
compatibility: best_effort
131+
132+
process:
133+
run_as_user: sandbox
134+
run_as_group: sandbox
135+
136+
network_policies:
137+
anthropic_api:
138+
name: anthropic-api
139+
endpoints:
140+
- host: api.anthropic.com
141+
port: 443
142+
protocol: rest
143+
tls: terminate
144+
enforcement: enforce
145+
access: full
146+
binaries:
147+
- path: /usr/local/bin/node
148+
149+
openai_api:
150+
name: openai-api
151+
endpoints:
152+
- host: api.openai.com
153+
port: 443
154+
protocol: rest
155+
tls: terminate
156+
enforcement: enforce
157+
access: full
158+
binaries:
159+
- path: /usr/local/bin/node
160+
161+
openai_realtime:
162+
name: openai-realtime
163+
endpoints:
164+
- host: api.openai.com
165+
port: 443
166+
protocol: wss
167+
tls: terminate
168+
enforcement: enforce
169+
access: full
170+
binaries:
171+
- path: /usr/local/bin/node
172+
173+
npm_registry:
174+
name: npm-registry
175+
endpoints:
176+
- host: registry.npmjs.org
177+
port: 443
178+
binaries:
179+
- path: /usr/local/bin/npm
180+
```
181+
182+
**Key points:**
183+
- Default-deny networking — only the endpoints listed above are reachable
184+
- Filesystem uses Landlock LSM + seccomp — anything not listed is inaccessible
185+
- Process runs as `sandbox` user, never root
186+
- Voice mode needs the `openai_realtime` WebSocket endpoint
187+
188+
## Uploading Your Project
189+
190+
```bash
191+
# Upload an existing agent directory into the sandbox
192+
openshell sandbox upload gitclaw-dev ./my-agent /sandbox/project
193+
194+
# Or create a fresh agent inside the sandbox
195+
openshell sandbox connect gitclaw-dev
196+
# Then inside: gitclaw --voice --dir /sandbox/project
197+
```
198+
199+
## Port Forwarding (Voice Mode)
200+
201+
GitClaw's voice server runs on port 3333. Forward it to your host:
202+
203+
```bash
204+
# At creation time (shown in Quick Start above)
205+
openshell sandbox create --forward 3333 ...
206+
207+
# Or add forwarding to a running sandbox
208+
openshell forward start 3333 gitclaw-dev
209+
210+
# Background mode
211+
openshell forward start 3333 gitclaw-dev -d
212+
213+
# List active forwards
214+
openshell forward list
215+
216+
# Stop
217+
openshell forward stop 3333 gitclaw-dev
218+
```
219+
220+
Then open `http://localhost:3333` in your browser.
221+
222+
## Environment Variables
223+
224+
Pass API keys when creating the sandbox:
225+
226+
```bash
227+
openshell sandbox create \
228+
--from ./sandboxes/gitclaw \
229+
--env OPENAI_API_KEY="sk-..." \
230+
--env ANTHROPIC_API_KEY="sk-ant-..." \
231+
--forward 3333 \
232+
--name gitclaw-dev
233+
```
234+
235+
Or place a `.env` file in the project directory before uploading — GitClaw's `install.sh` and `server.ts` will pick it up automatically.
236+
237+
## GPU Passthrough
238+
239+
If running local inference (e.g., Ollama models instead of API calls):
240+
241+
```bash
242+
openshell sandbox create --gpu --from ./sandboxes/gitclaw --name gitclaw-gpu
243+
```
244+
245+
Add Ollama to the policy if needed:
246+
247+
```yaml
248+
ollama_local:
249+
name: ollama
250+
endpoints:
251+
- host: host.docker.internal
252+
port: 11434
253+
protocol: rest
254+
enforcement: enforce
255+
access: full
256+
binaries:
257+
- path: /usr/local/bin/node
258+
```
259+
260+
## Monitoring & Debugging
261+
262+
```bash
263+
# Stream sandbox logs
264+
openshell logs gitclaw-dev --tail --source sandbox
265+
266+
# Check for policy denials
267+
openshell logs gitclaw-dev --level warn --since 5m
268+
269+
# Open the TUI dashboard (k9s-style)
270+
openshell term
271+
```
272+
273+
Denial logs show exactly which binary tried to connect where and why it was blocked — useful for iterating on the policy.
274+
275+
## Hot-Reload Policies
276+
277+
Adjust the network policy on a running sandbox without restarting:
278+
279+
```bash
280+
# Export current policy
281+
openshell policy get gitclaw-dev --full > current.yaml
282+
283+
# Edit current.yaml (e.g., add a new API endpoint)
284+
285+
# Apply
286+
openshell policy set gitclaw-dev --policy current.yaml --wait
287+
```
288+
289+
Use `enforcement: audit` during initial setup to log violations without blocking:
290+
291+
```yaml
292+
endpoints:
293+
- host: api.anthropic.com
294+
port: 443
295+
enforcement: audit # log only, don't block
296+
access: full
297+
```
298+
299+
Once everything works, switch to `enforcement: enforce`.
300+
301+
## Composio / Integrations
302+
303+
If using Composio (Gmail, Calendar, Slack, GitHub integrations), add its endpoint:
304+
305+
```yaml
306+
composio_api:
307+
name: composio
308+
endpoints:
309+
- host: "*.composio.dev"
310+
port: 443
311+
protocol: rest
312+
tls: terminate
313+
enforcement: enforce
314+
access: full
315+
binaries:
316+
- path: /usr/local/bin/node
317+
```
318+
319+
Similarly for Telegram, WhatsApp, or any other integration GitClaw supports — add the relevant API hosts to `network_policies`.
320+
321+
## Download Results
322+
323+
Pull generated files (workspace output, memory, photos) back to your host:
324+
325+
```bash
326+
openshell sandbox download gitclaw-dev /sandbox/project/workspace ./output
327+
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)