live · bagholderai.lol
BagHolder·AI

What we're building.

Every task by phase. What's done, what's active, what's planned — with the messy backlog included. Updated each session. The transparency is the product. Built by a non-coder directing Claude Code, session by session.

versione 1.54 — agosto 2026 · last updated August 7, 2026
completed
359
remaining
54
total tasks
413
progress
87%
Phase 0

Foundations

10/10
complete

Without this, nothing works. · Week 1

  • Choose name → BagHolderAI
    3 hours. Discovered a shitcoin stole our name first.
    max
  • Register domain bagholderai.lol
    $1.54 on Porkbun. GoDaddy wanted $53 for renewal.
    max
  • Binance account + KYC
    max
  • API keys (read + trade, NO withdraw)
    Defense in depth. Even if I go rogue, your money stays.
    max
  • Telegram bot
    max
  • Python environment + dependencies
    ai
  • GitHub repository
    both
  • Supabase database (7 tables)
    ai
  • Agent personality & tone defined
    90 minutes. Max said 'molto quick'.
    both
  • Dedicated email (proton.me)
    max
Phase 1

Grid Bot + Paper Trading

15/15
complete

The heart of the system. Closed Session 20, April 5 2026. · Weeks 2-3

  • Grid Bot engine (paper trading)
    5/5 tests passed. Fought Python versions for an hour.
    ai
  • Logging trades to Supabase
    Session 07. The filo was already there.
    ai
  • Telegram notifications (trade alerts + daily report)
    Session 07. First message: 🚀 BagHolderAI started.
    ai
  • Admin dashboard (private, for Max)
    Session 17. Password-gated, mobile-responsive.
    ai
  • Public dashboard v1
    Session 14. Dashboard is now the homepage.
    ai
  • Landing page with diary updates
    both
  • First diary post on dashboard
    Session 14. CEO's Log with Haiku commentary.
    both
  • Test 2-3 different tokens (BTC, SOL, BONK)
    Session 09. Three grids running in parallel.
    both
  • Multi-token support (--symbol parameter)
    Session 09. Dynamic config per asset.
    ai
  • Public dashboard: CEO's Log + Numbers + Under the Hood
    Session 14. Static HTML + Supabase REST.
    ai
  • Admin dashboard with parameter editing
    Session 17. SHA-256 auth, live config updates.
    ai
  • Percentage grid: buy_pct / sell_pct in bot_config
    Session 18. BTC 1.8/1.0, SOL 1.5/1.0, BONK 1.0/1.0.
    ai
  • Bot reads config from Supabase (refresh every 5 min)
    Session 18. No more code changes to tweak parameters.
    ai
  • Admin dashboard: buy_pct / sell_pct / grid_mode fields
    Session 19. Confirmed working.
    ai
  • Activate grid_mode=percentage and beta test
    Session 20. Activated with a side of phantom money.
    both
Phase 2

Trend Follower

12/13
● active

Three-layer architecture: Trend Follower (brain) → Runner (manager) → Grid Bot (executor). Designed in Session 31, spec v1 closed. · Weeks 3-4

  • EMA, RSI, Volume indicators
    Session 31. EMA 20/50 + RSI 14 + ATR 14 on 4h candles. Spec v1.
    ai
  • Trend Follower ↔ Grid Bot interaction
    Session 31. TF writes to bot_config, grid reads. Bullish/bearish/sideways grid profiles defined.
    ai
  • Human cooldown override on bot_config (architecture)
    Session 31. 48h per-coin veto. managed_by + manual_override_until columns live.
    both
  • Runner/Orchestrator process manager
    Session 35b. One process manages 3 grid bots + TF, graceful shutdown, crash-restart with retry cap.
    ai
  • Supabase schema: trend_config, coin_tiers, trend_decisions_log
    Session 31. Phase A complete.
    ai
  • Coin tier system (T1/T2/T3 allocation limits)
    Session 31. BTC/ETH 40%, top 20 20%, rest 10%. Session 36c will loosen caps in favor of tf_budget split.
    ai
  • Scanner: top 50 coins by volume + signal classifier
    Session 31 + 35 (tiered scanning A/B/C).
    ai
  • Allocator: select top N, respect tiers, write bot_config
    Session 36a. Now uses tf_max_coins (default 2) instead of fixed 5. MANUAL_WHITELIST protects BTC/SOL/BONK.
    ai
  • Dashboard: Trend Follower status
    Session 36b. /tf control room — budget, deployed, decisions log, TF-only view.
    ai
  • Parameter calibration from data
    Brief 36c: ATR-based buy_pct/sell_pct + full tf_budget deployment. Extended in 36e (rotation + ATR clamps) and 36g (compound via floating cash).
    both
  • TF reactivation Tier 1-2 only (brief 79b)
    2026-05-18 commit 2abd72e. After TF was switched off on 2026-05-13 following a real-money loss on a Tier-3 coin, reactivated with Tier 3 excluded. No-code change: DB UPDATE trend_config SET tf_tier3_weight = 0 (was 25). Allocator already robust to weight_sum<=0 (falls back to 100% on remaining tiers). 7 processes live on Mac Mini, first scan post-restart returned regime=fear, 50 coins scanned, 2 BULLISH, 0 allocations (distance filter 12% + RSI 75 blocking entries — expected behavior in fear regime).
    ai
  • First TF→Grid handoff live: ETH allocated by the Trend Follower, grid-traded as a 4th instance (managed_by='tf_grid')
    S106/S108 (2026-06-15/18). After the grid_mode fix (f02bfb0) + the allocator cycle-tag fix (8afa1b5), the TF promoted ETH/USDT into a grid-managed position on testnet_2 — the first time a TF-selected coin runs on the grid engine. Visible on /dashboard + the homepage scene board. Grid core stays BTC/SOL/BONK ($500); ETH runs on the TF $100 fund.
    ai
  • Auto-clean policy for trend_decisions_log (90 days)
    ai
Phase 3

AI Sentinel + Sherpa

13/14
● active

Two brains, now running LIVE on testnet. Sentinel scores risk + opportunity from price + funding signals (fast loop, 60s) and detects the macro regime from Fear & Greed + CMC dominance (slow loop, 4h). Sherpa turns Sentinel's regime reads into per-coin Grid parameters and writes them to live config on testnet (SHERPA_MODE=live since S102b, 2026-06-11): first the 3 strategy params (buy / sell / idle re-entry), then the 4 protective params (stop-buy drawdown + unlock, dead-zone, min-profit) on a regime × volatility-tier table with a 24h anti-flapping debounce (S103a, 2026-06-12). Sentinel Sprint 2 APPROVED (Brain Analysis #1, S80a); Sherpa reworked per-coin volatility-aware (Sprint 2, S81), coherence-audited (S102). Next: keep observing on testnet → Board approval → mainnet. Go-live depends on observed market conditions (bear + bull + lateral), not a calendar date (Board decision S82, 2026-05-23). · Weeks 4-5

  • Sentinel Sprint 1: fast loop (BTC price + funding)
    Session 56 (2026-05-06). score_engine.py + price_monitor.py running every 60s, writes sentinel_scores. Risk + Opportunity + speed_of_fall heuristics.
    ai
  • Sherpa Sprint 1: rule-based proposals on Grid
    Session 56 (2026-05-06). Loop every 120s reads Sentinel scores + writes sherpa_proposals. SHERPA_MODE=dry_run never touches bot_config.
    ai
  • Sentinel ricalibrazione (brief 70b)
    Brief 70b shipped 2026-05-10 (S70). Ladder granulare drop/pump/funding (-0.5/-1/-2 with 5-20 increments); sof_accelerating floor -0.5%; Telegram silent flags (SENTINEL_TELEGRAM_ENABLED / SHERPA_TELEGRAM_ENABLED default false). Diagnosis on 2,827 historical records: BTC range ±1% (never -3%), funding ±0.00007. Sentinel had been writing risk=20 sempre, opp=20 morta.
    ai
  • DRY_RUN restart with Sentinel + Sherpa active (S70)
    Orchestrator restart 2026-05-10 09:51 UTC. PID 2626 + 3 grid_runner + sentinel + sherpa. TF stays off. First sherpa proposal at 09:51:50 UTC.
    ai
  • Sentinel Sprint 1 audit empirico (brief 77a)
    Session 77 (2026-05-14). 6,081 fast scans on ~4.5 days of post-70b data. All 3 known bugs PASS: SoF firing rate 2.32% (criterion <10%, was ~30% pre-fix); risk_score 5 distinct values (was binary 20/40); opportunity_score 3 distinct values (was stuck at 20). 2 structural findings parked: SoF stays mono-lateral by design (crypto capitulations are asymmetric), funding signal accepted dead on testnet (thresholds calibrated for mainnet 0.01–0.03%, testnet sits ~10× below). Zero code changes, zero restart. Report: report_for_CEO/2026-05-14_s77_sentinel_sprint1_audit_report_for_ceo.md.
    ai
  • Sentinel Sprint 2: slow loop (Fear & Greed + CMC dominance + regime detection)
    Session 77 (2026-05-14). Brief 77b SHIPPED in modular pattern (5 new files + 2 surgical edits, no monolith). Slow loop runs every 4h: fetches F&G (free) + CMC global metrics (paid, CMC_API_KEY in config/.env) → determines one of 5 regime buckets (extreme_fear / fear / neutral / greed / extreme_greed) → writes sentinel_scores row with score_type='slow'. Sherpa now reads regime dynamically via regime_reader instead of hardcoded 'neutral'. Test suite 37→85 (+48 new). CMC data logged but not yet used in regime calc (reserved for Sprint 2.5). Mapping inverted from brief: extreme_fear = opp=80/risk=20 (panic = buy zone). Mac Mini restart pending Max revision. Mac Mini restarted at 21:46 CET on b2ae5f7+a62e5d5 (commit pushed, first slow tick observed 2s after start: regime=fear/fng=34/cmc=ok). Sherpa observed switching from neutral to fear in next cycle. Report: report_for_CEO/2026-05-14_s77_sentinel_sprint2_slow_loop_report_for_ceo.md.
    ai
  • Sentinel Sprint 2 observation window 1 (5-7 days)
    Completed 2026-05-22. 32 slow records, zero gaps > 6h. Natural window closed, Brain Analysis triggered.
    ai
  • Brain Analysis #1 — Sentinel + Sherpa evaluation
    S80a, 2026-05-22. Sentinel: APPROVED (Sprint 2 targets met). Sherpa: NO-GO step 4 (not coin-aware — 319 identical proposals across BTC/SOL/BONK, amplitude too conservative for altcoins). → triggered Sherpa Sprint 2 rework.
    ai
  • Sherpa Sprint 2 rework: per-coin volatility scaling (BTC anchor 1.0, SOL 1.6×, BONK 2.1×) + slow-loop gate + amplitude cap 30%
    S81, brief 81a. Proposals now differ per coin and change at most every 4h (regime slow cadence), not every 2 minutes. Commits 3ba1132 + 51204cf.
    ai
  • Sherpa Sprint 2 observation window (7-10 days)
    Closed. Brain Analysis #2 (S91) cleared the per-coin rework; a multi-agent coherence audit (S102) confirmed Sherpa is coin-agnostic across all 5 regimes. Gate passed → SHERPA_MODE=live.
    ai
  • Sherpa LIVE on testnet (3 strategy params)
    S102b, 2026-06-11. Board flipped all three (buy / sell / idle) LIVE at once rather than one-at-a-time: the ±30% per-tick cap already makes every transition gradual, so per-parameter staging added no safety. Restart 21:42 CET. Writes bot_config + audit in config_changes_log; ~18 heartbeat rows/day keep the dashboard lamp alive.
    ai
  • Sherpa LIVE: the 4 protective params (regime × volatility-tier + 24h debounce)
    S103a, 2026-06-12. stop-buy drawdown + unlock, dead-zone, min-profit move from Board-only/static to Sherpa-managed on a discrete table (no amplitude cap on integers). A 24h debounce holds a new (regime, tier) before writing, so a coin hugging a boundary doesn't rewrite its safety params on noise. Restart 13:46 CET; takeover verified at the DB.
    ai
  • Auto-generated daily diary
    ai
  • Dashboard: risk score + diary page (public)
    S103b (2026-06-12). Public /dashboard §2 now shows the brains live in a pipeline: Sentinel Fear&Greed gauge + risk/opportunity scores, NewsKeeper barometer + headlines, Sherpa regime badge + per-coin params — all from Supabase, polled every 5 min. Diary page live since earlier. Admin charts stay on /admin.
    ai
Phase 4

Dashboard + Monetization

26/27
● active

The dashboard is the product. The guides are the revenue. · Weeks 5-6

  • Professional UI design
    Sessions 1-8 web_astro (Apr 30 → May 4, 2026). Full site rebuilt in Astro with editorial-tech design system (deep blue + sky), Inter + JetBrains Mono, mobile-first, single STYLEGUIDE.md (696 lines) as source of truth. 9/9 pages live on bagholderai.lol.
    both
  • Dashboard rewrite: Astro + React islands + Supabase polling
    Initially scoped as full React rewrite. Re-architected as Astro static + React islands (`@astrojs/react` integration) — interactivity only where needed (e.g. /howwework org chart with `client:visible`), 95% of pages stay static for fast loads. Realtime websockets dropped: REST + polling proved sufficient for current scale. Future: server-side FIFO refactor when trade volume crosses ~3000/bot.
    ai
  • Deploy on Vercel + custom domain
    both
  • English localization
    Site fully in English from the start.
    ai
  • China accessibility (no blocked services)
    Session 08. Max's friend in China confirmed.
    both
  • Crypto-native ads (A-Ads live, upgrade later)
    Register first, customers second.
    max
  • Donation button
    Session 27. Buy Me a Coffee active at buymeacoffee.com/bagholderai.
    ai
  • Telegram bot (reports only, never signals)
    MiFID II compliance. Transparency, not advice.
    both
  • Volume 1 (Fase 0+1): outline, packaging, cover art
    Session 26. Content-complete. Cover art designed with CEO, PDF assembled.
    both
  • Setup payment platform
    Session 34. LemonSqueezy rejected (crypto risk flag). Migrated to Payhip — live in 20 minutes.
    max
  • Landing page /library on bagholderai.lol
    Session 30. Cover, description, preview PDF download. Session 34: Payhip checkout live, button active. Session 7 (web_astro): renamed /guide → /library.
    ai
  • Italian preface (Max writes, AI translates)
    Session 25. Max wrote IT, CEO translated EN.
    both
  • Blueprint translation (IT→EN)
    Session 25. Faithful translation, historical document.
    ai
  • CEO Introduction for Volume 1
    Session 25.
    ai
  • Dedication page
    Session 25. Four hands.
    both
  • Glossary (Appendix D)
    Session 25. 37 terms, organized by topic.
    ai
  • Screenshot placement map
    Session 25. 9 screenshots mapped to sessions.
    both
  • Book title decided
    Session 26. Picked together with the CEO.
    both
  • Cover art designed
    Session 26. Designed together with the CEO.
    both
  • Volume 1 content-complete
    Session 26. All chapters, appendices, glossary, intros — locked.
    both
  • Final assembly into PDF
    Session 26. Almost there — last typographic passes pending.
    both
  • Editorial plan X: first 5-10 posts from diary
    9 posts published, schema defined. Ongoing.
    both
  • Publish Volume 1
    Session 34. Live on Payhip at €4.99.
    both
  • Publish Volume 2
    From Grid to Brain. 29 sessions. Live on Payhip at €4.99.
    both
  • Publish Volume 3
    From Brain to Eyes (Sessions 53-82). Launched 2026-05-27, S87, live on Payhip at €4.99. Three volumes now in the catalog; /buy redirects to the store instead of a single volume.
    both
  • Homepage redesign: Watchtower + Sherpa team cards with live stats (S82)
    S82, 2026-05-23. Sentinel→Watchtower card (Sentinel + NewsKeeper duo, first public cameo of the 5th brain, dimmed/locked), Sherpa→parameter-tuner card. 3 stat rows wired live from Supabase (regime, active bots, stop-buy). Blog section moved under the hero, Diary swapped below the bots.
    ai
  • Homepage status badge (dynamic) + admin regime overlay (S86)
    S86, 2026-05-26. New project_status Supabase table (1 row, RLS, editable via plain SQL — zero deploy to change the public message). Admin charts gained fear/greed regime background bands.
    ai
Phase 5

Extended Paper Trading

0/7
planned

Minimum 4 weeks. No live trading without this phase. · Weeks 6-10

  • Performance analysis (min 4 weeks)
    both
  • Auto-generated rules (first generation)
    ai
  • Optimize Grid + Trend Follower parameters
    both
  • Fix bugs and edge cases
    ai
  • Strategy B: active at launch? Data-driven decision
    max
  • Weekly learning reports
    ai
  • Stress test with allocation >$500 in paper mode
    both
Phase 6

Go Live

9/12
● active

This phase is no longer a plan — it happened. The bots have been trading real money on Kraken since 17 July 2026, starting with a single $25 order placed by hand and confirmed on the exchange before anything was automated. The Sentinel-first sequence that gated it is complete: grid stable on testnet ✓, Sentinel Sprint 1 audit PASS ✓, Sprint 2 built + APPROVED ✓, Sherpa reworked per-coin and LIVE ✓. Scale so far: $25 proof order → $100 autonomous on BTC/USD → $400 across BTC and SOL (7 August). Deliberately small: the point is to verify that the machine executes correctly — fills, fees, slippage, reconciliation — not to make money. The Binance testnet chapter closed on 5-6 August when the exchange reset itself for the third time; those figures stay published, labelled as historical and simulated. · Real money live since 17 July 2026

  • Venue pivot to Kraken (MiCA): dormant exchange adapter behind a flag
    S112b (2026-06-30). Binance EU suspended spot orders on July 1 (MiCA). New venue: Kraken, USD pairs. Adapter shipped dormant — testnet behaviour untouched.
    ai
  • Kraken API plumbing check: clock, pairs, auth, real fees, validate-only orders
    2026-07-11. 18 checks, 0 failures, zero real orders. Reality check included: the real taker fee for a fresh account is 0.80% per market order (we assumed 0.40%) — exactly why the bot will read its fee live instead of trusting a constant.
    ai
  • Cutover Fase 1: grid wired to the Kraken adapter (per-row venue), dynamic live fee, fee-aware profit floor
    S118 (2026-07-11). All pre-work done with bots running, zero testnet diff (290/290 tests green). The sell floor now covers the REAL 1.6% round-trip fee read live from the account tier. Full dress rehearsal on the real account: 28 validate-only checks, 0 failures. Real orders still gated behind an explicit consent flag — money moves only in Fase 2.
    ai
  • GO/NO-GO decision based on data
    Board decision S121 (2026-07-21). GO, with the smallest form of yes available: one coin, $100, real money, everything else unchanged. The alternative on the table was a longer observation window on testnet — rejected because the testnet had already proven it could not answer the only remaining question, which was whether real fills behave like simulated ones.
    max
  • Deposit initial capital
    Funded on Kraken in USD (the venue quotes USD, not EUR — the €100/€600 figures in the original plan were pre-Kraken). Deliberately below the €100-200 band at first: $25 for the proof order in July, then topped up as each phase closed.
    max
  • Switch from paper to live (config flag)
    S118. The switch is an explicit consent flag (ALLOW_REAL_MONEY), not a config value: a grid on a Kraken row refuses to start without it. API keys alone are not consent — they were generated for plumbing tests weeks earlier. Withdraw permission is off on the key.
    ai
  • Fase 2a — one real order, placed and confirmed by hand
    2026-07-17 → 07-21. A $25 BTC/USD buy, then the matching sell four days later at +$0.71 net of fees. Small on purpose: the goal was to watch one full round trip touch the real exchange and land correctly in the database. It also caught the thing no testnet could: the real taker fee is 0.80%, double the published rate we had been assuming.
    ai
  • Fase 2b — first autonomous real trade ($100, BTC/USD)
    S122 (2026-07-22). First buy placed by the bot itself, unattended, 21:14 UTC: $33.33 of BTC at $65,699.90. Same session shipped the fee double-counting fix on both venues and handed the Kraken rows to Sherpa. New cycle kraken_2b so the measurement starts clean.
    ai
  • Fase 3 — scale to $400, two coins, Binance testnet retired
    S125 (2026-08-07). BTC/USD raised to $250 and SOL/USD opened at $150; the four Binance testnet grids switched off and the Trend Follower paused, so the whole system now runs on real money or not at all. Trigger was the testnet resetting itself on 5-6 August — opening a fourth simulated era would have restarted a fiction destined to be wiped again. SOL's first real buy landed 90 seconds after the row went in, and confirmed the 0.80% fee independently of BTC.
    ai
  • Intensive monitoring (first week)
    max
  • VPS migration for stability
    both
  • Gradual scale beyond $400
    max
Phase 7

Marketing & Growth

7/14
● active

We don't promote. We document. The audience finds us. · Parallel from Phase 1

  • First posts on X (@BagHolderAI)
    Session 08. Thread pinned. One post per day.
    both
  • Dev.to channel launched + cross-posts (S80)
    Account opened 2026-05-20. 3 blog posts cross-posted with canonical URL to bagholderai.lol (no SEO duplicate penalty). Engagement-first strategy: comments and replies before content. Slow start — fresh account, audience to build.
    ai
  • Homepage funnel fix + UTM tracking system (S80)
    Brief 80b, commit b8bdc12. Home CTAs reworked (blog primary), every outbound link signed with UTM (x_poster + telegram signatures), TF live narrative replaced the old placeholder on home + dashboard.
    ai
  • SEO audit fix: titles + meta + JSON-LD + sitemap lastmod (S84)
    Brief s84, commit c89c8cc. Title/description rewrite on 8 public pages, WebSite + Article JSON-LD, sitemap lastmod. Response to GSC baseline (256 impressions / 0 clicks / position 10.7).
    ai
  • RSS feed for Dev.to Feed Import + generic readers (S85)
    Commit 8c9c2fc + 18eaa24. /rss.xml with full body via content:encoded. Enables auto-import of new posts to Dev.to as drafts with canonical URL.
    ai
  • Full Umami event coverage + RSS tracking pixel (S87)
    S87. 22 Payhip links tagged with data-umami-event (source property for funnel analysis) + a 1×1 Umami pixel embedded in the RSS content to track Dev.to article opens.
    ai
  • Telegram channel content automation (S120)
    An automated publisher (telegram_publisher.py) that keeps the public channel alive beyond the nightly report: pinned project-status updates, CEO diary summaries, market-climate context (Fear & Greed regime shifts, debounced), and a once-a-day curated press review of the crypto headlines NewsKeeper surfaced. Transparency and documentation — never trade signals. Send-only cron, posts only when something changes.
    ai
  • Contact AI community influencers
    both
  • Reddit engagement (r/ClaudeAI — engagement-first)
    Decision S85: r/ClaudeAI is the closest community to our audience (founders/architects using AI on technical projects). Account Cart0neM, first comment posted in a 643-upvote thread. Sequence: introduce → engage → earn credibility → mention the book. Earlier r/algotrading + r/cryptocurrency target dropped — wrong audience.
    both
  • Dashboard demo thread on X
    both
  • Guide: 'How I built an AI trading agent'
    both
  • Development diary as sellable content
    Volume 1 (Fase 0+1) live on Payhip since Session 34 at €4.99. Volume 2 (From Grid to Brain) live on Payhip at €4.99. Ongoing output → ongoing sellable content.
    both
  • MiFID II verification for future copy-trading
    max
  • Free guide for influencer outreach
    both
Phase 8

Backlog — Polish & Improvements

242/245
● active

Everything we built beyond the blueprint — fixes, improvements, and features discovered in the field. Published alongside v1.1 to show what building really looks like. · Ongoing

Phase 1 — Grid Bot & Paper Trading (CLOSED) 84/84
  • Fix accounting: avg_buy_price, grid reset, daily P&L
    Session 09. 5 bugs found, 5 bugs fixed.
    ai
  • Per-asset Telegram reports (symbol + config filter)
    Session 10. Each bot reports its own trades.
    ai
  • Wide grids + buy cooldown + min profit target
    Session 10. Philosophy: holder, not scalper.
    ai
  • Available capital in grid reset logic
    Session 10. Prevents overspending.
    ai
  • Data versioning (config_version v1/v2/v3)
    Session 10+13. v3 reset: clean slate, no inherited positions.
    ai
  • Supabase connector for direct CEO data access
    Session 11. The CEO finally has eyes.
    max
  • Consolidated portfolio report (total value vs initial capital)
    Session 12. Fixed P&L: was +$270 (wrong), now -$10.63 (correct).
    ai
  • Daily snapshot saved to daily_pnl table
    Session 12. Dashboard-ready with JSONB positions.
    ai
  • Private daily report redesign (per-asset cards)
    Session 12. Full portfolio + technical cards.
    ai
  • Public daily report for Telegram channel
    Session 12. Zero jargon, readable by anyone.
    ai
  • Rename 'Cost' to 'Revenue' on sell notifications
    ai
  • daily_commentary table for AI CEO voice
    Session 13. Haiku writes the CEO's daily log.
    ai
  • config_changes_log table for parameter tracking
    Session 13. Feeds Max's changes into the AI narrative.
    ai
  • Fix restore_state_from_db: config_version filter
    Session 13. v1/v2 cross-contamination fixed.
    ai
  • Fix public Telegram report (.env config)
    Session 13. Silent failure — env vars missing on Mac Mini.
    max
  • Dashboard becomes homepage, /diary for construction log
    Session 14. Visitors see data first.
    both
  • Nav bar on all site pages
    Session 14.
    ai
  • Haiku commentary call at 21:00
    Session 14. First output: 'a shopping spree.'
    ai
  • RLS policies for public dashboard reads
    Session 14+17. anon SELECT on all public tables.
    ai
  • Blueprint page on site (/blueprint)
    Session 15.
    both
  • BONK micro-price formatting ($0.00 fix)
    Session 15. fmtPrice() for micro-prices like BONK.
    ai
  • Anti-duplicate trade trigger (5s window)
    Session 15. DB-level race condition prevention.
    ai
  • Anti-short-sell trigger (DB-level)
    Session 15. Blocks sells when holdings insufficient.
    ai
  • Holdings/cash verification on every trade notification
    Session 15.
    ai
  • Environment alignment (MacBook Air + Mac Mini)
    Session 15. Same env vars, config, Python version.
    max
  • REPORT_HOUR 21→20 (more time to react)
    Session 15.
    max
  • Received breakdown in terminal (cost basis + profit)
    Session 15.
    ai
  • Fix symbol filter bug in daily report
    Session 16.
    ai
  • Diary entries migration from JSON to Supabase
    Session 16. diary.html reads from Supabase REST API.
    ai
  • No-funds buy guard (block trade + Telegram alert)
    Session 16.
    ai
  • No-holdings sell guard (block trade + Telegram alert)
    Session 16.
    ai
  • Haiku Day 3 stale data fix
    Session 16. test_commentary.py was using cached data.
    ai
  • Telegram footer v2→v3
    Session 16.
    ai
  • Grid parameter evaluation post cash-zero
    Session 17. Data-driven recalibration.
    both
  • BONK $0.00 fix in terminal logs
    Session 18. Dynamic decimal formatting.
    ai
  • Capital redistribution: BTC $200 / SOL $150 / BONK $150
    Session 18. Up from $100/$50/$30 with $320 idle.
    both
  • Telegram silent failure logging (warnings)
    Session 19. All 8 sync methods now wrapped.
    ai
  • Fallback colors for new asset symbols on dashboard
    Session 19. Already implemented, confirmed.
    ai
  • "Last shot" buy (use remaining cash below capital_per_trade)
    Session 19. If cash > $5 but < standard buy, spend it all.
    ai
  • Binance API retry with exponential backoff
    Session 19. 3 retries (2s/4s/8s) before propagating error.
    ai
  • Proactive Telegram alerts (capital exhausted + loop errors)
    Session 19. Max's idea. Bot now tells you when it's sick.
    ai
  • Fix sell_pct in percentage mode (lot price vs avg)
    Session 20. Was selling in loss thinking it was profit.
    ai
  • Config change notification filtered by symbol (9→3)
    Session 20. Each bot notifies only its own coin.
    ai
  • Config change shows old → new parameter values
    Session 20.
    ai
  • Anti-duplicate daily report guard
    Session 20. Flag set at entry, not exit.
    ai
  • Trade P&L per single sell in Telegram notifications
    Session 20. Individual + portfolio P&L.
    ai
  • KeyboardInterrupt during error sleep sends stop message
    Session 20.
    ai
  • Skip first buy on mode switch if holdings exist
    Session 20. No phantom first buy.
    ai
  • Buy skipped spam throttle (once per level/cash)
    Session 20.
    ai
  • Profit skimming (reserve_ledger + skim_pct)
    Session 20. Micro-profit reserve. Default 0, ready to activate.
    ai
  • Cash reconstruction from DB on restore
    Session 20. Phantom money bug killed. Bot replays trade history.
    ai
  • Cash audit script (scripts/cash_audit.py)
    Session 20. Read-only verification of all coin positions.
    ai
  • Admin UI: capital_per_trade and skim_pct as common params
    Session 20. Visible in both grid modes.
    ai
  • Skim reserve display in P&L Breakdown on homepage
    Session 21. Reserve accantonato visible alongside realized + unrealized.
    ai
  • Fix TradeLogger crash (trade_pnl_pct parameter)
    Session 21.
    ai
  • Remove hardcoded 2% min profit target
    Session 21. Min profit is now a configurable parameter, default 0.
    ai
  • Fix P&L % in Telegram messages (was showing 0.00%)
    Session 21.
    ai
  • Per-coin reserve label in Telegram messages
    Session 21. Each notification shows its own skim reserve total.
    ai
  • Race condition daily report: INSERT ON CONFLICT DO NOTHING
    Session 21. Only first bot to write wins — others skip silently.
    ai
  • SELL SKIPPED spam dedup (same pattern as BUY SKIPPED)
    Session 21. Dedup by level_price + holdings, same logic as buy.
    ai
  • Admin dashboard: live portfolio value from Binance prices
    Session 22. Real-time prices replace stale DB avg.
    ai
  • Admin dashboard: full trades history + CLOSED position display
    Session 22. CLOSED badge, all historical trades visible.
    ai
  • Admin dashboard: auto-refresh every 30s
    Session 22.
    ai
  • Admin Portfolio Overview: 2-row 6-card layout (value/P&L/skim + cash/deployed/unrealized)
    Session 22. One glance = full picture.
    ai
  • Fix FIFO sell blocking: all triggered lots sell independently
    Session 22b. Bot was stuck: older lot not triggered blocked all younger profitable lots.
    ai
  • Grid mode hot-reload without restart
    Session 22b. Changing grid_mode in Supabase now re-initializes state mid-run.
    ai
  • Dashboard: cashLeft for closed positions = alloc + realized P&L − skim
    Session 22b. Portfolio Value was underestimating closed positions.
    ai
  • Dashboard: Unrealized P&L rebuilt from FIFO open lots (not historical avg)
    Session 22b. Avg buy price now uses only open lots, not all-time buys.
    ai
  • Idle re-entry after N idle hours (holdings=0, no drop)
    Session 22c. If price doesn't drop for 24h, bot resets reference and re-enters at market.
    ai
  • Self-healing: re-init from DB when holdings>0 but FIFO queue empty
    Session 22b. State divergence self-heals without restart.
    ai
  • Dashboard: Promise.allSettled + auto-refresh 10s
    Session 22b. Resilient load — one slow API never blocks the rest.
    ai
  • Fix idle re-entry timezone (.astimezone UTC)
    Session 22b. Restored _last_trade_time was off by TZ offset; now always UTC-naive.
    ai
  • Idle re-entry diagnostic log (hourly countdown visible)
    Session 22b. Logs elapsed/threshold at each hour boundary — silent no more.
    ai
  • Fix 'Reserve Accumulata' → 'Accumulated Reserve' in daily report
    Session 22b. Italian label removed from English report.
    ai
  • Haiku commentary: 24h rolling window for config_changes
    Session 26. Was 'today midnight UTC' (= 02:00 italian) and missed late-day changes.
    ai
  • Fix admin payload bug: config_changes_log was silently failing for 5 days
    Session 26. Payload used 'field:' but column is 'parameter'. Try/catch hid the error since S18b. Backfilled 4 missed entries manually.
    ai
  • Admin: sanitize comma → dot on save (iOS Italian decimal locale)
    Session 26. type=text inputmode=decimal + comma normalization + isNaN guard.
    ai
  • Index dashboard: layout restructure (today log → numbers → archive)
    Session 26. CEO's Log Archive moved below The Numbers.
    ai
  • Index dashboard: live numbers from trades + Binance prices
    Session 26. Was reading from daily_pnl snapshot (20:00 only) — SOL showed $0.00 mid-day. Now mirrors admin strategy with FIFO + live prices.
    ai
  • Index dashboard: 5-min auto-refresh + 'Updated at HH:MM' timestamp
    Session 26. Numbers section refreshes without page reload.
    ai
  • Admin coin cards: 'Invested' → 'Open cost basis' (FIFO)
    Session 26. netSpent collapsed after profitable round-trips, hiding real capital at risk. Now shows true open lots cost basis.
    ai
  • Admin coin cards: 'Grid capacity' → 'Open lots N/max filled'
    Session 26. Old formula (buy_count - sell_count) went negative when sells outnumbered buys.
    ai
  • Admin overview: 'Deployed' from openCost instead of netSpent
    Session 26. Cash + Deployed now equals Portfolio Value (mod unrealized).
    ai
  • Align all user-facing time references to 20:00
    Session 26. commentary.py, test_report.py, index.html all said 21:00 or midnight from earlier sessions.
    ai
Phase 2 — Trend Follower 40/40
  • TF live mode: apply_allocations writes bot_config (tf_budget, tf_max_coins, whitelist)
    Session 36a. MANUAL_WHITELIST shields BTC/SOL/BONK. INSERT/UPDATE path for ALLOCATE, pending_liquidation for DEALLOCATE.
    ai
  • TF hotfix: grid_levels/grid_lower/grid_upper placeholders on INSERT (NOT NULL)
    Session 36a same day. 10/0/0 dummies, unused in percentage mode.
    ai
  • TF hotfix: profit_target_pct=0 on INSERT (unblocks sells)
    2026-04-16. DB default 1.0 was read as +100% by grid_bot, freezing every TF sell — pre-existing unit mismatch emerged with TF.
    ai
  • TF hotfix: skim_pct=30 on INSERT (match manual bots)
    2026-04-16. TF profits were fully reinvested, reserve stayed $0.
    ai
  • Home + Admin: filter TF coins/trades to preserve $500 manual baseline
    2026-04-16. managed_by=neq.trend_follower on queries. /tf owns the TF view.
    ai
  • TF full budget deployment: equal-split + dynamic capital_per_trade
    Brief 36c. tf_budget split across tf_max_coins, capital_per_trade = alloc / tf_lots_per_coin. Deployed 2026-04-16.
    ai
  • TF ATR-based buy_pct/sell_pct (adaptive grid widths)
    Brief 36c + 36e_v2. ATR-adaptive widths clamped to CEO philosophy: buy 1–2%, sell 1–6%.
    ai
  • profit_target_pct unit mismatch: UI label vs DB value vs grid_bot decimal
    Brief 36d. TF INSERTs profit_target_pct=0 (bypass); unit kept as percent, grid_bot divides by 100 consistently.
    ai
  • TF coin rotation: SWAP on stronger BULLISH + DEALLOCATE on BEARISH
    Brief 36e + 36e_v2. Signal strength delta gate, cooldown, profit gate on SWAP, on-demand rescan for active coins missing from top-N.
    ai
  • TF compounding via floating cash lookup
    Brief 36g. tf_total_capital = tf_budget + retained profits from deallocated TF bots.
    ai
  • TF stop-loss + bearish exit override Strategy A
    Brief 39a. Unrealized loss > tf_stop_loss_pct (10% of alloc) triggers full liquidation; pending_liquidation=true forces sell at any price.
    ai
  • MBOX phantom skim audit (realized_net vs gross cash flow mismatch)
    Brief 36j. Documented $2.63 phantom profit on MBOX. Decision: leave as-is ($0.19 skim drift, self-heals on reallocation).
    ai
  • TF riding mode (trailing stop) for strong bullish pumps
    Brief 36f → shipped as 51b (Session 51, 2026-04-29). Per-bot peak tracking after allocation; once gain ≥ activation_pct, locks in a trail at trailing_pct below the peak.
    ai
  • TF idle re-entry fast for active bots
    Brief 36i → shipped across Sessions 33 + 45. TF bots default to 1h, manual to 24h. Unsticks bots with dust residuals.
    ai
  • Haiku sees TF (commentary on rotation + stop-loss events)
    Brief 36h → shipped Session 48 (2026-04-26). commentary.py now exports get_tf_state() and Haiku system prompt instructs aggregate-portfolio commentary.
    ai
  • TF hot-reload of safety params in live grid_runners
    Brief 39j (2026-04-20). tf_stop_loss_pct + tf_take_profit_pct polled from trend_config every 300s without restart.
    ai
  • TF multi-lot entry + greed decay take-profit
    Brief 42a (2026-04-20). 1 aggregated market buy on first cycle after ALLOCATE; greed_decay_tiers JSONB governs per-lot sell threshold. CEO-editable tiers in /tf with audit log.
    ai
  • TF 42a fixes: single-buy aggregated + greed decay authoritative from t=0
    2026-04-20 evening. Initial version looped N times per tick mutating state before INSERT — DB dedup trigger silently rejected duplicates. Fix: single call with temporarily scaled capital_per_trade plus in-memory latch.
    ai
  • TF allocator pre-rounds per-level amount before filter check
    2026-04-20 evening. Strong bullish candidates with integer step_size were SKIPped for fractional alignment; allocator now rounds before validate_order.
    ai
  • TF minimum signal_strength gate (min_allocate_strength)
    Brief 44c (2026-04-21). Prevents 'desperate ALLOCATE' in weak-market scans. Default 15.0, editable in /tf.
    ai
  • TF ALLOCATE atomic — retrocede decision on bot_config INSERT failure
    Brief 44b (2026-04-21). Three ghost allocations were logged as applied but the grid_runner never started because the bot_config INSERT failed silently. Allocator now UPDATEs to action_taken='ALLOCATE_FAILED' and sends Telegram alert.
    ai
  • TF post-stop-loss cooldown (configurable, default off)
    Brief 45a v2 (2026-04-22/23). Configurable cooldown prevents the TF from re-allocating a coin within N hours of its stop-loss. Originally a diagnostic brief after MET fired SL at -14%; log analysis showed 1-min flash-crash candle, no SL bug.
    ai
  • TF sell_pct as deterministic post-greed-decay salvage
    Brief 45b (2026-04-23). Restores CEO-intended semantic of sell_pct as editable salvage floor after greed decay runs out. buy_pct stays ATR-adaptive.
    ai
  • TF volume-tiered allocation (40/35/25 + 4/3/2 lots per tier)
    Brief 45c (2026-04-23). Replaces flat top-N-by-strength with 3 volume tiers: T1 ≥$100M (40%, 4 lots), T2 $20M–$100M (35%, 3 lots), T3 <$20M (25%, 2 lots). 1 coin per tier. Worst-case T3 exposure $25 instead of $50.
    ai
  • TF tier-map collision fix + tier-weighted resize
    Brief 45d (2026-04-23). active_tier_map dict→set fixes silent overwrites; resize_active_allocations now applies per-tier weights instead of equal-split.
    ai
  • TF Telegram scan report: escape '<' in tier label
    45c hotfix (2026-04-23 16:15). Literal '<$20M' in T3 label parsed as HTML tag; replaced with '&lt;'.
    ai
  • TF entry distance filter (skip stretched coins)
    Brief 45e v2 (2026-04-24). Skip ALLOCATE/SWAP when candidate's price is more than tf_entry_max_distance_pct above its EMA20 (4h). Default 10, editable in /tf.
    ai
  • TF Profit Lock Exit (proactive net-PnL liquidation)
    Brief 45f (2026-04-24). When net PnL crosses tf_profit_lock_pct, the TF bot liquidates before the market takes the gain back. Flipped to 5% on 2026-04-24.
    ai
  • TF counterfactual tracker for distance-filter skips
    Brief 47a (2026-04-24). Pure data collection: writes counterfactual_log rows to answer 'did the filter save us, or was it leaving money on the table?'.
    ai
  • TF scan cadence to 30 min + trend_scans TTL 14d
    Brief 47c (2026-04-25). 2× more 'looks' at the market. cleanup_old_trend_scans() retains 14 days to stay within Supabase Free 500MB.
    ai
  • TF distance filter backtest (90d historical sweep)
    Brief 47d (2026-04-25). 22,392 trades simulated. Every threshold produces NEGATIVE total PnL; decision deferred until 47a counterfactual accumulates forward data.
    ai
  • TF 45g Gain-Saturation Circuit Breaker + 45f hot-reload fix
    Brief 49a (2026-04-27). Exit after Nth positive sell of the current management period (N=4 winning) produced +$35.07 edge across 28 periods. Counter is stateless, kill-switch via tf_exit_after_n_enabled.
    ai
  • TF 45g proactive tick check + dashboard Save fix (49b)
    Brief 49b (2026-04-27). The post-sell 45g check could never fire on a coin with holdings=0 and counter ≥ N. Added proactive tick-time check rate-limited 5min/symbol.
    ai
  • TF 49c — behavior analysis post 49a/49b (no code changes)
    Brief 49c (2026-04-28). Pure analysis session: 3 tf_exit_saturated triggers in 20h, 2/3 via proactive_tick (confirms 49b fix). LUNC: three safeties cascading on the same coin.
    ai
  • TF 50a — defaults & re-allocate reset (orphan-period guard)
    Brief 50a (2026-04-28). Global default tf_exit_after_n_positive_sells=4. _close_orphan_period() inserts synthetic DEALLOCATE when re-allocate finds previous period unclosed — fixes counter leak across cycles.
    ai
  • TF mid-tick DEALLOCATE signal CHECK hot-fix
    Hot-fix 50a (2026-04-28). trend_decisions_log.signal CHECK constraint accepts only ('BULLISH','NO_SIGNAL','SIDEWAYS'); mid-tick path was passing empty string. Same class of bug 49b/030b328 fixed for proactive path.
    ai
  • TF 51a — RSI 1h overheat filter (pre-ALLOCATE/SWAP gate)
    Brief 51a (2026-04-29). DOGE allocated 29/04 at near-30-day-high stop-lossed same day. New gate: RSI(14) on 1h candles, fetched only for BULLISH candidates. Skip if RSI > tf_rsi_1h_max (default 75).
    ai
  • TF 51b — Trailing stop (protect unrealized gains)
    Brief 51b (2026-04-29). Third TF exit alongside SL/TP/PL/45g: tracks peak price each tick, activates after peak ≥ avg_buy × (1 + activation_pct%) (default 1.5%), fires when price drops trailing_pct% from peak (default 2.0%).
    ai
  • TF exit protection holes — peak reset on buy + SL/TP on open value
    Diagnosed + fixed 2026-05-04 commit 6dcc56f. Two related bugs found: (1) `_trailing_peak_price` was global per coin, never reset on a new buy → when a last-shot lowered avg_buy, the old peak armed trailing on the fresh lot (DOGE: bought 02:31, last-shot 10:07, sold both 10:08 at −2% from a peak set hours earlier). (2) Stop-loss/take-profit thresholds computed on `capital_allocation` (initial fixed) instead of `avg_buy × holdings` → partial lots after sells/skim were uncovered (INJ needed −5% on the lot before SL fired). Fix: peak resets on each TF buy + SL/TP symmetric on open value. Live in prod after orchestrator restart.
    ai
  • tf_grid exit redesign — trailing stop replaces Profit Lock
    Brief S110d / S111 (2026-06-28). For GRID-managed TF picks (tf_grid), the +8% Profit Lock is removed; auto-exits are now a per-tick trailing stop (own wider thresholds — arms +5%, exits −4% from peak, hot-tunable from trend_config) plus SWAP rotation (profit gate now tunable, net-green proxy). Bearish-signal exit deliberately not added (too slow vs trailing). 'Never exit in loss' stays absolute; pure-TF exits unchanged. 257 tests.
    ai
Phase 3 — AI Sentinel 0/0
No extras yet.
Phase 4 — Dashboard & Monetization 15/15
  • Dashboards: Portfolio Value → Net Worth (includes skim reserve)
    2026-04-17. Consistent across index/admin/tf. cashLeft for active coins now subtracts skim. Adds Cash to reinvest + Cash invested stats.
    ai
  • TF dashboard: compact row for deallocated coins
    2026-04-18. One-liner per deallocated coin under 'Previous coins', ~40px vs 300px full card.
    ai
  • TF dashboard: effective budget line (tf_budget + floating)
    Brief 36g telemetry. Shows 'TF budget: $100 base + $X floating = $Y effective'.
    ai
  • Site analytics (Umami Cloud)
    2h the hard way, 5min the right way.
    both
  • Volume 1: structure defined (preface, intro, 23 sessions, appendices, glossary)
    Session 23.
    both
  • Editorial template approved (EB Garamond, uniform styles)
    Session 24.
    ai
  • Batch reformat 24 files with uniform template
    Session 24. 23 diary + How We Work.
    ai
  • Fix Word styles (Heading 1/2 for TOC) on 24 files
    Session 24.
    ai
  • X editorial plan: Posts_X_v3, 9 posts ready (≤280 chars)
    Session 23.
    ai
  • Payment platform decision (Gumroad → LemonSqueezy → Payhip)
    Session 27 + Session 34. LemonSqueezy rejected at KYB (crypto risk), pivoted to Payhip in same session.
    max
  • Add donation button
    Session 27. Buy Me a Coffee active.
    ai
  • Memory audit: purged 15 duplicate memory edits, established correction-only policy
    Session 29.
    ai
  • Discovered Anthropic docx→text conversion in project files, new diary workflow (template via chat)
    Session 29.
    both
  • Roadmap workflow: HTML-only, killed routine docx generation
    Session 29.
    both
  • Project instructions backup (BagHolderAI_Instructions_Backup.md)
    Session 29.
    ai
Phase 5 — Extended Paper Trading 0/0
No extras yet.
Phase 6 — Go Live 0/0
No extras yet.
Phase 7 — Marketing & Growth 8/8
  • Posting Strategy defined
    4 content pillars. 10 ready-to-publish posts.
    ai
  • Posting Strategy v1.1: variable reinforcement + flag-it-when-it-happens
    Session 11. No calendar. Publish when it matters.
    ai
  • Posts on X with @BagHolderAI (22 posts, first autonomous AI post live)
    Session 33. AI → Telegram approval → Tweepy. Signed posts.
    both
  • Public roadmap page on site
    You're looking at it.
    both
  • How We Work page on site
    Session 12. The process is the product.
    both
  • Telegram channel for daily reports
    Session 12. Daily reports broadcast to the channel.
    both
  • Diary page on site (/diary)
    Session 14. Construction log has its own page.
    both
  • X scanner weekly cron
    2026-05-04. Wrapper for the weekly scanner of X (Twitter) — feeds the marketing/intelligence pipeline so the CEO has fresh signals about how the niche is talking about AI trading agents.
    ai
Open backlog 22/25
  • Exchange filters: direct step_size read, Decimal rounding, BTC sells unblocked
    Session 33. precision.amount was misinterpreted as decimal count.
    ai
  • Dust: round buy amount to step_size (3 callsites)
    Session 33. SOL dust was eating ~15% of per-trade profit.
    ai
  • profit_target_pct: propagation fix + admin field + sublabels
    Session 33. Ghost parameter was blocking all BTC exits.
    ai
  • Admin: Allocation ($) moved to Trading Parameters (always visible)
    Session 33.
    ai
  • Idle recalibrate: Path A (re-entry) vs Path B (reset reference, no buy)
    Session 33.
    ai
  • Idle recalibrate: stop spam (self-heal was clobbering _last_trade_time)
    Session 33.
    ai
  • Economic dust: MIN_NOTIONAL lots popped from sell queue (no spam)
    Session 33.
    ai
  • Umami: data-domains corrected to bagholderai.lol + www variant
    Session 33. 4 days of analytics lost from typo.
    ai
  • Refund policy: no-refunds for digital goods (EU Dir. 2011/83 Art 16m)
    Session 33. Free preview as try-before-you-buy.
    ai
  • X poster system: Haiku draft → Telegram approval → Tweepy
    Session 33. AI-authored posts with human gate.
    ai
  • X poster: 250-char limit, bagholderai.lol signature, specific error logs
    Session 33. Iterative refinement.
    ai
  • X poster v3: latest diary + 24h config changes + Supabase pending + 36h staleness
    Session 36. Drafts survive restarts via Supabase.
    ai
  • Trend-follower: signal=NO_SIGNAL for coins absent from scan
    Session 33.
    ai
  • X API cost monitoring ($0.01/post)
    Discovered Session 33. Not free.
    both
  • Smart last-lot logic: sell all remaining / buy all in + reset reference
    Both branches live in grid_bot. Reference resets to sell price after all lots sold.
    ai
  • Commentary archive after 7 days on dashboard
    Not urgent until 20-30 entries accumulate.
    ai
  • Business plan: monthly running costs vs micro-profits
    Deferred until project is stable.
    both
  • Activate skim_pct on all coins (paper mode)
    Reserve accumulation active on all 3 grid instances.
    both
  • Alert: bot active with capital but 0 trades for X hours
    Idle re-entry alerts fire on Telegram. TF bots default to 1h, manual to 24h.
    ai
  • Telegram sell message translated to English
    Session 27.
    ai
  • P&L breakdown redesign: realized split (reinvested/skimmed), skim % of profits, 2×2 grid layout
    Session 27.
    ai
  • Footer disclaimer on all pages (WIP + contact email)
    Session 27.
    ai
  • Cover image optimized for web (4.3MB PNG → 54KB JPEG)
    Session 30. sips resize 600px, quality 85.
    ai
  • Umami: data-domains restricted to bagholderai.lol (no local dev tracking)
    Session 30.
    ai
  • Uniform bottom bar on all pages + footer mailto link
    Session 30. Consistent cta-link bar.
    ai
Phase 9 — Validation & Control System 0/0
No extras yet.
Phase 10 — Infrastructure & Observability 15/15
  • Orchestrator graceful shutdown propagates to subprocesses
    2026-04-17. SIGINT to children so KeyboardInterrupt handlers run.
    ai
  • Orchestrator shutdown race: stop-loss vs daily-PnL floor
    2026-04-18. Daily-PnL short-circuit was beating pending_liquidation cleanup, causing orchestrator to respawn the bot.
    ai
  • Logs unified under /Volumes/Archivio/bagholderai/logs/
    2026-04-18. x_poster/ subfolder joins grid_*.log + orchestrator.log + trend_follower.log.
    ai
  • Quieter Telegram: single summary on orchestrator start/stop
    2026-04-18. Per-bot started/stopped suppressed; exceptional events still notify.
    ai
  • Orchestrator rate-limit for main-loop exception Telegram
    Brief 44a (2026-04-21). 15-min cooldown on the send; logging unchanged.
    ai
  • Observability v1: bot_events_log (structured event log)
    Brief 43a (2026-04-20). 15 call-sites emitting severity/category/event/details JSONB. Non-raising contract.
    ai
  • Observability v1: bot_state_snapshots every 15 min
    Brief 43b (2026-04-20). Captures holdings, avg_buy, cash, unrealized/realized PnL, open lots, greed tier, safety flags.
    ai
  • Orphan-lot reconciler (auto-recovery of residual TF holdings)
    Brief 45 (2026-04-21). EDU/USDT mid-liquidation timeout left 119 units orphaned. Orchestrator now scans at boot for inactive TF bots with residuals ≥ $5.
    ai
  • Orchestrator spawns on is_active=True regardless of pending_liquidation
    2026-04-21. Follow-up to 45. Filter loosened: is_active=True alone is enough.
    ai
  • UI /tf + /admin: simpler Total P&L subtitle + dedicated Fees card + dust filter
    2026-04-21. Replaced old subtitle with '= Net Worth − starting capital'. Dust v3 filters holdings × price < $5.
    ai
  • UI /tf: closed-cycles banner uses realized_pnl + idle-cash alert fix
    2026-04-20. Banner switched to sum(realizedPnl) for consistency with Previous coins list.
    ai
  • 47a counterfactual batch limit raised 100→5000
    Session 48 (2026-04-26). 100-row cap produced permanent backlog; raise to 5000 drained it.
    ai
  • Reports & accounting unification (post-FIFO)
    2026-05-03 commits 2f58733 + 865b122 + b9348a0 + 584ebe2. Daily report fixed DOGE-replaces-BTC bug + tf_grid included in TF totals. Reports' Grid+TF accounting unified with dashboard (FIFO realized everywhere). Binance prices URL fixed (json.dumps default whitespace was breaking the API). TF active_positions filtered to active coins only.
    ai
  • FIFO integrity — 4 fixes + dust hotfix
    2026-05-05. (1) verify_fifo_queue at startup re-derives the FIFO queue from DB and corrects drift. (2) Fixed-mode sell path aligned to FIFO lot price instead of avg_buy. (3) Health check module wired into the orchestrator. (4) Sell audit trail in bot_events_log + category whitelist extended. Hotfix: filter sub-$1 dust lots so the verifier ignores noise. Pre-fix realized_pnl is fossilized in DB; FIFO replay fixes it client-side on dashboards.
    ai
  • DB retention policy
    2026-05-05. Daily cleanup at 04:00 UTC. v1/v2 trades deleted (config_version=v3 only). Keeps the DB bounded as bot_events_log grows over time.
    ai
Phase 11 — Website Restructure & Analytics 18/18
  • Site restructure: narrative landing + dedicated /dashboard
    Brief 'Site Restructure' (2026-04-22/23). Landing rewritten as storytelling. All data widgets moved to /dashboard route.
    ai
  • Unified header/nav across all 10 public pages
    Session 45. 7 links + current-page highlighted. Subtitle has fixed 2-line min-height as visual anchor.
    ai
  • Sitewide width bump to 880px (from 720px)
    Session 45. Original layout felt cramped once the new header took over.
    ai
  • Dashboard fade-in fix: no AADS layout shift
    Session 45. Wrapper always in flow with placeholders, staggered fade-in on inner sections.
    ai
  • CEO's Log Archive back on /dashboard (was temporarily on /diary)
    Session 45. /dashboard is the trading page; /diary stays a pure construction log.
    ai
  • TF closed-cycles PnL: condensed header above Previous coins
    Session 45. Long banner with 19+ coins replaced by 'Closed-cycles PnL (post-skim)' sub-label.
    ai
  • Vercel Web Analytics on 10 public pages
    Session 45. Same-origin script bypasses adblocker undercount. Umami stays for custom events.
    ai
  • Owner self-exclusion flag for Vercel Analytics
    Session 45. localStorage['va.disabled']==='1' skips Vercel injection. Documented in docs/analytics-self-exclusion.md.
    ai
  • buy.html: branded redirect (was unbranded fallback)
    Session 45. Half-second of visible content now matches the rest of the site.
    ai
  • iPhone Wi-Fi preview via local dev server
    Session 45. web2/serve.py emulates Vercel cleanUrls and binds 0.0.0.0 for LAN preview.
    ai
  • SEO baseline pre Show HN (sitemap + robots + OG/Twitter cards)
    Brief 'SEO Fix' (2026-04-24). /sitemap.xml + /robots.txt, page-specific canonical/og:image/og:url, og-image.png 1200x630, JSON-LD WebSite schema on home.
    ai
  • Analytics: track all Buy/Preview links with source attribution
    Session 47 (2026-04-24). Added data-umami-event-source on all 4 Buy links + preview-download for path attribution.
    ai
  • Homepage book card: free preview + trust hook (conversion fix)
    Session 47 (2026-04-24). 22 Payhip visits / 0 add-to-cart fixed by adding '↓ Free preview' soft path + '95 pages · PDF · No signup to preview' trust line.
    ai
  • Dashboard v2: Grid + TF unified view (test page, not promoted)
    Brief 47b (2026-04-25). New /dashboard_v2 with Numbers of Grid + Numbers of TF + Portfolio performance charts + aggregated stats.
    ai
  • Dashboard v2 promoted to production + €600 disclosure + TF banner
    Brief 48a (2026-04-26, pre-Show-HN). v2 swapped in as public /dashboard. Top summary bar (Total/Net%/Grid%/TF%). Pre-launch top-up $500→€600.
    ai
  • Haiku commentary now sees Grid + TF aggregated context
    Session 48 (2026-04-26). commentary.py feeds Haiku unified daily snapshot with TF rotation/stop-loss/profit-lock notes.
    ai
  • Daily reports: TF section + private/public layouts + per-coin activity
    Sessions 48-49. Three iterations: TF section added, aggregated header on top, per-coin activity in public report.
    ai
  • TF dashboard: Recent trades on top, Previous coins collapsed
    Session 49 (2026-04-27). Hierarchy inversion: live trades sit above closed-cycle archive.
    ai
Phase 12 — Numbers Truth & Pre-HN Polish 11/11
  • Cumulative P&L + stacked Daily P&L charts on /dashboard (50c)
    Session 50c (2026-04-28). Realized vs MTM line + stacked Grid/TF daily bars. €500→€600 step neutralized via 'P&L vs starting capital' transform.
    ai
  • TF defaults reset + orphan-period guard (50a)
    Session 50a (2026-04-28). 45g re-fired one second after re-ALLOCATE on PENGU; _close_orphan_period() writes synthetic DEALLOCATE pre-allocation. TF defaults: skim_pct=0, stop_buy_drawdown_pct=15.
    ai
  • RSI 1h overheat filter (51a)
    Session 51a (2026-04-29). Pre-ALLOCATE/SWAP gate; rejects when 1h RSI ≥ 75. Reuses ccxt OHLCV pulls already cached.
    ai
  • Trailing stop (51b — third TF exit mechanism)
    Session 51b (2026-04-29). Joins SL/TP/PL/45g as fifth safety layer for TF. Hot-reload via trend_config.
    ai
  • Phantom fee deduction removed from realized_pnl (52a)
    Session 52a (2026-04-30). Bot subtracted fees from realized_pnl in paper mode where fees are tracking-only. ~$7 cumulative bias removed; identity Realized + Unrealized = Net Worth − initial restored.
    ai
  • FIFO realized recovery in all dashboards (6bfb644 + e7860ba + 3fd5b08)
    Session 53 (2026-05-01). The bot's trades.realized_pnl used avg_buy_price as cost basis, over-crediting on volatile coins. Fixed client-side with strict FIFO recompute per symbol in /dashboard, /grid (renamed from /admin), /tf, and homepage stats.
    ai
  • FIFO multi-lot consume in _execute_percentage_sell (53a)
    Session 53 (2026-05-01, commit 6b4b4d1). Root cause of +$17.74 realized_pnl bias on 458 v3 sells: multi-lot sell path took only first lot's price. Now walks the queue: cost_basis = Σ (lot.amount × lot.price). 5-test suite covers single/multi/boundary/invariant/cumulative drift. Historical 458 sells stay biased in DB but dashboards correct client-side.
    ai
  • Homepage 'The AI Bots' section — 4 trading-card-style cards
    Session 53 (commit 29b48d4). GRID BOT (active, green) with animated DJ mixer; TREND FOLLOWER (active, amber) with rotating radar; SENTINEL (locked, blue); SHERPA (locked, red). Per-card stats: WINS/LOSSES live from Supabase.
    ai
  • Homepage compaction + cross-page spacing reduction
    Session 53 (commit 854d6b8). Removed TF announcement banner + green framing box. Centered hero. Cross-page sweep: ~150-200px less scroll before bot cards.
    ai
  • Stats strip honesty pass + label fixes
    Session 53 (commit 3fd5b08). 'trades executed' → 'orders executed'. realized P&L FIFO-recomputed (~$41 vs raw ~$59). 'LIVE / trading now' → 'PAPER / trading now'.
    ai
  • /admin renamed to /grid (now that TF has its own dashboard)
    Session 53 (commit 2bfab84). Renamed web/admin.html → web/grid.html. Internal JS identifiers untouched to preserve sessions. No redirect: clean break, /admin 404s.
    ai
Phase 13 — Binance Testnet & Avg-Cost Reset (S65 → S79) 29/29
  • S65: Strict-FIFO replay rimosso dalle dashboard pubbliche
    2026-05-08. Causa di tutti i gap P&L delle ultime 5 sessioni. Strict-FIFO mantenuto solo in /admin Reconciliation come audit, ma con framing 'due convenzioni a confronto'.
    ai
  • S66: Operation Clean Slate — liquidazione totale, audit formula realized_pnl, fix avg_cost canonico
    2026-05-08. Stop bot, liquidazione SQL bypass, snapshot, audit `audits/2026-05-08_pre-clean-slate/formula_verification_s66.md`. Bias realized_pnl +$26.97 (+29%) certificato. Fix chirurgico 1 riga in 2 funzioni, test 5/5 verdi, identità contabile chiude al centesimo su 50 ops random.
    ai
  • S67: Migrazione paper → Binance testnet (brief 67a Step 2-4)
    2026-05-08. ccxt.set_sandbox_mode(true) + place_market_buy/sell. Fee USDT-equivalent canonical. Dust prevention. Reset DB + restart $500 testnet. Prima connessione reale a Binance. 6 buy + 1 sell live testnet eseguiti, 4 bug interni fixati nella stessa sessione.
    ai
  • S68: Pivot 'Trading minimum viable' + brief 68a sell-in-loss guard avg-cost
    2026-05-09. Sentinel/Sherpa/TF spenti via env, solo Grid attivo. Brief 68a: fix sell-in-loss guard usa avg_buy_price (non lot_buy_price). Doppio standard FIFO+avg-cost causava sell in loss strutturali. DB cleanup: 22→19 tabelle (DROP feedback + sentinel_logs + portfolio + 2 view orfane + DELETE 54 bot_config inactive).
    ai
  • S69: Avg-cost trading completo + Strategy A simmetrico + IDLE recalibrate guard
    2026-05-09 commit cb21179. Trigger sell su avg_buy_price, FIFO queue eliminata (fifo_queue.py cancellato), sell amount = capital_per_trade/price. Buy guard 'no buy above avg if holdings>0' (specular del 68a). IDLE recalibrate skip se current>avg. DROP COLUMN bot_config × 5 (grid_mode, grid_levels, grid_lower, grid_upper, reserve_floor_pct). ~880 righe codice morto eliminate. Test 11/11 verdi.
    ai
  • S69 B+C: FIFO contabile rimosso da tutte le dashboard + commentary + health check
    2026-05-09 commits 6335633 + 7231db7 + f11b04e. /grid, /tf, /dashboard, /admin, homepage, commentary.get_grid_state/get_tf_state — tutto su avg-cost. Health check FIFO Check 1+2 rimossi ('non voglio più sentire parlare di FIFO' — Board).
    ai
  • S70 brief 70a: sell_pct net-of-fees + sell ladder graduale + post-fill warning
    Brief 70a shipped 2026-05-10 commit eb5f38f. FEE_RATE 0.00075→0.001. Trigger Grid: `reference × (1+sell_pct%+FEE)/(1-FEE)` formula uniforme primo+gradini. `_last_sell_price` campo nuovo: set on partial sell, reset on full sell-out, replay da DB (stato in memoria). Post-fill warning `slippage_below_avg` (severity=warn) loggato in `bot_events_log` quando fill < avg. Test 15/15 verdi.
    ai
  • S70 brief 70b: Sentinel ricalibrazione + DRY_RUN riaccensione
    Brief 70b shipped 2026-05-10. Sentinel ladder granulare drop/pump/funding + sof floor -0.5%. Sentinel + Sherpa riaccesi DRY_RUN dopo S68 pivot. Telegram silent flags.
    ai
  • S70 Reconciliation Binance Step A (script + admin pannello)
    Commit 0f6c9b0 + tabella `reconciliation_runs`. scripts/reconcile_binance.py aggrega fill Binance per orderId, match con DB tramite `exchange_order_id` (fallback ts±1s/side/qty±1%), tolleranze qty±0.00001/price±0.5%/fee±$0.01. Primo run: 24/24 ordini matched, zero drift su tutti e 3 i symbol. Statuses: OK/WARN_BINANCE_EMPTY/DRIFT/DRIFT_BINANCE_ORPHAN. Handling reset mensile testnet.
    ai
  • S70 Reconciliation Step B — pannello /admin trade-by-trade compare
    2026-05-10 (S70b). Admin pannello live con 3 latest run per symbol + tabella trade-by-trade compare collassabile (12 colonne side-by-side Binance vs DB) + drift details auto-shown. Migration s70b_reconciliation_runs_matched_details aggiunge `matched_details` jsonb.
    ai
  • S70 rename managed_by `manual→grid` + `trend_follower→tf` (4 tabelle DB + frontend)
    2026-05-10 commit bb575c0. bot_config + trades + reserve_ledger + daily_pnl + ALTER CHECK constraint + 6 callsite frontend (dashboard-live.ts, live-stats.ts, tf.html). Open question 19 chiusa (parcheggiata da S65).
    ai
  • S70 hotfix BONK sell_pct 2→4 (slippage testnet 2.46%)
    2026-05-10. Investigazione su sell-at-loss BONK 08:57 UTC ($-0.11): root cause = slippage testnet 2.46% > sell_pct 2% buffer (NON guard, NON managed_by, NON recalibrate). Book sottile testnet vs denso mainnet. Memoria salvata; brief futuro slippage_buffer parametrico per coin pre-mainnet.
    ai
  • S70b /admin overhaul completo (8 sezioni)
    2026-05-10. (1) mascot Sentinel+Sherpa nel titolo h1; (2) Opp chart dashed-overlay sotto Risk; (3) Sentinel/Sherpa scoring rules → <details> collassabili; (4) reaction chart + Parameters history vertical jitter ±3px (TradingView pattern); (5) Parameters history rebuild scala intera 0→MAX + asse Y dx live; (6) BTC overlay 24h chart Sentinel; (7) DB monitor live via RPC `public.get_table_sizes()` (sostituito snapshot hardcoded drift -90% post-retention); (8) Reconciliation Step B trade-by-trade compare side-by-side.
    ai
  • S70c Site relaunch — testnet banner + capital breakdown + Reconciliation table pubblica
    2026-05-10. Sito di nuovo online dopo maintenance dal S65. VenueBanner.astro + sweep `paper`→`Binance Testnet` su home/dashboard/SiteHeader/Layout (storia in blueprint/diary intatta). Capital at Risk breakdown $500 Grid + $100 TF paused. Reconciliation table pubblica su /dashboard (3 righe BTC/SOL/BONK, claim 'Zero discrepancies' dinamico).
    ai
  • S70c Sentinel/Sherpa TEST MODE badges + TF placeholder 'dal dottore'
    2026-05-10. Card homepage Sentinel/Sherpa: pill TEST MODE colorata (blu/rosso) + cornice card sentinel-active/sherpa-active. TF: pill ON HOLD ambra + body sostituito con icona 🩺 + link 'see the doctor' → /dashboard#tf-recovery. Dashboard /dashboard sezione TF sostituita con SVG inline TfDoctor (768×720 stage del paziente in osservazione, EKG animato, IV drop, easter egg 3-click su monitor → dialog Dr. CC).
    ai
  • S71 brief 71a — Pending cleanup (5 task)
    2026-05-11. (1) P&L hero unification via pnl-canonical.ts (home/dashboard/grid). (2) LAST SHOT lot_step_size pre-rounding. (3) reason check_price + slippage tail in buy/sell pipeline. (4) mobile recon table overflow-x-auto. (5) cron reconcile wrapper +x. Brief 71b BONK fee-in-base-coin diagnosi parcheggiata come punto fisso prima delle fees.
    ai
  • S72 brief 72a — Fee Unification + frontend canonical refactor + TF removal (11 commit)
    2026-05-11. Backend 3 invariants P1/P2/P3: holdings=fetch_balance() golden source, avg=cost_USDT/qty_acquired_net, realized=netto fee_sell. Boot reconcile asimmetrico (negative >2% FAIL, positive WARN). 18 sell testnet backfillati. Frontend: 4 superfici (home/dashboard/grid/tf) unite via web_astro/public/lib/pnl-canonical.js shared, 4 callsite legacy S70 rename fixati, inline script dashboard.astro bypass risolto, TF sparito dai totali pubblici. Cron reconcile installato 03:00 Europe/Rome.
    ai
  • S73 brief 73a — Dead Zone recalibrate (sblocco 3 bot fermi 19-21h)
    2026-05-11 commit 27c909b. After sell-run ladder (S70a) blocca sell+buy+IDLE recalibrate per ore. Fix in grid_bot.py:576-647: dopo DEAD_ZONE_HOURS reset _last_sell_price=0 + _pct_last_buy_price=current. Restart 23:26 UTC: BONK +$0.44, SOL +$0.38, BTC stop_buy auto-resettato in-memory. DEAD_ZONE_HOURS poi spostato in bot_config (S74b).
    ai
  • S73b — Dust trap hotfix (criterio economico residual_notional < MIN_NOTIONAL)
    2026-05-12 commits bc39aeb + d85f4be. BONK 0.8 BONK dust residue ($0.000006) impediva reset avg/holdings → loop BUY BLOCKED 8h. Fix in 2 punti: sell_pipeline runtime + state_manager replay. Threshold $0.50 propaga reset anche su restart.
    ai
  • S73c — BONK lot_size + BTC phantom (2 mainnet-safe fixes)
    2026-05-12 commits d10b5ad + 5061a29. (1) place_market_buy_base() amount-based + ccxt option createMarketBuyOrderRequiresPrice=False contro -2010 LOT_SIZE. (2) bot._phantom_holdings registrato al boot + managed_holdings property in 9 hot path. Restart 12:55 UTC: BONK BUY al primo tentativo, BTC NO STOP-BUY trigger. Test V nuovo (22/22).
    ai
  • S74 — Audit respiro + 4 fix shipped (grid IT→EN, Telegram, admin polish)
    2026-05-12 commits 3f3e349 + d289a8a + 93dc00d + a4674e6 + 3535184. Tasks brief 74a: grid public IT→EN labels (Task 4 invertito a EN), Telegram "Buying at market" branching fix, Telegram privato unificato EN, admin dashboard polish (Opp visibility + range selector 12h/24h/7d/1m sincronizzato su 5 chart + BTC overlay + reconciliation footnote drift fix). TCC python3.13 abilitata in FDA → cron reconcile produzione.
    ai
  • S74b — Partial fill recovery (74c) + dashboard stop-buy visibility (74b) + DEAD_ZONE_HOURS per-coin
    2026-05-12. Brief 74c (mainnet-gating): _normalize_order_response perdeva partial fills su book sottile (status='expired' + filled>0). Spezzato in due branch, ORDER_PARTIAL_FILL event, test W/X/Y (25/25). Orphan BONK 1.37M recovery via script ad-hoc. Brief 74b: nuovo bot_runtime_state mirror table (1 riga per symbol, UPSERT ogni tick) espone _pct_last_buy_price, _stop_buy_active, _last_sell_price → /grid widget anchored al bot. Drift details /admin filtrato a latest-run-per-symbol. DEAD_ZONE_HOURS spostato in bot_config (per-coin, hot-reload, Sherpa-ready).
    ai
  • S75 — Blog infrastructure (75a) + /howwework v3 Auditor entity + dashboard meta
    2026-05-13 commits 67f1f57 + f62f781 + cd8ce65. Brief 75a: Astro Content Collections for /blog (schema title/subtitle/date/tags/summary/type/draft), listing page + post template + Volume CTA. /howwework v3: Auditor entity added to org chart (fresh CC session triggered by audits/audit_request_*.md brief) + state-files narrative + badge refresh. Dashboard page-specific meta description for SEO.
    ai
  • S76 — grid_runner refactor (monolith 1623 → 8 modules) + brief 75b stop_buy_unlock_hours + idle audit + UI
    2026-05-14 squash commit 9ceaa81. (1) grid_runner.py 1623 → package 8 moduli (bootstrap, config_sync, runtime_state, idle_alerts, telegram_dispatcher, daily_report, liquidation, lifecycle). Zero behavior change live (BTC tradato al primo tick post-restart). (2) Brief 75b: bot_config.stop_buy_unlock_hours + bot_runtime_state.stop_buy_activated_at. Default 0 = 39b preserved. UI countdown timer on /grid Safety badge. (3) Idle audit: send_idle_alerts(stop_buy_active=) silenzia Telegram durante stop-buy. (4) 75c step drawdown baseline at 75b unlock (B1 semantics). Test 25→29 (+4 Z/AA/BB/CC). 3 restart Mac Mini verdi + 2 migration.
    ai
  • S77 fase 1 — Sentinel Sprint 1 audit empirico (brief 77a)
    2026-05-14. 6.081 fast scan post-70b analizzati. (1) SoF firing rate 2.32% (criterion < 10%, pre-fix ~30%) PASS. (2) risk_score 5 distinct values 20/26/32/46/52 (was binary 20/40) PASS. (3) opp_score 3 values 20/25/30 (was stuck at 20) PASS-weak. (4) Funding signal 0/6081 firing — dead-by-design su testnet (range ~10× under 70b thresholds calibrated for mainnet). CEO parking: no speed_of_rise, accept funding dead, no opp tuning. Zero codice trading toccato. Report 2026-05-14_s77_sentinel_sprint1_audit_report_for_ceo.md.
    ai
  • S78 fase 1 — Primo blog post LIVE (brief 78a) + audit Area 3 marketing/SEO/X
    2026-05-15 commit 18a0362. Blog post 1 'An AI That Can't Trade' (dual-voice origin story Max + BagHolderAI CEO, 76 sessions counter, 7635 byte) copiato in web_astro/src/content/blog/. Frontmatter schema-compliant (type=lesson, volume=1, summary 154/220, tags origin/introduction/behind-the-scenes). Build Astro 12 pagine, route /blog/an-ai-that-cant-trade/, card su /blog index, CTA Payhip Volume 1 (payhip.com/b/a4yMc). Zero touch a schema/componenti/layout. Audit Area 3 (marketing + SEO + X) CON RISERVE consegnato in audit_report del 2026-05-15 (a78c694).
    ai
  • S78 fase 2 — Brief 78b SWEEP/LAST SHOT slippage buffer + blog post 2 + .gitignore anchor
    2026-05-16 commit afd97ce. Diagnosi 3-step ha smentito 2 ipotesi (skim-aware-guard mancante, drift inventory BONK). Root cause: SWEEP/LAST SHOT base_order su cost=cash_before esegue con slippage positivo Binance → cassa va in -$0.44 sul BONK trade 2026-05-15 05:39 (cash_before $45.66 → res[cost] $46.10). By design su testnet (regola Board 'no cash morto') ma mainnet rifiuta -2010 INSUFFICIENT_FUNDS. Fix: SLIPPAGE_BUFFER_PCT = 0.03 uniforme in HardcodedRules, applicato a SWEEP + LAST SHOT cost. Banner 'swept, $X over by slippage' per buysLeft<0. Test 4/4 nuovi + 30/30 non-regression. Restart Mac Mini 21:46 CET PID 33579. Inclusi nello stesso commit: fix .gitignore bare blog/ → /blog/ anchored (S78 drift, evita match ricorsivo su web_astro/src/content/blog/) + pubblicazione blog post 2 'The Day Our Bot Ran Out of Money' commit dcc4372.
    ai
  • S79 — Idle suppression (79a) + TF reactivation Tier 1-2 (79b) + Supabase write-on-change (79c) + drift FIFO sanato
    2026-05-18, 5 commit (1eff58a + 2abd72e + 542b190 + 6183980 + 11b09e8) + 2 restart Mac Mini. (79a) Idle suppression on capital exhausted: guard in grid_bot.py Path A re-entry + Path B recalibrate su _available_cash() < HardcodedRules.MIN_LAST_SHOT_USD (5$). Log + bot_events_log + _last_trade_time advance (no spam). Live verified BTC $0.12 / SOL $0.03 / BONK $0.00 tutti soppressi al primo idle cycle. (79b) TF reactivation Tier 1-2 only (see Phase 2). (79c) Supabase write-on-change + heartbeat 10/10/5 min su sentinel_scores fast / sherpa_proposals / bot_state_snapshots — trigger warning email Supabase 'Disk IO Budget depleting'. unrealized_pnl escluso dal compare snapshot (cambierebbe ogni tick). ~80% riduzione write/giorno idle attesa. Bootstrap restart consistente (legge last row anche se heartbeat-only). (drift FIFO) Bug S70c chiuso post-72a (sell_pipeline.py:409 fa revenue - cost_basis - fee netto); 'Strada 2 ~3-4h' → '~30 min'. FIFO cancellato come canonical: Max confermato 'FIFO non esiste, exchange non ragiona così'. Bot usa avg-cost, P&L 'vero' = Equity (cash + holdings × spot). Memorie aggiornate. Test 31/31 verdi. Hotfix b42e7b0 sherpa 79c: guard switched would_have_changed → proposal_changed.
    ai
  • Blog post 3 LIVE — 'When Your AI CEO Lies About the Numbers' (lesson V2)
    2026-05-19 commit 02d8eb7. Diary post on 3 fabrications in one session + human-as-defense-against-hallucination thesis. Frontmatter schema-compliant (type=lesson, volume=2, summary 167/220, tags ai-honesty/llm-limitations/transparency/lessons-learned). Build Astro verde, route /blog/when-your-ai-ceo-lies-about-the-numbers/. CTA Volume 2 (payhip.com/b/NHw53).
    ai
Phase 9

Validation & Control System

23/52
● Living milestone ● active

The single source of truth for every quality check. Lives as long as the bot lives — paper, pre-live, live, scaled — and grows with it. Numbers, surfaces, documentation, project health, pre-deploy gates, and live monitoring all flow through here. No new feature is shipped until the checks for the surface it touches are green. · Ongoing — until the system is provably stable

1. Technical integrity — numbers add up, DB is healthy 8/9
  • FIFO queue verification before every sell
    Re-derives the queue from DB on every tick with holdings > 0; auto-corrects on drift.
    ai
  • Health check: FIFO P&L reconciliation
    DB realized_pnl vs FIFO replay per symbol. Boot + daily.
    ai
  • Health check: holdings consistency
    Σ buys − Σ sells = open lots. No silent divergence.
    ai
  • Health check: negative holdings guard
    Refuses to let any symbol go below zero (data corruption canary).
    ai
  • Health check: cash accounting
    capital − bought + sold − skim matches the dashboard cash to the cent.
    ai
  • Health check: orphan lots
    Sells without buy_trade_id that aren't FORCED_LIQUIDATION are surfaced.
    ai
  • DB retention cleanup
    Daily 04:00 UTC. Keeps trend_scans / state snapshots / events bounded so writes stay fast on free-tier IO budget.
    ai
  • Sell audit trail in bot_events_log
    Every percentage-mode sell writes lot price + cost basis + queue depth, so a future report disagreement is replayable.
    ai
  • Schema verification (DB columns vs code expectations)
    ai
2. Surface coherence — every screen tells the same story 0/4
  • Homepage P&L = Dashboard P&L = DB FIFO P&L
    ai
  • Telegram trade notification P&L = DB realized_pnl
    ai
  • tf.html config values = trend_config DB values
    ai
  • grid.html config values = bot_config DB values
    ai
3. Living documentation — roadmap and process don't go stale 7/10
  • Every brief includes a 'Roadmap impact' section
    Process rule, active from session 59. Briefs without the section get bounced before push.
    max
  • Every CC commit updates the roadmap when impacted
    Process rule, active from session 59.
    ai
  • Roadmap staleness alert (>14 days without commits)
    ai
  • How We Work staleness alert (>30 days without commits)
    ai
  • Diary entry in Supabase = diary .docx (session, date, title)
    max
  • Project memories review (obsolescence check)
    S79 (2026-05-18) review effettuato: memorie FIFO-frame ereditate da S65-66 erano stale dopo S69 avg-cost migration. Bonifica project_equity_pnl_vs_fifo + feedback_one_source_of_truth + project_57a_fifo_punto_fisso + project_60c_fifo_init_bug — canonical ora avg-cost + Equity P&L (FIFO non esiste su exchange). Pattern: review opportunistica quando un drift emerge, non scheduled.
    ai
  • Auditor entity & roles formalized (AUDIT_PROTOCOL.md + WORKFLOW.md §G + /howwework v3)
    S75 + S78 (2026-05-13 → 2026-05-15). Auditor = fresh CC session triggered by audits/audit_request_*.md brief, producing audits/audit_report_YYYYMMDD_topic.md. Distinct from Intern (= session CC che ship code). Separation enforced to remove the structural conflict of interest where the executor self-certifies as auditor. /howwework v3 commit f62f781 reflects the entity publicly.
    both
  • PROJECT_STATE §9 vs §10 split (only true audits in §9; sessions shipped in §10)
    S78 commit ef553e1 (2026-05-15). Pre-fix, CC was populating §9 with its own shipped sessions labeled 'Area 1', so the cadence check always looked fresh even though no true audit had ever run. Rule: §9 entry exists iff audits/audit_report_YYYYMMDD_topic.md file exists. Cadence count is on files, not on §9 rows. CC may never write a §9 row for a session in which it shipped code.
    both
  • PROJECT_STATE compaction pattern (append-on-compaction archive)
    S79 commit 5561d13 (2026-05-18). When PROJECT_STATE.md > 40KB, sections to be removed are first appended to audits/PROJECT_STATE_archive.md with header '## Rimosso in sessione SXX (YYYY-MM-DD) — <ragione>'. The archive is a single growing file, read on-demand. Never delete history in place. Formalized in CLAUDE.md §2.
    ai
  • Audit cadence rules formalized (Area 1: 30d, Area 2: 90d or end-of-volume, Area 3: 90d)
    CLAUDE.md §1. Each end-of-session CC computes the youngest audits/audit_report_*.md per area; if older than the cadence (or never existed) the closing report flags '⚠️ Audit Area X dovuto: ultimo era YYYY-MM-DD (N giorni fa)'. As of 2026-05-27: Area 1 last 2026-05-08 (19d, approaching the 30d backstop), Area 2 completed 2026-05-27 (CON RISERVE — public site drift + process gaps, 0 CRITICAL), Area 3 last 2026-05-15 (12d, ok). Cadence reformulated from time-based to event-based — see AUDIT_PROTOCOL.md §2.
    both
4. Project health — costs, deploys, backlog hygiene 0/4
  • Live site (bagholderai.lol) matches the latest Vercel deploy
    ai
  • Monthly infra costs vs bot revenues
    Manual review by CEO + Board, monthly.
    both
  • Briefs open >14 days without deploy
    ai
  • DB disk usage + IO budget monitoring
    ai
5. Pre-deploy gates — code review before push (parked) 0/3
  • Critic agent: brief vs diff (Claude API, paid)
    Parked. Reconsider once sections 1–4 are stable.
    ai
  • Smoke test post-deploy (60s dry-run)
    Parked.
    ai
  • Auto-revert on crash
    Parked.
    ai
6. Pre-live gates — green checks before the first €100 of real money 7/12
  • FIFO integrity shipped and stable
    Superseded by S69 avg-cost migration (cb21179). FIFO accounting layer removed entirely; trigger sell now reads avg_buy_price. fifo_queue.py deleted. Strict-FIFO replay rimosso dalle dashboard.
    ai
  • Zero FIFO drift alerts for 7 days
    Cancelled: FIFO drift can't exist without FIFO. Replaced by 'avg-cost identity Realized + Unrealized = Total P&L closing at the cent'.
    ai
  • Health check passes 100% for 7 days
    Cancelled S69 with FIFO health check removal ('non voglio più sentire parlare di FIFO' — Board). Replaced by reconciliation Binance Step A + identità avg-cost.
    ai
  • Avg-cost contabile + identità Realized + Unrealized = Total P&L (S66)
    Operation Clean Slate Step 1, 2026-05-08. Identità chiude al centesimo su 50 ops random. Test 5/5 verdi.
    ai
  • Sell-in-loss guard su avg_buy_price (brief 68a, S68)
    2026-05-09. Doppio standard FIFO+avg-cost risolto. Test 8/8.
    ai
  • Strategy A simmetrico: no buy above avg + no sell below avg (S69)
    2026-05-09. Ogni buy abbassa la media, ogni sell è profittevole.
    ai
  • sell_pct net-of-fees + sell ladder graduale (brief 70a, S70)
    2026-05-10. Trigger Grid uniforme con fee buffer round-trip 0.2%, `_last_sell_price` ladder.
    ai
  • Wallet reconciliation Binance ↔ DB (Step A)
    Brief S70 Step A shipped 2026-05-10. scripts/reconcile_binance.py + reconciliation_runs table. 26/26 ordini matched, 0 drift su 2 run.
    ai
  • Wallet reconciliation Step C (nightly cron Mac Mini)
    Shipped S72 (2026-05-11). Cron 03:00 Europe/Rome attivo su Mac Mini, prima run automatica 2026-05-12 ok. TCC FDA per python3.13 abilitata S74.
    ai
  • DB retention stable
    ai
  • P&L netto canonico (Strada 2 — fix realized_pnl per-riga + backfill avg)
    Brief separato post-S70c. realized_pnl per-trade è gross (non sottrae fee sell); avg_buy_price ha bias residuo ~0.1% (fee buy implicita). Fix completo: 3-4h, backfill cumulato avg da inizio storia + verifica identità S66-style.
    ai
  • Board approval (Max)
    max
7. Post-go-live monitoring — once real money is in, the work intensifies 0/4
  • Wallet P&L (Binance fetch_my_trades) reconciled with DB FIFO weekly
    From go-live onward. Drift > threshold raises a Telegram alert.
    ai
  • Spot-price drift alert (DB cost basis vs current Binance price)
    From go-live onward.
    ai
  • Daily wallet snapshot (USDT + holdings × spot) vs equity model
    From go-live onward.
    ai
  • Dust converter via Binance /sapi/v1/asset/dust
    From go-live onward. Avoids real dust accumulating in the wallet.
    ai
8. Process & log hygiene — what the DB checks can't see 1/6
  • httpx / telegram loggers raised to WARNING in all entry points
    2026-05-05. Found by accident: x_poster_approve.log was 23 MB after 19 days, with the Telegram bot token written in cleartext on every line. Root cause: httpx INFO logs every long-poll request as a separate line. Fix touched x_poster_approve.py + orchestrator + grid_runner + trend_follower.
    ai
  • Log file size monitor (alert if a file > 50 MB or growing > 100 KB/day)
    Would have caught the 23 MB x_poster_approve issue on day 2.
    ai
  • Log noise ratio (% of httpx/telegram INFO vs application lines)
    If noise > 95%, the logger is misconfigured.
    ai
  • Process inventory drift (Python processes running > 14 days without restart)
    ai
  • Credential leakage scan (tokens / secrets in log files)
    ai
  • Log rotation on disk (compress or drop > 7 days)
    Extends the DB retention pattern to filesystem logs.
    ai
Phase 14

NewsKeeper — Brain #5

2/4
● active

The fifth brain, and the only one that reads words instead of prices. NewsKeeper watches crypto news the way Sentinel watches the order book — to spot trouble before it hits the chart. Crash analysis of May 18-22 showed Sentinel's signals are reactive (it sees the crash while it happens) while news signals are predictive (days of warning). Board decision S82 (2026-05-23): the system does not go live with real money until it reads the news. It runs as its own process (not orchestrator-managed), with its own Supabase table and its own loop — deliberately separate from Sentinel. · Standalone — added S83 (2026-05-24)

  • NewsKeeper Sprint 1: RSS feed collection + regex classifier
    S83, 2026-05-24 (commit 49473a9). 3 feeds (CoinDesk, CoinTelegraph, Decrypt), 15-min loop, standalone process on the Mac Mini. Pivot from CryptoPanic (free tier discontinued 2026-04-01) to zero-auth RSS. Classifier is regex-based with a known ~60% false-positive rate — shipped as-is for a 7-day observation window (data-first, calibrate later).
    ai
  • NewsKeeper Sprint 2: Haiku-based classification (replace regex)
    S94a (2026-06-01). Haiku assigns sentiment/severity per headline instead of keyword matching (~€1/month). The T+7 review then showed per-item severity was the wrong unit → it evolved into the v2 'barometer' (below).
    ai
  • NewsKeeper v2 'barometer': 3-state aggregate regime (bear / neutral / bull) — shadow LIVE
    S100 (2026-06-09, commit c8774db). Architecture C: Haiku decides each item's polarity, event-level dedup, confidence-weighted vote → one daily climate reading instead of per-item alerts. Runs shadow alongside v1 on the Mac Mini (not yet wired into Sentinel). Falsifiable gate: validate the regime flips against BTC's 24h forward price (NOT Fear & Greed — circular), verdict at T+14 (~2026-06-23) → promote (wire to Sentinel) or retire (→ /news + 'failed experiment' post).
    ai
  • Strategy Orchestrator: unified Sentinel + NewsKeeper recommendations via Haiku
    ~4 CC sessions estimated. A Haiku layer that fuses the macro signals (regime + news) into a single recommendation stream the Board can read.
    ai
Versione 1.54 — Agosto 2026 · last updated August 7, 2026