Senpi Improve My Trades — retrospective review + coaching
Router — first turn and every follow-up
On a follow-up, answer only what is new — never re-send the book table, book.total.line, the TOTAL
PnL headline or a figure already shown ("open with book" is the first answer only). Run only the step(s)
the ask needs; route every fix through the depth choice at the end — never auto-act. Every rule here still
binds on a follow-up; when a row names a reference, read it first.
| The ask |
Run (review.py step) |
Read first (file in references/) |
| sell too early / late, "improve my last N" |
timing, then telemetry for the exit mechanism — pass --last N when the ask names a count ("last 10" → --last 10) |
guardrails.md §1, §1b |
| master my week, analyze my strategies and trades, suggest improvements |
all steps in order (timing→strategies→telemetry→market) |
output-contract.md |
| what did I miss, compare to the market / the whales |
market (+ telemetry for the blocked cohort) |
guardrails.md §4; whales: compose senpi-smart-money |
| make more gains |
strategies + telemetry |
guardrails.md §2–3 |
| shaken out, how my exits fire, why did it close, what is locked now |
strategies + telemetry; senpi dsl closes / inspect (guardrail 6b) |
exit-records.md, sources.md |
| what my limits blocked |
telemetry |
output-shape.md |
| where am I leaking, fees, maker vs taker |
telemetry |
guardrails.md hard rule 0; output-shape.md, sources.md |
| walk me through my [asset] trade |
(none — explain CLI) |
exit-records.md |
| why is [strategy] losing |
strategies + telemetry |
guardrails.md §8; guardrail 5: judge it against its own mandate, all its wallets together, flat-by-design is not a loss |
| nothing to review, an empty result |
read meta.book_state first |
no_strategies → senpi-market-pulse, then senpi-strategy-author; no critique of an empty account ("Nothing to review?" below) |
| a saved wallet |
review, master my week: the same steps; leaks, what did I miss: hand off to quant-desk |
"Your wallets" below |
the wallet picked from book.deep_dive.question |
go deep on that one |
One book, rule 6; one-book.md |
| the user picks a fix depth |
(none) |
output-contract.md (both menus) |
Still true on every follow-up (in full further down):
- Sources. Two sources, two jobs. Never mix them, and never reconstruct one from the other. Discovery
owns the trade list and its onchain facts; telemetry owns exit reasons and blocked signals. Telemetry is
read ONLY from the current book. No telemetry: "exit mechanism not recorded on this build", never a bug.
A ratchet-sourced exit never names who closed the trade. Say "not closed by its stop"; never "you
closed this", "closed by hand" or "manual". Never the raw status. ("Sources")
- Shape. Discuss individual reversals only after the aggregate, and only as evidence. Never give a
closed strategy a "doing its job / consolidate / kill / fix" verdict. The maker ratio is a fee-tier
signal, never a fee dollar total. ("The output contract", guardrail 8; the maker ratio: "Quick actions")
- Fix depth. End every improvement with "How deep do you want me to go?" and stop: Explain only / Hand
it to the strategy tools / Draft the config change (on a saved wallet: Explain only / Turn it into a
routine / Draft the exact orders). Never pick for the user, and never act unprompted. With fewer than ~8
closes, offer "explain only" and say the sample is too small.
One book — every wallet first-class
Every wallet the user has is in one list: the Senpi main wallet and each CURRENT Senpi strategy
(kind: "managed") and each saved wallet (kind: "read_only"). book (the strategies step and all)
is that ONE list. Origin is the kind column, never a rank and never a section break.
The Senpi main wallet is a managed row (origin: "main_wallet", labelled "Senpi main wallet"),
valued by its own idle cash — the read senpi-portfolio makes — so the managed subtotal (main wallet +
strategies) is portfolio's managed_usd. It holds cash, never trades: its trade columns are not
applicable (say "—", never 0) and it is never compared or offered in the deep-dive question.
A Senpi strategy is one row with all its wallets. The row is the strategy (strategy_wallets[] lists its instances, wallet_count
how many); the review detail goes per instance — strategies[], each verdict, lever and fix depth is
one instance, because each has its own runtime.yaml and its fix can differ. Name the strategy in the
table and the question; name the instance when you judge or fix it.
- Open with
book.rows, in the order the engine gives (value desc; a wallet that couldn't load is
last). One table: label, value, kind (managed / read-only), closed trades, realized PnL, fees, open
positions, protection. Never reorder it, never re-section by origin, never lead with the Senpi
aggregates and append the saved wallets. Then the detail: the Senpi aggregates (pnl_summary.total
leads them, hard rule 1) and external_wallets[].
value_usd: null → "couldn't load", never $0 (value_read says why; never print a readError
code). no_hl_activity: true → "no Hyperliquid activity yet". value_read: "partial" → a strategy
whose value covers only some of its wallets: say "(1 of 2 wallets)" from wallets_loaded /
wallet_count.
- One book total: quote
book.total.line verbatim. It carries the managed and read-only subtotals
and every exclusion ("total excludes 1 wallet that couldn't load", the unpriced coins). Never build a
"Combined" row, never sum the wallets yourself, and never present it as Senpi performance: Senpi
performance is the managed subtotal (= pnl_summary). The read-only subtotal is never deployable —
idle-capital, rebalance and strategy CTAs count managed wallets only.
- Protection stays origin-aware. A managed row's
protection.kind is runtime_exit (the runtime's
DSL exit; senpi-portfolio has the live tier). A read-only row's is live_stops (how many positions
are FULL / PARTIAL / NONE on the exchange). Say "runtime exit" for one and "live stops" for the
other; never merge the two.
- Comparison: quote
book.comparison.line after the table when it is non-null.
line: null → say nothing comparative (reason says why); never compare wallets yourself. It names
wallets, not "you": a managed row's exits are its strategy's.
- Narrow offer — asked once, at the end of the whole answer. When
book.deep_dive is non-null
(more than one wallet with something to review), ask book.deep_dive.question verbatim — "Which
wallet do you want me to go deeper on: …?", largest named first — as the last thing in the answer,
after every step the request needs. It never stops the remaining steps: run and narrate them, then
ask. Go deep on the one they pick.
Your wallets (read-only, traded by hand)
A saved wallet is a Hyperliquid wallet the user added in Your wallets by pasting the address, and
trades by hand. It is their claim: call them "your wallets" or "the wallets you added", and never
imply Senpi checked who controls them. The engine adds every one to the review set and returns it in
external_wallets[] (the
timing step and all) — its own read, never folded into pnl_summary, strategies[],
dsl_close_reason_mix, timing_summary or leaks, which stay Senpi-only.
- Access line, verbatim — the answer to "can you close / trade / set a stop on it":
Read-only. Senpi can analyze this wallet. It cannot place, change or cancel orders on it.
- Every exit is a
MANUAL_TRADE (say "manual trade", source external_wallet). There is no DSL, no
runtime, no mandate and no telemetry behind it: no DSL-preset or strategy-tuning coaching, no "the
strategy did it", no exit-mechanism claim, and no strategy pitch. Coach the user's own process
(timing, give-back, fees).
- No write suggestions on these wallets — no
close.py, redeploy, edit_position,
close_position, strategy_* or ratchet_stop_*. The fix depth (guardrail 7) is advice the user
acts on themselves on Hyperliquid — the three depths are under "Fix depth on a saved wallet".
- "Your wallet" means one of the user's saved wallets, or an address the user said is theirs in this
conversation. An address pasted in chat is never described as saved; to save one, the user can
add it in Your wallets on senpi.ai (web).
- Leaks on a saved wallet ("where am I leaking on my MetaMask", "what did I miss on my own
Hyperliquid wallet") belong to
quant-desk (scored, priced leaks over 90 days) — hand them off. This
skill keeps the leaks of Senpi strategies. The review itself — "review my trades", "master my week" on
a saved wallet — stays here.
HARD RULES (never violate — obey these even if you skim the rest)
A "measurement framework", recurring analytics, or a scheduled review is read on demand, never an agent-turn cron. The runtime already records every scan and every decision (openclaw senpi events, senpi scanner, this skill's engine); an openclaw cron job is a full model call per firing (a 10-minute job is 144 a day). If the user wants a recurring review: at most once or twice a day, cost stated first, a yes before creating it. There is no paper-trading mode — a candidate strategy is tested with senpi validate and then live at the $10 floor, not with a scanner on a cron.
- Never quote a $ PnL without saying which side of fees it is on.
realized and total are HL
closedPnl — GROSS. Quote pnl_summary.realized_net for the closed book and show the fee line; when
fees is null say "gross — fees not netted". fee already INCLUDES
builderFee — never add them.
The fee rate is NOT a constant — never quote one from memory. Read the user's own rate with
user_get_senpi_points (builderFeePercent). Quote the measured fee from the trade whenever you
can; when you must state a rate, state theirs.
0b. Never take leverage from the config — read what the position ACTUALLY opened at. The venue caps
leverage per asset and clips silently: default_leverage is a request, not what opened.
ROE = price move % x ACTUAL leverage — read it from DslState.leverage (senpi dsl inspect <asset> --json), the clearinghouse position, or strategy_get_asset_trading_limits, never from runtime.yaml.
Say so when they differ — the venue cap is a fact about the user's exposure, not a footnote.
- Lead with TOTAL PnL (
pnl_summary.total = realized + unrealized), never realized alone. (The
review opens with book, the one list of every wallet — see "One book"; TOTAL leads the Senpi
detail.) Realized-only is half the ledger — it calls a book riding open winners a "loser" and penalizes hold-strategies. If
pnl_summary.unrealized_partial is true (or unrealized_coverage.read < .current_strategies), TOTAL is a
FLOOR, not a complete number — some current wallets couldn't be read. Say "at least $X (N of M wallets
readable)", never present it as the finished total. (total: null = the open book was entirely
unreadable → UNKNOWN, not 0 and not a floor.)
- The hold-to-now counterfactual is CONTEXT, never a verdict.
held_higher / a positive
if_all_reclosed_now_total just means the asset kept running THIS window (hindsight; it ignores the risk
the exit avoided). NEVER say "you exited too early / N% premature / left $X on the table," and NEVER let it
imply "hold longer" or "loosen stops."
- Undetermined ≠ all-clear. When
telemetry_availability.streams_computed is false (or .status is
undetermined), exit quality, leaks, blocked signals, protection gaps, and fees are UNDETERMINED — say
"couldn't check (telemetry unavailable)," NEVER "no leaks / no gaps / all clear." When
exit_attribution.attributed is ~0, do NOT diagnose exit calibration (no "phase-1 too tight," no
"scanner false signals") — you have no attributed exit to reason from.
- Quote the engine's numbers verbatim. Every $ and count you state must be a field the engine emitted
(
pnl_summary, timing_summary, strategies[], realized_by_book). NEVER re-derive or estimate an
aggregate — that is how fabrications like "closed did −$405" happen.
- It's the strategy, not the user — on Senpi strategy trades. Route every fix on a Senpi strategy trade
to the strategy config (a DSL tier, the hard stop, an entry gate); never "you should have…". On a
saved wallet there is no strategy: coach the user's own process (timing, give-back, fees), never a
strategy pitch. No fabricated forward numbers (no $/week). No guaranteed-gain language.
The detailed guardrails below explain each; these five are the floor.
Use this skill FIRST — before any raw MCP. (Bars replacing the engine with raw dumps; not the
targeted reads in guardrail 6b.) For any
"review my trades / did I sell too early / what did
I miss / master my week / how could I make more gains" question, run this engine before reaching for
raw discovery_get_trader_history / market_get_prices / execution_get_closed_position_details. Those
return un-attributed dumps that invite exactly the failure modes below (skipping the current-price
comparison, guessing the exit mechanism). And never use audit_* for closed trades — those tools are
deprecated; the engine sources closed trades from discovery_get_trader_history.
Your wallets — unknown reads and fix depth
The long tail of "Your wallets" above.
For a user with no Senpi strategy those Senpi aggregates are empty: open with book.rows as always (see
"One book"), and the detail is external_wallets[].
- Unknown is never empty.
external_wallets: null (meta.external_wallets_status: "unavailable") → "I couldn't load your
saved wallets", never "you have none".
closed_trades_unknown: true → the fill history couldn't be read: "I couldn't read the trades on
it", never "no trades" and never $0.
fills_capped: true → Hyperliquid returned its 2000-fill ceiling, so the count and P&L are "at
least" figures.
state: null (state_read: "unavailable") → "couldn't load this wallet". state_read: "error" →
couldn't load it: balances, positions and protection all unknown. read_error is matched by
prefix — never print the code.
- Open positions (
open_positions) are the wallet's state.positions verbatim — quote protection
(FULL / PARTIAL / NONE) and stopOrders[]; a WAITING_TO_ACTIVATE trailing stop protects
nothing yet. null → couldn't load, never "flat". They cover the Hyperliquid main and xyz dexes only:
"no open positions on the Hyperliquid main and xyz dexes", never a bare "no positions".
external_no_trades — saved wallets, no Senpi strategy, nothing closed in the window: say it
in one line and offer a longer --window. Never pitch a strategy.
Fix depth on a saved wallet — advice they apply on Hyperliquid
Guardrail 7's three depths apply to Senpi strategy trades. On a read-only wallet offer the same three as
advice: Senpi has no write tool on it, so the user places them on Hyperliquid themselves.
- Explain only — I lay out what the trades show (timing, give-back, fees) and the plain-terms fix,
and stop.
- Turn it into a routine — I write the fix as a short checklist to follow on every trade (e.g. "set
the stop in the same minute you open").
- Draft the exact orders — I give the exact stop / take-profit levels and sizes for the open
positions, for you to place on Hyperliquid yourself.
Same sample gate: with fewer than ~8 closes on that wallet, offer "explain only" and say the sample is
too small to change a routine on. Same floor: no write tool, no template or strategy pitch, no "Senpi
will".
Nothing to review? Read meta.book_state FIRST — it decides the whole answer
Every engine output carries meta.book_state. Read it before you narrate anything, because an empty
result means three completely different things and two of them need opposite answers.
book_state |
Situation |
What you do |
no_strategies |
Nothing deployed. Genuinely nothing to review. |
Pivot to the market — see below. |
strategies_no_trades |
Deployed, hasn't traded yet. |
Diagnose the strategy they already have. Never pitch another one. |
has_trades |
Normal. |
Review as usual. |
external_no_trades |
Saved wallets, no Senpi strategy, nothing closed in the window. |
One line, offer a longer window. Never pitch a strategy. |
unknown |
The strategy list was unreadable (token/scope), or there are no strategies and the saved wallets couldn't be loaded. |
Say the read failed. Never say "you have no strategies" or "nothing to review." |
no_strategies — pivot to market-pulse → build one
Say the truth in one line, then pivot — don't dwell. "Nothing to review yet — you haven't deployed a
strategy." Then:
- Read the market first — compose
senpi-market-pulse. What's actually moving today, which asset
classes lead, risk-on or risk-off.
- Then offer to build one on THAT read — compose
senpi-strategy-author with the read as the
brief ("semis and crypto-proxy equities lead while crypto is soft — want to build a strategy on
that?"). Name no template here; author forks the closest one when it fits.
- Offer, never push. If they'd rather wait, that's a fine outcome — say so.
Still forbidden here (guardrail 9 binds): no manufactured critique of an account with nothing in it, no
"your idle cash is a $0/day leak" framing, no DSL alarms. Idle cash is an option, never a loss.
Quick actions — the data and the lever per intent
The actionable lever (the fix) per intent; its step(s) are in the Router, its data in
references/output-shape.md.
| Intent (what the user asks) |
Actionable lever |
| "Did I sell too early / late? / improve my last 10" |
NEUTRAL context — a reversal is one data point, never "premature"; the counterfactual is not a grade (guardrail 1) → the DSL tier that fired (exit_reason) |
| "Master my week" / "analyze my strategies and trades" / "suggest improvements" |
Process recap, each strategy vs its own mandate |
| "What did I miss this week? / compare to market" |
Is the missed mover in the mandate? loosen a gate only if so |
| "How could I make more gains?" |
Strategy tune (DSL / entry gate), never a $/week promise — and never for a saved-only user: coach their own process, no strategy pitch |
| "Compare me to the whales / the market" |
Compose senpi-smart-money / senpi-market-pulse |
| 1. "Am I getting shaken out too early? / how are my exits firing?" |
The DSL preset lever — widen phase1 retrace / retune a tier → senpi-strategy-author / -ops |
| 2. "What did my own limits block? / what couldn't I take?" |
Add a slot · fund margin · loosen a risk gate — the exact gate the reason_code names |
| 3. "Where am I leaking? / fees" |
Fix the failing order path / the stop sync, review the halt reason, tighten the leaky exit |
| 4. "Walk me through / explain my [asset] trade" |
Read the lifecycle; the fix routes to whichever leg misfired |
| 5. "What am I paying in fees — maker vs taker?" |
Prefer maker execution on entry/exit → the fee-optimized-limit lever; authoritative fee $ = the future ledger hook |
| 6. "Why is [strategy] losing?" |
Judge vs the mandate; route the specific DSL / gate fix |
Fee $: execution_quality reports the maker-vs-taker rate today, not fee dollars. The
authoritative fee $ per order is a ledger join (references/sources.md). That per-order
join is the future upgrade; it's intentionally not called per-trade (rate-limit risk), so until it's
wired, quote the maker ratio as a fee-tier signal, never a fee dollar total. (pnl_summary.fees and the
trade rows do carry fee $.)
Fee rate (hard rule 0): Senpi charges no builder fee on a paid plan (Pro, Advanced, Quant, and
Starter for people already on it); tiers and points no longer change it. Quote fees from the fills,
never a rate from memory — the rate is not a constant. A fill keeps the fee it was signed with, so an order placed before
2026-10-26 (a resting stop included) can still carry a builder leg: read it from the fill's own
builderFee.
Quick action 4 — the explain command in full. For "walk me through / explain my BTC trade," the agent
runs the native lifecycle command directly (it's not in review.py — it's the runtime CLI):
openclaw senpi explain <ASSET> --runtime <id> --json # e.g. openclaw senpi explain BTC --runtime kodiak-main --json
You need the
runtime id, which is the key the event log is addressed by. Get it from the runtime registry
(installed_runtimes.json, the same source the engine reads for mandates — each entry's id) or from
openclaw senpi runtime list. A closed strategy has no ring → explain returns nothing; that's expected,
say so, don't call it a bug. The output shape: references/exit-records.md.
Sources — onchain vs runtime (the split that keeps you honest)
Two sources, two jobs. Never mix them, and never reconstruct one from the other.
- Onchain trade facts →
discovery. The trade list itself + every onchain fact: asset, direction,
entry/exit price, realized PnL, fees, timing, leverage, size. Discovery owns these — they are never
re-derived from anything else.
- Runtime / agent events →
telemetry (the on-disk event log). The facts discovery can't see because
they left no onchain trace: each trade's exit reason (dsl.closed / position.closed close_reason +
tier + roe), the blocked/rejected signals you never took (signal.outcome), and the leak / exit-
quality reads (failed orders, protection gaps, risk halts, maker-vs-taker fills). Telemetry enriches
the discovery trades — it fills exit_reason and produces the standalone streams; it never becomes the
trade list and never re-derives a price or PnL.
Telemetry is read ONLY from the current book. A
closed strategy's exit reasons therefore come from the ratchet record or honest UNKNOWN — and the durable
central event log (keyed by strategy address, survives the close) is the recovery path for them, not the
ephemeral local ring.
When telemetry is unavailable (an older runtime build without the event RPC, or a closed strategy) the
engine fails open to discovery: the trades are still listed, and exit_reason.terminal falls back to the
ratchet record or honest UNKNOWN. Say "exit mechanism not recorded on this build" (or "…this strategy is
closed — its live event ring is gone; the durable log is the recovery path") — never report it as a bug.
meta.telemetry_source (available / partial / unavailable) and meta.exit_reason_source_counts tell you
exactly how much enrichment landed; surface that honestly.
A ratchet-sourced exit never names who closed the trade. On the fallback path the record is a DSL ladder
status, and CLOSED_OFF_LADDER means only that the ladder ended for a reason that was not its own stop — the
runtime closing on signal invalidation or a time cut, the agent calling close_position, and the user closing
on the venue are indistinguishable in it. Say "not closed by its stop"; never "you closed this",
"closed by hand" or "manual". And never print the raw status (MANUALLY_CLOSED, CLOSED_EXTERNALLY,
EXCHANGE_SL_HIT): those are wire values, not words for a reader.
Closed strategies are recovered ON-CHAIN — the engine handles the trap for you. So a closed strategy's trades and realized total come back real — an empty discovery result is never "no trades." You do not hand-read strategy_get_pnl_and_account_value_history for this. If trades[] is still empty after the on-chain fallback, the book genuinely never traded (guardrail 9). How the recovery works: references/sources.md.
Run it in steps — narrate as you go
A full review is several MCP round-trips; run as ONE call it can take minutes, blow the exec timeout,
and make you bail to raw MCP — which loses every guardrail. So run the review as fast, resumable STEPS
and narrate each slice the moment it returns (this mirrors senpi-strategy-ops deploy.py
create→runtime→verify: short steps over a shared state file, the skill narrates between). Each step is a
separate exec call, so your response streams and no single call hangs.
python3 scripts/review.py timing # 1. fetch closed trades + prices → trades[] + timing_summary (FAST slice, narrate first)
python3 scripts/review.py strategies # 2. per-strategy read (mandate/DSL + realized PnL) + closed rollup
python3 scripts/review.py telemetry # 3. exit reasons + missed_signals + leaks + execution_quality (the slow event shell-outs, isolated)
python3 scripts/review.py market # 4. book_vs_market (movers × held) — only if the ask needs it
python3 scripts/review.py all # one-shot fallback: the full composed dict (same output as before)
For a FULL review — "analyze my strategies and trades", "master my week", "suggest improvements", "how
could I make more" — run the steps in order and narrate between:
review.py timing → narrate the timing teardown (the NEUTRAL exit counts exits_ahead / exits_held_higher
- realized so far) — but this is NOT your headline: TOTAL PnL (realized + unrealized) lands with the
strategies step (pnl_summary.total). exit_reason is still UNKNOWN here (telemetry hasn't run) —
narrate the timing, not the mechanism yet, and never call held_higher "premature / left on the table."
review.py strategies → open with book (rows by value, book.total.line, the comparison —
see "One book"), then narrate the per-strategy read (each CURRENT strategy vs its OWN mandate,
realized PnL as evidence; closed_strategies[] is history — no verdict).
review.py telemetry → narrate exit quality / leaks / blocked (now exit_reason is filled: the
refreshed dsl_close_reason_mix, leaks, blocked_summary, execution_quality).
review.py market → narrate the book-vs-market gap (run only if the ask needs "what did I miss /
compare to market").
After the last step the request needs, end the answer with book.deep_dive.question when it is
non-null — once, never mid-review (One book, rule 6).
Narrate each slice as it returns — never wait for all steps. The steps share a state file
(<tempdir>/senpi-improve-trades/state-<window>d.json, overridable with --state), so a later step reuses
what an earlier one fetched instead of re-pulling. For a NARROW ask, run only the minimal step(s) from
the Router (e.g. "did I sell too early" → just timing; "where am I leaking" → just
telemetry) — faster, and each step self-heals its prerequisites so it also works standalone.
Scope the ask. When the user names a trade count — "improve my last 10", "review my last 20 trades" —
pass --last N: it's a GLOBAL bound (the N most-recent closed trades across the whole book), so the review
stays about what they asked instead of the entire 7-day book.
trades[] is a curated OUTLIER SAMPLE, not the whole book. When trades_sample is present, trades_sample.total is the real
count. Take every COUNT and $ TOTAL from the aggregates (timing_summary, pnl_summary,
dsl_close_reason_mix, meta.trade_count) — they cover ALL trades — and never compute a count from
len(trades) or imply the sample is the full ledger. Need the complete per-trade list (rare)? re-run with
--full.
How to run (one-shot fallback)
python3 scripts/review.py # `all` (default): last ~7d composed review — the one-shot fallback
python3 scripts/review.py --window 30 # last 30 days
python3 scripts/review.py --last 20 # cap to the last 20 closed trades
python3 scripts/review.py --no-market # skip the current-price + book-vs-market pull
python3 scripts/review.py --fixture tests/fixtures/review_fixture.json # offline (tests)
Prefer the steps above for a full review (they stream and don't trip the timeout); use all
only when a single blocking call is fine. Read the JSON on stdout and narrate it under the guardrails. It
fails open end-to-end: partial data still returns valid JSON with meta.warnings; meta.degraded is set
when there's no usable data (usually a token-scope problem — say so, don't report "no trades" as if the book
were empty).
The analysis MUST come from review.py. Never bypass it and hand-assemble the review from raw MCP
calls. If a
single call is slow, that's exactly why the steps exist — run timing/strategies/telemetry/market as
separate calls and narrate between (each is fast and self-healing), or pass --last 20 / --no-market to
trim — do NOT substitute raw tool calls for the engine's output, and do NOT let an exec timeout push you
to raw MCP. The only raw MCP you add is to go beyond the review (e.g. a live position detail the user asks
for), never to replace it.
The nine guardrails — the reason this skill exists
These are non-negotiable. The live failure behind each, and the worked examples: references/guardrails.md.
1. TOTAL PnL leads; if_held is NEUTRAL context, symmetric, never the verdict
Lead with pnl_summary.total (realized closed + unrealized open) — NOT realized_pnl_total alone.
(Hard rule 1 has the "at least $X" floor.) Then give the aggregate exit counts (timing_summary: exits_ahead / exits_held_higher / flat). Only after
the aggregate may you mention a single trade, and only as one data point, never the headline.
if_held_delta_usd / if_all_reclosed_now_total are NEUTRAL context, symmetric both ways — never a grade:
- A negative aggregate → your exits, in aggregate, got out ahead of reversals (a good exit-discipline
sign).
- A positive aggregate → the market kept running this window after your exits. This is NOT "money left
on the table," and the
held_higher count is NOT "premature exits." Report it as context
("held to now, the closed book would be +$X vs the realized +$Y"), never a target, a grade, or a reason
to hold longer / loosen stops.
The real evidence for "do you let winners run" is the OPEN book, not this counterfactual —
strategies[].open_positions[] (what you hold now + its unrealized ROE). A book with open winners running IS
letting winners run, whatever the closed-trade counterfactual says.
What if_all_reclosed_now_total is NOT: the counterfactual on the closed trades only — it says nothing
about current OPEN positions or live drawdown; don't read it as "the book is bleeding."
1b. Peak-to-exit GIVE-BACK is the counterfactual that is diagnostic
Report peak ROE, exit ROE, and the share of peak kept, per trade and in aggregate. Habitually keeping a small share of peak means a lock too
low or a first rung arming too late — a named lever.
Keep floor vs fill separate: on AVAX the floor was +8.23% and it filled +7.67%, which is 0.55 ROE points of
execution slippage, not calibration.
2. It's the strategy, not you — fixes route to the strategy config
This section covers Senpi strategy trades. A saved wallet's trades are the user's own manual trades:
there is no strategy config to route to, so coach their process (see "Your wallets") and never pitch one.
These are autonomous strategy trades. The strategy exited them, not the user clicking sell. So never
say "you should have held" or "you sold too early." When the counterfactual favored holding (held_higher), the
lever — IF you decide to act at all — is the strategy config (the DSL preset / entry gates), reported in
strategy terms; held_higher is not itself a defect.
The engine gives you the exact lever: each trade's exit_reason (which DSL tier or hard stop fired) and each
strategy's dsl ladder (hard_stop_roe_pct, arm_at_roe_pct, the tiers[]). A fix reads like "Kodiak's
SOL exit locked at tier 2 (+41% high-water) then trailed out; if you want it to ride further, that's the
phase-2 tier ladder, not anything you did" — and it routes to senpi-strategy-author / senpi-strategy-ops
to apply. Frame every improvement as a strategy tune, never a user scolding.
Config vs live state — do NOT confuse "not armed yet" with "not configured / unprotected." Judge what a
strategy HAS from its dsl ladder config (profile.dsl: hard_stop_roe_pct, arm_at_roe_pct, tiers[]),
never from whether a live position has armed it:
- Phase-1 hard stop protects from ENTRY. A position sitting in phase 1 with no tier locked is not
"unprotected" or "has no stop" — it has the phase-1 floor, and phase 2 simply hasn't armed yet because
the position is below the
arm_at_roe_pct (Tier-1) threshold. That's expected, not a gap. Never say
"no stop-loss," "running unprotected," or "zero DSL protection" for a position whose strategy ships a DSL.
- If
tiers[] is present in the config, phase 2 IS configured — do not say "no tier-2 locks exist" or
recommend "add phase-2 tiers." If no live position has armed a tier, say "phase-2 tiers exist (arm at
+X%); nothing has reached the arm threshold yet" — a fact, not a defect. Only recommend adding phase 2 if
the config genuinely lacks tiers[].
- The crypto exit problem is a calibration fix, not a missing-DSL fix: the
arm_at_roe_pct or the phase-1
retrace may be too tight for crypto's volatility relative to equities — that's the lever, stated from the
config.
- A genuinely naked position (runtime deleted, position open on-chain, no DSL monitor) is a real, urgent
thing — but only claim it when you can show the runtime is gone, not when a
ratchet_stop record is
merely empty (empty = sub-Tier-1, which is normal). If unsure, say "verify the runtime is tracking this
position," not "it's unprotected."
3. No fabricated numbers — realized PnL + engine counterfactuals ONLY
Never invent a forward number. No "+$1,400–2,200/week," no "deploy 25% = +$800–1,200," no guaranteed-gain
figure of any kind. The only dollar figures you may state are:
- realized PnL (
realized_pnl, realized_pnl_total) — what actually happened, and
- the engine's counterfactuals (
if_held_delta_usd, if_all_reclosed_now_total) — clearly labeled as
"if held to now" context.
If you feel the urge to annualize, weekly-ize,
or forecast a dollar figure, stop — that urge is the exact failure mode this skill exists to kill.
Account value ≠ P&L — never narrate the value curve as trades. The engine sources closed trades from on-chain fills, so you should not need strategy_get_pnl_and_account_value_history for a trade review at all. If you ever look at it: accountValueHistory is a series of account snapshots, not trades — never narrate "$135 → $133 → $143 → …" as individual round-trips. A curve ending at $0 after a strategy_close / strategy_withdraw_funds is capital RETURNED to the main wallet (a withdrawal), not a loss — the realized result is realized PnL, not the value drop. If realized PnL (e.g. −$21) and the value drop (e.g. −$175) disagree, the difference is the withdrawal — reconcile, never report the drop as a loss.
4. No chasing — one window is noise; weigh mandate + turnover
Do not recommend abandoning a strategy's mandate to buy last window's winners. A book_vs_market.gap (a
mover the book didn't hold) is a question to ask of the strategy's design, not an order to go buy it. One
window is noise; weigh the strategy's mandate, the durability of the regime, and — critically — turnover
cost (fees compound on every rotation; chasing is how books bleed). "HYPE ran +18% and you weren't in it"
is only interesting if HYPE is in the strategy's mandate and the miss reveals a gate that's too tight —
otherwise it's just an asset the strategy was never designed to trade.
5. Inherit the portfolio rules — mandate, multi-wallet, idle-by-design
- Judge each strategy against its OWN mandate (
strategies[].mandate, from the deployed runtime.yaml),
not a generic momentum benchmark. Realized PnL is evidence for the mandate verdict, not the headline.
- A strategy is ALL its wallets. A multi-wallet strategy (long+short, core+ballast, multi-sleeve) is ONE
strategy — never recommend closing / repurposing a single sleeve ("close the duplicate wallet"). One
sleeve of a long/short book is a naked directional position, the opposite of the design.
- NEVER recommend merging or closing one of two ACTIVE wallets that share
group or skill_name.
They are the long + short sleeves (or core + ballast) of ONE multi-wallet strategy; merging
collapses a market-neutral / two-speed book into a naked directional bet. Read the pairing off
group (or skill_name) — never off label, which is each sleeve's OWN name and differs between
them (cougar-long / cougar-short), as do their mandates. When both are null (registry unreadable
and no attribution stamp) you cannot tell sleeves from redeployments: do not recommend consolidating —
say "these two wallets are likely the long/short sleeves of one strategy — check the package before
treating them as duplicates." The "consolidate these wallets" reflex is usually wrong; genuine closed
redeployments live in closed_strategies[], not strategies[], and the live book size is
meta.current_strategy_count, never meta.strategy_count (see rule 8).
- A flat / idle / no-trades-this-window strategy is often by design — the other sleeve waiting for its
signal, or a patient strategy between setups.
on_mandate_note flags this. Never call it "dead."
6. Honest sourcing — say what's missing, name your source
- Undetermined ≠ all-clear (READ
telemetry_availability FIRST). telemetry_availability.status
(available/partial/undetermined/no_trades) + .streams_computed tell you whether the telemetry
streams are real. When streams_computed is false (telemetry down / older build / a closed ring), the
leaks, blocked_summary, execution_quality, and dsl_close_reason_mix ZEROS are fail-open
placeholders, NOT findings — report them as "couldn't check (telemetry unavailable)," never "no leaks /
no protection gaps / no blocked signals / all clear." When exit_attribution.attributed is ~0 (status
undetermined), do NOT diagnose exit calibration at all (no "phase-1 too tight," no "scanner false
signals") — you have no attributed exit; say "exit mechanism undetermined — I'd need the runtime event log,"
and stop.
- Three things never need telemetry — answer them before writing "undetermined": maker vs taker
(
crossed on every fill), fees in $ (fee), and peak ROE
(1m candles over the hold). Scope "undetermined" to blocked signals and protection gaps — and for how the
position closed, work the ladder in 6b before you ever say you could not tell.
- When a price / horizon is missing,
if_held_delta_usd is null and the trade counts as exits_unknown —
say so ("couldn't compare — no current price"), don't invent a comparison.
- Read
meta.warnings and surface material gaps plainly. Missing data is a caveat, not a thing to paper over.
6b. Why the runtime closed it — READ THE REC
…(truncated)
1---2name: senpi-improve-trades3description: >-4 Retrospective trade review + improvement coaching for the user's Senpi trading. Answers "did I sell5 too early or late", "what did I miss this week", "master my week", "compare my trades to the market /6 to the best whales", "how could I make more gains", "suggest improvements", "review my trades", "am I7 getting shaken out too early / how are my exits firing", "what did my own limits block / what couldn't8 I take", "where am I leaking" (on Senpi strategies — "where am I leaking" or "what did I miss" about a9 SAVED wallet the user trades by hand — "my MetaMask", "my own Hyperliquid wallet", "my saved10 wallet" — go to quant-desk), "walk me through / explain11 my [asset] trade", "what am I paying in fees / maker vs taker", "why is [strategy] losing". Saved12 wallets are reviewed here too, read-only, as manual trades — "review my trades" and "master my week"13 on a saved wallet stay in this skill. When the user has NOTHING to review yet, `meta.book_state` routes it: nothing deployed -> read the market (senpi-market-pulse) then build one (senpi-strategy-author); deployed-but-idle -> diagnose THAT strategy, never pitch another. A hidden engine (scripts/review.py) reconstructs every14 CLOSED trade from discovery, enriches each exit reason + blocked signals from the runtime telemetry15 event log, computes the honest "if I'd held to now" counterfactual, and crosses the book against what16 the market did — you narrate it under strict guardrails: process over outcome (lead with the aggregate,17 not the one reversal), it's the STRATEGY not the user (on Senpi strategy trades), NO fabricated "+$X/week", no performance-chasing,18 honest sourcing (onchain facts = discovery, exit reason / blocked / leaks = telemetry), and the user19 chooses how deep the fix goes. Composes senpi-market-pulse (movers), senpi-smart-money (whales), and20 senpi-portfolio (live state). Requires a USER-scoped Senpi token.21license: Apache-2.022metadata:23 source: https://skillmd.com/skills/jiayaoqijia/senpi-improve-trades24 author: Senpi25 version: "1.25.0"26 platform: senpi27 exchange: hyperliquid28---2930# Senpi Improve My Trades — retrospective review + coaching3132## Router — first turn and every follow-up3334**On a follow-up, answer only what is new** — never re-send the `book` table, `book.total.line`, the TOTAL35PnL headline or a figure already shown ("open with `book`" is the first answer only). Run only the step(s)36the ask needs; route every fix through the depth choice at the end — never auto-act. Every rule here still37binds on a follow-up; when a row names a reference, read it first.3839| The ask | Run (`review.py` step) | Read first (file in `references/`) |40|---|---|---|41| sell too early / late, "improve my last N" | `timing`, then `telemetry` for the exit *mechanism* — **pass `--last N`** when the ask names a count ("last 10" → `--last 10`) | `guardrails.md` §1, §1b |42| master my week, analyze my strategies and trades, suggest improvements | **all steps in order** (`timing`→`strategies`→`telemetry`→`market`) | `output-contract.md` |43| what did I miss, compare to the market / the whales | `market` (+ `telemetry` for the blocked cohort) | `guardrails.md` §4; whales: compose `senpi-smart-money` |44| make more gains | `strategies` + `telemetry` | `guardrails.md` §2–3 |45| shaken out, how my exits fire, why did it close, what is locked now | `strategies` + `telemetry`; `senpi dsl closes` / `inspect` (guardrail 6b) | `exit-records.md`, `sources.md` |46| what my limits blocked | `telemetry` | `output-shape.md` |47| where am I leaking, fees, maker vs taker | `telemetry` | `guardrails.md` hard rule 0; `output-shape.md`, `sources.md` |48| walk me through my [asset] trade | *(none — `explain` CLI)* | `exit-records.md` |49| why is [strategy] losing | `strategies` + `telemetry` | `guardrails.md` §8; guardrail 5: judge it against its own mandate, all its wallets together, flat-by-design is not a loss |50| nothing to review, an empty result | read `meta.book_state` first | `no_strategies` → `senpi-market-pulse`, then `senpi-strategy-author`; no critique of an empty account ("Nothing to review?" below) |51| a saved wallet | review, master my week: the same steps; leaks, what did I miss: hand off to `quant-desk` | "Your wallets" below |52| the wallet picked from `book.deep_dive.question` | go deep on that one | One book, rule 6; `one-book.md` |53| the user picks a fix depth | *(none)* | `output-contract.md` (both menus) |5455**Still true on every follow-up** (in full further down):56- **Sources.** Two sources, two jobs. Never mix them, and never reconstruct one from the other. Discovery57 owns the trade list and its onchain facts; telemetry owns exit reasons and blocked signals. **Telemetry is58 read ONLY from the current book.** No telemetry: "exit mechanism not recorded on this build", never a bug.59 **A ratchet-sourced exit never names who closed the trade.** Say **"not closed by its stop"**; never "you60 closed this", "closed by hand" or "manual". Never the raw status. ("Sources")61- **Shape.** Discuss individual reversals only after the aggregate, and only as evidence. **Never** give a62 closed strategy a "doing its job / consolidate / kill / fix" verdict. The maker ratio is a fee-tier63 signal, never a fee dollar total. ("The output contract", guardrail 8; the maker ratio: "Quick actions")64- **Fix depth.** End every improvement with "How deep do you want me to go?" and stop: Explain only / Hand65 it to the strategy tools / Draft the config change (on a saved wallet: Explain only / Turn it into a66 routine / Draft the exact orders). Never pick for the user, and never act unprompted. With fewer than ~867 closes, offer "explain only" and say the sample is too small.6869## One book — every wallet first-class7071Every wallet the user has is in one list: the Senpi main wallet and each CURRENT Senpi strategy72(`kind: "managed"`) and each saved wallet (`kind: "read_only"`). `book` (the `strategies` step and `all`)73is that ONE list. Origin is the `kind` column, never a rank and never a section break.7475**The Senpi main wallet is a managed row** (`origin: "main_wallet"`, labelled "Senpi main wallet"),76valued by its own idle cash — the read senpi-portfolio makes — so the managed subtotal (main wallet +77strategies) is portfolio's `managed_usd`. It holds cash, never trades: its trade columns are not78applicable (say "—", never 0) and it is never compared or offered in the deep-dive question.7980**A Senpi strategy is one row with all its wallets.** The row is the strategy (`strategy_wallets[]` lists its instances, `wallet_count`81how many); the review detail goes per instance — `strategies[]`, each verdict, lever and fix depth is82one instance, because each has its own runtime.yaml and its fix can differ. Name the strategy in the83table and the question; name the instance when you judge or fix it.84851. **Open with `book.rows`, in the order the engine gives** (value desc; a wallet that couldn't load is86 last). One table: label, value, kind (managed / read-only), closed trades, realized PnL, fees, open87 positions, protection. Never reorder it, never re-section by origin, never lead with the Senpi88 aggregates and append the saved wallets. Then the detail: the Senpi aggregates (`pnl_summary.total`89 leads them, hard rule 1) and `external_wallets[]`.902. **`value_usd: null` → "couldn't load", never $0** (`value_read` says why; never print a `readError`91 code). `no_hl_activity: true` → "no Hyperliquid activity yet". `value_read: "partial"` → a strategy92 whose value covers only some of its wallets: say "(1 of 2 wallets)" from `wallets_loaded` /93 `wallet_count`.943. **One book total: quote `book.total.line` verbatim.** It carries the managed and read-only subtotals95 and every exclusion ("total excludes 1 wallet that couldn't load", the unpriced coins). Never build a96 "Combined" row, never sum the wallets yourself, and never present it as Senpi performance: Senpi97 performance is the managed subtotal (= `pnl_summary`). The read-only subtotal is never deployable —98 idle-capital, rebalance and strategy CTAs count managed wallets only.994. **Protection stays origin-aware.** A managed row's `protection.kind` is `runtime_exit` (the runtime's100 DSL exit; senpi-portfolio has the live tier). A read-only row's is `live_stops` (how many positions101 are `FULL` / `PARTIAL` / `NONE` on the exchange). Say "runtime exit" for one and "live stops" for the102 other; never merge the two.1035. **Comparison: quote `book.comparison.line` after the table when it is non-null.**104 `line: null` → say nothing comparative (`reason` says why); never compare wallets yourself. It names105 wallets, not "you": a managed row's exits are its strategy's.1066. **Narrow offer — asked once, at the end of the whole answer.** When `book.deep_dive` is non-null107 (more than one wallet with something to review), ask `book.deep_dive.question` verbatim — "Which108 wallet do you want me to go deeper on: …?", largest named first — as the last thing in the answer,109 after every step the request needs. It never stops the remaining steps: run and narrate them, then110 ask. Go deep on the one they pick.111112## Your wallets (read-only, traded by hand)113114A **saved wallet** is a Hyperliquid wallet the user added in Your wallets by pasting the address, and115trades by hand. It is their claim: call them "your wallets" or "the wallets you added", and never116imply Senpi checked who controls them. The engine adds every one to the review set and returns it in117`external_wallets[]` (the118`timing` step and `all`) — its own read, never folded into `pnl_summary`, `strategies[]`,119`dsl_close_reason_mix`, `timing_summary` or `leaks`, which stay Senpi-only.120121- **Access line, verbatim** — the answer to "can you close / trade / set a stop on it":122 > Read-only. Senpi can analyze this wallet. It cannot place, change or cancel orders on it.123- **Every exit is a `MANUAL_TRADE`** (say "manual trade", source `external_wallet`). There is no DSL, no124 runtime, no mandate and no telemetry behind it: no DSL-preset or strategy-tuning coaching, no "the125 strategy did it", no exit-mechanism claim, and no strategy pitch. Coach the user's own process126 (timing, give-back, fees).127- **No write suggestions** on these wallets — no `close.py`, redeploy, `edit_position`,128 `close_position`, `strategy_*` or `ratchet_stop_*`. The fix depth (guardrail 7) is advice the user129 acts on themselves on Hyperliquid — the three depths are under "Fix depth on a saved wallet".130- **"Your wallet"** means one of the user's saved wallets, or an address the user said is theirs in this131 conversation. An address pasted in chat is never described as saved; to save one, the user can132 add it in Your wallets on senpi.ai (web).133- **Leaks on a saved wallet** ("where am I leaking on my MetaMask", "what did I miss on my own134 Hyperliquid wallet") belong to `quant-desk` (scored, priced leaks over 90 days) — hand them off. This135 skill keeps the leaks of Senpi strategies. The review itself — "review my trades", "master my week" on136 a saved wallet — stays here.137138## HARD RULES (never violate — obey these even if you skim the rest)139140**A "measurement framework", recurring analytics, or a scheduled review is read on demand, never an agent-turn cron.** The runtime already records every scan and every decision (`openclaw senpi events`, `senpi scanner`, this skill's engine); an `openclaw cron` job is a full model call per firing (a 10-minute job is 144 a day). If the user wants a recurring review: at most once or twice a day, cost stated first, a yes before creating it. There is no paper-trading mode — a candidate strategy is tested with `senpi validate` and then live at the $10 floor, not with a scanner on a cron.1411420. **Never quote a $ PnL without saying which side of fees it is on.** `realized` and `total` are HL143 `closedPnl` — **GROSS**. Quote `pnl_summary.realized_net` for the closed book and show the fee line; when144 `fees` is `null` say *"gross — fees not netted"*. `fee` already INCLUDES145 `builderFee` — never add them.146 **The fee rate is NOT a constant — never quote one from memory.** Read the user's own rate with147 **`user_get_senpi_points`** (`builderFeePercent`). Quote the *measured* fee from the trade whenever you148 can; when you must state a rate, state theirs.1490b. **Never take leverage from the config — read what the position ACTUALLY opened at.** The venue caps150 leverage per asset and **clips silently**: `default_leverage` is a request, not what opened.151 **ROE = price move % x ACTUAL leverage** — read it from `DslState.leverage` (`senpi dsl inspect <asset>152 --json`), the clearinghouse position, or `strategy_get_asset_trading_limits`, never from runtime.yaml.153 **Say so when they differ** — the venue cap is a fact about the user's exposure, not a footnote.1541. **Lead with TOTAL PnL** (`pnl_summary.total` = realized + unrealized), never realized alone. (The155 review opens with `book`, the one list of every wallet — see "One book"; TOTAL leads the Senpi156 detail.) Realized-only is half the ledger — it calls a book riding open winners a "loser" and penalizes hold-strategies. **If157 `pnl_summary.unrealized_partial` is true (or `unrealized_coverage.read < .current_strategies`), TOTAL is a158 FLOOR, not a complete number** — some current wallets couldn't be read. Say **"at least $X (N of M wallets159 readable)"**, never present it as the finished total. (`total: null` = the open book was *entirely*160 unreadable → UNKNOWN, not 0 and not a floor.)1612. **The hold-to-now counterfactual is CONTEXT, never a verdict.** `held_higher` / a positive162 `if_all_reclosed_now_total` just means the asset kept running THIS window (hindsight; it ignores the risk163 the exit avoided). NEVER say "you exited too early / N% premature / left $X on the table," and NEVER let it164 imply "hold longer" or "loosen stops."1653. **Undetermined ≠ all-clear.** When `telemetry_availability.streams_computed` is false (or `.status` is166 `undetermined`), exit quality, leaks, blocked signals, protection gaps, and fees are **UNDETERMINED** — say167 "couldn't check (telemetry unavailable)," NEVER "no leaks / no gaps / all clear." When168 `exit_attribution.attributed` is ~0, do **NOT** diagnose exit calibration (no "phase-1 too tight," no169 "scanner false signals") — you have no attributed exit to reason from.1704. **Quote the engine's numbers verbatim.** Every $ and count you state must be a field the engine emitted171 (`pnl_summary`, `timing_summary`, `strategies[]`, `realized_by_book`). NEVER re-derive or estimate an172 aggregate — that is how fabrications like "closed did −$405" happen.1735. **It's the strategy, not the user — on Senpi strategy trades.** Route every fix on a Senpi strategy trade174 to the strategy config (a DSL tier, the hard stop, an entry gate); never "you should have…". On a175 saved wallet there is no strategy: coach the user's own process (timing, give-back, fees), never a176 strategy pitch. No fabricated forward numbers (no $/week). No guaranteed-gain language.177178The detailed guardrails below explain each; these five are the floor.179180> **Use this skill FIRST — before any raw MCP.** (Bars *replacing* the engine with raw dumps; not the181> targeted reads in guardrail 6b.) For any182> "review my trades / did I sell too early / what did183> I miss / master my week / how could I make more gains" question, run this engine **before** reaching for184> raw `discovery_get_trader_history` / `market_get_prices` / `execution_get_closed_position_details`. Those185> return un-attributed dumps that invite exactly the failure modes below (skipping the current-price186> comparison, guessing the exit mechanism). And **never use `audit_*`** for closed trades — those tools are187> deprecated; the engine sources closed trades from `discovery_get_trader_history`.188189## Your wallets — unknown reads and fix depth190191The long tail of "Your wallets" above.192For a user with no Senpi strategy those Senpi aggregates are empty: open with `book.rows` as always (see193"One book"), and the detail is `external_wallets[]`.194195- **Unknown is never empty.**196 - `external_wallets: null` (`meta.external_wallets_status: "unavailable"`) → "I couldn't load your197 saved wallets", never "you have none".198 - `closed_trades_unknown: true` → the fill history couldn't be read: "I couldn't read the trades on199 it", never "no trades" and never $0.200 - `fills_capped: true` → Hyperliquid returned its 2000-fill ceiling, so the count and P&L are "at201 least" figures.202 - `state: null` (`state_read: "unavailable"`) → "couldn't load this wallet". `state_read: "error"` →203 couldn't load it: balances, positions and protection all unknown. `read_error` is matched by204 prefix — never print the code.205- **Open positions** (`open_positions`) are the wallet's `state.positions` verbatim — quote `protection`206 (`FULL` / `PARTIAL` / `NONE`) and `stopOrders[]`; a `WAITING_TO_ACTIVATE` trailing stop protects207 nothing yet. `null` → couldn't load, never "flat". They cover the Hyperliquid main and xyz dexes only:208 "no open positions on the Hyperliquid main and xyz dexes", never a bare "no positions".209- **`external_no_trades`** — saved wallets, no Senpi strategy, nothing closed in the window: say it210 in one line and offer a longer `--window`. Never pitch a strategy.211212### Fix depth on a saved wallet — advice they apply on Hyperliquid213214Guardrail 7's three depths apply to Senpi strategy trades. On a read-only wallet offer the same three as215advice: Senpi has no write tool on it, so the user places them on Hyperliquid themselves.216217> - **Explain only** — I lay out what the trades show (timing, give-back, fees) and the plain-terms fix,218> and stop.219> - **Turn it into a routine** — I write the fix as a short checklist to follow on every trade (e.g. "set220> the stop in the same minute you open").221> - **Draft the exact orders** — I give the exact stop / take-profit levels and sizes for the open222> positions, for you to place on Hyperliquid yourself.223224Same sample gate: with fewer than ~8 closes on that wallet, offer "explain only" and say the sample is225too small to change a routine on. Same floor: no write tool, no template or strategy pitch, no "Senpi226will".227228## Nothing to review? Read `meta.book_state` FIRST — it decides the whole answer229230Every engine output carries `meta.book_state`. **Read it before you narrate anything**, because an empty231result means three completely different things and two of them need opposite answers.232233| `book_state` | Situation | What you do |234|---|---|---|235| `no_strategies` | Nothing deployed. Genuinely nothing to review. | **Pivot to the market** — see below. |236| `strategies_no_trades` | Deployed, hasn't traded yet. | Diagnose **the strategy they already have**. **Never pitch another one.** |237| `has_trades` | Normal. | Review as usual. |238| `external_no_trades` | Saved wallets, no Senpi strategy, nothing closed in the window. | One line, offer a longer window. **Never pitch a strategy.** |239| `unknown` | The strategy list was **unreadable** (token/scope), or there are no strategies and the saved wallets couldn't be loaded. | Say the read failed. **Never** say "you have no strategies" or "nothing to review." |240241### `no_strategies` — pivot to market-pulse → build one242243**Say the truth in one line, then pivot — don't dwell.** *"Nothing to review yet — you haven't deployed a244strategy."* Then:2452461. **Read the market first** — compose **`senpi-market-pulse`**. What's actually moving today, which asset247 classes lead, risk-on or risk-off.2482. **Then offer to build one on THAT read** — compose **`senpi-strategy-author`** with the read as the249 brief (*"semis and crypto-proxy equities lead while crypto is soft — want to build a strategy on250 that?"*). Name no template here; author forks the closest one when it fits.2513. **Offer, never push.** If they'd rather wait, that's a fine outcome — say so.252253**Still forbidden here** (guardrail 9 binds): no manufactured critique of an account with nothing in it, no254"your idle cash is a $0/day leak" framing, no DSL alarms. Idle cash is an **option**, never a loss.255256## Quick actions — the data and the lever per intent257258The **actionable lever** (the fix) per intent; its step(s) are in the Router, its data in259`references/output-shape.md`.260261| Intent (what the user asks) | Actionable lever |262|---|---|263| *"Did I sell too early / late? / improve my last 10"* | NEUTRAL context — a reversal is one data point, never "premature"; the counterfactual is not a grade (guardrail 1) → the DSL tier that fired (`exit_reason`) |264| *"Master my week" / "analyze my strategies and trades" / "suggest improvements"* | Process recap, each strategy vs its own mandate |265| *"What did I miss this week? / compare to market"* | Is the missed mover in the mandate? loosen a gate only if so |266| *"How could I make more gains?"* | Strategy tune (DSL / entry gate), never a $/week promise — and never for a saved-only user: coach their own process, no strategy pitch |267| *"Compare me to the whales / the market"* | Compose `senpi-smart-money` / `senpi-market-pulse` |268| **1.** *"Am I getting shaken out too early? / how are my exits firing?"* | The **DSL preset lever** — widen phase1 retrace / retune a tier → `senpi-strategy-author` / `-ops` |269| **2.** *"What did my own limits block? / what couldn't I take?"* | Add a slot · fund margin · loosen a risk gate — the exact gate the `reason_code` names |270| **3.** *"Where am I leaking? / fees"* | Fix the failing order path / the stop sync, review the halt reason, tighten the leaky exit |271| **4.** *"Walk me through / explain my [asset] trade"* | Read the lifecycle; the fix routes to whichever leg misfired |272| **5.** *"What am I paying in fees — maker vs taker?"* | Prefer maker execution on entry/exit → the fee-optimized-limit lever; authoritative fee $ = the future ledger hook |273| **6.** *"Why is [strategy] losing?"* | Judge vs the mandate; route the specific DSL / gate fix |274275**Fee $:** `execution_quality` reports the maker-vs-taker **rate** today, not fee dollars. The276authoritative fee $ per order is a ledger join (`references/sources.md`). That per-order277join is the future upgrade; it's intentionally **not** called per-trade (rate-limit risk), so until it's278wired, quote the maker ratio as a fee-tier signal, never a fee dollar total. (`pnl_summary.fees` and the279trade rows do carry fee $.)280281**Fee rate (hard rule 0):** Senpi charges **no builder fee on a paid plan** (Pro, Advanced, Quant, and282Starter for people already on it); tiers and points no longer change it. Quote fees from the fills,283never a rate from memory — the rate is not a constant. A fill keeps the fee it was signed with, so an order placed before2842026-10-26 (a resting stop included) can still carry a builder leg: read it from the fill's own285`builderFee`.286287**Quick action 4 — the `explain` command in full.** For "walk me through / explain my BTC trade," the agent288runs the native lifecycle command directly (it's not in `review.py` — it's the runtime CLI):289290```sh291openclaw senpi explain <ASSET> --runtime <id> --json # e.g. openclaw senpi explain BTC --runtime kodiak-main --json292```293294You need the295**runtime id**, which is the key the event log is addressed by. Get it from the runtime registry296(`installed_runtimes.json`, the same source the engine reads for mandates — each entry's `id`) or from297`openclaw senpi runtime list`. A closed strategy has no ring → `explain` returns nothing; that's expected,298say so, don't call it a bug. The output shape: `references/exit-records.md`.299300## Sources — onchain vs runtime (the split that keeps you honest)301302Two sources, two jobs. Never mix them, and never reconstruct one from the other.303304- **Onchain trade facts → `discovery`.** The trade **list itself** + every onchain fact: asset, direction,305 entry/exit price, realized PnL, fees, timing, leverage, size. Discovery **owns** these — they are never306 re-derived from anything else.307- **Runtime / agent events → `telemetry` (the on-disk event log).** The facts discovery *can't* see because308 they left no onchain trace: each trade's **exit reason** (`dsl.closed` / `position.closed` close_reason +309 tier + roe), the **blocked/rejected signals** you never took (`signal.outcome`), and the **leak / exit-310 quality** reads (failed orders, protection gaps, risk halts, maker-vs-taker fills). Telemetry **enriches**311 the discovery trades — it fills `exit_reason` and produces the standalone streams; it **never** becomes the312 trade list and **never** re-derives a price or PnL.313314**Telemetry is read ONLY from the current book.** A315closed strategy's exit reasons therefore come from the ratchet record or honest `UNKNOWN` — and the **durable316central event log** (keyed by strategy address, survives the close) is the recovery path for them, not the317ephemeral local ring.318319**When telemetry is unavailable** (an older runtime build without the event RPC, or a closed strategy) the320engine **fails open to discovery**: the trades are still listed, and `exit_reason.terminal` falls back to the321ratchet record or honest `UNKNOWN`. Say **"exit mechanism not recorded on this build"** (or "…this strategy is322closed — its live event ring is gone; the durable log is the recovery path") — **never** report it as a bug.323`meta.telemetry_source` (`available` / `partial` / `unavailable`) and `meta.exit_reason_source_counts` tell you324exactly how much enrichment landed; surface that honestly.325326**A ratchet-sourced exit never names who closed the trade.** On the fallback path the record is a DSL *ladder*327status, and `CLOSED_OFF_LADDER` means only that the ladder ended for a reason that was not its own stop — the328runtime closing on signal invalidation or a time cut, the agent calling `close_position`, and the user closing329on the venue are **indistinguishable** in it. Say **"not closed by its stop"**; never "you closed this",330"closed by hand" or "manual". And never print the raw status (`MANUALLY_CLOSED`, `CLOSED_EXTERNALLY`,331`EXCHANGE_SL_HIT`): those are wire values, not words for a reader.332333**Closed strategies are recovered ON-CHAIN — the engine handles the trap for you.** So a closed strategy's trades and realized total come back **real** — an empty discovery result is never "no trades." You do **not** hand-read `strategy_get_pnl_and_account_value_history` for this. If `trades[]` is still empty after the on-chain fallback, the book genuinely never traded (guardrail 9). How the recovery works: `references/sources.md`.334335## Run it in steps — narrate as you go336337A full review is several MCP round-trips; run as **ONE** call it can take minutes, blow the `exec` timeout,338and make you bail to raw MCP — which loses every guardrail. So run the review as **fast, resumable STEPS**339and **narrate each slice the moment it returns** (this mirrors `senpi-strategy-ops` `deploy.py`340create→runtime→verify: short steps over a shared state file, the skill narrates between). Each step is a341**separate `exec` call**, so your response streams and no single call hangs.342343```sh344python3 scripts/review.py timing # 1. fetch closed trades + prices → trades[] + timing_summary (FAST slice, narrate first)345python3 scripts/review.py strategies # 2. per-strategy read (mandate/DSL + realized PnL) + closed rollup346python3 scripts/review.py telemetry # 3. exit reasons + missed_signals + leaks + execution_quality (the slow event shell-outs, isolated)347python3 scripts/review.py market # 4. book_vs_market (movers × held) — only if the ask needs it348python3 scripts/review.py all # one-shot fallback: the full composed dict (same output as before)349```350351**For a FULL review** — "analyze my strategies and trades", "master my week", "suggest improvements", "how352could I make more" — run the steps **in order** and narrate between:3533541. `review.py timing` → narrate the timing teardown (the NEUTRAL exit counts `exits_ahead` / `exits_held_higher`355 + realized so far) — but this is NOT your headline: TOTAL PnL (realized + unrealized) lands with the356 `strategies` step (`pnl_summary.total`). `exit_reason` is still `UNKNOWN` here (telemetry hasn't run) —357 narrate the *timing*, not the mechanism yet, and never call `held_higher` "premature / left on the table."3582. `review.py strategies` → open with **`book`** (rows by value, `book.total.line`, the comparison —359 see "One book"), then narrate the **per-strategy read** (each CURRENT strategy vs its OWN mandate,360 realized PnL as evidence; `closed_strategies[]` is history — no verdict).3613. `review.py telemetry` → narrate **exit quality / leaks / blocked** (now `exit_reason` is filled: the362 refreshed `dsl_close_reason_mix`, `leaks`, `blocked_summary`, `execution_quality`).3634. `review.py market` → narrate the **book-vs-market gap** (run only if the ask needs "what did I miss /364 compare to market").365366**After the last step the request needs**, end the answer with `book.deep_dive.question` when it is367non-null — once, never mid-review (One book, rule 6).368369**Narrate each slice as it returns — never wait for all steps.** The steps share a state file370(`<tempdir>/senpi-improve-trades/state-<window>d.json`, overridable with `--state`), so a later step reuses371what an earlier one fetched instead of re-pulling. **For a NARROW ask, run only the minimal step(s)** from372the Router (e.g. "did I sell too early" → just `timing`; "where am I leaking" → just373`telemetry`) — faster, and each step self-heals its prerequisites so it also works standalone.374375**Scope the ask.** When the user names a trade count — "improve my last 10", "review my last 20 trades" —376**pass `--last N`**: it's a GLOBAL bound (the N most-recent closed trades across the whole book), so the review377stays about what they asked instead of the entire 7-day book.378379**`trades[]` is a curated OUTLIER SAMPLE, not the whole book.** When `trades_sample` is present, `trades_sample.total` is the real380count. **Take every COUNT and $ TOTAL from the aggregates** (`timing_summary`, `pnl_summary`,381`dsl_close_reason_mix`, `meta.trade_count`) — they cover ALL trades — and **never** compute a count from382`len(trades)` or imply the sample is the full ledger. Need the complete per-trade list (rare)? re-run with383`--full`.384385## How to run (one-shot fallback)386387```sh388python3 scripts/review.py # `all` (default): last ~7d composed review — the one-shot fallback389python3 scripts/review.py --window 30 # last 30 days390python3 scripts/review.py --last 20 # cap to the last 20 closed trades391python3 scripts/review.py --no-market # skip the current-price + book-vs-market pull392python3 scripts/review.py --fixture tests/fixtures/review_fixture.json # offline (tests)393```394395Prefer the **steps** above for a full review (they stream and don't trip the timeout); use `all`396only when a single blocking call is fine. Read the JSON on stdout and narrate it under the guardrails. It397fails open end-to-end: partial data still returns valid JSON with `meta.warnings`; `meta.degraded` is set398when there's no usable data (usually a token-scope problem — say so, don't report "no trades" as if the book399were empty).400401**The analysis MUST come from `review.py`. Never bypass it and hand-assemble the review from raw MCP402calls.** **If a403single call is slow, that's exactly why the steps exist — run `timing`/`strategies`/`telemetry`/`market` as404separate calls and narrate between** (each is fast and self-healing), or pass `--last 20` / `--no-market` to405trim — do NOT substitute raw tool calls for the engine's output, and do NOT let an `exec` timeout push you406to raw MCP. The only raw MCP you add is to go *beyond* the review (e.g. a live position detail the user asks407for), never to replace it.408409## The nine guardrails — the reason this skill exists410411These are non-negotiable. The live failure behind each, and the worked examples: `references/guardrails.md`.412413### 1. TOTAL PnL leads; `if_held` is NEUTRAL context, symmetric, never the verdict414415**Lead with `pnl_summary.total`** (realized closed + unrealized open) — NOT `realized_pnl_total` alone.416(Hard rule 1 has the "at least $X" floor.) Then give the aggregate exit counts (`timing_summary`: `exits_ahead` / `exits_held_higher` / flat). Only after417the aggregate may you mention a single trade, and only as *one data point*, never the headline.418419`if_held_delta_usd` / `if_all_reclosed_now_total` are **NEUTRAL context, symmetric both ways — never a grade:**420- A **negative** aggregate → your exits, in aggregate, **got out ahead of reversals** (a *good* exit-discipline421 sign).422- A **positive** aggregate → the market kept running this window after your exits. This is **NOT** "money left423 on the table," and the `held_higher` count is **NOT** "premature exits." Report it as context424 ("held to now, the closed book would be +$X vs the realized +$Y"), **never** a target, a grade, or a reason425 to hold longer / loosen stops.426427**The real evidence for "do you let winners run" is the OPEN book, not this counterfactual** —428`strategies[].open_positions[]` (what you hold now + its unrealized ROE). A book with open winners running IS429letting winners run, whatever the closed-trade counterfactual says.430431**What `if_all_reclosed_now_total` is NOT:** the counterfactual on the **closed** trades only — it says nothing432about current OPEN positions or live drawdown; don't read it as "the book is bleeding."433434### 1b. Peak-to-exit GIVE-BACK is the counterfactual that *is* diagnostic435436Report **peak ROE, exit ROE, and the share of peak kept**, per trade and in aggregate. Habitually keeping a small share of peak means a lock too437low or a first rung arming too late — a named lever.438439Keep **floor vs fill** separate: on AVAX the floor was +8.23% and it filled +7.67%, which is 0.55 ROE points of440execution slippage, not calibration.441442### 2. It's the strategy, not you — fixes route to the strategy config443444This section covers **Senpi strategy** trades. A saved wallet's trades are the user's own manual trades:445there is no strategy config to route to, so coach their process (see "Your wallets") and never pitch one.446447These are **autonomous strategy** trades. The strategy exited them, not the user clicking sell. So **never**448say "you should have held" or "you sold too early." When the counterfactual favored holding (`held_higher`), the449lever — IF you decide to act at all — is the **strategy config** (the DSL preset / entry gates), reported in450strategy terms; `held_higher` is not itself a defect.451The engine gives you the exact lever: each trade's `exit_reason` (which DSL tier or hard stop fired) and each452strategy's `dsl` ladder (`hard_stop_roe_pct`, `arm_at_roe_pct`, the `tiers[]`). A fix reads like *"Kodiak's453SOL exit locked at tier 2 (+41% high-water) then trailed out; if you want it to ride further, that's the454phase-2 tier ladder, not anything you did"* — and it routes to **`senpi-strategy-author` / `senpi-strategy-ops`**455to apply. Frame every improvement as a strategy tune, never a user scolding.456457**Config vs live state — do NOT confuse "not armed yet" with "not configured / unprotected."** Judge what a458strategy HAS from its **`dsl` ladder config** (`profile.dsl`: `hard_stop_roe_pct`, `arm_at_roe_pct`, `tiers[]`),459never from whether a live position has *armed* it:460- **Phase-1 hard stop protects from ENTRY.** A position sitting in phase 1 with no tier locked is **not**461 "unprotected" or "has no stop" — it has the phase-1 floor, and phase 2 simply hasn't **armed** yet because462 the position is **below the `arm_at_roe_pct` (Tier-1) threshold**. That's expected, not a gap. Never say463 "no stop-loss," "running unprotected," or "zero DSL protection" for a position whose strategy ships a DSL.464- **If `tiers[]` is present in the config, phase 2 IS configured** — do not say "no tier-2 locks exist" or465 recommend "add phase-2 tiers." If no live position has armed a tier, say *"phase-2 tiers exist (arm at466 +X%); nothing has reached the arm threshold yet"* — a fact, not a defect. Only recommend adding phase 2 if467 the config genuinely lacks `tiers[]`.468- The crypto exit problem is a **calibration** fix, not a missing-DSL fix: the `arm_at_roe_pct` or the phase-1469 `retrace` may be too tight for crypto's volatility relative to equities — that's the lever, stated from the470 config.471- **A genuinely naked position** (runtime deleted, position open on-chain, no DSL monitor) is a real, urgent472 thing — but only claim it when you can *show the runtime is gone*, not when a `ratchet_stop` record is473 merely empty (empty = sub-Tier-1, which is normal). If unsure, say "verify the runtime is tracking this474 position," not "it's unprotected."475476### 3. No fabricated numbers — realized PnL + engine counterfactuals ONLY477478**Never invent a forward number.** No "+$1,400–2,200/week," no "deploy 25% = +$800–1,200," no guaranteed-gain479figure of any kind. The only dollar figures you may state are:480- **realized PnL** (`realized_pnl`, `realized_pnl_total`) — what actually happened, and481- the engine's **counterfactuals** (`if_held_delta_usd`, `if_all_reclosed_now_total`) — clearly labeled as482 *"if held to now"* context.483484If you feel the urge to annualize, weekly-ize,485or forecast a dollar figure, stop — that urge is the exact failure mode this skill exists to kill.486487**Account value ≠ P&L — never narrate the value curve as trades.** The engine sources closed trades from on-chain fills, so you should not need `strategy_get_pnl_and_account_value_history` for a trade review at all. If you ever look at it: `accountValueHistory` is a series of account **snapshots**, not trades — never narrate "$135 → $133 → $143 → …" as individual round-trips. A curve ending at **`$0` after a `strategy_close` / `strategy_withdraw_funds` is capital RETURNED to the main wallet (a withdrawal), not a loss** — the realized result is realized PnL, not the value drop. If realized PnL (e.g. −$21) and the value drop (e.g. −$175) disagree, the difference **is the withdrawal** — reconcile, never report the drop as a loss.488489### 4. No chasing — one window is noise; weigh mandate + turnover490491Do **not** recommend abandoning a strategy's mandate to buy last window's winners. A `book_vs_market.gap` (a492mover the book didn't hold) is a **question to ask of the strategy's design**, not an order to go buy it. One493window is noise; weigh the strategy's mandate, the durability of the regime, and — critically — **turnover494cost** (fees compound on every rotation; chasing is how books bleed). "HYPE ran +18% and you weren't in it"495is only interesting if HYPE is *in the strategy's mandate* and the miss reveals a gate that's too tight —496otherwise it's just an asset the strategy was never designed to trade.497498### 5. Inherit the portfolio rules — mandate, multi-wallet, idle-by-design499500- **Judge each strategy against its OWN mandate** (`strategies[].mandate`, from the deployed `runtime.yaml`),501 not a generic momentum benchmark. Realized PnL is *evidence for the mandate verdict*, not the headline.502- **A strategy is ALL its wallets.** A multi-wallet strategy (long+short, core+ballast, multi-sleeve) is ONE503 strategy — **never** recommend closing / repurposing a single sleeve ("close the duplicate wallet"). One504 sleeve of a long/short book is a **naked directional position**, the opposite of the design.505- **NEVER recommend merging or closing one of two ACTIVE wallets that share `group` or `skill_name`.**506 They are the **`long` + `short` sleeves** (or `core` + `ballast`) of ONE multi-wallet strategy; merging507 collapses a market-neutral / two-speed book into a **naked directional bet**. Read the pairing off508 `group` (or `skill_name`) — **never off `label`**, which is each sleeve's OWN name and differs between509 them (`cougar-long` / `cougar-short`), as do their mandates. When **both are null** (registry unreadable510 and no attribution stamp) you cannot tell sleeves from redeployments: **do not recommend consolidating** —511 say "these two wallets are likely the long/short sleeves of one strategy — check the package before512 treating them as duplicates." The "consolidate these wallets" reflex is usually wrong; genuine *closed*513 redeployments live in `closed_strategies[]`, not `strategies[]`, and the live book size is514 `meta.current_strategy_count`, never `meta.strategy_count` (see rule 8).515- **A flat / idle / no-trades-this-window strategy is often by design** — the other sleeve waiting for its516 signal, or a patient strategy between setups. `on_mandate_note` flags this. Never call it "dead."517518### 6. Honest sourcing — say what's missing, name your source519520- **Undetermined ≠ all-clear (READ `telemetry_availability` FIRST).** `telemetry_availability.status`521 (`available`/`partial`/`undetermined`/`no_trades`) + `.streams_computed` tell you whether the telemetry522 streams are real. When `streams_computed` is **false** (telemetry down / older build / a closed ring), the523 `leaks`, `blocked_summary`, `execution_quality`, and `dsl_close_reason_mix` ZEROS are **fail-open524 placeholders, NOT findings** — report them as "couldn't check (telemetry unavailable)," **never** "no leaks /525 no protection gaps / no blocked signals / all clear." When `exit_attribution.attributed` is ~0 (status526 `undetermined`), **do NOT diagnose exit calibration at all** (no "phase-1 too tight," no "scanner false527 signals") — you have no attributed exit; say "exit mechanism undetermined — I'd need the runtime event log,"528 and stop.529- **Three things never need telemetry** — answer them before writing "undetermined": **maker vs taker**530 (`crossed` on every fill), **fees in $** (`fee`), and **peak ROE**531 (1m candles over the hold). Scope "undetermined" to blocked signals and protection gaps — and for *how the532 position closed*, work the ladder in 6b before you ever say you could not tell.533- When a price / horizon is missing, `if_held_delta_usd` is `null` and the trade counts as `exits_unknown` —534 say so ("couldn't compare — no current price"), don't invent a comparison.535- Read `meta.warnings` and surface material gaps plainly. Missing data is a caveat, not a thing to paper over.536537### 6b. Why the runtime closed it — READ THE REC538539…(truncated)