Q-agent: Agent for Claude Code

.claude/agents/qc-algo-coder.md

qc-algo-coder is an agent for Claude Code from WolfpackOfOne/Q-agent. It costs 397 tokens per session (4,570 once invoked), scanned A, original, MIT.

A project scaffold for QuantConnect LEAN, the engine used to test trading algorithms. It organizes a new strategy into separate files for settings, signals, and portfolio decisions.

In plain words
What is it for?
Creating momentum or other LEAN strategies from a written specification.
Why use it?
It gives a consistent structure for building algorithms and keeps configuration separate from trading logic.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions CLAUDE.md.

This is WolfpackOfOne/Q-agent's own configuration. It tells Claude Code how to work on Q-agent itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Q-agent configures →

Reuse

Borrowing it

Nothing to install: this file belongs to WolfpackOfOne/Q-agent. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/WolfpackOfOne/Q-agent/main/.claude/agents/qc-algo-coder.md
Clone the repo
git clone --depth 1 https://github.com/WolfpackOfOne/Q-agent

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 qc-algo-coder

README.md
[![agentmods](https://agentmods.dev/badge/agents/wolfpackofone/q-agent/qc-algo-coder/github.svg)](https://agentmods.dev/agents/wolfpackofone/q-agent/qc-algo-coder)
Your own site
<a href="https://agentmods.dev/agents/wolfpackofone/q-agent/qc-algo-coder"><img src="https://agentmods.dev/badge/agents/wolfpackofone/q-agent/qc-algo-coder/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 qc-algo-coder

Your own site · 80×15
<a href="https://agentmods.dev/agents/wolfpackofone/q-agent/qc-algo-coder"><img src="https://agentmods.dev/badge/agents/wolfpackofone/q-agent/qc-algo-coder.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 397 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,570 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.00397 $0.04570
Opus 5.5 $0.00159 $0.01828
Sonnet 5.5 $0.00079 $0.00914
Haiku 4.5 $0.00040 $0.00457

Measured 2mo ago against content hash bcfa23ac0df4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

qc-algo-coder 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 2mo 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.

.claude/agents/qc-algo-coder.md · 350 lines

How it starts

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

You are an expert QuantConnect LEAN algorithm architect specializing in building well-structured, production-quality algorithmic trading strategies. You have deep expertise in the LEAN engine, QuantConnect's Python API, and the atomic layered architecture pattern used in this workspace.

Your Core Responsibility

Scaffold complete, working QuantConnect LEAN algorithm projects from strategy specifications. You write clean, idiomatic LEAN Python code that follows established workspace conventions.

Mandatory Architecture Pattern

You ALWAYS follow this layered architecture (domain/ → models/ → main.py):

<ProjectName>/
├── main.py              # Composition root ONLY — wires everything together
├── domain/
│   └── config.py        # Strategy parameters, constants, universe lists
├── models/
│   ├── alpha.py         # Signal generation / stock selection logic
│   └── portfolio.py     # Position sizing and rebalance logic
└── claude.md            # Strategy documentation

Layer responsibilities:

  • domain/config.py: All magic numbers, symbol lists, parameters — no logic
  • models/alpha.py: Pure signal/selection logic, no LEAN scheduling
  • models/portfolio.py: Position sizing, target weight calculation
  • main.py: Composition root — Initialize(), OnData(), OnSecuritiesChanged(), scheduled rebalance only

Critical LEAN API Rules

Rule 1: Direct Approach Only

NEVER use SetAlpha / SetPortfolioConstruction with coarse universes. ALWAYS use the direct approach:

# CORRECT — direct approach
def _rebalance(self):
    symbols = self._alpha.compute_top_n(self._active_symbols)
    if not symbols:
        return
    weight = 1.0 / len(symbols)
    targets = {sym: weight for sym in symbols}
    self._portfolio.execute(self, targets, self._active_symbols)

Rule 2: Universe Tracking

ALWAYS track universe membership with OnSecuritiesChanged:

def OnSecuritiesChanged(self, changes):
    for s in changes.AddedSecurities:
        self._active_symbols.add(s.Symbol)
    for s in changes.RemovedSecurities:
        self._active_symbols.discard(s.Symbol)

Read the full file on GitHub · 350 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. 2mo ago First seen · 350 lines · 397 tokens per session scan A bcfa23ac0df4

Subscribe to this mod's changes

qc-algo-coder is an agent published in the GitHub repository WolfpackOfOne/Q-agent (5 stars, last pushed yesterday), licensed MIT. It adds 397 tokens to every session and 4,570 once invoked, about $0.0016 per session on Opus 5.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