Repository navigation
v1.1.5 - cycle checkpoint, approval gate, prompt hardening, verifiable suite
What changed since v1.1.4
28 commits, 182 files, +11,557 / −5,682. Grouped by area; each line is a commit in this range.
Trading loop and safety
- Cycle checkpoint — one checkpoint persisted per cycle; a duplicate intent is suppressed by decision hash before any local booking, so a restart cannot open the same position twice.
- Human approval gate (opt-in,
require_approval_above_usdc) — above the threshold an order waits for approval;/api/admin/approvalsserves approve/reject, and an expired request counts as a refusal. - Prompt budget policy —
PromptBudgetPolicy+ a sharedTokenCountersize the whole request before every provider call; protected sections are untouchable, lower-priority context is trimmed instead of the call failing. - Execution quality per entry —
Position/TradeDecisioncarry the entry fill quality, persisted throughPersistenceManagerand SQLite; divergent fills are excluded from statistics and from brain lessons. - Brain evidence — historical MAE evidence and post-mortem lessons feed the prompt; entry trend direction is stored separately from the exit market regime; executor handler shuts down gracefully.
- Read-only MCP server over trade history (
mode=ro+query_only).
Executor and reconciliation
- Incomplete fill evidence on entry intents no longer books a position.
- Entry fill handling and reconciliation reworked; late UPDATE confirmations are settled instead of silently dropped.
- Executor connection failures now surface with warnings and a defined path back, instead of a bare exception.
Analyzer and prompts
- Canonical TTM squeeze — Carter's published pairing: KC(20, 1.5 × Wilder ATR), one smoothing shared by band and printed ATR; the detector returns the run length and a fired event instead of a flag.
- Pattern-state durations — MACD histogram, volatility trend, Bollinger squeeze and accumulation/distribution report how long a state has held ("for N bars"), re-evaluated per bar.
- Explicit labels — "momentum shift", "breakout imminent", "(strong signal)" and "reversal confirmation" removed; the prompt legend names the calculator's fixed windows and every detector threshold.
- R/R narrative false positive fixed —
RR_CHECKspans are stripped before counting quoted ratios, sorisk=819.51is no longer read as a second, unverified R/R that warned on every cycle. - Prompt injection hardening — external news/Reddit text is treated as data: instruction-shaped lines quarantined, code fences defused, invisible characters stripped, block wrapped in per-cycle nonce markers.
- Reddit assessments quoting title IDs as decimal strings are accepted instead of discarding the whole sentiment block; one-shot corrective retry when a parsed decision breaks the contract.
Dashboard and observability
- Cycle journal — append-only
metrics/cycles.jsonlwith latency p50/p95 and signal mix, summarised byGET /api/performance/cycles. - Per-provider circuit breaker — 3 consecutive failures open the circuit for 120 s, then a half-open probe; when every circuit is open the primary gets one fail-open attempt.
- Per-visitor limits —
/api/*rate limiting, the WebSocket cap and the admin login limiter resolve the visitor throughresolve_client_ip(), so Cloudflare-tunnel traffic is limited per visitor; the header is trusted only on a loopback peer. Writes have their own budget and 429s carryRetry-After. - Load shedding — heavy endpoints are capped in concurrency; excess work is refused immediately and a slow GET is cancelled, so a flood cannot queue unbounded work in the event loop that runs the analysis cycle.
- Shared price refresh —
/api/brain/refresh-priceshares one exchange attempt across all dashboard callers for 10 s. - Chart revision URLs stay stable between polls and rotate on analysis, so a late response cannot replace a newer image; news previews are lightweight and no longer ship the full payload.
Data freshness
- CoinGecko — the source's own
updated_attravels with the payload assource_updated_at, a warning fires when it is older than 48 h, and a response served from the HTTP cache without an expiry is warned about once per endpoint. The timestamp is shown in the Market Overview prompt block.
Dependencies, CI and docs
constraints.txtfor the eight non-imported floors/caps;aiosqlite,scipyandbitsandbytesdropped fromrequirements.txt(nothing imports them, they arrive through used dependencies). Every launcher passes the constraints file.- CI — a unit-test workflow (
ruff+pytest -m "not integration"), live/Playwright suites markedintegrationso CI stays offline,config.iniseeded from the tracked template, andruffpinned after 0.17 promoted rules and flagged 178 untouched lines. gitignorecleanup: dead boilerplate and unanchoredlib/pattern removed, local-only files (scripts/start_script_{develop,futures}.ps1,.hermes/,.agents/) now ignored for every clone, not just this one.- Older changelog entries archived into
docs/; README and the site re-measured (79 Numba indicator functions, real pre-execution checks instead of an "R:R gate", providerdeepseek), the duplicated architecture article deleted, the private executor repo no longer linked. - Dead suites deleted —
test_shutdown_real.py(zero assertions) andtest_admin_live.py(needed the production admin password); CSP/HSTS coverage moved totests/domain_infra/test_dashboard_brain.py. The suite now runs with 0 skipped. - Four untested paths closed by mutation testing: narrative R/R tolerance (
2.35claimed vs verified1.953), BUY bracket ordering (stop < entry < target),position_size > 1, and a fill divergence above 1% (a 50% tolerance had passed all 182 tests in that file). - Agent documentation trimmed 117.6 KB → 70.0 KB, with false statements corrected (paper-only execution while
[executor_api] enabled = true, a1.50R:R gate againstmin_rr_entry = 0.0, Gemini as the provider whileprovider = deepseek).
Verification
- Full Windows-venv suite: 2419 passed, 0 skipped, 0 failed (~160 s)
- CI gate
pytest -m "not integration": 2385 passed, 34 deselected - Mutation probe: 9 realistic mutants in
src/— 5 killed before the new assertions, 9 killed after ruff check src start.py scriptsclean; GitHub ActionstestsandCodeQLgreen on this commit