Skip to content

Commit 9fbc74e

Browse files
win4rclaude
andcommitted
feat: add hedge-fund-hermes template with gbrain-backed output
The original hedge-fund template tells each analyst to publish their report via `clawteam inbox send ...`. OpenClaw workers reliably execute that. Hermes workers often don't — they treat -q as "answer this" and return analysis to stdout without running the send command. Result: kanban shows COMPLETED, but inboxes are empty. Users fall back to parsing tmux scrollback which is fragile. Fix: a Hermes-native template variant that uses gbrain as the output channel instead of clawteam inbox. Hermes workers reliably call mcp_gbrain_put_page because gbrain is their native MCP surface. Changes: - clawteam/templates/hedge-fund-hermes.toml (new) - command = ["hermes"] by default (no --command flag needed) - Each analyst stores findings via mcp_gbrain_put_page with slug {team_name}-<analyst> (buffett/growth/technical/fundamentals/ sentiment/risk/final-report) - Portfolio-manager and risk-manager read from gbrain via mcp_gbrain_query + mcp_gbrain_get_page instead of clawteam inbox - 100% parity with hedge-fund.toml analysts, prompts rewritten for Hermes idioms - skills/hermes/SKILL.md - Added "Reading Output from hedge-fund-hermes" section explaining the gbrain query pattern - Recommends hedge-fund-hermes over hedge-fund for Hermes users - README.md - Added hedge-fund-hermes example to the AI Hedge Fund section Benefits vs hedge-fund (OpenClaw-style): - Findings persist in Postgres across sessions - Cross-session memory: next week's analysis can reference prior reports - No tmux scrollback fragility - Works with unmodified Hermes installations (no coordination-prompt tuning needed) Requires: gbrain MCP server configured in ~/.hermes/config.yaml. Without gbrain, this template degrades to the same tmux-scrollback-only behavior as hedge-fund.toml. 474 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0837de0 commit 9fbc74e

3 files changed

Lines changed: 305 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,17 @@ Leader agent:
370370
A TOML template spawns a complete 7-agent investment team with one command:
371371

372372
```bash
373+
# OpenClaw (default)
373374
clawteam launch hedge-fund --team fund1 --goal "Analyze AAPL, MSFT, NVDA for Q2 2026"
375+
376+
# Hermes Agent — use the Hermes-native variant that stores findings in gbrain
377+
clawteam launch hedge-fund-hermes --team-name fund1 --goal "Analyze AAPL" --force
374378
```
375379

376380
5 analyst agents (value, growth, technical, fundamentals, sentiment) work in parallel. Risk manager synthesizes all signals. Portfolio manager makes final decisions.
377381

382+
Hermes users: the `hedge-fund-hermes` variant rewrites each analyst's task to use `mcp_gbrain_put_page` for output persistence instead of `clawteam inbox send`. Findings land in gbrain pages with predictable slugs (`<team-name>-buffett`, `<team-name>-growth`, etc.), persist across sessions, and can be queried later.
383+
378384
Templates are TOML files — **create your own** for any domain.
379385

380386
---
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
[template]
2+
name = "hedge-fund-hermes"
3+
description = "AI Hedge Fund - Hermes-native variant using gbrain for persistence (not clawteam inbox)"
4+
command = ["hermes"]
5+
backend = "tmux"
6+
7+
# DESIGN NOTE: This template is a Hermes-native rewrite of hedge-fund.toml.
8+
# Key differences from the OpenClaw variant:
9+
# 1. Analysts store findings in gbrain via mcp_gbrain_put_page (not clawteam inbox send).
10+
# Hermes workers treat -q as "answer this prompt" and reliably return analysis
11+
# to stdout, but they often skip the post-analysis `clawteam inbox send` step.
12+
# Storing to gbrain uses Hermes's native MCP muscle memory.
13+
# 2. Output persists in Postgres. Works across sessions. Next week's analysis can
14+
# reference prior findings.
15+
# 3. Portfolio-manager and risk-manager read findings via mcp_gbrain_query
16+
# instead of clawteam inbox receive.
17+
#
18+
# Requires: gbrain MCP server configured in ~/.hermes/config.yaml.
19+
# Without gbrain, this template degrades to the same tmux-scrollback-only behavior
20+
# as hedge-fund.toml under Hermes.
21+
22+
[template.leader]
23+
name = "portfolio-manager"
24+
type = "portfolio-manager"
25+
task = """You are the Portfolio Manager and team leader of an AI hedge fund.
26+
Your goal: {goal}
27+
28+
Workflow (read-from-gbrain, not from inbox):
29+
1. Wait ~2 minutes for all 5 analysts and the risk-manager to store their findings.
30+
2. Query the knowledge brain for analyst reports:
31+
mcp_gbrain_query("{team_name} analyst")
32+
Expected pages (slug pattern): {team_name}-buffett, {team_name}-growth, {team_name}-technical, {team_name}-fundamentals, {team_name}-sentiment, {team_name}-risk
33+
3. Read each page individually via mcp_gbrain_get_page(slug) for the full analysis.
34+
4. Synthesize all analyst signals + risk assessment into a final recommendation.
35+
5. Output a final report with: ticker, action (buy/sell/hold), position size, confidence, reasoning, key risks.
36+
6. Persist the final report: mcp_gbrain_put_page with slug "{team_name}-final-report", type "deal", full report as compiled_truth.
37+
7. Update your task status: clawteam task update {team_name} [task-id] --status completed.
38+
39+
If any analyst's page is missing after 3 minutes, proceed with partial data and note the missing analysts in the final report."""
40+
41+
[[template.agents]]
42+
name = "buffett-analyst"
43+
type = "value-analyst"
44+
task = """You are Warren Buffett. Analyze stocks using value investing principles.
45+
The team goal is: {goal}
46+
47+
Your analysis framework:
48+
- Moat analysis: durable competitive advantages, pricing power
49+
- Financial health: ROE >15%, debt-to-equity <0.5, operating margins >15%
50+
- Management quality: share buybacks, dividend history
51+
- Intrinsic value: owner earnings DCF with 15% margin of safety
52+
- Book value growth: CAGR and consistency
53+
54+
OUTPUT INSTRUCTIONS (Hermes-native — do NOT use clawteam inbox send):
55+
After completing your analysis, store findings via mcp_gbrain_put_page with:
56+
slug: {team_name}-buffett
57+
type: deal
58+
title: "{team_name} Buffett-style Value Analysis"
59+
compiled_truth: Full analysis including:
60+
- SIGNAL: bullish | bearish | neutral
61+
- CONFIDENCE: 0-100
62+
- MOAT ANALYSIS
63+
- FINANCIAL METRICS (ROE, D/E, margins)
64+
- INTRINSIC VALUE vs current price
65+
- REASONING (2-3 paragraphs)
66+
67+
Then update task status: clawteam task update {team_name} [task-id] --status completed"""
68+
69+
[[template.agents]]
70+
name = "growth-analyst"
71+
type = "growth-analyst"
72+
task = """You are a growth/disruption investor (Cathie Wood style). Analyze stocks for growth potential.
73+
The team goal is: {goal}
74+
75+
Your analysis framework:
76+
- Revenue growth trajectory (>20% preferred)
77+
- Total addressable market (TAM) expansion
78+
- Disruptive innovation potential
79+
- Network effects and platform dynamics
80+
- Management vision and execution
81+
82+
OUTPUT INSTRUCTIONS (Hermes-native — do NOT use clawteam inbox send):
83+
After completing your analysis, store findings via mcp_gbrain_put_page with:
84+
slug: {team_name}-growth
85+
type: deal
86+
title: "{team_name} Growth/Disruption Analysis"
87+
compiled_truth: Full analysis including:
88+
- SIGNAL: bullish | bearish | neutral
89+
- CONFIDENCE: 0-100
90+
- REVENUE GROWTH TRAJECTORY
91+
- TAM & DISRUPTION POTENTIAL
92+
- NETWORK EFFECTS
93+
- REASONING (2-3 paragraphs)
94+
95+
Then update task status: clawteam task update {team_name} [task-id] --status completed"""
96+
97+
[[template.agents]]
98+
name = "technical-analyst"
99+
type = "technical-analyst"
100+
task = """You are a Technical Analyst. Analyze stocks using technical indicators.
101+
The team goal is: {goal}
102+
103+
Your analysis framework (weighted ensemble):
104+
- Trend following (25%): EMA-8/21/55, ADX
105+
- Momentum (25%): 1/3/6-month returns, volume momentum
106+
- Mean reversion (20%): Z-score, Bollinger Bands, RSI-14/28
107+
- Volatility (15%): Historical vol, ATR ratio, vol regime
108+
- Statistical arbitrage (15%): Hurst exponent, skewness, kurtosis
109+
110+
OUTPUT INSTRUCTIONS (Hermes-native — do NOT use clawteam inbox send):
111+
After completing your analysis, store findings via mcp_gbrain_put_page with:
112+
slug: {team_name}-technical
113+
type: deal
114+
title: "{team_name} Technical Analysis"
115+
compiled_truth: Full analysis including:
116+
- SIGNAL: bullish | bearish | neutral
117+
- CONFIDENCE: 0-100
118+
- TREND (EMA crossovers, ADX)
119+
- MOMENTUM (returns, volume)
120+
- MEAN REVERSION (RSI, Bollinger, Z-score)
121+
- VOLATILITY REGIME
122+
- REASONING (2-3 paragraphs)
123+
124+
Then update task status: clawteam task update {team_name} [task-id] --status completed"""
125+
126+
[[template.agents]]
127+
name = "fundamentals-analyst"
128+
type = "fundamentals-analyst"
129+
task = """You are a Fundamentals Analyst. Evaluate stocks using financial metrics.
130+
The team goal is: {goal}
131+
132+
Your analysis framework (4 dimensions):
133+
- Profitability: ROE >15%, net margin >20%, operating margin >15%
134+
- Growth: revenue growth >10%, earnings growth >10%, book value growth >10%
135+
- Financial health: current ratio >1.5, D/E <0.5, FCF >80% of earnings
136+
- Valuation: P/E <25, P/B <3, P/S <5
137+
138+
Signal = majority vote of 4 dimensions. Confidence = % of agreeing signals.
139+
140+
OUTPUT INSTRUCTIONS (Hermes-native — do NOT use clawteam inbox send):
141+
After completing your analysis, store findings via mcp_gbrain_put_page with:
142+
slug: {team_name}-fundamentals
143+
type: deal
144+
title: "{team_name} Fundamentals Analysis"
145+
compiled_truth: Full analysis including:
146+
- SIGNAL: bullish | bearish | neutral
147+
- CONFIDENCE: 0-100
148+
- PROFITABILITY (ROE, margins)
149+
- GROWTH (revenue, earnings, book value)
150+
- FINANCIAL HEALTH (liquidity, leverage, FCF)
151+
- VALUATION (P/E, P/B, P/S)
152+
- REASONING (2-3 paragraphs)
153+
154+
Then update task status: clawteam task update {team_name} [task-id] --status completed"""
155+
156+
[[template.agents]]
157+
name = "sentiment-analyst"
158+
type = "sentiment-analyst"
159+
task = """You are a Sentiment Analyst. Analyze market sentiment for stocks.
160+
The team goal is: {goal}
161+
162+
Your analysis framework:
163+
- News sentiment analysis (70% weight): classify recent news as bullish/bearish/neutral
164+
- Insider trading activity (30% weight): net insider buying = bullish, selling = bearish
165+
- Combined weighted signal with confidence score
166+
167+
OUTPUT INSTRUCTIONS (Hermes-native — do NOT use clawteam inbox send):
168+
After completing your analysis, store findings via mcp_gbrain_put_page with:
169+
slug: {team_name}-sentiment
170+
type: deal
171+
title: "{team_name} Sentiment Analysis"
172+
compiled_truth: Full analysis including:
173+
- SIGNAL: bullish | bearish | neutral
174+
- CONFIDENCE: 0-100
175+
- NEWS SENTIMENT (recent headlines classified)
176+
- INSIDER ACTIVITY (net buy/sell)
177+
- REASONING (2-3 paragraphs)
178+
179+
Then update task status: clawteam task update {team_name} [task-id] --status completed"""
180+
181+
[[template.agents]]
182+
name = "risk-manager"
183+
type = "risk-manager"
184+
task = """You are the Risk Manager. Consolidate all analyst signals and assess portfolio risk.
185+
The team goal is: {goal}
186+
187+
Workflow (read-from-gbrain, not from inbox):
188+
1. Wait ~90 seconds for all 5 analysts to finish.
189+
2. Query the knowledge brain for analyst reports:
190+
mcp_gbrain_query("{team_name} analyst")
191+
Expected pages: {team_name}-buffett, {team_name}-growth, {team_name}-technical, {team_name}-fundamentals, {team_name}-sentiment
192+
3. Read each page via mcp_gbrain_get_page(slug) to extract signal + confidence.
193+
4. Consolidate signals:
194+
- For each ticker, tally bullish/bearish/neutral votes with confidence-weighted scores.
195+
- Compute volatility-adjusted position limits (low vol: 25% max, high vol: 10% max).
196+
- Adjust for correlation with existing positions.
197+
5. Persist your risk report via mcp_gbrain_put_page with:
198+
slug: {team_name}-risk
199+
type: deal
200+
title: "{team_name} Risk Report"
201+
compiled_truth:
202+
- CONSOLIDATED SIGNAL (per ticker)
203+
- POSITION LIMITS
204+
- CORRELATION ADJUSTMENTS
205+
- KEY RISKS (2-3 bullets)
206+
- ALL ANALYST VOTES (table)
207+
6. Update your task status: clawteam task update {team_name} [task-id] --status completed.
208+
209+
If fewer than 5 analyst pages exist after 3 minutes, proceed with partial data and note which analysts are missing in the risk report."""
210+
211+
[[template.tasks]]
212+
subject = "Coordinate analysis, read gbrain, and make final investment decisions"
213+
owner = "portfolio-manager"
214+
215+
[[template.tasks]]
216+
subject = "Value investing analysis (Buffett style) — store in gbrain"
217+
owner = "buffett-analyst"
218+
219+
[[template.tasks]]
220+
subject = "Growth/disruption analysis — store in gbrain"
221+
owner = "growth-analyst"
222+
223+
[[template.tasks]]
224+
subject = "Technical indicators analysis — store in gbrain"
225+
owner = "technical-analyst"
226+
227+
[[template.tasks]]
228+
subject = "Fundamentals and financial metrics analysis — store in gbrain"
229+
owner = "fundamentals-analyst"
230+
231+
[[template.tasks]]
232+
subject = "News and insider sentiment analysis — store in gbrain"
233+
owner = "sentiment-analyst"
234+
235+
[[template.tasks]]
236+
subject = "Consolidate signals from gbrain and assess portfolio risk"
237+
owner = "risk-manager"

skills/hermes/SKILL.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ For `clawteam spawn` (manual mode):
4040
## Launch a Template (Recommended Path)
4141

4242
```bash
43-
# Stock analysis (7 specialist analysts: portfolio-manager, buffett, growth, technical, fundamentals, sentiment, risk-manager)
43+
# Stock analysis (Hermes-native template using gbrain for output — RECOMMENDED for Hermes users)
44+
clawteam launch hedge-fund-hermes --team-name tesla --goal "Analyze TSLA" --force
45+
46+
# Stock analysis (original OpenClaw-style template — relies on clawteam inbox send which Hermes workers often skip)
4447
clawteam launch hedge-fund --team-name tesla --goal "Analyze TSLA" --command hermes --force
4548

4649
# Research paper summary
@@ -53,6 +56,31 @@ clawteam launch code-review --team-name review1 --goal "Review PR #42" --command
5356
clawteam launch strategy-room --team-name strat --goal "Q2 planning" --command hermes --force
5457
```
5558

59+
## Reading Output from `hedge-fund-hermes` (Preferred Path)
60+
61+
The Hermes-native template stores each analyst's findings as a gbrain page with a predictable slug. After launch + ~2 minutes wait:
62+
63+
```bash
64+
# Query all findings at once
65+
mcp_gbrain_query("<team-name> analyst")
66+
67+
# Or read each analyst's page directly
68+
for analyst in buffett growth technical fundamentals sentiment risk; do
69+
mcp_gbrain_get_page("<team-name>-$analyst")
70+
done
71+
72+
# Portfolio manager stores the final synthesis here
73+
mcp_gbrain_get_page("<team-name>-final-report")
74+
```
75+
76+
**Why this works better than `hedge-fund`**: Hermes workers reliably call `mcp_gbrain_put_page` because gbrain is their native MCP surface. They often skip the `clawteam inbox send` step in the OpenClaw-style template.
77+
78+
Benefits:
79+
- Findings persist in Postgres across sessions
80+
- No tmux scrollback fragility
81+
- Next week's analysis can query prior reports
82+
- Cross-agent memory works natively
83+
5684
## CRITICAL: Timing Expectations (DO NOT cleanup early)
5785

5886
Spawned Hermes workers need substantial time to produce output:
@@ -207,11 +235,43 @@ clawteam spawn -t research -n analyst --task "Research topic X. Query gbrain for
207235
| `clawteam board live <team>` | Auto-refreshing board |
208236
| `clawteam board serve --port 8080` | Web dashboard |
209237

238+
## Known Failure Modes
239+
240+
1. **risk-manager crash**: The risk-manager agent is prone to crashing mid-execution (`"Agent 'risk-manager' exited unexpectedly. Reset N task(s) to pending"`). This can leave the team's final synthesis incomplete. If this happens, read tmux scrollback for the portfolio-manager (leader) window first — it may have the final recommendation before the crash.
241+
242+
2. **Inbox empty despite COMPLETED tasks**: Hermes workers write to tmux scrollback, not to the inbox system. The kanban board reflects task state but not content. Always capture tmux panes to read actual output.
243+
244+
3. **Workers do not persist findings**: Unless explicitly instructed to use gbrain, agent outputs exist only in tmux scrollback and are lost when the session is cleaned up. Always include brain-instructions in analysis goals.
245+
246+
## CRITICAL: Inbox Peek Is Unreliable — Use Tmux Capture
247+
248+
`clawteam inbox peek` often returns EMPTY even when tasks show COMPLETED on the board. The actual agent outputs live in **tmux scrollback**, not in the inbox system.
249+
250+
**Always use tmux pane capture to read agent reports:**
251+
252+
```bash
253+
# List all tmux windows for the team
254+
tmux list-windows -t clawteam-<team-name> 2>/dev/null
255+
256+
# Capture each window's scrollback (each window = one agent)
257+
for win in $(tmux list-windows -t clawteam-<team-name> -F '#{window_index}' 2>/dev/null); do
258+
echo -e "\n\n=== Window $win ==="
259+
tmux capture-pane -t clawteam-<team-name>:$win -p 2>&1 | tail -100
260+
done
261+
```
262+
263+
**Also:** When launching a team for analysis work, include brain-instructions in the goal so agents store findings in gbrain — this provides a persistent fallback when tmux sessions are lost:
264+
265+
```bash
266+
clawteam launch hedge-fund --team-name <name> --goal "Analyze AAPL. IMPORTANT: After completing your analysis, store key findings as brain pages using mcp_gbrain_put_page so findings persist even if the tmux session is lost." --command hermes --force
267+
```
268+
210269
## Anti-Patterns (Do Not Do)
211270

212271
- Don't use `delegate_task` when the user asks for multi-agent/swarm/team analysis. Use clawteam.
213272
- Don't pass `--team` (the flag is `--team-name`).
214273
- Don't pass `--command hermes` to `spawn` (it's a positional arg at the end). That flag only works on `launch`.
215274
- Don't forget `--command hermes` on `launch` — templates default to openclaw.
216275
- Don't assume templates will use Hermes by default. They don't. Always pass `--command hermes`.
217-
- Don't clean up the team before reading final reports from inboxes.
276+
- Don't clean up the team before reading final reports — BUT `inbox peek` alone is unreliable; always ALSO capture tmux panes.
277+
- Don't rely on `clawteam inbox peek` alone — tasks can be COMPLETED on the board while inbox messages are empty. Tmux scrollback capture is the source of truth.

0 commit comments

Comments
 (0)