suzi-cli 0.1.21 → 0.1.23
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/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +86 -47
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +2 -6
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +48 -1
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +133 -93
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/run.js +8 -8
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/transactions.d.ts.map +1 -1
- package/dist/commands/transactions.js +49 -30
- package/dist/commands/transactions.js.map +1 -1
- package/dist/lib/api-errors.d.ts +17 -0
- package/dist/lib/api-errors.d.ts.map +1 -0
- package/dist/lib/api-errors.js +84 -0
- package/dist/lib/api-errors.js.map +1 -0
- package/dist/lib/api-errors.test.d.ts +2 -0
- package/dist/lib/api-errors.test.d.ts.map +1 -0
- package/dist/lib/api-errors.test.js +51 -0
- package/dist/lib/api-errors.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/lib/suzi-guide.d.ts +0 -2
- package/dist/lib/suzi-guide.d.ts.map +0 -1
- package/dist/lib/suzi-guide.js +0 -682
- package/dist/lib/suzi-guide.js.map +0 -1
package/dist/lib/suzi-guide.js
DELETED
|
@@ -1,682 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Shared suzi-guide content used by both skills.ts and create.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.SUZI_GUIDE_CONTENT = void 0;
|
|
5
|
-
exports.SUZI_GUIDE_CONTENT = `---
|
|
6
|
-
name: suzi-guide
|
|
7
|
-
description: >
|
|
8
|
-
Comprehensive guide for the Suzi CLI and agent platform. Use this skill when
|
|
9
|
-
the user asks about Suzi commands, how to create/deploy/manage agents, available
|
|
10
|
-
protocols and actions, agent code patterns, or anything related to the Suzi
|
|
11
|
-
autonomous agent platform for blockchain protocols.
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Suzi CLI & Agent Platform Guide
|
|
15
|
-
|
|
16
|
-
## IMPORTANT: Always Use the CLI for Live Data
|
|
17
|
-
|
|
18
|
-
**NEVER rely on hardcoded data from this skill for questions about protocols, actions, balances, agents, or any runtime state.** Always run the appropriate \`suzi\` CLI command and use its output. This ensures the user gets up-to-date information.
|
|
19
|
-
|
|
20
|
-
**Hard rule:** the CLI is the primary source of truth. This skill is guidance documentation and can lag behind the latest release. If the skill and CLI output ever conflict, trust the CLI.
|
|
21
|
-
|
|
22
|
-
| User asks about... | Run this command |
|
|
23
|
-
|---------------------|-----------------|
|
|
24
|
-
| Available protocols / actions | \`suzi list-actions --verbose\` |
|
|
25
|
-
| Actions for a specific protocol | \`suzi list-actions --protocol <name>\` |
|
|
26
|
-
| Action schema (parameters + response) | \`suzi list-actions --protocol <name> --schema <action>\` |
|
|
27
|
-
| Multiple action schemas at once | \`suzi list-actions --protocol <name> --schema a1,a2,a3\` or \`--schema all\` |
|
|
28
|
-
| Available triggers | \`suzi list-triggers\` |
|
|
29
|
-
| Triggers for a specific protocol | \`suzi list-triggers --protocol <name>\` |
|
|
30
|
-
| Run an action directly | \`suzi agents run <protocol>.<action> --key value\` |
|
|
31
|
-
| Run an action and get raw JSON | \`suzi agents run <action> --output json\` |
|
|
32
|
-
| Their agents | \`suzi agents\` |
|
|
33
|
-
| Agent details / triggers / config | \`suzi agents view <id>\` |
|
|
34
|
-
| Agent logs | \`suzi agents logs <id>\` |
|
|
35
|
-
| Debugging agent issues | \`suzi debug logs <id>\` |
|
|
36
|
-
| Agent execution history | \`suzi debug runs <id>\` |
|
|
37
|
-
| Failed action details | \`suzi debug executions <id> --status failed\` |
|
|
38
|
-
| Database-level agent logs | \`suzi debug db-logs <id>\` |
|
|
39
|
-
| Wallet addresses | \`suzi accounts show\` |
|
|
40
|
-
| Balances | \`suzi portfolio\` |
|
|
41
|
-
| Portfolio | \`suzi portfolio\` |
|
|
42
|
-
| Transactions | \`suzi transactions\` |
|
|
43
|
-
| Current user / auth status | \`suzi whoami\` |
|
|
44
|
-
|
|
45
|
-
**Do NOT answer "what protocols are available?" or "what actions does polymarket have?" from memory. Run the CLI.**
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## What is Suzi?
|
|
50
|
-
|
|
51
|
-
Suzi is an autonomous agent platform for creating and executing intelligent agents that interact with blockchain protocols. Users write TypeScript agents with triggers (manual, schedule, event-based) that execute actions against protocols in a sandboxed environment.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Installing the Suzi CLI
|
|
56
|
-
|
|
57
|
-
\\\`\\\`\\\`bash
|
|
58
|
-
pnpm add suzi
|
|
59
|
-
|
|
60
|
-
# Verify installation
|
|
61
|
-
suzi --version
|
|
62
|
-
\\\`\\\`\\\`
|
|
63
|
-
|
|
64
|
-
### First-time setup
|
|
65
|
-
|
|
66
|
-
\\\`\\\`\\\`bash
|
|
67
|
-
# 1. Point to the Suzi API (production)
|
|
68
|
-
suzi login --api-url https://api-3ihwe.ondigitalocean.app
|
|
69
|
-
|
|
70
|
-
# 2. Browser opens for Google OAuth sign-in
|
|
71
|
-
# 3. After auth, CLI shows your wallet address + QR code
|
|
72
|
-
# 4. Send SOL to the displayed address to fund your wallet
|
|
73
|
-
# 5. CLI auto-detects the deposit and shows your portfolio
|
|
74
|
-
\\\`\\\`\\\`
|
|
75
|
-
|
|
76
|
-
### Requirements
|
|
77
|
-
|
|
78
|
-
- Node.js 22.x
|
|
79
|
-
- pnpm 9.15.0
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## CLI Commands Reference
|
|
84
|
-
|
|
85
|
-
### Authentication
|
|
86
|
-
|
|
87
|
-
\`\`\`bash
|
|
88
|
-
suzi login # Sign in with Google (OAuth2.0). Shows QR code for wallet funding.
|
|
89
|
-
suzi login --api-url <url> # Override API endpoint
|
|
90
|
-
suzi login --web-url <url> # Override web app URL
|
|
91
|
-
suzi logout # Sign out and clear stored credentials
|
|
92
|
-
suzi whoami # Show current authenticated user, wallet addresses
|
|
93
|
-
\`\`\`
|
|
94
|
-
|
|
95
|
-
### Accounts & Funding
|
|
96
|
-
|
|
97
|
-
\`\`\`bash
|
|
98
|
-
suzi accounts # Manage accounts and switch active account
|
|
99
|
-
suzi accounts list # List accounts (same as interactive accounts view)
|
|
100
|
-
suzi accounts show # Show full wallet addresses for active account
|
|
101
|
-
suzi accounts fund # Show deposit instructions with full addresses
|
|
102
|
-
suzi accounts switch <name> # Switch active account
|
|
103
|
-
suzi accounts create <name> # Create a new account
|
|
104
|
-
suzi accounts rename <name> <newName> # Rename an account
|
|
105
|
-
suzi accounts delete <name> # Delete an account (use -f to skip confirmation)
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
### Portfolio
|
|
109
|
-
|
|
110
|
-
\`\`\`bash
|
|
111
|
-
suzi portfolio # View spot balances and Hyperliquid perp positions
|
|
112
|
-
\`\`\`
|
|
113
|
-
|
|
114
|
-
### Agent Management
|
|
115
|
-
|
|
116
|
-
\`\`\`bash
|
|
117
|
-
suzi agents # List all agents (ALWAYS run this for agent questions)
|
|
118
|
-
suzi agents view <id> # View agent details (spec, triggers, resources, config)
|
|
119
|
-
suzi agents activate <id> # Activate agent (allocates wallets, registers triggers)
|
|
120
|
-
suzi agents deactivate <id> # Deactivate agent
|
|
121
|
-
suzi agents execute <id> [trigger] # Manually execute a trigger (prompts if multiple)
|
|
122
|
-
suzi agents logs <id> # View agent logs (default: last 20)
|
|
123
|
-
suzi agents logs <id> -n 50 # View more log entries
|
|
124
|
-
suzi agents logs <id> --level error # Filter by level: info|warn|error|debug
|
|
125
|
-
suzi agents delete <id> # Delete agent (with confirmation)
|
|
126
|
-
suzi agents delete <id> -f # Delete without confirmation
|
|
127
|
-
\`\`\`
|
|
128
|
-
|
|
129
|
-
### Agent Deployment & Validation
|
|
130
|
-
|
|
131
|
-
\`\`\`bash
|
|
132
|
-
suzi validate # Validate agent code (auto-discovers agent file)
|
|
133
|
-
suzi validate ./path/to/agent.ts # Validate specific file (checks triggers + actions)
|
|
134
|
-
suzi deploy # Deploy agent (auto-discovers agent.ts, src/agent.ts, index.ts)
|
|
135
|
-
suzi deploy ./path/to/agent.ts # Deploy specific file
|
|
136
|
-
suzi deploy -t "My Agent" # Set title
|
|
137
|
-
suzi deploy -d "Description here" # Set description
|
|
138
|
-
suzi deploy --activate # Activate immediately after deployment
|
|
139
|
-
suzi deploy --update <agentId> # Update existing agent's code
|
|
140
|
-
\`\`\`
|
|
141
|
-
|
|
142
|
-
### Debugging
|
|
143
|
-
|
|
144
|
-
\`\`\`bash
|
|
145
|
-
suzi debug logs <agentId> # View Datadog logs for an agent (last 1h)
|
|
146
|
-
suzi debug logs <agentId> --status error # Filter by log level: error, warn, info, debug
|
|
147
|
-
suzi debug logs <agentId> --time-range now-1d # Lookback: now-15m, now-1h, now-1d
|
|
148
|
-
suzi debug logs <agentId> --limit 100 # Max results (default: 25, max: 1000)
|
|
149
|
-
suzi debug logs <agentId> --query "@http.status_code:500" # Append raw Datadog query
|
|
150
|
-
|
|
151
|
-
suzi debug aggregate <agentId> # Aggregate Datadog logs (counts)
|
|
152
|
-
suzi debug aggregate <agentId> --group-by status # Group by: status, host, service
|
|
153
|
-
suzi debug aggregate <agentId> --time-range now-1d
|
|
154
|
-
|
|
155
|
-
suzi debug db-logs <agentId> # View agent logs from database
|
|
156
|
-
suzi debug db-logs <agentId> --level error # Filter: info, warn, error, debug
|
|
157
|
-
suzi debug db-logs <agentId> --run-id <id> # Filter by specific run
|
|
158
|
-
suzi debug db-logs <agentId> --limit 50 # Page size (default: 50)
|
|
159
|
-
suzi debug db-logs <agentId> --cursor <c> # Pagination cursor from previous response
|
|
160
|
-
|
|
161
|
-
suzi debug executions <agentId> # View action executions from database
|
|
162
|
-
suzi debug executions <agentId> --status failed # Filter: running, completed, failed
|
|
163
|
-
suzi debug executions <agentId> --run-id <id>
|
|
164
|
-
|
|
165
|
-
suzi debug runs <agentId> # View agent runs from database
|
|
166
|
-
suzi debug runs <agentId> --status failed # Filter: running, completed, failed
|
|
167
|
-
\`\`\`
|
|
168
|
-
|
|
169
|
-
### Sharing & Import
|
|
170
|
-
|
|
171
|
-
\`\`\`bash
|
|
172
|
-
suzi share create [agentId] # Create share link (prompts if agentId omitted)
|
|
173
|
-
suzi share create --slug <slug> # Create share link with custom slug
|
|
174
|
-
suzi share create --expires <days> # Create expiring share link
|
|
175
|
-
suzi share list # List shared agent snapshots (alias: suzi share ls)
|
|
176
|
-
suzi share update <agentId> --slug <slug> # Publish a new shared version
|
|
177
|
-
suzi share revoke <snapshotId> # Revoke shared snapshot (use -f to skip confirmation)
|
|
178
|
-
suzi import <slug> # Clone a shared agent by slug
|
|
179
|
-
\`\`\`
|
|
180
|
-
|
|
181
|
-
### Transactions
|
|
182
|
-
|
|
183
|
-
\`\`\`bash
|
|
184
|
-
suzi transactions # View recent transactions across agents (alias: suzi txns)
|
|
185
|
-
suzi txns -n 30 # Show more entries
|
|
186
|
-
suzi txns --type order # Filter: order|cancel|transfer|swap|bridge|liquidity
|
|
187
|
-
suzi txns --protocol polymarket # Filter by protocol
|
|
188
|
-
suzi txns --agent <id> # Filter by specific agent
|
|
189
|
-
suzi tx-confirm <agentId> [executionId] # Show execution details and parsed input/output
|
|
190
|
-
\`\`\`
|
|
191
|
-
|
|
192
|
-
### Direct Action Execution
|
|
193
|
-
|
|
194
|
-
\`\`\`bash
|
|
195
|
-
suzi agents run <protocol>.<action> [--key value ...] # Execute any action directly
|
|
196
|
-
suzi agents run polymarket.get_event_by_slug --slug btc # Pass params as CLI flags
|
|
197
|
-
suzi agents run solana.get_native_balance # Wallet context injected from active account
|
|
198
|
-
suzi agents run <action> --json '{"key":"value"}' # Pass all params as JSON string
|
|
199
|
-
suzi agents run <action> --output json # Output raw JSON (default: pretty)
|
|
200
|
-
suzi agents run <action> --dry-run # Preview request payload without executing
|
|
201
|
-
\`\`\`
|
|
202
|
-
|
|
203
|
-
**Notes:**
|
|
204
|
-
- Wallet-requiring actions automatically receive wallet credentials from your active account (no need to pass walletId/address).
|
|
205
|
-
- Parameter names are case-insensitive and support kebab-case (e.g. \`--token-id\` resolves to \`tokenID\`).
|
|
206
|
-
- Values are auto-coerced using the action's JSON schema (strings, numbers, booleans, JSON objects).
|
|
207
|
-
|
|
208
|
-
### Tools & Triggers
|
|
209
|
-
|
|
210
|
-
\`\`\`bash
|
|
211
|
-
suzi list-actions # List all protocols (alias: suzi actions)
|
|
212
|
-
suzi list-actions --verbose # Show all actions per protocol
|
|
213
|
-
suzi list-actions --protocol <name> # Show actions for one protocol
|
|
214
|
-
suzi list-actions --protocol <name> --schema <action> # Print action schema JSON
|
|
215
|
-
suzi list-actions --protocol <name> --schema a1,a2,a3 # Print schemas for multiple actions at once
|
|
216
|
-
suzi list-actions --protocol <name> --schema all # Print all schemas for a protocol
|
|
217
|
-
suzi list-actions --schema proto.action1,proto.action2 # Fully-qualified names (no --protocol needed)
|
|
218
|
-
suzi list-actions reload # Force-refresh actions cache from API
|
|
219
|
-
suzi list-triggers # List all available triggers (alias: suzi triggers)
|
|
220
|
-
suzi list-triggers --verbose # Show trigger config fields and examples
|
|
221
|
-
suzi list-triggers --protocol <name> # Show triggers for one protocol
|
|
222
|
-
suzi list-triggers --protocol <name> --schema <trigger> # Print trigger schema JSON
|
|
223
|
-
\`\`\`
|
|
224
|
-
|
|
225
|
-
### Action Parameter & Response Schemas
|
|
226
|
-
|
|
227
|
-
Every action has a typed **parameters** schema (what you pass in) and a **response** schema (what the action returns). Both are available as JSON Schema via the CLI.
|
|
228
|
-
|
|
229
|
-
**Before writing any action call in agent code, always run the CLI to get the current schemas:**
|
|
230
|
-
|
|
231
|
-
\`\`\`bash
|
|
232
|
-
# See all actions in a protocol
|
|
233
|
-
suzi list-actions --protocol polymarket --verbose
|
|
234
|
-
|
|
235
|
-
# Get the full JSON schema (parameters + response) for a specific action
|
|
236
|
-
suzi list-actions --protocol polymarket --schema place_order
|
|
237
|
-
|
|
238
|
-
# Get schemas for MULTIPLE actions at once (preferred — avoids sequential calls)
|
|
239
|
-
suzi list-actions --protocol polymarket --schema place_order,cancel_order,get_market_price
|
|
240
|
-
|
|
241
|
-
# Get ALL schemas for a protocol at once
|
|
242
|
-
suzi list-actions --protocol polymarket --schema all
|
|
243
|
-
|
|
244
|
-
# Mix protocols with fully-qualified names (no --protocol needed)
|
|
245
|
-
suzi list-actions --schema polymarket.place_order,solana.get_balance
|
|
246
|
-
\`\`\`
|
|
247
|
-
|
|
248
|
-
**IMPORTANT: Always batch schema lookups.** When you need schemas for multiple actions, fetch them all in a single \`--schema a,b,c\` call instead of running separate commands for each action. This is significantly faster.
|
|
249
|
-
|
|
250
|
-
**Do NOT guess action parameters or response fields.** Run the CLI to see the exact schemas, then use those fields in your agent code. This skill's field listings can be stale — the CLI is always up to date.
|
|
251
|
-
|
|
252
|
-
### Environment Variables
|
|
253
|
-
|
|
254
|
-
\`\`\`bash
|
|
255
|
-
suzi env # Interactive env-var manager
|
|
256
|
-
suzi env list # List env-var names and scopes
|
|
257
|
-
suzi env list --agent <id> # List env vars for a specific agent
|
|
258
|
-
suzi env set <KEY> # Set env var (prompts for secret value)
|
|
259
|
-
suzi env set <KEY> --agent <id> # Set env var scoped to one agent
|
|
260
|
-
suzi env remove <KEY> # Remove env var
|
|
261
|
-
suzi env remove <KEY> --agent <id> # Remove scoped env var
|
|
262
|
-
\`\`\`
|
|
263
|
-
|
|
264
|
-
### Preferences
|
|
265
|
-
|
|
266
|
-
\`\`\`bash
|
|
267
|
-
suzi preferences # View current preferences (alias: suzi prefs)
|
|
268
|
-
suzi prefs set-username [name] # Set display username
|
|
269
|
-
suzi prefs telegram # Connect Telegram for notifications
|
|
270
|
-
suzi prefs api-url <url> # Set API server URL
|
|
271
|
-
\`\`\`
|
|
272
|
-
|
|
273
|
-
### AI-Assisted Agent Creation
|
|
274
|
-
|
|
275
|
-
\`\`\`bash
|
|
276
|
-
suzi start # Create with configured default AI; falls back to Claude
|
|
277
|
-
suzi start ./my-agent # Create inside a target directory
|
|
278
|
-
suzi start --ai claude # Force Claude Code for this run
|
|
279
|
-
suzi start --ai codex # Force Codex for this run
|
|
280
|
-
suzi start --set-default claude # Set default AI provider
|
|
281
|
-
suzi start --set-default codex # Set default AI provider
|
|
282
|
-
suzi start --no-scaffold # Skip template creation for agent.ts
|
|
283
|
-
\`\`\`
|
|
284
|
-
|
|
285
|
-
### Agent Templates
|
|
286
|
-
|
|
287
|
-
\`\`\`bash
|
|
288
|
-
suzi subagents # List agent.md and agent.ts files in current directory
|
|
289
|
-
suzi subagents init # Create template agent.md + agent.ts files
|
|
290
|
-
suzi subagents init --dir ./myagent # Create templates in specific directory
|
|
291
|
-
suzi subagents validate # Validate agent.md (Meta/Resources/Triggers checks)
|
|
292
|
-
suzi subagents validate ./agent.md # Validate specific file
|
|
293
|
-
\`\`\`
|
|
294
|
-
|
|
295
|
-
### Memory & Context
|
|
296
|
-
|
|
297
|
-
\`\`\`bash
|
|
298
|
-
suzi memory # Show memory summary
|
|
299
|
-
suzi memory learnings # View recent learnings
|
|
300
|
-
suzi memory log # View today's activity log
|
|
301
|
-
suzi memory log 2026-01-15 # View a specific day
|
|
302
|
-
suzi memory context # View active context
|
|
303
|
-
suzi memory clear # Clear learnings (use -f to skip confirmation)
|
|
304
|
-
suzi memory edit # Edit learnings in $EDITOR
|
|
305
|
-
suzi memory export # Export memory files to stdout
|
|
306
|
-
\`\`\`
|
|
307
|
-
|
|
308
|
-
### Project Setup & Hooks
|
|
309
|
-
|
|
310
|
-
\`\`\`bash
|
|
311
|
-
suzi init # Generate SUZI.md for current project
|
|
312
|
-
suzi install-hooks # Install global Claude Code hooks (~/.claude/hooks/)
|
|
313
|
-
suzi install-hooks --preferences # Also create starter ~/.suzi/preferences.md
|
|
314
|
-
\`\`\`
|
|
315
|
-
|
|
316
|
-
### Feedback & Suggestions
|
|
317
|
-
|
|
318
|
-
\`\`\`bash
|
|
319
|
-
suzi suggest # Interactive command suggestions (alias: suzi help-me)
|
|
320
|
-
suzi feedback # Send feedback interactively
|
|
321
|
-
suzi feedback -c bug -m "..." # Non-interactive feedback submit
|
|
322
|
-
suzi --help # Show all commands
|
|
323
|
-
\`\`\`
|
|
324
|
-
|
|
325
|
-
### Skills
|
|
326
|
-
|
|
327
|
-
\`\`\`bash
|
|
328
|
-
suzi skills # List available skills
|
|
329
|
-
suzi skills show <name> # Show skill details and sections
|
|
330
|
-
suzi skills add <name> # Install for Claude + Codex (default target)
|
|
331
|
-
suzi skills add --all # Install all available skills
|
|
332
|
-
suzi skills add <name> --client claude|codex|both
|
|
333
|
-
suzi skills add <name> --dir <path> # Install into a custom directory
|
|
334
|
-
\`\`\`
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
## Creating Agents
|
|
339
|
-
|
|
340
|
-
### Quick Start
|
|
341
|
-
|
|
342
|
-
\`\`\`bash
|
|
343
|
-
# 1. Initialize a template
|
|
344
|
-
suzi subagents init
|
|
345
|
-
|
|
346
|
-
# 2. Edit agent.ts with your logic
|
|
347
|
-
|
|
348
|
-
# 3. Deploy
|
|
349
|
-
suzi deploy ./agent.ts
|
|
350
|
-
|
|
351
|
-
# 4. Activate
|
|
352
|
-
suzi agents activate <agent-id>
|
|
353
|
-
|
|
354
|
-
# 5. Execute manually
|
|
355
|
-
suzi agents execute <agent-id>
|
|
356
|
-
\`\`\`
|
|
357
|
-
|
|
358
|
-
### Agent File Structure
|
|
359
|
-
|
|
360
|
-
Agent files must default-export a \`defineAgent()\` call. The file is self-contained — **no imports allowed** (the runtime provides \`defineAgent\`, \`on\`, \`resource\`, \`config\`, \`requirement\` as globals).
|
|
361
|
-
|
|
362
|
-
\`\`\`typescript
|
|
363
|
-
export default defineAgent({
|
|
364
|
-
meta: { ... }, // Required: name, version
|
|
365
|
-
resources: { ... }, // Optional: wallet requirements
|
|
366
|
-
config: { ... }, // Optional: user-configurable parameters
|
|
367
|
-
activationRequirements: { ... }, // Optional: balance checks before activation
|
|
368
|
-
lifecycle: { ... }, // Optional: onActivate, onDeactivate hooks
|
|
369
|
-
triggers: { ... }, // Required: at least one trigger
|
|
370
|
-
});
|
|
371
|
-
\`\`\`
|
|
372
|
-
|
|
373
|
-
### Minimal Agent
|
|
374
|
-
|
|
375
|
-
\`\`\`typescript
|
|
376
|
-
export default defineAgent({
|
|
377
|
-
meta: {
|
|
378
|
-
name: 'My Agent',
|
|
379
|
-
version: '0.1.0',
|
|
380
|
-
},
|
|
381
|
-
triggers: {
|
|
382
|
-
manual: on.suzi.manual(async (ctx, input) => {
|
|
383
|
-
await ctx.actions.suzi.log({ message: 'Hello from my agent!' });
|
|
384
|
-
return { ok: true };
|
|
385
|
-
}),
|
|
386
|
-
},
|
|
387
|
-
});
|
|
388
|
-
\`\`\`
|
|
389
|
-
|
|
390
|
-
### Full Agent Template
|
|
391
|
-
|
|
392
|
-
\`\`\`typescript
|
|
393
|
-
export default defineAgent({
|
|
394
|
-
meta: {
|
|
395
|
-
name: 'My Trading Agent',
|
|
396
|
-
version: '0.1.0',
|
|
397
|
-
description: 'Automated trading strategy',
|
|
398
|
-
tags: ['trading', 'solana'],
|
|
399
|
-
},
|
|
400
|
-
|
|
401
|
-
// Wallet resources the agent needs
|
|
402
|
-
resources: {
|
|
403
|
-
svmWallet: resource.wallet('svm'), // Solana wallet
|
|
404
|
-
evmWallet: resource.wallet('evm'), // Ethereum wallet (for Hyperliquid/Polymarket)
|
|
405
|
-
},
|
|
406
|
-
|
|
407
|
-
// User-configurable parameters (set during activation)
|
|
408
|
-
config: {
|
|
409
|
-
capital: config.number({
|
|
410
|
-
description: 'Initial capital in USDC',
|
|
411
|
-
min: 100,
|
|
412
|
-
max: 10000,
|
|
413
|
-
required: true,
|
|
414
|
-
default: 1000,
|
|
415
|
-
}),
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
// Balance checks before agent can activate
|
|
419
|
-
activationRequirements: {
|
|
420
|
-
__min_usdc: requirement.svmTokenBalance({
|
|
421
|
-
token: 'USDC',
|
|
422
|
-
minAmount: { $ref: 'config.capital' }, // References config value
|
|
423
|
-
description: 'Minimum USDC required',
|
|
424
|
-
}),
|
|
425
|
-
__min_sol: requirement.svmNativeBalance({
|
|
426
|
-
minAmount: 0.5,
|
|
427
|
-
description: 'Minimum SOL for transaction fees',
|
|
428
|
-
}),
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
// Lifecycle hooks
|
|
432
|
-
lifecycle: {
|
|
433
|
-
onActivate: async (ctx) => {
|
|
434
|
-
const { capital } = ctx.config as { capital: number };
|
|
435
|
-
await ctx.actions.suzi.log({ message: \`Activating with $\${capital} USDC\` });
|
|
436
|
-
const svmResult = await ctx.actions.suzi.get_svm_address({});
|
|
437
|
-
await ctx.actions.suzi.set_to_store({ key: 'initial_capital', value: capital });
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
onDeactivate: async (ctx) => {
|
|
441
|
-
await ctx.actions.suzi.log({ message: 'Deactivating — closing positions...' });
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
triggers: {
|
|
446
|
-
// Manual trigger — executed from dashboard or CLI
|
|
447
|
-
manual: on.suzi.manual(async (ctx, input) => {
|
|
448
|
-
await ctx.actions.suzi.log({ message: 'Manual execution' });
|
|
449
|
-
return { ok: true };
|
|
450
|
-
}),
|
|
451
|
-
|
|
452
|
-
// Schedule trigger — runs on a cron schedule
|
|
453
|
-
rebalance: on.suzi.schedule(
|
|
454
|
-
{ cronExpressions: ['*/5 * * * *'] }, // Every 5 minutes
|
|
455
|
-
async (ctx) => {
|
|
456
|
-
await ctx.actions.suzi.log({ message: 'Rebalancing...' });
|
|
457
|
-
return { ok: true, action: 'rebalanced' };
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
},
|
|
461
|
-
});
|
|
462
|
-
\`\`\`
|
|
463
|
-
|
|
464
|
-
### Agent Context (ctx)
|
|
465
|
-
|
|
466
|
-
Available in all trigger handlers and lifecycle hooks:
|
|
467
|
-
|
|
468
|
-
\`\`\`typescript
|
|
469
|
-
ctx.actions.<protocol>.<action>() // Call any protocol action
|
|
470
|
-
ctx.config // Access config values
|
|
471
|
-
\`\`\`
|
|
472
|
-
|
|
473
|
-
**To see what protocols and actions are available, run \`suzi list-actions --verbose\`.**
|
|
474
|
-
Actions are called as \`ctx.actions.<protocol>.<action_name>({ ...params })\`.
|
|
475
|
-
|
|
476
|
-
**Before writing any action call, always fetch its schema first:**
|
|
477
|
-
\`\`\`bash
|
|
478
|
-
suzi list-actions --protocol <name> --schema <action>
|
|
479
|
-
\`\`\`
|
|
480
|
-
This returns both the **parameters** (what to pass) and the **response** (what comes back). Use the response schema to know what fields are available on the result object. Never guess parameter names or response fields — always check the schema.
|
|
481
|
-
|
|
482
|
-
### Validation Rules
|
|
483
|
-
|
|
484
|
-
- Agent **must** default-export via \`defineAgent({})\`
|
|
485
|
-
- **No imports/requires** — agent code must be self-contained
|
|
486
|
-
- \`triggers\` object is **required** with at least one trigger
|
|
487
|
-
- Each trigger must have a \`type\` (e.g., \`suzi.manual\`, \`suzi.schedule\`)
|
|
488
|
-
- Config fields need \`type\` and \`description\`
|
|
489
|
-
- The file is transpiled from TypeScript to JavaScript and executed in a VM2 sandbox
|
|
490
|
-
|
|
491
|
-
### Agent Statuses
|
|
492
|
-
|
|
493
|
-
| Status | Description |
|
|
494
|
-
|--------|-------------|
|
|
495
|
-
| \`draft\` | Created but not activated. No wallets allocated. |
|
|
496
|
-
| \`active\` | Running. Schedule triggers fire on cron, event triggers are subscribed. |
|
|
497
|
-
| \`inactive\` | Deactivated. Triggers stopped. Can be reactivated. |
|
|
498
|
-
| \`deleted\` | Soft-deleted. Not recoverable from CLI. |
|
|
499
|
-
|
|
500
|
-
---
|
|
501
|
-
|
|
502
|
-
## Trigger Types
|
|
503
|
-
|
|
504
|
-
| Trigger | Syntax | Description |
|
|
505
|
-
|---------|--------|-------------|
|
|
506
|
-
| Manual | \`on.suzi.manual(handler)\` | Triggered from dashboard or \`suzi agents execute\` |
|
|
507
|
-
| Schedule | \`on.suzi.schedule({ cronExpressions: ['...'] }, handler)\` | Runs on a cron schedule, interval, or calendar spec |
|
|
508
|
-
| Event | \`on.<protocol>.event(config, handler)\` | Triggered by realtime protocol events |
|
|
509
|
-
|
|
510
|
-
### Schedule Examples
|
|
511
|
-
|
|
512
|
-
| Schedule | Meaning |
|
|
513
|
-
|----------|---------|
|
|
514
|
-
| \`*/1 * * * *\` | Every minute |
|
|
515
|
-
| \`*/5 * * * *\` | Every 5 minutes |
|
|
516
|
-
| \`0 * * * *\` | Every hour |
|
|
517
|
-
| \`0 */4 * * *\` | Every 4 hours |
|
|
518
|
-
| \`0 0 * * *\` | Daily at midnight |
|
|
519
|
-
|
|
520
|
-
### Trigger Event Output Schemas
|
|
521
|
-
|
|
522
|
-
Every trigger passes a typed \`event\` object to the handler. The \`event\` contains specific fields depending on the trigger type (e.g., price, size, side, timestamp, etc.).
|
|
523
|
-
|
|
524
|
-
**Before writing a trigger handler, always run the CLI to get the current output schema:**
|
|
525
|
-
|
|
526
|
-
\`\`\`bash
|
|
527
|
-
# See output fields for all triggers in a protocol
|
|
528
|
-
suzi list-triggers --protocol polymarket --verbose
|
|
529
|
-
|
|
530
|
-
# Get the full JSON schema (configSchema + outputSchema) for a specific trigger
|
|
531
|
-
suzi list-triggers --protocol polymarket --schema price_change
|
|
532
|
-
\`\`\`
|
|
533
|
-
|
|
534
|
-
**Do NOT guess event field names.** Run the CLI to see the exact output schema, then use those fields in your handler. This skill's field listings can be stale — the CLI is always up to date.
|
|
535
|
-
|
|
536
|
-
---
|
|
537
|
-
|
|
538
|
-
## Common Workflows
|
|
539
|
-
|
|
540
|
-
### Deploy & Activate in One Command
|
|
541
|
-
|
|
542
|
-
\`\`\`bash
|
|
543
|
-
suzi deploy ./agent.ts --activate
|
|
544
|
-
\`\`\`
|
|
545
|
-
|
|
546
|
-
### Update Running Agent Code
|
|
547
|
-
|
|
548
|
-
\`\`\`bash
|
|
549
|
-
suzi deploy ./agent.ts --update <agent-id>
|
|
550
|
-
\`\`\`
|
|
551
|
-
|
|
552
|
-
### Monitor & Debug Agent
|
|
553
|
-
|
|
554
|
-
\`\`\`bash
|
|
555
|
-
suzi agents logs <id> # Quick log check
|
|
556
|
-
suzi debug logs <id> --status error # Datadog error logs
|
|
557
|
-
suzi debug runs <id> --status failed # Failed runs
|
|
558
|
-
suzi debug executions <id> --status failed # Failed action executions
|
|
559
|
-
suzi debug db-logs <id> --level error # Database error logs
|
|
560
|
-
suzi txns --agent <id> # View transactions
|
|
561
|
-
\`\`\`
|
|
562
|
-
|
|
563
|
-
### Typical Development Loop
|
|
564
|
-
|
|
565
|
-
\`\`\`bash
|
|
566
|
-
# 1. Create template
|
|
567
|
-
suzi subagents init --dir ./my-agent
|
|
568
|
-
|
|
569
|
-
# 2. Look up schemas for the actions you plan to use
|
|
570
|
-
suzi list-actions --protocol <name> --schema <action>
|
|
571
|
-
|
|
572
|
-
# 3. Edit agent.ts — write your logic using the exact parameter/response fields
|
|
573
|
-
|
|
574
|
-
# 4. Validate before deploying (checks triggers + actions)
|
|
575
|
-
suzi validate ./my-agent/agent.ts
|
|
576
|
-
|
|
577
|
-
# 5. Deploy as draft
|
|
578
|
-
suzi deploy ./my-agent/agent.ts
|
|
579
|
-
|
|
580
|
-
# 6. Review
|
|
581
|
-
suzi agents view <id>
|
|
582
|
-
|
|
583
|
-
# 7. Activate
|
|
584
|
-
suzi agents activate <id>
|
|
585
|
-
|
|
586
|
-
# 8. Test manually
|
|
587
|
-
suzi agents execute <id>
|
|
588
|
-
|
|
589
|
-
# 9. Check results
|
|
590
|
-
suzi agents logs <id>
|
|
591
|
-
|
|
592
|
-
# 10. Iterate — update code
|
|
593
|
-
suzi deploy ./my-agent/agent.ts --update <id>
|
|
594
|
-
\`\`\`
|
|
595
|
-
|
|
596
|
-
---
|
|
597
|
-
|
|
598
|
-
## Tips & Best Practices
|
|
599
|
-
|
|
600
|
-
1. **Start simple** — begin with a manual trigger, test it, then add schedule/event triggers
|
|
601
|
-
2. **Use \`suzi.log\`** liberally — logs are your debugging tool since agents run in a sandbox
|
|
602
|
-
3. **Use \`suzi.set_to_store / get_from_store\`** for state that persists across trigger executions
|
|
603
|
-
4. **Activation requirements** prevent agents from starting without sufficient funds
|
|
604
|
-
5. **Kill switches** — add a schedule trigger that checks drawdown and calls \`request_deactivation\` if needed
|
|
605
|
-
6. **No imports** — all code must be self-contained. Use \`ctx.actions\` for all external interactions
|
|
606
|
-
7. **Test with manual triggers first**, then add schedules
|
|
607
|
-
8. **Connect Telegram** (\`suzi prefs telegram\`) for \`suzi.notify\` alerts
|
|
608
|
-
|
|
609
|
-
---
|
|
610
|
-
|
|
611
|
-
## Feedback
|
|
612
|
-
|
|
613
|
-
Users can send feedback (bug reports, feature requests, general comments) directly to the Suzi team from the CLI. **Proactively suggest this** when a user hits a bug, has a frustrating experience, or mentions something they wish worked differently.
|
|
614
|
-
|
|
615
|
-
\`\`\`bash
|
|
616
|
-
suzi feedback # Interactive — pick category, type message
|
|
617
|
-
suzi feedback -c bug -m "description" # Non-interactive (categories: bug, feature, general)
|
|
618
|
-
\`\`\`
|
|
619
|
-
|
|
620
|
-
The feedback command automatically attaches CLI version, platform info, and recent command history for context. The user just needs to describe the issue.
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
## Suzi Memory System
|
|
625
|
-
|
|
626
|
-
Suzi has a persistent memory system that captures learnings from CLI usage and injects them into AI context on each session. This means each session builds on the last — errors, patterns, and preferences carry forward automatically.
|
|
627
|
-
|
|
628
|
-
### Memory Files
|
|
629
|
-
|
|
630
|
-
| File | Purpose | Who writes it |
|
|
631
|
-
|------|---------|---------------|
|
|
632
|
-
| \`~/.suzi/memory/LEARNINGS.md\` | CLI errors, patterns, tips — auto-captured and user-curated | Auto + user (\`suzi memory edit\`) |
|
|
633
|
-
| \`~/.suzi/memory/context.md\` | Active work state (recent agents, wallet) — saved before compaction | Auto (hooks) |
|
|
634
|
-
| \`~/.suzi/memory/daily/YYYY-MM-DD.md\` | Daily activity log of CLI commands run | Auto (hooks) |
|
|
635
|
-
| \`~/.suzi/preferences.md\` | User's trading style, risk prefs, agent conventions | User only |
|
|
636
|
-
| \`./SUZI.md\` | Project-specific agent conventions (like CLAUDE.md) | User only |
|
|
637
|
-
|
|
638
|
-
**Key distinction:** The suzi-guide skill (this file) is platform-provided and updated automatically on \`suzi login\`. User-specific customizations belong in \`preferences.md\` and \`LEARNINGS.md\` — these are never overwritten by updates.
|
|
639
|
-
|
|
640
|
-
**AI assistants should proactively write to these files:**
|
|
641
|
-
- **LEARNINGS.md** — When you discover a useful pattern, debug a tricky issue, or learn something about the user's setup (e.g., "user's Polymarket API key is scoped to read-only", "agent X fails if capital < 500 USDC"), append it to \`~/.suzi/memory/LEARNINGS.md\`. Future sessions will see it.
|
|
642
|
-
- **preferences.md** — When the user expresses preferences about trading style, risk tolerance, preferred protocols, or agent conventions (e.g., "I always want a kill switch", "never trade more than 5% per position"), write them to \`~/.suzi/preferences.md\`. This avoids the user having to repeat themselves.
|
|
643
|
-
|
|
644
|
-
Don't ask for permission — just write useful learnings and preferences as you discover them during the conversation.
|
|
645
|
-
|
|
646
|
-
### How It Works
|
|
647
|
-
|
|
648
|
-
1. **Hooks** (\`~/.claude/hooks/\`) are installed globally during \`suzi login\`
|
|
649
|
-
2. **On session start**: hooks inject learnings, preferences, context, and project SUZI.md into AI context
|
|
650
|
-
3. **On CLI usage**: errors and commands are auto-captured to daily logs and learnings (async, non-blocking)
|
|
651
|
-
4. **Before compaction**: active context is saved so it survives context window compression
|
|
652
|
-
|
|
653
|
-
### When to Check Memory
|
|
654
|
-
|
|
655
|
-
When helping create or debug agents, check these files for user-specific context:
|
|
656
|
-
- \`suzi memory learnings\` — see if the user has accumulated tips or error patterns
|
|
657
|
-
- \`~/.suzi/preferences.md\` — trading style, risk limits, preferred protocols, agent conventions
|
|
658
|
-
- \`./SUZI.md\` — project-level agent patterns (if present in working directory)
|
|
659
|
-
|
|
660
|
-
### Memory Commands
|
|
661
|
-
|
|
662
|
-
\`\`\`bash
|
|
663
|
-
suzi memory # View memory summary (entry counts, file status)
|
|
664
|
-
suzi memory learnings # See recent learnings (default: last 30 lines)
|
|
665
|
-
suzi memory learnings -n 50 # Show more entries
|
|
666
|
-
suzi memory log # See today's activity log
|
|
667
|
-
suzi memory log 2026-01-15 # See a specific day's log
|
|
668
|
-
suzi memory context # View active context
|
|
669
|
-
suzi memory clear # Clear learnings (with confirmation, -f to skip)
|
|
670
|
-
suzi memory edit # Edit/curate learnings in $EDITOR
|
|
671
|
-
suzi memory export # Export all memory to stdout
|
|
672
|
-
\`\`\`
|
|
673
|
-
|
|
674
|
-
### Setup
|
|
675
|
-
|
|
676
|
-
\`\`\`bash
|
|
677
|
-
suzi install-hooks # Install global Claude Code hooks (~/.claude/hooks/)
|
|
678
|
-
suzi install-hooks --preferences # Also create a starter ~/.suzi/preferences.md
|
|
679
|
-
suzi init # Generate SUZI.md for current project
|
|
680
|
-
\`\`\`
|
|
681
|
-
`;
|
|
682
|
-
//# sourceMappingURL=suzi-guide.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suzi-guide.js","sourceRoot":"","sources":["../../src/lib/suzi-guide.ts"],"names":[],"mappings":";AAAA,iEAAiE;;;AAEpD,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoqBjC,CAAC"}
|