safehands-pharos 1.2.6 → 1.3.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/.agents/skill/safehands/SKILL.md +212 -0
- package/.agents/skill/safehands/assets/networks.json +24 -0
- package/.agents/skill/safehands/assets/tokens.json +66 -0
- package/.agents/wallets.json +20 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/policy/actionPolicyEngine.js +2 -2
- package/dist/lib/policy/actionPolicyEngine.js.map +1 -1
- package/dist/tools/approveToken.d.ts.map +1 -1
- package/dist/tools/approveToken.js +4 -4
- package/dist/tools/approveToken.js.map +1 -1
- package/dist/tools/executeSwap.d.ts.map +1 -1
- package/dist/tools/executeSwap.js +4 -4
- package/dist/tools/executeSwap.js.map +1 -1
- package/dist/tools/publishRiskScore.d.ts.map +1 -1
- package/dist/tools/publishRiskScore.js +4 -4
- package/dist/tools/publishRiskScore.js.map +1 -1
- package/dist/tools/sendPayment.d.ts.map +1 -1
- package/dist/tools/sendPayment.js +4 -4
- package/dist/tools/sendPayment.js.map +1 -1
- package/docs/reports/OFFICIAL_DOCS_ALIGNMENT_REPORT.md +137 -0
- package/docs/reports/final_audit_report.md +307 -0
- package/docs/reports/live_verification_report.md +147 -0
- package/docs/reports/pharos_skill_engine_alignment_report.md +85 -0
- package/package.json +3 -1
- package/skill/SKILL.md +133 -133
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# SafeHands-Pharos — Official Pharos Skill Engine Alignment Report
|
|
2
|
+
|
|
3
|
+
> **Date:** 2026-06-12
|
|
4
|
+
> **Version:** 1.2.0
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. Files Changed
|
|
9
|
+
| File | Change |
|
|
10
|
+
|------|--------|
|
|
11
|
+
| `src/lib/constants.ts` | Upgraded `0xE0BE08c7...` to primary `USDC_ADDRESS`, relabeled `0xcfC8330f...` as `CIRCLE_USDC_ADDRESS`. |
|
|
12
|
+
| `src/tools/tokenRegistryStatus.ts` | Rewrote classification to output `SKILL_ENGINE_CANONICAL_TOKEN` or `ALTERNATE_SOURCE_TOKEN` based on new registry metadata. |
|
|
13
|
+
| `skill/SKILL.md` | **NEW** — Created official SKILL.md file adhering to Pharos Skill Engine formatting standards with YAML frontmatter. |
|
|
14
|
+
| `skill/references/safehands.md` | **NEW** — Copied over the CLI reference guide into the required skill package structure. |
|
|
15
|
+
| `skill/assets/safehands/*` | **NEW** — Policy defaults and example actions migrated. Example actions now strictly use `0xE0BE08c7...`. |
|
|
16
|
+
| `src/lib/testTools.ts` | Added 6 new smoke tests covering the `skill/` package structure and exact token metadata values. |
|
|
17
|
+
| `src/lib/testLiveSafehands.ts` | Updated live CLI checks to verify new USDC classification. |
|
|
18
|
+
| `src/index.ts` | Fixed the `--demo` exit path bug to ensure test pipelines exit cleanly without starting the MCP server inadvertently. |
|
|
19
|
+
| `package.json` | Appended the `skill` directory and new alignment reports to the npm `files` array for proper packaging. |
|
|
20
|
+
| `README.md` | Added the "Official Pharos Skill Engine Alignment" section and updated token addresses in the context table. |
|
|
21
|
+
| `OFFICIAL_DOCS_ALIGNMENT_REPORT.md` | Updated docs alignment tables and summaries to reflect the Skill Engine metadata. |
|
|
22
|
+
|
|
23
|
+
## 2. Official Pharos Skill Engine Zip Findings
|
|
24
|
+
Inspection of `pharos-skill-engine-0.1.0.zip` revealed:
|
|
25
|
+
- **Structure:** `SKILL.md`, `references/`, and `assets/`.
|
|
26
|
+
- **Token Metadata:** The file `assets/tokens.json` officially defines the Atlantic Testnet USDC address as **`0xE0BE08c77f415F577A1B3A9aD7a1Df1479564ec8`**.
|
|
27
|
+
- **Role:** The official skill handles execution (`cast`/`forge`), confirming SafeHands' positioning as a complementary preflight guardrail rather than an execution wrapper.
|
|
28
|
+
|
|
29
|
+
## 3. Token Metadata Changes
|
|
30
|
+
- **Primary USDC (`0xE0BE08c7...`)**: The official Pharos Skill Engine token (previously treated as a docs demo token) has been promoted to the canonical testnet USDC default.
|
|
31
|
+
- **Status:** `SKILL_ENGINE_CANONICAL_TOKEN`
|
|
32
|
+
- **Verification:** `DOCS_VERIFIED_FROM_PHAROS_SKILL_ENGINE`
|
|
33
|
+
- **Alternate USDC (`0xcfC8330f...`)**: The USDC address sourced from Circle's official documentation is preserved but deprioritized to avoid conflicts.
|
|
34
|
+
- **Status:** `ALTERNATE_SOURCE_TOKEN`
|
|
35
|
+
- **Verification:** `CIRCLE_REFERENCED_USDC`
|
|
36
|
+
|
|
37
|
+
Both tokens are handled gracefully by `token_registry_status`, ensuring the agent receives factual provenance.
|
|
38
|
+
|
|
39
|
+
## 4. Skill Package Structure Created
|
|
40
|
+
The `skill/` directory was generated successfully, mirroring the PiggyBank template layout:
|
|
41
|
+
```text
|
|
42
|
+
skill/
|
|
43
|
+
├── SKILL.md (with YAML frontmatter, Capability Index, Pre-checks)
|
|
44
|
+
├── references/
|
|
45
|
+
│ └── safehands.md
|
|
46
|
+
└── assets/
|
|
47
|
+
└── safehands/
|
|
48
|
+
├── policy-defaults.json
|
|
49
|
+
└── example-actions.json
|
|
50
|
+
```
|
|
51
|
+
The package allows an AI agent to dynamically invoke `safehands_preflight_check` using official Pharos patterns.
|
|
52
|
+
|
|
53
|
+
## 5. Tests Added/Updated
|
|
54
|
+
- **`skill_package_skill_md_exists`**: Confirms presence of `SKILL.md`.
|
|
55
|
+
- **`skill_package_yaml_frontmatter`**: Ensures exact match for `name: safehands-pharos-guard` in frontmatter.
|
|
56
|
+
- **`skill_package_references_exist`**: Verifies presence of the `references/safehands.md` guide.
|
|
57
|
+
- **`skill_package_assets_exist`**: Verifies presence of the JSON assets.
|
|
58
|
+
- **`skill_package_example_uses_skill_engine_usdc`**: Blocks regressions to the `0xcfC8...` address within example configs.
|
|
59
|
+
- **`token_registry_circle_usdc_alternate`**: Ensures `0xcfC8...` retains its explicit alternate status.
|
|
60
|
+
- **`demo_runs_or_fails_gracefully`**: Fixed to properly handle the exit code when the demo runs successfully.
|
|
61
|
+
|
|
62
|
+
## 6. Commands Run and Results
|
|
63
|
+
| Command | Result |
|
|
64
|
+
|---------|--------|
|
|
65
|
+
| `npm ci` | 0 ✅ |
|
|
66
|
+
| `npm run build` | 0 ✅ |
|
|
67
|
+
| `npx tsc -p tsconfig.all.json --pretty false` | 0 ✅ |
|
|
68
|
+
| `npm run test:all` | 0 ✅ (43/43 smoke tests passed) |
|
|
69
|
+
| `npm audit --omit=dev --audit-level=high` | 0 ✅ (0 vulnerabilities) |
|
|
70
|
+
| `npm run demo` | 0 ✅ (Clean exit, output identical to previous demo) |
|
|
71
|
+
|
|
72
|
+
## 7. npm pack Safety Result
|
|
73
|
+
```bash
|
|
74
|
+
npm pack --dry-run
|
|
75
|
+
```
|
|
76
|
+
- Includes the new `skill/` directory and `OFFICIAL_DOCS_ALIGNMENT_REPORT.md`.
|
|
77
|
+
- **Secret scan**: Passed (0 exposed variables found).
|
|
78
|
+
- **Total files:** 215 files (135.9 kB).
|
|
79
|
+
|
|
80
|
+
## 8. Remaining Risks/TODOs
|
|
81
|
+
- **DODO / FaroSwap Router Addresses:** Currently `PROJECT_CONFIGURED`. This remains unverified due to the FaroSwap documentation returning an HTTP 307 redirect. This cannot be fixed without live docs.
|
|
82
|
+
- **RiskRegistry Contract:** A project-deployed contract (`PROJECT_CONFIGURED`) used to simulate risk scores. Expected hackathon behavior.
|
|
83
|
+
|
|
84
|
+
## 9. Final Status
|
|
85
|
+
**Status: Ready for DoraHacks Phase 1 submission with official Pharos Skill Engine alignment**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "safehands-pharos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Pharos Skill Engine-compatible transaction safety firewall for AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"skill",
|
|
19
19
|
"README.md",
|
|
20
20
|
".env.example",
|
|
21
|
+
"docs",
|
|
22
|
+
".agents",
|
|
21
23
|
"LICENSE"
|
|
22
24
|
],
|
|
23
25
|
"scripts": {
|
package/skill/SKILL.md
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: safehands-pharos-guard
|
|
3
|
-
description: >
|
|
4
|
-
REQUIRED before any Pharos AI agent write action involving token approvals, payments, swaps,
|
|
5
|
-
x402 paid requests, or custom contract calls. SafeHands runs policy-based preflight checks
|
|
6
|
-
and returns ALLOW, WARN, BLOCK, REQUIRE_CONFIRMATION, REQUIRE_FUNDING, or REQUIRE_TOKEN_REVIEW
|
|
7
|
-
before execution. Use this skill as a safety firewall before invoking Pharos Skill Engine
|
|
8
|
-
write operations.
|
|
9
|
-
version: 1.
|
|
10
|
-
requires:
|
|
11
|
-
anyBins:
|
|
12
|
-
- npx
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# SafeHands Pharos Guard
|
|
16
|
-
|
|
17
|
-
Transaction Safety Firewall / Guardrail Skill for Pharos AI agents. SafeHands checks whether an action is safe before execution on Pharos Atlantic Testnet.
|
|
18
|
-
|
|
19
|
-
SafeHands complements the official `pharos-skill-engine`. It is not a replacement. The official Skill Engine provides general on-chain capabilities (queries, transactions, contract deployments). SafeHands answers: **"Is this action safe to execute?"**
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
User intent
|
|
23
|
-
→ SafeHands preflight (ALLOW / WARN / BLOCK / REQUIRE_CONFIRMATION)
|
|
24
|
-
→ Pharos Skill Engine or MCP execution (only if safe)
|
|
25
|
-
→ SafeHands risk report
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Real-World Use Cases
|
|
29
|
-
|
|
30
|
-
1. **Anti-Drain Protection:** An AI Agent is tricked by a prompt injection to approve `999999 USDC` to a hacker's contract. SafeHands intercepts the action, detects an unlimited approval, and returns `BLOCK`.
|
|
31
|
-
2. **SSRF Payment Prevention:** A malicious website asks the AI Agent to pay `0.001 USDC` to an x402 URL pointing to `http://localhost:8080/admin`. SafeHands detects the private IP address, blocks the HTTP request, and returns `BLOCK` preventing server compromise.
|
|
32
|
-
3. **Fake Token Detection:** An AI Agent decides to buy a token named "Official Pharos Coin" on the testnet. SafeHands checks the `token_registry_status`, realizes it's a fake token not listed in the official docs, and returns `WARN` to ask the human for confirmation before swapping.
|
|
33
|
-
|
|
34
|
-
## Prerequisites
|
|
35
|
-
|
|
36
|
-
1. **Install SafeHands** (via npx, no global install required):
|
|
37
|
-
```bash
|
|
38
|
-
npx safehands-pharos --help
|
|
39
|
-
```
|
|
40
|
-
If `npx safehands-pharos` is not available, install globally:
|
|
41
|
-
```bash
|
|
42
|
-
npm install -g safehands-pharos
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. **No private key required** for safety checks. Private keys are only needed for write execution (which is disabled by default).
|
|
46
|
-
|
|
47
|
-
## Network Configuration
|
|
48
|
-
|
|
49
|
-
SafeHands reads network configuration from its built-in constants. Default network: **Atlantic Testnet**.
|
|
50
|
-
|
|
51
|
-
| Field | Value |
|
|
52
|
-
|-------|-------|
|
|
53
|
-
| Environment | `atlantic-testnet` |
|
|
54
|
-
| Chain ID | `688689` |
|
|
55
|
-
| RPC URL | `https://atlantic.dplabs-internal.com` |
|
|
56
|
-
| Native Token | `PHRS` |
|
|
57
|
-
| Primary USDC | `0xE0BE08c77f415F577A1B3A9aD7a1Df1479564ec8` |
|
|
58
|
-
| Mainnet | `false` |
|
|
59
|
-
|
|
60
|
-
Token addresses are sourced from the official Pharos Skill Engine `assets/tokens.json`.
|
|
61
|
-
|
|
62
|
-
## Safety Model
|
|
63
|
-
|
|
64
|
-
SafeHands enforces these guardrails by default:
|
|
65
|
-
|
|
66
|
-
- **Block** mainnet actions
|
|
67
|
-
- **Block** chain ID mismatch
|
|
68
|
-
- **Block** unlimited token approvals
|
|
69
|
-
- **Block** SSRF-sensitive x402 URLs (localhost, private IPs)
|
|
70
|
-
- **Block** payments above configured limits
|
|
71
|
-
- **Block** x402 payments above `MAX_X402_PAYMENT_USDC`
|
|
72
|
-
- **Warn** when token is custom or non-registry
|
|
73
|
-
- **Warn** when token security provider is unavailable
|
|
74
|
-
- **Require confirmation** for medium-risk actions
|
|
75
|
-
- **Allow** low-risk Pharos Atlantic Testnet actions
|
|
76
|
-
|
|
77
|
-
Write tools are disabled by default (`WRITE_TOOLS_ENABLED=false`).
|
|
78
|
-
|
|
79
|
-
## Capability Index
|
|
80
|
-
|
|
81
|
-
Load the corresponding reference file based on user needs to get full command templates.
|
|
82
|
-
|
|
83
|
-
| User Need | Capability | Detailed Instructions |
|
|
84
|
-
|-----------|------------|----------------------|
|
|
85
|
-
| Check whether an on-chain action is safe before execution | SafeHands Preflight Check | → `references/safehands.md#safehands-preflight-check` |
|
|
86
|
-
| Check whether an x402 paid endpoint is safe to pay | SafeHands x402 Preflight | → `references/safehands.md#safehands-x402-preflight` |
|
|
87
|
-
| Check whether an agent wallet is ready to act | SafeHands Wallet Health | → `references/safehands.md#safehands-wallet-health` |
|
|
88
|
-
| Check whether a token address is canonical or custom | Token Registry Status | → `references/safehands.md#token-registry-status` |
|
|
89
|
-
| Explain why an action was blocked or warned | Explain Risk | → `references/safehands.md#explain-risk` |
|
|
90
|
-
| Generate a human-readable safety report | SafeHands Risk Report | → `references/safehands.md#safehands-risk-report` |
|
|
91
|
-
|
|
92
|
-
## General Error Handling
|
|
93
|
-
|
|
94
|
-
Before executing commands, the Agent should perform pre-checks; when commands fail, provide user-friendly error messages based on the structured JSON output.
|
|
95
|
-
|
|
96
|
-
| Error Scenario | Error Code | Handling |
|
|
97
|
-
|---------------|-----------|----------|
|
|
98
|
-
| Invalid address format | `INVALID_TOKEN_ADDRESS` / `INVALID_WALLET_ADDRESS` | Prompt to check address format (0x + 40 hex characters) |
|
|
99
|
-
| Write tools disabled | `WRITE_TOOLS_DISABLED` | Inform user that write tools are disabled by default |
|
|
100
|
-
| SSRF blocked URL | `SSRF_BLOCKED` | Do not fetch or pay; inform user the URL is blocked |
|
|
101
|
-
| Mainnet action attempted | `MAINNET_NOT_SUPPORTED` | Do not execute; SafeHands is testnet-only |
|
|
102
|
-
| Chain ID mismatch | `CHAIN_ID_MISMATCH` | Switch to Pharos Atlantic Testnet (688689) |
|
|
103
|
-
| Signer not available | `NO_SIGNER_AVAILABLE` | Ask user to configure wallet mode |
|
|
104
|
-
| Invalid input JSON | `INVALID_INPUT_JSON` | Fix the JSON input and retry |
|
|
105
|
-
| Policy blocked | `POLICY_BLOCKED` | Explain reasons to the user; do not execute |
|
|
106
|
-
|
|
107
|
-
See `references/safehands.md` for detailed error handling tables for each operation.
|
|
108
|
-
|
|
109
|
-
## Security Reminders
|
|
110
|
-
|
|
111
|
-
- **No private key required** for read-only safety checks (preflight, token registry, wallet health, explain risk).
|
|
112
|
-
- **Write tools are disabled by default.** Set `WRITE_TOOLS_ENABLED=true` only for trusted testnet execution.
|
|
113
|
-
- **Private keys are never returned** in CLI or MCP responses.
|
|
114
|
-
- **Unlimited approvals are blocked** unless explicitly allowed via `ALLOW_UNLIMITED_APPROVAL=true`.
|
|
115
|
-
- **SSRF protection** blocks localhost and private IP x402 URLs by default.
|
|
116
|
-
- **Testnet only.** SafeHands is not audited for mainnet production use.
|
|
117
|
-
|
|
118
|
-
## Write Operation Pre-checks (Required for All Write Operations)
|
|
119
|
-
|
|
120
|
-
For all write operations, the Agent must run SafeHands preflight first:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npx safehands-pharos skill safehands_preflight_check --input-json '<action_json>'
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
1. If `decision` is `BLOCK`, **stop execution**.
|
|
127
|
-
2. If `decision` is `WARN`, explain the risk and ask for user confirmation.
|
|
128
|
-
3. If `decision` is `REQUIRE_CONFIRMATION`, ask for explicit user approval.
|
|
129
|
-
4. If `decision` is `REQUIRE_FUNDING`, ask user to fund the wallet.
|
|
130
|
-
5. If `decision` is `REQUIRE_TOKEN_REVIEW`, ask user to verify the token contract.
|
|
131
|
-
6. If `decision` is `ALLOW`, proceed with the Pharos Skill Engine write operation.
|
|
132
|
-
|
|
133
|
-
For full command templates, parameters, output parsing, and error handling, see [`references/safehands.md`](references/safehands.md).
|
|
1
|
+
---
|
|
2
|
+
name: safehands-pharos-guard
|
|
3
|
+
description: >
|
|
4
|
+
REQUIRED before any Pharos AI agent write action involving token approvals, payments, swaps,
|
|
5
|
+
x402 paid requests, or custom contract calls. SafeHands runs policy-based preflight checks
|
|
6
|
+
and returns ALLOW, WARN, BLOCK, REQUIRE_CONFIRMATION, REQUIRE_FUNDING, or REQUIRE_TOKEN_REVIEW
|
|
7
|
+
before execution. Use this skill as a safety firewall before invoking Pharos Skill Engine
|
|
8
|
+
write operations.
|
|
9
|
+
version: 1.3.0
|
|
10
|
+
requires:
|
|
11
|
+
anyBins:
|
|
12
|
+
- npx
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# SafeHands Pharos Guard
|
|
16
|
+
|
|
17
|
+
Transaction Safety Firewall / Guardrail Skill for Pharos AI agents. SafeHands checks whether an action is safe before execution on Pharos Atlantic Testnet.
|
|
18
|
+
|
|
19
|
+
SafeHands complements the official `pharos-skill-engine`. It is not a replacement. The official Skill Engine provides general on-chain capabilities (queries, transactions, contract deployments). SafeHands answers: **"Is this action safe to execute?"**
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
User intent
|
|
23
|
+
→ SafeHands preflight (ALLOW / WARN / BLOCK / REQUIRE_CONFIRMATION)
|
|
24
|
+
→ Pharos Skill Engine or MCP execution (only if safe)
|
|
25
|
+
→ SafeHands risk report
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Real-World Use Cases
|
|
29
|
+
|
|
30
|
+
1. **Anti-Drain Protection:** An AI Agent is tricked by a prompt injection to approve `999999 USDC` to a hacker's contract. SafeHands intercepts the action, detects an unlimited approval, and returns `BLOCK`.
|
|
31
|
+
2. **SSRF Payment Prevention:** A malicious website asks the AI Agent to pay `0.001 USDC` to an x402 URL pointing to `http://localhost:8080/admin`. SafeHands detects the private IP address, blocks the HTTP request, and returns `BLOCK` preventing server compromise.
|
|
32
|
+
3. **Fake Token Detection:** An AI Agent decides to buy a token named "Official Pharos Coin" on the testnet. SafeHands checks the `token_registry_status`, realizes it's a fake token not listed in the official docs, and returns `WARN` to ask the human for confirmation before swapping.
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
1. **Install SafeHands** (via npx, no global install required):
|
|
37
|
+
```bash
|
|
38
|
+
npx safehands-pharos --help
|
|
39
|
+
```
|
|
40
|
+
If `npx safehands-pharos` is not available, install globally:
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g safehands-pharos
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. **No private key required** for safety checks. Private keys are only needed for write execution (which is disabled by default).
|
|
46
|
+
|
|
47
|
+
## Network Configuration
|
|
48
|
+
|
|
49
|
+
SafeHands reads network configuration from its built-in constants. Default network: **Atlantic Testnet**.
|
|
50
|
+
|
|
51
|
+
| Field | Value |
|
|
52
|
+
|-------|-------|
|
|
53
|
+
| Environment | `atlantic-testnet` |
|
|
54
|
+
| Chain ID | `688689` |
|
|
55
|
+
| RPC URL | `https://atlantic.dplabs-internal.com` |
|
|
56
|
+
| Native Token | `PHRS` |
|
|
57
|
+
| Primary USDC | `0xE0BE08c77f415F577A1B3A9aD7a1Df1479564ec8` |
|
|
58
|
+
| Mainnet | `false` |
|
|
59
|
+
|
|
60
|
+
Token addresses are sourced from the official Pharos Skill Engine `assets/tokens.json`.
|
|
61
|
+
|
|
62
|
+
## Safety Model
|
|
63
|
+
|
|
64
|
+
SafeHands enforces these guardrails by default:
|
|
65
|
+
|
|
66
|
+
- **Block** mainnet actions
|
|
67
|
+
- **Block** chain ID mismatch
|
|
68
|
+
- **Block** unlimited token approvals
|
|
69
|
+
- **Block** SSRF-sensitive x402 URLs (localhost, private IPs)
|
|
70
|
+
- **Block** payments above configured limits
|
|
71
|
+
- **Block** x402 payments above `MAX_X402_PAYMENT_USDC`
|
|
72
|
+
- **Warn** when token is custom or non-registry
|
|
73
|
+
- **Warn** when token security provider is unavailable
|
|
74
|
+
- **Require confirmation** for medium-risk actions
|
|
75
|
+
- **Allow** low-risk Pharos Atlantic Testnet actions
|
|
76
|
+
|
|
77
|
+
Write tools are disabled by default (`WRITE_TOOLS_ENABLED=false`).
|
|
78
|
+
|
|
79
|
+
## Capability Index
|
|
80
|
+
|
|
81
|
+
Load the corresponding reference file based on user needs to get full command templates.
|
|
82
|
+
|
|
83
|
+
| User Need | Capability | Detailed Instructions |
|
|
84
|
+
|-----------|------------|----------------------|
|
|
85
|
+
| Check whether an on-chain action is safe before execution | SafeHands Preflight Check | → `references/safehands.md#safehands-preflight-check` |
|
|
86
|
+
| Check whether an x402 paid endpoint is safe to pay | SafeHands x402 Preflight | → `references/safehands.md#safehands-x402-preflight` |
|
|
87
|
+
| Check whether an agent wallet is ready to act | SafeHands Wallet Health | → `references/safehands.md#safehands-wallet-health` |
|
|
88
|
+
| Check whether a token address is canonical or custom | Token Registry Status | → `references/safehands.md#token-registry-status` |
|
|
89
|
+
| Explain why an action was blocked or warned | Explain Risk | → `references/safehands.md#explain-risk` |
|
|
90
|
+
| Generate a human-readable safety report | SafeHands Risk Report | → `references/safehands.md#safehands-risk-report` |
|
|
91
|
+
|
|
92
|
+
## General Error Handling
|
|
93
|
+
|
|
94
|
+
Before executing commands, the Agent should perform pre-checks; when commands fail, provide user-friendly error messages based on the structured JSON output.
|
|
95
|
+
|
|
96
|
+
| Error Scenario | Error Code | Handling |
|
|
97
|
+
|---------------|-----------|----------|
|
|
98
|
+
| Invalid address format | `INVALID_TOKEN_ADDRESS` / `INVALID_WALLET_ADDRESS` | Prompt to check address format (0x + 40 hex characters) |
|
|
99
|
+
| Write tools disabled | `WRITE_TOOLS_DISABLED` | Inform user that write tools are disabled by default |
|
|
100
|
+
| SSRF blocked URL | `SSRF_BLOCKED` | Do not fetch or pay; inform user the URL is blocked |
|
|
101
|
+
| Mainnet action attempted | `MAINNET_NOT_SUPPORTED` | Do not execute; SafeHands is testnet-only |
|
|
102
|
+
| Chain ID mismatch | `CHAIN_ID_MISMATCH` | Switch to Pharos Atlantic Testnet (688689) |
|
|
103
|
+
| Signer not available | `NO_SIGNER_AVAILABLE` | Ask user to configure wallet mode |
|
|
104
|
+
| Invalid input JSON | `INVALID_INPUT_JSON` | Fix the JSON input and retry |
|
|
105
|
+
| Policy blocked | `POLICY_BLOCKED` | Explain reasons to the user; do not execute |
|
|
106
|
+
|
|
107
|
+
See `references/safehands.md` for detailed error handling tables for each operation.
|
|
108
|
+
|
|
109
|
+
## Security Reminders
|
|
110
|
+
|
|
111
|
+
- **No private key required** for read-only safety checks (preflight, token registry, wallet health, explain risk).
|
|
112
|
+
- **Write tools are disabled by default.** Set `WRITE_TOOLS_ENABLED=true` only for trusted testnet execution.
|
|
113
|
+
- **Private keys are never returned** in CLI or MCP responses.
|
|
114
|
+
- **Unlimited approvals are blocked** unless explicitly allowed via `ALLOW_UNLIMITED_APPROVAL=true`.
|
|
115
|
+
- **SSRF protection** blocks localhost and private IP x402 URLs by default.
|
|
116
|
+
- **Testnet only.** SafeHands is not audited for mainnet production use.
|
|
117
|
+
|
|
118
|
+
## Write Operation Pre-checks (Required for All Write Operations)
|
|
119
|
+
|
|
120
|
+
For all write operations, the Agent must run SafeHands preflight first:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx safehands-pharos skill safehands_preflight_check --input-json '<action_json>'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
1. If `decision` is `BLOCK`, **stop execution**.
|
|
127
|
+
2. If `decision` is `WARN`, explain the risk and ask for user confirmation.
|
|
128
|
+
3. If `decision` is `REQUIRE_CONFIRMATION`, ask for explicit user approval.
|
|
129
|
+
4. If `decision` is `REQUIRE_FUNDING`, ask user to fund the wallet.
|
|
130
|
+
5. If `decision` is `REQUIRE_TOKEN_REVIEW`, ask user to verify the token contract.
|
|
131
|
+
6. If `decision` is `ALLOW`, proceed with the Pharos Skill Engine write operation.
|
|
132
|
+
|
|
133
|
+
For full command templates, parameters, output parsing, and error handling, see [`references/safehands.md`](references/safehands.md).
|