Skip to content

Commit 15779a2

Browse files
committed
docs: add MiniClaw documentation to README
Add MiniClaw secure agent runtime docs: overview, quick start, four-layer security model, API endpoints, dashboard, and config defaults. Update architecture tree to include miniclaw/ directory.
1 parent b3a6c6c commit 15779a2

1 file changed

Lines changed: 116 additions & 5 deletions

File tree

README.md

Lines changed: 116 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Security auditor for AI agent configurations. Scans Claude Code setups for vulne
44

55
The AI agent ecosystem is growing fast — but security isn't keeping pace. 12% of one major agent marketplace contains malicious skills. A CVSS 8.8 CVE affected 17,500+ internet-facing instances. Developers install community skills, connect MCP servers, and configure hooks without any automated way to audit the security of their setup.
66

7-
AgentShield scans your `.claude/` directory and agent configuration files to detect vulnerabilities before they become exploits.
7+
AgentShield scans your `.claude/` directory and agent configuration files to detect vulnerabilities before they become exploits. It also includes **MiniClaw** — a minimal, sandboxed AI agent runtime that demonstrates what a secure-by-default agent looks like.
88

99
Built at the [Claude Code Hackathon](https://cerebralvalley.ai/e/claude-code-hackathon) (Cerebral Valley x Anthropic, Feb 2026).
1010

@@ -81,6 +81,17 @@ agentshield scan --opus --stream -v
8181

8282
Requires `ANTHROPIC_API_KEY` environment variable.
8383

84+
### MiniClaw — Secure Agent Runtime
85+
86+
A minimal, sandboxed AI agent that demonstrates secure-by-default design. Single HTTP endpoint, isolated filesystem, whitelist-based tool authorization, prompt injection filtering. See the [MiniClaw section](#miniclaw) below for full documentation.
87+
88+
```typescript
89+
import { startMiniClaw } from 'ecc-agentshield/miniclaw';
90+
91+
const { server, stop } = startMiniClaw();
92+
// Listening on http://localhost:3847
93+
```
94+
8495
### GitHub Action
8596

8697
Add AgentShield to your CI pipeline:
@@ -226,10 +237,18 @@ src/
226237
│ └── index.ts Fix engine orchestrator
227238
├── init/
228239
│ └── index.ts Secure config generator
229-
└── opus/
230-
├── prompts.ts Attacker/Defender/Auditor system prompts
231-
├── pipeline.ts Three-agent Opus 4.6 pipeline
232-
└── render.ts Opus analysis rendering
240+
├── opus/
241+
│ ├── prompts.ts Attacker/Defender/Auditor system prompts
242+
│ ├── pipeline.ts Three-agent Opus 4.6 pipeline
243+
│ └── render.ts Opus analysis rendering
244+
└── miniclaw/
245+
├── types.ts Core type system (immutable, readonly)
246+
├── sandbox.ts Sandbox lifecycle + path validation
247+
├── router.ts Prompt sanitization + output filtering
248+
├── tools.ts Whitelist-based tool authorization
249+
├── server.ts HTTP server with rate limiting + CORS
250+
├── dashboard.tsx React dashboard component
251+
└── index.ts Entry point and re-exports
233252
```
234253

235254
## Security Rules
@@ -243,6 +262,98 @@ src/
243262
| Agents | 3 | High - Info |
244263
| **Total** | **16** | |
245264

265+
## MiniClaw
266+
267+
MiniClaw is a minimal, secure, sandboxed AI agent runtime — the antithesis of multi-channel orchestration platforms. Where platforms like OpenClaw expose many attack surfaces (Telegram, Discord, email, community plugins), MiniClaw presents a **single HTTP endpoint** backed by an **isolated sandbox**.
268+
269+
**Design mantra**: Minimal attack surface, maximum security, simple to deploy.
270+
271+
| Principle | Typical Agent Platform | MiniClaw |
272+
|-----------|----------------------|----------|
273+
| Access points | Many (Telegram, X, Discord, email) | One (single HTTP endpoint) |
274+
| Execution | Host machine, broad access | Containerized, sandboxed |
275+
| Skills | Unvetted community marketplace | Manually audited, local only |
276+
| Network exposure | Multiple ports, services | Minimal, single entry point |
277+
| Blast radius | Everything agent can access | Sandboxed to session directory |
278+
279+
### Quick Start
280+
281+
```typescript
282+
import { startMiniClaw } from 'ecc-agentshield/miniclaw';
283+
284+
// Start with secure defaults (localhost:3847, no network, safe tools only)
285+
const { server, stop } = startMiniClaw();
286+
287+
// Or customize configuration
288+
const { server, stop } = startMiniClaw({
289+
sandbox: { networkPolicy: 'localhost' },
290+
server: { port: 4000, rateLimit: 20 },
291+
});
292+
293+
// Embed in an existing app (no HTTP server)
294+
import { createMiniClawSession, routePrompt } from 'ecc-agentshield/miniclaw';
295+
const session = await createMiniClawSession();
296+
const response = await routePrompt({ sessionId: session.id, prompt: 'Read index.ts' }, session);
297+
```
298+
299+
### Security Model
300+
301+
**Defense in depth** — four layers, each independently enforced:
302+
303+
1. **Server Layer** — Rate limiting (10 req/min per IP), CORS restriction, request size cap (10KB), security headers, localhost-only binding
304+
2. **Prompt Router** — Strips 12+ injection pattern categories: system prompt overrides, identity reassignment, jailbreak attempts, tool invocation syntax, data exfiltration URLs, zero-width Unicode, base64-encoded payloads. Output filtering removes leaked system prompt content.
305+
3. **Tool Whitelist** — Three-tier authorization:
306+
- **Safe** (auto-approved): read, search, list
307+
- **Guarded** (session opt-in): write, edit, glob
308+
- **Restricted** (disabled by default): bash, network, external API
309+
- Unknown tools are **blocked by default** (fail-closed)
310+
4. **Sandbox** — Isolated filesystem per session. Path traversal blocked, symlink escape detection, allowed extensions whitelist, 10MB file size limit, 5-minute session timeout. No network access by default.
311+
312+
### API Endpoints
313+
314+
| Method | Endpoint | Description |
315+
|--------|----------|-------------|
316+
| `POST` | `/api/prompt` | Send a prompt, receive a response |
317+
| `POST` | `/api/session` | Create a new sandboxed session |
318+
| `GET` | `/api/session` | Get current session info |
319+
| `DELETE` | `/api/session/:id` | Destroy session and cleanup sandbox |
320+
| `GET` | `/api/events/:sessionId` | Retrieve security audit events |
321+
| `GET` | `/api/health` | Health check |
322+
323+
### Dashboard
324+
325+
MiniClaw includes a React dashboard component for interactive use:
326+
327+
```tsx
328+
import { MiniClawDashboard } from 'ecc-agentshield/miniclaw/dashboard';
329+
330+
<MiniClawDashboard endpoint="http://localhost:3847" />
331+
```
332+
333+
Features: dark theme, prompt input, streaming response display, session status indicator, security events panel, tool whitelist categorized by risk level. Requires React 18+ as a peer dependency.
334+
335+
### Configuration Defaults
336+
337+
```typescript
338+
// Sandbox defaults — maximum security posture
339+
{
340+
rootPath: '/tmp/miniclaw-sandboxes',
341+
maxFileSize: 10_485_760, // 10MB
342+
allowedExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.txt', ...],
343+
networkPolicy: 'none', // No network access
344+
maxDuration: 300_000, // 5 minutes
345+
}
346+
347+
// Server defaults — locked to localhost
348+
{
349+
port: 3847,
350+
hostname: 'localhost', // Never 0.0.0.0 by default
351+
corsOrigins: ['http://localhost:3847', 'http://localhost:3000'],
352+
rateLimit: 10, // 10 req/min per IP
353+
maxRequestSize: 10_240, // 10KB
354+
}
355+
```
356+
246357
## Development
247358

248359
```bash

0 commit comments

Comments
 (0)