Drawdown Circuit Breaker scans the thesis YAML files kept by the trader-memory-core skill, adds up realized profit and loss for the day, week and month, counts consecutive losing closes, and returns one recommendation: TRADING_ALLOWED, COOLDOWN or HALTED.
Default limits are a 2 percent daily loss, a cooldown after two losing closes, a 5 percent weekly drawdown and an 8 percent monthly drawdown, all adjustable. It works from local files with no network access. The result is a recommendation and record, and it does not enforce blocks at a broker.
What You Get
- A decision of TRADING_ALLOWED, COOLDOWN or HALTED with the triggered rules and their release times
- Metrics for realized P&L today, week to date and month to date, and the current losing streak
- A data quality field (OK, EMPTY_STATE or PARTIAL) with warnings for any thesis file that had to be skipped
- A JSON decision file and a matching Markdown report
Common Use Cases
- Checking before screening or sizing any new swing trade whether risk is allowed today
- Seeing whether a cooldown is active after a losing trade
- Reviewing whether weekly or monthly loss limits were breached
- Gating a daily swing workflow before candidate generation
What Makes It Unique
It fails closed on bad data: a malformed, conflicting or duplicated thesis record produces a PARTIAL result and a HALTED recommendation until the state is repaired, while an empty state folder lets a new user start. Time boundaries follow the New York exchange calendar, and an explicit as-of value makes a run reproducible. Thresholds can be set on the command line or in a JSON file, with the command line taking priority.
Under The Hood
The agent runs a local Python script that reads YAML files from the state folder (usually state/theses), needs the pandas-market-calendars package for the exchange calendar, makes no network calls and needs no API keys. It writes a timestamped JSON file and, unless JSON-only is set, a Markdown file into an output folder, so it creates files on disk. The decision is advisory: nothing is sent to a broker.