agentlaunch-templates 0.2.8 → 0.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.
Files changed (40) hide show
  1. package/dist/__tests__/build.test.d.ts +12 -0
  2. package/dist/__tests__/build.test.d.ts.map +1 -0
  3. package/dist/__tests__/build.test.js +134 -0
  4. package/dist/__tests__/build.test.js.map +1 -0
  5. package/dist/__tests__/genesis-integration.test.d.ts +12 -0
  6. package/dist/__tests__/genesis-integration.test.d.ts.map +1 -0
  7. package/dist/__tests__/genesis-integration.test.js +143 -0
  8. package/dist/__tests__/genesis-integration.test.js.map +1 -0
  9. package/dist/__tests__/genesis.test.d.ts +16 -0
  10. package/dist/__tests__/genesis.test.d.ts.map +1 -0
  11. package/dist/__tests__/genesis.test.js +312 -0
  12. package/dist/__tests__/genesis.test.js.map +1 -0
  13. package/dist/claude-context.d.ts +51 -1
  14. package/dist/claude-context.d.ts.map +1 -1
  15. package/dist/claude-context.js +722 -10
  16. package/dist/claude-context.js.map +1 -1
  17. package/dist/generator.d.ts +2 -0
  18. package/dist/generator.d.ts.map +1 -1
  19. package/dist/generator.js +21 -9
  20. package/dist/generator.js.map +1 -1
  21. package/dist/index.d.ts +5 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/presets.d.ts +50 -0
  26. package/dist/presets.d.ts.map +1 -0
  27. package/dist/presets.js +194 -0
  28. package/dist/presets.js.map +1 -0
  29. package/dist/registry.d.ts +15 -2
  30. package/dist/registry.d.ts.map +1 -1
  31. package/dist/registry.js +37 -3
  32. package/dist/registry.js.map +1 -1
  33. package/dist/templates/genesis.d.ts +26 -0
  34. package/dist/templates/genesis.d.ts.map +1 -0
  35. package/dist/templates/genesis.js +1197 -0
  36. package/dist/templates/genesis.js.map +1 -0
  37. package/dist/templates/gifter.d.ts.map +1 -1
  38. package/dist/templates/gifter.js +7 -3
  39. package/dist/templates/gifter.js.map +1 -1
  40. package/package.json +2 -1
@@ -37,16 +37,23 @@ GET /tokens/address/{address} Token details by address
37
37
  GET /tokens/id/{id} Token details by ID
38
38
  GET /tokens/calculate-buy Preview buy
39
39
  GET /tokens/calculate-sell Preview sell
40
+ GET /agents/my-agents List your agents
41
+ GET /agents/token/{address}/holders Token holder list
42
+ POST /agents/auth Exchange API key for JWT
43
+ GET /comments/{address} Get comments
44
+ POST /comments/{address} Post comment
40
45
  GET /platform/stats Platform statistics
41
46
  \`\`\`
42
47
 
43
48
  ## Handoff Protocol
44
49
 
45
- Agents NEVER hold private keys. Flow:
50
+ Token deployment requires a human signature:
46
51
  1. Agent calls API to create token record
47
52
  2. API returns handoff link
48
53
  3. Agent shares link with human
49
54
  4. Human signs transaction
55
+
56
+ Once deployed, agents CAN trade autonomously via HoldingsManager + BSC_PRIVATE_KEY.
50
57
  `,
51
58
  "agentverse.md": `# Agentverse Deployment Rules
52
59
 
@@ -80,6 +87,8 @@ payload = {"code": json.dumps(code_array)}
80
87
  `,
81
88
  "uagent-patterns.md": `# uAgent Code Patterns
82
89
 
90
+ > For new agents, use the genesis template: \`agentlaunch scaffold myagent --type genesis\`
91
+
83
92
  ## Minimal Working Agent
84
93
 
85
94
  \`\`\`python
@@ -118,6 +127,116 @@ agent.include(chat_proto, publish_manifest=True)
118
127
  if __name__ == "__main__":
119
128
  agent.run()
120
129
  \`\`\`
130
+
131
+ ## Payment Protocol (Official)
132
+
133
+ \`\`\`python
134
+ from uagents_core.contrib.protocols.payment import (
135
+ RequestPayment, CommitPayment, CompletePayment,
136
+ RejectPayment, CancelPayment, Funds, payment_protocol_spec,
137
+ )
138
+
139
+ # Seller (service provider)
140
+ seller_proto = agent.create_protocol(spec=payment_protocol_spec, role="seller")
141
+
142
+ # Buyer (service consumer)
143
+ buyer_proto = agent.create_protocol(spec=payment_protocol_spec, role="buyer")
144
+ \`\`\`
145
+
146
+ ## Commerce Layer (Genesis Template)
147
+
148
+ The genesis template includes inline commerce classes:
149
+ - PaymentService: Charge callers, pay other agents
150
+ - PricingTable: Per-service pricing from ctx.storage
151
+ - TierManager: Token-gated access (free/premium)
152
+ - WalletManager: Balance queries, fund alerts
153
+ - RevenueTracker: Income/expense logging
154
+ - SelfAwareMixin: Token price/holder awareness
155
+ - HoldingsManager: Buy/sell other agents' tokens
156
+ `,
157
+ "payment-protocol.md": `# Payment Protocol Rules
158
+
159
+ ## Official Imports (uagents_core)
160
+
161
+ \`\`\`python
162
+ from uagents_core.contrib.protocols.payment import (
163
+ RequestPayment,
164
+ CommitPayment,
165
+ CompletePayment,
166
+ RejectPayment,
167
+ CancelPayment,
168
+ Funds,
169
+ payment_protocol_spec,
170
+ )
171
+ \`\`\`
172
+
173
+ ## Role-Based Protocol Creation
174
+
175
+ \`\`\`python
176
+ # Seller (service provider)
177
+ seller_proto = agent.create_protocol(spec=payment_protocol_spec, role="seller")
178
+
179
+ # Buyer (service consumer)
180
+ buyer_proto = agent.create_protocol(spec=payment_protocol_spec, role="buyer")
181
+ \`\`\`
182
+
183
+ ## Payment Flow
184
+
185
+ Buyer sends ChatMessage -> Seller sends RequestPayment -> Buyer sends CommitPayment (tx_hash) -> Seller verifies on-chain -> Seller sends CompletePayment.
186
+
187
+ ## Denomination
188
+
189
+ - Testnet: atestfet (1 FET = 10^18 atestfet)
190
+ - Mainnet: afet (1 FET = 10^18 afet)
191
+
192
+ ## Error Handling
193
+
194
+ - Always handle RejectPayment -- buyer may decline
195
+ - Always handle CancelPayment -- timeout or cancellation
196
+ - Verify tx_hash on-chain before delivering service
197
+ - Store transaction log in ctx.storage
198
+
199
+ ## Genesis Template Commerce Layers
200
+
201
+ The genesis template includes these commerce classes inline:
202
+ - PaymentService, PricingTable, TierManager
203
+ - WalletManager, RevenueTracker, SelfAwareMixin, HoldingsManager
204
+ `,
205
+ "genesis-network.md": `# Genesis Network Rules
206
+
207
+ ## The 7 Roles
208
+
209
+ | Role | Token | Services | Price/call |
210
+ |------|-------|----------|-----------|
211
+ | Oracle | $DATA | price_feed, ohlc_history, market_summary | 0.001 FET |
212
+ | Brain | $THINK | reason, classify, summarize | 0.01 FET |
213
+ | Analyst | $RANK | score_token, evaluate_quality, rank_tokens | 0.005 FET |
214
+ | Coordinator | $COORD | route_query, discover_agents | 0.0005 FET |
215
+ | Sentinel | $WATCH | monitor, alert, anomaly_report | 0.002 FET |
216
+ | Launcher | $BUILD | find_gap, scaffold_agent, deploy_recommendation | 0.02 FET |
217
+ | Scout | $FIND | discover_agents, evaluate_agent, tokenize_recommendation | 0.01 FET |
218
+
219
+ ## Build Order
220
+
221
+ Oracle -> Coordinator -> Analyst -> Sentinel -> Brain -> Launcher -> Scout
222
+
223
+ ## Starter Configurations
224
+
225
+ - Minimum viable: Oracle + Coordinator (2 agents)
226
+ - Intelligence: Oracle + Brain + Coordinator (3 agents)
227
+ - Monitoring: Oracle + Analyst + Sentinel + Coordinator (4 agents)
228
+ - Full Genesis: All 7
229
+
230
+ ## Cross-Holdings
231
+
232
+ Agents buy each other's tokens for economic alignment.
233
+
234
+ ## Token Lifecycle
235
+
236
+ 1. Deploy on Agentverse
237
+ 2. Tokenize on AgentLaunch (120 FET deploy fee)
238
+ 3. Bonding curve active (2% fee to protocol treasury, NO creator fee)
239
+ 4. At 30,000 FET -> auto DEX listing (graduation)
121
240
  `,
122
241
  "api-design.md": `# API Design Rules
123
242
 
@@ -187,6 +306,32 @@ Build, deploy, and tokenize an agent in one guided flow.
187
306
  ## Platform Fees
188
307
  - Deploy: 120 FET (paid by human signer)
189
308
  - Trading: 2% to protocol treasury
309
+ `,
310
+ "build-swarm/SKILL.md": `# /build-swarm — Deploy Agent Swarm
311
+
312
+ Scaffold, deploy, and tokenize a multi-agent swarm with the genesis template.
313
+
314
+ ## Steps
315
+
316
+ 1. Ask user what swarm they want (name, roles, purpose)
317
+ 2. Show the 7 available presets: oracle, brain, analyst, coordinator, sentinel, launcher, scout
318
+ 3. Let user pick roles (or suggest a starter configuration)
319
+ 4. For each role:
320
+ a. Scaffold from genesis template with preset variables
321
+ b. Deploy to Agentverse
322
+ c. Tokenize on AgentLaunch
323
+ 5. Return handoff links for each agent
324
+
325
+ ## Starter Configurations
326
+
327
+ - Minimum viable: Oracle + Coordinator (2 agents)
328
+ - Intelligence: Oracle + Brain + Coordinator (3 agents)
329
+ - Monitoring: Oracle + Analyst + Sentinel + Coordinator (4 agents)
330
+ - Full Genesis: All 7
331
+
332
+ ## Platform Fees
333
+ - Deploy: 120 FET per agent (paid by human signer)
334
+ - Trading: 2% to protocol treasury (NO creator fee)
190
335
  `,
191
336
  "deploy/SKILL.md": `# /deploy — Deploy to Agentverse
192
337
 
@@ -256,8 +401,12 @@ export const DOCS = {
256
401
  # Set API key
257
402
  export AGENTVERSE_API_KEY=av-xxx
258
403
 
259
- # Create agent project
260
- npx agentlaunch-cli create
404
+ # Create agent project (genesis template recommended)
405
+ npx agentlaunch-cli create --type genesis
406
+
407
+ # Or deploy a full swarm
408
+ npx agentlaunch-cli create --type genesis --preset oracle
409
+ npx agentlaunch-cli create --type genesis --preset brain
261
410
 
262
411
  # Or use SDK
263
412
  npm install agentlaunch-sdk
@@ -265,16 +414,18 @@ npm install agentlaunch-sdk
265
414
 
266
415
  ## The Agent-Human Handoff
267
416
 
268
- Agents never hold private keys:
417
+ Token deployment requires a human signature:
269
418
  1. Agent calls API -> gets handoff link
270
419
  2. Agent shares link with human
271
420
  3. Human opens link, connects wallet, signs
272
421
  4. Token goes live
273
422
 
423
+ Agents CAN trade autonomously after deployment using HoldingsManager + BSC_PRIVATE_KEY.
424
+
274
425
  ## Platform Constants
275
426
  - Deploy fee: 120 FET
276
427
  - Graduation: 30,000 FET -> DEX listing
277
- - Trading fee: 2% to protocol
428
+ - Trading fee: 2% to protocol treasury (NO creator fee)
278
429
  `,
279
430
  "sdk-reference.md": `# SDK Reference
280
431
 
@@ -295,6 +446,13 @@ import {
295
446
  generateBuyLink, // Create buy URL
296
447
  generateSellLink, // Create sell URL
297
448
  deployAgent, // Deploy to Agentverse
449
+ getAgentRevenue, // Get agent revenue data
450
+ getPricingTable, // Get agent pricing table
451
+ getNetworkGDP, // Get swarm GDP metrics
452
+ listStorage, // List agent storage keys
453
+ getStorage, // Get agent storage value
454
+ putStorage, // Set agent storage value
455
+ deleteStorage, // Delete agent storage key
298
456
  } from 'agentlaunch-sdk';
299
457
  \`\`\`
300
458
 
@@ -348,7 +506,8 @@ Already configured in \`.claude/settings.json\`.
348
506
 
349
507
  | Tool | Description |
350
508
  |------|-------------|
351
- | \`scaffold_agent\` | Generate agent code |
509
+ | \`scaffold_agent\` | Generate agent code from template |
510
+ | \`scaffold_genesis\` | Scaffold agent from genesis preset |
352
511
  | \`deploy_to_agentverse\` | Deploy agent |
353
512
  | \`create_token_record\` | Create token |
354
513
  | \`list_tokens\` | Browse tokens |
@@ -356,6 +515,9 @@ Already configured in \`.claude/settings.json\`.
356
515
  | \`calculate_buy\` | Preview buy |
357
516
  | \`calculate_sell\` | Preview sell |
358
517
  | \`get_trade_link\` | Generate trade URL |
518
+ | \`check_agent_commerce\` | Revenue, pricing, balance for an agent |
519
+ | \`network_status\` | Swarm GDP, per-agent health |
520
+ | \`deploy_swarm\` | Deploy multiple agents as a swarm |
359
521
 
360
522
  ## Example Prompts
361
523
 
@@ -363,6 +525,8 @@ Already configured in \`.claude/settings.json\`.
363
525
  - "Deploy my agent to Agentverse"
364
526
  - "Tokenize my agent as $MYTOKEN"
365
527
  - "Show trending tokens"
528
+ - "Deploy an Oracle + Brain + Analyst swarm"
529
+ - "Check my swarm's GDP"
366
530
  `,
367
531
  };
368
532
  // ---------------------------------------------------------------------------
@@ -395,7 +559,7 @@ watches = {}
395
559
 
396
560
  def fetch_price(token_address: str) -> float | None:
397
561
  try:
398
- r = requests.get(f"{API_URL}/agents/token/{token_address}", timeout=10)
562
+ r = requests.get(f"{API_URL}/tokens/address/{token_address}", timeout=10)
399
563
  if r.ok:
400
564
  return float(r.json().get("price", 0))
401
565
  except:
@@ -465,7 +629,7 @@ price_history = {}
465
629
 
466
630
  def get_signal(addr: str) -> str:
467
631
  try:
468
- r = requests.get(f"{API_URL}/agents/token/{addr}", timeout=10)
632
+ r = requests.get(f"{API_URL}/tokens/address/{addr}", timeout=10)
469
633
  if r.ok:
470
634
  data = r.json()
471
635
  price = float(data.get("price", 0))
@@ -541,7 +705,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN", "")
541
705
 
542
706
  def get_token_data(addr: str) -> dict:
543
707
  try:
544
- r = requests.get(f"{API_URL}/agents/token/{addr}", timeout=10)
708
+ r = requests.get(f"{API_URL}/tokens/address/{addr}", timeout=10)
545
709
  if r.ok:
546
710
  return r.json()
547
711
  except:
@@ -647,6 +811,106 @@ export function buildPackageJson(name) {
647
811
  }, null, 2) + "\n";
648
812
  }
649
813
  // ---------------------------------------------------------------------------
814
+ // CLAUDE.md builder for scaffolded projects
815
+ // ---------------------------------------------------------------------------
816
+ export function buildClaudeMd(name) {
817
+ return `# ${name} — AgentLaunch Agent
818
+
819
+ ## What This Is
820
+
821
+ An AI agent built with the AgentLaunch Toolkit. It runs on Agentverse and
822
+ has a tradeable ERC-20 token on the bonding curve.
823
+
824
+ ## Authentication
825
+
826
+ **The Agentverse API key is already configured in \`.env\`** — do NOT ask the user for it again.
827
+ To deploy or tokenize, simply run the commands below. The SDK and CLI read from \`.env\` automatically.
828
+
829
+ ## Templates
830
+
831
+ | Template | Description | Use Case |
832
+ |----------|-------------|----------|
833
+ | \`genesis\` | **Full commerce stack** (recommended) | Any agent that charges for services |
834
+ | \`custom\` | Blank Chat Protocol boilerplate | Start from scratch |
835
+ | \`price-monitor\` | Watch token prices, send alerts | Monitoring service |
836
+ | \`trading-bot\` | Buy/sell signal generation | Trading service |
837
+ | \`data-analyzer\` | On-chain data analysis | Analytics service |
838
+ | \`research\` | Deep dives and reports | Research service |
839
+ | \`gifter\` | Treasury wallet + rewards | Community incentives |
840
+
841
+ ## Agent Swarms
842
+
843
+ The genesis template generates agents with a complete commerce stack:
844
+ - PaymentService, PricingTable, TierManager (charge for services)
845
+ - WalletManager, RevenueTracker (track revenue)
846
+ - SelfAwareMixin (token price awareness)
847
+ - HoldingsManager (buy/sell other tokens)
848
+
849
+ ### Presets
850
+ 7 pre-configured roles: oracle, brain, analyst, coordinator, sentinel, launcher, scout.
851
+ Use presets for instant configuration.
852
+
853
+ ## Quick Commands
854
+
855
+ - \`npm run deploy\` — Deploy to Agentverse
856
+ - \`npm run tokenize\` — Create token + handoff link
857
+ - \`npm run status\` — Check status
858
+
859
+ ## Key Files
860
+
861
+ - \`agent.py\` — Your agent code (edit this!)
862
+ - \`CLAUDE.md\` — This file
863
+ - \`docs/\` — SDK, CLI, MCP documentation
864
+ - \`examples/\` — Working code samples
865
+
866
+ ## SDK Reference
867
+
868
+ \`\`\`typescript
869
+ import {
870
+ tokenize, // Create token record
871
+ getToken, // Get token details
872
+ listTokens, // List all tokens
873
+ getTokenPrice, // Get current price
874
+ getTokenHolders, // Get holder list
875
+ generateDeployLink, // Create deploy URL
876
+ generateBuyLink, // Create buy URL
877
+ generateSellLink, // Create sell URL
878
+ deployAgent, // Deploy to Agentverse
879
+ getAgentRevenue, // Get agent revenue data
880
+ getPricingTable, // Get agent pricing table
881
+ getNetworkGDP, // Get swarm GDP metrics
882
+ listStorage, // List agent storage keys
883
+ getStorage, // Get agent storage value
884
+ putStorage, // Set agent storage value
885
+ deleteStorage, // Delete agent storage key
886
+ } from 'agentlaunch-sdk';
887
+ \`\`\`
888
+
889
+ ## MCP Tools
890
+
891
+ | Tool | Description |
892
+ |------|-------------|
893
+ | \`scaffold_agent\` | Generate agent code from template |
894
+ | \`scaffold_genesis\` | Scaffold agent from genesis preset |
895
+ | \`deploy_to_agentverse\` | Deploy agent |
896
+ | \`create_token_record\` | Create token |
897
+ | \`list_tokens\` | Browse tokens |
898
+ | \`get_token\` | Token details |
899
+ | \`calculate_buy\` | Preview buy |
900
+ | \`calculate_sell\` | Preview sell |
901
+ | \`get_trade_link\` | Generate trade URL |
902
+ | \`check_agent_commerce\` | Revenue, pricing, balance for an agent |
903
+ | \`network_status\` | Swarm GDP, per-agent health |
904
+ | \`deploy_swarm\` | Deploy multiple agents as a swarm |
905
+
906
+ ## Platform Constants
907
+
908
+ - Deploy fee: 120 FET
909
+ - Graduation: 30,000 FET liquidity -> auto DEX listing
910
+ - Trading fee: 2% to protocol treasury (NO creator fee)
911
+ `;
912
+ }
913
+ // ---------------------------------------------------------------------------
650
914
  // Cursor IDE config
651
915
  // ---------------------------------------------------------------------------
652
916
  export const CURSOR_MCP_CONFIG = JSON.stringify({
@@ -677,10 +941,458 @@ This is an AgentLaunch agent project. Use the MCP tools to build, deploy, and to
677
941
  - \`docs/\` - SDK, CLI, MCP documentation
678
942
  - \`examples/\` - Working code samples
679
943
 
944
+ ## Genesis Template (Recommended)
945
+
946
+ Use the genesis template for agents with a full commerce stack:
947
+ - Payment handling, pricing tables, revenue tracking
948
+ - Token-gated tiers, wallet management
949
+ - 7 presets: oracle, brain, analyst, coordinator, sentinel, launcher, scout
950
+
680
951
  ## Platform Constants
681
952
 
682
953
  - Deploy fee: 120 FET
683
954
  - Graduation: 30,000 FET liquidity
684
- - Trading fee: 2% to protocol treasury
955
+ - Trading fee: 2% to protocol treasury (NO creator fee)
956
+ `;
957
+ /**
958
+ * Builds a CLAUDE.md for deployed agents (single or swarm).
959
+ * This gives Claude Code full context about what was deployed.
960
+ */
961
+ export function buildSwarmClaudeMd(ctx) {
962
+ const isSingleAgent = ctx.agents.length === 1;
963
+ const presetDescriptions = {
964
+ oracle: "Market data provider — price feeds, OHLC history, market summaries (0.001 FET/call)",
965
+ brain: "LLM reasoning engine — query classification, summarization, deep analysis (0.01 FET/call)",
966
+ analyst: "Token scoring engine — quality evaluation, risk assessment, ranking (0.005 FET/call)",
967
+ coordinator: "Query router — discovers agents, routes queries to specialists (0.0005 FET/call)",
968
+ sentinel: "Real-time watchdog — monitors tokens, detects anomalies, sends alerts (0.002 FET/call)",
969
+ launcher: "Gap finder — discovers unmet needs, scaffolds new agents (0.02 FET/call)",
970
+ scout: "Agent scout — discovers promising agents, evaluates quality (0.01 FET/call)",
971
+ };
972
+ if (isSingleAgent) {
973
+ const agent = ctx.agents[0];
974
+ const desc = presetDescriptions[agent.preset] || agent.preset;
975
+ return `# ${ctx.swarmName}
976
+
977
+ ## Your Agent
978
+
979
+ | Field | Value |
980
+ |-------|-------|
981
+ | **Name** | ${agent.name} |
982
+ | **Type** | ${agent.preset.charAt(0).toUpperCase() + agent.preset.slice(1)} |
983
+ | **Address** | \`${agent.address}\` |
984
+ | **Status** | ${agent.status} |
985
+
986
+ **What it does:** ${desc}
987
+
988
+ ## Project Structure
989
+
990
+ \`\`\`
991
+ ${ctx.swarmName}/
992
+ agent.py # Your agent code (edit this!)
993
+ CLAUDE.md # This file
994
+ agentlaunch.config.json
995
+ .env # API key (already configured)
996
+ .claude/ # Claude Code settings
997
+ docs/ # Documentation
998
+ \`\`\`
999
+
1000
+ ## What's Already Done
1001
+
1002
+ 1. **Agent deployed** — Running on Agentverse at \`${agent.address}\`
1003
+ 2. **Commerce ready** — Has pricing built in (${desc.split('—')[1]?.trim() || 'charges for services'})
1004
+ 3. **API key set** — Your Agentverse API key is in \`.env\`
1005
+
1006
+ ## Next Steps
1007
+
1008
+ ### 1. Tokenize your agent (so you can earn from trading)
1009
+ \`\`\`bash
1010
+ agentlaunch tokenize --agent ${agent.address} --name "${agent.name}" --symbol "${agent.preset.slice(0, 4).toUpperCase()}"
1011
+ \`\`\`
1012
+ You'll get a handoff link. Share it with someone who has a wallet to pay the 120 FET deploy fee.
1013
+
1014
+ ### 2. Customize pricing
1015
+ Edit \`agent.py\` and look for the \`PRICING\` section. Adjust prices based on value you provide.
1016
+
1017
+ ### 3. Check status
1018
+ \`\`\`bash
1019
+ agentlaunch status ${agent.address}
1020
+ \`\`\`
1021
+
1022
+ ## What Makes an Agent Valuable?
1023
+
1024
+ Agents earn fees when they provide **real value**:
1025
+ - **Data providers** (Oracle): Sell accurate, timely market data
1026
+ - **AI services** (Brain): Sell quality reasoning and analysis
1027
+ - **Infrastructure** (Coordinator): Become the routing layer other agents depend on
1028
+
1029
+ The more agents that depend on yours, the more fees you earn. Consider:
1030
+ 1. What unique data or capability do you have?
1031
+ 2. Who would pay for it?
1032
+ 3. How can you make other agents need your service?
1033
+
1034
+ ## Quick Diagnostics
1035
+
1036
+ \`\`\`bash
1037
+ # Is your agent running?
1038
+ agentlaunch status ${agent.address}
1039
+
1040
+ # Verify API key is set
1041
+ echo "Key: $AGENTVERSE_API_KEY" | head -c 20
1042
+
1043
+ # List all your agents
1044
+ agentlaunch list
1045
+ \`\`\`
1046
+
1047
+ ## MCP Tools Available
1048
+
1049
+ Type \`/\` in Claude Code to access these skills:
1050
+ - \`/deploy\` — Deploy or redeploy your agent
1051
+ - \`/tokenize\` — Create a tradeable token
1052
+ - \`/status\` — Check agent status
1053
+ - \`/market\` — Browse tokens on AgentLaunch
1054
+
1055
+ Or use MCP tools directly:
1056
+ - \`scaffold_agent\` — Generate agent code
1057
+ - \`deploy_to_agentverse\` — Deploy to Agentverse
1058
+ - \`create_token_record\` — Tokenize an agent
1059
+ - \`calculate_buy\` / \`calculate_sell\` — Preview trades
1060
+ - \`check_agent_commerce\` — Revenue and pricing info
1061
+
1062
+ ## Platform Constants
1063
+
1064
+ - Deploy fee: **120 FET** (paid when tokenizing)
1065
+ - Graduation: **30,000 FET** liquidity → auto DEX listing
1066
+ - Trading fee: **2%** → 100% to protocol treasury (no creator fee)
685
1067
  `;
1068
+ }
1069
+ // Multi-agent swarm
1070
+ const agentTable = ctx.agents
1071
+ .map((a) => `| ${a.preset} | \`${a.address}\` | ${a.status} |`)
1072
+ .join("\n");
1073
+ const addressList = ctx.agents
1074
+ .map((a) => `${a.preset.toUpperCase()}_ADDRESS=${a.address}`)
1075
+ .join("\n");
1076
+ const roleDetails = ctx.agents
1077
+ .map((a) => {
1078
+ const desc = presetDescriptions[a.preset] || a.preset;
1079
+ return `### ${a.preset.charAt(0).toUpperCase() + a.preset.slice(1)}
1080
+
1081
+ - **Address:** \`${a.address}\`
1082
+ - **Status:** ${a.status}
1083
+ - **Description:** ${desc}
1084
+ - **Code:** \`agents/${a.preset}.py\``;
1085
+ })
1086
+ .join("\n\n");
1087
+ return `# ${ctx.swarmName} — Agent Swarm
1088
+
1089
+ ## What This Is
1090
+
1091
+ A deployed multi-agent swarm on the Fetch.ai Agentverse platform.
1092
+ Deployed at: ${ctx.deployedAt}
1093
+
1094
+ ## Deployed Agents
1095
+
1096
+ | Role | Address | Status |
1097
+ |------|---------|--------|
1098
+ ${agentTable}
1099
+
1100
+ ## Agent Roles
1101
+
1102
+ ${roleDetails}
1103
+
1104
+ ## Peer Addresses
1105
+
1106
+ These environment variables are set as secrets on each agent so they can communicate:
1107
+
1108
+ \`\`\`bash
1109
+ ${addressList}
1110
+ \`\`\`
1111
+
1112
+ ## Project Structure
1113
+
1114
+ \`\`\`
1115
+ ${ctx.swarmName}/
1116
+ CLAUDE.md # This file (swarm context)
1117
+ agentlaunch.config.json # Swarm configuration with all addresses
1118
+ .env # API key (already configured)
1119
+ agents/ # Individual agent code
1120
+ ${ctx.agents.map((a) => ` ${a.preset}.py`).join("\n")}
1121
+ .claude/ # Claude Code settings
1122
+ settings.json # MCP server config
1123
+ rules/ # Coding guidelines
1124
+ skills/ # Slash commands
1125
+ docs/ # SDK, CLI, MCP documentation
1126
+ examples/ # Working code samples
1127
+ \`\`\`
1128
+
1129
+ ## What's Already Done
1130
+
1131
+ 1. **Agents deployed** — All ${ctx.agents.length} agents are running on Agentverse
1132
+ 2. **Secrets configured** — Each agent knows its peers' addresses
1133
+ 3. **API key set** — Your Agentverse API key is in \`.env\`
1134
+
1135
+ ## Next Steps
1136
+
1137
+ ### 1. Verify agents are running
1138
+ \`\`\`bash
1139
+ agentlaunch status ${ctx.agents[0]?.address || "<address>"}
1140
+ \`\`\`
1141
+
1142
+ ### 2. Tokenize an agent
1143
+ \`\`\`bash
1144
+ agentlaunch tokenize \\
1145
+ --agent ${ctx.agents[0]?.address || "<address>"} \\
1146
+ --name "${ctx.agents[0]?.name || "AgentName"}" \\
1147
+ --symbol "${ctx.agents[0]?.preset?.slice(0, 4).toUpperCase() || "SYMB"}"
1148
+ \`\`\`
1149
+
1150
+ You'll receive a handoff link. Share it with someone who has a wallet to deploy the token on-chain (120 FET fee).
1151
+
1152
+ ### 3. Customize agent behavior
1153
+ Edit the code in \`agents/<role>.py\` and redeploy:
1154
+ \`\`\`bash
1155
+ agentlaunch deploy --code agents/oracle.py --address ${ctx.agents.find((a) => a.preset === "oracle")?.address || "<oracle-address>"}
1156
+ \`\`\`
1157
+
1158
+ ### 4. Monitor the swarm
1159
+ \`\`\`bash
1160
+ agentlaunch list # See all your tokens
1161
+ \`\`\`
1162
+
1163
+ ## Quick Diagnostics
1164
+
1165
+ \`\`\`bash
1166
+ # Check all agents' status
1167
+ ${ctx.agents.map((a) => `agentlaunch status ${a.address} # ${a.preset}`).join("\n")}
1168
+
1169
+ # Verify API key
1170
+ echo "Key: $AGENTVERSE_API_KEY" | head -c 20
1171
+
1172
+ # List all tokens you own
1173
+ agentlaunch list
1174
+ \`\`\`
1175
+
1176
+ ## What Makes a Swarm Valuable?
1177
+
1178
+ Swarms earn fees when agents **depend on each other**:
1179
+ - **Oracle** sells data → Brain, Analyst, Sentinel buy it
1180
+ - **Brain** sells reasoning → Coordinator, Launcher buy it
1181
+ - **Coordinator** routes queries → Everyone pays routing fees
1182
+
1183
+ The more interconnections, the more fees flow. Your agents should:
1184
+ 1. Provide unique, high-quality services
1185
+ 2. Consume services from other agents in the swarm
1186
+ 3. Become infrastructure that external agents depend on
1187
+
1188
+ ## Platform Constants
1189
+
1190
+ - Deploy fee: **120 FET** (paid when tokenizing)
1191
+ - Graduation: **30,000 FET** liquidity → auto DEX listing
1192
+ - Trading fee: **2%** → 100% to protocol treasury (no creator fee)
1193
+
1194
+ ## Skills & MCP Tools
1195
+
1196
+ Type \`/\` in Claude Code for skills:
1197
+ - \`/deploy\` — Deploy or redeploy an agent
1198
+ - \`/tokenize\` — Create a tradeable token
1199
+ - \`/status\` — Check agent status
1200
+ - \`/market\` — Browse tokens
1201
+
1202
+ MCP tools available:
1203
+ - \`list_tokens\` — Browse all tokens
1204
+ - \`get_token\` — Get details for a specific token
1205
+ - \`calculate_buy\` / \`calculate_sell\` — Preview trades
1206
+ - \`create_token_record\` — Tokenize an agent
1207
+ - \`deploy_to_agentverse\` — Deploy code updates
1208
+ - \`check_agent_commerce\` — Revenue, pricing, balance
1209
+ - \`network_status\` — Swarm GDP, per-agent health
1210
+
1211
+ ## Resources
1212
+
1213
+ - [AgentLaunch Platform](https://agent-launch.ai)
1214
+ - [Agentverse](https://agentverse.ai)
1215
+ - [Your Agents](https://agentverse.ai/agents)
1216
+ `;
1217
+ }
1218
+ /**
1219
+ * Builds agentlaunch.config.json for a deployed swarm.
1220
+ */
1221
+ export function buildSwarmConfig(ctx) {
1222
+ const agents = {};
1223
+ for (const a of ctx.agents) {
1224
+ agents[a.preset] = { address: a.address, status: a.status };
1225
+ }
1226
+ return JSON.stringify({
1227
+ name: ctx.swarmName,
1228
+ type: "swarm",
1229
+ chain: 97,
1230
+ deployedAt: ctx.deployedAt,
1231
+ agents,
1232
+ peerAddresses: ctx.peerAddresses,
1233
+ }, null, 2) + "\n";
1234
+ }
1235
+ /**
1236
+ * Builds package.json for a deployed swarm.
1237
+ */
1238
+ export function buildSwarmPackageJson(swarmName) {
1239
+ return JSON.stringify({
1240
+ name: swarmName.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
1241
+ version: "1.0.0",
1242
+ description: `${swarmName} - AgentLaunch Swarm`,
1243
+ scripts: {
1244
+ status: "agentlaunch status",
1245
+ list: "agentlaunch list",
1246
+ tokenize: "agentlaunch tokenize",
1247
+ },
1248
+ dependencies: {
1249
+ "agentlaunch-sdk": "^0.2.0",
1250
+ },
1251
+ devDependencies: {
1252
+ "agentlaunch-cli": "^1.1.0",
1253
+ },
1254
+ }, null, 2) + "\n";
1255
+ }
1256
+ /**
1257
+ * Generates a tokenize skill specific to an agent.
1258
+ */
1259
+ export function buildTokenizeSkill(agent) {
1260
+ const symbol = agent.symbol || agent.preset.slice(0, 4).toUpperCase();
1261
+ return `# /tokenize-${agent.preset}
1262
+
1263
+ Create a tradeable token for your ${agent.preset} agent.
1264
+
1265
+ ## Your Agent
1266
+
1267
+ - **Name:** ${agent.name}
1268
+ - **Address:** \`${agent.address}\`
1269
+ - **Suggested Symbol:** ${symbol}
1270
+
1271
+ ## Command
1272
+
1273
+ Run this to create a token:
1274
+
1275
+ \`\`\`bash
1276
+ agentlaunch tokenize \\
1277
+ --agent ${agent.address} \\
1278
+ --name "${agent.name}" \\
1279
+ --symbol "${symbol}"
1280
+ \`\`\`
1281
+
1282
+ ## What Happens
1283
+
1284
+ 1. CLI creates a token record on AgentLaunch
1285
+ 2. You get a **handoff link**
1286
+ 3. Share the link with someone who has a wallet
1287
+ 4. They pay 120 FET to deploy the token on-chain
1288
+ 5. Your agent now has a tradeable token!
1289
+
1290
+ ## After Tokenization
1291
+
1292
+ - Token trades on a bonding curve (price goes up as people buy)
1293
+ - At 30,000 FET liquidity, it auto-lists on DEX
1294
+ - 2% trading fee goes to protocol (no creator fee)
1295
+
1296
+ ## Pro Tips
1297
+
1298
+ - Pick a memorable symbol (3-5 chars)
1299
+ - Write a good description — it shows on the token page
1300
+ - The first buyers get the best price (bonding curve)
1301
+ `;
1302
+ }
1303
+ /**
1304
+ * Generates a status skill specific to an agent.
1305
+ */
1306
+ export function buildStatusSkill(agent) {
1307
+ return `# /status-${agent.preset}
1308
+
1309
+ Check the status of your ${agent.preset} agent.
1310
+
1311
+ ## Your Agent
1312
+
1313
+ - **Name:** ${agent.name}
1314
+ - **Address:** \`${agent.address}\`
1315
+
1316
+ ## Commands
1317
+
1318
+ ### Check if running
1319
+ \`\`\`bash
1320
+ agentlaunch status ${agent.address}
1321
+ \`\`\`
1322
+
1323
+ ### View logs (if issues)
1324
+ \`\`\`bash
1325
+ # Via Agentverse dashboard
1326
+ open "https://agentverse.ai/agents/local/${agent.address}/logs"
1327
+ \`\`\`
1328
+
1329
+ ### Restart if stuck
1330
+ \`\`\`bash
1331
+ agentlaunch deploy --address ${agent.address}
1332
+ \`\`\`
1333
+
1334
+ ## Common Issues
1335
+
1336
+ - **"compiling" for >60s** — Check logs for syntax errors
1337
+ - **"stopped"** — Redeploy with \`agentlaunch deploy\`
1338
+ - **No responses** — Verify Chat Protocol handlers are correct
1339
+ `;
1340
+ }
1341
+ /**
1342
+ * Generates a redeploy skill specific to an agent.
1343
+ */
1344
+ export function buildRedeploySkill(agent, isSingleAgent) {
1345
+ const codePath = isSingleAgent ? "agent.py" : `agents/${agent.preset}.py`;
1346
+ return `# /redeploy-${agent.preset}
1347
+
1348
+ Redeploy your ${agent.preset} agent after making changes.
1349
+
1350
+ ## Your Agent
1351
+
1352
+ - **Name:** ${agent.name}
1353
+ - **Address:** \`${agent.address}\`
1354
+ - **Code:** \`${codePath}\`
1355
+
1356
+ ## Command
1357
+
1358
+ After editing ${codePath}, run:
1359
+
1360
+ \`\`\`bash
1361
+ agentlaunch deploy --code ${codePath} --address ${agent.address}
1362
+ \`\`\`
1363
+
1364
+ ## What Gets Updated
1365
+
1366
+ - Agent code (the Python file)
1367
+ - Dependencies are reinstalled
1368
+ - Agent restarts automatically
1369
+
1370
+ ## What Does NOT Change
1371
+
1372
+ - Agent address (stays the same)
1373
+ - Secrets (already configured)
1374
+ - Token (if tokenized)
1375
+
1376
+ ## Workflow
1377
+
1378
+ 1. Edit \`${codePath}\`
1379
+ 2. Run the deploy command above
1380
+ 3. Wait 15-60s for compilation
1381
+ 4. Check status: \`agentlaunch status ${agent.address}\`
1382
+ `;
1383
+ }
1384
+ /**
1385
+ * Generates all project-specific skills for an agent.
1386
+ * Returns a map of filepath -> content.
1387
+ */
1388
+ export function buildProjectSkills(agents, isSingleAgent) {
1389
+ const skills = {};
1390
+ for (const agent of agents) {
1391
+ const prefix = agent.preset;
1392
+ skills[`tokenize-${prefix}/SKILL.md`] = buildTokenizeSkill(agent);
1393
+ skills[`status-${prefix}/SKILL.md`] = buildStatusSkill(agent);
1394
+ skills[`redeploy-${prefix}/SKILL.md`] = buildRedeploySkill(agent, isSingleAgent);
1395
+ }
1396
+ return skills;
1397
+ }
686
1398
  //# sourceMappingURL=claude-context.js.map