SAEBL
UNDER THE HOOD

How Saebl Thinks

Most trading bots execute rules. Saebl reasons, adapts, and evolves its own playbook. Here's how.

THE DECISION PIPELINE

Five steps. Every cycle.

Every five minutes, Saebl runs a complete reasoning cycle: observe market conditions, reason about opportunities, execute with precision, learn from the outcome, and repeat.

01

Observe

Fetch prices, technicals, regime, and open positions from broker and market data.

02

Reason

LLM analyzes context against learned playbook, lessons, and strategy history.

03

Execute

Submit bracket orders with stop-loss and take-profit. Verify protection before confirming.

04

Learn

After every close, analyze what worked and update lessons, strategies, and playbook.

05

Repeat

Each cycle benefits from everything learned before. The agent gets sharper over time.

[14:30:02] Cycle 47 — Analyzing 8 symbols across BULL_CALM regime
[14:30:04] Decision: BUY 15 NVDA @ $892.40 (confidence: 82%)
            Strategy: momentum_breakout
            Stop-loss: $874.55 (-2.0%)  Take-profit: $928.10 (+4.0%)
[14:30:05] Bracket order submitted — SL/TP confirmed by broker
[14:30:05] Trace: DECISION_BUYJOURNAL_OPENBROKER_FILL
THE LEARNING SYSTEM

It writes its own playbook.

After every trade closes, the LLM analyzes what happened and updates three layers of persistent memory. Lessons are created, validated with evidence, and distilled into an evolving trading playbook.

playbook.md

Trading Playbook

The master document. LLM-distilled trading rules synthesized from all lessons and strategies. Reviewed and rewritten periodically as evidence accumulates.

lessons/*.md

Individual Lessons

Each lesson captures a single insight with evidence tracking. Lessons follow a state machine: proposed, testing, validated, or invalidated based on statistical significance.

strategies/*.md

Strategy Logs

Per-strategy trade histories with win rates, average P&L, and performance over time. The agent uses these to decide which strategies to trust.

# Lesson L-047 — momentum_breakout

Status:     VALIDATED
Evidence:   14 supporting / 3 contradicting (82% support rate)
Created:    2026-02-14

Insight:
Momentum breakouts on NVDA perform significantly better when
VIX is below 18 and the stock is above its 20-day EMA.
Average gain: +3.2% vs +0.8% when conditions are not met.

Counterfactual:
Trades taken without these conditions showed 45% win rate
vs 78% when both conditions were present.
RISK ARCHITECTURE

Five layers. Zero unprotected trades.

Every trade passes through five independent risk layers. If any layer fails, the trade is blocked or the engine shuts down. No exceptions, no overrides.

LAYER 1

Bracket Orders

Every trade has a stop-loss and take-profit set at the broker level. If the bracket fails, the trade is rejected.

LAYER 2

Max Positions

Hard cap on concurrent open positions. Enforced even if the LLM tries to exceed it.

LAYER 3

Daily Loss Limit

If net session P&L hits your daily loss limit, the engine auto-kills and closes all positions.

LAYER 4

Drawdown Protection

Rolling drawdown tracking pauses or kills the engine before cumulative losses become critical.

LAYER 5

EOD Liquidation

All positions closed before market close. No overnight risk. Retries with escalation on failure.

MARKET REGIME DETECTION

It reads the room.

Before every decision, Saebl classifies the current market into one of six regimes using SPY, QQQ, DIA, and VIX data. The regime shapes strategy selection, position sizing, and risk tolerance.

BULL_CALM

Uptrend with low volatility. Favorable for momentum and breakout strategies. Larger position sizes.

BULL_VOLATILE

Uptrend with high volatility. Opportunities exist but require tighter stops and smaller sizing.

BEAR_CALM

Downtrend with low volatility. Selective entries only. Reduced position count and size.

BEAR_VOLATILE

Downtrend with high volatility. Most strategies paused. Only high-conviction setups considered.

SIDEWAYS

No clear trend. Range-bound strategies preferred. Momentum entries avoided.

CRISIS

Extreme volatility or market stress. Engine pauses all new entries automatically.

AUDIT TRAIL

Every decision, traced.

Every significant action writes to an append-only trace log. Query by symbol, event type, or time range. Full transparency into what the agent did and why.

// trade_events.jsonl — append-only pipeline trace

{
  "event": "DECISION_BUY",
  "symbol": "NVDA",
  "quantity": 15,
  "price": 892.40,
  "confidence": 0.82,
  "strategy": "momentum_breakout",
  "regime": "BULL_CALM",
  "timestamp": "2026-02-28T14:30:04Z"
}
{
  "event": "OUTCOME_WRITTEN",
  "symbol": "NVDA",
  "pnl": +534.75,
  "hold_time": "2h 14m",
  "exit_reason": "take_profit",
  "timestamp": "2026-02-28T16:44:18Z"
}
{
  "event": "LEARNING_OK",
  "symbol": "NVDA",
  "lesson_action": "update",
  "lesson_id": "L-047",
  "timestamp": "2026-02-28T16:44:20Z"
}
CONFIGURATION

Your rules. Your risk.

Everything is configurable from the dashboard. Risk parameters, watchlist, approval thresholds, and provider keys. All stored locally at ~/.saebl/config.json with 0600 permissions.

Risk Parameters

risk_per_trade: 1R ($500)
max_open_positions: 5
daily_loss_limit: 3R
max_drawdown: 10%
stop_loss_pct: 2.0%
take_profit_pct: 4.0%

Trading Settings

watchlist: NVDA, AAPL, MSFT...
analysis_interval: 300s
require_approval: false
approval_threshold: 0.7
eod_liquidation: true
entry_cutoff: 15:30 ET

Providers

llm_provider: anthropic
llm_model: claude-sonnet-4-...
broker: alpaca
mode: paper
api_keys: ******** (local)
permissions: 0600

REST API

Full local API running on port 8000. Control the engine, query trades, monitor market state, and update configuration programmatically.

SECURITY

The API binds to 127.0.0.1 only — not accessible from other machines. Authentication token required for all POST endpoints. CORS restricted to localhost origins.

Engine

GET /api/engine/status
POST /api/engine/start
POST /api/engine/stop
POST /api/engine/pause | /resume | /kill
GET /api/engine/recovery-status

Trades

GET /api/positions
GET /api/trades?page=1&limit=25
GET /api/account
POST /api/approve/{trade_id}
GET /api/trade-events?symbol=&limit=50

Market

GET /health
GET /api/regime
GET /api/performance
GET /api/playbook
GET /api/lessons | /api/stats

Config

GET /api/config
POST /api/config
POST /api/config/credentials
POST /api/config/validate-credentials
GET /api/setup-status