mantis-strategy
MANTIS v6.0.0 โ Slipstream (Cross-Asset Catchup Hunter), senpi_runtime_helpers migration. Plumbing-only flip from openclaw cron + mcporter subprocess + in-Python state to in-process SenpiClient (direct HTTPS for MCP, direct HTTP POST to runtime /signals, long-lived producer_daemon). Thesis preserved verbatim from v5.0: when BTC (or another leader) makes a significant 4h move and a correlated alt hasn't responded yet, Mantis strikes the alt before the catchup completes. Confidence-tier sizing preserved. Leader-reversal veto NOW WORKS (v5.0 was silent no-op).
What this skill does
# ๐ฆ MANTIS v6.0.0 โ Slipstream
The mantis is patience plus speed. Stillness, then strike.
## v6.0.0 (2026-05-12) โ plumbing-only migration
NO thesis change. v5.0 entry filters, confidence-tier sizing, dynamic hard_timeout, and leader-reversal veto logic all preserved verbatim. Six-layer plumbing flip:
1. **MCP transport**: `mcporter` subprocess (2.5-5s cold-start) โ `SenpiClient.mcp_call()` in-process HTTPS (~280ms).
2. **Signal emit**: scanner called `create_position` directly; producer now emits via `push_signal()` to runtime `/signals`. Runtime LLM-gated `mantis_entry` action opens via FEE_OPTIMIZED_LIMIT, passing `leverage` + `marginUsd` through from signal data for tier-based sizing.
3. **Leader-reversal veto NOW WORKS.** v5.0 emitted `VETO_CLOSE` stdout JSON that no runtime action consumed (silent no-op). v6.0 wires it as a direct producer-authoritative action โ `cfg.mcp_call("close_position", ...)` fires when the leader reverses >1% from entry value. The runtime cannot express "close this position if a separate asset's 4h move reverses by X%"; that thesis lives in the producer.
4. **Scheduler**: openclaw cron (60s) โ `producer_daemon(interval_seconds=60)`. Long-lived process; scanner_lock with stale-PID auto-recovery.
5. **Risk gates**: Python `MAX_DAILY_ENTRIES` + `asset-cooldowns.json` โ declarative `risk.guard_rails` block. `state/asset-cooldowns.json` deleted (runtime `per_asset_cooldown_minutes: 240` is authoritative).
6. **Exit fee**: DSL exits switched from MARKET (taker, 0.045%) to FEE_OPTIMIZED_LIMIT (maker-first, 0.015%, 60s ALO timeout, taker fallback).
State files retained (producer-authoritative, NOT runtime-leaky):
- `state/position-metadata.json` โ `leader_pct_at_entry` per asset (required for veto pass)
- `state/entry-log.jsonl` โ observability only (no longer used for daily-cap counting)
## What Mantis does
Mantis monitors `market_get_cross_asset_flows` every 60 seconds. When a leader (currently BTC) makes a significant 4h move, the tool surfaces correlated alts that historically follow that leader but haven't yet responded. Mantis filters those laggards by strict criteria, picks the highest-confidence one, and emits a signal to enter the laggard in the direction the leader moved โ sized by confidence, with a hard timeout calibrated to the alt's typical lag distribution.
## The thesis
Pure statistical edge with quantified time bounds:
- **Edge**: alts that follow a leader 85%+ of the time, with low timing variance, are likely to catch up after a leader move
- **Timing**: the alt's historical `avg_lag_minutes` defines the trade's window
- **Exit**: the catchup either happens within `avg_lag ร 1.5` minutes โ or it doesn't happen at all
- **Veto**: if the leader reverses mid-position, the entire thesis is invalidated and Mantis closes immediately (producer-side `close_position` call)
## Entry criteria (all must pass โ preserved from v5.0)
| Filter | Threshold | What it ensures |
|---|---|---|
| `follow_rate` | โฅ 0.85 | Alt historically follows leader 85%+ of moves |
| `confidence` | โฅ 0.75 | Composite of correlation + follow + lag + SM alignment |
| `gap_pct` | โฅ 1.5% (abs) | Catchup opportunity is meaningful |
| `sm_starting_to_rotate` | true | Smart money is confirming the catchup |
| `lag_stddev_minutes` | โค 90 | Timing is predictable enough to trade |
| Asset | not already open | No doubling up on same asset |
| Asset | not in `per_asset_cooldown_minutes` | runtime-enforced (240min) |
## Sizing โ conviction tiers (preserved from v5.0)
Sizing scales directly off the `confidence` score. Producer computes the tier-based `marginUsd` and `leverage`, embeds in signal `data`; LLM passes both through to the runtime's `OPEN_POSITION` payload.
| Confidence | Margin % | Leverage |
|---|---|---|
| โฅ 0.92 | 75% | 8x |
| โฅ 0.85 | 50% | 7x |
| โฅ 0.75 | 25% | 5x |
Hard cap: 8x leverage, 75% notional of available margin.
## Direction
Match the leader: positive leader 4h move โ LONG the laggard, negative โ SHORT. Mantis never goes against the leader's direction; the entire setup is "the alt is going to catch up to where the leader is."
## Exit logic โ three layers in priority order
1. **Leader-reversal veto** (producer-side, v6.0 wired correctly) โ every 60s tick, Mantis checks the current 4h leader move vs. the leader's move at entry. If the leader has reversed by >1.0% from entry, Mantis calls `close_position` directly with `orderType: FEE_OPTIMIZED_LIMIT` + `ensureExecutionAsTaker: true`, 30s ALO timeout. The thesis was the leader's move; if it dies, the trade dies โ but maker-first with a guaranteed taker fallback saves 0.030% per maker-filled close. Half the DSL exit timeout (30s vs 60s) because vetos are slightly more time-sensitive than retrace-based DSL exits.
2. **Dynamic hard timeout** (producer-side, via signal data) โ `avg_lag_minutes ร 1.5`, clamped to [30, 240] minutes, passed in signal `data.hardTimeoutMinutes`. If the alt hasn't caught up within that window, the catchup probably isn't happening โ DSL `hard_timeout: 240` ceiling backstops.
3. **DSL trail** โ standard Phase 1 / Phase 2 trailing logic for in-window winners:
- Phase 1 max loss: 12%
- Phase 2 trail tiers: 5/30, 10/60, 15/75, 25/85
- Weak peak cut: 20 min, 1.5% min value
- Exits via FEE_OPTIMIZED_LIMIT (v6.0 win)
## Risk controls
| Control | v6.0 source | Value |
|---|---|---|
| Max concurrent positions | `strategy.slots` | 2 |
| Per-asset cooldown | `risk.guard_rails.per_asset_cooldown_minutes` | 240 min |
| Daily entry cap | `risk.guard_rails.max_entries_per_day` | 6 |
| Max position notional | producer-side cap | 75% of available margin |
| Daily loss limit | `risk.guard_rails.daily_loss_limit_pct` | 10% |
| Max consecutive losses | `risk.guard_rails.max_consecutive_losses` | 3 |
| Cooldown after loss | `risk.guard_rails.cooldown_minutes` | 60 min |
| Drawdown halt | `risk.guard_rails.drawdown_halt_pct` | 20% |
| Reset on day rollover | `risk.guard_rails.drawdown_reset_on_day_rollover` | false |
## MCP tools used
Producer side (in-process via `SenpiClient.mcp_call`):
- `market_get_cross_asset_flows` โ primary signal source
- `strategy_get_clearinghouse_state` โ current positions + account value
- `close_position` โ direct call when leader-reversal veto fires
Runtime side (called by senpi-trading-runtime in response to the signal):
- `create_position` (FEE_OPTIMIZED_LIMIT entry via `mantis_entry` action)
- DSL trailing exits via `FEE_OPTIMIZED_LIMIT` close
## Cron cadence
Producer daemon runs every 60 seconds. The cross-asset flow data itself is refreshed daily at 00:00 UTC by the `hyperliquid-cross-asset-flow-cron` job; Mantis consumes the live output.
## Hard rule for user-conversation Claude sessions
User-conversation Claude sessions MUST NOT call any of:
`create_position`, `close_position`, `edit_position`,
`ratchet_stop_add`, `ratchet_stop_edit`, `ratchet_stop_delete`,
`cancel_order`, `strategy_close`, `strategy_close_positions`.
These tools are reserved for the **producer daemon โ runtime action path** (entry), the **DSL ratchet engine** (DSL exits), and the **producer's leader-reversal veto pass** (the only producer-direct `close_position` call site, scoped strictly to assets in `position-metadata.json` whose tracked leader has reversed). User-conversation sessions are **read-only**.
## Operator install
See [README.md](README.md) for fresh-install + migration commands from v5.0.
## Status
**v6.0.0 โ helpers-native migration.** Currently BTC-only as the leader. Adding ETH/SOL/HYPE as leaders is a one-line config change in `mantis_config.py` once pre-computed lag data for those assets ships.
## License
MIT โ Copyright 2026 Senpi (https://senpi.ai).
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts โ single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score โฅ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.