Technical Analysis Ontology
This document defines the fundamental concepts and relationships in Ghost’s technical analysis system. It establishes the shared vocabulary that all agents use.
Core Concepts
1. Memory Types
Technical analysis reads three types of market memory. (Momentum is a timing layer, not a memory type — it tells you WHEN to act within the structure the other three define.)
| Memory Type | Agent | What It Captures | Persistence |
|---|---|---|---|
| Structural | Fib | Where price reversed before | Long (months/years) |
| Trend | MA | Direction and trend strength | Medium (weeks/months) |
| Positioning | VWAP | Where participants are positioned | Short (days/weeks) |
Relationship: Structural memory creates the framework, trend memory shows movement within that framework, positioning memory reveals who is trapped or defending.
2. Levels
A level is a price where market behavior is expected to change.
Level Taxonomy:
├── Support (price expected to bounce)
│ ├── Structural (Fib retracements, prior lows)
│ ├── Dynamic (moving averages, trendlines)
│ └── Positioning (VWAP where buyers defend)
├── Resistance (price expected to reject)
│ ├── Structural (Fib extensions, prior highs)
│ ├── Dynamic (moving averages, trendlines)
│ └── Positioning (VWAP where trapped sellers exit)
└── Neutral (inflection points)
└── Pivots, mid-points, value areas
Level Strength is determined by:
- Source count: How many agents identify it
- Timeframe count: How many timeframes show it
- Recency: How recently it was tested
- Reaction magnitude: How strongly price reacted before
3. Confluence
Confluence occurs when multiple independent sources identify the same price zone.
Confluence Strength (Fib — computed by _calculate_confluence_zones() in timeframe_fibs.py):
├── STRONG: 3+ timeframes, OR 2+ with monthly, OR 10+ fibs from 2+ timeframes
├── MODERATE: 2 timeframes, OR 5+ fibs clustered
└── WEAK: Single timeframe only
Clustering tolerance: 0.75% — levels within this % of cluster midpoint are grouped.
Pre-calculated from ALL stored fibs, filtered to near-price zones for agent prompts.
Confluence Strength (Cross-Agent):
├── STRONG: 3+ agents agree (Fib + MA + VWAP)
├── MODERATE: 2 agents agree
└── WEAK: Single agent only
Confluence Types:
- Horizontal: Multiple levels at same price (e.g., Fib 61.8% + 50 SMA + session VWAP)
- Temporal: Same level confirmed across multiple timeframes
- Cross-domain: Structure + Trend + Positioning agree
4. Epochs
An epoch is a meaningful price movement worth measuring.
Epoch Requirements:
├── Magnitude: Minimum move size (varies by timeframe)
│ ├── Monthly: 30%+ moves
│ ├── Weekly: 15%+ moves
│ ├── Daily: 5-15% moves
│ └── Intraday: Session ranges (no minimum)
├── Duration: Sustained movement (not noise)
└── Significance: Clear swing high/low boundaries
Epoch Anatomy:
- Anchor Low (0%): Where the move started
- Anchor High (100%): Where the move ended
- Retracement Levels: 23.6%, 38.2%, 61.8%, 78.6%
- Extension Levels: 127.2%, 161.8%, 200%, 261.8%
⚠️ THE 50% RULE (CRITICAL)
The 50% level is REFERENCE ONLY — it is NOT a structural level.
| Level | Status | Usage |
|---|---|---|
| 38.2% | Structural | List in key S/R |
| 50% | Reference | Use only to describe location (“price between 50% and 61.8%“) |
| 61.8% | Structural (Golden Ratio) | The real floor/ceiling — always list |
Do NOT list 50% in “key support/resistance” outputs. The 61.8% golden ratio is the true structural level. See FIB_HERMENEUTICS.md for full details.
5. Regime
A regime describes the current market state.
Regime Types:
├── Trend Regime (from MA)
│ ├── Bullish: Price > stacked MAs
│ ├── Bearish: Price < inverted MAs
│ └── Tangled: MAs interleaved (choppy)
├── Session Regime (from VWAP)
│ ├── Buyers control: Closes above VWAP
│ ├── Sellers control: Closes below VWAP
│ └── Contested: Mixed closes
└── Momentum Regime (from Momentum)
├── Strong bullish: MACD > 0, histogram expanding
├── Strong bearish: MACD < 0, histogram expanding
└── Transitional: Crossover imminent
6. Positioning
Positioning maps where market participants are located relative to price.
Position States:
├── Trapped (underwater)
│ ├── Location: AVWAP above current price
│ ├── Behavior: Will sell rallies to escape
│ └── Creates: Supply/resistance
├── Defending (profitable)
│ ├── Location: AVWAP below current price
│ ├── Behavior: Will buy dips to add
│ └── Creates: Demand/support
└── Neutral
├── Location: AVWAP near current price
└── Behavior: Unpredictable
7. Signals
A signal is an actionable indication from an indicator.
Signal Taxonomy:
├── Momentum Signals
│ ├── Divergence (price vs indicator disagreement)
│ ├── Crossover (indicator lines crossing)
│ ├── Extreme (overbought/oversold)
│ └── Squeeze (volatility compression)
├── Structural Signals
│ ├── Level test (price at key level)
│ ├── Breakout (level violated)
│ └── Rejection (level defended)
└── Timing Signals
├── Confirmation (multiple signals align)
├── Warning (early reversal sign)
└── Invalidation (thesis broken)
8. Pattern Memory (Playbooks)
A playbook is a Bayesian model of a recurring market pattern, calibrated from historical instances. Where Fib, MA, and VWAP agents read real-time market memory (structural, trend, positioning), playbooks read compounded historical memory — what has happened on prior sessions that match today’s setup, and what that implies for today’s outcome probability.
What a Playbook Is
A playbook is a versioned YAML artifact per ticker module that encodes:
| Field | What it captures |
|---|---|
| Definition criteria | Rules used to identify historical instances from OHLCV data. NOT predictive signals — they are definitional and have likelihood ratio of 1.0 by construction. |
| Prior | Base rate of the pattern firing on any given session (empirical frequency across YTD trading days). |
| Signals | Observable features with Bayesian likelihood ratios per signal. Mechanical signals have likelihood_if_fires and likelihood_if_no_fire computed from data. Narrative signals have neither — the LLM evaluates them qualitatively at runtime. |
| Historical outcomes | Aggregate outcome counts across instances (e.g., recovered at T+2, reached intraday high at T+5) used to compute posterior outcome rate. |
| Historical instances | Each with per-signal tri-state values (present/absent/unknown) and outcome measurements. Audit trail plus calibration data. |
| Failure conditions | Documented known failure modes (e.g., “Q4 earnings overhang breaks the accumulation thesis”) that modify LLM interpretation when detected. |
| Correlations | Pairwise overlap with other playbooks. Some correlations are structural (1.0 when one playbook is a derived view of another) vs empirical. |
Loaded playbooks produce two numbers at runtime: posterior firing probability (how likely this pattern is active today, computed via Bayes from the prior and the observed signals) and posterior recovery rate (given the pattern is active, what’s the historical rate of the desired outcome, computed via Beta-Binomial shrinkage).
Signals: Mechanical vs Narrative
Playbook signals divide into two types, each with different handling in the Bayesian inference layer:
| Signal Type | Availability | Bayes handling | Examples |
|---|---|---|---|
| Mechanical | yfinance, options_chain, intraday_flow — computable from data | Included in posterior math via likelihood ratios | prior_day_keltner_squeeze, gamma_environment_negative, range_position_lower_third |
| Narrative | llm_runtime — evaluated qualitatively by LLM at runtime | Skipped from posterior math. Tracked per-instance as audit trail only. | new_narrative_cover, weekend_binary_risk, catalyst_follow_through |
The schema enforces this split. Mechanical signals MUST have both likelihoods set. Narrative signals MUST NOT have likelihoods. The inference layer skips narrative signals by signal_type check, not by absence from the conditions dict — they’re passed through to the prompt as context for the LLM consumer.
This separation preserves epistemic honesty. Bayesian math is for computable, likelihood-calibrated signals. Qualitative judgment (e.g., “is this a real catalyst?”) belongs in the LLM’s interpretive layer, not in a likelihood ratio pulled out of thin air.
The Tri-State Model
Each historical instance records per-signal values as a tri-state:
| State | Meaning | Bayes handling |
|---|---|---|
present | Signal was directly observed in the instance | Contributes positive likelihood ratio |
absent | Signal was directly observed NOT to be present | Contributes negative likelihood ratio |
unknown | Signal could not be observed (data unavailable, outside research window) | Skipped entirely. Does NOT contribute negative likelihood. |
The critical distinction is between absent and unknown. Marking a signal absent when we can’t actually observe it would systematically bias posteriors downward — the playbook would be penalized for our inability to see the signal. The unknown state preserves the option: “we don’t know, don’t count it either way.”
This matters most when historical data is uneven. The early VST stop mine instances (Jan-Mar 2026) have options/flow signals marked unknown because GCS reports only go back to April. The Apr 2 and Apr 9 instances have them present because the reports exist. The likelihood estimation counts known instances (present + absent) in the denominator, not total. This is an epistemic choice, not a convenience — it’s the honest treatment of missing data.
Calibration Regimes
Playbooks fall into one of three calibration regimes, determined by what data is available and how the negative pool is defined:
| Regime | Description | Negative pool | Example |
|---|---|---|---|
| 1. Broad-market discrimination | Calibrated against the broad YTD non-instance pool. Strong individual likelihood ratios possible when the pattern is common enough. | All YTD trading sessions NOT matching the positive criterion | pre_mine_setup (9 positives vs 58 negatives), narrative_cover_rotation (5 positives vs 63 negatives) |
| 2. Within-population discrimination | Calibrated within a conditioned population by outcome. Small samples with transparent weakness. Functions as a context flag rather than a high-discrimination signal. | Members of the conditioned population with the OPPOSITE outcome | recovery_t_plus_2 (5 mines recovered vs 3 mines failed), mirror_session_pair (5 vs 3) |
| 3. Live-capture only | Public historical data does not show the pattern — must be observed in real time via broker-grade feeds. Deferred to the Research Backlog until live capture accumulates enough instances. | To be determined once calibration data exists | mine_t1_shakeout (pre-market wick not visible in yfinance), capitulation_catalyst_gap (3 seed instances, below threshold) |
The regime determines the shape of discrimination and the appropriate expectations for the LLM consumer. A Regime 1 playbook firing at 70% posterior is a strong directional signal. A Regime 2 playbook firing at 70% posterior is a weaker context flag. The LLM should reason differently about them.
Definition Criteria vs Signals — The Critical Distinction
Every playbook has a definition_criteria field separate from its signals list. This distinction is easy to conflate and produces degenerate playbooks if confused.
Definition criteria are the rules used to IDENTIFY historical instances of the pattern. They are not predictive signals. By construction, every positive instance satisfies the definition criteria with probability 1. Including them as signals would produce likelihood ratios of 1.0 / likelihood_if_no_fire — tautological, overconfident, and uninformative.
Signals are observable features that VARY across instances and discriminate positive vs negative pools. They are the things the Bayesian layer actually reasons over.
Example — pre_mine_setup:
- Definition criteria:
rally_from_open >= 2%,range >= 2.7%,close_position <= 25%. These are how we identify “this is a stop mine session.” Every positive instance has them. They are NOT signals. - Signals:
prior_day_keltner_squeeze,prior_day_macd_state,ceg_close_magnitude_match, etc. These vary across instances and give the Bayesian layer real discriminative power.
The recovery_t_plus_2 review caught a tautology where a signal was equivalent to the outcome metric by construction — same failure mode, different expression. Always verify empirically that signals have non-degenerate likelihood ratios before shipping a playbook.
Sister Playbooks and Directional Symmetry
Many market patterns have directional mirrors that the initial framing misses. A stop mine runs both ways — long-side (rally→fade, trap longs) and short-side (flush→squeeze, trap shorts) are mechanically symmetric but structurally distinct (close in opposite quartiles). If a playbook is built for one direction, the mirror should be scanned explicitly:
| Original playbook | Directional mirror |
|---|---|
pre_mine_setup (long-side, rally→fade, close bottom quartile) | short_mine_setup (short-side, flush→squeeze, close top quartile) |
recovery_t_plus_2 (long-side recovery to upside) | Possible short_mine_recovery_t_plus_2 sister — not yet built |
Sister playbooks have disjoint populations (no session can be both by criterion) but share the same mechanical principle. They are documented as a matched pair in the library and may be consolidated into a single symmetric playbook in a future refactor.
Cross-Playbook Coupling
Playbooks are not always independent. Some are derived views of others — they operate on the same underlying population with different evaluation timing or different outcome framing. Their correlation is structurally 1.0, not 0.78.
Example: recovery_t_plus_2 is a derived view of pre_mine_setup. Every instance of recovery_t_plus_2 is BY DEFINITION an instance of pre_mine_setup (the 9 mine dates are the same). They evaluate at different T_offsets (T+0 for setup, T+2 for recovery) and predict different outcomes (the mine pattern vs the recovery pattern), but they are coupled through their shared population.
The LLM consumer must treat coupled playbooks as a pair, not as independent signals. The correlations field in each playbook’s YAML captures this explicitly — a value of 1.0 means “this playbook is structurally derived from the referenced one; do not double-count their posteriors.”
The Research Backlog Lifecycle
Not every observed pattern becomes a playbook. Patterns that fail empirical verification enter a Research Backlog — a holding area for candidates that require more data or a different approach.
Observed pattern
│
▼
Empirical scan on YTD data
│
├─ 0-2 instances ────────► Research Backlog (defer, grow via live capture)
│
├─ 3-4 instances ────────► Regime 2 consideration OR Research Backlog
│
└─ 5+ instances ─────────► Build queue (graduates to the library)
The Research Backlog entries are documented with: the pattern description, the seed instances (if any), the specific obstacle to formalization, and a clear maturity path. Sub-task F’s online feedback loop captures live instances over time. When a backlog entry accumulates enough data, it graduates to a real playbook via a future build session.
The backlog is a first-class knowledge artifact, not a todo list. It represents empirically-validated observations that the current data can’t yet support as formal playbooks — valuable knowledge held in escrow.
Scale Invariance — playbooks operate at multiple timeframes
Pattern memory is scale-invariant. The same accumulation pattern (bait → distribution → structural support → catalyst exit) operates at multiple timeframes — intraday, single-session, multi-day, multi-week, multi-month — with scale-specific criterion thresholds. This is exactly parallel to Fib retracements operating at multiple epochs (monthly / weekly / daily / intraday) with epoch-specific magnitude thresholds.
The Phase 2 playbooks (pre_mine_setup, recovery_t_plus_2, mirror_session_pair, short_mine_setup, narrative_cover_rotation) are valid pattern detectors at the single-session scale. They are not wrong — they are scale-specific instances of a broader canonical pattern.
The canonical playbook (Phase 2.5: accumulation_stop_harvest, authored AFTER Phase 2 push) is a meta-playbook that:
- Sits on top of the existing single-session playbooks as a scale classifier + execution router
- Takes day-1 signals (intraday tape shape, prior-day characteristics, sector divergence, distance from multi-month log trendline, known catalyst calendar within 48-72h)
- Outputs a scale classification and an execution route appropriate to that scale
Why this matters: the execution asymmetry between scales is large. Multi-day-scale entry at structural support → exit at catalyst gap open captures 5-8x the return of single-session entry → T+1 swing exit, with the multi-day entry actually being lower-risk because it sits at multi-year structural support rather than intermediate session support.
The epistemic rule: when a pattern’s empirical criterion fails to match an observed event, do NOT immediately conclude “not the pattern.” First ask: “Is this the same pattern at a different scale?” Pattern criteria are scale-specific by design. A criterion built for single-session OHLCV cannot validate or invalidate the same pattern operating at multi-day or weekly scale.
The Jan 7-9 2026 VST event is the canonical example. Pre-compaction analysis classified it as “capitulation, not a stop mine” because Jan 7 had no morning rally (open=high), failing the single-session criterion. The corrected reading: the bait happened on Jan 6 (+4.05% on 1.5x volume — the multi-day-scale “morning”), Jan 7-8 was the distribution phase, the structural support was the multi-year log trendline at $149, and Jan 9 was the catalyst exit (Vistra-Meta direct PPA, gap open +15.8%). Same pattern, different clock.
See docs/PLAYBOOK_METHODOLOGY.md for builder-side guidance on scale-invariant playbook design and docs/PHASE_2_5_CANONICAL_PLAYBOOK_BRIEFING.md for the canonical author’s brief.
Relationships
Memory Hierarchy
Structural Memory (Fib)
│
│ provides framework for
▼
Trend Memory (MA)
│
│ shows movement within
▼
Positioning Memory (VWAP)
│
│ reveals participants within
▼
Timing Layer (Momentum)
Level-Confluence Relationship
Level ──────────────────────────┐
│ │
│ multiple levels at │ confirmed by
│ same price create │ momentum
│ │
▼ ▼
Confluence Zone ◄──────────── Signal
│
│ strength determines
▼
Conviction Level
Agent Synthesis Flow
┌─────────────────────────────────────────────────────────────┐
│ Technical Director │
│ │
│ Fib Reading ──┐ │
│ │ │
│ MA Reading ───┼──► Confluence Detection ──► Trade Plan │
│ │ │
│ VWAP Reading ─┤ │
│ │ │
│ Momentum ─────┘ │
└─────────────────────────────────────────────────────────────┘
structural_reading → trade_plan
Each agent outputs a structural_reading object. The exact fields vary by agent, but all include a thesis (1-2 sentence interpretation):
| Agent | Key structural_reading Fields |
|---|---|
| Fib | current_position, confluence_zones, golden_ratios, structure_quality, next_tests, structural_thesis |
| MA | trend_regime, extension_status, dynamic_sr, monthly_context, thesis |
| VWAP | positioning_map, session_regime, accumulation_distribution, trapped_cohorts, thesis |
| Momentum | divergence_status, sentiment_extreme, momentum_regime, volatility_state, indicator_confluence, thesis |
See each agent’s *_HERMENEUTICS.md doc for the full output schema.
The Technical Director consumes all four outputs and produces a trade_plan:
structural_reading (Fib) trade_plan (Director output)
┌─────────────────────────┐ ┌─────────────────────────┐
│ current_position │ │ long_zones │
│ confluence_zones │ ────────► │ primary_buy_zone │
│ golden_ratios │ │ secondary_buy_zone │
│ structure_quality │ │ profit_zones │
│ next_tests │ │ risk_management │
│ structural_thesis │ │ timing │
└─────────────────────────┘ │ agent_evidence │
+ │ chain_of_thought │
structural_reading (MA) │ confidence │
┌─────────────────────────┐ └─────────────────────────┘
│ trend_regime │
│ extension_status │ ────────►
│ dynamic_sr │
│ monthly_context │
└─────────────────────────┘
+
structural_reading (VWAP)
┌─────────────────────────┐
│ positioning_map │
│ session_regime │ ────────►
│ trapped_cohorts │
│ accumulation_distrib │
└─────────────────────────┘
+
structural_reading (Momentum)
┌─────────────────────────┐
│ divergence_status │
│ sentiment_extreme │ ────────►
│ momentum_regime │
│ indicator_confluence │
└─────────────────────────┘
The Director cites each agent’s contribution in agent_evidence and chain_of_thought fields.
Concept Definitions
Price Action Concepts
| Concept | Definition | Example |
|---|---|---|
| Swing High | Local maximum with lower highs on both sides | Peak before a pullback |
| Swing Low | Local minimum with higher lows on both sides | Trough before a rally |
| Higher High | Swing high above prior swing high | Uptrend confirmation |
| Lower Low | Swing low below prior swing low | Downtrend confirmation |
| Retracement | Pullback within a larger move | 38.2% pullback in uptrend |
| Extension | Move beyond prior swing | 161.8% extension target |
Technical Structure Concepts
| Concept | Definition | Example |
|---|---|---|
| Support | Price level where buying emerges | Fib 61.8% holds on test |
| Resistance | Price level where selling emerges | Prior high rejected |
| Breakout | Price moves through level with momentum | Close above resistance |
| Breakdown | Price moves below level with momentum | Close below support |
| False Break | Level violated then reclaimed | Wick below support, close above |
| Retest | Price returns to broken level | Resistance becomes support |
Indicator Concepts
| Concept | Definition | Example |
|---|---|---|
| Divergence | Price and indicator disagree | Higher price, lower RSI |
| Confirmation | Price and indicator agree | Higher price, higher RSI |
| Overbought | Indicator at upper extreme | RSI > 70 |
| Oversold | Indicator at lower extreme | RSI < 30 |
| Crossover | Two lines intersect | MACD crosses signal line |
| Squeeze | Volatility contracts | Bollinger inside Keltner |
Positioning Concepts
| Concept | Definition | Example |
|---|---|---|
| Trapped Long | Buyer underwater, wants out | Bought at AVWAP above price |
| Defending Long | Buyer profitable, will add | Bought at AVWAP below price |
| Accumulation | Institutions buying | Rising AVWAP slope |
| Distribution | Institutions selling | Falling AVWAP slope |
| Session Bias | Who controlled the session | Close vs VWAP position |
Market Environment Instruments — The Quartet
Four instruments provide a complete environment read before looking at any individual ticker. Each is normalized and universal:
| Instrument | What It Measures | Question It Answers | Data Function |
|---|---|---|---|
| Williams %R | Where close sits in the high-low range (0 to -100) | Position — how far has the market fallen in its own range? | get_williams_r() in ghost/tools/market_data.py |
| VIX | Implied volatility of S&P 500 options | Sentiment — how scared are participants? | get_vix_data() in ghost/tools/premarket.py |
| Surprisal | Absolute change in log-odds of prediction market probabilities (in nats) | Information Velocity — how fast are beliefs changing? | compute_deltas() in ghost/tools/prediction_markets.py |
| Hurst | DFA scaling exponent of log returns (0.0-1.0) | Persistence — do moves continue or reverse? | get_hurst_exponent() in ghost/tools/market_data.py |
Position + Sentiment + Information Velocity + Persistence = full environment read.
The key insight: each instrument is universal. %R works on any range. VIX on any fear level. Surprisal regardless of catalyst (0.5 nats is 0.5 nats whether oil, tariffs, or Fed). Hurst classifies regime character (mean-reverting < 0.45, random ≈ 0.5, trending > 0.55) without requiring a price target.
The 1+1=3 reads:
- %R oversold + Hurst mean-reverting = STRONGEST BUY (washed out and reverts)
- %R oversold + Hurst trending = FALLING KNIFE (washed out but momentum continues)
- %R overbought + Hurst mean-reverting = pullback is buyable (stretched but reverts)
- %R overbought + Hurst trending = chase risk (stretched and momentum)
Per-ticker Hurst: The mechanical snapshot also computes Hurst on each ticker’s own returns (ticker_hurst field). NVDA can be trending while SPY is mean-reverting — that’s a different trade than if both align. Per-ticker Hurst answers “does THIS NAME revert?” independently of broad market character.
Yield curve as rate path context: Not part of the quartet (it’s not directly a regime instrument), but the environment layer also fetches FRED 2Y/10Y yields with daily deltas. rate_path_delta_2y_bps shows the bond market’s forward repricing — useful for sectors where rate sensitivity matters (utilities, financials, REITs, growth tech). The Strategist gets this context as yield_curve_data with sector-specific interpretation.
Where they surface:
- All quartet instruments appear in the report header and FLAGS section
- Williams %R, VIX, Hurst flow through
market_environmentin the Strategist output - Surprisal signals are ranked in the MARKET SIGNALS report section and injected into News Analyst and Strategist prompts
- Williams %R, VIX, and Hurst regime are tracked as condition keys in the feedback loop; surprisal is not yet a condition key (it flows through flags and director reasoning)
- Yield curve flows into the Strategist prompt as a rate path context block
Market Breadth Concepts
| Concept | Definition | Example |
|---|---|---|
| Williams %R | Larry Williams momentum oscillator measuring where close sits in the high-low range over a lookback period; 0 to -100 scale | SPY 14d %R: -92 = deeply oversold |
| Market Breadth Regime | Composite reading of SPY + QQQ Williams %R at 14d and 50d lookbacks — classifies the broad market as oversold, neutral, overbought, or divergent | Both SPY and QQQ 14d below -80 → oversold regime |
| Breadth Tailwind | When broad market is oversold, dip-buying has structural support from mean reversion forces | Williams %R oversold + zone_status IN_PRIMARY = high conviction |
| Breadth Headwind | When broad market is overbought, buy zones may not hold because the rising tide is exhausted | Williams %R overbought + zone entry = size down |
| Breadth Divergence | SPY and QQQ in different zones — one index oversold while the other overbought, signaling sector rotation rather than broad direction | SPY oversold, QQQ neutral → rotation out of tech |
Key Principle: Williams %R is a market-regime signal, not a ticker signal. It belongs alongside VIX as a broad environment read that modifies conviction on individual setups. Displayed in the report header next to VIX and tracked as williams_r_regime in the condition accuracy system.
Regime Classification:
| Regime | Condition | Dip-Buying Implication |
|---|---|---|
oversold | Both SPY and QQQ 14d %R ≤ -80 | Strong tailwind — market washed out |
leaning_oversold | One index ≤ -80, other neutral | Moderate tailwind |
neutral | Both between -80 and -20 | No broad signal |
leaning_overbought | One index ≥ -20, other neutral | Caution |
overbought | Both SPY and QQQ 14d %R ≥ -20 | Headwind — zone may not hold |
divergent | One oversold, one overbought | Sector rotation — read carefully |
Prediction Market Concepts
| Concept | Definition | Example |
|---|---|---|
| Logit Transform | Converts probability percentage to log-odds: log(p / (1 - p)). Normalizes probability space so that changes near 50% (high uncertainty) are correctly weighted as more informative than changes near extremes | 50% → 0.0 logit, 80% → 1.39 logit, 95% → 2.94 logit |
| Surprisal | Absolute change in logit between two probability snapshots, measured in nats. The standard Bayesian measure of how much new information arrived | 50% → 55% = 0.20 nats; 90% → 95% = 0.59 nats |
| Signal Strength | Classification of surprisal magnitude. major (>0.5 nats) = regime change — cite in conflicts and flags. notable (>0.2 nats) = meaningful repositioning. Below = noise | Ceasefire probability 30% → 45% = 0.62 nats = major |
| Information Velocity | How fast prediction market beliefs are updating — measured by surprisal per day. High velocity means the market is actively repricing a scenario | 3 consecutive days of >0.2 nats = sustained repricing |
| Acceleration | Delta of logit deltas — whether belief updates are speeding up, slowing down, reversing, or flat. Computed on logit scale, not raw percentages | accelerating = today’s logit delta > 1.3x yesterday’s; decelerating = <0.7x; reversal = direction flipped |
| Probability Snapshot | Daily snapshot of all tracked prediction market probabilities, saved to Firestore (prediction_market_snapshots/{YYYY-MM-DD}). Enables multi-day delta computation | Saved on first ghost run each trading day |
Key Principle: Prediction market probabilities are real-money consensus prices on binary events. They outrank headlines and pundit opinions because participants have skin in the game. When headlines say “de-escalation” but ceasefire probability is <50%, the market is NOT pricing de-escalation. Surprisal-based ranking ensures a 2pt move at 5% probability correctly ranks above a 5pt move at 50% — the low-probability event update contains more information because the market was already very confident.
Options Structure Concepts
| Concept | Definition | Example |
|---|---|---|
| Max Pain | Strike where options holders lose most | Price gravitates here at expiry |
| DTE (Days to Expiry) | Days until options expiration | 0 DTE = TODAY, strongest magnet |
| Gamma Flip | Price where dealer net gamma = 0 | Behavior changes at this level |
| Structural Flip | Gamma flip from 1-45 DTE options | Multi-day positioning bias |
| Tactical Flip | Gamma flip from 0DTE options only | Intraday hedging pressure |
| Put Wall | Large put OI below price | Dealers buy dips here (support) |
| Call Wall | Large call OI above price | Dealers sell rips here (resistance) |
| Positive Gamma | Net long gamma environment | Dealers dampen moves (stabilizing) |
| Negative Gamma | Net short gamma environment | Dealers amplify moves (trending) |
| OI Concentration | OI clustered vs diffuse at max pain | >25% = strong magnet |
| Bridge Entry | Put wall between Fib zones with positive gamma — dealers buy the sweep, creating mechanical support before the next structural level | $155 put wall between primary ($158.42) and secondary ($152.98), gamma positive = stop mine catch |
| Stop Mine | Price sweeps below known support to trigger stops, then reverses when mechanical support (put wall + positive gamma) arrests the flush | Sweep below $158.42 primary zone caught at $155 put wall, bounces back to entries |
Catalyst Mechanism Concepts
| Concept | Definition | Example |
|---|---|---|
| Narrative Catalyst | News event that changes sentiment; market may or may not react | Analyst upgrade, earnings, geopolitical event |
| Mechanical Catalyst | Forced flow event; buying/selling is guaranteed regardless of sentiment | S&P 100 addition, ETF rebalancing, index reconstitution |
| Catalyst Type | Classification of active catalyst: accumulation, distribution, binary, or mechanical | catalyst_type: mechanical for index addition |
Key Principle: Narrative catalysts are probabilistic — the market can ignore them. Mechanical catalysts are deterministic — index funds must execute. When both are present (e.g., index addition during a selloff), mechanical flow provides a floor that narrative fear cannot override. The News Analyst classifies the type; the mechanical structure engine may detect the resulting flow as organic accumulation.
Catalyst Timing Asymmetry: When observable flow (volume, buying type, options positioning) precedes a narrative catalyst by days or weeks, the market priced the catalyst through information channels before the headline. This is not inside information — it’s observable logistics: military deployments visible via satellite, shipping data via AIS, insurance repricing via broker quotes, speculative positioning via CFTC. The calibration question: “Has a similar event happened before, and what did the market learn about what to price?” The probability question: “Each observable channel moves the market’s probability estimate of the downstream consequence — what’s the arc?” See NARRATIVE_FORENSICS.md.
Feedback Loop Concepts
| Concept | Definition | Example |
|---|---|---|
| Prompt Regime | Version tag for a significant prompt strategy change | "v6_mechanical_catalyst_2026-03-09" — added mechanical catalyst type for forced flow events (index adds, rebalancing) |
| Regime Isolation | Feedback queries only return predictions from the current regime | Old predictions excluded automatically |
| Feedback Reset | Wipe predictions, guardrail stats, and scout scores for a clean slate | ghost feedback-reset --yes after a major prompt change |
| Williams %R Regime | Market breadth condition tracked in feedback loop — oversold, neutral, overbought, divergent, etc. | williams_r_regime: oversold when both SPY and QQQ 14d %R ≤ -80 |
| Condition Accuracy | Historical accuracy under specific market conditions | 82% accuracy when sweep=completed + gamma=positive |
| Accuracy Multiplier | Score adjustment based on condition accuracy | 1.18x boost for 82% accuracy, 0.70x floor for 45% |
| Flow-Adjusted Activation | Flow data upgrades WAIT_FOR_ZONE → BUY_NOW when institutional buying confirms near a zone | Absorption ≥50, organic accumulation ≥60%, bullish delta → BUY_NOW [FLOW] |
| Flow Score Bonus | Extra points for confirmed institutional flow near zones | +15 extreme flow, +8 strong flow |
| Scalp-Aware R:R | Scout uses better of swing/scalp R:R for scoring | Swing R:R 0.19 + scalp R:R 3.9 → uses 3.9 |
| Zone Defense | Unconditional historical test of whether daily candles held a zone — “did price hold here?” | DEFENDED: 6/6 sessions held zone (25d lookback) |
| Zone Touch | A recorded event when price enters or approaches a zone during a ghost run, stored in Firestore with market conditions | Zone touch at $175.55 with gamma=negative, buying_type=organic |
| Zone Hold Rate | Condition-aware historical hold percentage — “did price hold here when conditions looked like this?” | ZONE HOLD: ▲ 90% (10 touches, gamma_environment, buying_type) → 1.15x |
| Hold Rate Multiplier | Score adjustment based on zone hold rate under matching conditions | 1.15x boost for 90% hold rate, 0.85x penalty for 43% hold rate |
| Pass Decay | Quantified cost of inaction: what happens when a zone holds and you don’t trade? Measured from 2-year backtest corpus — retest rates, retest hold rates, EV of acting vs passing. | EV act $1.49/sh, EV pass $0.00/sh, 22% never returns |
| Never Returns Rate | Percentage of held zones that never retest within 20 trading days. When this happens, the trade is gone — no second chance. | NVDA 22%, VST 23% |
| Retest Hold Rate | When a held zone does come back, how often does it hold on the second touch? Degrades significantly from first touch — the structural support (shorts covering, accumulation) is spent. | First touch 94%, retest 66% (NVDA) |
| Signal Density | Ratio of ESSENTIAL content to total prompt tokens | Interrogation measures this; target: minimize NOISE and PASS-THROUGH |
| Prompt Interrogation | Eval process where an LLM classifies its own inputs as ESSENTIAL/USEFUL/PASS-THROUGH/NOISE | See INTERROGATION.md and scripts/interrogate/ |
Key Principle: When prompt strategy changes significantly, old predictions were made under different logic. Their accuracy patterns don’t reflect the new strategy. The regime system prevents this contamination without losing the data (old predictions are preserved, just filtered out).
Trading Philosophy Concepts
Ghost’s trading style has a specific philosophy that informs how analysis becomes action.
| Concept | Definition | Example |
|---|---|---|
| Prescient | Identifying setups BEFORE they trigger, then waiting for price | Zones defined at 6am; at 2pm price reaches zone, you execute |
| Long-only | Only buy dips; profit from shorts covering | We don’t short; we buy fear and sell to panicked shorts |
| Human-in-the-loop | Ghost provides analysis; human makes final call | Ghost says “BUY_NOW”; you verify and decide |
| Dip Buyer | Wait for price to come to zones; never chase | Setup at $165; price at $172 = WAIT, not “close enough” |
| Day Desk Synthesis | Agent reads KB report + overlays live data + enrichment | Trader asks “what’s actionable?”; agent reads KB zones, checks should_reevaluate(), gives entry/target/stop. Zero LLM cost. See DAY_DESK_REFERENCE.md. |
Key Principle: Prescient trading means the work happens BEFORE the trade. Analysis at 6am defines zones; execution at 2pm is mechanical (price hit zone = evaluate entry). Chasing is the opposite of prescient.
Entry Style Concepts
Every dip presents two valid entry framings. Ghost surfaces both; the trader decides which game to play.
| Concept | Definition | Example |
|---|---|---|
| Retest Entry | Buy the orderly pullback to support | Price pulls back to $167, buy the zone |
| Sweep Entry | Wait for support to break, buy the flush | $167 breaks, buy panic at $164 |
| Bridge Entry | Buy at put wall between Fib zones when gamma is positive — mechanical support catches the sweep | Primary breaks, put wall at $155 catches sweep, buy the dealer floor |
| Trigger Level | The support that will break (retest zone becomes trigger) | $167.91 — if this breaks, sweep activates |
| Flush Zone | Where panicked longs liquidate | VWAP, POC, next support below trigger |
Entry Style Characteristics:
| Aspect | Retest | Sweep | Bridge |
|---|---|---|---|
| Entry Zone | Primary support zone | Below broken support (VWAP/POC) | Put wall between Fib zones |
| Stop | Just below entry zone | Below flush zone | Bottom of next zone below |
| Target | Next resistance / max pain | Back to broken level | Back to broken upper zone |
| R:R | Wider stop, further target | Tighter risk, closer target | Depends on wall-to-zone distances |
| Risk | Support may not hold | Flush may not happen | Put wall fails (gamma flips, OI overwhelmed) |
| Psychology | Buy structure | Buy panic | Buy dealer mechanics |
Key Principle: All three are valid. Ghost presents each with their respective levels and R:R. The trader decides based on tape read and risk tolerance.
RETEST: Entry $167.91-$169.96 | Stop $167.00 | Target $175.50 | R:R 3.4
SWEEP: If $167.91 breaks → Entry $164.73-$166.61 | Stop $164.00 | Target $167.91 | R:R 1.3
BRIDGE: If $158.42 breaks → Put wall catch $155.00 (12,500 OI, γ+) | Target $158.42 | R:R 1.7
Execution Mode Concepts
Ghost supports two execution modes that apply to every setup. The same price level can be a scalp entry, a swing entry, or both.
| Concept | Definition | Example |
|---|---|---|
| Scalp | Short-duration trade targeting mean reversion | Buy overdone dip at $642, sell at VWAP $650 |
| Swing | Multi-day trade targeting structural levels | Buy golden ratio at $616, hold for $674 |
| Overdone Dip | Intraday move that’s mechanically exhausted | Dealer unwind into Friday close |
| Mean Reversion Target | Where price snaps back to after overdone move | VWAP, POC, prior session VWAP |
| Structural Target | Where price travels in a sustained move | Fib extensions, prior highs |
Mode Characteristics:
| Aspect | Scalp | Swing |
|---|---|---|
| Timeframe | Minutes to hours | Days to weeks |
| Stop Logic | Below OR low, air pocket, absorption | Below structural level (golden ratio) |
| Target Logic | VWAP, POC, mean reversion | Fib extensions, prior structure |
| R:R Threshold | >1.0 acceptable | >1.5 preferred |
| Trigger | Overdone intraday move | Price at structural confluence |
| Thesis Required | No (mechanical setup) | Yes (conviction to hold through noise) |
Mode Relationship:
SCALP profits fund SWING conviction
Example path:
1. Scalp $642 → $650 (bank $8)
2. Scalp $635 → $645 (bank $10)
3. Price reaches $616 (structural level)
4. Swing entry with size (funded by scalp profits, clear head)
Key Principle: A name can have a scalp setup, a swing setup, both, or neither. Ghost should surface all applicable modes.
| Situation | What Ghost Shows |
|---|---|
| Overdone dip, not at structure | SCALP only — mean reversion trade |
| At structure, not overdone | SWING only — wait for level test |
| Overdone dip INTO structure | BOTH — scalp now, swing if continues |
| Neither overdone nor at structure | WAIT — no setup |
Documentation Boundary:
OPTIONS_HERMENEUTICS.md— Day-of-week interpretation. How to read the same data differently on Monday vs Friday. Dealer mode, tactical vs structural flip, weekly cycle mechanics.MARKET_STRUCTURE_HERMENEUTICS.md— Overall positioning synthesis. How to combine options data with short interest, flow, and institutional positioning into a unified structural thesis. The MS Director outputsflow_synthesis(merged flow + sweep with conflict detection) and uses a 3-read chain of thought (flow, walls/gamma, max pain).
Weekly Expiration Cycle
Options mechanics vary by day of week:
Monday Tuesday Wednesday Thursday Friday
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
BUILD ──► ADJUST ────► ADJUST ───► PREPARE ─► UNWIND
│ │ │ │ │
New OI Positions Positions Pre-pin Hedges
forming adjust mature activity close
| Day | Dealer Mode | Max Pain Weight | Tactical Flip |
|---|---|---|---|
| Monday | BUILDING | LOW | N/A |
| Tue-Wed | ADJUSTING | LOW-MEDIUM | N/A |
| Thursday | PREPARING | MEDIUM-HIGH | PREVIEW |
| Friday | UNWINDING | HIGH | CRITICAL |
Key Principle: The same data means different things depending on where you are in the weekly cycle. Friday’s 0DTE structure dies at close; Monday starts fresh.
Deep Dive: See OPTIONS_HERMENEUTICS.md for complete day-by-day interpretation rules, including:
- How dealer mode interacts with tactical vs structural gamma flip
- Session breakdown for Friday expiration (9:30am → 3:30pm unwind)
- When to weight max pain vs technicals by day of week
Agent Responsibilities
| Agent | Reads | Outputs | Key Concepts |
|---|---|---|---|
| Fib | Structural memory | Confluence zones, golden ratios | Epoch, retracement, extension |
| MA | Trend memory | Regime, dynamic S/R, extension | Stack, cluster, slope |
| VWAP | Positioning memory | Trapped/defending, session regime | AVWAP, cohort, accumulation |
| Momentum | Timing signals | Divergence, extremes, confluence | RSI, MACD, squeeze |
| Director | All of above | Synthesized trade plan | Confluence, conviction |
Two-Layer Architecture: Morning Analysts + Day Desk
Ghost operates as two layers with distinct roles:
Layer 1: Gemini Agents (Morning Analysts)
The multi-agent ensemble (Fib, MA, VWAP, Momentum, Directors, Strategist) runs as a batch analysis — typically once in the morning via ghost run or the 7 AM scheduled run. These agents:
- Produce deep thesis-level analysis (narrative, interpretation, conflict resolution)
- Write structured outputs to the Knowledge Base (Firestore)
- Cost 12 LLM calls per run (5 Fib + MA + VWAP + Momentum + Sector Alignment + Technical Director + News Analyst + Strategist)
- Are the 20% that requires interpretive reasoning
Layer 2: Claude Code Agent (Day Desk)
The Claude Code agent is the trader’s primary interface throughout the day. It:
- Reads KB entries directly (everything the Gemini agents produced)
- Calls deterministic tool functions ad hoc for live data (
get_williams_r(),get_options_levels(),bayesian_hold_rate(), etc.) - Reasons across tickers, incorporates position context, answers follow-ups
- Costs zero LLM calls on Ghost’s Gemini quota (uses Claude’s own context)
The Interaction Model
7 AM: ghost run NVDA → Gemini agents analyze → KB updated
ghost run VST → Gemini agents analyze → KB updated
↓
Day: Trader asks Claude Code → Reads KB + calls tools ad hoc
"What's actionable?" → Reads all KB entries, reasons
"Where's the zone?" → Calls get_options_levels(), math
"Did gamma flip?" → Calls analyze_oi_gamma()
"Price at $175, am I in?" → Math: $175 vs zones
"Things changed, rerun" → ghost run NVDA (only when needed)
Signal Classification
80% of Ghost’s signals are deterministic — computed by tool functions with zero LLM cost. 20% are interpretive — require Gemini agent reasoning. See docs/SIGNAL_AUDIT.md for the full mapping.
| Type | Examples | Cost | When computed |
|---|---|---|---|
| Deterministic | RSI, MACD, MA stack, %R, VIX regime, gamma, max pain, surprisal, zone status | Zero LLM | Any time (ad hoc tool calls) |
| Interpretive | ”Which epochs matter?”, “Who’s trapped?”, “What’s the dominant narrative?”, entry/exit synthesis | Gemini LLM call | Morning run (or on-demand rerun) |
ghost mechanical TICKER
A zero-LLM-cost quantitative snapshot calling all deterministic tool functions. Returns structured data (zones, MA regime, momentum, options, flow, environment, ticker_hurst, enrichment) that Claude Code reads for instant triage. See docs/SIGNAL_AUDIT.md for the output schema.
Canonical Price Source
get_current_price(ticker) in ghost/tools/market_data.py is THE price function for all code paths. Uses 1-minute intraday history (reliable across all sessions including pre-market and after-hours). NEVER use fast_info.last_price, fast_info.previous_close, or stock.info["currentPrice"] — they return stale (prior close) data. This rule was earned through 3 incidents of bad analysis from stale prices. All internal price helpers (mechanical.py, full_stack.py, trigger.py) delegate to it.
When to Rerun the Full Stack
The full Gemini stack (ghost run) should only rerun when the thesis has changed — detected by has_thesis_changed() in the event detection layer, or when the trader explicitly asks. Signals that warrant a rerun:
- Zone boundary crossing (price entered/exited a zone)
- Gamma environment flip (positive → negative)
- VIX regime change (NORMAL → ELEVATED)
- Williams %R regime shift
- Breaking news with high surprisal (>0.5 nats)
Signals that do NOT warrant a rerun:
- Small price moves within the same zone
- Time passing (stale data ≠ changed thesis)
- Curiosity (“let’s see what it says”) — use
ghost mechanicalinstead
Anti-Concepts (What Things Are NOT)
Levels Are Not:
- Exact prices: They’re zones with a tolerance (±0.5-1%)
- Guaranteed: They’re probabilities, not certainties
- Permanent: They decay with time and tests
Confluence Is Not:
- Just multiple lines: Sources must be independent
- Always strong: Quality of sources matters
- Binary: Strength is a gradient
Signals Are Not:
- Commands: They inform decisions, not make them
- Timers: They indicate condition, not exact timing
- Isolated: Context determines meaning
Trends Are Not:
- Permanent: All trends eventually end
- Linear: Trends have pullbacks and consolidations
- Binary: Trends can be strong, weak, or transitioning
Related Documentation
Foundational
EPISTEMOLOGY.md— How Ghost forms and validates knowledgeETHICS.md— What Ghost must and must not doPEDAGOGICAL.md— How to learn this system
Per-Agent
FIB_METHODOLOGY.md— How to identify Fib structureFIB_HERMENEUTICS.md— How to interpret Fib structureMA_METHODOLOGY.md— How to identify MA structureMA_HERMENEUTICS.md— How to interpret MA structureVWAP_METHODOLOGY.md— How to identify VWAP positioningVWAP_HERMENEUTICS.md— How to interpret VWAP positioningMOMENTUM_HERMENEUTICS.md— How to interpret momentum timing signalsMARKET_STRUCTURE_METHODOLOGY.md— How to identify market positioning dataMARKET_STRUCTURE_HERMENEUTICS.md— How to interpret positioning overallOPTIONS_HERMENEUTICS.md— How to interpret options by day of week
Operational
SIGNAL_AUDIT.md— Which signals are deterministic (80%) vs LLM-interpretive (20%). Tool function inventory.ghost mechanicaloutput schema. The reference for what Claude Code can call ad hoc.CONDITION_ACCURACY.md— Feedback loop mechanics (Bayesian posteriors, hierarchical shrinkage)
Practice
PRAXIS.md— Where analysis meets actionDAY_DESK_REFERENCE.md— Day desk tool catalog, when to rerunINDEX_CONFLUENCE_PROPOSAL.md— Index/sector confluence subsystem