Lighter Agent Kitのロゴ

Lighter Agent Kit

組織
elliottech
lighter-agent-kit

Query Lighter DEX market data on Lighter and Robinhood Lighter (orderbooks, trades, candles, funding rates) and execute trades (limit and market orders, modify, cancel, leverage, margin, withdraw, spot and perp transfers) on perpetual and spot markets. Use when the user mentions Lighter, zkLighter, perps, perpetual futures, or wants to check positions or PnL or place orders on Lighter.

概要

公開者elliottech
リポジトリlighter-agent-kit
スキル名lighter-agent-kit
スター
73
フォーク
8
同梱ファイル
22
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 22個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    elliottechがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルLighter Agent KitをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/elliottech/lighter-agent-kit/tree/main
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/elliottech/lighter-agent-kit.git \
  .claude/skills/lighter-agent-kit
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでLighter Agent Kitを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にLighter Agent Kitを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Lighter Agent Kitは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Lighter Agent Kit

Trade on Lighter or its Robinhood Chain deployment using the same commands.

Scripts live in this skill's scripts/ directory. Read commands use query.py, write commands use trade.py. Every command prints structured JSON to stdout. Errors are always in JSON as {"error": "..."}.

Commands use <group> <action> syntax mirroring the Lighter UI (e.g. market stats, order limit, orders open).

For response schemas and details, see the references/ folder.

Install

Copy this folder to one of the standard Claude Code skill locations:

  • Personal (all projects): ~/.claude/skills/lighter-agent-kit/
  • Project-level (this repo only): .claude/skills/lighter-agent-kit/

On first call, lighter-sdk and its transitive deps will be installed into <skill>/.vendor/pyX.Y/. Every version is pinned by requirements.lock. Supported targets are Apple Silicon Macs plus Linux x86_64/arm64. Intel Macs are not supported by this kit.

Requires network egress to the selected Lighter host (mainnet.zklighter.elliot.ai, testnet.zklighter.elliot.ai, api.rh.lighter.xyz, or api.rh-testnet.lighter.xyz), pypi.org / files.pythonhosted.org, and github.com (pip clones the pinned lighter-sdk build from GitHub). On Claude.ai's sandbox the default egress allowlist doesn't include github.com — you'll need to expand it before first run.

Read commands work with no credentials. Write commands and account-private reads will first check environment variables and then your personal credentials file — see references/env-vars.md.

How to Handle User Requests

  1. Symbol convention: perp-bare, spot-pair. Perp markets use bare tickers (BTC, ETH, SOL, LIT); spot markets use quote-qualified pairs (ETH/USDC on Lighter, AAPL/USDG on Robinhood Lighter). The presence of / is the single discriminator — no --market_type flag is needed on symbol-resolved commands. Numeric market_index is also accepted as an escape hatch.
  2. Symbol resolution is automatic. Market symbols resolve from the live order-books API and are cached on disk for 5 minutes per host, so query.py, trade.py, and paper.py share the same market map across calls. Fund assets resolve against the selected deployment; collateral aliases its quote asset when unambiguous. Only when the user says something you can't confidently map (e.g. "brent oil", "gold", "silver"), run python3 scripts/query.py market list --search <substring> [--market_type perp|spot] first to discover it. These usually appear under ticker-style symbols like BRENTOIL, XAU, and XAG.
  3. Side accepts both forms. --side buy|sell|long|short — both are accepted on perp and spot. Normalized internally to canonical (long/short for perp, buy/sell for spot).
  4. Filter at the source on high-cardinality reads. market funding, market stats, and market info accept --symbol / --market_index / --exchange — always pass them when you only need one row.
  5. Run the matching script: python3 scripts/query.py <group> <action> ARGS for reads, python3 scripts/trade.py <group> <action> ARGS for writes. Paths are relative to this skill's directory.
  6. Parse the JSON and present it clearly.
  7. Account-scoped commands and LIGHTER_ACCOUNT_INDEX. Two cases:
    • Public reads (account info, account apikeys) accept --account_index and default to LIGHTER_ACCOUNT_INDEX when omitted.
    • Authenticated reads (account limits, portfolio performance, orders open, orders history) are self-only using LIGHTER_ACCOUNT_INDEX instead of --account_index because the auth token is bound to that account.

Diagnostic (optional): if a call fails with an import lighter style error, run python3 scripts/bootstrap.py to verify the SDK vendored correctly. It should return a response with status: ok field. You should never need to run this in a healthy session.


Read Commands (query.py)

Public reads — no credentials

CommandPurpose
system statuszkLighter system status (network id, timestamp).
market list [--market_type perp|spot] [--search X]Compact {symbol, market_index, market_type} catalog. Use for symbol → index lookups.
market stats [--symbol X]Market overview: prices, 24h volumes, daily trades. Pass --symbol to get one row.
market info [--market_type perp|spot] [--symbol X]Full market metadata (fees, decimals, min sizes). Always filter; unfiltered is ~150 rows.
market book <symbol> [--limit 20]Top-of-book bids and asks. <symbol> is perp ticker (BTC), spot pair (ETH/USDC), or numeric market_index. --limit is per side.
market trades <symbol> [--limit 20]Recent fills for one market. --limit max 100.
market candles <symbol> --resolution 1h --count_back 24OHLCV candles. Resolutions: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Returns o/h/l/c (price), v (base volume), V (quote volume), t (bucket start, ms), i (last trade id).
market funding [--symbol X] [--market_index N] [--exchange X]Funding rates across venues. ~300 rows unfiltered; always pass --symbol or --exchange.
account info [--account_index N] [--by l1_address --value 0x…] [--include_zero_positions]Account lookup: balances, positions, assets. Defaults to LIGHTER_ACCOUNT_INDEX. Use --by l1_address --value … to look up by L1 address instead. positions[] is filtered to currently open positions by default — Lighter keeps one row per market the account has ever touched so the raw list can be huge and mostly flat. Pass --include_zero_positions when you need lifetime realized_pnl / total_funding_paid_out per market (PnL analytics, funding audits, tax reports).
account apikeys [--account_index N] [--api_key_index N]List API keys for an account. Omit --api_key_index (defaults to 255) to list all keys.
auth statusLocal-only credential precheck. Returns auth_capable + source per credential. Run once before authenticated calls.

Account-private reads — require LIGHTER_API_PRIVATE_KEY + LIGHTER_ACCOUNT_INDEX + LIGHTER_API_KEY_INDEX

These endpoints generate a short-lived auth token from your configured credentials on every call. The auth token is bound to LIGHTER_ACCOUNT_INDEX, so all four commands below are self-only — they do not accept --account_index and there is no way to query a different account from the one whose private key signed the token.

CommandPurpose
account limitsTrading limits and tier info.
portfolio performance --resolution 1h --count_back 24PnL chart over a time range.
orders open (--symbol X | --market_index N)Open orders on one market. Pass either --symbol (perp ticker or spot pair) or --market_index.
orders history [--symbol X] [--market_index N] [--limit 20]Filled / canceled order history. Market filter is optional.

Platform note: on claude.ai's sandboxed bash environment there is no persistent shell to export env vars into, and pasting an API private key into chat is not acceptable. Treat the four commands above as effectively Claude Code / Cursor / desktop only. On claude.ai, fall back to the public reads or direct the user to the Lighter web/mobile UI for account-private views.

Sanity check: python3 scripts/health.py returns {"status": "ok", "version": "..."} without touching the SDK — useful to confirm the skill loads at all.

See references/schemas-read.md for the full response shapes.


Write Commands (trade.py)

All write commands require credentials. Prices and amounts are in human units (e.g. --price 4050.5 --amount 0.1); the script fetches market metadata and scales them to integer ticks/lots automatically. The response echoes effective_amount / effective_price so you can see what actually landed after rounding.

Side accepts both forms: --side buy|sell|long|short. Both are accepted on perp and spot markets. Normalized internally to canonical (long/short for perp, buy/sell for spot).

Symbol convention: The positional <symbol> argument is a perp ticker (BTC, ETH), a spot pair (ETH/USDC, LIT/USDC), or a numeric market_index (1). The / in a spot symbol is the discriminator — no --market_type flag is needed.

Spot trading: every order command works transparently for spot markets — just pass a spot pair like ETH/USDC. Use query.py market list --market_type spot to discover them. On spot markets, --reduce_only and the position leverage / position margin commands are no-ops — spot has no leveraged positions.

CommandKey arguments
order limit <symbol> --side <side> --amount N --price N [--reduce_only] [--post_only]Limit order on perp or spot.
order market <symbol> --side <side> --amount N [--slippage N] [--reduce_only]Market order on perp or spot. Default slippage 0.01 (1%).
order modify <symbol> --order_index COI --price N --amount NCOI is the client_order_index returned by order limit.
order cancel <symbol> --order_index COICancel a single open order.
order cancel_allCancel every open order across every market (no args).
order close_all [--slippage N] [--with_cancel_all] [--preview]High-risk. Flattens every open position with reduce-only market orders — realizes PnL on every market at once. Always run --preview first and get explicit user approval before the real call; do not auto-infer intent from phrases like "clean up" or "reset". --with_cancel_all also kills TP/SL brackets. When combined with --preview, the response includes a note that cancel-all would run first, but would_close[] still lists positions only.
position leverage <symbol> --leverage N [--margin_mode cross|isolated]Set leverage. Default cross.
position margin <symbol> --amount N --direction add|removeAmount is deployment collateral (USDC or USDG); only valid on isolated positions.
account mode --mode classic|unifiedHigh-risk. Changes account-wide margin behavior. Inspect query.py account info and get explicit user approval first.
account collateral --asset A --mode enabled|disabledHigh-risk. Changes whether an eligible asset contributes collateral in Unified mode. Inspect the account and get explicit user approval first.
funds withdraw --asset A --amount N [--route perp|spot]Default route perp. Accepts any deployment asset symbol or numeric asset ID; collateral aliases the quote asset when it is unambiguous. This creates a withdrawal request; funds may move into a pending / claim flow and not appear in the wallet instantly.
funds transfer --asset A --amount N --from_route perp|spot --to_route perp|spotMoves any deployment asset between your own spot and perp buckets. No L1 signature, no cross-account routing.

order limit and order market return a client_order_index — save it; it is the handle for later order modify / order cancel.

Example — move deployment collateral from perp to spot to fund a spot buy:

bash
python3 scripts/trade.py funds transfer --asset collateral --amount 250 \
    --from_route perp --to_route spot

Example — enable SPY collateral on Robinhood Lighter:

bash
python3 scripts/query.py account info
python3 scripts/trade.py account mode --mode unified
python3 scripts/query.py account info  # wait until account_trading_mode is 1
python3 scripts/trade.py account collateral --asset SPY --mode enabled
python3 scripts/query.py account info

The two write commands above require separate, explicit user approval. account collateral --mode enabled rejects assets the selected deployment does not mark collateral-eligible and rejects Classic-mode accounts.

Every command supports --help. See references/schemas-write.md for the response envelope, precision echoback, and error-code table.


Paper Trading (paper.py)

Simulate trades against real Lighter order book snapshots without credentials, without broadcasting, and without risk. All state is local.

Shared-subset commands use <group> <action> shape identical to trade.py, so swapping the script name swaps the engine. Paper-only lifecycle commands stay flat.

Commands

Paper-only (flat):

CommandPurpose
init [--collateral N] [--tier T]Create paper account. Defaults: --collateral 10000 --tier premium.
reset [--collateral N] [--tier T]Wipe state. No-args form reuses previous collateral and tier.
set_tier --tier TChange fee tier on existing account (updates cached market configs).
status [--no-refresh]Account summary: collateral, PnL, position/trade counts. Auto-refreshes mark prices for all open positions; pass --no-refresh to skip.
positions [--symbol X] [--no-refresh]Open positions. No --symbol lists all. Auto-refreshes mark prices.
trades [--symbol X] [--limit 50]Trade history, most recent first.
health [--no-refresh]Account health: TAV, margin requirements, leverage. Auto-refreshes mark prices.
liquidation_price <symbol> [--no-refresh]Estimated liq price for a position. Auto-refreshes mark prices.
refresh <symbol>Force-refresh one market's order book snapshot. Useful for pre-warming a market before trading, or when you want current mark data without passing --no-refresh on every read.

Shared subset (mirrors trade.py shape):

CommandPurpose
order market <symbol> --side buy|sell|long|short --amount NTaker market order against live book snapshot.
order ioc <symbol> --side buy|sell|long|short --amount N --price NTaker IOC order with limit price.

Swap rule: swap trade.py ↔ paper.py to switch engines:

bash
# live
python3 scripts/trade.py order market BTC --side long --amount 0.1

# paper — same call, same args, no live broadcast
python3 scripts/paper.py order market BTC --side long --amount 0.1

Tiers: standard (0/0 bps), premium (2.8/0.4 bps, default), premium_1 through premium_7. See references/schemas-paper.md for full tier table and response shapes.

Paper vs Live Caveats

These structural simulator limits cause paper-to-live PnL divergence, roughly ordered by how often they bite:

  1. Maker fills never occur. Every paper fill is charged taker fee, even an IOC at the limit price. Live resting limits would pay maker and often get a better effective price.
  2. No order-impact model. Paper orders walk the real book but don't move it. A size that clears 3 levels in paper would, live, push those levels and make the next entry worse.
  3. No latency / partial-fill modeling. Paper fills instantly in full if depth exists. Live orders can miss entries or fill partially.
  4. No funding accrual. For positions held across funding intervals, this is typically the dominant PnL drag/credit. Paper ignores it.
  5. Cross-margin only. Strategies depending on isolated-margin blast-radius containment cannot be paper-validated.

Secondary items:

  • No credentials required for paper mode
  • Perp-only (market_index >= 2048 is rejected)
  • Only MARKET and IOC order types (no resting limits, no stop, no TP, no post-only)
  • Local-only state; rm "$LIGHTER_PAPER_STATE_PATH" (or the default path ~/.lighter/lighter-agent-kit/paper-state.json) is a valid nuclear reset

Environment Variables

See references/env-vars.md. TL;DR: public reads need nothing; for account-private reads and write commands, set LIGHTER_API_PRIVATE_KEY, LIGHTER_ACCOUNT_INDEX, and LIGHTER_API_KEY_INDEX as env vars or in your personal credentials file.

Safety Notes

  • Write commands sign and broadcast immediately. Claude Code's per-tool approval prompt is the user's confirmation step — the user sees the exact command before it runs.
  • funds withdraw, funds transfer, and order amounts are validated client-side (> 0, deployment-reported minimums, market/asset exists, precision fits).
  • funds withdraw is not necessarily an instant wallet credit. A successful response means the withdrawal request was accepted by Lighter. The balance may leave the selected route immediately, while the actual funds move through Lighter's withdrawal / pending-balance / claim flow before showing up in the user's wallet.
  • order close_all is a high-impact, account-wide write. Treat it like funds withdraw: require explicit user approval before running the non-preview form, always run --preview first and show the plan to the user, and never infer intent from vague prompts ("tidy up", "reset my account", "start fresh"). Ask the user to confirm in plain language before the real call.
  • account mode and account collateral change account-wide risk configuration. Read query.py account info, explain the resulting mode/collateral change, and get explicit user approval before each write. Verify with account info afterward.
  • The deployment is selected with LIGHTER_HOST. Use https://testnet.zklighter.elliot.ai or https://api.rh-testnet.lighter.xyz for testing before the corresponding mainnet.
  • First call installs lighter-sdk into <skill>/.vendor/pyX.Y/. Expect ~15–40s on a cold session; subsequent calls are instant. Nothing is written outside the skill folder, so uninstalling is rm -rf <skill>/.vendor.

Credential Security — MANDATORY

Never read, cat, print, echo, or display the credentials file or any environment variable containing a private key. This includes:

  • cat ~/.lighter/lighter-agent-kit/credentials
  • echo $LIGHTER_API_PRIVATE_KEY
  • env | grep LIGHTER
  • Reading .envrc or .env files
  • Any other command that would output secret values to stdout/stderr

Never write your own env-var probe (echo $..., python3 -c "print(os.environ.get(...))") — they miss the credentials file and risk leaking the secret. Secret values inside the SDK are wrapped in SecretValue objects that print [REDACTED]; do not attempt to bypass this.

What capabilities are allowed

CapabilityScopeStatus
Order opscreate / modify / cancel / cancel_all / close_all, leverage, isolated marginSupported
Self-routingfunds transfer between your own spot and perp bucketsSupported
Unified collateralaccount mode and per-asset account collateralSupported with explicit approval
Sub-account routingtransfer between master and sub-accountsNot supported
Cross-account transfertransfer to an arbitrary destination accountNot supported — transferring to arbitrary destinations is risky for unsupervised LLMs; advise the user to do it through the web or mobile interface.
API key rotationchange_api_keyNot supported — rotation requires LIGHTER_ETH_PRIVATE_KEY and a mistake locks the user out of their account; advise the user to do it through the web or mobile interface.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Lighter Agent Kit」では何ができますか?

Query Lighter DEX market data on Lighter and Robinhood Lighter (orderbooks, trades, candles, funding rates) and execute trades (limit and market orders, modify, cancel, leverage, margin, withdraw, spot and perp transfers) on perpetual and spot markets. Use when the user mentions Lighter, zkLighter, perps, perpetual futures, or wants to check positions or PnL or place orders on Lighter.

TypingMindでLighter Agent Kitを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Lighter Agent Kitはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにLighter Agent Kitをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/elliottech/lighter-agent-kit/tree/mainを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Lighter Agent Kitを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Lighter Agent Kitは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもLighter Agent Kitを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Lighter Agent Kit」は無料ですか?

はい。elliottechがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇