clmm-rebalance

clmm-rebalance is a command for Claude Code from solanabr/position-manager-skill. It costs 17 tokens per session (1,381 once invoked), scanned A, original, MIT.

A command for moving a Solana concentrated-liquidity position—a pool deposit active only within a chosen price range—to a new range.

In plain words
What is it for?
Use it to close an out-of-range position and reopen it at a different tick range on supported Solana liquidity pools.
Why use it?
It helps prevent an accidental transaction by requiring a simulation and typed human confirmation every time. It also supports limits for transaction size, position value, and price slippage.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is builder, // your TxBuilder (delegated to ../solana-dev).

Good fit Use it to close an out-of-range position and reopen it at a different tick range on supported Solana liquidity pools.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/solanabr/position-manager-skill
agentmods
npx agentmods add commands/solanabr/position-manager-skill/clmm-rebalance

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clmm-rebalance

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-rebalance/github.svg)](https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-rebalance)
Your own site
<a href="https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-rebalance"><img src="https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-rebalance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clmm-rebalance

Your own site · 80×15
<a href="https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-rebalance"><img src="https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-rebalance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,381 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.01381
Opus 5 $0.00009 $0.00691
Sonnet 5 $0.00003 $0.00276
Haiku 4.5 $0.00002 $0.00138

Measured 9d ago against content hash 93eae6eac1aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

clmm-rebalance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/clmm-rebalance.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/clmm-rebalance

Closes an out-of-range CLMM position and reopens it at a new tick range. Every execution path requires a simulation check AND a typed human confirmation. No bypass flag exists. This is non-negotiable.

Steps

  1. Set environment:

    export SOLANA_RPC_URL="https://your-rpc-endpoint"
    export OWNER_ADDRESS="YourWallet111..."
    export KEYPAIR_PATH="$HOME/.config/solana/id.json"
    
    # Safety caps (edit to your risk tolerance)
    export MAX_NOTIONAL_USD=50000
    export MAX_POSITION_USD=100000
    export MAX_SLIPPAGE_BPS=100        # 1%
    export DRY_RUN=true                # set false only when ready to execute
    export REQUIRE_CONFIRM=true        # never set false
    
  2. Plan the rebalance (no transaction yet):

    npx tsx -e "
    import { planRebalance } from './skill/templates/rebalance';
    import { fetchPositions } from './skill/templates/adapters/orca';  // or raydium/meteora
    
    const [pos] = await fetchPositions(process.env.OWNER_ADDRESS!);
    // planRebalance(position, newRange) -> RebalancePlan (synchronous; reads no chain)
    const plan = planRebalance(pos, { tickLower: 44500, tickUpper: 45500 });
    console.log(JSON.stringify(plan, (_k, v) => (typeof v === 'bigint' ? v.toString() : v), 2));
    "
    

    Review the plan output (note the confirmPhrase you must type to authorize):

    {
      "venue": "orca",
      "pool": "<whirlpool-address>",
      "from": { "tickLower": 44000, "tickUpper": 45000 },
      "to":   { "tickLower": 44500, "tickUpper": 45500 },
      "steps": [ { "kind": "collectFees" }, { "kind": "decreaseLiquidity" }, { "kind": "closePosition" }, { "kind": "openPosition" }, { "kind": "increaseLiquidity" } ],
      "estNotional": "9840000000",
      "estPosition": "9800000000",
      "confirmPhrase": "REBALANCE orca <whirlpool-address> [44000,45000]->[44500,45500]"
    }
    
  3. Simulate (automatic when executeRebalance is called; shown separately here):

    The execute function calls rpc.simulateTransaction before any signing. If simulation fails, execution aborts with the simulation error. You must fix the plan and retry; the error is never silently ignored.

Read the full file on GitHub · 124 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 124 lines · 17 tokens per session scan A 93eae6eac1aa

Subscribe to this mod's changes

clmm-rebalance is a command published in the GitHub repository solanabr/position-manager-skill (2 stars, last pushed 2mo ago), licensed MIT. It adds 17 tokens to every session and 1,381 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.