feat(regime): drawdown de-risk leg in research brief + macro prompt (PR 4 / ROADMAP L99)#205
Merged
Merged
Conversation
…R 4) Plan regime-drawdown-hysteresis-260518.md §6 item 4 (ROADMAP L99). The producer arc (predictor #176/#177/#179, ae #193) shipped 2026-05-19 and now fills substrate["drawdown"] + substrate["effective_regime"] weekly; this is the research consumer surface. - agents/macro_agent.py: new _format_drawdown_leg() renders the SPY tiered drawdown + book-vs-market excess as a continuous, market-grounded statement plus the composed effective_regime (most-protective over the ensemble). The HMM "weeks_in_current_state" line is reframed as a filter-stability DIAGNOSTIC, explicitly NOT a market-duration statement (origin: the 2026-05-15 brief's misleading "P(neutral)=1.00, 50 weeks in state"). - graph/research_graph.py: _build_regime_trend drops the "Weeks in State" column for a continuous "SPY Drawdown" + composed "Effective" column, and the Summary line carries the continuous statement ("SPY X% off trailing peak; book Y% off NAV HWM; Z pp deeper"). Fallbacks (both tested): - absent-key: no substrate["drawdown"] (pre-#176/#179) ⇒ the leg block is omitted entirely — byte-identical to the prior HMM-only path. - portfolio-unavailable: drawdown.excess.available=False ⇒ SPY leg still renders; excess line states it is unavailable; never raises. flag-name note: consumers/config use drawdown_regime_enabled (matches shipped predictor #178 + ROADMAP/SYSTEM_STATE), not the plan doc's stray L214 regime_drawdown_enabled spelling. Tests: +8 (drawdown columns, continuous summary, absent-key, NAV unavailable, macro-prompt leg rendering). max_tokens lint allowlist line ref bumped 476→562 (critic call relocated, unchanged 512 literal). Full suite 1372 passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan:
regime-drawdown-hysteresis-260518.md§6 item 4 — ROADMAP L99. PR 4 of the 6-PR ensemble-leg set. Producer arc (predictor #176/#177/#179 + ae #193) shipped+merged 2026-05-19; this is the research consumer surface (observe-mode, no behavior change).What
agents/macro_agent.py— new_format_drawdown_leg(): renders the SPY tiered drawdown + book-vs-market excess as a continuous, market-grounded statement + the composedeffective_regime(most-protective over the ensemble). HMMweeks_in_current_statereframed as a filter-stability diagnostic, explicitly NOT a market-duration statement (origin: the misleading "P(neutral)=1.00, 50 weeks in state").graph/research_graph.py—_build_regime_trenddrops the "Weeks in State" column for a continuous SPY Drawdown + composed Effective column; Summary carries the continuous statement (SPY X% off trailing peak; book Y% off NAV HWM; Z pp deeper).Fallbacks (tested)
substrate["drawdown"](pre-feat(graph): macro-sector coherence gate — block NEW BUYs in UW sectors below threshold #176/feat(scoring): factor composite scoring (Phase 1c of factor substrate, 260513 plan) #179) ⇒ leg omitted entirely — byte-identical to the prior HMM-only path.drawdown.excess.available=False⇒ SPY leg still renders; excess line states unavailable; never raises.Notes
drawdown_regime_enabled(matches shipped predictor feat(scanner): quality floor + regime-conditional ATR tilt (PRs D+E of intelligent risk-taking arc) #178 + ROADMAP/SYSTEM_STATE), not the plan doc's stray L214regime_drawdown_enabled. No flag is read here (pure observability surface).Tests
+8 targeted; full suite 1372 passed.
max_tokenslint allowlist line ref bumped 476→562 (critic call relocated by the insertion; unchanged 512 literal).🤖 Generated with Claude Code