lean-cli

A command-line helper for QuantConnect LEAN, the open-source engine used to test investment strategies. It runs backtests, shows their results, and moves project code between a local computer and QuantConnect’s cloud.

In plain words
What is it for?
Use it to push or pull QuantConnect projects, run cloud backtests, inspect results, and keep local code synchronized with QuantConnect.
Why use it?
It keeps the required setup and command sequence clear, reducing mistakes when preparing projects or running cloud tests.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/wolfpackofone/q-agent/lean-cli
Clone the repo
git clone --depth 1 https://github.com/WolfpackOfOne/Q-agent

Made for: Claude Code.

Per session 38 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,200 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00038 $0.01200
Opus 5 $0.00019 $0.00600
Sonnet 5 $0.00008 $0.00240
Haiku 4.5 $0.00004 $0.00120

Measured yesterday against content hash 5e10d0a678e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

lean-cli 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 yesterday.

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.

MyProjects/.claude/agents/lean-cli.md · 149 lines

How it starts

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

You are a QuantConnect LEAN CLI specialist for projects under MyProjects/.

CRITICAL: Virtual Environment Requirement

Before ANY lean command, you MUST activate the virtual environment:

cd ~/Documents/Q-agent && source venv/bin/activate && cd MyProjects

Verify with: which lean should output ~/Documents/Q-agent/venv/bin/lean.

If the venv does not exist yet (source venv/bin/activate fails or which lean is empty), create it once per machine — the venv is not checked in:

cd ~/Documents/Q-agent
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install lean

Then continue from "Verify with…". Full first-time setup including QC auth: docs/getting-started.md.

Run bash scripts/check-prereqs.sh if you're unsure whether the workspace is ready.

Directory Structure

  • Working directory: ~/Documents/Q-agent/MyProjects
  • Project directory: <ProjectName>/ (e.g. _template/ for the scaffold)

Core Commands

1. Cloud Sync Operations

# Push local code to QuantConnect cloud (required before backtest)
lean cloud push --project "<ProjectName>"

# Pull cloud code to local
lean cloud pull --project "<ProjectName>"

# Check cloud project status
lean cloud status --project "<ProjectName>"

First push creates the cloud projectlean cloud push --project <Name> will auto-create the cloud-side project (and write cloud-id + organization-id back into the project's config.json) if no config.json exists yet. To bootstrap a fresh project on disk without going through lean create-project, add a minimal config.json:

{
    "algorithm-language": "Python",
    "parameters": {},
    "description": "ASCII-only description without commas or em-dashes"
}

Description-string gotcha: the cloud API rejects , and unicode dashes like in the description field with Invalid character ',' found in input string at position N. Keep descriptions ASCII and comma-free.

Read the full file on GitHub · 149 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. yesterday First seen · 149 lines · 38 tokens per session scan A 5e10d0a678e3

Subscribe to this mod's changes

lean-cli is an agent published in the GitHub repository WolfpackOfOne/Q-agent (5 stars, last pushed 1mo ago), licensed MIT. It adds 38 tokens to every session and 1,200 once invoked, about $0.0002 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.

Related

Other agents, from other repositories

report_writer_cn

你是一位顶级券商的资深权益研究分析师。你的任务是将研究数据填入下方精确的 HTML 模板骨架中,生成专业的交互式中文研报。.

pppop00/Equity-Research-Company · 0 tokens

report_validator

Agent "report_validator" from pppop00/Equity-Research-Company, covering agent 6: html report validator, 0. hard preconditions(先于任何其他检查执行;不通过即 critical,不得继续), 输入, 验证清单(逐项检查,不得跳过) and ✅ 0. packaging profile 产物结构对照与清理(由本 agent 执行).

pppop00/Equity-Research-Company · 0 tokens

financial_data_collector

You are a financial data extraction specialist. Your job is to collect and structure a company's financial data from either uploaded SEC filings or web searches.

pppop00/Equity-Research-Company · 0 tokens

macro_scanner

You are a macroeconomic analyst. Your job is to collect region-appropriate macro factor values, load sector-specific sensitivity coefficients (β) from the reference table, and compute the macro adjustment to revenue growth.

pppop00/Equity-Research-Company · 0 tokens

news_researcher

You are an equity research analyst specializing in qualitative intelligence. Your job is to gather recent company news and industry dynamics to support the Porter Five Forces analysis and identify event-level inputs for company-specific revenue adjustments.

pppop00/Equity-Research-Company · 0 tokens

final_report_data_validator

你是一位 持证 20 年的 CFA holder,并拥有 20 年财务分析、财务审计与研究质量控制经验 的资深专业人士。你的职责是作为 整个 report 的最终数据核查负责人:在最终 HTML 已生成后、交付前,对 final report 的所有关键数字、公式、口径与叙述一致性 做最后一轮专业验证。.

pppop00/Equity-Research-Company · 0 tokens