Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

position-manager-skill

A complete build-out of the official position-manager-skill seed: one routed Claude Code / Codex skill to monitor, backtest, rebalance, and tax-track concentrated-liquidity LP across every major Solana DEX.

Submitted to the Superteam Brasil "Ship useful agent skills for the Solana AI Kit" bounty via Path 1 (level up a seed). This populates the empty solanabr/position-manager-skill seed with a production-grade implementation. The skill is internally branded "CLMM Command Center" (name: position-manager).

The problem

Concentrated-liquidity LPs juggle five disconnected tools: one dashboard per venue (Orca, Raydium, Meteora, Kamino), a spreadsheet for IL math, a Telegram bot for alerts, and a separate exporter at tax time. Studies of Uniswap-style CLMM repeatedly show a majority of LPs are net-unprofitable after impermanent loss versus simply holding. The core failure mode is late information: polling a position every 60s means you learn you went out-of-range minutes after fees stopped accruing, and you size rebalances on stale quotes.

What it does

  • Track every CLMM/DLMM position across Orca Whirlpools, Raydium CLMM, Meteora DLMM + DAMM v2, and Kamino vaults in one normalized LpPosition view (tick bounds, in-range flag, unclaimed fees, token amounts).
  • Alert in realtime via reconnecting Yellowstone gRPC / websocket subscriptions, firing the moment the current tick crosses a stored bound, instead of polling.
  • Backtest a range: IL-vs-HODL net P&L and fee-APR over historical price paths, plus the break-even range width where fees cover IL.
  • Route yield: compare fee APR for a pair across venues so you LP where the capital actually earns.
  • Rebalance safely: plan a close+reopen into a new range, always simulate first, and gate execution behind a typed human confirmation with slippage / exposure caps.
  • Tax-lot ledger: build cost-basis lots (FIFO / HIFO / SPECID) from add/remove/collect events as a record-keeping aid.

Prior art and how this differs

Single-venue liquidity skills/SDKs exist (Orca, Raydium, Meteora, Kamino each ship their own); agiprolabs/claude-trading-skills covers CLMM math educationally (lp-math, impermanent-loss). None give you live, multi-venue position management as one routed skill. This is the build-out of the official empty position-manager-skill seed: realtime gRPC alerting (not polling), IL-vs-HODL backtesting with break-even width, cross-DEX yield routing, and a simulate-first human-confirm rebalance gate. Scaffolding and knowledge you run yourself - never a hosted or auto-running bot.

How it works (progressive loading)

skill/SKILL.md is a router, not a manual. On activation it loads source-precedence rules and a Task Routing Guide that maps each intent to exactly one leaf (references/positions.md, streaming.md, backtesting.md, yield-routing.md, kamino-vaults.md, rebalancing.md, tax-lots.md). The agent opens one leaf per task - minimal context, maximal precision. All Anchor / program / IDL / tx-signing / priority-fee plumbing is delegated to the sibling ../solana-dev core skill via references/delegation.md.

Install

./install.sh            # copies skill + templates into ~/.claude/skills/position-manager-skill
                        # clones the solana-dev core skill alongside it if missing
# or, from inside Claude Code:
/plugin marketplace add solanabr/position-manager-skill
/plugin install position-manager-skill

Templates under skill/templates/ are importable TypeScript (@solana/kit / web3.js v2); adapters import venue SDKs lazily so the core compiles without every DEX SDK present. cd skill/templates && npm install (a committed .npmrc sets legacy-peer-deps=true because the optional @orca-so/whirlpools v8 still peers on @solana/kit@^5 while the skill runs on kit ^6; the lazy Orca import works fine at runtime). Verify: npm test (74 tests) and npx tsc --noEmit (strict, clean).

Use cases

> Watch my LP positions and alert me the moment any one goes out of range.
> Backtest a 5% SOL/USDC range on Orca over the last 90 days: IL vs HODL and fee APR.
> My SOL/USDC position is out of range. Plan a recenter, simulate it, and ask me to confirm before sending.

Safety

Rebalances always simulate (rpc.simulateTransaction) before submit and never auto-execute. Fund-moving and signing transactions require an explicit typed human confirmation; slippage, max-notional, max-position, and daily-loss caps plus a kill-switch are mandatory; configs default to DRY_RUN=true and REQUIRE_CONFIRM=true. No flag defeats the confirm-gate.

Tax note

The tax-lot ledger is a record-keeping aid, not tax advice. Per-wallet cost-basis tracking became mandatory Jan 1 2025 (Rev. Proc. 2024-28); the new 2026 items are broker 1099-DA cost-basis reporting and the expiry of Notice 2025-7 spec-ID transitional relief. The taxability of LP add/remove is unsettled, so ambiguous lots are flagged for CPA review. Default method is FIFO (HIFO / SPECID supported).

Stack (last-verified 2026-06; run npm view <pkg> version to confirm latest)

@solana/kit ^6 (Kit-native: Orca v8 + Kamino kliquidity v13) - @solana/compat ^6 at the remaining v1 boundaries (Raydium + Meteora only) - @triton-one/yellowstone-grpc ^5 - @orca-so/whirlpools ^8 - @raydium-io/raydium-sdk-v2 0.2.53-alpha (pin exact) - @meteora-ag/dlmm ^1.9 + @meteora-ag/cp-amm-sdk ^1.4 (DAMM v2) - @kamino-finance/kliquidity-sdk ^13 - @types/node ^24, tsx ^4 (dev). See skill/references/sdk-versions.md (last-verified 2026-06).

License

MIT - see LICENSE (retained from the upstream seed).

About

CLMM position manager for Orca Whirlpools / Raydium CLMM / Meteora DLMM — track impermanent loss, alert on out-of-range, and suggest rebalances.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages