opencrowd 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Srijith Poduval and OpenCrowd contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # OpenCrowd
2
+
3
+ **A CLI agent with its own wallet.** Give it a task and a budget; it finds paid
4
+ [x402](https://www.x402.org/) services on the open market, pays for them in
5
+ USDC on Base, and gets the job done — asking you before it spends on anything
6
+ new, and writing every cent to a local ledger.
7
+
8
+ [![CI](https://github.com/sr33j/opencrowd/actions/workflows/ci.yml/badge.svg)](https://github.com/sr33j/opencrowd/actions/workflows/ci.yml)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
+
11
+ ![OpenCrowd demo: the agent asks permission, pays an x402 service, and accounts for every cent](docs/demo.gif)
12
+
13
+ ## Try it in 60 seconds (no crypto required)
14
+
15
+ ```sh
16
+ npx opencrowd --demo
17
+ ```
18
+
19
+ Demo mode runs the full loop — service discovery, payment, artifacts, ledger —
20
+ against a mock wallet, mock x402 services, and a mock LLM. No real money moves.
21
+
22
+ ## Run it for real
23
+
24
+ ```sh
25
+ npx opencrowd
26
+ ```
27
+
28
+ First launch is two steps — there is no wallet setup:
29
+
30
+ 1. **Fund the wallet** — it already exists (created automatically, shared
31
+ with the AgentCash and CrowdCode tools so everything draws one balance).
32
+ Scan the QR or tap the MetaMask link to send a few dollars of USDC on
33
+ Base. The wallet is the agent's entire blast radius: it can never spend
34
+ more than you put in.
35
+ 2. **Give it a task** — type what you want. The agent discovers paid
36
+ x402/MPP services through its connectors, checks their CrowdCode
37
+ reputation, and pays per call.
38
+
39
+ ```text
40
+ ❯ find an x402 service that returns live weather and get today's forecast
41
+
42
+ → search_services query="live weather forecast"
43
+ ← search_services found 7 candidates; top: WeatherStation ($0.02 USDC)
44
+ $ paid $0.02 → api.weatherstation.xyz (HTTP 200) · saved forecast.json
45
+
46
+ Today: 72°F, clear. Full forecast saved to artifacts.
47
+ summary: spent $0.05, remaining $19.95, services 1, artifacts 1
48
+ ```
49
+
50
+ The LLM itself is paid the same way: OpenCrowd uses an x402-metered,
51
+ OpenAI-compatible route funded from the same wallet — no API keys, no
52
+ subscriptions.
53
+
54
+ ## Safety model
55
+
56
+ Real money demands real guardrails. The defaults:
57
+
58
+ - **`ask_first` permission mode** — the agent must show you the service URL,
59
+ reason, and cost caps before its first payment to any service. Approve with
60
+ one key. Shift+tab toggles to `yolo` (auto-approve) when you want speed.
61
+ - **Session budgets** — default `min($20, wallet balance)`, enforced locally
62
+ with reserve/finalize accounting around every paid call. Unused budget never
63
+ leaves the wallet.
64
+ - **Burner-wallet design** — the agent has its own low-value wallet, never
65
+ your main one. Worst case is bounded by what you deposited.
66
+ - **Full ledger** — every LLM call, service payment, and top-up lands in
67
+ `sessions/<id>/ledger.csv` with costs, tx hashes, and artifacts.
68
+ - **No telemetry** — everything stays on your machine.
69
+
70
+ Read [SECURITY.md](SECURITY.md) for the full threat model, including how we
71
+ treat marketplace content as prompt-injection input.
72
+
73
+ ## Use it from Claude, Codex, or any MCP client
74
+
75
+ OpenCrowd doubles as an MCP server, so your existing coding agent can search
76
+ the bazaar, make x402 payments, and manage budgets using OpenCrowd's wallet:
77
+
78
+ ```sh
79
+ claude mcp add opencrowd -- npx -y opencrowd mcp
80
+ ```
81
+
82
+ Or in any MCP client config:
83
+
84
+ ```json
85
+ {
86
+ "mcpServers": {
87
+ "opencrowd": { "command": "npx", "args": ["-y", "opencrowd", "mcp"] }
88
+ }
89
+ }
90
+ ```
91
+
92
+ There's also a localhost HTTP API: `opencrowd api --port 8787`.
93
+
94
+ Here's Claude Code discovering a live weather service on the Bazaar and paying
95
+ it 0.001 USDC on Base through OpenCrowd — real money, real on-chain settlement:
96
+
97
+ ![Claude Code paying a real x402 service through the OpenCrowd MCP server](docs/mcp-demo.gif)
98
+
99
+ ## Commands
100
+
101
+ Inside the interactive UI (`/help` shows this live):
102
+
103
+ | Command | What it does |
104
+ | --- | --- |
105
+ | `/budget <usd>` | Set the local session spend cap |
106
+ | `/mode ask_first\|yolo\|blocked` | Set permission mode (shift+tab toggles) |
107
+ | `/wallet list\|balance\|use\|fund\|export` | Manage the shared payment wallet |
108
+ | `/models list\|set <model>` | Pick the x402 LLM model |
109
+ | `/search "<query>"` | Search the x402 service bazaar |
110
+ | `/permissions list\|allow\|block <url>` | Manage allowed/blocked services |
111
+ | `/ledger show` | Show this session's spend ledger |
112
+ | `/summary` | Spend and artifacts so far |
113
+
114
+ One-shot and scripting forms:
115
+
116
+ ```sh
117
+ opencrowd run --budget 1.00 "Find a service and summarize options"
118
+ opencrowd run --session <session-id> "Follow up on the previous result"
119
+ opencrowd run --headless --prompt "..." --output json # programmatic run contract
120
+ opencrowd search --json "stock price"
121
+ opencrowd wallet balance
122
+ opencrowd wallet send 0x... 5.00 --network base # send USDC anywhere (confirmed interactively)
123
+ opencrowd evals gaia --tier smoke --harness opencrowd,claude,codex
124
+ ```
125
+
126
+ `wallet send` signs a plain ERC-20 USDC transfer with the shared wallet key
127
+ (the wallet needs a one-time ~$0.20 ETH deposit for gas; x402 payments stay
128
+ gasless). It requires an interactive confirmation and is never retried
129
+ automatically. `evals gaia` runs the GAIA validation split
130
+ against OpenCrowd — and optionally Claude Code and Codex with the same prompt
131
+ template and scorer — reporting accuracy and cost per question (OpenCrowd's
132
+ cost is measured on-chain spend; comparators are estimates).
133
+
134
+ ## Local state
135
+
136
+ | What | Where |
137
+ | --- | --- |
138
+ | Config | `~/.config/opencrowd/config.json` |
139
+ | Wallet metadata | `~/.config/opencrowd/wallets.json` (no secrets) |
140
+ | Seed phrases | OS credential store (Keychain on macOS) |
141
+ | Service permissions | `~/.config/opencrowd/permissions.json` |
142
+ | Sessions, ledger, artifacts | `./sessions/<session-id>/` |
143
+
144
+ Conversations persist per session and are automatically compacted when they
145
+ outgrow the model's context window (archives kept under `sessions/<id>/context/`).
146
+
147
+ ## Configuration notes
148
+
149
+ - **Model**: defaults to `openai/gpt-5.6-sol` on an x402-metered OpenRouter
150
+ route (`x402LlmBaseUrl` points at any OpenAI-compatible x402 endpoint).
151
+ `opencrowd models list` then `models set <model>` to change it.
152
+ - **Model policy / subagents**: `modelPolicy` in config (`{"mode": "auto"|"manual",
153
+ "main": "<model>|auto", "subagent": "<model>|auto"}`) pairs the main loop
154
+ with a subagent model, both paid over the same x402 route. Defaults:
155
+ `openai/gpt-5.6-sol` main, `openai/gpt-5.6-luna` subagents. The main loop
156
+ gets `spawn_subagent`/`check_subagents` tools (local tools only, one level
157
+ deep, parallel with background mode); resolution is recorded per session
158
+ for reproducibility. Auto mode refuses to run if the catalog has no
159
+ frontier-tier model.
160
+ - **Connectors**: paid capability comes from vendor MCP servers (AgentCash
161
+ for wallet/payments, CrowdCode for reputation), configured under
162
+ `mcpServers` in config with pinned versions. Their tools are ingested
163
+ verbatim (`agentcash_fetch`, `crowdcode_get_service_score`, ...) and their
164
+ own instructions become prompt context. When connectors are unreachable the
165
+ runtime falls back to the legacy Bazaar path.
166
+ - **Discovery (legacy fallback)**: Coinbase CDP Bazaar; custom bazaar URLs
167
+ supported in config.
168
+ - **Env overrides**: `OPENCROWD_BUDGET_CENTS`, `OPENCROWD_PERMISSION_MODE`,
169
+ `OPENCROWD_SHELL_ENABLED`, `OPENCROWD_CONFIG_DIR`, `OPENCROWD_TEST_MODE`.
170
+
171
+ ## Development
172
+
173
+ ```sh
174
+ npm install
175
+ npm run build
176
+ npm test
177
+ ```
178
+
179
+ Monorepo layout: `packages/core` (wallets, x402, sessions, budgets, ledger),
180
+ `packages/agent-runtime` (LLM loop + tools + subagents), `packages/evals`
181
+ (GAIA benchmark runner), `packages/mcp`, `packages/local-api`, `apps/cli`
182
+ (the `opencrowd` binary and TUI).
183
+
184
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Licensed [MIT](LICENSE).