{
  "purpose": "Permanent strategy-package authoring reference for the single-feature Kalshi-only engine.",
  "features": {
    "strategy_runner": "Loads one selected declarative strategy package and runs Until Stopped or 15-480 minutes.",
    "manual_trading": "Persistent-dollar one-click YES/NO buys, one-click full-position sells, optional executable-bid stop loss, P/L rows, and editable trade cards.",
    "live_market_review": "Five-minute ZIP capture of Kalshi-only 15-minute market and account data.",
    "program_report": "Downloads as a compact ZIP. Repeated scan decisions are aggregated and sampled; transient scan and HTTP records rotate only after successful download while permanent trade/audit history remains.",
    "trade_only_report": "Small ZIP containing orders, positions, fees, P/L, post-sale outcomes, paper tests, manual trades and notes, deadman records, balances, and trade-related errors without broad market conditions.",
    "rolling_hour_replay": "A bounded ZIP containing synchronized one-hour market data, qualified trades not taken, and reverse-paper results for first price-touch entries.",
    "master_market_store": "One disk-backed, one-hour source used for research and replay. Expired raw rows are deleted automatically.",
    "perpetual_mini_bot": "Paper-validation only until Kalshi publishes a stable supported margin-order API. Uses the isolated perpetual research feed and cannot submit live orders.",
    "strategy_slots": "Up to five validated folders can be attached. Exactly one is selected and only the selected package is evaluated.",
    "ai_assistant": "Offline-by-default OpenAI or Anthropic assistant for bounded analysis, scheduled reviews and human-approved strategy/data proposals. It has no order-placement authority and cannot start or resume live trading.",
    "telegram_control": "Allowlisted phone chat for status, AI analysis, pause and proposal approval/rejection. Resume, live-mode activation, accounts, budgets, protected balances and credentials remain dashboard-only."
  },
  "engine_version": "4.6.2",
  "architecture": {
    "automated_feature": "strategy_runner",
    "installed_strategy_slots": 5,
    "simultaneously_selected_packages": 1,
    "data_sources": [
      "Kalshi public market WebSocket",
      "Kalshi private account WebSocket",
      "Kalshi CF Benchmarks reference stream",
      "Kalshi event live-data reference endpoint",
      "optional Kraken/Coinbase secondary confirmation"
    ],
    "research_only_sources": [
      "Kalshi perpetual margin REST collector; connected only to the paper-validation Perpetual Mini Bot"
    ]
  },
  "operator_settings": {
    "mode": [
      "paper",
      "live"
    ],
    "strategy_budget": "Positive USD amount; total open Strategy Runner exposure, including fees.",
    "strategy_runtime_minutes": "0 means Until Stopped; otherwise 15-480 in 15-minute steps.",
    "protected_minimum_balance": "Per-account floor checked against actual planned cost.",
    "manual_market_buy_amount": "Persistent positive USD amount stored independently for each supported market family.",
    "manual_market_profit_pct": "0 disables; otherwise 5-100% in 5% steps. A sell qualifies only after entry fees, estimated exit fees, and at least $0.02 net profit.",
    "manual_stop_enabled": "Off by default; confirmation is required when enabling.",
    "manual_stop_cents": "1-99; triggers from the executable bid.",
    "manual_waiting_buy": "Operator may arm a YES/NO buy within three cents of the current ask. It remains manual, uses the market-specific amount, and expires when the 15-minute market closes.",
    "manual_buyback": "A sold Strategy Runner lot may be repurchased only in its original 15-minute window, on its original side, capped by its original quantity and original dollar exposure. It is excluded from strategy P/L and held until settlement unless manually sold.",
    "manual_reinforcement": "Operator may add up to $1 to an open bot position. The added lot is manual, separately reported, excluded from strategy P/L, and never managed by strategy exit rules.",
    "secondary_reference_switches": "Kalshi CF Benchmarks, Kraken and Coinbase may be toggled independently. External feeds are strategy-optional and retained for at most 30 minutes.",
    "perpetual_research_enabled": "Research collector feeding the isolated paper-validation Perpetual Mini Bot; live perpetual orders are disabled.",
    "perpetual_bot_budget": "Separate $0.01-$100 paper-validation budget; it does not alter the Strategy Runner budget.",
    "rolling_hour_replay": "One synchronized rolling hour of targeted market/reference observations, automatically pruned and downloadable for reverse-paper analysis.",
    "recovery_mode": "Independent 15-minute recovery lane for Account A. It never forces a trade, holds at most two positions, and spends at most $1 per position.",
    "recovery_floor": "Operator-controlled floor used only by Recovery Mode. The AI cannot change it.",
    "recovery_target_balance": "Recovery Mode stops opening entries when Account A reaches this balance."
  },
  "strategy_manifest": {
    "required": [
      "name",
      "version",
      "rules_schema",
      "features",
      "strategies"
    ],
    "features": [
      "strategy_runner"
    ],
    "rules_schema": "1.0",
    "maximum_strategies_inside_one_package": 5,
    "strategy_fields": [
      "id",
      "allowed_sides",
      "account_assignment",
      "eligible_market_patterns",
      "config",
      "entry_rules",
      "exit_rules",
      "emergency_rules"
    ],
    "config_fields": [
      "budget_allocation_pct",
      "max_positions",
      "target_gain_cents",
      "take_profit_cents",
      "maximum_loss_cents",
      "stop_loss_cents",
      "max_hold_seconds",
      "hold_to_settlement",
      "catastrophic_stop_cents",
      "catastrophic_stop_activation_cents",
      "score_bonus",
      "allowed_assets",
      "excluded_assets",
      "allowed_categories",
      "eligible_market_patterns",
      "excluded_market_patterns",
      "market_priority",
      "maximum_positions_per_asset",
      "maximum_trades_per_session",
      "maximum_trades_per_market",
      "force_trade_when_qualified",
      "allow_reentry_after_loss",
      "reentry_after_loss_seconds",
      "reentry_after_win_seconds",
      "allow_position_reinforcement",
      "maximum_reinforcements",
      "reinforcement_cooldown_seconds",
      "disable_after_total_losses",
      "disable_after_consecutive_losses",
      "disable_after_strategy_loss_usd",
      "failure_pnl_threshold"
    ],
    "rule_types": [
      "compare",
      "multipoint",
      "all",
      "any",
      "count",
      "score",
      "not"
    ],
    "comparison_operators": [
      "eq",
      "ne",
      "gt",
      "gte",
      "lt",
      "lte",
      "between",
      "outside",
      "in"
    ],
    "multipoint_streams": [
      "kalshi_side",
      "kalshi_opposite",
      "kalshi_reference",
      "target_distance",
      "side_target_margin"
    ],
    "multipoint_patterns": [
      "rising",
      "falling",
      "stable"
    ]
  },
  "supported_signals": [
    "market.ticker",
    "market.asset",
    "market.category",
    "kalshi.side_bid",
    "kalshi.side_ask",
    "kalshi.opposite_bid",
    "kalshi.opposite_ask",
    "kalshi.spread",
    "kalshi.quote_age",
    "market.seconds_remaining",
    "market.seconds_elapsed",
    "market.phase",
    "execution.estimated_slippage",
    "account.available_balance",
    "account.protected_floor",
    "position.requested_spend",
    "position.open_risk",
    "position.realized_pnl",
    "position.unrealized_pnl",
    "position.entry_fill",
    "position.highest_bid",
    "position.drawdown_from_high",
    "position.seconds_open",
    "feed.kalshi_connected",
    "risk.planned_loss",
    "session.selected_budget",
    "session.positions_on_account",
    "market.target_price",
    "market.target_lower",
    "market.target_upper",
    "market.target_direction",
    "market.reference_price",
    "market.distance_from_target",
    "market.distance_from_target_pct",
    "market.distance_velocity",
    "market.moving_away_from_target",
    "market.moving_toward_target",
    "market.side_target_margin",
    "market.reference_supports_side",
    "market.reference_velocity_per_second",
    "market.reference_favorable_velocity",
    "market.distance_to_recent_range_ratio",
    "market.contract_reference_contradiction",
    "market.safety_score",
    "market.contract_implied_percent",
    "market.reference_source",
    "market.reference_type",
    "market.reference_age",
    "market.reference_fresh",
    "kalshi.displayed_chance_percent",
    "kalshi.last_trade",
    "kalshi.midpoint",
    "kalshi.bid_size",
    "kalshi.ask_size",
    "kalshi.microprice",
    "kalshi.price_pressure",
    "orderbook.bid_quantity",
    "orderbook.ask_quantity",
    "orderbook.imbalance",
    "orderbook.depth_for_spend",
    "orderbook.spread_cents",
    "orderbook.liquidity_sufficient",
    "external.sources_available",
    "external.median_price",
    "external.disagreement_percent",
    "external.direction_agreement",
    "external.kraken_price",
    "external.kraken_age",
    "external.coinbase_price",
    "external.coinbase_age",
    "external.confirmation_score",
    "session.realized_pnl",
    "session.unrealized_pnl",
    "session.strategy_attempts",
    "session.strategy_losses",
    "session.strategy_consecutive_losses",
    "session.strategy_realized_pnl",
    "cross.BTC.previous_settlement",
    "cross.BTC.previous_yes_rate_4",
    "cross.BTC.previous_yes_rate_12",
    "cross.BTC.samples_4",
    "cross.BTC.samples_12",
    "cross.BTC.settlement_streak",
    "cross.ETH.previous_settlement",
    "cross.ETH.previous_yes_rate_4",
    "cross.ETH.previous_yes_rate_12",
    "cross.ETH.samples_4",
    "cross.ETH.samples_12",
    "cross.ETH.settlement_streak",
    "cross.DOGE.previous_settlement",
    "cross.DOGE.previous_yes_rate_4",
    "cross.DOGE.previous_yes_rate_12",
    "cross.DOGE.samples_4",
    "cross.DOGE.samples_12",
    "cross.DOGE.settlement_streak",
    "cross.XRP.previous_settlement",
    "cross.XRP.previous_yes_rate_4",
    "cross.XRP.previous_yes_rate_12",
    "cross.XRP.samples_4",
    "cross.XRP.samples_12",
    "cross.XRP.settlement_streak",
    "cross.SOL.previous_settlement",
    "cross.SOL.previous_yes_rate_4",
    "cross.SOL.previous_yes_rate_12",
    "cross.SOL.samples_4",
    "cross.SOL.samples_12",
    "cross.SOL.settlement_streak",
    "cross.HYPE.previous_settlement",
    "cross.HYPE.previous_yes_rate_4",
    "cross.HYPE.previous_yes_rate_12",
    "cross.HYPE.samples_4",
    "cross.HYPE.samples_12",
    "cross.HYPE.settlement_streak",
    "cross.BNB.previous_settlement",
    "cross.BNB.previous_yes_rate_4",
    "cross.BNB.previous_yes_rate_12",
    "cross.BNB.samples_4",
    "cross.BNB.samples_12",
    "cross.BNB.settlement_streak",
    "cross.GOLD.previous_settlement",
    "cross.GOLD.previous_yes_rate_4",
    "cross.GOLD.previous_yes_rate_12",
    "cross.GOLD.samples_4",
    "cross.GOLD.samples_12",
    "cross.GOLD.settlement_streak",
    "cross.SILVER.previous_settlement",
    "cross.SILVER.previous_yes_rate_4",
    "cross.SILVER.previous_yes_rate_12",
    "cross.SILVER.samples_4",
    "cross.SILVER.samples_12",
    "cross.SILVER.settlement_streak",
    "cross.OIL.previous_settlement",
    "cross.OIL.previous_yes_rate_4",
    "cross.OIL.previous_yes_rate_12",
    "cross.OIL.samples_4",
    "cross.OIL.samples_12",
    "cross.OIL.settlement_streak",
    "levels.15m.support",
    "levels.15m.resistance",
    "levels.15m.distance_above_support",
    "levels.15m.distance_below_resistance",
    "levels.15m.support_touches",
    "levels.15m.resistance_touches",
    "levels.15m.samples",
    "levels.15m.coverage_seconds",
    "levels.30m.support",
    "levels.30m.resistance",
    "levels.30m.distance_above_support",
    "levels.30m.distance_below_resistance",
    "levels.30m.support_touches",
    "levels.30m.resistance_touches",
    "levels.30m.samples",
    "levels.30m.coverage_seconds",
    "levels.1h.support",
    "levels.1h.resistance",
    "levels.1h.distance_above_support",
    "levels.1h.distance_below_resistance",
    "levels.1h.support_touches",
    "levels.1h.resistance_touches",
    "levels.1h.samples",
    "levels.1h.coverage_seconds",
    "levels.daily.support",
    "levels.daily.resistance",
    "levels.daily.distance_above_support",
    "levels.daily.distance_below_resistance",
    "levels.daily.support_touches",
    "levels.daily.resistance_touches",
    "levels.daily.samples",
    "levels.daily.coverage_seconds"
  ],
  "non_bypassable_execution_safety": [
    "Recalculate whole-contract quantity from the selected side's executable ask.",
    "Translate and verify the actual reported fill on the requested YES/NO side.",
    "Reject a fill price above the submitted buy limit.",
    "Reject total open exposure above the selected strategy budget.",
    "Include pending orders and fees in exposure checks.",
    "Block orders that cross the protected account balance.",
    "Block an unattributed or opposite-side same-market position.",
    "Use unique client order identifiers and immediate-or-cancel orders.",
    "Record partial fills and fail closed when an exit is incomplete.",
    "Treat order-book age, depth, spread, imbalance and liquidity as optional strategy signals, never mandatory engine entry gates.",
    "Re-evaluate unchanged strategy entry rules against the final executable ask before submission.",
    "Cool down an unfilled market-side candidate for 15 seconds before another IOC attempt.",
    "Block every new entry immediately when a deadman pause or runner stop is active.",
    "After a losing/stop exit, block re-entry into that exact expiring ticker; after a win, enforce a 120-second cooldown.",
    "A fixed stop at or above the actual entry fill is not armed.",
    "After three consecutive same-side entries, prefer a qualified opposite-side candidate only when its score is within five points of the best candidate.",
    "Deadman activation requires a recorded operator sell plus three reconciliations confirming that actual quantity fell below bot-owned quantity while the market is still open. Settlement, bot orders, manual additions, and unrelated manual positions never activate it.",
    "An incomplete bot exit enters EXIT RETRY, blocks new entries, and is retried; it is not an operator deadman event.",
    "Reject malformed or crossed executable quotes; ordinary spread, liquidity, order-book size, score, reference freshness and timing thresholds belong to the selected strategy."
  ],
  "runtime_completion": "At expiration, new entries stop. Existing positions remain managed by their selected strategy rules until closed or settled.",
  "session_controls": {
    "reset": "Every Strategy Runner start creates a new session and clears all prior session-only strategy lockouts.",
    "pnl": "Session realized P/L is based on completed after-fee lots; open unrealized P/L is displayed separately.",
    "strategy_lockout": "A strategy may disable itself for the remainder of the current runner session after declared total losses, consecutive losses, or strategy drawdown. Other strategies continue.",
    "forced_trade": "force_trade_when_qualified gives first priority only after declared entry rules pass; it never bypasses hard safety checks.",
    "reentry_and_reinforcement": "Both are off unless explicitly enabled. Every added lot is separately recorded and total exposure remains inside the selected budget."
  },
  "market_selection": {
    "assets": [
      "BTC",
      "ETH",
      "DOGE",
      "XRP",
      "SOL",
      "HYPE",
      "BNB",
      "GOLD",
      "SILVER",
      "OIL"
    ],
    "controls": [
      "allow/exclude asset",
      "allow category",
      "ticker pattern",
      "priority bonus",
      "per-asset position cap"
    ],
    "default": "Existing strategies are unchanged. New selection controls apply only when present in their config."
  },
  "market_probability_and_liquidity": {
    "displayed_chance": "Last traded side price when available; otherwise bid/ask midpoint, then executable ask. This is market-implied probability, not a guarantee.",
    "execution_prices": "Executable bid and ask remain separate from displayed chance.",
    "orderbook": "Top size, imbalance, microprice, spread and spend-depth are reconstructed from Kalshi bid books and reciprocal YES/NO pricing.",
    "strategy_use": "Chance is one signal among target distance, reference direction, time, spread, liquidity and volatility."
  },
  "support_and_resistance": {
    "enforcement": "Informational only. These levels never permit, reject or close a trade unless the selected strategy explicitly references them.",
    "windows": [
      "15m",
      "30m",
      "1h",
      "daily"
    ],
    "method": "Rolling Kalshi-native reference low is support and rolling high is resistance. Touch counts, sample count and observed coverage are also supplied.",
    "warmup": "A level is usable immediately but strategies should inspect samples and coverage_seconds before relying on longer windows. History rebuilds after an engine restart."
  },
  "five_minute_system_test": {
    "duration": "Hard maximum 300 seconds, including any live canary attempt and exit.",
    "paper_default": "Exercises the selected package's primary strategy with simulated orders.",
    "optional_live_canary": "Requires exact confirmation, uses at most $1 total planned cost, never bypasses protected balance or selected-strategy qualification.",
    "report": "Produces copyable plain text containing checks, inspected/rejected/qualified counts, rejection causes, order/fill/exit results, and an explicit reason if no live order succeeds."
  },
  "update_and_backup": {
    "strategy_zip": "The dashboard validates, extracts and attaches a strategy ZIP to the selected slot; it never starts trading.",
    "engine_zip": "Only checksum-listed application, web, report and documentation files are accepted. Data, settings and credentials cannot be overwritten. Installation requires no runner and no open position, creates a rollback ZIP and restarts.",
    "credential_vault": "Kalshi API identifiers and private-key contents may be exported only in an AES-GCM encrypted vault protected by an operator-supplied passphrase. They remain excluded from AI context, reports and logs.",
    "application_password": "No application password or login requirement is introduced; external cloud access protection remains the operator's responsibility."
  },
  "manual_execution": {
    "one_click_buy": "Immediate-or-cancel at the current executable ask after whole-contract and protected-balance checks.",
    "one_click_sell": "Up to five immediate reduce-only IOC attempts, 50ms apart, with no more than three cents of price chase from the initiating bid.",
    "profit_accounting": "Estimated profit deducts recorded entry fees, recorded partial-exit fees, and a conservative estimated selling fee. Net gains below $0.02 display as break-even; actual closed P/L always uses actual reported fees.",
    "automatic_profit": "Checks every 250ms. It requires the greater of the selected percentage gain or $0.02 net after estimated fees, rechecks the executable bid and estimated fee before every IOC attempt, and never chases below the qualifying bid.",
    "partial_fill": "The exact unfilled remainder stays visible and may be sold again; every attempt is recorded.",
    "fill_limit": "Immediate execution cannot be guaranteed when the order book lacks sufficient opposing quantity."
  },
  "automated_strategy_profit_accounting": {
    "unrealized_signal": "position.unrealized_pnl deducts recorded entry fees and a conservative estimated selling fee.",
    "normal_profit_target": "A take_profit_cents or target_gain_cents exit must also project at least $0.02 net profit after estimated fees.",
    "safety_exit_exception": "Emergency, stop-loss, explicit exit-rule, time, and settlement actions are not blocked by the profit buffer."
  },
  "cross_market_settlement_history": {
    "collection": "Every discovered eligible 15-minute market is stored by settlement window whether or not it was traded.",
    "report_only_default": "Cross-market relationships are observational and do not affect trading unless a selected strategy explicitly references them.",
    "strategy_signals_per_asset": [
      "previous_settlement",
      "previous_yes_rate_4",
      "previous_yes_rate_12",
      "samples_4",
      "samples_12",
      "settlement_streak"
    ],
    "assets": [
      "BTC",
      "ETH",
      "DOGE",
      "XRP",
      "SOL",
      "HYPE",
      "BNB",
      "GOLD",
      "SILVER",
      "OIL"
    ],
    "example": "cross.BTC.previous_settlement eq 'no' can be combined with cross.GOLD.previous_settlement and an Oil entry rule.",
    "anti_overfitting": "Do not promote observed relationships into live rules until an adequate out-of-sample count exists; the report recommends at least 100 paired windows."
  }
}