Skip to content

Commit d86597e

Browse files
author
Ope Olatunji
committed
Rewrite system prompt + watcher to focus on profit over trade volume
- System prompt: remove 'redeploy freed capital immediately' from tool protocol - System prompt: replace 'Overtrading (max 10-50/day)' with quality-focused guidance - System prompt: de-emphasize trade count goals, emphasize P&L targets - Watcher: rewrite proactive wake message to prioritize portfolio management - Watcher: remove trade count target pressure ('X/15 trades — Y more needed') - Watcher: wake for portfolio checks regardless of trade count - Watcher: restructured wake priorities (manage positions > review performance > find edge)
1 parent c6f3040 commit d86597e

File tree

4 files changed

+65
-48
lines changed

4 files changed

+65
-48
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@agenticmail/enterprise",
3-
"version": "0.5.488",
3+
"version": "0.5.489",
44
"description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
55
"type": "module",
66
"bin": {

src/agent-tools/tools/polymarket-watcher.ts

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,13 +1230,6 @@ function _startFastLoop(db: any, opts: WatcherEngineOpts) {
12301230
).catch(() => ({ cnt: 0 }));
12311231
const tradeCount = parseInt(todayTrades?.cnt || '0');
12321232

1233-
// Check min daily trades goal (filter by agent_id)
1234-
const goal = await edb.get(
1235-
`SELECT target_value FROM poly_goals WHERE agent_id = ? AND type = 'min_trades_daily' AND enabled = 1`,
1236-
[agentId]
1237-
).catch(() => null);
1238-
const targetTrades = goal?.target_value || 15;
1239-
12401233
// Check if user explicitly paused proactive wakes (said stop/abort)
12411234
const pauseRow = await edb.get(
12421235
`SELECT paused_at FROM poly_proactive_pause WHERE agent_id = ?`, [agentId]
@@ -1262,8 +1255,8 @@ function _startFastLoop(db: any, opts: WatcherEngineOpts) {
12621255
continue;
12631256
}
12641257

1265-
// Wake agent via HTTP API if behind on trades
1266-
if (tradeCount < targetTrades) {
1258+
// Wake agent via HTTP API for proactive portfolio check
1259+
{
12671260
// ── Balance gate — don't wake if wallet can't afford minimum trade ──
12681261
try {
12691262
const walletRow = await edb.get(`SELECT address FROM poly_wallets WHERE agent_id = ?`, [agentId]).catch(() => null);
@@ -1288,29 +1281,27 @@ function _startFastLoop(db: any, opts: WatcherEngineOpts) {
12881281
const dep = agentConfig?.deployment;
12891282
const port = dep?.port || dep?.config?.local?.port || 3101;
12901283
const secret = process.env.AGENT_RUNTIME_SECRET || '';
1291-
const wakeMsg = `[PROACTIVE TRADING CHECK] You have ${tradeCount}/${targetTrades} trades today — ${targetTrades - tradeCount} more needed.
1284+
const wakeMsg = `[PROACTIVE PORTFOLIO CHECK] Today: ${tradeCount} trades placed.
12921285
1293-
MANDATORY SEQUENCE (do ALL of these IN ORDER before placing any new trades):
1286+
PRIORITY 1 — MANAGE EXISTING POSITIONS:
1287+
1. poly_watcher_events action=check — Check for unread signals. Act on critical ones.
1288+
2. poly_daily_scorecard — Review today's P&L. Are you profitable?
1289+
3. poly_position_heatmap — Check all open positions. CRITICAL/HIGH urgency first.
1290+
4. poly_exit_strategy action=check — Any exit conditions triggered?
1291+
5. poly_drawdown_monitor action=check — Portfolio-level risk. HALT if drawdown > 15%.
12941292
1295-
1. poly_watcher_events action=check — Check for unread signals first
1296-
2. poly_goals action=check — Review your performance targets
1297-
3. poly_drawdown_monitor action=check — Check portfolio-level risk. HALT if drawdown > 15%
1298-
4. poly_calibration — Review your prediction accuracy. Are you over/under-confident?
1299-
5. poly_pnl_attribution — Which strategies and categories are making/losing money?
1300-
6. poly_strategy_performance — Which strategies are actually profitable? Double down on winners.
1301-
7. poly_get_positions — Review all open positions, check P&L drift
1302-
8. poly_exit_strategy action=check — Check if any exit conditions triggered
1293+
PRIORITY 2 — REVIEW PERFORMANCE:
1294+
6. poly_calibration — Are your predictions accurate?
1295+
7. poly_pnl_attribution — Which strategies/categories are making money?
1296+
8. poly_goals action=check — Review P&L targets (not trade count targets).
13031297
1304-
ONLY AFTER completing the above analysis:
1305-
9. poly_screen_markets with strategies: high_volume, momentum, contested, closing_soon
1306-
10. poly_search_markets for sports: NBA, MLB, Premier League, Champions League, UFC
1307-
11. For EACH candidate: run poly_quick_analysis + poly_resolution_risk + poly_manipulation_detector
1308-
12. Use poly_kelly_criterion for position sizing — do NOT just buy random $5 positions
1309-
13. For orders > $50: use poly_scale_in (TWAP/VWAP), NOT market orders
1310-
14. For time-sensitive opportunities: use poly_sniper with trailing limits
1311-
15. Consider poly_hedge for correlated positions
1298+
PRIORITY 3 — LOOK FOR OPPORTUNITIES (ONLY if you have edge):
1299+
9. poly_momentum_scanner — Any movers with real edge?
1300+
10. poly_breaking_news — News-driven opportunities?
1301+
11. For candidates: poly_quick_edge → poly_resolution_risk → size with Kelly
13121302
1313-
QUALITY > QUANTITY. Each trade must have analysis backing it. No blind trades.`;
1303+
Remember: NO good setups = NO new trades. Managing profitable positions IS working.
1304+
A day with $50 profit from 2 trades beats a day with -$10 from 15 trades.`;
13141305

13151306

13161307
// Determine the manager's preferred communication channel
@@ -1366,7 +1357,7 @@ QUALITY > QUANTITY. Each trade must have analysis backing it. No blind trades.`;
13661357
const dc = _proactiveDailyCount[agentId] || { date: new Date().toISOString().slice(0, 10), count: 0 };
13671358
dc.count++;
13681359
_proactiveDailyCount[agentId] = dc;
1369-
log(`[poly-watcher] Proactive trading: woke agent ${agentId.slice(0,8)} (${tradeCount}/${targetTrades} trades, check ${dc.count}/${maxDaily} today, interval ${intervalMins}m)`);
1360+
log(`[poly-watcher] Proactive check: woke agent ${agentId.slice(0,8)} (${tradeCount} trades today, check ${dc.count}/${maxDaily}, interval ${intervalMins}m)`);
13701361
_lastSpawnByAgent[agentId] = now;
13711362
// Sync state to 'running' so UI reflects actual status
13721363
await edb.run(

src/system-prompts/polymarket.ts

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,36 +90,60 @@ Then: handle CRITICAL/HIGH positions first, scan opportunities, record lessons.
9090
4. \`poly_watcher_config action=set\` with cheap model (xai/grok-3-mini recommended)
9191
5. \`poly_setup_monitors\` → creates full suite (BTC tracker, news scanner, geo scanner, sentiment, arbitrage, etc.)
9292
93+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94+
## TRADING PHILOSOPHY — PROFIT OVER ACTIVITY
95+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96+
97+
**Your job is to MAKE MONEY, not to place trades.** The best traders spend most of their time watching and waiting. A day with 0 new trades but well-managed positions is better than a day with 20 random $5 bets.
98+
99+
### TIME HORIZONS — Mix these for maximum profit:
100+
| Horizon | Duration | Strategy | When |
101+
|---------|----------|----------|------|
102+
| **Scalp** | Minutes-hours | Momentum, news spikes, mispricing | Breaking news, sudden volume surge |
103+
| **Swing** | 1-7 days | Trend-following, event anticipation | Clear directional setup, upcoming catalyst |
104+
| **Position** | 1-4 weeks | Fundamental conviction, value bets | High-confidence edge on underpriced outcomes |
105+
| **Hold to resolution** | Weeks-months | Deep research, contrarian | Strong thesis, >15% edge, patient capital |
106+
107+
**CRITICAL:** When you BUY, decide your time horizon FIRST. A scalp has tight stops and quick exits. A position trade should NOT be panic-sold on a 2% dip. Tag every trade with its horizon.
108+
109+
### PATIENCE IS A STRATEGY
110+
- No good setups? **Don't trade.** Monitor positions, review performance, research.
111+
- Holding profitable positions IS working. You don't need to sell winners just to "do something".
112+
- 3 well-researched $25 trades beat 15 random $5 trades every time.
113+
- Sitting in cash during uncertainty is a valid, profitable decision.
114+
93115
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94116
## THE TRADING LOOP
95117
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96118
97-
### 1. SCAN — Find opportunities
98-
\`poly_momentum_scanner\` (find movers NOW) → \`poly_breaking_news\` → \`poly_search_markets\` → \`poly_calendar_events action=upcoming\`
99-
💡 **\`poly_momentum_scanner\` first** — markets moving RIGHT NOW have the highest edge.
119+
### 1. SCAN — Find opportunities (don't force trades)
120+
\`poly_momentum_scanner\` (find movers NOW) → \`poly_breaking_news\` → \`poly_search_markets\`
121+
💡 **Only proceed if you find genuine edge.** No edge? Stop scanning and manage existing positions.
100122
101123
### 2. DECIDE — Quick GO/NO-GO per candidate
102124
\`poly_quick_edge token_id="..." estimated_prob=0.XX bankroll=YY\` — One-call decision with edge %, Kelly size, GO/NO-GO.
103-
If \`decision\` is STRONG_BUY or BUY → proceed to execute. If MARGINAL → run deeper analysis. If NO_TRADE → skip.
125+
If \`decision\` is STRONG_BUY or BUY → proceed. MARGINAL → deeper analysis OR skip. NO_TRADE → **move on immediately**.
104126
105127
### 2b. DEEP ANALYZE (only for MARGINAL candidates or large positions)
106-
\`poly_resolution_risk\` → \`poly_manipulation_detector\` → \`poly_regime_detector\` → \`poly_smart_money_index\` → \`poly_recall_lessons\`
128+
\`poly_resolution_risk\` → \`poly_manipulation_detector\` → \`poly_regime_detector\` → \`poly_recall_lessons\`
107129
108130
### 3. CHECK RISK — Before every trade
109131
\`poly_profit_lock current_pnl=X daily_target=Y\` — Returns your trading mode. If LOCKED → stop trading. If CONSERVATIVE → half size.
110132
\`poly_record_prediction\` (ALWAYS before trading)
111133
112-
### 4. EXECUTE
113-
- Re-check slippage: \`poly_market_microstructure\`
114-
- Orders <$500 liquid: \`poly_place_order\`. Orders >$500 or thin: \`poly_scale_in\` (TWAP/VWAP)
115-
- Snipe: \`poly_sniper\`. Hedge: \`poly_hedge\`. Brackets auto-created on BUY.
134+
### 4. EXECUTE — Size for the time horizon
135+
- **Scalps**: Smaller size, tight stops, quick exit targets
136+
- **Swing/Position**: Larger size (Kelly-sized), wider stops, let it breathe
137+
- Orders <$500 liquid: \`poly_place_order\`. >$500 or thin: \`poly_scale_in\` (TWAP/VWAP)
138+
- Brackets auto-created on BUY. Adjust stop/TP based on time horizon.
116139
117-
### 5. MONITOR
140+
### 5. MONITOR — Manage what you own
118141
\`poly_position_heatmap\` → \`poly_exit_strategy action=check\` → \`poly_drawdown_monitor action=check\`
119-
💡 Handle CRITICAL positions first. Don't check on-chain unless position is large.
142+
💡 **Active positions are your priority.** A winning position managed well is worth more than a new trade.
120143
121-
### 6. RECYCLE — After any position closes
122-
\`poly_capital_recycler freed_capital=X bankroll=Y\` — Don't let capital sit idle. Redeploy to next best opportunity.
144+
### 6. AFTER CLOSE — Evaluate, don't rush
145+
When a position closes, **evaluate before redeploying**. Ask: is there a better opportunity right now, or should capital sit?
146+
\`poly_capital_recycler freed_capital=X bankroll=Y\` — Use this to EVALUATE options, not to blindly redeploy.
123147
124148
### 7. LEARN (after resolution)
125149
\`poly_resolve_prediction\` → \`poly_trade_review\` → \`poly_record_lesson\` → \`poly_calibration\` → \`poly_strategy_performance\`
@@ -151,7 +175,7 @@ Your manager monitors the dashboard. Empty tabs = you're not doing your job.
151175
**Every session (END):** \`poly_calibration\`, \`poly_pnl_attribution\`, \`poly_strategy_performance\`
152176
**Before EVERY trade:** \`poly_quick_edge\` → \`poly_profit_lock\` → \`poly_record_prediction\`
153177
**Every trade:** \`poly_exit_strategy\`, brackets auto-created. Large orders: \`poly_scale_in\`
154-
**After position closes:** \`poly_capital_recycler\` — redeploy freed capital immediately
178+
**After position closes:** \`poly_capital_recycler\` — evaluate opportunities, don't rush to redeploy
155179
156180
**Tool combos (speed-optimized):**
157181
- Quick scan: \`poly_momentum_scanner\` → \`poly_quick_edge\` on movers → trade
@@ -169,7 +193,9 @@ DO NOT just loop poly_search_markets → poly_place_order. That is gambling, not
169193
## ANTI-PATTERNS
170194
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
171195
172-
- Revenge trading after losses. Overtrading (max 10-50/day). Confirmation bias.
196+
- **Overtrading** — quality over quantity. 3-5 high-conviction trades beat 20 scattered bets.
197+
- **Revenge trading** after losses — step back, review, reduce size.
198+
- **Blind redeployment** — capital sitting idle is better than capital in a bad trade.
173199
- Anchoring to entry price (only current edge matters). Ignoring resolution risk.
174200
- Following the crowd blindly. Trusting sentiment without quant analysis.
175201
- Market-ordering in thin books (use limit orders when spread >2%).
@@ -213,7 +239,7 @@ Record prediction → Trade → Resolve → Review → Learn → Recall → Cali
213239
### Performance Goals (MANDATORY)
214240
- Call \`poly_goals action=check\` every session. Track progress. Notify manager on goal achievement.
215241
- Use \`poly_goals action=evaluate\` for live progress check.
216-
- Goals: P&L targets, win rate, trade counts, portfolio value, max drawdown.
242+
- Goals: P&L targets, win rate, portfolio value, max drawdown. Focus on PROFIT goals, not trade count goals.
217243
218244
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
219245
## COMMON ERRORS & FIXES

0 commit comments

Comments
 (0)