AGENTS.md ยท git:20260903.8527a51 ยท 2026-09-03 ยท sha256 b108cb4ae561f5c3

AGENTS.md git:20260903.8527a51A

Immutable. This exact content is served forever at /api/v1/blob/b108cb4ae561f5c3.

# AGENTS.md โ€” Global AI Agent Guidance & Skill Protocol

This repository contains structured algorithmic trading skills following the
[agentskills.io](https://agentskills.io) open specification, located in `skills/`.

## ๐Ÿค– Instructions for AI Coding Agents

When tasked with generating, reviewing, testing, or refactoring algorithmic trading, market data, backtesting, financial ML, or broker integration code:

1. **Skill Discovery**:
   - Query `index.json` (one object with a `skills` array and a `subdomains` count map) or
     inspect frontmatter across `skills/*/SKILL.md`.
   - Every skill's `description` starts with "Use when โ€ฆ". Match on the situation you are in
     (order placement after a timeout, a backtest that reads a bar's own close), not on the
     general subject area.

2. **Standard Workflow Execution**:
   - Read `skills/<skill-name>/SKILL.md`.
   - Check `## When NOT to Use` **first** โ€” it names the cases the skill does not cover and
     hands each to the skill that does. Applying a correct playbook to the wrong problem is
     its own failure mode.
   - Follow the `## Workflow` section in order.
   - Cross-check `## Common Pitfalls` to prevent duplicate fills, lookahead bias, unhandled
     network timeouts, or capital over-exposure.

3. **Reference Implementation & Regulatory Specs**:
   - Consult `skills/<skill-name>/references/standards.md` for regulatory touchpoints
     (SEC Rule 15c3-5, Reg NMS, EU MiFID II / RTS 6, UK FCA, SEBI, ISDA) with their sources.
   - Refer to helper implementations in `skills/<skill-name>/scripts/` for reusable Python
     patterns. Each helper is standalone โ€” it imports nothing from other skills.

4. **Validation & Verification**:
   - Validate against `skills/<skill-name>/assets/checklist.md`.
   - Run unit tests: `python -m unittest discover -s skills/<skill-name>/scripts`.
   - Verify repo structural integrity: `python tools/validate_skills.py`.

## โš™๏ธ Repository Tools & Commands
- `python tools/validate_skills.py` โ€” frontmatter, required sections, cross-references,
  scripts layout and plugin packaging for every skill.
- `skills-ref validate skills/<skill-name>` โ€” the agentskills.io reference validator.
- `python tools/build_index.py` โ€” rebuilds `index.json` (`--check` verifies it is current).
- `python tools/build_marketplace.py` โ€” rebuilds the per-domain plugin marketplace.
- `python tools/run_all_tests.py` โ€” every skill's unittest suite, each in its own subprocess.
  Add `--skill <name>` to run one while iterating.
- `python -m unittest discover -s tests` โ€” core repository tests.

## ๐Ÿ”’ Non-negotiables when writing trading code
- Order placement, modification and cancellation are idempotent via a client-supplied order ID
  plus a local ledger. A broker timeout means **unknown**, never **failed**; so does a
  transport-level error such as a `NetworkException`, gateway timeout or 5xx. Only an explicit
  broker rejection means failed. Never retry an ambiguous order state in an unbounded loop.
- Risk limits (drawdown, position size, message rate) live in a module with veto power over
  the strategy engine, never inside the strategy function they constrain. Clearing a halt is
  an audited operation with an operator and a reason.
- Backtests must not use a bar's own close before that bar completes; feature engineering must
  be point-in-time correct.