@agether/agether 2.6.1 β†’ 2.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/agether",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "OpenClaw plugin for Agether β€” onchain credit for AI agents on Ethereum & Base",
5
5
  "main": "src/index.ts",
6
6
  "openclaw": {
@@ -1,21 +1,6 @@
1
1
  ---
2
2
  name: agether
3
- description: On-chain credit protocol for AI a## πŸ”— CHAIN RESOLUTION (CRITICAL β€” HARD REQUIREMENT)
4
-
5
- All on-chain tools (register, borrow, deposit, withdraw, pay, etc.) will **FAIL with an error** if chain is not configured. You MUST call `agether_set_chain` FIRST.
6
-
7
- If `agether_health` returns `chain: "?"`, the chain is NOT configured:
8
-
9
- ```
10
- 1. Ask user: "Which blockchain would you like to use? **Ethereum** or **Base**?"
11
- 2. User chooses a chain
12
- 3. Call `agether_set_chain(chain: "<ethereum or base>")`
13
- 4. After set β†’ call `agether_health` to confirm everything is working on that chain
14
- ```
15
-
16
- `agether_set_chain` saves the chain to config permanently (survives restarts). Accepts: `ethereum`, `eth`, `1`, `base`, `8453`.
17
-
18
- **IMPORTANT:** Resolve chain BEFORE doing ANYTHING else β€” including `agether_register`. The agent identity is chain-specific. If you skip this step, all write tools will return an error. Morpho credit & lending, x402 payments, ERC-8004 identity.
3
+ description: On-chain credit protocol for AI agents. Morpho credit & lending, x402 payments, ERC-8004 identity.
19
4
  ---
20
5
 
21
6
  # Agether β€” On-Chain Credit for AI Agents
@@ -41,11 +26,11 @@ If you don't paste it, the user sees NOTHING. An empty colon ":" with no data af
41
26
  1. **PASTE tool results into your reply.** Every tool returns JSON. Extract the key fields and write them in your message. The user cannot see tool output directly.
42
27
  2. **ALWAYS paste tx links.** Tools return `tx` field like `https://basescan.org/tx/0x...`. Copy it verbatim into your reply.
43
28
  3. **After on-chain actions, call `agether_balance` and paste the balances.**
44
- 4. **On first message, call `agether_health`.** This is your single best "context loader" β€” it returns balances, positions, LTV, alerts, and headroom in one call. If `agentId` is `"?"`, see AGENT ID RESOLUTION below.
29
+ 4. **On first message, call `agether_health`.** This is your single best "context loader" β€” it returns balances, positions, LTV, alerts, and headroom in one call. If `chain` is `"?"`, follow the MANDATORY BOOT SEQUENCE above β€” set chain FIRST, then agent ID.
45
30
  5. **Be proactive** β€” if the user asks to call a paid API, do the full flow without asking.
46
31
  6. **Never ask for private keys** β€” they come from OpenClaw secrets (AGETHER_PRIVATE_KEY env var).
47
32
  7. **Max LTV is 80%** (125% collateral ratio). To borrow $X, you need $X Γ— 1.25 in collateral value.
48
- 8. **When user says "register" β†’ ALWAYS call `agether_register`.** A wallet CAN have multiple ERC-8004 identities. The tool handles everything. Never refuse to register because the wallet "already has an identity". Just call the tool.
33
+ 8. **When user says "register" β†’ ALWAYS call `agether_register`.** But ONLY after chain is set (see MANDATORY BOOT SEQUENCE). A wallet CAN have multiple ERC-8004 identities. The tool handles everything. Never refuse to register because the wallet "already has an identity". Just call the tool.
49
34
  9. **Never guess about blockchain state.** If you're unsure, call the tool. Don't tell the user something is impossible β€” try it first.
50
35
  10. **Your EOA wallet IS the user's wallet.** Same private key, same address. If the user says "I have WETH", call `agether_balance` β€” you'll see it in the `collateral` field. You already have access to those tokens.
51
36
  11. **`morpho_deposit` and `morpho_deposit_and_borrow` transfer collateral from your EOA automatically.** You do NOT need anyone to "send you" tokens. If your EOA has WETH, just call the deposit tool directly. The SDK handles EOAβ†’Safe accountβ†’Morpho in one flow.
@@ -58,39 +43,63 @@ If you don't paste it, the user sees NOTHING. An empty colon ":" with no data af
58
43
 
59
44
  ---
60
45
 
61
- ## πŸ†” AGENT ID RESOLUTION (CRITICAL)
46
+ ## 🚫🚫🚫 MANDATORY BOOT SEQUENCE β€” READ THIS FIRST 🚫🚫🚫
47
+
48
+ There is a **strict ordering requirement**. Violating this order WILL cause wrong-chain registration and lost funds.
49
+
50
+ ### STEP 1 β†’ CHAIN (must be first, ALWAYS, no exceptions)
51
+
52
+ **You MUST set the chain BEFORE you do ANYTHING else β€” before `agether_set_agent`, before `agether_register`, before ANY on-chain tool call.**
62
53
 
63
- If `agether_health` or `agether_balance` returns `agentId: "?"`, ALL Morpho tools will fail. You MUST resolve this first:
54
+ An `agentId` is **chain-specific**. Agent 28368 on Base is a completely different account than agent 28368 on Ethereum. If you set an agentId without knowing the chain, you WILL point at the wrong contract on the wrong network.
55
+
56
+ **NEVER call `agether_set_agent` before the chain is confirmed. NEVER.**
64
57
 
65
58
  ```
66
- 1. Check your memory for a previously registered agentId
67
- 2. IF you find an agentId in memory:
68
- β†’ Ask user: "I remember agent ID <X> from before. Should I use it, or register a new one?"
69
- β†’ IF user says yes β†’ call `agether_set_agent(agentId: "<X>")`
70
- β†’ IF user says no β†’ call `agether_register(name: "<ask name>")`
71
- 3. IF no agentId in memory:
72
- β†’ call `agether_register(name: "<ask name>")`
73
- 4. After either path β†’ call `agether_health` to confirm everything is working
59
+ IF agether_health returns chain: "?"
60
+ β†’ Ask user: "Which chain β€” Ethereum or Base?"
61
+ β†’ Call agether_set_chain(chain: "<ethereum or base>")
62
+ β†’ Call agether_health again to confirm chain is set (not "?")
74
63
  ```
75
64
 
76
- Both `agether_set_agent` and `agether_register` save the agentId to config permanently (survives restarts).
65
+ `agether_set_chain` accepts: `ethereum`, `eth`, `1`, `base`, `8453`.
77
66
 
78
- ---
67
+ ### STEP 2 β†’ AGENT ID (ONLY after chain is confirmed, not "?")
79
68
 
80
- ## οΏ½ CHAIN RESOLUTION (CRITICAL)
69
+ **NEVER call `agether_set_agent` or `agether_register` until the chain is confirmed (chain β‰  "?").**
81
70
 
82
- If `agether_health` returns `chain: "?"`, the chain is NOT configured. You MUST resolve this before proceeding with any on-chain action:
71
+ Even if you have an agentId cached in memory or config β€” that agentId belongs to a **specific chain**. Do NOT blindly reuse it. A config value like `"agentId": "28368"` might be from the old deployment or a different chain.
83
72
 
84
73
  ```
85
- 1. Ask user: "Which blockchain would you like to use? **Ethereum** or **Base**?"
86
- 2. User chooses a chain
87
- 3. Call `agether_set_chain(chain: "<ethereum or base>")`
88
- 4. After set β†’ call `agether_health` to confirm everything is working on that chain
74
+ IF chain is confirmed AND agentId is "?"
75
+ 1. IF you remember an agentId AND know which chain it was for:
76
+ β†’ Ask: "I remember agent <X> on <CHAIN>. Is this still correct?"
77
+ β†’ IF yes AND chain matches β†’ agether_set_agent(agentId: "<X>")
78
+ β†’ IF no β†’ agether_register(name: "<ask>")
79
+ 2. IF no memory of agentId:
80
+ β†’ agether_register(name: "<ask>")
81
+ 3. Call agether_health to confirm
89
82
  ```
90
83
 
91
- `agether_set_chain` saves the chain to config permanently (survives restarts). Accepts: `ethereum`, `eth`, `1`, `base`, `8453`.
84
+ ### β›” FORBIDDEN (will cause bugs)
85
+
86
+ - ❌ `agether_set_agent` β†’ then `agether_set_chain` β€” **WRONG ORDER, agent points at wrong chain**
87
+ - ❌ `agether_register` before chain is set β€” **WILL FAIL**
88
+ - ❌ Reusing a cached agentId without confirming which chain it belongs to β€” **WRONG ACCOUNT**
89
+ - ❌ Seeing `"agentId": "28368"` in config and assuming it's valid β€” it might be stale or from a different chain
90
+ - ❌ Calling `agether_set_agent` just because config has an agentId β€” **ASK THE USER FIRST**
91
+
92
+ ### βœ… CORRECT SEQUENCE (always follow this)
92
93
 
93
- **IMPORTANT:** Resolve chain BEFORE resolving agentId β€” the agent registration happens on a specific chain.
94
+ ```
95
+ 1. agether_health β†’ check chain and agentId status
96
+ 2. agether_set_chain β†’ if chain is "?", ask user and set it FIRST
97
+ 3. agether_health β†’ confirm chain is now set
98
+ 4. agether_set_agent OR agether_register β†’ only NOW, after chain is confirmed
99
+ 5. agether_health β†’ final confirmation that both chain + agentId are set
100
+ ```
101
+
102
+ Both `agether_set_agent` and `agether_register` save the agentId to config permanently (survives restarts).
94
103
 
95
104
  ---
96
105
 
@@ -191,11 +200,11 @@ When `autoYield` and/or `autoDraw` are enabled, `x402_pay` automatically sources
191
200
  ```
192
201
  1. agether_health ← ONE call for full context
193
202
  2. Check the "chain" field:
194
- β†’ If chain is "?" β†’ go to CHAIN RESOLUTION (must resolve before anything else)
203
+ β†’ If chain is "?" β†’ STOP. Set chain first (MANDATORY BOOT SEQUENCE). Do NOT proceed until chain is confirmed.
195
204
  3. Check the "alerts" array:
196
205
  β†’ If any πŸ”΄ alerts β†’ WARN user immediately (liquidation risk!)
197
206
  β†’ If any 🟑 alerts β†’ mention the risk casually
198
- β†’ If "agentId: ?" β†’ go to AGENT ID RESOLUTION
207
+ β†’ If "agentId: ?" β†’ set agent ID (but only AFTER chain is confirmed β€” see MANDATORY BOOT SEQUENCE)
199
208
  4. Now you have full context to handle any request
200
209
  ```
201
210