Skip to content
FunCoding

exposure-coach

Generate a one-page Market Posture summary with net exposure ceiling, growth-vs-value bias, participation breadth, and new-entry-allowed vs cash-priority recommendation by integrating signals from breadth, regime, and flow analysis skills.

Star
9,394
License
MIT
Last commit
Dec 2, 2026

skills/exposure-coach/SKILL.md

View on GitHub

Exposure Coach

Overview

Exposure Coach synthesizes outputs from market-breadth-analyzer, uptrend-analyzer, macro-regime-detector, market-top-detector, ftd-detector, theme-detector, sector-analyst, and institutional-flow-tracker into a unified control-plane decision. The skill answers the solo trader's core question: "How much capital should I commit to equities right now?" before any individual stock analysis begins.

When to Use

  • Before initiating any new stock positions to determine appropriate capital commitment
  • At the start of each trading week to calibrate portfolio exposure
  • When multiple market signals conflict and a unified posture is needed
  • After significant macro or market events to reassess exposure ceiling
  • When transitioning between market regimes (broadening, concentration, contraction)

Prerequisites

  • Python 3.9+
  • FMP API key (set FMP_API_KEY environment variable) for institutional-flow-tracker data
  • Input JSON files from upstream skills (see Workflow Step 1)
  • Standard library + argparse, json, datetime

Workflow

Step 1: Gather Upstream Skill Outputs

Collect the most recent JSON outputs from integrated skills. Each file provides a specific signal dimension:

SkillOutput File PatternSignal Provided
market-breadth-analyzerbreadth_*.jsonAdvance/decline ratios, new highs/lows
uptrend-analyzeruptrend_*.jsonUptrend participation percentage
macro-regime-detectorregime_*.jsonCurrent regime (Concentration, Broadening, etc.)
market-top-detectortop_risk_*.jsonDistribution day count, top probability score
ftd-detectorftd_*.jsonFollow-Through Day quality (market bottom confirmation)
theme-detectortheme_detector_*.json or theme_*.jsonActive investment themes and rotation
sector-analystsector_rotation_*.jsonSector uptrend ratios and trend direction
institutional-flow-trackerinstitutional_*.jsonNet institutional buying/selling

Step 2: Run Exposure Scoring Engine

Execute the exposure scoring script with paths to upstream outputs:

python3 skills/exposure-coach/scripts/calculate_exposure.py \
  --breadth reports/breadth_latest.json \
  --uptrend reports/uptrend_latest.json \
  --regime reports/regime_latest.json \
  --top-risk reports/top_risk_latest.json \
  --ftd reports/ftd_latest.json \
  --theme reports/theme_latest.json \
  --sector reports/sector_latest.json \
  --institutional reports/institutional_latest.json \
  --output-dir reports/

The script accepts partial inputs; missing files reduce confidence but do not block execution.

When an input declares evaluation_coverage, require valid schema 1.0 counts and verdict: complete. Partial, not-evaluable or malformed coverage is excluded from scoring, with a stderr warning; never restore its score or bias manually. Legacy inputs without the block remain supported without a coverage guarantee.

Canonical macro-regime reports must include nested regime.confidence and composite.data_quality with valid integer component counts. Missing or malformed availability metadata, very_low confidence, and zero usable components are treated as missing critical input. They do not contribute a regime score or bias, and the normal missing-input haircut and confidence cap apply. Never override this degradation by manually copying the report's regime label into the exposure decision.

Theme input contract: Consume canonical report_type: theme_detector reports from themes.all once; ignore duplicate sorted groups. Require finite numeric non-boolean heat in [0,100], bullish/bearish direction, and data_quality with ok/warning status and string-list flags. The consumer maps to round(50 + mean(signed_heat)/2) (bullish positive, bearish negative; nearest integer, ties to even). This is an uncalibrated integration heuristic, not a forecast or freshness guarantee. Legacy numeric theme_score and recognized theme_strength labels remain supported; see references/exposure_framework.md.

Sector input contract: Pass the unchanged JSON from analyze_sector_rotation.py --json --save to --sector. Require all 11 known sectors exactly once in ranking, finite non-boolean ratio in [0,1], a slope that is null or in [-1,1], and a string trend label; a null slope or a label that disagrees with the slope gets no adjustment and a warning. Require trends counts and sector lists to match those rows, plus valid meta freshness metadata or unknown freshness. Reject the whole input on invalid required data; do not repair it by inserting legacy fields.

Use the consumer-owned sector_uptrend_health_v1 mapping: apply Uptrend Analyzer's absolute ratio bands, add +5 for Up with positive slope, -5 for Down with negative slope and 0 otherwise, clamp each unrounded value to [0,100], then average all 11 sectors equally and round once (nearest integer, ties to even). This uncalibrated heuristic uses neither groups.score nor a low-dispersion bonus. See the Sector Score section of references/exposure_framework.md for the bands and validation contract. Canonical sector input contributes to the composite score only; bias and participation use other accepted inputs. Supported legacy sector_score and dispersion/leadership inputs retain their scoring and validated context rules.

Inspect sector_integration for the mapping version, per-sector calculation, and source_freshness. A producer's is_fresh: true is a recorded claim, not a current freshness check. Without --as-of, freshness_verified remains false and stale or unknown freshness produces warnings without excluding otherwise usable sector data. With --as-of, the sector source date (meta.freshness.date) is also age-gated: it is compared with the evaluation date in America/New_York, and a source date after that date or older than --max-age-days excludes sector as unusable. In --require-provenance mode, unknown freshness and undated legacy sector input are excluded too. An excluded sector never stops the run; it is reported in inputs_unparseable, input_warnings, Markdown and stderr. A passing check sets freshness_verified: true and records freshness_check. Outside strict mode, an --as-of that is not timezone-aware or a negative --max-age-days does not stop the run: the sector age gate is skipped with a sector warning.

Verification pitfall: Inspect inputs_provided, inputs_missing, inputs_unparseable and input_warnings (diagnostic fields appear only when nonempty). Omitted theme or sector input is missing; a supplied but invalid/unreadable input is unparsable, excluded and warned on stderr. Never fold a rejected input into exposure manually. Upstream quality flags remain visible in JSON/Markdown/stderr. Confidence measures input completeness, not freshness, verified quality, independent evidence or prediction accuracy. Sector Analyst and Uptrend Analyzer share upstream data; counting both does not establish two independent confirmations.

Market status cap overlay: When the ftd-detector JSON carries a combined market_state.market_status, it caps the result instead of joining the weighted average. The composite score stays untouched and exposure_ceiling_pct = min(composite ceiling, cap).

  • market_in_correction (CORRECTION, RALLY_ATTEMPT, FTD_WINDOW, RALLY_FAILED, FTD_INVALIDATED): cap 20%; NEW_ENTRY_ALLOWED becomes REDUCE_ONLY, and CASH_PRIORITY stays CASH_PRIORITY.
  • confirmed_uptrend with FTD_CONFIRMED: cap by ftd_invalidation.days_since_ftd, 40% under 5 sessions, 60% for 5-14, 80% for 15 or more, 60% when the age is unknown. The recommendation is unchanged.
  • confirmed_uptrend with UPTREND_RESUMED: cap 80%, labelled a new-high resume, not an FTD.
  • uptrend_under_pressure: one band (20 points) below the confirmed cap, minimum 20%; the rationale says to be selective and lists cycle.pressure_reasons.
  • Null or absent status (old ftd-detector output, NO_SIGNAL, data gap) or no --ftd: no overlay and no new keys.

Inspect the market_status_overlay block (status, legacy_state, cap_pct, applied, reason, days_since_ftd, per_index, pressure_reasons), also shown in the Markdown report. The caps are uncalibrated, IBD-inspired model choices. IBD's own guidance is cited only from secondary reports (risk management rules, after a follow-through day). A maintainer test found that varying exposure by these signals barely changed index-level returns (S&P 500, Nasdaq, RSP, SPY, QQQ) versus holding the same average exposure. The ceiling judges whether the environment supports adding individual-stock positions; it is not an index trading signal. See references/exposure_framework.md.

Step 3: Interpret the Market Posture Summary

Review the generated posture report containing:

  1. Exposure Ceiling -- Maximum recommended equity allocation (0-100%)
  2. Bias Direction -- Growth vs Value tilt based on regime and flow
  3. Participation Assessment -- Broad (healthy) vs Narrow (fragile) market
  4. Action Recommendation -- NEW_ENTRY_ALLOWED, REDUCE_ONLY, or CASH_PRIORITY
  5. Confidence Level -- HIGH, MEDIUM, or LOW based on input completeness

Step 4: Apply Exposure Guidance

Map the posture recommendation to portfolio actions:

RecommendationAction
NEW_ENTRY_ALLOWEDProceed with stock-level analysis and new positions
REDUCE_ONLYNo new entries; trim existing positions on strength
CASH_PRIORITYRaise cash aggressively; avoid all new commitments

Output Format

JSON Report

{
  "schema_version": "1.0",
  "generated_at": "2026-03-16T07:00:00Z",
  "exposure_ceiling_pct": 70,
  "bias": "GROWTH",
  "participation": "BROAD",
  "recommendation": "NEW_ENTRY_ALLOWED",
  "confidence": "HIGH",
  "component_scores": {
    "breadth_score": 65,
    "uptrend_score": 72,
    "regime_score": 80,
    "top_risk_score": 25,
    "ftd_score": 10,
    "theme_score": 68,
    "sector_score": 70,
    "institutional_score": 75
  },
  "inputs_provided": ["breadth", "uptrend", "regime", "top_risk", "ftd", "theme", "sector", "institutional"],
  "inputs_missing": [],
  "rationale": "Broad participation with low top risk supports elevated exposure."
}

Markdown Report

The markdown report provides a one-page summary suitable for quick review:

# Market Posture Summary
**Date:** 2026-03-16 | **Confidence:** HIGH

## Exposure Ceiling: 70%

| Dimension | Score | Status |
|-----------|-------|--------|
| Breadth | 65 | Healthy |
| Uptrend Participation | 72% | Broad |
| Regime | Broadening | Favorable |
| Top Risk | 25 | Low |

## Recommendation: NEW_ENTRY_ALLOWED

**Bias:** Growth > Value
**Participation:** Broad (healthy internals)

### Rationale
Broad participation with low distribution day count supports elevated equity exposure.
New positions allowed within the 70% ceiling.

Reports are saved to reports/ with filenames exposure_posture_YYYY-MM-DD_HHMMSS.{json,md}.

Resources

  • scripts/calculate_exposure.py -- Main orchestrator that scores and synthesizes inputs
  • scripts/sector_contract.py -- Sector input validation and versioned score translation
  • references/exposure_framework.md -- Scoring rules and threshold definitions
  • references/regime_exposure_map.md -- Regime-to-exposure ceiling mappings

Key Principles

  1. Safety First -- Default to lower exposure when inputs are incomplete or conflicting
  2. Regime Alignment -- Let macro regime set the baseline; breadth adjusts within bounds
  3. Actionable Output -- Always produce a clear recommendation, not just data aggregation

Strict provenance for market-regime-daily

Add --require-provenance --run-id daily-20261017-unique --as-of 2026-10-17T13:00:00Z --max-age-days 3 to validate breadth and uptrend before scoring. Both producers must receive the same unique run ID; pass their exact printed JSON paths. --as-of is the timezone-aware evaluation instant, not an override of the source business date.

The gate checks schema 1.0, expected run ID, UTC retrieval no later than evaluation, nonfuture source date and configured age. Default three calendar days is a conservative policy, not an exchange holiday calendar. Failure stops before report output. Successful output records accepted lineage and verification limits. Optional top-risk/other inputs and auxiliary summary dates remain outside this gate; unknown quality flags stay false. Legacy mode retains its existing schema. Run IDs are consistency markers, not authenticity or point-in-time proof.

Similar Skills

ask-matt

MAmattpocock/skills337k4,978 new stars in the last 7 days

chief-of-staff

MAmattpocock/skills337k4,978 new stars in the last 7 days

setup-matt-pocock-skills

MAmattpocock/skills337k4,978 new stars in the last 7 days

subagent-driven-development

OBobra/superpowers331k4,772 new stars in the last 7 days

autonomous-loops

AFaffaan-m/ECC315k4,381 new stars in the last 7 days

autonomous-agent-harness

AFaffaan-m/ECC315k4,381 new stars in the last 7 days