[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X8PAFJWH46MVABCGRKDZRW":3,"skill-same:01M6X8PAFJWH46MVABCGRKDZRW":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6X8PAFJWH46MVABCGRKDZRW","max-concurrent-positions",null,"Use before opening any new position to determine whether adding it would violate concurrent position limits. Enforces per-strategy, per-direction, per-correlation-cluster, and total portfolio limits. Integrates kill-switch tier state and regime conditions to dynamically tighten caps. Always consult this skill after kelly-position-sizing-perps and before slippage-budget-enforcement.","enuno\u002Fcrewless-capital","enuno","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6727752?v=4","01M6J09HF6Y74150F7PEMC446X","Elvis Nuno","01M6X86WGZG9RH09ACTSTJ2383",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fmulticlaw\u002Fmetaclaw\u002Fskills\u002Frisk\u002Fmax-concurrent-positions\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"max concurrent positions","positions","max","kill","limits","direction","cluster","tighten","perps","switch","agentic","enforcement","portfolio","use","strategy","consult","kill-switch","Budget","correlation","state","2026-11-10 10:12:30",false,"---\nname: max-concurrent-positions\ndescription: Use before opening any new position to determine whether adding it would violate concurrent position limits. Enforces per-strategy, per-direction, per-correlation-cluster, and total portfolio limits. Integrates kill-switch tier state and regime conditions to dynamically tighten caps. Always consult this skill after kelly-position-sizing-perps and before slippage-budget-enforcement.\ncategory: agentic\n---\n\n# Max Concurrent Positions\n\n## When This Skill Activates\n\nApply this skill:\n\n- Immediately after `kelly-position-sizing-perps` produces a sized\n  notional — before any order is submitted\n- When evaluating whether a second leg or scale-in is permitted on an\n  existing position\n- At session open to audit the inherited position count and confirm\n  caps are not already breached from a prior session\n- After any kill-switch tier change — tier changes dynamically tighten\n  all caps and may require immediate position reduction\n- When a new strategy is added to the active strategy set — check\n  whether combined capacity of all strategies fits within portfolio caps\n- During regime transitions — trending → ranging or low → high cascade\n  score changes the effective caps\n\n---\n\n## Cap Hierarchy\n\nConcurrent position limits are enforced at **five nested levels**.\nA new position must clear **all five** before entry is permitted.\nThe binding cap is the one that produces the smallest allowed count\nat the moment of evaluation.\n\n```\nLevel 1: Total portfolio positions          (global ceiling)\nLevel 2: Per-direction (long \u002F short)       (directional concentration)\nLevel 3: Per-correlation-cluster            (correlated exposure grouping)\nLevel 4: Per-strategy                       (single strategy capacity)\nLevel 5: Per-asset                          (repeat position guard)\n```\n\n---\n\n## Default Cap Table\n\nCaps are defined in `kill_switch_config.yaml` and dynamically\noverridden by kill-switch tier and regime state.\n\n| Cap Level | Normal | Tier 1 Post | Tier 2 Post | Tier 3 Recovery | Tier 4 |\n|---|---|---|---|---|---|\n| Total portfolio | 6 | 4 | 3 | 1 | 0 |\n| Per-direction (long or short) | 4 | 3 | 2 | 1 | 0 |\n| Per-correlation-cluster | 2 | 2 | 1 | 1 | 0 |\n| Per-strategy | 3 | 2 | 2 | 1 | 0 |\n| Per-asset | 1 | 1 | 1 | 1 | 0 |\n\n> **Tier 4 is always 0** — no positions of any kind while an emergency\n> shutdown is active. This cap is enforced independently by\n> `drawdown-kill-switch-trigger`; this skill cross-checks it.\n\n---\n\n## Correlation Clusters\n\nAssets are grouped into correlation clusters based on empirically\nobserved co-movement. A position in any asset within a cluster counts\ntoward that cluster's cap. Clusters are not fixed — they are\nre-evaluated when the rolling 30-day correlation matrix changes\nsignificantly (threshold: correlation drift > 0.15 for a pair).\n\n### Default Cluster Definitions\n\n```python\nCORRELATION_CLUSTERS = {\n    \"btc_majors\": {\n        \"assets\": [\"BTC\", \"ETH\", \"SOL\", \"BNB\"],\n        \"min_correlation\": 0.70,   # observed 30d rolling\n        \"description\": \"Large-cap proof-of-work and L1 majors\",\n    },\n    \"eth_ecosystem\": {\n        \"assets\": [\"ETH\", \"OP\", \"ARB\", \"MATIC\", \"BASE\"],\n        \"min_correlation\": 0.75,\n        \"description\": \"Ethereum and L2 ecosystem tokens\",\n    },\n    \"defi_bluechip\": {\n        \"assets\": [\"AAVE\", \"UNI\", \"CRV\", \"SNX\", \"MKR\"],\n        \"min_correlation\": 0.65,\n        \"description\": \"DeFi protocol governance tokens\",\n    },\n    \"high_beta_alt\": {\n        \"assets\": [\"DOGE\", \"SHIB\", \"PEPE\", \"WIF\", \"BONK\"],\n        \"min_correlation\": 0.60,\n        \"description\": \"High-beta meme and retail-driven tokens\",\n    },\n    \"perp_funding_plays\": {\n        \"assets\": [],   # populated dynamically from funding rate screening\n        \"min_correlation\": 0.50,\n        \"description\": \"Assets currently in elevated funding regime\",\n    },\n}\n\n# Note: an asset may appear in multiple clusters (e.g. ETH in both\n# btc_majors and eth_ecosystem). A new ETH position counts against\n# BOTH cluster caps simultaneously.\ndef get_clusters_for_asset(asset: str) -> list[str]:\n    return [\n        name for name, cluster in CORRELATION_CLUSTERS.items()\n        if asset in cluster[\"assets\"]\n    ]\n```\n\n---\n\n## Core Position Registry\n\n```python\nfrom dataclasses import dataclass, field\nfrom typing import Optional\nimport time\n\n@dataclass\nclass OpenPosition:\n    position_id: str          # unique identifier (uuid)\n    asset: str                # e.g. \"ETH\"\n    direction: str            # \"long\" or \"short\"\n    strategy_id: str          # which strategy opened this position\n    notional_usd: float       # current notional size\n    margin_usd: float         # current margin consumed\n    entry_timestamp_utc: float\n    unrealised_pnl_usd: float = 0.0\n    leverage: float = 1.0\n    clusters: list[str] = field(default_factory=list)  # populated on creation\n\n@dataclass\nclass PositionRegistry:\n    positions: dict[str, OpenPosition] = field(default_factory=dict)\n    # key: position_id\n\n    def count_total(self) -> int:\n        return len(self.positions)\n\n    def count_by_direction(self, direction: str) -> int:\n        return sum(1 for p in self.positions.values() if p.direction == direction)\n\n    def count_by_cluster(self, cluster: str) -> int:\n        return sum(1 for p in self.positions.values() if cluster in p.clusters)\n\n    def count_by_strategy(self, strategy_id: str) -> int:\n        return sum(1 for p in self.positions.values() if p.strategy_id == strategy_id)\n\n    def count_by_asset(self, asset: str) -> int:\n        return sum(1 for p in self.positions.values() if p.asset == asset)\n\n    def total_margin_usd(self) -> float:\n        return sum(p.margin_usd for p in self.positions.values())\n\n    def total_notional_usd(self) -> float:\n        return sum(p.notional_usd for p in self.positions.values())\n\n    def net_direction_notional(self) -> float:\n        \"\"\"Positive = net long, negative = net short.\"\"\"\n        longs  = sum(p.notional_usd for p in self.positions.values() if p.direction == \"long\")\n        shorts = sum(p.notional_usd for p in self.positions.values() if p.direction == \"short\")\n        return longs - shorts\n```\n\n---\n\n## Effective Cap Resolver\n\n```python\nfrom enum import Enum\n\nclass KillSwitchTier(Enum):\n    NONE   = 0\n    TIER_1 = 1\n    TIER_2 = 2\n    TIER_3 = 3\n    TIER_4 = 4\n\n# Base caps — override via kill_switch_config.yaml\nBASE_CAPS = {\n    \"total\":       6,\n    \"directional\": 4,\n    \"cluster\":     2,\n    \"strategy\":    3,\n    \"asset\":       1,\n}\n\n# Tier overrides — each tier tightens caps relative to base\nTIER_CAP_OVERRIDES = {\n    KillSwitchTier.NONE:   {\"total\": 6,  \"directional\": 4, \"cluster\": 2, \"strategy\": 3, \"asset\": 1},\n    KillSwitchTier.TIER_1: {\"total\": 4,  \"directional\": 3, \"cluster\": 2, \"strategy\": 2, \"asset\": 1},\n    KillSwitchTier.TIER_2: {\"total\": 3,  \"directional\": 2, \"cluster\": 1, \"strategy\": 2, \"asset\": 1},\n    KillSwitchTier.TIER_3: {\"total\": 1,  \"directional\": 1, \"cluster\": 1, \"strategy\": 1, \"asset\": 1},\n    KillSwitchTier.TIER_4: {\"total\": 0,  \"directional\": 0, \"cluster\": 0, \"strategy\": 0, \"asset\": 0},\n}\n\ndef resolve_effective_caps(\n    kill_switch_tier: KillSwitchTier,\n    cascade_score: int,          # 0-10 from liquidation-cascade-risk\n    funding_regime: str,         # \"NORMAL\" | \"ELEVATED\" | \"EXTREME\"\n    is_post_tier3_recovery: bool = False,\n) -> dict:\n    \"\"\"\n    Resolve effective position caps after applying all dynamic modifiers.\n    Returns a dict with keys: total, directional, cluster, strategy, asset.\n    The most restrictive (minimum) value at each level wins.\n    \"\"\"\n    caps = dict(TIER_CAP_OVERRIDES[kill_switch_tier])\n\n    # Cascade regime tightening\n    if cascade_score >= 8:\n        # CRITICAL: treat like Tier 3 regardless of kill-switch tier\n        caps = {k: min(caps[k], TIER_CAP_OVERRIDES[KillSwitchTier.TIER_3][k])\n                for k in caps}\n    elif cascade_score >= 5:\n        # HIGH: reduce total and cluster by 1\n        caps[\"total\"]   = max(0, caps[\"total\"]   - 1)\n        caps[\"cluster\"] = max(0, caps[\"cluster\"] - 1)\n\n    # Funding regime tightening\n    if funding_regime == \"EXTREME\":\n        caps[\"total\"]       = max(0, caps[\"total\"]       - 1)\n        caps[\"directional\"] = max(0, caps[\"directional\"] - 1)\n    elif funding_regime == \"ELEVATED\":\n        caps[\"total\"]       = max(0, caps[\"total\"]       - 1)\n\n    # Post-Tier-3 recovery protocol (first 5 sessions)\n    if is_post_tier3_recovery:\n        caps = {k: min(caps[k], TIER_CAP_OVERRIDES[KillSwitchTier.TIER_3][k])\n                for k in caps}\n\n    return caps\n```\n\n---\n\n## Admission Check\n\n```python\n@dataclass\nclass AdmissionResult:\n    admitted: bool\n    binding_cap_level: str      # \"total\" | \"directional\" | \"cluster\" | \"strategy\" | \"asset\" | \"none\"\n    binding_cap_value: int\n    current_count_at_binding: int\n    reason: str\n    effective_caps: dict\n    registry_snapshot: dict     # counts at time of check\n\ndef check_admission(\n    registry: PositionRegistry,\n    candidate_asset: str,\n    candidate_direction: str,\n    candidate_strategy_id: str,\n    kill_switch_tier: KillSwitchTier,\n    cascade_score: int,\n    funding_regime: str,\n    is_post_tier3_recovery: bool = False,\n) -> AdmissionResult:\n    \"\"\"\n    Check whether a new position may be opened.\n    Returns AdmissionResult with admitted=True or False and full reasoning.\n    \"\"\"\n    caps = resolve_effective_caps(\n        kill_switch_tier, cascade_score, funding_regime, is_post_tier3_recovery\n    )\n\n    candidate_clusters = get_clusters_for_asset(candidate_asset)\n\n    snapshot = {\n        \"total\":       registry.count_total(),\n        \"directional\": registry.count_by_direction(candidate_direction),\n        \"strategy\":    registry.count_by_strategy(candidate_strategy_id),\n        \"asset\":       registry.count_by_asset(candidate_asset),\n        \"clusters\":    {c: registry.count_by_cluster(c) for c in candidate_clusters},\n    }\n\n    # Check each cap level in priority order (most restrictive first)\n\n    # Level 5: per-asset (repeat position guard)\n    if snapshot[\"asset\"] >= caps[\"asset\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"asset\",\n            binding_cap_value=caps[\"asset\"],\n            current_count_at_binding=snapshot[\"asset\"],\n            reason=f\"Asset cap reached: {snapshot['asset']}\u002F{caps['asset']} \"\n                   f\"positions already open on {candidate_asset}. \"\n                   f\"Close existing {candidate_asset} position before opening a new one.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 1: total portfolio\n    if snapshot[\"total\"] >= caps[\"total\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"total\",\n            binding_cap_value=caps[\"total\"],\n            current_count_at_binding=snapshot[\"total\"],\n            reason=f\"Total portfolio cap reached: {snapshot['total']}\u002F{caps['total']} \"\n                   f\"positions open. Close at least one position before adding \"\n                   f\"{candidate_asset} {candidate_direction}.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 2: per-direction\n    if snapshot[\"directional\"] >= caps[\"directional\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"directional\",\n            binding_cap_value=caps[\"directional\"],\n            current_count_at_binding=snapshot[\"directional\"],\n            reason=f\"Directional cap reached: {snapshot['directional']}\u002F{caps['directional']} \"\n                   f\"{candidate_direction} positions open. \"\n                   f\"Adding another {candidate_direction} increases directional concentration \"\n                   f\"beyond the current regime limit.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 3: per-correlation-cluster\n    for cluster in candidate_clusters:\n        cluster_count = snapshot[\"clusters\"].get(cluster, 0)\n        if cluster_count >= caps[\"cluster\"]:\n            return AdmissionResult(\n                admitted=False,\n                binding_cap_level=\"cluster\",\n                binding_cap_value=caps[\"cluster\"],\n                current_count_at_binding=cluster_count,\n                reason=f\"Correlation cluster cap reached for '{cluster}': \"\n                       f\"{cluster_count}\u002F{caps['cluster']} positions in this cluster. \"\n                       f\"{candidate_asset} belongs to cluster '{cluster}'. \"\n                       f\"Reduce correlated exposure before adding this position.\",\n                effective_caps=caps,\n                registry_snapshot=snapshot,\n            )\n\n    # Level 4: per-strategy\n    if snapshot[\"strategy\"] >= caps[\"strategy\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"strategy\",\n            binding_cap_value=caps[\"strategy\"],\n            current_count_at_binding=snapshot[\"strategy\"],\n            reason=f\"Strategy cap reached: {snapshot['strategy']}\u002F{caps['strategy']} \"\n                   f\"positions open for strategy '{candidate_strategy_id}'. \"\n                   f\"This strategy has reached its concurrent position limit.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # All caps cleared\n    return AdmissionResult(\n        admitted=True,\n        binding_cap_level=\"none\",\n        binding_cap_value=0,\n        current_count_at_binding=0,\n        reason=\"All concurrent position caps cleared.\",\n        effective_caps=caps,\n        registry_snapshot=snapshot,\n    )\n```\n\n---\n\n## Registry Maintenance\n\n```python\ndef register_position(\n    registry: PositionRegistry,\n    position: OpenPosition,\n) -> PositionRegistry:\n    \"\"\"\n    Add a newly opened position to the registry.\n    Called immediately after confirmed exchange fill.\n    Populates correlation clusters for the position.\n    \"\"\"\n    position.clusters = get_clusters_for_asset(position.asset)\n    registry.positions[position.position_id] = position\n    return registry\n\ndef deregister_position(\n    registry: PositionRegistry,\n    position_id: str,\n) -> PositionRegistry:\n    \"\"\"\n    Remove a closed position from the registry.\n    Called immediately after confirmed exchange close.\n    \"\"\"\n    registry.positions.pop(position_id, None)\n    return registry\n\ndef reconcile_registry(\n    registry: PositionRegistry,\n    exchange_positions: list[dict],  # from HyperLiquid \u002Finfo clearinghouseState\n) -> tuple[PositionRegistry, list[str]]:\n    \"\"\"\n    Reconcile local registry against live exchange position state.\n    Called at session open and after any API reconnect.\n    Returns updated registry and list of discrepancy warnings.\n\n    Discrepancy types:\n    - Position in registry but not on exchange (phantom position)\n    - Position on exchange but not in registry (shadow position)\n    - Notional mismatch > 1% (partial fill or manual intervention)\n    \"\"\"\n    warnings = []\n    exchange_ids = {p[\"positionId\"] for p in exchange_positions}\n    registry_ids = set(registry.positions.keys())\n\n    # Phantom positions\n    for pid in registry_ids - exchange_ids:\n        warnings.append(f\"PHANTOM_POSITION: {pid} in registry but not on exchange. Removing.\")\n        registry.positions.pop(pid, None)\n\n    # Shadow positions\n    for ep in exchange_positions:\n        pid = ep[\"positionId\"]\n        if pid not in registry_ids:\n            warnings.append(\n                f\"SHADOW_POSITION: {pid} ({ep.get('asset')} {ep.get('direction')}) \"\n                f\"on exchange but not in registry. Adding.\"\n            )\n            registry.positions[pid] = OpenPosition(\n                position_id=pid,\n                asset=ep[\"asset\"],\n                direction=ep[\"direction\"],\n                strategy_id=\"UNKNOWN_RECONCILED\",\n                notional_usd=ep[\"notionalUsd\"],\n                margin_usd=ep[\"marginUsd\"],\n                entry_timestamp_utc=ep.get(\"entryTimestamp\", time.time()),\n                leverage=ep.get(\"leverage\", 1.0),\n                clusters=get_clusters_for_asset(ep[\"asset\"]),\n            )\n\n    # Notional mismatch\n    for ep in exchange_positions:\n        pid = ep[\"positionId\"]\n        if pid in registry.positions:\n            local_n  = registry.positions[pid].notional_usd\n            remote_n = ep[\"notionalUsd\"]\n            if abs(local_n - remote_n) \u002F max(remote_n, 1) > 0.01:\n                warnings.append(\n                    f\"NOTIONAL_MISMATCH: {pid} local={local_n:.2f} \"\n                    f\"exchange={remote_n:.2f}. Updating to exchange value.\"\n                )\n                registry.positions[pid].notional_usd = remote_n\n\n    return registry, warnings\n```\n\n---\n\n## Regime-Driven Cap Tightening Logic\n\nBeyond kill-switch tier, the following real-time signals automatically\ntighten caps within a session. The `resolve_effective_caps()` function\nhandles these; this table documents the design intent:\n\n| Signal | Source Skill | Cap Tightening | Rationale |\n|---|---|---|---|\n| Cascade score ≥ 5 (HIGH) | `liquidation-cascade-risk` | total −1, cluster −1 | Book fragility elevates correlated liquidation risk |\n| Cascade score ≥ 8 (CRITICAL) | `liquidation-cascade-risk` | All caps → Tier 3 limits | Imminent cascade; portfolio must be minimal |\n| Funding regime ELEVATED | `high-funding-carry-avoidance` | total −1 | Carry cost silently reduces edge on all open positions |\n| Funding regime EXTREME | `high-funding-carry-avoidance` | total −1, directional −1 | Extreme funding: long positions bleed carry rapidly |\n| Kill-switch Tier 1 | `drawdown-kill-switch-trigger` | Per Tier 1 override table | Session soft stop in effect |\n| Kill-switch Tier 3 recovery | `drawdown-kill-switch-trigger` | total=1 for first 5 sessions | Recovery protocol; avoid re-triggering Tier 3 |\n\n---\n\n## Net Directional Exposure Check\n\nBeyond position count, net directional notional must stay within\nbounds to prevent de facto one-sided book construction across\nmultiple positions:\n\n```python\nMAX_NET_DIRECTIONAL_PCT_NAV = 1.50   # 150% of NAV net long or net short\n\ndef check_net_directional_exposure(\n    registry: PositionRegistry,\n    candidate_direction: str,\n    candidate_notional_usd: float,\n    portfolio_nav_usd: float,\n) -> dict:\n    \"\"\"\n    Check whether adding the candidate notional would breach the net\n    directional exposure cap. Separate from position count checks.\n    \"\"\"\n    current_net = registry.net_direction_notional()\n    candidate_signed = candidate_notional_usd if candidate_direction == \"long\" else -candidate_notional_usd\n    projected_net = current_net + candidate_signed\n    projected_net_pct_nav = abs(projected_net) \u002F portfolio_nav_usd\n\n    permitted = projected_net_pct_nav \u003C= MAX_NET_DIRECTIONAL_PCT_NAV\n    return {\n        \"permitted\": permitted,\n        \"current_net_usd\": current_net,\n        \"projected_net_usd\": projected_net,\n        \"projected_net_pct_nav\": projected_net_pct_nav * 100,\n        \"cap_pct_nav\": MAX_NET_DIRECTIONAL_PCT_NAV * 100,\n        \"reason\": (\n            \"Net directional exposure within cap.\"\n            if permitted else\n            f\"Net directional cap breached: projected {projected_net_pct_nav*100:.1f}% \"\n            f\"of NAV net {'long' if projected_net > 0 else 'short'} vs cap of \"\n            f\"{MAX_NET_DIRECTIONAL_PCT_NAV*100:.0f}%. Reduce existing \"\n            f\"{'long' if projected_net > 0 else 'short'} exposure or take the \"\n            f\"opposite direction to reduce net.\"\n        ),\n    }\n```\n\n---\n\n## Worked Example — Full Admission Pipeline\n\n```\nInputs:\n  Portfolio NAV:               $200,000\n  Kill-switch tier:            NONE\n  Cascade score:               5  (HIGH — tightens total -1, cluster -1)\n  Funding regime:              ELEVATED (tightens total -1)\n  Post-Tier-3 recovery:        False\n\nEffective caps after regime modifiers:\n  Base NONE caps:  total=6, directional=4, cluster=2, strategy=3, asset=1\n  Cascade HIGH:    total=5, cluster=1\n  Funding ELEVATED: total=4\n  Final caps:      total=4, directional=4, cluster=1, strategy=3, asset=1\n\nCurrent open positions:\n  1. BTC-long  (btc_majors cluster, strategy: trending-bull)\n  2. ETH-long  (btc_majors + eth_ecosystem clusters, strategy: trending-bull)\n  3. OP-long   (eth_ecosystem cluster, strategy: funding-carry)\n\nCandidate: SOL-long, strategy: trending-bull\n\nStep 1 — Asset check:\n  SOL count in registry: 0  \u003C  asset cap 1  ✔\n\nStep 2 — Total check:\n  Total open: 3  \u003C  effective total cap 4  ✔\n\nStep 3 — Directional check:\n  Long count: 3  \u003C  directional cap 4  ✔\n\nStep 4 — Cluster check:\n  SOL clusters: [btc_majors]\n  btc_majors count: 2 (BTC + ETH)  >=  cluster cap 1  ✗\n\nResult: REJECTED\n  binding_cap_level:  \"cluster\"\n  reason: \"Correlation cluster cap reached for 'btc_majors': 2\u002F1\n           positions in this cluster. SOL belongs to cluster\n           'btc_majors'. Reduce correlated exposure before adding\n           this position.\"\n\nImplication: Agent should not add SOL while both BTC and ETH are\nopen. Options: close BTC or ETH first (freeing the btc_majors\ncluster slot), or wait for a different asset in a different cluster.\n```\n\n---\n\n## Configuration\n\n```yaml\n# multiclaw\u002Fmetaclaw\u002Fconcurrent_positions_config.yaml\n\nconcurrent_positions:\n  base_caps:\n    total:       6\n    directional: 4\n    cluster:     2\n    strategy:    3\n    asset:       1\n\n  net_directional_cap_pct_nav: 150   # 150% of NAV net long or short\n\n  correlation_clusters:\n    btc_majors:\n      assets: [BTC, ETH, SOL, BNB]\n      min_correlation: 0.70\n    eth_ecosystem:\n      assets: [ETH, OP, ARB, MATIC]\n      min_correlation: 0.75\n    defi_bluechip:\n      assets: [AAVE, UNI, CRV, SNX, MKR]\n      min_correlation: 0.65\n    high_beta_alt:\n      assets: [DOGE, SHIB, PEPE, WIF, BONK]\n      min_correlation: 0.60\n\n  reconciliation:\n    run_at_session_open: true\n    run_on_reconnect: true\n    shadow_position_action: add_with_warning   # \"add_with_warning\" | \"halt_until_reviewed\"\n    phantom_position_action: remove_with_warning\n\n  audit_log_path: logs\u002Faudit\u002Fposition_registry.jsonl\n  state_store_path: logs\u002Fstate\u002Fposition_registry.json\n```\n\n---\n\n## Audit JSONL Schema\n\n```json\n{\n  \"event\": \"position_admission_rejected\",\n  \"timestamp_utc\": \"2026-04-07T22:00:00Z\",\n  \"candidate_asset\": \"SOL\",\n  \"candidate_direction\": \"long\",\n  \"candidate_strategy_id\": \"trending-bull\",\n  \"candidate_notional_usd\": 2353,\n  \"admitted\": false,\n  \"binding_cap_level\": \"cluster\",\n  \"binding_cap_value\": 1,\n  \"current_count_at_binding\": 2,\n  \"reason\": \"Correlation cluster cap reached for 'btc_majors': 2\u002F1 positions.\",\n  \"effective_caps\": {\"total\": 4, \"directional\": 4, \"cluster\": 1, \"strategy\": 3, \"asset\": 1},\n  \"kill_switch_tier\": 0,\n  \"cascade_score\": 5,\n  \"funding_regime\": \"ELEVATED\",\n  \"registry_snapshot\": {\n    \"total\": 3,\n    \"directional\": 3,\n    \"strategy\": 2,\n    \"asset\": 0,\n    \"clusters\": {\"btc_majors\": 2}\n  }\n}\n```\n\n---\n\n## Integration with Other Skills\n\n- **`kelly-position-sizing-perps`** (risk\u002F): Kelly produces\n  `final_notional_usd`. This skill checks whether that position is\n  even admissible before the notional is sent to execution. Kelly\n  sizing and admission check are always run in sequence: Kelly first,\n  admission second.\n- **`drawdown-kill-switch-trigger`** (risk\u002F): Tier state feeds\n  directly into `resolve_effective_caps()`. On Tier 3 recovery, the\n  maximum concurrent position count is 1 for the first 5 sessions —\n  this skill enforces that constraint. On Tier 4, this skill cross-\n  checks and returns `admitted=False` for all candidates.\n- **`liquidation-cascade-risk`** (regime-detection\u002F): Cascade score\n  of 5+ reduces total and cluster caps within the session. Score of\n  8+ maps all caps to Tier 3 limits regardless of kill-switch state.\n- **`high-funding-carry-avoidance`** (regime-detection\u002F): Funding\n  regime ELEVATED or EXTREME reduces total and directional caps. The\n  carry skill's `funding_regime` field is a required input to\n  `resolve_effective_caps()`.\n- **`slippage-budget-enforcement`** (execution\u002F): Only called after\n  this skill returns `admitted=True`. The execution pipeline order is:\n  Kelly → Admission → Slippage → Order Submission.\n\n---\n\n## Quick Decision Tree\n\n```\nNew position candidate arrives — run in order:\n│\n├── 1. Check kill-switch state (drawdown-kill-switch-trigger)\n│     state.trading_permitted()? → No → HALT. Do not proceed.\n│\n├── 2. Resolve effective caps\n│     resolve_effective_caps(tier, cascade_score, funding_regime, recovery)\n│\n├── 3. Run admission check\n│     result = check_admission(registry, asset, direction, strategy,\n│                              tier, cascade_score, funding_regime)\n│     result.admitted == False? → Log rejection. Do not proceed.\n│     Inform strategy: reason + binding_cap_level\n│\n├── 4. Check net directional exposure\n│     check_net_directional_exposure(registry, direction, notional, nav)\n│     permitted == False? → Log rejection. Do not proceed.\n│\n├── 5. Proceed to slippage-budget-enforcement\n│     Pass final_notional_usd as initial_size_usd\n│\n├── 6. On confirmed fill:\n│     register_position(registry, new_position)\n│     persist_state(registry)\n│     Log position_admission_accepted audit event\n│\n└── 7. On confirmed close:\n      deregister_position(registry, position_id)\n      persist_state(registry)\n      Log position_closed audit event\n```\n","# Max Concurrent Positions\n\n## When This Skill Activates\n\nApply this skill:\n\n- Immediately after `kelly-position-sizing-perps` produces a sized\n  notional — before any order is submitted\n- When evaluating whether a second leg or scale-in is permitted on an\n  existing position\n- At session open to audit the inherited position count and confirm\n  caps are not already breached from a prior session\n- After any kill-switch tier change — tier changes dynamically tighten\n  all caps and may require immediate position reduction\n- When a new strategy is added to the active strategy set — check\n  whether combined capacity of all strategies fits within portfolio caps\n- During regime transitions — trending → ranging or low → high cascade\n  score changes the effective caps\n\n---\n\n## Cap Hierarchy\n\nConcurrent position limits are enforced at **five nested levels**.\nA new position must clear **all five** before entry is permitted.\nThe binding cap is the one that produces the smallest allowed count\nat the moment of evaluation.\n\n```\nLevel 1: Total portfolio positions          (global ceiling)\nLevel 2: Per-direction (long \u002F short)       (directional concentration)\nLevel 3: Per-correlation-cluster            (correlated exposure grouping)\nLevel 4: Per-strategy                       (single strategy capacity)\nLevel 5: Per-asset                          (repeat position guard)\n```\n\n---\n\n## Default Cap Table\n\nCaps are defined in `kill_switch_config.yaml` and dynamically\noverridden by kill-switch tier and regime state.\n\n| Cap Level | Normal | Tier 1 Post | Tier 2 Post | Tier 3 Recovery | Tier 4 |\n|---|---|---|---|---|---|\n| Total portfolio | 6 | 4 | 3 | 1 | 0 |\n| Per-direction (long or short) | 4 | 3 | 2 | 1 | 0 |\n| Per-correlation-cluster | 2 | 2 | 1 | 1 | 0 |\n| Per-strategy | 3 | 2 | 2 | 1 | 0 |\n| Per-asset | 1 | 1 | 1 | 1 | 0 |\n\n> **Tier 4 is always 0** — no positions of any kind while an emergency\n> shutdown is active. This cap is enforced independently by\n> `drawdown-kill-switch-trigger`; this skill cross-checks it.\n\n---\n\n## Correlation Clusters\n\nAssets are grouped into correlation clusters based on empirically\nobserved co-movement. A position in any asset within a cluster counts\ntoward that cluster's cap. Clusters are not fixed — they are\nre-evaluated when the rolling 30-day correlation matrix changes\nsignificantly (threshold: correlation drift > 0.15 for a pair).\n\n### Default Cluster Definitions\n\n```python\nCORRELATION_CLUSTERS = {\n    \"btc_majors\": {\n        \"assets\": [\"BTC\", \"ETH\", \"SOL\", \"BNB\"],\n        \"min_correlation\": 0.70,   # observed 30d rolling\n        \"description\": \"Large-cap proof-of-work and L1 majors\",\n    },\n    \"eth_ecosystem\": {\n        \"assets\": [\"ETH\", \"OP\", \"ARB\", \"MATIC\", \"BASE\"],\n        \"min_correlation\": 0.75,\n        \"description\": \"Ethereum and L2 ecosystem tokens\",\n    },\n    \"defi_bluechip\": {\n        \"assets\": [\"AAVE\", \"UNI\", \"CRV\", \"SNX\", \"MKR\"],\n        \"min_correlation\": 0.65,\n        \"description\": \"DeFi protocol governance tokens\",\n    },\n    \"high_beta_alt\": {\n        \"assets\": [\"DOGE\", \"SHIB\", \"PEPE\", \"WIF\", \"BONK\"],\n        \"min_correlation\": 0.60,\n        \"description\": \"High-beta meme and retail-driven tokens\",\n    },\n    \"perp_funding_plays\": {\n        \"assets\": [],   # populated dynamically from funding rate screening\n        \"min_correlation\": 0.50,\n        \"description\": \"Assets currently in elevated funding regime\",\n    },\n}\n\n# Note: an asset may appear in multiple clusters (e.g. ETH in both\n# btc_majors and eth_ecosystem). A new ETH position counts against\n# BOTH cluster caps simultaneously.\ndef get_clusters_for_asset(asset: str) -> list[str]:\n    return [\n        name for name, cluster in CORRELATION_CLUSTERS.items()\n        if asset in cluster[\"assets\"]\n    ]\n```\n\n---\n\n## Core Position Registry\n\n```python\nfrom dataclasses import dataclass, field\nfrom typing import Optional\nimport time\n\n@dataclass\nclass OpenPosition:\n    position_id: str          # unique identifier (uuid)\n    asset: str                # e.g. \"ETH\"\n    direction: str            # \"long\" or \"short\"\n    strategy_id: str          # which strategy opened this position\n    notional_usd: float       # current notional size\n    margin_usd: float         # current margin consumed\n    entry_timestamp_utc: float\n    unrealised_pnl_usd: float = 0.0\n    leverage: float = 1.0\n    clusters: list[str] = field(default_factory=list)  # populated on creation\n\n@dataclass\nclass PositionRegistry:\n    positions: dict[str, OpenPosition] = field(default_factory=dict)\n    # key: position_id\n\n    def count_total(self) -> int:\n        return len(self.positions)\n\n    def count_by_direction(self, direction: str) -> int:\n        return sum(1 for p in self.positions.values() if p.direction == direction)\n\n    def count_by_cluster(self, cluster: str) -> int:\n        return sum(1 for p in self.positions.values() if cluster in p.clusters)\n\n    def count_by_strategy(self, strategy_id: str) -> int:\n        return sum(1 for p in self.positions.values() if p.strategy_id == strategy_id)\n\n    def count_by_asset(self, asset: str) -> int:\n        return sum(1 for p in self.positions.values() if p.asset == asset)\n\n    def total_margin_usd(self) -> float:\n        return sum(p.margin_usd for p in self.positions.values())\n\n    def total_notional_usd(self) -> float:\n        return sum(p.notional_usd for p in self.positions.values())\n\n    def net_direction_notional(self) -> float:\n        \"\"\"Positive = net long, negative = net short.\"\"\"\n        longs  = sum(p.notional_usd for p in self.positions.values() if p.direction == \"long\")\n        shorts = sum(p.notional_usd for p in self.positions.values() if p.direction == \"short\")\n        return longs - shorts\n```\n\n---\n\n## Effective Cap Resolver\n\n```python\nfrom enum import Enum\n\nclass KillSwitchTier(Enum):\n    NONE   = 0\n    TIER_1 = 1\n    TIER_2 = 2\n    TIER_3 = 3\n    TIER_4 = 4\n\n# Base caps — override via kill_switch_config.yaml\nBASE_CAPS = {\n    \"total\":       6,\n    \"directional\": 4,\n    \"cluster\":     2,\n    \"strategy\":    3,\n    \"asset\":       1,\n}\n\n# Tier overrides — each tier tightens caps relative to base\nTIER_CAP_OVERRIDES = {\n    KillSwitchTier.NONE:   {\"total\": 6,  \"directional\": 4, \"cluster\": 2, \"strategy\": 3, \"asset\": 1},\n    KillSwitchTier.TIER_1: {\"total\": 4,  \"directional\": 3, \"cluster\": 2, \"strategy\": 2, \"asset\": 1},\n    KillSwitchTier.TIER_2: {\"total\": 3,  \"directional\": 2, \"cluster\": 1, \"strategy\": 2, \"asset\": 1},\n    KillSwitchTier.TIER_3: {\"total\": 1,  \"directional\": 1, \"cluster\": 1, \"strategy\": 1, \"asset\": 1},\n    KillSwitchTier.TIER_4: {\"total\": 0,  \"directional\": 0, \"cluster\": 0, \"strategy\": 0, \"asset\": 0},\n}\n\ndef resolve_effective_caps(\n    kill_switch_tier: KillSwitchTier,\n    cascade_score: int,          # 0-10 from liquidation-cascade-risk\n    funding_regime: str,         # \"NORMAL\" | \"ELEVATED\" | \"EXTREME\"\n    is_post_tier3_recovery: bool = False,\n) -> dict:\n    \"\"\"\n    Resolve effective position caps after applying all dynamic modifiers.\n    Returns a dict with keys: total, directional, cluster, strategy, asset.\n    The most restrictive (minimum) value at each level wins.\n    \"\"\"\n    caps = dict(TIER_CAP_OVERRIDES[kill_switch_tier])\n\n    # Cascade regime tightening\n    if cascade_score >= 8:\n        # CRITICAL: treat like Tier 3 regardless of kill-switch tier\n        caps = {k: min(caps[k], TIER_CAP_OVERRIDES[KillSwitchTier.TIER_3][k])\n                for k in caps}\n    elif cascade_score >= 5:\n        # HIGH: reduce total and cluster by 1\n        caps[\"total\"]   = max(0, caps[\"total\"]   - 1)\n        caps[\"cluster\"] = max(0, caps[\"cluster\"] - 1)\n\n    # Funding regime tightening\n    if funding_regime == \"EXTREME\":\n        caps[\"total\"]       = max(0, caps[\"total\"]       - 1)\n        caps[\"directional\"] = max(0, caps[\"directional\"] - 1)\n    elif funding_regime == \"ELEVATED\":\n        caps[\"total\"]       = max(0, caps[\"total\"]       - 1)\n\n    # Post-Tier-3 recovery protocol (first 5 sessions)\n    if is_post_tier3_recovery:\n        caps = {k: min(caps[k], TIER_CAP_OVERRIDES[KillSwitchTier.TIER_3][k])\n                for k in caps}\n\n    return caps\n```\n\n---\n\n## Admission Check\n\n```python\n@dataclass\nclass AdmissionResult:\n    admitted: bool\n    binding_cap_level: str      # \"total\" | \"directional\" | \"cluster\" | \"strategy\" | \"asset\" | \"none\"\n    binding_cap_value: int\n    current_count_at_binding: int\n    reason: str\n    effective_caps: dict\n    registry_snapshot: dict     # counts at time of check\n\ndef check_admission(\n    registry: PositionRegistry,\n    candidate_asset: str,\n    candidate_direction: str,\n    candidate_strategy_id: str,\n    kill_switch_tier: KillSwitchTier,\n    cascade_score: int,\n    funding_regime: str,\n    is_post_tier3_recovery: bool = False,\n) -> AdmissionResult:\n    \"\"\"\n    Check whether a new position may be opened.\n    Returns AdmissionResult with admitted=True or False and full reasoning.\n    \"\"\"\n    caps = resolve_effective_caps(\n        kill_switch_tier, cascade_score, funding_regime, is_post_tier3_recovery\n    )\n\n    candidate_clusters = get_clusters_for_asset(candidate_asset)\n\n    snapshot = {\n        \"total\":       registry.count_total(),\n        \"directional\": registry.count_by_direction(candidate_direction),\n        \"strategy\":    registry.count_by_strategy(candidate_strategy_id),\n        \"asset\":       registry.count_by_asset(candidate_asset),\n        \"clusters\":    {c: registry.count_by_cluster(c) for c in candidate_clusters},\n    }\n\n    # Check each cap level in priority order (most restrictive first)\n\n    # Level 5: per-asset (repeat position guard)\n    if snapshot[\"asset\"] >= caps[\"asset\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"asset\",\n            binding_cap_value=caps[\"asset\"],\n            current_count_at_binding=snapshot[\"asset\"],\n            reason=f\"Asset cap reached: {snapshot['asset']}\u002F{caps['asset']} \"\n                   f\"positions already open on {candidate_asset}. \"\n                   f\"Close existing {candidate_asset} position before opening a new one.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 1: total portfolio\n    if snapshot[\"total\"] >= caps[\"total\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"total\",\n            binding_cap_value=caps[\"total\"],\n            current_count_at_binding=snapshot[\"total\"],\n            reason=f\"Total portfolio cap reached: {snapshot['total']}\u002F{caps['total']} \"\n                   f\"positions open. Close at least one position before adding \"\n                   f\"{candidate_asset} {candidate_direction}.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 2: per-direction\n    if snapshot[\"directional\"] >= caps[\"directional\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"directional\",\n            binding_cap_value=caps[\"directional\"],\n            current_count_at_binding=snapshot[\"directional\"],\n            reason=f\"Directional cap reached: {snapshot['directional']}\u002F{caps['directional']} \"\n                   f\"{candidate_direction} positions open. \"\n                   f\"Adding another {candidate_direction} increases directional concentration \"\n                   f\"beyond the current regime limit.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # Level 3: per-correlation-cluster\n    for cluster in candidate_clusters:\n        cluster_count = snapshot[\"clusters\"].get(cluster, 0)\n        if cluster_count >= caps[\"cluster\"]:\n            return AdmissionResult(\n                admitted=False,\n                binding_cap_level=\"cluster\",\n                binding_cap_value=caps[\"cluster\"],\n                current_count_at_binding=cluster_count,\n                reason=f\"Correlation cluster cap reached for '{cluster}': \"\n                       f\"{cluster_count}\u002F{caps['cluster']} positions in this cluster. \"\n                       f\"{candidate_asset} belongs to cluster '{cluster}'. \"\n                       f\"Reduce correlated exposure before adding this position.\",\n                effective_caps=caps,\n                registry_snapshot=snapshot,\n            )\n\n    # Level 4: per-strategy\n    if snapshot[\"strategy\"] >= caps[\"strategy\"]:\n        return AdmissionResult(\n            admitted=False,\n            binding_cap_level=\"strategy\",\n            binding_cap_value=caps[\"strategy\"],\n            current_count_at_binding=snapshot[\"strategy\"],\n            reason=f\"Strategy cap reached: {snapshot['strategy']}\u002F{caps['strategy']} \"\n                   f\"positions open for strategy '{candidate_strategy_id}'. \"\n                   f\"This strategy has reached its concurrent position limit.\",\n            effective_caps=caps,\n            registry_snapshot=snapshot,\n        )\n\n    # All caps cleared\n    return AdmissionResult(\n        admitted=True,\n        binding_cap_level=\"none\",\n        binding_cap_value=0,\n        current_count_at_binding=0,\n        reason=\"All concurrent position caps cleared.\",\n        effective_caps=caps,\n        registry_snapshot=snapshot,\n    )\n```\n\n---\n\n## Registry Maintenance\n\n```python\ndef register_position(\n    registry: PositionRegistry,\n    position: OpenPosition,\n) -> PositionRegistry:\n    \"\"\"\n    Add a newly opened position to the registry.\n    Called immediately after confirmed exchange fill.\n    Populates correlation clusters for the position.\n    \"\"\"\n    position.clusters = get_clusters_for_asset(position.asset)\n    registry.positions[position.position_id] = position\n    return registry\n\ndef deregister_position(\n    registry: PositionRegistry,\n    position_id: str,\n) -> PositionRegistry:\n    \"\"\"\n    Remove a closed position from the registry.\n    Called immediately after confirmed exchange close.\n    \"\"\"\n    registry.positions.pop(position_id, None)\n    return registry\n\ndef reconcile_registry(\n    registry: PositionRegistry,\n    exchange_positions: list[dict],  # from HyperLiquid \u002Finfo clearinghouseState\n) -> tuple[PositionRegistry, list[str]]:\n    \"\"\"\n    Reconcile local registry against live exchange position state.\n    Called at session open and after any API reconnect.\n    Returns updated registry and list of discrepancy warnings.\n\n    Discrepancy types:\n    - Position in registry but not on exchange (phantom position)\n    - Position on exchange but not in registry (shadow position)\n    - Notional mismatch > 1% (partial fill or manual intervention)\n    \"\"\"\n    warnings = []\n    exchange_ids = {p[\"positionId\"] for p in exchange_positions}\n    registry_ids = set(registry.positions.keys())\n\n    # Phantom positions\n    for pid in registry_ids - exchange_ids:\n        warnings.append(f\"PHANTOM_POSITION: {pid} in registry but not on exchange. Removing.\")\n        registry.positions.pop(pid, None)\n\n    # Shadow positions\n    for ep in exchange_positions:\n        pid = ep[\"positionId\"]\n        if pid not in registry_ids:\n            warnings.append(\n                f\"SHADOW_POSITION: {pid} ({ep.get('asset')} {ep.get('direction')}) \"\n                f\"on exchange but not in registry. Adding.\"\n            )\n            registry.positions[pid] = OpenPosition(\n                position_id=pid,\n                asset=ep[\"asset\"],\n                direction=ep[\"direction\"],\n                strategy_id=\"UNKNOWN_RECONCILED\",\n                notional_usd=ep[\"notionalUsd\"],\n                margin_usd=ep[\"marginUsd\"],\n                entry_timestamp_utc=ep.get(\"entryTimestamp\", time.time()),\n                leverage=ep.get(\"leverage\", 1.0),\n                clusters=get_clusters_for_asset(ep[\"asset\"]),\n            )\n\n    # Notional mismatch\n    for ep in exchange_positions:\n        pid = ep[\"positionId\"]\n        if pid in registry.positions:\n            local_n  = registry.positions[pid].notional_usd\n            remote_n = ep[\"notionalUsd\"]\n            if abs(local_n - remote_n) \u002F max(remote_n, 1) > 0.01:\n                warnings.append(\n                    f\"NOTIONAL_MISMATCH: {pid} local={local_n:.2f} \"\n                    f\"exchange={remote_n:.2f}. Updating to exchange value.\"\n                )\n                registry.positions[pid].notional_usd = remote_n\n\n    return registry, warnings\n```\n\n---\n\n## Regime-Driven Cap Tightening Logic\n\nBeyond kill-switch tier, the following real-time signals automatically\ntighten caps within a session. The `resolve_effective_caps()` function\nhandles these; this table documents the design intent:\n\n| Signal | Source Skill | Cap Tightening | Rationale |\n|---|---|---|---|\n| Cascade score ≥ 5 (HIGH) | `liquidation-cascade-risk` | total −1, cluster −1 | Book fragility elevates correlated liquidation risk |\n| Cascade score ≥ 8 (CRITICAL) | `liquidation-cascade-risk` | All caps → Tier 3 limits | Imminent cascade; portfolio must be minimal |\n| Funding regime ELEVATED | `high-funding-carry-avoidance` | total −1 | Carry cost silently reduces edge on all open positions |\n| Funding regime EXTREME | `high-funding-carry-avoidance` | total −1, directional −1 | Extreme funding: long positions bleed carry rapidly |\n| Kill-switch Tier 1 | `drawdown-kill-switch-trigger` | Per Tier 1 override table | Session soft stop in effect |\n| Kill-switch Tier 3 recovery | `drawdown-kill-switch-trigger` | total=1 for first 5 sessions | Recovery protocol; avoid re-triggering Tier 3 |\n\n---\n\n## Net Directional Exposure Check\n\nBeyond position count, net directional notional must stay within\nbounds to prevent de facto one-sided book construction across\nmultiple positions:\n\n```python\nMAX_NET_DIRECTIONAL_PCT_NAV = 1.50   # 150% of NAV net long or net short\n\ndef check_net_directional_exposure(\n    registry: PositionRegistry,\n    candidate_direction: str,\n    candidate_notional_usd: float,\n    portfolio_nav_usd: float,\n) -> dict:\n    \"\"\"\n    Check whether adding the candidate notional would breach the net\n    directional exposure cap. Separate from position count checks.\n    \"\"\"\n    current_net = registry.net_direction_notional()\n    candidate_signed = candidate_notional_usd if candidate_direction == \"long\" else -candidate_notional_usd\n    projected_net = current_net + candidate_signed\n    projected_net_pct_nav = abs(projected_net) \u002F portfolio_nav_usd\n\n    permitted = projected_net_pct_nav \u003C= MAX_NET_DIRECTIONAL_PCT_NAV\n    return {\n        \"permitted\": permitted,\n        \"current_net_usd\": current_net,\n        \"projected_net_usd\": projected_net,\n        \"projected_net_pct_nav\": projected_net_pct_nav * 100,\n        \"cap_pct_nav\": MAX_NET_DIRECTIONAL_PCT_NAV * 100,\n        \"reason\": (\n            \"Net directional exposure within cap.\"\n            if permitted else\n            f\"Net directional cap breached: projected {projected_net_pct_nav*100:.1f}% \"\n            f\"of NAV net {'long' if projected_net > 0 else 'short'} vs cap of \"\n            f\"{MAX_NET_DIRECTIONAL_PCT_NAV*100:.0f}%. Reduce existing \"\n            f\"{'long' if projected_net > 0 else 'short'} exposure or take the \"\n            f\"opposite direction to reduce net.\"\n        ),\n    }\n```\n\n---\n\n## Worked Example — Full Admission Pipeline\n\n```\nInputs:\n  Portfolio NAV:               $200,000\n  Kill-switch tier:            NONE\n  Cascade score:               5  (HIGH — tightens total -1, cluster -1)\n  Funding regime:              ELEVATED (tightens total -1)\n  Post-Tier-3 recovery:        False\n\nEffective caps after regime modifiers:\n  Base NONE caps:  total=6, directional=4, cluster=2, strategy=3, asset=1\n  Cascade HIGH:    total=5, cluster=1\n  Funding ELEVATED: total=4\n  Final caps:      total=4, directional=4, cluster=1, strategy=3, asset=1\n\nCurrent open positions:\n  1. BTC-long  (btc_majors cluster, strategy: trending-bull)\n  2. ETH-long  (btc_majors + eth_ecosystem clusters, strategy: trending-bull)\n  3. OP-long   (eth_ecosystem cluster, strategy: funding-carry)\n\nCandidate: SOL-long, strategy: trending-bull\n\nStep 1 — Asset check:\n  SOL count in registry: 0  \u003C  asset cap 1  ✔\n\nStep 2 — Total check:\n  Total open: 3  \u003C  effective total cap 4  ✔\n\nStep 3 — Directional check:\n  Long count: 3  \u003C  directional cap 4  ✔\n\nStep 4 — Cluster check:\n  SOL clusters: [btc_majors]\n  btc_majors count: 2 (BTC + ETH)  >=  cluster cap 1  ✗\n\nResult: REJECTED\n  binding_cap_level:  \"cluster\"\n  reason: \"Correlation cluster cap reached for 'btc_majors': 2\u002F1\n           positions in this cluster. SOL belongs to cluster\n           'btc_majors'. Reduce correlated exposure before adding\n           this position.\"\n\nImplication: Agent should not add SOL while both BTC and ETH are\nopen. Options: close BTC or ETH first (freeing the btc_majors\ncluster slot), or wait for a different asset in a different cluster.\n```\n\n---\n\n## Configuration\n\n```yaml\n# multiclaw\u002Fmetaclaw\u002Fconcurrent_positions_config.yaml\n\nconcurrent_positions:\n  base_caps:\n    total:       6\n    directional: 4\n    cluster:     2\n    strategy:    3\n    asset:       1\n\n  net_directional_cap_pct_nav: 150   # 150% of NAV net long or short\n\n  correlation_clusters:\n    btc_majors:\n      assets: [BTC, ETH, SOL, BNB]\n      min_correlation: 0.70\n    eth_ecosystem:\n      assets: [ETH, OP, ARB, MATIC]\n      min_correlation: 0.75\n    defi_bluechip:\n      assets: [AAVE, UNI, CRV, SNX, MKR]\n      min_correlation: 0.65\n    high_beta_alt:\n      assets: [DOGE, SHIB, PEPE, WIF, BONK]\n      min_correlation: 0.60\n\n  reconciliation:\n    run_at_session_open: true\n    run_on_reconnect: true\n    shadow_position_action: add_with_warning   # \"add_with_warning\" | \"halt_until_reviewed\"\n    phantom_position_action: remove_with_warning\n\n  audit_log_path: logs\u002Faudit\u002Fposition_registry.jsonl\n  state_store_path: logs\u002Fstate\u002Fposition_registry.json\n```\n\n---\n\n## Audit JSONL Schema\n\n```json\n{\n  \"event\": \"position_admission_rejected\",\n  \"timestamp_utc\": \"2026-04-07T22:00:00Z\",\n  \"candidate_asset\": \"SOL\",\n  \"candidate_direction\": \"long\",\n  \"candidate_strategy_id\": \"trending-bull\",\n  \"candidate_notional_usd\": 2353,\n  \"admitted\": false,\n  \"binding_cap_level\": \"cluster\",\n  \"binding_cap_value\": 1,\n  \"current_count_at_binding\": 2,\n  \"reason\": \"Correlation cluster cap reached for 'btc_majors': 2\u002F1 positions.\",\n  \"effective_caps\": {\"total\": 4, \"directional\": 4, \"cluster\": 1, \"strategy\": 3, \"asset\": 1},\n  \"kill_switch_tier\": 0,\n  \"cascade_score\": 5,\n  \"funding_regime\": \"ELEVATED\",\n  \"registry_snapshot\": {\n    \"total\": 3,\n    \"directional\": 3,\n    \"strategy\": 2,\n    \"asset\": 0,\n    \"clusters\": {\"btc_majors\": 2}\n  }\n}\n```\n\n---\n\n## Integration with Other Skills\n\n- **`kelly-position-sizing-perps`** (risk\u002F): Kelly produces\n  `final_notional_usd`. This skill checks whether that position is\n  even admissible before the notional is sent to execution. Kelly\n  sizing and admission check are always run in sequence: Kelly first,\n  admission second.\n- **`drawdown-kill-switch-trigger`** (risk\u002F): Tier state feeds\n  directly into `resolve_effective_caps()`. On Tier 3 recovery, the\n  maximum concurrent position count is 1 for the first 5 sessions —\n  this skill enforces that constraint. On Tier 4, this skill cross-\n  checks and returns `admitted=False` for all candidates.\n- **`liquidation-cascade-risk`** (regime-detection\u002F): Cascade score\n  of 5+ reduces total and cluster caps within the session. Score of\n  8+ maps all caps to Tier 3 limits regardless of kill-switch state.\n- **`high-funding-carry-avoidance`** (regime-detection\u002F): Funding\n  regime ELEVATED or EXTREME reduces total and directional caps. The\n  carry skill's `funding_regime` field is a required input to\n  `resolve_effective_caps()`.\n- **`slippage-budget-enforcement`** (execution\u002F): Only called after\n  this skill returns `admitted=True`. The execution pipeline order is:\n  Kelly → Admission → Slippage → Order Submission.\n\n---\n\n## Quick Decision Tree\n\n```\nNew position candidate arrives — run in order:\n│\n├── 1. Check kill-switch state (drawdown-kill-switch-trigger)\n│     state.trading_permitted()? → No → HALT. Do not proceed.\n│\n├── 2. Resolve effective caps\n│     resolve_effective_caps(tier, cascade_score, funding_regime, recovery)\n│\n├── 3. Run admission check\n│     result = check_admission(registry, asset, direction, strategy,\n│                              tier, cascade_score, funding_regime)\n│     result.admitted == False? → Log rejection. Do not proceed.\n│     Inform strategy: reason + binding_cap_level\n│\n├── 4. Check net directional exposure\n│     check_net_directional_exposure(registry, direction, notional, nav)\n│     permitted == False? → Log rejection. Do not proceed.\n│\n├── 5. Proceed to slippage-budget-enforcement\n│     Pass final_notional_usd as initial_size_usd\n│\n├── 6. On confirmed fill:\n│     register_position(registry, new_position)\n│     persist_state(registry)\n│     Log position_admission_accepted audit event\n│\n└── 7. On confirmed close:\n      deregister_position(registry, position_id)\n      persist_state(registry)\n      Log position_closed audit event\n```\n",{"name":5,"category":29,"description":7},"main","bfe4e4653cba696a8dc20f70c6006651b997fdef","migrate-hyperliquid-firm\u002Fmulticlaw\u002Fmetaclaw\u002Fskills\u002Frisk\u002Fmax-concurrent-positions",0,"https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital","https:\u002F\u002Fgithub.com\u002Fenuno","https:\u002F\u002Fenuno.github.io\u002FDynamicCareerCanvas","Digital Nomad, Blockchain Evangel, and Digital Solutions Architect. \r\nCreator of TerraHash Stack.\r\nCEO of Ryno Crypto Mining Services.","2026-07-02 10:49:15",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add enuno\u002Fcrewless-capital --skill max-concurrent-positions",{"tool":59,"command":60},"bunx","bunx skills add enuno\u002Fcrewless-capital --skill max-concurrent-positions",{"tool":62,"command":63},"pnpm","pnpm dlx skills add enuno\u002Fcrewless-capital --skill max-concurrent-positions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fmulticlaw\u002Fmetaclaw\u002Fskills\u002Frisk\u002Fmax-concurrent-positions\u002FSKILL.md",true,[],[68,94,119,141,165,186],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":39},"01M6X94YFR1XNANZ321FS661NG","supermemory","Supermemory is a state-of-the-art memory and context infrastructure for AI agents. Use this skill when building applications that need persistent memory, user personalization, long-term context retention, or semantic search across knowledge bases. It provides Memory API for learned user context, User Profiles for static\u002Fdynamic facts, and RAG for semantic search. Perfect for chatbots, assistants, and knowledge-intensive applications.","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsupermemory\u002FSKILL.md",[],[70,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],"ai agents","memory","rag","semantic search","infrastructure","search","applications","api","knowledge","context","Art","personalization","across","learned","retention","for","persistent memory","static","when",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":98,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":39},"01M6X94S3K97CSK7VFF5H85ED2","wolverine-strategy","WOLVERINE v2.0 — HYPE alpha hunter. Entry-only scanner, DSL-exit-only architecture. v1.1 lost -22.7% because the scanner's thesis exit chopped 25\u002F27 trades before DSL could manage them. v2.0 removes thesis exit entirely. Scanner decides entries (score 8+, 4H\u002F1H aligned, SM consensus). DSL manages all exits (wide Phase 1 for HYPE volatility, trailing tiers starting at +15% ROE). Leverage lowered to 7x. Max 4 entries\u002Fday. 3-hour cooldown between entries. DSL exit managed by plugin runtime via runtime.yaml.","MIT","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsenpi-skills\u002Fwolverine\u002FSKILL.md",[],[33,102,103,104,105,106,107,108,109,110,21,111,112,113,114,115,90,116,117,118],"wolverine strategy","architecture","alpha","Volatility","consensus","only","trading","scanner","manage","hyperliquid","runtime","leverage","hunter","at","managed","dsl","phase",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":98,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6X94HN3CHBM37GM2C84KT26","wolf-strategy","WOLF v6.3 — Fully autonomous multi-strategy trading for Hyperliquid perps via Senpi MCP. Manages multiple strategies simultaneously, each with independent wallets, budgets, slots, and DSL configs. 5+N cron architecture: 5 shared wolf crons (Emerging Movers 3min, SM Flip 5min, Watchdog 5min, Risk Guardian 5min, Health Check 10min) plus one DSL v5.2 cron per strategy (native Hyperliquid SL sync via dsl-dynamic-stop-loss skill v5.3.1). Same asset can be traded in different strategies simultaneously. Enter early on first jumps, not at confirmed peaks. Dynamic risk-based leverage per strategy. Requires Senpi MCP connection, python3, mcporter CLI, OpenClaw cron system, and dsl-dynamic-stop-loss skill (provides dsl-cli.py + dsl-v5.py).","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsenpi-skills\u002Fwolf-strategy\u002FSKILL.md",[],[33,126,127,128,103,129,130,131,132,133,134,135,136,113,137,138,115,139,140,90],"wolf strategy","MCP","openclaw","health","system","python3","check","health check","stop","strategies","shared","connection","wallets","stop-loss","hyperliquid perps",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":98,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":39},"01M6X949FBGWWGY3YZ8N3WB3CP","wolf-howl","HOWL v2 — Hunt, Optimize, Win, Learn. Nightly self-improvement loop for the WOLF autonomous trading strategy. Runs once per day (via cron) to review all trades from the last 24 hours, compute win rates, analyze signal quality correlation, evaluate DSL tier performance, identify missed opportunities, and produce concrete improvement suggestions for the wolf-strategy skill. v2 adds fee drag ratio (FDR) analysis, holding period bucketing, LONG vs SHORT regime detection, rotation cost tracking, cumulative drift detection, and gross vs net profit factor separation. Use when setting up daily trade review automation, analyzing trading performance, or improving an autonomous trading strategy through data-driven feedback loops. Requires Senpi MCP connection, mcporter CLI, and OpenClaw cron system.","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsenpi-skills\u002Fwolf-howl\u002FSKILL.md",[],[148,127,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,117,164,93],"wolf howl","review","performance","learn","analysis","loop","analyze","short","autonomous","up","optimize","drift","self","factor","loops","profit","fdr",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":39},"01M6X9437CQ55N5AYHCPF71JWG","whale-index","Auto-mirror top Discovery traders on Hyperliquid. Scans top 50 traders, scores on PnL rank (35%), win rate (25%), consistency (20%), hold time (10%), drawdown (10%). Creates 2-5 mirror strategies with overlap checks. Daily rebalance with 2-day watch period before swaps. Use when setting up trader mirroring, copy trading, or portfolio auto-rebalancing based on Discovery leaderboard performance.","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsenpi-skills\u002Fwhale-index\u002FSKILL.md",[],[172,173,174,150,175,176,177,32,178,157,179,180,135,181,182,183,184,90,185,93],"index","whale","whale index","auth","monitoring","discovery","auto","daily","time","with","consistency","top","mirror","pnl",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":98,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":192,"publishedAt":39},"01M6X93YTRGNPYNHZRTW9XNH1E","vixen-strategy","VIXEN v1.0 — Dual-mode emerging movers scanner. Built from FOX v1.6 live trading data (+34.5% ROI). Two entry modes: STALKER (steady accumulation, score 6+, catches the SM buildup BEFORE the explosion) and STRIKER (violent FIRST_JUMP, score 9+, with raw volume confirmation to filter blow-off tops). 2-hour per-asset cooldown after Phase 1 exits. DSL High Water Mode mandatory.","https:\u002F\u002Fgithub.com\u002Fenuno\u002Fcrewless-capital\u002Fblob\u002Fmain\u002Fmigrate-hyperliquid-firm\u002Fskills\u002Fsenpi-skills\u002Fvixen\u002FSKILL.md",[],[33,193,194,195,196,197,109,198,199,200,181,201,202,203,204,205,206,207,117,118],"vixen strategy","roi","data","first","confirmation","volume","filter","asset","explosion","mode","high","v1","modes","emerging movers","entry"]