Agent skill

Senpi Trading Runtime Contract

by Senpi-ai in Senpi-ai/senpi-skills

Documents how a Senpi strategy's scan function talks to the runtime that schedules it, sizes orders, and manages stop-loss exits on Hyperliquid.

Apache-2.0Auto-check passedBusiness, Finance & HR

Install Senpi Trading Runtime Contract

skills CLI
$ npx skills add Senpi-ai/senpi-skills --skill senpi-trading-runtime -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Senpi-ai/senpi-skills senpi-trading-runtime --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Senpi-ai/senpi-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/senpi-trading-runtime .claude/skills/senpi-trading-runtime && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
senpi-trading-runtime
GitHub stars
134
Token cost
~2.6k tokens
SKILL.md length
1,187 words
Files
15 (incl. scripts, references)
Skills in repo
5
Repo updated
First seen
Licence
Apache-2.0

At a glance

Documents how a Senpi strategy's scan function talks to the runtime that schedules it, sizes orders, and manages stop-loss exits on Hyperliquid.

  • Understanding what a strategy's scan function is and isn't responsible for
  • SKILL.md covers The runtime model, How your code talks to the…, Runtime commands (essentials) and The reference set, plus 1 more section
  • Runs Python scripts from its folder
  • Writing or reading a runtime configuration file for a Senpi strategy

What it does

This skill is reference knowledge rather than a build tool: it explains how a strategy declared in a runtime configuration file hands control to the Senpi runtime, which spawns and supervises its Python module and calls a scan function on a fixed interval. That function's only job is to read market and account data and return candidate signals — it never opens, closes, sizes, or schedules a trade on its own.

Everything after that belongs to the runtime: checking and de-duplicating returned signals, sizing and placing orders, applying risk guard rails, running a two-phase trailing-stop exit, and reconciling positions after a crash. A strategy gets checked with a single real-tick validation rather than a paper-trading mode, and the skill is explicit that it does not cover building, installing, or choosing a strategy — those sit with sibling skills.

When your agent uses it

  • Understanding what a strategy's scan function is and isn't responsible for
  • Writing or reading a runtime configuration file for a Senpi strategy
  • Checking whether an open position has a working stop-loss attached

Example prompts

  • “Explain what my scan function is allowed to return to the runtime.”
  • “Check if this config correctly declares the exit engine.”
  • “Verify that all my open positions have an active stop-loss.”

Requirements

  • Python for the strategy's scan module
  • A Senpi runtime deployment on Hyperliquid

What it can do on your machine

Read from SKILL.md and the folder at commit 4f0a537. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Senpi Trading Runtime Contract loads about 2.6k tokens when it runs, and up to ~19k if it reads all its reference files. Until then it costs about 184 tokens; SKILL.md has 1,187 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~184
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~19k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from Senpi-ai/senpi-skills at commit 4f0a537, republished under its Apache-2.0 licence (© Senpi-ai). 1,187 words, ~2,649 tokens.

Download SKILL.mdSave it as .claude/skills/senpi-trading-runtime/SKILL.md (or your agent's skills folder). This skill also uses 14 other files; get the full folder from GitHub.
name
senpi-trading-runtime
description
How a Senpi trading strategy interacts with the runtime engine (@senpi-ai/runtime) on Hyperliquid: a strategy runs from a runtime.yaml pointing at a Python module that exports scan(inputs, ctx), which the runtime supervises and calls each interval, then owns execution, risk guard_rails, and two-phase DSL trailing-stop exits. Use when working with runtime.yaml, the scan(inputs, ctx) contract, external_scanner, ctx, or the DSL exit engine — including verifying open positions are protected by DSL (have a working stop-loss). The shared runtime contract the lifecycle skills reference. NOT for building, installing, or picking a strategy (→ senpi-strategy-author / senpi-strategy-ops / senpi-strategy-discover).
license
Apache-2.0
metadata.author
Senpi
metadata.version
4.1.7
metadata.platform
senpi
metadata.exchange
hyperliquid

Senpi Trading Runtime — the runtime contract

This skill is infrastructure: the canonical knowledge of how the Senpi runtime (@senpi-ai/runtime) behaves and how a strategy interacts with it. The lifecycle skills — author (build), ops (install/monitor), discover (recommend) — reference this one for the contract.

The runtime model

A strategy runs from a runtime.yaml that points at an in-repo Python module. The runtime spawns and supervises that module and calls a frozen scan(inputs, ctx) every interval_seconds. The division of labor is fixed:

  • Your code produces signals — nothing else. scan(inputs, ctx) reads market and account data and returns a list[dict] of candidate signals. It does not open, close, size, schedule, or execute anything.
  • Zero model cost, and the only loop there is. The runtime ticks every interval_seconds without a model call. Never put an agent-turn cron beside it — a producer, a re-check, a watcher — each firing is a full model call. There is no paper-trading mode: a strategy is tested with senpi validate (one real tick, no wallet) and then run live at the $10 floor.
  • The runtime owns everything downstream: scheduling (interval_seconds), spawning + supervising + restarting the scanner, validating (signal_data_schema) + de-duplicating the signals you return, sizing & order execution (FEE_OPTIMIZED_LIMIT), slot accounting, risk.guard_rails, the two-phase DSL trailing-stop exits, and crash-safe position reconcile on restart.

How your code talks to the runtime

The interaction surface is small and one-directional — you read, you return signals, the runtime acts.

  • runtime.yaml declares the scanner(s), the action gate, the exit engine, and the risk guard-rails, and passes author tunables down via inputs:. → references/runtime-yaml.md
  • scan(inputs, ctx) is the single entry point. inputs is the runtime's inputs: map; ctx gives you:
    • ctx.senpi_mcp.call_tool(name, args) — the Senpi MCP client, read-only (market, account, leaderboard, discovery, strategy_get*, …). It is the only way to fetch data.
    • ctx.state — transactional, runtime-persisted history (last() / append() / len) for dedup, rotation, and first-seen ledgers; advances only on a clean tick.
    • ctx.wallet — the strategy's wallet address.
    • → references/scan-contract.md
  • The return value is a list[dict], one per candidate signal (asset, direction, marginPct, leverage, data{}). The runtime validates each data{} against the runtime.yaml's signal_data_schema, then sizes, executes, and manages exits.

Keep the thesis logic in a sibling pure scoring.py (no I/O, no MCP) so it is unit-testable; scan.py does the reads + state, scoring.py does the math.

Runtime commands (essentials)

The plugin registers a senpi command group on the gateway. Deploying a strategy and checking it:

bash
openclaw plugins install @senpi-ai/runtime
openclaw senpi validate <dir-with-runtime.yaml>        # THE GATE, pre-money: one real tick, no wallet; a PASS records the proof deploy requires
openclaw senpi deploy -p <package-dir> --budget <usd>  # ONE verb, detached: funds preflight → wallet create+fund → install → one observed tick
openclaw senpi deploy status                           # poll until terminal; the verified report (read-only)
openclaw senpi runtime list                            # id, source, status ("running — NO ENTRY SCANNERS" = scanners never wired)

Deploy a package through senpi-strategy-ops' deploy.py create <id> --budget <usd>, which resolves the package, runs the structural preflight and drives that same verb. The verb owns the gates — the live-universe check ([E_UNIVERSE_NOT_LIVE], pre-money), the funds preflight, the skillName/skillVersion attribution and the verified tick. runtime create is internal: it installs a runtime and skips every one of those, so it is not the deploy path.

senpi validate is the gate every deploy runs through — it loads the scanners and runs one real tick with no wallet and no funding, and a full unscoped PASS at live depth is what writes the .senpi-proof.json senpi deploy refuses to fund a package without. Run it before deploy, once per instance, pointed at the directory holding that instance's runtime.yaml.

To CHANGE a strategy that is already live → openclaw senpi update, not a delete-and-redeploy. Deleting a runtime abandons its DSL position files, so every open position loses the trailing stop the strategy already promised and its replacement re-adopts from scratch at whatever price it finds. update swaps the components in place and keeps DSL state, scanner stores and action history — no wallet is created, nothing is funded, and no position is closed.

bash
openclaw senpi update ./pkg                       # PLAN — what changes, what it leaves alone
openclaw senpi update ./pkg --apply               # commit (needs the same proof deploy needs)
openclaw senpi update ./pkg --apply --code-only   # assert only scan.py changed; refuses if not

It plans by default; --apply is the only way to commit. phase2.tiers is what users call the ratchet; with no open position, the edit plus --apply is the whole change. dsl_preset changes are forward-only — new entries only, while every open position keeps a snapshot of the preset it was opened under (other exit: fields, e.g. order_type, are read live and DO reach open positions). Refused outright, changing nothing: a different strategy.wallet (that is a new deployment, and the old wallet's positions would be left unmanaged), an external scanner renamed or moved (state is keyed by name and position together, and inserting or removing one moves every external scanner below it — appending at the end moves nobody and is allowed), or a changed action_type under a stable name. --apply also needs a passing proof that covers the recipe being applied, so point it at the package DIRECTORY: a recipe handed over as bare text has nothing to verify against and is refused. Exit 2 means the runtime was never touched; exit 1 means an apply was attempted and it may not be where you left it — read the message before retrying.

Show full SKILL.md (412 more words)Show less

Saved is not applied. Without --apply, update changes nothing, and only the first line of its output says so — Dry run for <runtime_id> — nothing has been applied. — so never pipe openclaw senpi output through tail or head. A scanner imports scan.py once, when it starts, so a running strategy keeps its old code until --apply restarts its scanners (a crash or a gateway restart would load the edit too, unannounced). senpi validate runs the copy on disk, never the running one, and re-running deploy on a strategy that is already running applies nothing. The edit is live once the apply exits 0 with Updated <runtime_id>. as its first line and no WARNING that its external scanners are NOT running, and the running strategy shows it:

bash
openclaw senpi events -r <runtime_id> --name runtime.updated   # an entry for this apply (code-only edits too)
openclaw senpi update ./pkg --id <runtime_id>                  # read-only: a recipe edit that landed plans "The recipe is unchanged."

Until both reads show it, tell the user the edit is saved, not applied. What a tick keeps and what discards one: references/scan-contract.md.

Beyond validate, deploy/deploy status, update and runtime list/delete, the CLI exposes the runtime's live state — senpi dsl positions|inspect|closes (the exit engine), senpi action list|inspect|history|decisions (the decision layer), senpi risk (am I allowed to trade, and why not), senpi audit (backend trade trail with AI reasoning), senpi scanner (per-scanner health, liveness, and a (no signals yet) flag for scanners that run but produce nothing), senpi events/senpi explain <asset> (the local domain-event log — the trade narrative, and one asset's stitched lifecycle), senpi status/senpi state (health — fail-closed: an external scanner never proven by a tick reads unknown, not healthy; non-healthy scanners get their own line with restart count and cause), and senpi guide … (in-shell reference). Full surface with every option → references/runtime-cli.md.

To confirm open positions are actually stop-loss protected (a position with no DSL shows up as an absence in dsl positions, so it's easy to miss) → the verdict procedure in references/dsl-protection-check.md.

The reference set

Read thisFor
references/runtime-concepts.mdHow the runtime behaves end to end: the runtime pipeline, position_tracker, and the two-phase DSL exit engine
references/runtime-yaml.mdThe runtime.yaml schema — every section, the external_scanner fields, the risk guard-rails
references/scan-contract.mdThe author contract in depth: scan(inputs, ctx), the ctx surface, the signal shape, and scoring.py
references/runtime-cli.mdThe full openclaw senpi … command surface — validate (the pre-deploy gate: flags, depths, exit codes, the proof it records), deploy, runtime, dsl, action, status/state, skills, guide
references/dsl-protection-check.mdVerify open positions are DSL-protected — the PROTECTED / UNPROTECTED / STOP-NOT-ON-VENUE verdict + the open-vs-tracked reconciliation

Package naming (load-bearing)

The runtime package is @senpi-ai/runtime (with -ai) — the one users install on their hosts. Always write it with the -ai.

© Senpi-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 14 other files (scripts, references) in senpi-trading-runtime of Senpi-ai/senpi-skills.

  • SKILL.md
  • references/dsl-protection-check.md
  • references/runtime-cli.md
  • references/runtime-concepts.md
  • references/runtime-yaml.md
  • references/scan-contract.md
  • scripts/behaviour_hash.py
  • scripts/gen_catalog.py
  • scripts/min_budget.py
  • tests/fixtures/min_budget_golden.json
  • tests/test_edit_is_live_only_after_apply.py
  • tests/test_min_budget_golden.py
  • tests/test_min_budget_tier_shapes.py
  • tests/test_reference_candle_time_units.py
  • tests/test_reference_time_cuts_either_phase.py

Open the folder on GitHubat commit 4f0a537

Compare with similar skills

Senpi Trading Runtime Contract next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Senpi Trading Runtime Contract compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Senpi Trading Runtime Contract this skillSenpi-ai/senpi-skills134—~2.6kAutomated safety check: PassApache-2.0
Aomi Transactjeremylongshore/tons-of-skills-marketplace2.8k—~2.3kAutomated safety check: PassMIT
Crypto Pricesundial-org/awesome-openclaw-skills663—~489Automated safety check: PassNone
Vibetrading Code GenLeoYeAI/openclaw-master-skills2.2k—~5.7kAutomated safety check: PassMIT
CCXT Crypto Exchange Library2025Emma/vibe-coding-cn23k1 repos~4.4kAutomated safety check: PassMIT
Minara Crypto Trading and WalletMinara-AI/minara-skills362—~5.7kAutomated safety check: PassNone

Similar skills

  • Aomi Transact

    jeremylongshore/tons-of-skills-marketplace

    Build natural-language crypto agents, web3 assistants, and trading bots that read and write EVM chain state.

    2.8k GitHub stars~2.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Crypto Price

    sundial-org/awesome-openclaw-skills

    Get cryptocurrency token price and generate candlestick charts via CoinGecko API or Hyperliquid API.

    663 GitHub stars~489 tokensUpdated 7 mo ago
    Business, Finance & HRAuto-check passed
  • Vibetrading Code Gen

    LeoYeAI/openclaw-master-skills

    Generate executable Hyperliquid trading strategy code from natural language prompts.

    2.2k GitHub stars~5.7k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • CCXT Crypto Exchange Library

    2025Emma/vibe-coding-cn

    Reference help for the CCXT library covering crypto exchange APIs, market data, trading and order management across 150+ exchanges in JavaScript, Python and PHP.

    23k GitHub starsUsed in 1 repo~4.4k tokens
    Business, Finance & HRAuto-check passed
  • Minara Crypto Trading and Wallet

    Minara-AI/minara-skills

    Drives the Minara CLI for crypto swaps, perps, limit orders, wallet transfers, deposits and withdrawals, plus AI market analysis.

    362 GitHub stars~5.7k tokensUpdated 24 days ago
    Business, Finance & HRAuto-check passed
  • Hyperliquid CLI Trading

    chrisling-dev/hyperliquid-cli

    Trades crypto perpetuals and HIP-3 stocks and commodities on Hyperliquid from the terminal with the hl CLI, including live position tracking and multiple accounts.

    100 GitHub stars~1.8k tokensUpdated 8 mo ago
    Business, Finance & HRAuto-check passed

More from Senpi-ai/senpi-skills

  • Senpi Account Status

    Senpi-ai/senpi-skills

    Reports a user's Senpi points, rank, loyalty tier, fees and referral earnings from one real-time script, and explains the AI-credit usage meter without ever reading its balance.

    134 GitHub stars~3k tokensUpdated yesterday
    Auto-check passed
  • Senpi Market Pulse

    Senpi-ai/senpi-skills

    Produces a structured cross-asset read of the day across crypto, equities, indices, commodities and macro, using a bundled engine for data and ending with a signals brief.

    134 GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Reads where proven profitable Hyperliquid wallets are positioned versus smaller traders, surfacing the divergence worth paying attention to.

    134 GitHub stars~4k tokensUpdated yesterday
    Auto-check passed
  • Senpi Why

    Senpi-ai/senpi-skills

    Answer "what makes Senpi different?" / "why Senpi?" / "Senpi vs other trading apps, bots or AI chatbots?" — the positioning answer, led by value, not a feature dump.

    134 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed

Questions about Senpi Trading Runtime Contract

What does Senpi Trading Runtime Contract do?

Documents how a Senpi strategy's scan function talks to the runtime that schedules it, sizes orders, and manages stop-loss exits on Hyperliquid. This skill is reference knowledge rather than a build tool: it explains how a strategy declared in a runtime configuration file hands control to the Senpi runtime, which spawns and supervises its Python module and calls a scan function on a fixed interval. That function's only job is to read market and account data and return candidate signals — it never opens, closes, sizes, or schedules a trade on its own.

When should I use Senpi Trading Runtime Contract?

Senpi Trading Runtime Contract fits situations like: understanding what a strategy's scan function is and isn't responsible for; writing or reading a runtime configuration file for a Senpi strategy; checking whether an open position has a working stop-loss attached.

How do I install Senpi Trading Runtime Contract in Claude Code?

Run `npx skills add Senpi-ai/senpi-skills --skill senpi-trading-runtime -a claude-code`. Or copy the skill folder (senpi-trading-runtime in Senpi-ai/senpi-skills) into .claude/skills/senpi-trading-runtime in your project. Claude Code loads it when a task matches its description.

How do I install Senpi Trading Runtime Contract in Codex?

Run `npx skills add Senpi-ai/senpi-skills --skill senpi-trading-runtime -a codex`. Or copy the skill folder (senpi-trading-runtime in Senpi-ai/senpi-skills) into .agents/skills/senpi-trading-runtime in your project. Codex loads it when a task matches its description.

Can I use Senpi Trading Runtime Contract in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Senpi-ai/senpi-skills --skill senpi-trading-runtime -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/senpi-trading-runtime, .gemini/skills/senpi-trading-runtime, .github/skills/senpi-trading-runtime and .opencode/skills/senpi-trading-runtime in your project.

What does Senpi Trading Runtime Contract need to run?

Going by SKILL.md and its folder, Senpi Trading Runtime Contract needs Python for the scripts in its folder. Our summary lists: Python for the strategy's scan module; A Senpi runtime deployment on Hyperliquid.

Does Senpi Trading Runtime Contract access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Senpi Trading Runtime Contract safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Senpi Trading Runtime Contract use?

Senpi Trading Runtime Contract is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Senpi Trading Runtime Contract use?

About 2.6k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.

What are the alternatives to Senpi Trading Runtime Contract?

Skills that share tags, products or a category with Senpi Trading Runtime Contract: Aomi Transact (jeremylongshore/tons-of-skills-marketplace, 2.8k stars), Crypto Price (sundial-org/awesome-openclaw-skills, 663 stars), Vibetrading Code Gen (LeoYeAI/openclaw-master-skills, 2.2k stars) and CCXT Crypto Exchange Library (2025Emma/vibe-coding-cn, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Senpi Trading Runtime Contract?

Senpi-ai (a GitHub organization) maintains it in Senpi-ai/senpi-skills, which has 134 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 10, 2026.

Source: Senpi-ai/senpi-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.