feat: add OpenClaw trading agents multi-agent debate system
All checks were successful
continuous-integration/drone/push Build is passing

- 5 analysis skills: trade-analyze (orchestrator), market-analysis,
  fundamental-analysis, sentiment-analysis, macro-analysis
- 4 debate agent personas (SOUL.md): invest-bull, invest-bear,
  invest-hawk, invest-dove
- 5 agent operating instructions (AGENTS.md) including invest-analyst
- Deploy script for pushing to remote OpenClaw server
- Uses sessions_spawn for non-blocking agent delegation
- invest-analyst collects data via API, spawns debate agents,
  synthesizes final BUY/SELL/HOLD verdict
This commit is contained in:
Yaojia Wang
2026-03-21 17:06:51 +01:00
parent ec005c91a9
commit 9b64dfb74e
15 changed files with 780 additions and 0 deletions

View File

@@ -0,0 +1,140 @@
---
name: trade-analyze
description: "Deep trading analysis with multi-agent debate. Use sessions_spawn to delegate to invest-bull, invest-bear, invest-hawk, invest-dove. Triggered by /trade-analyze or deep analysis requests."
user-invocable: true
metadata: { "openclaw": { "emoji": "⚖️", "requires": { "bins": ["curl"] } } }
---
# Trade Analysis — Multi-Agent Debate Pipeline
**You are the judge. Debate agents work in the background via sessions_spawn. Only YOU post to Discord.**
**IMPORTANT: Use `sessions_spawn` (NOT sessions_send). sessions_send will timeout due to gateway architecture.**
## Step 1: Collect Data
Run these curl commands using the `exec` tool:
```bash
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/technical"
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/metrics"
curl -sk "https://invest-api.k8s.home/api/v1/stock/{TICKER}/sentiment"
curl -sk "https://invest-api.k8s.home/api/v1/macro/overview"
```
Summarize key data points (under 500 words).
## Step 2: Bull Case
Use the `sessions_spawn` tool:
```json
{
"task": "You are the Bull Researcher. Based on the following data for {TICKER}, build your bullish investment thesis with 3-5 specific data-backed arguments. Keep under 400 words.\n\nData:\n{data summary}",
"agentId": "invest-bull",
"label": "bull-{TICKER}"
}
```
sessions_spawn returns immediately with `{ status: "accepted", runId }`. The result will be announced back to you automatically when Bull finishes. **Wait for the announce before proceeding.**
## Step 3: Bear Case
After receiving Bull's result, use `sessions_spawn`:
```json
{
"task": "You are the Bear Researcher. For {TICKER}, Bull argued:\n\n{Bull's argument}\n\nBuild your bearish counter-argument with 3-5 specific data-backed points. Keep under 400 words.",
"agentId": "invest-bear",
"label": "bear-{TICKER}"
}
```
Wait for Bear's announce.
## Step 4: Bull Rebuttal (FINAL)
```json
{
"task": "You are the Bull Researcher. Bear responded:\n\n{Bear's argument}\n\nThis is your FINAL rebuttal. Counter Bear's strongest point. Keep under 300 words.",
"agentId": "invest-bull",
"label": "bull-final-{TICKER}"
}
```
**STOP Bull/Bear debate after this. Maximum 3 spawns for Bull/Bear.**
## Step 5: Hawk Risk
Formulate a trading proposal, then:
```json
{
"task": "You are the Hawk (aggressive) Risk Analyst. Evaluate this {TICKER} trading proposal. Propose position size, entry, stop-loss with specific numbers.\n\nProposal: {direction, entry, stop, target}",
"agentId": "invest-hawk",
"label": "hawk-{TICKER}"
}
```
## Step 6: Dove Risk
```json
{
"task": "You are the Dove (conservative) Risk Analyst. Hawk proposed:\n\n{Hawk response}\n\nEvaluate from capital preservation perspective. Propose safer sizing.\n\nKeep under 300 words.",
"agentId": "invest-dove",
"label": "dove-{TICKER}"
}
```
## Step 7: Final Verdict (ONLY output to Discord)
After all spawns complete, synthesize and output:
```
# ⚖️ Trading Verdict: {TICKER}
## Decision: [BUY / SELL / HOLD]
## Confidence: {1-10}/10
### Summary
{2-3 sentences}
### Entry Plan
| Item | Value |
|------|-------|
| Action | BUY/SELL/HOLD |
| Entry | ${price} |
| Stop-loss | ${price} ({%} risk) |
| Target | ${price} ({%} upside) |
| Position | {%} of portfolio |
### 🐂 Bull Case
1. {point}
2. {point}
3. {point}
### 🐻 Bear Case
1. {point}
2. {point}
3. {point}
### Risk Assessment
| Analyst | Position | Stop | View |
|---------|----------|------|------|
| 🦅 Hawk | {%} | ${} | {line} |
| 🕊️ Dove | {%} | ${} | {line} |
| **Final** | **{%}** | **${}** | **{why}** |
```
## Step 8: Save to Memory
Write decision to today's memory log.
## Rules
1. **Use `sessions_spawn`** with `agentId` — NOT sessions_send (it will timeout)
2. **Wait for each announce** before spawning the next agent
3. **Only YOU post to Discord** — spawn agents are silent
4. **Max spawns**: Bull(2) + Bear(1) + Hawk(1) + Dove(1) = 5 total
5. If spawn times out, skip and continue
6. **Never use @ mentions**