Solana AI Kit · skill addon

solana-position-manager-skill

Manage concentrated-liquidity (CLMM/DLMM) LP positions on Solana — measure → monitor → rebalance — with real impermanent-loss math, current SDK calls, and safe execution rules.

CI green 26 tests 5 AMM protocols MIT eval 24/24 vs baseline 16/24

GitHub repo →   ·   PR #54 (skill-bounty) →   ·   Eval report →

The problem

Concentrated liquidity turns LPing into an active management job most builders get wrong: positions silently drift out of range and stop earning; impermanent loss is larger and non-obvious in narrow ranges; rebalancing is done by feel. Three protocols with different models (tick ranges vs discrete bins) make every script bespoke. No existing kit skill covers the LP position lifecycle end-to-end.

What the skill gives an agent

Measure

Real concentrated-IL math with the exact λ-amplification formula (capital efficiency = IL multiplier), unit-tested against worked examples.

Monitor

Out-of-range + drift detection (GREEN / YELLOW / RED), fee-to-principal alerts, opt-in Claude Code Stop hook.

Rebalance

HOLD / WIDEN / MOVE / WITHDRAW heuristics gated by fee-vs-IL — simulate before sign, never auto-execute.

Execute

Verified SDK tx order per protocol; atomic Meteora rebalancePosition (claim+remove+resize+add in one ix).

Protocol coverage — the full Solana AMM landscape

Three concentrated programs are covered end-to-end (fetch → measure → decide → monitor): Meteora DLMM ships an executable atomic rebalance (tsc-clean SDK example), while Orca and Raydium ship SDK-correct rebalance recipes (resetPositionRangeInstructions / close+open). Two constant-product programs are covered as the v2 baseline (λ = 1) with an explicit scope explanation — so the skill knows what it does and does not actively manage.

Orca Whirlpools

Tick-range CLMM, 216-byte Position, resetPositionRangeInstructions.

concentrated · covered

Raydium CLMM

Tick-range CLMM, Position NFT, close+open range change.

concentrated · covered

Meteora DLMM

Bin-based, dynamic fees, atomic rebalance, limit orders.

concentrated · managed

Raydium CPMM

Constant-product, fungible LP — full-range v2 case (λ=1).

scope-clarified

Meteora DAMM v2

Constant-product, NFT positions — fetch / fees / claim in scope.

scope-clarified

The λ-amplification formula (why concentrated IL is bigger)

The same factor that boosts fee APR boosts IL. For a symmetric range [1/k, k]:

IL_v3(r) = λ · IL_v2(r),   λ = √k / (√k − 1)        // capital efficiency = IL multiplier
IL_v2(r) = 2√r / (1 + r) − 1                          // full-range (λ → 1) ✓

Range [0.5, 2.0] (λ ≈ 3.4) on a +21% move → −1.54% IL. Tight range [0.8, 1.25] (λ ≈ 9.5) on the same move → −4.28% IL. Implemented and pinned in examples/il_math.py + tests/test_il.py.

Position manager skill architecture: SKILL.md routes to whirlpools, raydium-clmm, meteora-dlmm, meteora-damm-v2, raydium-cpmm, impermanent-loss, range-alerts, rebalance, backtest, monitoring, hooks.

Quantified evaluation

Reproducible offline suite (python tests/test_eval.py, runs in CI) — with-skill vs a fair ablation baseline (knows the common textbook cases, misses the CLMM nuance) across the LP lifecycle.

Suitebaselinewith-skilltasks
IL computation4 / 66 / 66
In-range / drift level7 / 1010 / 1010
Rebalance decision5 / 88 / 88
Total16 / 2424 / 2424
Trigger false-positive (false-RED on margin-in-range)0 / 1212

Full methodology + per-task detail: docs/EVAL.md.

Install

git clone https://github.com/yusizer/solana-position-manager-skill.git
cd solana-position-manager-skill
./validate.sh && python tests/test_il.py && python tests/test_fetch.py && python tests/test_eval.py
./install.sh -y