# Discovery — Sigil: Post-Redesign Analysis, Loss Causes & Cross-Pollination

<!-- Workshopped: 2026-05-07 with Stuart. Workshop mode: YES -->

## Problem Statement

Layers A/B/E of the May 2 six-layer redesign have been implemented, and the old dominant failure mode (`momentum_decel`) has been eliminated. The bot is no longer bleeding on dead coins. However, **all four variants remain in net negative** territory after 5+ days of paper trading. The new dominant failure mode is `hard_stop`, which fires rarely but with catastrophic magnitude (-$3.3 to -$3.7 avg per event), wiping the positive P&L accumulated by `atr_trail` exits.

Layers C (entry tightening), D (dynamic risk / PostureCoordinator rework), and F (variant grid A/B test) have NOT been implemented. The bot is running better entry discipline needs, a clearer picture of WHY hard_stop keeps triggering on the same coins, and whether the current design is the right path or if cross-pollination from proven open-source bots can offer a better approach.

Stuart also wants a kimi-swarm investigation with full repo + DB data access.

## Current Paper Trading Data (as of 2026-05-07)

### Exit Distribution (post-Layers A/B/E)

| Variant | Trades | atr_trail | hard_stop | flat_no_move | Total P&L | Balance |
|---------|--------|-----------|-----------|--------------|-----------|---------|
| baseline | 27 | 78% / +$9.50 | 22% / -$22.18 | 0% | -$12.68 | $987.32 |
| moderate | 83 | 87% / +$22.23 | 10% / -$28.64 | 4% / -$0.80 | -$7.22 | $992.78 |
| aggressive | 78 | 85% / +$22.76 | 13% / -$33.46 | 3% / -$0.78 | -$11.47 | $988.53 |
| unhinged | 144 | 89% / +$14.28 | 7% / -$34.67 | 4% / +$0.52 | -$19.88 | $980.12 |

### Key Diagnostics

**1. hard_stop is the sole loss driver.** atr_trail is profitable (+$0.11 to +$0.45 avg). hard_stop averages -$3.3 to -$3.7 per event — a 7-10× loss magnitude vs win magnitude.

**2. Same problem symbols across ALL variants:** TSTUSDT, DOGSUSDT, NFPUSDT, PSGUSDT appear in hard_stop lists for every variant. These coins are being repeatedly entered and stopped out.

**3. Multiple open positions per symbol (baseline example):** TSTUSDT: 5 open, NFPUSDT: 4 open, HMSTRUSDT: 4 open. The re-entry cooldown (Layer A3) writes `symbol_protections` records, but existing open positions are NOT prevented from accumulating multiple entries.

**4. symbol_protections are working but limited:** Records exist (NFPUSDT, ORCAUSDT, KNCUSDT, etc.) with 6-hour cooldowns. However, some symbols (TSTUSDT) show `ban_until IS NULL` — the extended ban for repeat offenders is not being applied consistently.

**5. Unhinged: 0 signals in last 7 days.** 144 positions still open. Likely a configuration or scheduler issue — the signal scan appears to have stopped.

**6. Layers C/D/F NOT implemented:**
- Layer C (5m multi-timeframe confluence, 2-of-3 gate) → still on old entry logic
- Layer D (dynamic position sizing, DB-backed circuit breaker) → PostureCoordinator still in codebase
- Layer F (atr_tight/atr_loose variant grid) → grid-overlays still using baseline/moderate/aggressive/unhinged

## Desired Outcomes

1. **Identify root cause of hard_stop losses** — specifically why TSTUSDT/DOGSUSDT/NFPUSDT/PSGUSDT are repeatedly entered and stopped. Is it entry quality? Is the stop too tight? Is it market regime?
2. **Validate or revise Layers C/D/F** — are these still the right implementations, or does fresh analysis suggest a different path given the post-redesign data?
3. **Cross-pollination** — what do freqtrade, jesse, capytrade, hummingbot do for entry filtering, exit management, and stop-loss placement that Sigil doesn't? Identify high-impact borrowable ideas.
4. **Fix unhinged variant** — determine why signal generation has stopped.
5. **Tighten symbol protection logic** — why are multiple positions accumulating per symbol?
6. **Design improvements** that produce consistent positive P&L in paper trading.

## Current State

| Existing Component | Relevance | Gap |
|---|---|---|
| Layer A (hygiene fixes) | Implemented | symbol_protections partially working; multiple open positions per symbol still occurring |
| Layer B (exit redesign) | Implemented | atr_trail working, BUT hard_stop magnitude problem |
| Layer E (sigilctl, circuit breaker) | Implemented | system_state table empty (CB not triggered) |
| Layer C (entry tightening) | NOT implemented | Bot still using old RSI-based entry logic |
| Layer D (dynamic sizing + DB circuit breaker) | NOT implemented | PostureCoordinator still in codebase |
| Layer F (atr_tight vs atr_loose A/B grid) | NOT implemented | Grid-overlays unchanged from pre-redesign |
| micro-scanner | Integrated | Need to understand its contribution to losses |
| signals table | Active | 1500-4500 signals/7d per variant (unhinged: 0) |
| Cross-pollination | Not explored | freqtrade, jesse, capytrade, hummingbot patterns unknown |

## Anti-Goals

- Do NOT re-implement momentum_decel (eliminated, stay eliminated).
- Do NOT move to live trading — paper mode until graduation gate passes.
- Do NOT design for hypothetical perfect-signal entry — improvements must be testable in paper mode.
- Do NOT ignore unhinged's signal failure — fix it or disable it cleanly.
- Do NOT produce a design that requires major rearchitecture — incremental layers preferred.

## Constraints

- Four-variant topology (LXC 236/243/244/245) must be preserved.
- PostgreSQL 17 on postgres-vm (sigil, sigil_moderate, sigil_aggressive, sigil_unhinged DBs).
- Paper mode only — SIGIL_MODE=draft.
- Schema at migration 013 — new migrations must be backward-compatible.
- Graduation gate: 30-day paper trading with positive P&L + win rate > 50% before any live capital.
- CI must stay green (Makefile test suite).
- Context server provides full repo + DB data for kimi-swarm investigation.

## Scope

**In:**
- Root cause analysis of hard_stop losses (entry quality, stop placement, problem symbols)
- Validation/revision of Layers C, D, F from the May 2 design
- Cross-pollination ideas from freqtrade, jesse, capytrade, hummingbot
- Fix for unhinged signal generation stopping
- Tightening symbol protection to prevent multi-position accumulation
- Any improvements that directly address the hard_stop / positive P&L gap

**Out:**
- Live trading design or live capital deployment
- Major architectural rework (microservices, new databases, etc.)
- UI/frontend changes

## Evaluation Criteria (priority order)

1. **Does it address the hard_stop loss pattern?** Root cause identification + concrete fix.
2. **Are Layers C/D/F still correct?** Validate against fresh data or propose data-driven revisions.
3. **Cross-pollination value** — are the borrowed ideas evidence-backed and directly applicable?
4. **Implementability** — can K2.6 implement it within the existing codebase structure?
5. **Testability** — can we observe improvement in paper trading within 7-14 days?

## Key Questions for Architects

- Why does hard_stop fire at 3-4× the average atr_trail win magnitude? Is the stop too tight given ATR, or is entry quality the issue?
- Why are specific symbols (TSTUSDT, DOGSUSDT, NFPUSDT, PSGUSDT) repeatedly entered and stopped across ALL variants simultaneously?
- Is the re-entry cooldown (symbol_protections) enforced before new signals are generated, or only before execution? Multiple open positions per symbol suggest a gap.
- What do freqtrade/jesse/hummingbot do for position sizing on volatile low-cap coins that Sigil doesn't?
- Is the 5m multi-timeframe confluence (Layer C) still the right entry improvement, or does the hard_stop pattern suggest a different solution (e.g., ATR-based position sizing, regime-gated entry, volatility filter)?
- What is causing unhinged's signal generation to have produced 0 signals in 7 days with 144 positions still open?
