Skip to content
Back to skills

Regime Health

ASecurity

A regime-switching bot is alive but not trading as expected — sits idle or flat, "no trades tonight", the regime did not change, a long/short strategy swap never happened, or a classification or vote needs auditing. Checks whether last night was classified, whether the recommendation applied, and whether a flip pause or news suppression is freezing it (Steven regime bots via dashboard /api/bot). If the bot may be down, run bot-status first.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 16, 2026
researchpythongobashgitapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 2, 2026

npx -y skills add ericwu13/tai-robot --skill regime-health --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Regime Health?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Regime Health
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ericwu13-regime-health/badge)](https://www.skillsdirectory.com/skills/ericwu13-regime-health)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: regime-health
description: A regime-switching bot is alive but not trading as expected — sits idle or flat, "no trades tonight", the regime did not change, a long/short strategy swap never happened, or a classification or vote needs auditing. Checks whether last night was classified, whether the recommendation applied, and whether a flip pause or news suppression is freezing it (Steven regime bots via dashboard /api/bot). If the bot may be down, run bot-status first.
---

# Regime Health

> **Where the data is (since 2026-10-24/25):** the live fleet (12 headless
> `tai_backtest.exe` bots), the bot dashboard and the W1–W4 bridge tasks
> run on **Steven**, not this PC. This PC's `data\live` holds only
> retired/test bots and its n8n is stopped. Read live state from the
> dashboard API (`http://<Steven tailnet IP>:8765/api/fleet`,
> `/api/bot?id=<SYMBOL>_<bot>`; address in `hosts.local.yaml`) or run the
> checker on Steven via `tailscale-ssh`. A run of a checker on this PC
> describes this PC only — never publish it as fleet health. Host map →
> `start-here`. Run checkers from an up-to-date checkout
> (`git rev-list --count HEAD..origin/master` = 0); the main tree may be
> weeks behind.

```bash
~/.venvs/tai-monitor/Scripts/python.exe -s scripts/monitor/check_regime.py
```

The monitor runs from the `tai-monitor` venv, not a system-site install.
Verified on oreopie: that venv is Python 3.13.7 and contains exactly
`holidays==0.105`, `python-dateutil`, `PyYAML==6.0.3`, and `six`.
`check_regime` runs clean under `-s` there. Create it once from the
system interpreter, then install that pin list:

```bat
C:\Python313\python.exe -m venv %USERPROFILE%\.venvs\tai-monitor
%USERPROFILE%\.venvs\tai-monitor\Scripts\python.exe -m pip install holidays==0.105 python-dateutil PyYAML==6.0.3 six
```

`check_regime` imports `holidays`, which imports `python-dateutil`, which
imports `six`. `PyYAML` is in the same venv for the checkers that share
it and call `load_settings` (`check_bridge`, `daily_review`).
`check_regime` does not call `load_settings`. The script inserts the repo
root on `sys.path` itself.

Executed chain (a `check_regime(now, base_dir)` call):
`scripts.monitor.check_regime` → `src.regime.switch_logic.holiday_calendar_degraded`
/ `latest_night_session` → `src.market_data.holidays` → `import holidays`
→ `dateutil` → `six`. `src.live.live_runner` is imported only by
settlement-day helpers in `holidays.py`, which this checker does not call.

`~/.venvs/tai-monitor/Scripts/python.exe -s -c "import holidays"`
is the env gate for this path. A missing `holidays` install makes the
checker report a degraded calendar instead of a missed night.

Read-only over `data/live/<bot>/regime_state.json`, `regime_history.csv`,
`decisions.csv`, and the `news` block of `session.json`.

## Session identity (get this right first)

A session is identified by its **OPEN date**. The night opening Mon 15:00
and closing Tue 05:00 is `2026-08-24|NIGHT` on BOTH sides of midnight.
Every key the checker compares — `last_assessed`, history rows, P&L
windows, vote `expires_after_session` — uses that convention.
`session_slot()` (calendar date at poll time) survives only for the
daily-report key; never use it for session identity.

## Reading the verdict

| Level | Meaning |
|---|---|
| P1 | `last_assessed` older than the last completed night (classification MISSED) — only when the TW holiday calendar is healthy and that night is not `is_taifex_holiday`; corrupt `regime_state.json`; news suppression latched on a stale session key |
| P2 | never classified (placeholder state); pre-v2.16 `key_format`; flip-counter pause active; recommendation never applied; session P&L never recorded; >20 `NEWS_SUPPRESSED` bars in 24h; any `REAL_ORDER_TIMEOUT`; TW holiday calendar degraded (miss P1 suppressed) |
| P3 | suppression that is current and by-design; findings on a stopped/retired bot (demoted wholesale — a bot that isn't running cannot classify) |

Healthy vs unhealthy:

| `regime_state.json` | Healthy? |
|---|---|
| `last_assessed` == last completed night's key, `key_format: open-date` | yes |
| `next_session.executed: true` | yes — the swap applied |
| `next_session.executed: false` after the gap ended | NO — blocked by position/veto/replay |
| `paused_until_session >= session_count` | NO — flips froze the regime |
| `{"regime": "unknown", "classified_at": null}` | not yet — fresh deploy or insufficient bars |

## Gotchas

- **`applied` / `applied_at` in `regime_history.csv` are DEAD columns** —
  always `false`/empty by construction. Never read them, never quote them
  as evidence. Application evidence lives in
  `regime_state.json` → `next_session.executed` / `executed_at`.
- **The 30-minute insufficient-bars backoff is invisible.** When the
  classifier lacks bars it silently backs off; the only trace is the
  ABSENCE of a "Classified" line in the debug log. Don't read "no error"
  as "it classified".
- `classification_due` fires in the night's last 2 minutes OR any time
  after close while unassessed — so a catch-up after an app hang is
  normal and its features may include following-DAY bars.
- **Holiday gaps are not residual #151 misses.** With
  `last_assessed=2026-09-24|NIGHT`, a working calendar on Teachers' Day
  morning (reproduced at 2026-09-28 05:17 TPE) still has last completed
  night `2026-09-24|NIGHT`, and `classification_due` returns None. Live
  logs `Classification not due`. Mid-Autumn **2026-09-25** and Teachers'
  Day **2026-09-28** did not open nights. The next real night is Tuesday
  **2026-09-29 15:00** TPE. Do not restart the bot and do not
  hand-advance `last_assessed`.
  The phantom `classification_due → 2026-09-25|NIGHT` happens only when
  the TW `holidays` package has fallen back to weekends. In that state
  `is_taifex_holiday(2026-09-25)` is also false, so a holiday check does
  not refute the tip. Call `holiday_calendar_degraded(now)` first. If it
  is true, refuse the miss escalation: `check_regime` emits a
  degraded-calendar finding (P2) instead of a miss P1. Use
  `is_taifex_holiday` only after that health check says the calendar is
  intact.
- Poll order is classify → record → apply. `record_session_result`
  UPDATES the row in place, so re-recording never double-counts.
- Votes: `last_features._vote_sources` is the audit trail of what the
  LAST classification consumed. A missing key just means the state
  predates vote-source persistence.
- Bilingual reasons in state/history are expected (`下降趨勢確認
  trending-down confirmed`) — not corruption.

## Next steps

- votes look wrong or absent → `bridge-health`
- classification missed but the bot was alive → `log-scan`, then the
  repo's `debug` skill to root-cause end to end
- live votes (missing, stale, or wrong) → `bridge-health`. The local n8n
  side of the vote pipeline is history only (pre-2026-10-24) → `n8n-debug`;
  do not run its fixes.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in research →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.