@sahu-01/openpaw 1.0.9 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +338 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,338 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/npm/v/@sahu-01/openpaw?style=flat-square&color=22c55e" alt="npm version" />
3
+ <img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="license" />
4
+ <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square" alt="node" />
5
+ <img src="https://img.shields.io/badge/typescript-5.x-3178c6?style=flat-square" alt="typescript" />
6
+ </p>
7
+
8
+ <h1 align="center">🐾 OpenPaw</h1>
9
+
10
+ <p align="center">
11
+ <strong>Privacy-first security wrapper for OpenClaw AI agents.</strong><br/>
12
+ Drop-in protection — same experience, cryptographic guarantees underneath.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#quick-start">Quick Start</a> •
17
+ <a href="#why-openpaw">Why OpenPaw</a> •
18
+ <a href="#architecture">Architecture</a> •
19
+ <a href="#security-layers">Security Layers</a> •
20
+ <a href="#cli-reference">CLI Reference</a> •
21
+ <a href="#configuration">Configuration</a> •
22
+ <a href="#roadmap">Roadmap</a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ Three commands. That's it.
30
+
31
+ ```bash
32
+ npm install -g @sahu-01/openpaw
33
+
34
+ openpaw migrate --from openclaw
35
+
36
+ openpaw start
37
+ ```
38
+
39
+ Your OpenClaw agent keeps working exactly as before — same channels, same personality, same skills — but now credentials are encrypted, tool calls are proxied, sessions are secured, and every action is auditable.
40
+
41
+ ---
42
+
43
+ ## Why OpenPaw
44
+
45
+ OpenClaw is the most popular open-source AI agent gateway, connecting LLMs to WhatsApp, Telegram, Discord, Slack, and more. But it stores **everything as plaintext**: API keys, OAuth tokens, conversation history, agent memory, daily logs — all sitting unencrypted on disk. Skills run unscanned. The browser tool uses your actual Chrome sessions. There's no access control on tool calls.
46
+
47
+ If an attacker gains disk access, or if the agent is tricked by a prompt injection, the damage is total and silent.
48
+
49
+ **OpenPaw fixes this without changing anything the user sees.** It's not a fork or a rewrite — it's a security layer that wraps OpenClaw's functionality while preserving the same port (18789), same channel adapters, same workspace structure, and same SKILL.md format.
50
+
51
+ ### The Problem, Visualized
52
+
53
+ ```
54
+ OpenClaw (unprotected):
55
+ Channel → Agent → Tool (direct, unprotected)
56
+
57
+ • Credentials stored as plaintext JSON
58
+ • No scanning of third-party skills
59
+ • Agent has unrestricted tool access
60
+ • Sessions readable by anyone with disk access
61
+ • No audit trail of agent actions
62
+ ```
63
+
64
+ ### The Fix
65
+
66
+ ```
67
+ OpenPaw (secured):
68
+ Channel → TEE Gateway → Agent (in enclave)
69
+ → MCP Proxy (credential injection + policy engine)
70
+ → ZK Attestation → Tool
71
+
72
+ • Credentials encrypted with AES-256-GCM
73
+ • Skills statically analyzed and quarantined if flagged
74
+ • Every tool call proxied, rate-limited, and logged
75
+ • Sessions encrypted at rest
76
+ • Tamper-proof audit trail on Solana
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Architecture
82
+
83
+ OpenPaw is built as a TypeScript monorepo using pnpm workspaces and turborepo.
84
+
85
+ ```
86
+ @zkagi/openpaw
87
+ ├── packages/
88
+ │ ├── cli/ Commander.js entry point — all user-facing commands
89
+ │ ├── detect/ Scans directories for AI agent configurations
90
+ │ ├── vault/ AES-256-GCM credential encryption + reference IDs
91
+ │ ├── scanner/ AST-based skill security analysis + quarantine
92
+ │ ├── migrate/ One-command OpenClaw → OpenPaw migration engine
93
+ │ ├── mcp-proxy/ JSON-RPC 2.0 proxy — credential injection, redaction, rate limiting
94
+ │ ├── gateway/ WebSocket server on :18789 — encrypted sessions, channel routing
95
+ │ ├── whatsapp/ Baileys WhatsApp channel adapter
96
+ │ ├── telegram/ grammY Telegram channel adapter
97
+ │ ├── discord/ discord.js channel adapter
98
+ │ ├── slack/ @slack/bolt channel adapter
99
+ │ ├── zk-prover/ Circom + Groth16 zero-knowledge proof generation
100
+ │ ├── solana/ Anchor programs + on-chain audit verification
101
+ │ └── shared/ Shared types, config schema, utilities
102
+ ├── circuits/
103
+ │ ├── IntentVerify.circom Proves tool call matches user instruction
104
+ │ └── PolicyCheck.circom Proves action is within policy constraints
105
+ └── tests/
106
+ ├── e2e/ End-to-end integration tests
107
+ └── fixtures/ Real OpenClaw directory structures for testing
108
+ ```
109
+
110
+ ### How a Message Flows Through OpenPaw
111
+
112
+ 1. **Message arrives** on WhatsApp / Telegram / Discord / Slack
113
+ 2. **OpenPaw Gateway** receives it on `ws://127.0.0.1:18789`
114
+ 3. **MCP Proxy intercepts** — credentials replaced with reference IDs (`cred_gmail_oauth_a1b2`)
115
+ 4. **Agent processes** the message — it never sees raw credentials
116
+ 5. **LLM responds** with a tool call request
117
+ 6. **MCP Proxy checks**: rate limits, policy constraints, credential patterns
118
+ 7. **Groth16 prover** generates a ZK proof that the action is authorized
119
+ 8. **Vault decrypts** the real credential server-side for the API call
120
+ 9. **Token redaction** strips any leaked keys from the response (`sk-*` → `[REDACTED]`)
121
+ 10. **Tool executes** within sandbox limits
122
+ 11. **Audit log** records the action with timestamp and proof hash
123
+ 12. **Response returns** to user through the channel
124
+
125
+ ---
126
+
127
+ ## Security Layers
128
+
129
+ ### Layer 1 — Credential Vault (AES-256-GCM)
130
+
131
+ All API keys, OAuth tokens, and secrets are encrypted at rest. The agent never handles raw credentials — it only knows reference IDs like `cred_google_a1b2`. The vault decrypts server-side when the actual API call is made.
132
+
133
+ ```bash
134
+ # Import a credential
135
+ openpaw vault import --service google --type api-key
136
+
137
+ # List stored credentials (shows reference IDs only, never plaintext)
138
+ openpaw vault list
139
+
140
+ # Securely delete (3-pass overwrite + unlink)
141
+ openpaw vault delete cred_google_api_a1b2
142
+ ```
143
+
144
+ ### Layer 2 — Skill Scanner
145
+
146
+ Before any skill runs, an AST parser reads the code and flags 9 categories of dangerous patterns: `fetch()` to external URLs, `fs.readFileSync` on credential paths, `eval()`, obfuscated code, `child_process` usage, and more. Flagged skills go to quarantine — you approve or reject.
147
+
148
+ ```bash
149
+ # Scan a skills directory
150
+ openpaw scan ./skills
151
+
152
+ # Auto-quarantine flagged skills
153
+ openpaw scan ./skills --quarantine
154
+ ```
155
+
156
+ ### Layer 3 — MCP Proxy
157
+
158
+ A JSON-RPC 2.0 stdio server that sits between the agent and every tool. It intercepts every tool call, injects credentials so the agent never handles them directly, redacts sensitive data from responses, enforces rate limits and budget caps, sandboxes shell commands, and logs everything.
159
+
160
+ ### Layer 4 — TEE Runtime (Oasis ROFL)
161
+
162
+ The entire gateway runs inside a hardware-sealed enclave. CPU encrypts all RAM — even root access on the host can't read agent memory. Remote attestation proves the enclave is running unmodified OpenPaw code.
163
+
164
+ ### Layer 5 — ZK Attestation (Circom + Groth16)
165
+
166
+ Every tool call requires a zero-knowledge proof before execution. Two circuits handle this:
167
+
168
+ - **IntentVerify.circom** — proves the tool call matches the user's original instruction
169
+ - **PolicyCheck.circom** — proves the action is within policy constraints (rate limits, budget caps, allowed services)
170
+
171
+ Failed proof = action blocked. Even if an attacker crafts a prompt injection, the action can't pass attestation.
172
+
173
+ ### Layer 6 — On-Chain Audit (Solana Anchor)
174
+
175
+ Hash commitments of every action are logged on Solana. Private but verifiable — anyone can confirm an action happened without seeing the contents. This creates a tamper-proof record that kills deniability.
176
+
177
+ ---
178
+
179
+ ## CLI Reference
180
+
181
+ | Command | Description |
182
+ |---|---|
183
+ | `openpaw detect [path]` | Scan a directory for AI agent configurations |
184
+ | `openpaw vault import --service <s> --type <t>` | Import a credential into the encrypted vault |
185
+ | `openpaw vault list [--json]` | List stored credentials (reference IDs only) |
186
+ | `openpaw vault get <id>` | Retrieve a credential by reference ID |
187
+ | `openpaw vault delete <id>` | Securely delete a credential (3-pass wipe) |
188
+ | `openpaw scan [path] [--quarantine]` | Run security scanner on skill code |
189
+ | `openpaw migrate --from openclaw` | Migrate an OpenClaw workspace to OpenPaw |
190
+ | `openpaw start` | Start the gateway + MCP proxy |
191
+ | `openpaw stop` | Stop the gateway |
192
+ | `openpaw status` | Show vault, scans, proofs, and budget status |
193
+ | `openpaw doctor` | Verify installation health |
194
+ | `openpaw audit show [--day]` | Show audit log entries |
195
+ | `openpaw budget set <amount>` | Set daily spending limit |
196
+ | `openpaw prove verify <hash>` | Verify a Groth16 proof against Solana |
197
+
198
+ ---
199
+
200
+ ## Configuration
201
+
202
+ After migration, OpenPaw creates `openpaw.json` in your workspace:
203
+
204
+ ```jsonc
205
+ {
206
+ "gateway": {
207
+ "port": 18789,
208
+ "host": "127.0.0.1"
209
+ },
210
+ "vault": {
211
+ "algorithm": "aes-256-gcm",
212
+ "keyDerivation": "scrypt"
213
+ },
214
+ "proxy": {
215
+ "rateLimit": {
216
+ "maxCallsPerMinute": 60,
217
+ "maxCallsPerHour": 500
218
+ },
219
+ "redaction": {
220
+ "patterns": ["sk-*", "AIza*", "Bearer *", "ghp_*", "xoxb-*"]
221
+ }
222
+ },
223
+ "scanner": {
224
+ "autoQuarantine": false,
225
+ "severityThreshold": "HIGH"
226
+ },
227
+ "audit": {
228
+ "enabled": true,
229
+ "logPath": ".openpaw/audit.jsonl"
230
+ },
231
+ "budget": {
232
+ "dailyLimit": null,
233
+ "currency": "USDC"
234
+ },
235
+ "zk": {
236
+ "prover": "local",
237
+ "circuits": ["IntentVerify", "PolicyCheck"]
238
+ }
239
+ }
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Migration Guide
245
+
246
+ OpenPaw reads your existing OpenClaw workspace and secures it in place.
247
+
248
+ ```bash
249
+ # Step 1: See what OpenPaw detects
250
+ openpaw detect ~/.openclaw
251
+
252
+ # Step 2: Run migration
253
+ openpaw migrate --from openclaw
254
+
255
+ # Step 3: Verify
256
+ openpaw doctor
257
+
258
+ # Step 4: Start
259
+ openpaw start
260
+ ```
261
+
262
+ **What migration does:**
263
+
264
+ - Copies agent personality files (AGENTS.md, SOUL.md, IDENTITY.md, USER.md, TOOLS.md)
265
+ - Translates `openclaw.json` → `openpaw.json`
266
+ - Encrypts session files (`session.jsonl` → `session.jsonl.enc`)
267
+ - Extracts credentials from `auth-profiles.json` into the encrypted vault
268
+ - Optionally wipes the original plaintext credentials (`--wipe`)
269
+
270
+ **What migration does NOT do:**
271
+
272
+ - Change your agent's behavior or personality
273
+ - Modify your channel connections
274
+ - Require new API keys or endpoints
275
+ - Break existing skills or tools
276
+
277
+ ---
278
+
279
+ ## Development
280
+
281
+ ```bash
282
+ # Clone
283
+ git clone https://github.com/ZkAGI/openpaw.git
284
+ cd openpaw
285
+
286
+ # Install dependencies
287
+ pnpm install
288
+
289
+ # Build all packages
290
+ pnpm build
291
+
292
+ # Run tests (real tests, no mocks)
293
+ pnpm test
294
+
295
+ # Run a specific package
296
+ pnpm test --filter=@openpaw/vault
297
+
298
+ # Start in development mode
299
+ pnpm dev
300
+ ```
301
+
302
+ ### Test Philosophy
303
+
304
+ Every test operates on real files, real crypto, and real directory structures. No mocks, no simulations. Test fixtures create actual OpenClaw workspace layouts with plaintext credential files, session JSONLs, and skill code. Encryption tests use real AES-256-GCM. Scanner tests parse real ASTs.
305
+
306
+ ---
307
+
308
+ ## Roadmap
309
+
310
+ | Version | What Ships |
311
+ |---|---|
312
+ | **v0.1.0** | Vault, Scanner, Migration, MCP Proxy, Gateway — full local security stack |
313
+ | **v0.2.0** | Lightpanda browser (replaces Chrome), encrypted memory system |
314
+ | **v0.3.0** | Circom + Groth16 ZK attestation, Solana audit trail |
315
+ | **v0.4.0** | Oasis ROFL TEE runtime, Sapphire vault |
316
+ | **v0.5.0** | x402 payments, FROST MPC signing, budget enforcement |
317
+ | **v1.0.0** | Production release — full six-layer security stack |
318
+
319
+ ---
320
+
321
+ ## Contributing
322
+
323
+ Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting a PR.
324
+
325
+ All code follows RED → GREEN → REFACTOR. Write the test first, make it pass, then clean up. PRs without tests won't be merged.
326
+
327
+ ---
328
+
329
+ ## License
330
+
331
+ MIT — see [LICENSE](LICENSE) for details.
332
+
333
+ ---
334
+
335
+ <p align="center">
336
+ Built by <a href="https://github.com/ZkAGI">ZkAGI</a><br/>
337
+ <sub>Privacy-first AI infrastructure on Solana</sub>
338
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sahu-01/openpaw",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "description": "OpenPaw CLI - Security-first wrapper for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",