cornerstone-autonomous-agent 1.3.0 → 2.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/README.md CHANGED
@@ -1,10 +1,12 @@
1
- # Autonomous Agentx402 MCP + LangChain.js
1
+ # CornerStone MCP x402 Skill Tools for Agents
2
2
 
3
- Autonomous AI agent for **x402-paid MCP tools**: predict tickers, backtest strategies, open bank accounts. Pays with **Aptos** or **EVM** via the x402 facilitator—no OpenAI key; uses **Hugging Face** for the LLM. Built for Cursor, OpenClaw/Moltbot, and headless runs.
3
+ **Published as [cornerstone-autonomous-agent](https://www.npmjs.com/package/cornerstone-autonomous-agent)** on npm; **source: [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)**.
4
+
5
+ A **skill** that gives agents a set of **x402-paid MCP tools**: predict tickers, backtest strategies, link bank accounts, and query agent/borrower scores. Agents using this skill pay with **Aptos** or **EVM** via the x402 facilitator. Designed for marketplaces where agents can autonomously download and use the skill; also usable from Cursor, OpenClaw/Moltbot, and headless runners.
4
6
 
5
7
  ## Why?
6
8
 
7
- Most agent demos need a full backend and separate API keys. This agent talks to an **x402 MCP server**, pays with its own Aptos and EVM wallets (verify → settle), and uses an OpenAI-compatible LLM (e.g. Hugging Face). You get **run_prediction**, **run_backtest**, **link_bank_account**, and score tools with minimal setup—whitelist your agent, fund wallets, run.
9
+ Agents need tools, not a full backend. This skill provides **run_prediction**, **run_backtest**, **link_bank_account**, and **score tools** (get_agent_reputation_score, get_borrower_score, by-email variants). Agents using it talk to an **x402 MCP server**, pay with their own Aptos and EVM wallets (verify → settle), and get results after minimal setup—whitelist the agent’s addresses, fund wallets, then the agent can call the tools. The server offers both Aptos and EVM payment options; the skill handles 402 → pay → retry so the agent just calls the tool.
8
10
 
9
11
  ## Install
10
12
 
@@ -14,7 +16,7 @@ Most agent demos need a full backend and separate API keys. This agent talks to
14
16
  npm install cornerstone-autonomous-agent
15
17
  ```
16
18
 
17
- Copy the package’s `.env.example` into your project and set `MCP_SERVER_URL`, `X402_FACILITATOR_URL`, `HUGGINGFACE_API_KEY`, `LLM_MODEL`, and wallet paths. See [Config](#config).
19
+ Copy the package’s `.env.example` into your project and set `X402_FACILITATOR_URL`, `HUGGINGFACE_API_KEY`, `LLM_MODEL`, and wallet paths. See [Config](#config).
18
20
 
19
21
  ### From source
20
22
 
@@ -23,108 +25,110 @@ git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-
23
25
  npm install
24
26
  ```
25
27
 
26
- **OpenClaw / MoltBook / Moltbot:** Load the skill from `skills/autonomous-agent/` or [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md). See [MoltBook / OpenClaw](#moltbook--openclaw) below. Then point `MCP_SERVER_URL` at your MCP server.
27
-
28
+ **OpenClaw / Moltbot:** See [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) or use your platform’s skill install (e.g. ClawHub).
28
29
  ## Quick Start
29
30
 
30
- From the repo root (or with the package installed):
31
+ **Important:** Another npm package is named [autonomous](https://www.npmjs.com/package/autonomous). To run **this** package without installing, always use the full name: **`npx cornerstone-autonomous-agent`**. After you `npm install cornerstone-autonomous-agent`, the short binary `autonomous` in that project runs this CLI.
31
32
 
32
33
  ```bash
33
- # Generate Aptos wallet (for prediction/backtest)
34
- npm run setup:aptos
35
-
36
- # Generate EVM wallet (for link_bank_account)
37
- npm run setup
38
-
39
- # Show addresses for whitelisting at the onboarding flow (e.g. https://borrower.replit.app/flow.html)
40
- npm run addresses
34
+ # Run without installing (use full package name so the other "autonomous" package isn’t used)
35
+ npx cornerstone-autonomous-agent setup:aptos
36
+ npx cornerstone-autonomous-agent setup
37
+ npx cornerstone-autonomous-agent addresses
38
+ npx cornerstone-autonomous-agent attest:aptos
39
+ npx cornerstone-autonomous-agent "Run a 30-day prediction for AAPL"
40
+
41
+ # Or install first, then you can use the short command in that project
42
+ npm install cornerstone-autonomous-agent
43
+ npx autonomous setup:aptos
44
+ npx autonomous attest:aptos
41
45
 
42
- # (Optional) Sign wallet attestations for onboarding (POST /attest/aptos, /attest/evm)
43
- npx cornerstone-agent-attest-aptos
44
- npx cornerstone-agent-attest-evm
45
- # or from repo: npm run attest:aptos && npm run attest:evm
46
+ # Or install globally for the short command everywhere
47
+ npm i -g cornerstone-autonomous-agent
48
+ autonomous setup:aptos
49
+ autonomous "Run a 30-day prediction for AAPL"
46
50
 
47
- # Run the agent (demo: balance + AAPL prediction)
48
- npx cornerstone-agent "Run a 30-day prediction for AAPL"
49
- # or from repo: npm run agent -- "Run a 30-day prediction for AAPL"
51
+ # From source:
52
+ node src/setup-aptos.js
53
+ node src/run-agent.js "Run a 30-day prediction for AAPL"
50
54
  ```
51
55
 
56
+ **CLI:** This package registers the **`autonomous`** binary (short name) and **`cornerstone-autonomous-agent`** (matches package name). Use **`npx cornerstone-autonomous-agent <command>`** when you haven’t installed the package; use **`npx autonomous <command>`** only inside a project that has `cornerstone-autonomous-agent` installed, or **`autonomous <command>`** after a global install.
57
+
52
58
  ## Config
53
59
 
54
60
  Copy `.env.example` to `.env` and set:
55
61
 
56
62
  | Variable | Description |
57
63
  |----------|-------------|
58
- | `MCP_SERVER_URL` | x402 MCP server base URL (e.g. https://borrower.replit.app or http://localhost:4023) |
59
- | `X402_FACILITATOR_URL` | Facilitator base URL for Aptos (verify/settle). Use public (e.g. https://x402-navy.vercel.app/facilitator) for link_bank_account. |
60
- | `X402_EVM_FACILITATOR_URL` | Optional. EVM facilitator; defaults to X402_FACILITATOR_URL. Set to public when using local Aptos facilitator. |
64
+ | `X402_FACILITATOR_URL` | Facilitator base URL (Aptos + EVM verify/settle). Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo. |
65
+ | `X402_EVM_FACILITATOR_URL` | Optional. EVM facilitator; defaults to X402_FACILITATOR_URL. |
66
+ | `PREFERRED_PAYMENT_ORDER` | Optional. Comma-separated `network|asset` (e.g. `aptos:2|usdc,eip155:84532|usdc`) to choose payment option when server returns multiple. |
61
67
  | `LLM_BASE_URL` | OpenAI-compatible base URL (default https://router.huggingface.co/v1) |
62
68
  | `HUGGINGFACE_API_KEY` or `HF_TOKEN` | Hugging Face API key |
63
69
  | `LLM_MODEL` | Model ID (e.g. meta-llama/Llama-3.2-3B-Instruct) |
64
70
  | `APTOS_WALLET_PATH` | Aptos wallet JSON path. Multi-wallet: ~/.aptos-agent-wallets.json. |
65
71
  | `EVM_WALLET_PATH` | EVM wallet path. Multi-wallet: ~/.evm-wallets.json. Or set EVM_PRIVATE_KEY. |
66
- | `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC for link_bank_account |
72
+ | `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC. Skill supports all EVM chains in lib/chains.js (Base, Ethereum, Polygon, etc.). |
67
73
 
68
74
  ## Commands
69
75
 
70
- Prefer **npx** when the package is installed; from repo root use **npm run** or **node src/...**.
76
+ Use **`npx cornerstone-autonomous-agent <command>`** (or, in a project that has this package installed, **`npx autonomous <command>`**). From source: `node src/<script>.js` or `npm run <script>`.
71
77
 
72
78
  | Command | Description |
73
79
  |---------|-------------|
74
- | `npm run setup` | Generate EVM wallet (single; for multi use agent tool `create_evm_wallet`) |
75
- | `npm run setup:aptos` | Generate Aptos wallet (single; for multi use `create_aptos_wallet`) |
76
- | `npm run addresses` | Print all Aptos and EVM addresses for whitelisting at flow.html |
77
- | `npm run credit:aptos` | Credit Aptos agent (devnet: programmatic; testnet: instructions) |
78
- | `npm run balance -- <chain>` | EVM balance (e.g. `baseSepolia`) |
79
- | **`npx cornerstone-agent [message]`** | Run agent (or `npm run agent -- [message]` from repo) |
80
- | `npm run attest:aptos` | Sign Aptos wallet attestation for onboarding POST /attest/aptos |
81
- | `npm run attest:evm` | Sign EVM wallet attestation for onboarding POST /attest/evm |
82
- | `npx cornerstone-agent-attest-aptos` | Same as attest:aptos (when package installed) |
83
- | `npx cornerstone-agent-attest-evm` | Same as attest:evm (when package installed) |
80
+ | `autonomous setup` | Generate EVM wallet (single; for multi use agent tool create_evm_wallet) |
81
+ | `autonomous setup:aptos` | Generate Aptos wallet (single; for multi use create_aptos_wallet) |
82
+ | `autonomous setup:evm:multichain` | Generate EVM multi-chain wallet |
83
+ | `autonomous addresses` | Print all Aptos and EVM addresses for whitelisting at https://arnstein.ch/flow.html |
84
+ | `autonomous attest:aptos` | Sign attestation for Aptos wallet (set `APTOS_PRIVATE_KEY` or `APTOS_TESTNET_*`); submit to POST /attest/aptos |
85
+ | `autonomous attest:evm` | Sign attestation for EVM wallet; submit to POST /attest/evm |
86
+ | `autonomous balance [chain]` | EVM balance |
87
+ | `autonomous transfer` | Transfer (see script for args) |
88
+ | `autonomous contract` | Contract interaction helper |
89
+ | `autonomous swap` | Swap helper |
90
+ | `autonomous` or `autonomous agent` or `autonomous start [message]` | Run skill demo (default: balance + prediction) |
91
+ | `npm run credit:aptos` | Credit Aptos wallet (devnet: programmatic; testnet: instructions) |
92
+ | `npx cornerstone-agent [message]` | Run skill demo (legacy bin name) |
84
93
 
85
94
  **Crediting Aptos:** Testnet has no programmatic faucet—use [Aptos testnet faucet](https://aptos.dev/network/faucet). Devnet: `APTOS_FAUCET_NETWORK=devnet npm run credit:aptos`. See [Canteen – Aptos x402](https://canteenapp-aptos-x402.notion.site/).
86
95
 
87
96
  ## MCP Tools
88
97
 
89
- All tools are exposed at the MCP server path `/mcp`. Paid tools follow the x402 flow: call without `payment_payload` → 402 + `paymentRequirements` → sign payment → call again with `payment_payload` → facilitator verify/settle → result + `paymentReceipt`. See [MCP_INTEGRATION_REFERENCE.md](MCP_INTEGRATION_REFERENCE.md).
90
-
91
- | Tool | Resource | Description | Cost (USD) |
92
- |------|----------|-------------|-----------|
93
- | `run_prediction` | `/mcp/prediction/{symbol}` | Stock prediction (symbol, horizon) | ~0.06 (Aptos/EVM) |
94
- | `run_backtest` | `/mcp/backtest/{symbol}` | Backtest trading strategy (symbol, start/end, strategy) | ~0.06 |
95
- | `link_bank_account` | `/mcp/banking/link` | CornerStone/Plaid bank link token | ~0.05 (configurable) |
96
- | `get_agent_reputation_score` | `/mcp/scores/reputation` | Agent reputation (100 when allowlisted); x402 or lender credits | ~0.06 |
97
- | `get_borrower_score` | `/mcp/scores/borrower` | Borrower score (100 or 100+Plaid when bank linked); x402 or lender credits | ~0.06 |
98
- | `get_agent_reputation_score_by_email` | `/mcp/scores/reputation-by-email` | Reputation by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
99
- | `get_borrower_score_by_email` | `/mcp/scores/borrower-by-email` | Borrower score by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
98
+ | Tool | Description | Payment |
99
+ |------|-------------|---------|
100
+ | `run_prediction` | Stock prediction (symbol, horizon) | x402: Aptos or EVM |
101
+ | `run_backtest` | Backtest trading strategy | x402: Aptos or EVM |
102
+ | `link_bank_account` | CornerStone bank link (Plaid) | x402: Aptos or EVM |
103
+ | `get_agent_reputation_score` | Reputation Score: measures the agent's ability to transact using x402 | x402 or lender credits |
104
+ | `get_borrower_score` | Borrower score: measures real borrower behavior | x402 or lender credits |
105
+ | `get_agent_reputation_score_by_email` | Reputation score by email (resolves to agent) | x402 or lender credits |
106
+ | `get_borrower_score_by_email` | Borrower score by email | x402 or lender credits |
100
107
 
101
- ## Wallet attestation (signing)
108
+ **Score definitions:** Reputation Score measures an agent’s ability to transact using x402. Borrower score measures real borrower behavior.
102
109
 
103
- To prove ownership of agent wallets during onboarding, use the **attestation** scripts. They sign an off-chain message; submit the JSON output to the onboarding server (`POST /attest/aptos`, `POST /attest/evm`).
104
-
105
- - **Aptos:** `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — outputs `address`, `message`, `signature` (hex), `public_key_hex`.
106
- - **EVM:** `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — outputs `address`, `message`, `signature`.
107
-
108
- Options: `--address 0x...` to attest a specific address, `--message "Custom message"` for a custom payload.
110
+ All paid tools accept **both Aptos and EVM**; the server returns 402 with multiple options. Use `PREFERRED_PAYMENT_ORDER` to prefer one chain/asset.
109
111
 
110
112
  ## Supported Networks
111
113
 
112
- | Network | Use | Cost |
113
- |---------|-----|------|
114
- | Aptos testnet | run_prediction, run_backtest | ~6¢ USDC |
115
- | Base Sepolia | link_bank_account (testnet) | ~$3.65 |
116
- | Base (mainnet) | link_bank_account (production) | ~$3.65 |
114
+ | Network | Use |
115
+ |---------|-----|
116
+ | Aptos testnet (aptos:2) / mainnet (aptos:1) | run_prediction, run_backtest, score tools |
117
+ | Base Sepolia (eip155:84532), Base (eip155:8453), Ethereum, Polygon, Arbitrum, Optimism | link_bank_account, score tools (when server offers them) |
117
118
 
118
119
  ## x402 Flow
119
120
 
120
121
  ```
121
- Agent calls MCP tool (no payment_payload)
122
- → Server returns 402 + paymentRequirements (network, amount, asset, payTo, ...)
123
- Agent signs payment, calls facilitator /verify then /settle
124
- Agent retries tool call with payment_payload
125
- Server returns result + paymentReceipt
122
+ Agent (using this skill) calls MCP tool
123
+ → Server returns 402 + payment requirements (single or array of options: USDC, APT, native ETH)
124
+ Skill picks one option (by preferredPaymentOrder or first), builds payload (Aptos or EVM)
125
+ Skill calls facilitator /verify then /settle
126
+ Skill retries request with payment_payload
127
+ → Server returns result + payment_receipt
126
128
  ```
127
129
 
130
+ **Multi-asset:** The server may return multiple `paymentRequirements` (e.g. USDC on Aptos, USDC on EVM, APT on Aptos, native ETH on EVM). The client uses `preferredPaymentOrder` (e.g. `["aptos:2|usdc", "eip155:84532|native"]`) to choose, or the first option. Native ETH: client submits the ETH transfer, then sends the `txHash` in the payload; facilitator verifies on-chain.
131
+
128
132
  ## Architecture
129
133
 
130
134
  ```
@@ -136,84 +140,55 @@ autonomous/
136
140
  │ │ ├── aptos/ # Aptos wallet, balance, signPayment
137
141
  │ │ ├── evm/ # EVM wallet, signPayment (Base)
138
142
  │ │ └── x402/ # Payment types, verify/settle flow
139
- │ ├── run-agent.js # Entrypoint (npx cornerstone-agent)
143
+ │ ├── cli.js # CLI router (autonomous / cornerstone-autonomous-agent)
144
+ │ ├── run-agent.js # Skill demo entrypoint (agent + tools)
140
145
  │ ├── setup.js # EVM wallet generation
141
146
  │ ├── setup-aptos.js # Aptos wallet generation
142
- │ ├── show-agent-addresses.js
143
- ├── attest-aptos-wallet.js # Sign attestation for POST /attest/aptos
144
- │ └── attest-evm-wallet.js # Sign attestation for POST /attest/evm
145
- ├── skills/ # MoltBook/OpenClaw (AgentSkills layout)
146
- │ └── autonomous-agent/
147
- │ └── SKILL.md
147
+ │ ├── attest-aptos-wallet.js / attest-evm-wallet.js
148
+ └── show-agent-addresses.js
148
149
  ├── adapters/ # OpenClaw, OpenAI, Anthropic, local
149
150
  ├── .env.example
150
151
  └── package.json
151
152
  ```
152
153
 
153
- **Core pieces:** `lib/mcp` — MCP client and 402 retry; `lib/aptos` / `lib/evm` — wallets and payment signing; `lib/x402` — verify/settle; `agent/` — LangChain.js ReAct agent and tools.
154
+ **Core pieces:** `lib/mcp` — MCP client and 402 retry; `lib/aptos` / `lib/evm` — wallets and payment signing; `lib/x402` — verify/settle; `agent/` — LangChain.js ReAct runner and tools (for agents using the skill).
154
155
 
155
156
  ## Tech Stack
156
157
 
157
158
  - **Runtime:** Node.js 18+
158
- - **Agent:** LangChain.js (ReAct), OpenAI-compatible LLM (e.g. Hugging Face)
159
+ - **Runner:** LangChain.js (ReAct), OpenAI-compatible LLM (e.g. Hugging Face) for the demo; agents use the tools via their own runtime
159
160
  - **MCP:** [Model Context Protocol](https://modelcontextprotocol.io) + x402 payment flow
160
161
  - **Chains:** Aptos (viem-style + @aptos-labs/ts-sdk), EVM (viem) for Base Sepolia/Base
161
162
  - **Payments:** x402 facilitator (verify/settle), local wallet storage
162
163
 
163
164
  ## Security
164
165
 
165
- - **Wallets:** Stored locally (e.g. `~/.aptos-agent-wallets.json`, `~/.evm-wallets.json`); private keys not logged or sent except as signed payloads to the facilitator.
166
+ - **Wallets:** Stored locally (e.g. `~/.aptos-agent-wallets.json`, `~/.evm-wallets.json`) for the agent using the skill; private keys not logged or sent except as signed payloads to the facilitator.
166
167
  - **Payments:** Only verify/settle go to the facilitator; no custody of funds by the MCP server.
167
- - **Whitelist:** Agent addresses must be allowlisted at the onboarding flow before paid tools succeed.
168
+ - **Whitelist:** Addresses used by the agent must be allowlisted at the onboarding flow before paid tools succeed.
168
169
 
169
170
  ## Capability + adapters
170
171
 
171
- - **Capability:** Core (`src/`) — MCP client, x402 flow, local tools. No OpenAI/Claw/Anthropic logic in code.
172
- - **Adapters:** How each platform uses the capability:
173
- - **MoltBook / OpenClaw / Moltbot:** `skills/autonomous-agent/SKILL.md` (AgentSkills-compatible; [see below](#moltbook--openclaw)) or [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md)
174
- - **OpenAI:** [adapters/openai/openapi.yaml](adapters/openai/openapi.yaml) — Custom GPTs / Assistants
175
- - **Claude / Anthropic:** [adapters/anthropic/tools.json](adapters/anthropic/tools.json) — Claude tools
176
- - **Local / OSS:** [adapters/local/README.md](adapters/local/README.md) — LM Studio, AutoGen, CrewAI
177
-
178
- ## MoltBook / OpenClaw
179
-
180
- This repo is optimized for **easy skill loading** in MoltBook and OpenClaw (Claude, Anthropic, OpenAI, and other providers work via the same agent; the skill tells the assistant how to run it).
181
-
182
- - **Skill layout:** The skill lives in `skills/autonomous-agent/SKILL.md` (AgentSkills-compatible, single-line frontmatter, `metadata.openclaw` gating). OpenClaw/MoltBook loads skills from `skills/` subfolders.
183
- - **Load options:**
184
- 1. **extraDirs:** Add this repo path to `~/.openclaw/openclaw.json` under `skills.load.extraDirs`. OpenClaw will scan `skills/` and load `autonomous-agent`.
185
- 2. **Workspace:** Clone the repo and use it as your OpenClaw workspace; workspace skills are loaded from `<workspace>/skills`.
186
- 3. **Managed skills:** Copy `skills/autonomous-agent` to `~/.openclaw/skills/` for all agents on the machine.
187
- 4. **ClawHub:** When published, install with `clawhub install autonomous-agent` (installs into `./skills` by default).
188
- - **Config:** In `skills.entries["autonomous-agent"]` you can set `enabled`, `env`, or `apiKey` (maps to `primaryEnv`). Ensure `MCP_SERVER_URL`, x402 facilitator URLs, and LLM/env are set for the agent run.
189
- - **Run:** From the **repository root** (parent of `skills/`), run `npx cornerstone-agent "your message"` or `npm run agent -- "your message"`.
190
-
191
- Example `~/.openclaw/openclaw.json` to load this repo’s skills:
192
-
193
- ```json
194
- {
195
- "skills": {
196
- "load": {
197
- "extraDirs": ["/path/to/autonomous-agent"]
198
- },
199
- "entries": {
200
- "autonomous-agent": {
201
- "enabled": true,
202
- "env": { "MCP_SERVER_URL": "https://borrower.replit.app" }
203
- }
204
- }
205
- }
206
- }
207
- ```
172
+ - **Capability:** Core (`src/`) — MCP client, x402 flow, tools for agents. No OpenAI/Claw/Anthropic logic in code.
173
+ - **Adapters:** `adapters/` — how each platform or marketplace loads the skill:
174
+ - [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) — OpenClaw / Moltbot
175
+ - [adapters/openai/openapi.yaml](adapters/openai/openapi.yaml) — Custom GPTs / Assistants
176
+ - [adapters/anthropic/tools.json](adapters/anthropic/tools.json) — Claude tools
177
+ - [adapters/local/README.md](adapters/local/README.md) — LM Studio, AutoGen, CrewAI
178
+
179
+ ## Deployment order
208
180
 
181
+ 1. **x402 facilitator** — Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo; or run local and set X402_EVM_FACILITATOR_URL to public for link_bank_account.
182
+ 2. **MCP server** — x402-enabled.
183
+ 3. **Skill runner (demo)** — `node src/run-agent.js` or PM2 (`pm2 start ecosystem.config.cjs --only agent-autonomous` from repo root).
209
184
 
210
185
  ## References
211
186
 
212
- - **Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)
213
- - **MCP integration:** [MCP_INTEGRATION_REFERENCE.md](MCP_INTEGRATION_REFERENCE.md) — endpoints, tools, resources, x402 flow, facilitator
214
187
  - [Canteen App – Aptos x402](https://canteenapp-aptos-x402.notion.site/) — wallet hydration and crediting
215
188
  - [LangChain.js MCP](https://js.langchain.com/docs/integrations/toolkits/mcp_toolbox)
216
189
  - [Hugging Face Inference – OpenAI-compatible](https://huggingface.co/docs/api-inference/en/index)
190
+ - [evm-wallet-skill](https://github.com/surfer77/evm-wallet-skill) — self-sovereign EVM wallet pattern for agents
191
+
217
192
  ## License
218
193
 
219
- GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
194
+ GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](../LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
@@ -1,10 +1,10 @@
1
1
  # Local / OSS agents
2
2
 
3
- Use the CreditNexus x402 capability from local or OSS agents (e.g. LM Studio, AutoGen, CrewAI).
3
+ Use the CornerStone MCP x402 capability from local or OSS agents (e.g. LM Studio, AutoGen, CrewAI).
4
4
 
5
5
  1. **Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent).
6
6
  2. **Install:** `npm install` in `autonomous/`.
7
- 3. **Config:** Set `MCP_SERVER_URL` to your MCP server (e.g. `https://borrower.replit.app` or `http://localhost:4023`). Set x402 facilitator URL and LLM/env as needed.
7
+ 3. **Config:** Set x402 facilitator URL and LLM/env as needed.
8
8
  4. **Run:** `node src/run-agent.js "your message"` or wire MCP client to your agent framework.
9
9
  5. **x402:** On 402 responses, call facilitator verify → settle, then retry the request with `PAYMENT-SIGNATURE` header.
10
10
 
@@ -1,11 +1,11 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
- title: CreditNexus x402 MCP Tools
3
+ title: CornerStone MCP x402 Tools
4
4
  description: Payment-protected tools (run_prediction, run_backtest, open_bank_account, scores). Use x402 flow (402 → pay → retry with PAYMENT-SIGNATURE).
5
5
  version: 1.0.0
6
6
  servers:
7
- - url: http://localhost:4023
8
- description: MCP server (override with MCP_SERVER_URL)
7
+ - url: https://arnstein.ch/mcp
8
+ description: MCP server
9
9
  paths:
10
10
  /mcp/prediction/{symbol}:
11
11
  get:
@@ -1,62 +1,73 @@
1
1
  ---
2
2
  name: autonomous-agent
3
- description: CreditNexus x402 agent. Use when the user wants stock predictions, backtests, bank linking, or agent/borrower scores. Payment-protected MCP tools (run_prediction, run_backtest, link_bank_account, get_agent_reputation_score, get_borrower_score, and by-email variants) with x402 flow (Aptos + Base). Agent handles 402 → pay → retry autonomously. Supports wallet attestation (signing) for onboarding.
3
+ description: CornerStone MCP x402 skill for agents. Tools for stock predictions, backtests, bank linking, and agent/borrower scores. Payment-protected MCP tools with x402 flow (Aptos + Base). Skill handles 402 → pay → retry. Wallet attestation for onboarding. For marketplaces where agents download and use skills autonomously.
4
4
  metadata: {"openclaw":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]},"primaryEnv":"MCP_SERVER_URL","skillKey":"autonomous-agent"},"clawdbot":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]}}}
5
5
  ---
6
6
 
7
- # CreditNexus x402 Agent Skill
7
+ # CornerStone MCP x402 Skill (for Agents)
8
8
 
9
- Autonomous agent that calls x402-protected MCP tools: stock prediction, backtest, bank linking, and agent/borrower scores. Handles payment flow (402 → payretry with `payment_payload`) with Aptos (prediction/backtest) and Base (banking). Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
9
+ Skill that gives **agents** tools to call x402-protected MCP endpoints: stock prediction, backtest, bank linking, and agent/borrower scores. **Payment is automatic** — the skill handles 402 → signverify settle retry transparently. Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
10
10
 
11
11
  ## Installation
12
12
 
13
13
  Clone or copy the repo. When loaded from OpenClaw/MoltBook, the skill folder is `{baseDir}`; run commands from the **repo root** (parent of `adapters/openclaw` or of `skills/autonomous-agent`).
14
14
 
15
15
  ```bash
16
- # From repository root
17
16
  git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-agent
18
17
  npm install
19
18
  ```
20
19
 
21
- Set `MCP_SERVER_URL` to your MCP server (e.g. `https://borrower.replit.app`). Copy `.env.example` to `.env` and set:
20
+ Copy `.env.example` to `.env` and set:
22
21
 
23
- - `MCP_SERVER_URL` – MCP server base URL (MCP protocol at `/mcp`)
24
22
  - `X402_FACILITATOR_URL` – x402 facilitator (verify/settle)
25
23
  - `LLM_BASE_URL`, `HUGGINGFACE_API_KEY` or `HF_TOKEN`, `LLM_MODEL` – for inference
26
24
  - `APTOS_WALLET_PATH`, `EVM_WALLET_PATH` (or `EVM_PRIVATE_KEY`) – for payments
27
25
 
28
- ## Run the agent
26
+ ## Quick-start workflow
29
27
 
30
- From the **repository root** (where `package.json` and `src/` live):
28
+ 1. `get_wallet_addresses()` check what wallets exist.
29
+ 2. If empty: `create_aptos_wallet()` + `create_evm_wallet()`.
30
+ 3. Fund: `credit_aptos_wallet()` + `fund_evm_wallet()`.
31
+ 4. Whitelist addresses at https://arnstein.ch/flow.html.
32
+ 5. Check balances: `balance_aptos()`, `balance_evm({ chain: "baseSepolia" })`.
33
+ 6. Call paid tools: `run_prediction`, `run_backtest`, `link_bank_account`, or score tools.
34
+
35
+ ## Run the skill (demo)
31
36
 
32
37
  ```bash
33
38
  npx cornerstone-agent "Run a 30-day prediction for AAPL"
34
- # Or interactive
35
39
  npx cornerstone-agent
36
- # Or from repo: npm run agent -- "..." or node src/run-agent.js "..."
40
+ npm run agent -- "..."
41
+ node src/run-agent.js "..."
37
42
  ```
38
43
 
39
- **x402 flow:** Agent calls tool without `payment_payload` → server returns 402 + `paymentRequirements` → agent signs, facilitator verify/settle → agent retries with `payment_payload` → receives result + `paymentReceipt`.
40
-
41
44
  ## Wallet attestation (signing)
42
45
 
43
- To prove wallet ownership during onboarding, run from repo root:
44
-
45
46
  - Aptos: `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — output to POST /attest/aptos
46
47
  - EVM: `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — output to POST /attest/evm
47
48
 
48
- ## MCP Tools
49
-
50
- All tools are on the MCP server at `/mcp`. See repo [MCP_INTEGRATION_REFERENCE.md](https://github.com/FinTechTonic/autonomous-agent/blob/main/MCP_INTEGRATION_REFERENCE.md) for resources and pricing.
51
-
52
- | Tool | Resource | Description | Cost |
53
- |------|----------|-------------|------|
54
- | `run_prediction` | `/mcp/prediction/{symbol}` | Stock prediction (symbol, horizon) | ~6¢ |
55
- | `run_backtest` | `/mcp/backtest/{symbol}` | Backtest (symbol, start/end, strategy) | ~6¢ |
56
- | `link_bank_account` | `/mcp/banking/link` | CornerStone/Plaid bank link token | ~5¢ (config) |
57
- | `get_agent_reputation_score` | `/mcp/scores/reputation` | Agent reputation (100 allowlisted); x402 or lender credits | ~6¢ |
58
- | `get_borrower_score` | `/mcp/scores/borrower` | Borrower score (100 or 100+Plaid); x402 or lender credits | ~6¢ |
59
- | `get_agent_reputation_score_by_email` | `/mcp/scores/reputation-by-email` | Reputation by email; requires SCORE_BY_EMAIL_ENABLED | base + extra |
60
- | `get_borrower_score_by_email` | `/mcp/scores/borrower-by-email` | Borrower score by email; requires SCORE_BY_EMAIL_ENABLED | base + extra |
61
-
62
- Whitelist your agent at the onboarding flow (e.g. `MCP_SERVER_URL/flow.html`) so the server allows your wallet.
49
+ ## Tool reference
50
+
51
+ ### Wallet tools (local)
52
+ | Tool | Args | Returns |
53
+ |------|------|---------|
54
+ | `get_wallet_addresses` | none | `{ aptos: [{ address, network }], evm: [...] }` |
55
+ | `create_aptos_wallet` | `{ force?, network? }` | `{ success, address, network }` |
56
+ | `create_evm_wallet` | `{ force?, network? }` | `{ success, address, network }` |
57
+ | `credit_aptos_wallet` | `{ amount_octas? }` | devnet: funds directly; testnet: `{ faucet_url, address }` |
58
+ | `fund_evm_wallet` | none | `{ faucet_url, address, message }` |
59
+ | `balance_aptos` | none | `{ address, balances: { usdc, apt } }` |
60
+ | `balance_evm` | `{ chain? }` | `{ address, chain, balance, symbol }` |
61
+
62
+ ### Paid MCP tools (x402 — payment automatic)
63
+ | Tool | Args | Returns | Cost |
64
+ |------|------|---------|------|
65
+ | `run_prediction` | `{ symbol, horizon? }` | Forecast data | ~6¢ |
66
+ | `run_backtest` | `{ symbol, startDate?, endDate?, strategy? }` | Performance metrics | ~6¢ |
67
+ | `link_bank_account` | none | `{ link_token }` | ~5¢ |
68
+ | `get_agent_reputation_score` | `{ agent_address?, payer_wallet? }` | `{ reputation_score }` | ~6¢ or credits |
69
+ | `get_borrower_score` | `{ agent_address?, payer_wallet? }` | `{ score }` | ~6¢ or credits |
70
+ | `get_agent_reputation_score_by_email` | `{ email, payer_wallet? }` | `{ reputation_score }` | higher |
71
+ | `get_borrower_score_by_email` | `{ email, payer_wallet? }` | `{ score }` | higher |
72
+
73
+ Whitelist the addresses the agent uses at https://arnstein.ch/flow.html so the server allows those wallets.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "cornerstone-autonomous-agent",
3
- "version": "1.3.0",
4
- "description": "CornerStone Agentic Score: autonomous agent that uses an x402-enabled MCP server to predict tickers, backtest trading strategies, and open bank accounts. Handles 402 Payment Required (pay via Aptos/Ethereum facilitator and retry). LangChain.js ReAct agent with Hugging Face inference (OpenAI-compatible endpoint).",
3
+ "version": "2.1.0",
4
+ "description": "CornerStone MCP x402 skill for agents: tools to predict tickers, backtest strategies, link bank accounts, and query agent/borrower scores. Agents pay via Aptos/EVM (x402). Handles 402 → pay → retry. Publishable in marketplaces for autonomous download and use. Includes LangChain.js demo runner (Hugging Face / OpenAI-compatible).",
5
5
  "type": "module",
6
6
  "main": "src/run-agent.js",
7
7
  "bin": {
8
- "cornerstone-agent": "src/run-agent.js",
9
- "cornerstone-agent-attest-aptos": "src/attest-aptos-wallet.js",
10
- "cornerstone-agent-attest-evm": "src/attest-evm-wallet.js"
8
+ "autonomous": "src/cli.js",
9
+ "cornerstone-autonomous-agent": "src/cli.js",
10
+ "cornerstone-agent": "src/run-agent.js"
11
11
  },
12
12
  "files": [
13
13
  "src",
@@ -51,7 +51,7 @@
51
51
  "@aptos-labs/ts-sdk": "^1.0.0"
52
52
  },
53
53
  "keywords": [
54
- "creditnexus",
54
+ "cornerstone-mcp",
55
55
  "demo",
56
56
  "autonomous-agent",
57
57
  "x402",
@@ -67,7 +67,7 @@
67
67
  "evm",
68
68
  "crypto"
69
69
  ],
70
- "author": "CreditNexus",
70
+ "author": "CornerStone MCP",
71
71
  "license": "GPL-2.0-only",
72
72
  "repository": {
73
73
  "type": "git",
package/skills/README.md CHANGED
@@ -4,6 +4,6 @@ This folder follows the **AgentSkills** layout expected by MoltBook and OpenClaw
4
4
 
5
5
  | Skill | Description |
6
6
  |-------|-------------|
7
- | [autonomous-agent](autonomous-agent/SKILL.md) | x402 MCP agent: stock prediction, backtest, link_bank_account, agent/borrower scores (Aptos + Base). Wallet attestation (signing) for onboarding. |
7
+ | [autonomous-agent](autonomous-agent/SKILL.md) | x402 MCP skill for agents: stock prediction, backtest, link_bank_account, agent/borrower scores (Aptos + Base). Wallet attestation for onboarding. |
8
8
 
9
9
  **Loading:** Add this repo path to `skills.load.extraDirs` in `~/.openclaw/openclaw.json` (MoltBook/OpenClaw will load `autonomous-agent` from `skills/autonomous-agent/`), or copy `autonomous-agent` into `~/.openclaw/skills/`, or use the repo as your OpenClaw workspace. See the main [README](../README.md#moltbook--openclaw).
@@ -1,62 +1,73 @@
1
1
  ---
2
2
  name: autonomous-agent
3
- description: CreditNexus x402 agent. Use when the user wants stock predictions, backtests, bank linking, or agent/borrower scores. Payment-protected MCP tools (run_prediction, run_backtest, link_bank_account, get_agent_reputation_score, get_borrower_score, and by-email variants) with x402 flow (Aptos + Base). Agent handles 402 → pay → retry autonomously. Supports wallet attestation (signing) for onboarding.
3
+ description: CornerStone MCP x402 skill for agents. Tools for stock predictions, backtests, bank linking, and agent/borrower scores. Payment-protected MCP tools with x402 flow (Aptos + Base). Skill handles 402 → pay → retry. Wallet attestation for onboarding. For marketplaces where agents download and use skills autonomously.
4
4
  metadata: {"openclaw":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]},"primaryEnv":"MCP_SERVER_URL","skillKey":"autonomous-agent"},"clawdbot":{"emoji":"📈","homepage":"https://github.com/FinTechTonic/autonomous-agent","requires":{"bins":["node","npm"]}}}
5
5
  ---
6
6
 
7
- # CreditNexus x402 Agent Skill
7
+ # CornerStone MCP x402 Skill (for Agents)
8
8
 
9
- Autonomous agent that calls x402-protected MCP tools: stock prediction, backtest, bank linking, and agent/borrower scores. Handles payment flow (402 → payretry with `payment_payload`) with Aptos (prediction/backtest) and Base (banking). Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
9
+ Skill that gives **agents** tools to call x402-protected MCP endpoints: stock prediction, backtest, bank linking, and agent/borrower scores. **Payment is automatic** — the skill handles 402 → signverify settle retry transparently. Supports **wallet attestation** (signing) for onboarding (POST /attest/aptos, /attest/evm).
10
10
 
11
11
  ## Installation
12
12
 
13
13
  When this skill is loaded from the **autonomous-agent** repo, the repo root is the parent of the skill folder `{baseDir}`. Clone and install from the repo root:
14
14
 
15
15
  ```bash
16
- # From repository root (parent of {baseDir} when using this repo)
17
16
  git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-agent
18
17
  npm install
19
18
  ```
20
19
 
21
- Set `MCP_SERVER_URL` to your MCP server (e.g. `https://borrower.replit.app`). Copy `.env.example` to `.env` and set:
20
+ Copy `.env.example` to `.env` and set:
22
21
 
23
- - `MCP_SERVER_URL` – MCP server base URL (MCP protocol at `/mcp`)
24
- - `X402_FACILITATOR_URL` – x402 facilitator (verify/settle)
22
+ - set `X402_FACILITATOR_URL` too
25
23
  - `LLM_BASE_URL`, `HUGGINGFACE_API_KEY` or `HF_TOKEN`, `LLM_MODEL` – for inference
26
24
  - `APTOS_WALLET_PATH`, `EVM_WALLET_PATH` (or `EVM_PRIVATE_KEY`) – for payments
27
25
 
28
- ## Run the agent
26
+ ## Quick-start workflow
29
27
 
30
- From the **repository root** (where `package.json` and `src/` live):
28
+ 1. `get_wallet_addresses()` check what wallets exist.
29
+ 2. If empty: `create_aptos_wallet()` + `create_evm_wallet()`.
30
+ 3. Fund: `credit_aptos_wallet()` + `fund_evm_wallet()`.
31
+ 4. Whitelist addresses at https://arnstein.ch/sse/flow.html.
32
+ 5. Check balances: `balance_aptos()`, `balance_evm({ chain: "baseSepolia" })`.
33
+ 6. Call paid tools: `run_prediction`, `run_backtest`, `link_bank_account`, or score tools.
34
+
35
+ ## Run the skill (demo)
31
36
 
32
37
  ```bash
33
38
  npx cornerstone-agent "Run a 30-day prediction for AAPL"
34
- # Or interactive
35
39
  npx cornerstone-agent
36
- # Or from repo: npm run agent -- "..." or node src/run-agent.js "..."
40
+ npm run agent -- "..."
41
+ node src/run-agent.js "..."
37
42
  ```
38
43
 
39
- **x402 flow:** Agent calls tool without `payment_payload` → server returns 402 + `paymentRequirements` → agent signs, facilitator verify/settle → agent retries with `payment_payload` → receives result + `paymentReceipt`.
40
-
41
44
  ## Wallet attestation (signing)
42
45
 
43
- To prove wallet ownership during onboarding, run from repo root:
44
-
45
46
  - Aptos: `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — output to POST /attest/aptos
46
47
  - EVM: `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — output to POST /attest/evm
47
48
 
48
- ## MCP Tools
49
-
50
- All tools are on the MCP server at `/mcp`. See repo [MCP_INTEGRATION_REFERENCE.md](https://github.com/FinTechTonic/autonomous-agent/blob/main/MCP_INTEGRATION_REFERENCE.md) for resources and pricing.
51
-
52
- | Tool | Resource | Description | Cost |
53
- |------|----------|-------------|------|
54
- | `run_prediction` | `/mcp/prediction/{symbol}` | Stock prediction (symbol, horizon) | ~6¢ |
55
- | `run_backtest` | `/mcp/backtest/{symbol}` | Backtest (symbol, start/end, strategy) | ~6¢ |
56
- | `link_bank_account` | `/mcp/banking/link` | CornerStone/Plaid bank link token | ~5¢ (config) |
57
- | `get_agent_reputation_score` | `/mcp/scores/reputation` | Agent reputation (100 allowlisted); x402 or lender credits | ~6¢ |
58
- | `get_borrower_score` | `/mcp/scores/borrower` | Borrower score (100 or 100+Plaid); x402 or lender credits | ~6¢ |
59
- | `get_agent_reputation_score_by_email` | `/mcp/scores/reputation-by-email` | Reputation by email; requires SCORE_BY_EMAIL_ENABLED | base + extra |
60
- | `get_borrower_score_by_email` | `/mcp/scores/borrower-by-email` | Borrower score by email; requires SCORE_BY_EMAIL_ENABLED | base + extra |
61
-
62
- Whitelist your agent at the onboarding flow (e.g. `MCP_SERVER_URL/flow.html`) so the server allows your wallet.
49
+ ## Tool reference
50
+
51
+ ### Wallet tools (local)
52
+ | Tool | Args | Returns |
53
+ |------|------|---------|
54
+ | `get_wallet_addresses` | none | `{ aptos: [{ address, network }], evm: [...] }` |
55
+ | `create_aptos_wallet` | `{ force?, network? }` | `{ success, address, network }` |
56
+ | `create_evm_wallet` | `{ force?, network? }` | `{ success, address, network }` |
57
+ | `credit_aptos_wallet` | `{ amount_octas? }` | devnet: funds directly; testnet: `{ faucet_url, address }` |
58
+ | `fund_evm_wallet` | none | `{ faucet_url, address, message }` |
59
+ | `balance_aptos` | none | `{ address, balances: { usdc, apt } }` |
60
+ | `balance_evm` | `{ chain? }` | `{ address, chain, balance, symbol }` |
61
+
62
+ ### Paid MCP tools (x402 — payment automatic)
63
+ | Tool | Args | Returns | Cost |
64
+ |------|------|---------|------|
65
+ | `run_prediction` | `{ symbol, horizon? }` | Forecast data | ~6¢ |
66
+ | `run_backtest` | `{ symbol, startDate?, endDate?, strategy? }` | Performance metrics | ~6¢ |
67
+ | `link_bank_account` | none | `{ link_token }` | ~5¢ |
68
+ | `get_agent_reputation_score` | `{ agent_address?, payer_wallet? }` | `{ reputation_score }` | ~6¢ or credits |
69
+ | `get_borrower_score` | `{ agent_address?, payer_wallet? }` | `{ score }` | ~6¢ or credits |
70
+ | `get_agent_reputation_score_by_email` | `{ email, payer_wallet? }` | `{ reputation_score }` | higher |
71
+ | `get_borrower_score_by_email` | `{ email, payer_wallet? }` | `{ score }` | higher |
72
+
73
+ Whitelist the addresses the agent uses at https://arnstein.ch/sse/flow.html so the server allows those wallets.