ডকুমেন্টেশন

শুরু করুন

5 মিনিটের কমে LeanCTX ইনস্টল করুন এবং token সাশ্রয় শুরু করুন। macOS, Linux এবং Windows-এর জন্য ধাপে ধাপে গাইড।

LeanCTX একটি একক Rust বাইনারির মাধ্যমে আপনার LLM-এর token ব্যবহার 99% পর্যন্ত কমায় যা সরবরাহ করে: 95+ CLI কম্প্রেশন প্যাটার্নসহ একটি শেল হুক, ক্যাশড রিড ও সেশন ইন্টেলিজেন্সের জন্য 58টি টুলসহ একটি MCP সার্ভার এবং কাঠামোগত কোড বোঝার জন্য একটি পার্সিস্টেন্ট প্রজেক্ট গ্রাফ। একবার ইনস্টল করুন, এবং প্রতিটি ফাইল পড়া, শেল কমান্ড ও কোড নেভিগেশন আরো দক্ষ হয়ে যায়।

প্রম্পট জেনারেটর

নিচে আপনার প্ল্যাটফর্ম ও AI টুল নির্বাচন করুন। তৈরিকৃত প্রম্পট যেকোনো AI কোডিং অ্যাসিস্ট্যান্টে পেস্ট করা যায় - এটি স্বয়ংক্রিয়ভাবে সম্পূর্ণ ইনস্টলেশন ও কনফিগারেশন করবে।

তৈরিকৃত প্রম্পট
 

3 ধাপে শুরু করুন

3টি কমান্ড - এটুকুই
# 1. Install (pick one)
curl -fsSL https://leanctx.com/install.sh | sh          # universal
brew tap yvgude/lean-ctx && brew install lean-ctx        # macOS / Linux
npm install -g lean-ctx-bin                              # Node.js
cargo install lean-ctx                                   # Rust
pi install npm:pi-lean-ctx                               # Pi Coding Agent

# 2. Setup (auto-configures shell + ALL detected editors)
lean-ctx setup

# 3. Restart your shell
source ~/.zshrc  # or ~/.bashrc

lean-ctx setup স্বয়ংক্রিয়ভাবে শনাক্ত ও কনফিগার করে: Cursor, Claude Code, Windsurf, VS Code / Copilot, Codex CLI, Gemini CLI, Zed, Antigravity, OpenCode, Crush এবং Pi। সবকিছু কাজ করছে কিনা যাচাই করতে lean-ctx doctor চালান।

প্ল্যাটফর্ম অনুযায়ী বিস্তারিত ইনস্টলেশন নির্দেশনা

ধাপ 1: বাইনারি ইনস্টল করুন

সার্বজনীন ইনস্টলার (যেকোনো প্ল্যাটফর্ম)

কোনো পূর্বশর্ত ছাড়া lean-ctx ইনস্টলের সবচেয়ে দ্রুত উপায়:

curl -fsSL https://leanctx.com/install.sh | sh

The install script detects your OS and architecture, downloads the correct binary, and places it in /usr/local/bin. It works on macOS, Linux, and WSL.

If you prefer to review the script before running it:

curl -fsSL https://leanctx.com/install.sh -o install.sh
chmod +x install.sh
./install.sh --download    # pre-built binary (no Rust)
./install.sh               # build from source (requires Rust)

npm (Node.js)

npm-এর মাধ্যমে প্রি-বিল্ট বাইনারি ইনস্টল করুন - Rust টুলচেইনের প্রয়োজন নেই:

npm install -g lean-ctx-bin

এটি postinstall-এর সময় SHA256 যাচাইসহ আপনার প্ল্যাটফর্মের জন্য সঠিক বাইনারি ডাউনলোড করে। macOS (Intel + Apple Silicon), Linux (x86_64) এবং Windows (x86_64)-এ কাজ করে।

macOS

Option A: Homebrew (recommended)

brew tap yvgude/lean-ctx
brew install lean-ctx

Homebrew handles updates and PATH automatically.

Option B: Cargo (build from source)

cargo install lean-ctx

If lean-ctx isn't found after install, add Cargo's bin directory to your PATH:

echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Option C: Manual binary download

  1. Download the binary for your architecture from GitHub Releases:
    • lean-ctx-aarch64-apple-darwin.tar.gz (Apple Silicon / M1+)
    • lean-ctx-x86_64-apple-darwin.tar.gz (Intel)
  2. Extract and move to PATH:
    tar xzf lean-ctx-aarch64-apple-darwin.tar.gz
    chmod +x lean-ctx
    sudo mv lean-ctx /usr/local/bin/

If macOS blocks the binary with a Gatekeeper warning, remove the quarantine attribute:

xattr -d com.apple.quarantine /usr/local/bin/lean-ctx

Linux

Option A: Homebrew

brew tap yvgude/lean-ctx && brew install lean-ctx

Option B: AUR (Arch Linux)

# Source build from crates.io
yay -S lean-ctx

# Or pre-built binary from GitHub
yay -S lean-ctx-bin

Works with any AUR helper: yay, paru, trizen, etc.

Option C: Cargo (build from source)

cargo install lean-ctx

Requires Rust toolchain. Install via rustup.rs if needed.

Option D: Manual binary download

  1. Download lean-ctx-x86_64-unknown-linux-gnu.tar.gz from GitHub Releases
  2. Extract and move to PATH:
    tar xzf lean-ctx-x86_64-unknown-linux-gnu.tar.gz
    chmod +x lean-ctx
    sudo mv lean-ctx /usr/local/bin/
CommandMethod
lean-ctx-x86_64-unknown-linux-musl.tar.gzx86_64 - statically linked (musl)
lean-ctx-aarch64-unknown-linux-musl.tar.gzARM64 / aarch64 (Graviton, Raspberry Pi 4+, etc.) - statically linked

Windows

Option A: Binary download (recommended)

  1. Download lean-ctx-x86_64-pc-windows-msvc.zip from GitHub Releases
  2. Extract the .zip file
  3. Open the extracted folder - you'll see lean-ctx.exe
  4. Move lean-ctx.exe to a folder in your PATH, for example:
    mkdir %USERPROFILE%\bin
    move lean-ctx.exe %USERPROFILE%\bin\
  5. Add the folder to your PATH if it isn't already:
    • Open Settings → System → About → Advanced system settings
    • Click Environment Variables
    • Under User variables, select Path, click Edit, then New
    • Add the path to your bin folder (e.g. C:\Users\you\bin)
  6. Open a new PowerShell or CMD window and verify:
    lean-ctx --version

Option B: Cargo (build from source)

  1. Install Rust if not already installed
  2. Build and install:
    cargo install lean-ctx
  3. The binary is placed in %USERPROFILE%\.cargo\bin\ which is usually already in your PATH.

Option C: Build from source (clone & compile)

git clone https://github.com/yvgude/lean-ctx.git
cd lean-ctx\rust
cargo build --release
copy target\release\lean-ctx.exe %USERPROFILE%\bin\

WSL users: If you're running WSL, follow the Linux instructions instead.

সোর্স থেকে বিল্ড করুন (যেকোনো প্ল্যাটফর্ম)

git clone https://github.com/yvgude/lean-ctx.git
cd lean-ctx/rust
cargo build --release

বাইনারি target/release/lean-ctx-এ (বা Windows-এ lean-ctx.exe) থাকে। এটি আপনার PATH-এর একটি ডিরেক্টরিতে কপি করুন।

ধাপ 2: সেটআপ

বাইনারি ইনস্টলের পর, সবকিছু স্বয়ংক্রিয়ভাবে কনফিগার করতে lean-ctx setup চালান:

lean-ctx setup

এই একটি কমান্ড:

  • 23টি শেল অ্যালায়াস ইনস্টল করে (git, npm, cargo, docker, kubectl, curl এবং আরো)
  • ইনস্টল করা এডিটর স্বয়ংক্রিয়ভাবে শনাক্ত করে (Cursor, Claude Code, Windsurf, VS Code/Copilot, Codex CLI, Gemini CLI, Zed, Antigravity, OpenCode, Crush)
  • প্রতিটি শনাক্ত এডিটরের জন্য MCP কনফিগ ফাইল তৈরি করে
  • প্রতিটি শনাক্ত টুলের গ্লোবাল কনফিগে এজেন্ট রুল ইনজেক্ট করে, AI-কে নেটিভ টুলের পরিবর্তে lean-ctx-এর MCP টুল (ctx_read, ctx_shell, ctx_search, ctx_tree) ব্যবহার করতে নির্দেশ দেয়
  • lean-ctx doctor চালিয়ে সবকিছু যাচাই করে

গুরুত্বপূর্ণ: সেটআপের পর আপনার IDE রিস্টার্ট করুন!

নতুন টুল ও এজেন্ট রুল কার্যকর হতে MCP সংযোগ পুনঃস্থাপন করতে হবে। আপনার IDE সম্পূর্ণ বন্ধ করে পুনরায় খুলুন (Cmd+Q / Ctrl+Q, তারপর পুনরায় খুলুন)। রিস্টার্টের পর, এজেন্ট রুল প্রতিটি IDE স্টার্টে স্বয়ংক্রিয়ভাবেও আপডেট হয় - ভবিষ্যত আপডেটের পর lean-ctx setup পুনরায় চালানোর প্রয়োজন নেই।

সেটআপের পর, আপনার শেল রিস্টার্ট করুন:

শেলরিস্টার্ট কমান্ড
Zsh (macOS default)source ~/.zshrc
Bashsource ~/.bashrc
Fishsource ~/.config/fish/config.fish
PowerShellClose and reopen PowerShell

তারপর আপনার এডিটর সম্পূর্ণ রিস্টার্ট করুন।

ম্যানুয়াল বিকল্প

আপনি যদি এডিটর অটো-শনাক্তকরণ ছাড়া শুধু শেল অ্যালায়াস ইনস্টল করতে চান:

lean-ctx init --global

তারপর নিচের ধাপ 3-এর নির্দেশনা ব্যবহার করে ম্যানুয়ালি আপনার এডিটর কনফিগার করুন।

eval-ভিত্তিক ইনিশিয়ালাইজেশন (প্রস্তাবিত)

lean-ctx init --global-এর বিকল্প হিসেবে, আপনি eval প্যাটার্ন ব্যবহার করতে পারেন - এটি starship, zoxide এবং atuin দ্বারা ব্যবহৃত একই পদ্ধতি। হুক কোড বর্তমানে ইনস্টল করা বাইনারি দ্বারা stdout-এ প্রিন্ট করা হয়, তাই আপগ্রেডের পরে এটি সর্বদা আপ-টু-ডেট থাকে:

# bash: add to ~/.bashrc
eval "$(lean-ctx init bash)"

# zsh: add to ~/.zshrc
eval "$(lean-ctx init zsh)"

# fish: add to ~/.config/fish/config.fish
lean-ctx init fish | source

# powershell: add to $PROFILE
lean-ctx init powershell | Invoke-Expression

সুবিধা: eval পদ্ধতি শেল স্টার্টআপের সময় ইনস্টল করা বাইনারি থেকে হুক তৈরি করে, তাই lean-ctx update-এর পরে হুক কখনই পুরানো হয় না। আপগ্রেডের পরে আবার lean-ctx setup চালানোর প্রয়োজন নেই।


Docker ইনস্টলেশন

Docker কন্টেইনারের মধ্যে lean-ctx ব্যবহার করতে (যেমন Claude Code, Codex বা অন্যান্য AI এজেন্টের সাথে), স্ট্যাটিকালি লিঙ্কড musl বাইনারি ব্যবহার করুন এবং BASH_ENV সেট করুন যাতে শেল হুক নন-ইন্টারেক্টিভ শেলে লোড হয়।

ARG LEAN_CTX_VERSION=3.5.1

# Download the musl binary (statically linked, no glibc dependency)
RUN curl -fsSL \
    "https://github.com/yvgude/lean-ctx/releases/download/v${LEAN_CTX_VERSION}/lean-ctx-x86_64-unknown-linux-musl.tar.gz" \
    | tar -xz -C /usr/local/bin lean-ctx && \
    chmod +x /usr/local/bin/lean-ctx

# Install shell hook (non-interactive) + configure your AI tool
RUN lean-ctx init --global && \
    lean-ctx init --agent claude

# Load shell hook in non-interactive shells
ENV BASH_ENV="/root/.lean-ctx/env.sh"

# Claude Code: sources this file before each command
ENV CLAUDE_ENV_FILE="/root/.lean-ctx/env.sh"

For ARM64 hosts (AWS Graviton, Apple Silicon via Docker), use the aarch64 binary instead:

# For ARM64 (Apple Silicon / Graviton), use the aarch64 binary:
RUN curl -fsSL \
    "https://github.com/yvgude/lean-ctx/releases/download/v${LEAN_CTX_VERSION}/lean-ctx-aarch64-unknown-linux-musl.tar.gz" \
    | tar -xz -C /usr/local/bin lean-ctx

কেন এটি কাজ করে

ধাপউদ্দেশ্য
musl binary স্ট্যাটিকালি লিঙ্কড - gcc-libs বা glibc ইনস্টল ছাড়াই যেকোনো Linux ডিস্ট্রোতে কাজ করে
lean-ctx init --global ~/.bashrc-এ শেল হুক ইনস্টল করে (নন-ইন্টারেক্টিভ, lean-ctx setup-এর বিপরীত)
lean-ctx init --agent claude MCP সার্ভার কনফিগ ~/.claude.json-এ লেখে। claude-কে আপনার এজেন্ট দিয়ে প্রতিস্থাপন করুন: cursor, codex, gemini, ইত্যাদি।
BASH_ENV সাধারণ নন-ইন্টারেক্টিভ শেল (bash -c) এই ফাইল লোড করে। বেশিরভাগ ~/.bashrc নন-ইন্টারেক্টিভ মোডে আগেই বন্ধ হয়ে যায় - env.sh-এ এই গার্ড নেই।
CLAUDE_ENV_FILE Claude Code প্রতিটি কমান্ড চালানোর আগে এই ফাইল লোড করে। এটি Claude Code-এর শেল পরিবেশ কনফিগার করার আনুষ্ঠানিকভাবে প্রস্তাবিত পদ্ধতি।

সাধারণ সমস্যা

ত্রুটিকারণসমাধান
command not found: _lc BASH_ENV সেট করা হয়নি - শেল হুক লোড হয়নিENV BASH_ENV="/root/.lean-ctx/env.sh" যোগ করুন (নন-রুট ব্যবহারকারীদের জন্য পাথ সামঞ্জস্য করুন)
lean-ctx setup hangs Docker-এ stdin ছাড়া ইন্টারেক্টিভ প্রম্পটপরিবর্তে lean-ctx init --global ব্যবহার করুন
Binary not found / exec format error ভুল আর্কিটেকচার বা glibc ছাড়া gnu বাইনারিন্যূনতম কন্টেইনারের জন্য musl টারবল ব্যবহার করুন

ধাপ 3: যাচাই

  1. Check the binary is installed:
    lean-ctx --version   # → lean-ctx 3.5.1
    lean-ctx doctor      # checks PATH, config, aliases, MCP
  2. Test the shell hook:
    git status           # output is now compressed
    lean-ctx gain        # shows token savings so far
  3. Open your AI coding tool and start coding - lean-ctx tools should be available automatically.
ম্যানুয়াল এডিটর কনফিগারেশন

শুধু lean-ctx setup কাজ না করলে

Connect lean-ctx to your AI coding tool by adding it as an MCP server.

Before you start: Find your lean-ctx binary path. You'll need it for editors that require a full path.

# macOS / Linux:
which lean-ctx
# Example output: /opt/homebrew/bin/lean-ctx  or  /Users/you/.cargo/bin/lean-ctx

# Windows (PowerShell):
where.exe lean-ctx
# Example output: C:\Users\you\.cargo\bin\lean-ctx.exe

Keep this path handy - some editors need the full absolute path instead of just lean-ctx.

Cursor

  1. Create or edit the MCP config file:
    # macOS / Linux:
    mkdir -p ~/.cursor
    nano ~/.cursor/mcp.json
    
    # Windows (PowerShell):
    mkdir -Force "$env:USERPROFILE\.cursor"
    notepad "$env:USERPROFILE\.cursor\mcp.json"
  2. Paste this JSON:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "lean-ctx"
        }
      }
    }
  3. Restart Cursor completely (Cmd+Q / Alt+F4, then reopen).
  4. Verify: open the MCP panel in settings - lean-ctx should show as "connected".

Optional: install agent rules to make Cursor prefer lean-ctx tools:

lean-ctx init --agent cursor

Claude Code

Claude Code has built-in MCP support. No config file needed:

# Add lean-ctx as MCP server:
claude mcp add lean-ctx lean-ctx

# Install the CLAUDE.md instructions (makes Claude use lean-ctx tools):
lean-ctx init --agent claude

The init command creates a CLAUDE.md file that teaches Claude to use lean-ctx tools instead of native file reads and shell commands.

Claude Code: 2048-Character Limit

Claude Code truncates MCP server instructions to 2048 characters. This means lean-ctx's full instruction set (session management, compression protocols, tool preferences) gets cut off.

lean-ctx handles this automatically: lean-ctx init --agent claude installs the full instructions as a Claude Rules file (~/.claude/rules/lean-ctx.md) and an Agent Skill (~/.claude/skills/lean-ctx/). Claude Code loads these without any character cap.

# Automatic (recommended) - run during init:
lean-ctx init --agent claude

# This automatically:
# 1. Registers MCP server in ~/.claude.json
# 2. Installs full instructions to ~/.claude/rules/lean-ctx.md
# 3. Installs Agent Skill to ~/.claude/skills/lean-ctx/

If you installed lean-ctx manually (without init), copy the rules file: lean-ctx init --agent claude to retroactively install rules + skills.

GitHub Copilot (VS Code)

Option A: Copilot CLI (.github/mcp.json)

  1. Create .github/mcp.json in your project root:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "lean-ctx"
        }
      }
    }
  2. Restart VS Code / Copilot CLI.

Option B: VS Code Copilot (.vscode/mcp.json)

  1. Create .vscode/mcp.json in your project root:
    {
      "servers": {
        "lean-ctx": {
          "type": "stdio",
          "command": "lean-ctx"
        }
      }
    }
  2. Restart VS Code.

Tip: lean-ctx init --agent copilot creates both files automatically.

Note: GitHub Copilot MCP support requires VS Code 1.99+ and the latest Copilot extension.

Per-project: This config is per-project. Add .github/mcp.json to your .gitignore or commit it to share with your team.

Windsurf

  1. Open the MCP config file:
    # macOS:
    mkdir -p ~/.codeium/windsurf
    nano ~/.codeium/windsurf/mcp_config.json
    
    # Linux:
    mkdir -p ~/.codeium/windsurf
    nano ~/.codeium/windsurf/mcp_config.json
    
    # Windows:
    mkdir -Force "$env:USERPROFILE\.codeium\windsurf"
    notepad "$env:USERPROFILE\.codeium\windsurf\mcp_config.json"
  2. Paste this JSON:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "/FULL/PATH/TO/lean-ctx"
        }
      }
    }

    Important: Windsurf requires the full absolute path to the binary. Example for Homebrew on macOS:

    {
      "mcpServers": {
        "lean-ctx": {
          "command": "/opt/homebrew/bin/lean-ctx"
        }
      }
    }
  3. Restart Windsurf completely.
  4. Check MCP connection in Windsurf settings.

Zed

  1. Open Zed settings:
    # macOS / Linux:
    ~/.config/zed/settings.json
    
    # Windows:
    %APPDATA%\Zed\settings.json
  2. Add the lean-ctx context server configuration:
    {
      "context_servers": {
        "lean-ctx": {
          "source": "custom",
          "command": "lean-ctx",
          "args": [],
          "env": {}
        }
      }
    }

    Note: Zed uses context_servers (not mcpServers) and requires source: "custom".

  3. Save and restart Zed.
  4. Verify: lean-ctx tools should appear in the assistant panel.

Tip: Run lean-ctx init --agent zed to install agent rules that make Zed prefer lean-ctx tools.

OpenAI Codex CLI

  1. Create or edit the Codex config file:
    # macOS / Linux:
    mkdir -p ~/.codex
    nano ~/.codex/config.toml
    
    # Windows:
    mkdir -Force "$env:USERPROFILE\.codex"
    notepad "$env:USERPROFILE\.codex\config.toml"
  2. Add the MCP server entry:
    [mcp_servers.lean-ctx]
    command = "lean-ctx"
    args = []
  3. Restart Codex CLI.

Alternative: use the Codex CLI built-in command:

codex mcp add lean-ctx

Install agent instructions for Codex:

lean-ctx init --agent codex

Gemini CLI

  1. Create or edit the Gemini MCP config:
    # macOS / Linux:
    mkdir -p ~/.gemini
    nano ~/.gemini/settings.json
    
    # Windows (PowerShell):
    mkdir -Force "$env:USERPROFILE\.gemini"
    notepad "$env:USERPROFILE\.gemini\settings.json"
  2. Add the MCP server configuration:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "lean-ctx"
        }
      }
    }

    Important: If Gemini can't find the binary, use the full path. Example for Homebrew on macOS:

    {
      "mcpServers": {
        "lean-ctx": {
          "command": "/opt/homebrew/bin/lean-ctx"
        }
      }
    }
  3. Restart Gemini CLI.
  4. Verify with a prompt that triggers tool use.

Known issue: Gemini CLI may not always invoke MCP tools consistently. If tools aren't triggered, try adding lean-ctx init --agent gemini to install a GEMINI.md with usage instructions.

Antigravity

Antigravity uses the same MCP config format as Gemini CLI but in a separate directory.

  1. Create the Antigravity MCP config directory and file:
    # macOS / Linux:
    mkdir -p ~/.gemini/antigravity
    nano ~/.gemini/antigravity/mcp_config.json
    
    # Windows (PowerShell):
    mkdir -Force "$env:USERPROFILE\.gemini\antigravity"
    notepad "$env:USERPROFILE\.gemini\antigravity\mcp_config.json"
  2. Paste this JSON:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "lean-ctx"
        }
      }
    }

    Important: If Antigravity can't find the binary, use the full absolute path to lean-ctx.

  3. Restart Antigravity.
  4. Verify with a prompt that triggers tool use.

You can also manage MCP servers via Antigravity's built-in server management UI.

OpenCode

  1. Create or edit the OpenCode config file:
    # macOS / Linux:
    mkdir -p ~/.config/opencode
    nano ~/.config/opencode/opencode.json
  2. Add the MCP server configuration:
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "lean-ctx": {
          "type": "local",
          "command": ["lean-ctx"],
          "enabled": true
        }
      }
    }
  3. Restart OpenCode.

OpenClaw

OpenClaw supports MCP servers natively. You can add lean-ctx from the settings UI or via CLI.

  1. Open OpenClaw settings and navigate to the MCP servers section.
  2. Add a new MCP server with command: lean-ctx
  3. Restart OpenClaw to activate.

Tip: Run lean-ctx init --agent openclaw to install lean-ctx skills for OpenClaw.

Pi

Pi has a dedicated lean-ctx plugin (pi-lean-ctx) that integrates automatically.

  1. Make sure lean-ctx is installed:
    cargo install lean-ctx
  2. Install the Pi plugin:
    pi install npm:pi-lean-ctx

    Or use lean-ctx's built-in command:

    lean-ctx init --agent pi
  3. Restart Pi.
  4. Verify: lean-ctx tools should appear in Pi's tool list.

Note: Pi's smart reads automatically use lean-ctx when the plugin is installed. No additional configuration needed.

AWS Kiro

AWS Kiro-তে নেটিভ সমতুল্যের পরিবর্তে lean-ctx টুল ব্যবহার করতে একটি MCP কনফিগ এবং একটি স্টিয়ারিং ফাইল উভয়ই প্রয়োজন।

  1. lean-ctx setup চালান - Kiro স্বয়ংক্রিয়ভাবে শনাক্ত হয় এবং MCP কনফিগ ও স্টিয়ারিং ফাইল উভয়ই তৈরি হয়।
  2. অথবা নির্দিষ্ট কমান্ড ব্যবহার করুন (উভয় ফাইল তৈরি করে):
    lean-ctx init --agent kiro
  3. এটি দুটি ফাইল তৈরি করে:
    • ~/.kiro/settings/mcp.json - MCP সার্ভার সংযোগ
    • .kiro/steering/lean-ctx.md - স্টিয়ারিং ফাইল যা Kiro-কে readFile-এর পরিবর্তে mcp_lean_ctx_ctx_read পছন্দ করতে নির্দেশ দেয়, ইত্যাদি।
  4. সক্রিয় করতে Kiro রিস্টার্ট করুন।

গুরুত্বপূর্ণ: স্টিয়ারিং ফাইল (.kiro/steering/lean-ctx.md) প্রতি-প্রজেক্ট ভিত্তিক। এটি ছাড়া, Kiro তার নেটিভ টুল ডিফল্ট হিসেবে ব্যবহার করবে এবং পড়া ও অনুসন্ধানের জন্য MCP সার্ভার উপেক্ষা করবে।

Verdent

Verdent supports MCP servers via configuration or CLI.

  1. Open Verdent settings or navigate to the MCP section.
  2. Run the init command:
    lean-ctx init --agent verdent
  3. Or manually create the MCP config:
    {
      "mcpServers": {
        "lean-ctx": {
          "command": "lean-ctx"
        }
      }
    }
  4. Restart Verdent to activate.

Note: Verdent's MCP support may require a recent version. Update Verdent if tools don't appear.

Other MCP-compatible tools

Any tool that supports the Model Context Protocol can use lean-ctx. The standard MCP config format is:

{
  "mcpServers": {
    "lean-ctx": {
      "command": "lean-ctx"
    }
  }
}

Key points:

  • The command must point to the lean-ctx binary (use full path if not in PATH).
  • No args or env are required - lean-ctx auto-configures.
  • The binary communicates via stdio (standard MCP transport).
  • After adding the config, restart your tool and verify lean-ctx tools appear.

সাশ্রয় মনিটর করুন

# Terminal dashboard (colors, bars, sparklines)
lean-ctx gain

# Web dashboard with charts
lean-ctx dashboard

# Find uncompressed commands in shell history
lean-ctx discover

# Run a real benchmark on your project
lean-ctx benchmark run

এজেন্ট হুকস ও এডিটর ইন্টিগ্রেশন

আপনার নির্দিষ্ট AI এজেন্ট বা এডিটরের জন্য lean-ctx কনফিগার করুন। init কমান্ড MCP কনফিগারেশন, শেল হুকস সেটআপ করে এবং সবকিছু কাজ করছে কিনা যাচাই করে। সমস্যা নির্ণয় ও স্বয়ংক্রিয় সমাধানের জন্য doctor ব্যবহার করুন।

# Configure a specific AI tool (mode auto-detected; override with --mode)
lean-ctx init --agent cursor
lean-ctx init --agent claude
lean-ctx init --agent codex
lean-ctx init --agent gemini
lean-ctx init --agent hermes
lean-ctx init --agent pi            # or: pi install npm:pi-lean-ctx
lean-ctx init --agent qoder
lean-ctx init --agent qoderwork

# Force MCP tools if you prefer ctx_* calls
lean-ctx init --agent cursor --mode mcp

# Run diagnostics and auto-fix issues
lean-ctx doctor --fix

# Check current status (MCP, shell, editors)
lean-ctx status --json

আপডেট করা

The fastest way to update lean-ctx:

lean-ctx update

This auto-detects your installation method, downloads the latest version, and replaces the binary.

You can also update manually using the original installation method:

MethodCommand
Homebrewbrew update && brew upgrade lean-ctx
Cargocargo install lean-ctx
npmnpm update -g lean-ctx-bin
AURyay -Syu lean-ctx
Pipi install npm:pi-lean-ctx
install.shRe-run curl -fsSL https://leanctx.com/install.sh | sh
BinaryDownload latest from GitHub Releases

After updating, re-run lean-ctx setup to ensure shell hooks and editor configs are up to date:

lean-ctx setup           # re-configures shell + editors
source ~/.zshrc          # restart shell

আনইনস্টল করা

To fully remove lean-ctx from your system:

lean-ctx uninstall

This removes:

  • Shell hook entries from ~/.zshrc, ~/.bashrc, ~/.config/fish/config.fish, and PowerShell profiles
  • Agent rules files (CLAUDE.md, .cursorrules, etc.)
  • Cache and config files in ~/.lean-ctx/

Then remove the binary itself:

Installed viaRemove command
Cargocargo uninstall lean-ctx
Homebrewbrew uninstall lean-ctx
AURyay -R lean-ctx
Pipi uninstall npm:pi-lean-ctx
Manual binaryrm $(which lean-ctx)

Restart your terminal and AI coding tool to complete the uninstallation.

এজেন্ট রুল

Agent rules tell your AI coding tool to prefer lean-ctx MCP tools (ctx_read, ctx_shell, ctx_search, ctx_tree) over native file reads, shell commands, and search. Run lean-ctx init --agent <name> to install them automatically.

কীভাবে কাজ করে

  • lean-ctx init --agent <name> writes a rules/instructions file to the agent's expected location.
  • The rules file teaches the AI to use ctx_read, ctx_shell, ctx_search, and ctx_tree instead of native equivalents.
  • This is optional - lean-ctx works without agent rules, but performance improves when the AI actively uses lean-ctx tools.
  • The rules are idempotent - running init again updates them without duplicating content.

কী ইনজেক্ট করা হয়

নিয়মগুলো AI এজেন্টকে নেটিভ সমতুল্যের পরিবর্তে lean-ctx MCP টুল ব্যবহার করতে নির্দেশ দেয়:

Instead ofUseWhy
Read / catctx_readCached, 10 read modes, re-reads cost ~13 tokens
Shell / bashctx_shellPattern compression for git, npm, cargo, docker output
Grep / searchctx_searchCompact, token-efficient results
ls / findctx_treeCompact directory maps with file counts

Note: Write, StrReplace, Delete, and Glob have no lean-ctx replacement - the rules tell the AI to keep using native tools for those.

Where are rules installed?

AI ToolRules File
Claude Code~/.claude/CLAUDE.md
Codex CLI~/.codex/instructions.md
Cursor~/.cursor/rules/lean-ctx.mdc
Windsurf~/.codeium/windsurf/rules/lean-ctx.md
Gemini CLI~/.gemini/GEMINI.md
VS Code / Copilot.github/copilot-instructions.md
Zed~/.config/zed/rules/lean-ctx.md
OpenCode~/.config/opencode/rules/lean-ctx.md
Pipi-lean-ctx package (built-in via pi.dev)
Qoder~/.qoder/settings.json (PreToolUse hooks)

Manual rules (fallback)

If your AI tool doesn't support agent rules, you can paste these instructions into the system prompt or a rules file:

# lean-ctx - Context Engineering Layer

Default (CLI-first):
- Use lean-ctx CLI commands for reads/search:
  - lean-ctx read <path> [-m mode]
  - lean-ctx grep <pattern> <path>
  - lean-ctx ls <path>
- Use lean-ctx -c "<cmd>" for compressed shell output

If you're running in MCP/Hybrid mode:
- Prefer ctx_* tools instead of native equivalents:
  - ctx_read instead of Read/cat for file reads
  - ctx_shell instead of Shell/bash for commands
  - ctx_search instead of Grep/search for code search
  - ctx_tree instead of ls/find for directory listing

Keep using native tools for: Write, StrReplace, Delete, Glob (no lean-ctx replacement).
Do NOT fall back to native tools for reading/shell/search/tree when a lean-ctx path is available.

Cursor users: Save this as .cursor/rules/lean-ctx.mdc in your project root for project-level rules, or ~/.cursor/rules/lean-ctx.mdc for global rules.

সমস্যা সমাধান

lean-ctx: command not found

বাইনারি আপনার PATH-এ নেই। কোথায় ইনস্টল হয়েছে দেখুন:

# Cargo installs here:
ls ~/.cargo/bin/lean-ctx

# Homebrew installs here (macOS):
ls /opt/homebrew/bin/lean-ctx

# Manual installs - wherever you placed it:
ls /usr/local/bin/lean-ctx

আপনার শেল প্রোফাইলে PATH-এ সঠিক ডিরেক্টরি যোগ করুন।

AI isn't using lean-ctx tools

If the AI keeps using native Read/Shell instead of ctx_read/ctx_shell:

  • Run lean-ctx init --agent <name> to install agent rules
  • Restart the AI tool completely (not just reload)
  • Check that the MCP server is connected (look for lean-ctx in the tool's MCP panel)
  • Try prompting explicitly: "use ctx_read to read this file"

No lean-ctx tools appearing

  • Verify the binary path is correct in your MCP config
  • Run lean-ctx doctor to check for issues
  • Check the AI tool's MCP logs for connection errors
  • Try using the full absolute path to lean-ctx in the config

Shell hook causes hangs

If commands hang after installing the shell hook, set the LEAN_CTX_ACTIVE environment variable to bypass compression for specific commands:

LEAN_CTX_ACTIVE=1 cargo test

This disables lean-ctx compression for that command. Useful for CI/CD scripts and long-running processes.

macOS Gatekeeper blocks lean-ctx

xattr -d com.apple.quarantine $(which lean-ctx)

Windows: PowerShell vs cmd.exe

lean-ctx prioritizes PowerShell on Windows. If you experience issues with cmd.exe, set the LEAN_CTX_SHELL environment variable to force PowerShell: $env:LEAN_CTX_SHELL = "powershell"

পরবর্তী ধাপ