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.
- completed
- 359
- remaining
- 54
- total tasks
- 413
- progress
- 87%
Phase 0 Foundations
10/10 complete
Foundations
10/10Without this, nothing works. · Week 1
- ✓ maxChoose name → BagHolderAI3 hours. Discovered a shitcoin stole our name first.
- ✓ maxRegister domain bagholderai.lol$1.54 on Porkbun. GoDaddy wanted $53 for renewal.
- ✓ maxBinance account + KYC
- ✓ maxAPI keys (read + trade, NO withdraw)Defense in depth. Even if I go rogue, your money stays.
- ✓ maxTelegram bot
- ✓ aiPython environment + dependencies
- ✓ bothGitHub repository
- ✓ aiSupabase database (7 tables)
- ✓ bothAgent personality & tone defined90 minutes. Max said 'molto quick'.
- ✓ maxDedicated email (proton.me)
Phase 1 Grid Bot + Paper Trading
15/15 complete
Grid Bot + Paper Trading
15/15The heart of the system. Closed Session 20, April 5 2026. · Weeks 2-3
- ✓ aiGrid Bot engine (paper trading)5/5 tests passed. Fought Python versions for an hour.
- ✓ aiLogging trades to SupabaseSession 07. The filo was already there.
- ✓ aiTelegram notifications (trade alerts + daily report)Session 07. First message: 🚀 BagHolderAI started.
- ✓ aiAdmin dashboard (private, for Max)Session 17. Password-gated, mobile-responsive.
- ✓ aiPublic dashboard v1Session 14. Dashboard is now the homepage.
- ✓ bothLanding page with diary updates
- ✓ bothFirst diary post on dashboardSession 14. CEO's Log with Haiku commentary.
- ✓ bothTest 2-3 different tokens (BTC, SOL, BONK)Session 09. Three grids running in parallel.
- ✓ aiMulti-token support (--symbol parameter)Session 09. Dynamic config per asset.
- ✓ aiPublic dashboard: CEO's Log + Numbers + Under the HoodSession 14. Static HTML + Supabase REST.
- ✓ aiAdmin dashboard with parameter editingSession 17. SHA-256 auth, live config updates.
- ✓ aiPercentage grid: buy_pct / sell_pct in bot_configSession 18. BTC 1.8/1.0, SOL 1.5/1.0, BONK 1.0/1.0.
- ✓ aiBot reads config from Supabase (refresh every 5 min)Session 18. No more code changes to tweak parameters.
- ✓ aiAdmin dashboard: buy_pct / sell_pct / grid_mode fieldsSession 19. Confirmed working.
- ✓ bothActivate grid_mode=percentage and beta testSession 20. Activated with a side of phantom money.
Phase 2 Trend Follower
12/13 ● active
Trend Follower
12/13Three-layer architecture: Trend Follower (brain) → Runner (manager) → Grid Bot (executor). Designed in Session 31, spec v1 closed. · Weeks 3-4
- ✓ aiEMA, RSI, Volume indicatorsSession 31. EMA 20/50 + RSI 14 + ATR 14 on 4h candles. Spec v1.
- ✓ aiTrend Follower ↔ Grid Bot interactionSession 31. TF writes to bot_config, grid reads. Bullish/bearish/sideways grid profiles defined.
- ✓ bothHuman cooldown override on bot_config (architecture)Session 31. 48h per-coin veto. managed_by + manual_override_until columns live.
- ✓ aiRunner/Orchestrator process managerSession 35b. One process manages 3 grid bots + TF, graceful shutdown, crash-restart with retry cap.
- ✓ aiSupabase schema: trend_config, coin_tiers, trend_decisions_logSession 31. Phase A complete.
- ✓ aiCoin 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.
- ✓ aiScanner: top 50 coins by volume + signal classifierSession 31 + 35 (tiered scanning A/B/C).
- ✓ aiAllocator: select top N, respect tiers, write bot_configSession 36a. Now uses tf_max_coins (default 2) instead of fixed 5. MANUAL_WHITELIST protects BTC/SOL/BONK.
- ✓ aiDashboard: Trend Follower statusSession 36b. /tf control room — budget, deployed, decisions log, TF-only view.
- ✓ bothParameter calibration from dataBrief 36c: ATR-based buy_pct/sell_pct + full tf_budget deployment. Extended in 36e (rotation + ATR clamps) and 36g (compound via floating cash).
- ✓ aiTF 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).
- ✓ aiFirst 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.
- aiAuto-clean policy for trend_decisions_log (90 days)
Phase 3 AI Sentinel + Sherpa
13/14 ● active
AI Sentinel + Sherpa
13/14Two 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
- ✓ aiSentinel 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.
- ✓ aiSherpa Sprint 1: rule-based proposals on GridSession 56 (2026-05-06). Loop every 120s reads Sentinel scores + writes sherpa_proposals. SHERPA_MODE=dry_run never touches bot_config.
- ✓ aiSentinel 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.
- ✓ aiDRY_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.
- ✓ aiSentinel 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.
- ✓ aiSentinel 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.
- ✓ aiSentinel Sprint 2 observation window 1 (5-7 days)Completed 2026-05-22. 32 slow records, zero gaps > 6h. Natural window closed, Brain Analysis triggered.
- ✓ aiBrain Analysis #1 — Sentinel + Sherpa evaluationS80a, 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.
- ✓ aiSherpa 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.
- ✓ aiSherpa 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.
- ✓ aiSherpa 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.
- ✓ aiSherpa 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.
- aiAuto-generated daily diary
- ✓ aiDashboard: 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.
Phase 4 Dashboard + Monetization
26/27 ● active
Dashboard + Monetization
26/27The dashboard is the product. The guides are the revenue. · Weeks 5-6
- ✓ bothProfessional UI designSessions 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.
- ✓ aiDashboard rewrite: Astro + React islands + Supabase pollingInitially 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.
- ✓ bothDeploy on Vercel + custom domain
- ✓ aiEnglish localizationSite fully in English from the start.
- ✓ bothChina accessibility (no blocked services)Session 08. Max's friend in China confirmed.
- ✓ maxCrypto-native ads (A-Ads live, upgrade later)Register first, customers second.
- ✓ aiDonation buttonSession 27. Buy Me a Coffee active at buymeacoffee.com/bagholderai.
- ✓ bothTelegram bot (reports only, never signals)MiFID II compliance. Transparency, not advice.
- ✓ bothVolume 1 (Fase 0+1): outline, packaging, cover artSession 26. Content-complete. Cover art designed with CEO, PDF assembled.
- ✓ maxSetup payment platformSession 34. LemonSqueezy rejected (crypto risk flag). Migrated to Payhip — live in 20 minutes.
- ✓ aiLanding page /library on bagholderai.lolSession 30. Cover, description, preview PDF download. Session 34: Payhip checkout live, button active. Session 7 (web_astro): renamed /guide → /library.
- ✓ bothItalian preface (Max writes, AI translates)Session 25. Max wrote IT, CEO translated EN.
- ✓ aiBlueprint translation (IT→EN)Session 25. Faithful translation, historical document.
- ✓ aiCEO Introduction for Volume 1Session 25.
- ✓ bothDedication pageSession 25. Four hands.
- ✓ aiGlossary (Appendix D)Session 25. 37 terms, organized by topic.
- ✓ bothScreenshot placement mapSession 25. 9 screenshots mapped to sessions.
- ✓ bothBook title decidedSession 26. Picked together with the CEO.
- ✓ bothCover art designedSession 26. Designed together with the CEO.
- ✓ bothVolume 1 content-completeSession 26. All chapters, appendices, glossary, intros — locked.
- ✓ bothFinal assembly into PDFSession 26. Almost there — last typographic passes pending.
- ◐ bothEditorial plan X: first 5-10 posts from diary9 posts published, schema defined. Ongoing.
- ✓ bothPublish Volume 1Session 34. Live on Payhip at €4.99.
- ✓ bothPublish Volume 2From Grid to Brain. 29 sessions. Live on Payhip at €4.99.
- ✓ bothPublish Volume 3From 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.
- ✓ aiHomepage 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.
- ✓ aiHomepage 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.
Phase 5 Extended Paper Trading
0/7 planned
Extended Paper Trading
0/7Minimum 4 weeks. No live trading without this phase. · Weeks 6-10
- bothPerformance analysis (min 4 weeks)
- aiAuto-generated rules (first generation)
- bothOptimize Grid + Trend Follower parameters
- aiFix bugs and edge cases
- maxStrategy B: active at launch? Data-driven decision
- aiWeekly learning reports
- bothStress test with allocation >$500 in paper mode
Phase 6 Go Live
9/12 ● active
Go Live
9/12This 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
- ✓ aiVenue pivot to Kraken (MiCA): dormant exchange adapter behind a flagS112b (2026-06-30). Binance EU suspended spot orders on July 1 (MiCA). New venue: Kraken, USD pairs. Adapter shipped dormant — testnet behaviour untouched.
- ✓ aiKraken API plumbing check: clock, pairs, auth, real fees, validate-only orders2026-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.
- ✓ aiCutover Fase 1: grid wired to the Kraken adapter (per-row venue), dynamic live fee, fee-aware profit floorS118 (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.
- ✓ maxGO/NO-GO decision based on dataBoard 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.
- ✓ maxDeposit initial capitalFunded 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.
- ✓ aiSwitch 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.
- ✓ aiFase 2a — one real order, placed and confirmed by hand2026-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.
- ✓ aiFase 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.
- ✓ aiFase 3 — scale to $400, two coins, Binance testnet retiredS125 (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.
- maxIntensive monitoring (first week)
- bothVPS migration for stability
- maxGradual scale beyond $400
Phase 7 Marketing & Growth
7/14 ● active
Marketing & Growth
7/14We don't promote. We document. The audience finds us. · Parallel from Phase 1
- ✓ bothFirst posts on X (@BagHolderAI)Session 08. Thread pinned. One post per day.
- ✓ aiDev.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.
- ✓ aiHomepage 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.
- ✓ aiSEO 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).
- ✓ aiRSS 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.
- ✓ aiFull 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.
- ✓ aiTelegram 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.
- bothContact AI community influencers
- ◐ bothReddit 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.
- bothDashboard demo thread on X
- bothGuide: 'How I built an AI trading agent'
- ◐ bothDevelopment diary as sellable contentVolume 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.
- maxMiFID II verification for future copy-trading
- bothFree guide for influencer outreach
Phase 8 Backlog — Polish & Improvements
242/245 ● active
Backlog — Polish & Improvements
242/245Everything 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
- ✓ aiFix accounting: avg_buy_price, grid reset, daily P&LSession 09. 5 bugs found, 5 bugs fixed.
- ✓ aiPer-asset Telegram reports (symbol + config filter)Session 10. Each bot reports its own trades.
- ✓ aiWide grids + buy cooldown + min profit targetSession 10. Philosophy: holder, not scalper.
- ✓ aiAvailable capital in grid reset logicSession 10. Prevents overspending.
- ✓ aiData versioning (config_version v1/v2/v3)Session 10+13. v3 reset: clean slate, no inherited positions.
- ✓ maxSupabase connector for direct CEO data accessSession 11. The CEO finally has eyes.
- ✓ aiConsolidated portfolio report (total value vs initial capital)Session 12. Fixed P&L: was +$270 (wrong), now -$10.63 (correct).
- ✓ aiDaily snapshot saved to daily_pnl tableSession 12. Dashboard-ready with JSONB positions.
- ✓ aiPrivate daily report redesign (per-asset cards)Session 12. Full portfolio + technical cards.
- ✓ aiPublic daily report for Telegram channelSession 12. Zero jargon, readable by anyone.
- ✓ aiRename 'Cost' to 'Revenue' on sell notifications
- ✓ aidaily_commentary table for AI CEO voiceSession 13. Haiku writes the CEO's daily log.
- ✓ aiconfig_changes_log table for parameter trackingSession 13. Feeds Max's changes into the AI narrative.
- ✓ aiFix restore_state_from_db: config_version filterSession 13. v1/v2 cross-contamination fixed.
- ✓ maxFix public Telegram report (.env config)Session 13. Silent failure — env vars missing on Mac Mini.
- ✓ bothDashboard becomes homepage, /diary for construction logSession 14. Visitors see data first.
- ✓ aiNav bar on all site pagesSession 14.
- ✓ aiHaiku commentary call at 21:00Session 14. First output: 'a shopping spree.'
- ✓ aiRLS policies for public dashboard readsSession 14+17. anon SELECT on all public tables.
- ✓ bothBlueprint page on site (/blueprint)Session 15.
- ✓ aiBONK micro-price formatting ($0.00 fix)Session 15. fmtPrice() for micro-prices like BONK.
- ✓ aiAnti-duplicate trade trigger (5s window)Session 15. DB-level race condition prevention.
- ✓ aiAnti-short-sell trigger (DB-level)Session 15. Blocks sells when holdings insufficient.
- ✓ aiHoldings/cash verification on every trade notificationSession 15.
- ✓ maxEnvironment alignment (MacBook Air + Mac Mini)Session 15. Same env vars, config, Python version.
- ✓ maxREPORT_HOUR 21→20 (more time to react)Session 15.
- ✓ aiReceived breakdown in terminal (cost basis + profit)Session 15.
- ✓ aiFix symbol filter bug in daily reportSession 16.
- ✓ aiDiary entries migration from JSON to SupabaseSession 16. diary.html reads from Supabase REST API.
- ✓ aiNo-funds buy guard (block trade + Telegram alert)Session 16.
- ✓ aiNo-holdings sell guard (block trade + Telegram alert)Session 16.
- ✓ aiHaiku Day 3 stale data fixSession 16. test_commentary.py was using cached data.
- ✓ aiTelegram footer v2→v3Session 16.
- ✓ bothGrid parameter evaluation post cash-zeroSession 17. Data-driven recalibration.
- ✓ aiBONK $0.00 fix in terminal logsSession 18. Dynamic decimal formatting.
- ✓ bothCapital redistribution: BTC $200 / SOL $150 / BONK $150Session 18. Up from $100/$50/$30 with $320 idle.
- ✓ aiTelegram silent failure logging (warnings)Session 19. All 8 sync methods now wrapped.
- ✓ aiFallback colors for new asset symbols on dashboardSession 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.
- ✓ aiBinance API retry with exponential backoffSession 19. 3 retries (2s/4s/8s) before propagating error.
- ✓ aiProactive Telegram alerts (capital exhausted + loop errors)Session 19. Max's idea. Bot now tells you when it's sick.
- ✓ aiFix sell_pct in percentage mode (lot price vs avg)Session 20. Was selling in loss thinking it was profit.
- ✓ aiConfig change notification filtered by symbol (9→3)Session 20. Each bot notifies only its own coin.
- ✓ aiConfig change shows old → new parameter valuesSession 20.
- ✓ aiAnti-duplicate daily report guardSession 20. Flag set at entry, not exit.
- ✓ aiTrade P&L per single sell in Telegram notificationsSession 20. Individual + portfolio P&L.
- ✓ aiKeyboardInterrupt during error sleep sends stop messageSession 20.
- ✓ aiSkip first buy on mode switch if holdings existSession 20. No phantom first buy.
- ✓ aiBuy skipped spam throttle (once per level/cash)Session 20.
- ✓ aiProfit skimming (reserve_ledger + skim_pct)Session 20. Micro-profit reserve. Default 0, ready to activate.
- ✓ aiCash reconstruction from DB on restoreSession 20. Phantom money bug killed. Bot replays trade history.
- ✓ aiCash audit script (scripts/cash_audit.py)Session 20. Read-only verification of all coin positions.
- ✓ aiAdmin UI: capital_per_trade and skim_pct as common paramsSession 20. Visible in both grid modes.
- ✓ aiSkim reserve display in P&L Breakdown on homepageSession 21. Reserve accantonato visible alongside realized + unrealized.
- ✓ aiFix TradeLogger crash (trade_pnl_pct parameter)Session 21.
- ✓ aiRemove hardcoded 2% min profit targetSession 21. Min profit is now a configurable parameter, default 0.
- ✓ aiFix P&L % in Telegram messages (was showing 0.00%)Session 21.
- ✓ aiPer-coin reserve label in Telegram messagesSession 21. Each notification shows its own skim reserve total.
- ✓ aiRace condition daily report: INSERT ON CONFLICT DO NOTHINGSession 21. Only first bot to write wins — others skip silently.
- ✓ aiSELL SKIPPED spam dedup (same pattern as BUY SKIPPED)Session 21. Dedup by level_price + holdings, same logic as buy.
- ✓ aiAdmin dashboard: live portfolio value from Binance pricesSession 22. Real-time prices replace stale DB avg.
- ✓ aiAdmin dashboard: full trades history + CLOSED position displaySession 22. CLOSED badge, all historical trades visible.
- ✓ aiAdmin dashboard: auto-refresh every 30sSession 22.
- ✓ aiAdmin Portfolio Overview: 2-row 6-card layout (value/P&L/skim + cash/deployed/unrealized)Session 22. One glance = full picture.
- ✓ aiFix FIFO sell blocking: all triggered lots sell independentlySession 22b. Bot was stuck: older lot not triggered blocked all younger profitable lots.
- ✓ aiGrid mode hot-reload without restartSession 22b. Changing grid_mode in Supabase now re-initializes state mid-run.
- ✓ aiDashboard: cashLeft for closed positions = alloc + realized P&L − skimSession 22b. Portfolio Value was underestimating closed positions.
- ✓ aiDashboard: 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.
- ✓ aiIdle 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.
- ✓ aiSelf-healing: re-init from DB when holdings>0 but FIFO queue emptySession 22b. State divergence self-heals without restart.
- ✓ aiDashboard: Promise.allSettled + auto-refresh 10sSession 22b. Resilient load — one slow API never blocks the rest.
- ✓ aiFix idle re-entry timezone (.astimezone UTC)Session 22b. Restored _last_trade_time was off by TZ offset; now always UTC-naive.
- ✓ aiIdle re-entry diagnostic log (hourly countdown visible)Session 22b. Logs elapsed/threshold at each hour boundary — silent no more.
- ✓ aiFix 'Reserve Accumulata' → 'Accumulated Reserve' in daily reportSession 22b. Italian label removed from English report.
- ✓ aiHaiku commentary: 24h rolling window for config_changesSession 26. Was 'today midnight UTC' (= 02:00 italian) and missed late-day changes.
- ✓ aiFix admin payload bug: config_changes_log was silently failing for 5 daysSession 26. Payload used 'field:' but column is 'parameter'. Try/catch hid the error since S18b. Backfilled 4 missed entries manually.
- ✓ aiAdmin: sanitize comma → dot on save (iOS Italian decimal locale)Session 26. type=text inputmode=decimal + comma normalization + isNaN guard.
- ✓ aiIndex dashboard: layout restructure (today log → numbers → archive)Session 26. CEO's Log Archive moved below The Numbers.
- ✓ aiIndex dashboard: live numbers from trades + Binance pricesSession 26. Was reading from daily_pnl snapshot (20:00 only) — SOL showed $0.00 mid-day. Now mirrors admin strategy with FIFO + live prices.
- ✓ aiIndex dashboard: 5-min auto-refresh + 'Updated at HH:MM' timestampSession 26. Numbers section refreshes without page reload.
- ✓ aiAdmin 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.
- ✓ aiAdmin coin cards: 'Grid capacity' → 'Open lots N/max filled'Session 26. Old formula (buy_count - sell_count) went negative when sells outnumbered buys.
- ✓ aiAdmin overview: 'Deployed' from openCost instead of netSpentSession 26. Cash + Deployed now equals Portfolio Value (mod unrealized).
- ✓ aiAlign all user-facing time references to 20:00Session 26. commentary.py, test_report.py, index.html all said 21:00 or midnight from earlier sessions.
Phase 2 — Trend Follower 40/40
- ✓ aiTF 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.
- ✓ aiTF hotfix: grid_levels/grid_lower/grid_upper placeholders on INSERT (NOT NULL)Session 36a same day. 10/0/0 dummies, unused in percentage mode.
- ✓ aiTF 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.
- ✓ aiTF hotfix: skim_pct=30 on INSERT (match manual bots)2026-04-16. TF profits were fully reinvested, reserve stayed $0.
- ✓ aiHome + Admin: filter TF coins/trades to preserve $500 manual baseline2026-04-16. managed_by=neq.trend_follower on queries. /tf owns the TF view.
- ✓ aiTF full budget deployment: equal-split + dynamic capital_per_tradeBrief 36c. tf_budget split across tf_max_coins, capital_per_trade = alloc / tf_lots_per_coin. Deployed 2026-04-16.
- ✓ aiTF 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%.
- ✓ aiprofit_target_pct unit mismatch: UI label vs DB value vs grid_bot decimalBrief 36d. TF INSERTs profit_target_pct=0 (bypass); unit kept as percent, grid_bot divides by 100 consistently.
- ✓ aiTF coin rotation: SWAP on stronger BULLISH + DEALLOCATE on BEARISHBrief 36e + 36e_v2. Signal strength delta gate, cooldown, profit gate on SWAP, on-demand rescan for active coins missing from top-N.
- ✓ aiTF compounding via floating cash lookupBrief 36g. tf_total_capital = tf_budget + retained profits from deallocated TF bots.
- ✓ aiTF stop-loss + bearish exit override Strategy ABrief 39a. Unrealized loss > tf_stop_loss_pct (10% of alloc) triggers full liquidation; pending_liquidation=true forces sell at any price.
- ✓ aiMBOX 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).
- ✓ aiTF riding mode (trailing stop) for strong bullish pumpsBrief 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.
- ✓ aiTF idle re-entry fast for active botsBrief 36i → shipped across Sessions 33 + 45. TF bots default to 1h, manual to 24h. Unsticks bots with dust residuals.
- ✓ aiHaiku 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.
- ✓ aiTF hot-reload of safety params in live grid_runnersBrief 39j (2026-04-20). tf_stop_loss_pct + tf_take_profit_pct polled from trend_config every 300s without restart.
- ✓ aiTF multi-lot entry + greed decay take-profitBrief 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.
- ✓ aiTF 42a fixes: single-buy aggregated + greed decay authoritative from t=02026-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.
- ✓ aiTF allocator pre-rounds per-level amount before filter check2026-04-20 evening. Strong bullish candidates with integer step_size were SKIPped for fractional alignment; allocator now rounds before validate_order.
- ✓ aiTF 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.
- ✓ aiTF ALLOCATE atomic — retrocede decision on bot_config INSERT failureBrief 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.
- ✓ aiTF 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.
- ✓ aiTF sell_pct as deterministic post-greed-decay salvageBrief 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.
- ✓ aiTF 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.
- ✓ aiTF tier-map collision fix + tier-weighted resizeBrief 45d (2026-04-23). active_tier_map dict→set fixes silent overwrites; resize_active_allocations now applies per-tier weights instead of equal-split.
- ✓ aiTF Telegram scan report: escape '<' in tier label45c hotfix (2026-04-23 16:15). Literal '<$20M' in T3 label parsed as HTML tag; replaced with '<'.
- ✓ aiTF 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.
- ✓ aiTF 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.
- ✓ aiTF counterfactual tracker for distance-filter skipsBrief 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?'.
- ✓ aiTF scan cadence to 30 min + trend_scans TTL 14dBrief 47c (2026-04-25). 2× more 'looks' at the market. cleanup_old_trend_scans() retains 14 days to stay within Supabase Free 500MB.
- ✓ aiTF 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.
- ✓ aiTF 45g Gain-Saturation Circuit Breaker + 45f hot-reload fixBrief 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.
- ✓ aiTF 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.
- ✓ aiTF 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.
- ✓ aiTF 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.
- ✓ aiTF mid-tick DEALLOCATE signal CHECK hot-fixHot-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.
- ✓ aiTF 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).
- ✓ aiTF 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%).
- ✓ aiTF exit protection holes — peak reset on buy + SL/TP on open valueDiagnosed + 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.
- ✓ aitf_grid exit redesign — trailing stop replaces Profit LockBrief 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.
Phase 3 — AI Sentinel 0/0
Phase 4 — Dashboard & Monetization 15/15
- ✓ aiDashboards: 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.
- ✓ aiTF dashboard: compact row for deallocated coins2026-04-18. One-liner per deallocated coin under 'Previous coins', ~40px vs 300px full card.
- ✓ aiTF dashboard: effective budget line (tf_budget + floating)Brief 36g telemetry. Shows 'TF budget: $100 base + $X floating = $Y effective'.
- ✓ bothSite analytics (Umami Cloud)2h the hard way, 5min the right way.
- ✓ bothVolume 1: structure defined (preface, intro, 23 sessions, appendices, glossary)Session 23.
- ✓ aiEditorial template approved (EB Garamond, uniform styles)Session 24.
- ✓ aiBatch reformat 24 files with uniform templateSession 24. 23 diary + How We Work.
- ✓ aiFix Word styles (Heading 1/2 for TOC) on 24 filesSession 24.
- ✓ aiX editorial plan: Posts_X_v3, 9 posts ready (≤280 chars)Session 23.
- ✓ maxPayment platform decision (Gumroad → LemonSqueezy → Payhip)Session 27 + Session 34. LemonSqueezy rejected at KYB (crypto risk), pivoted to Payhip in same session.
- ✓ aiAdd donation buttonSession 27. Buy Me a Coffee active.
- ✓ aiMemory audit: purged 15 duplicate memory edits, established correction-only policySession 29.
- ✓ bothDiscovered Anthropic docx→text conversion in project files, new diary workflow (template via chat)Session 29.
- ✓ bothRoadmap workflow: HTML-only, killed routine docx generationSession 29.
- ✓ aiProject instructions backup (BagHolderAI_Instructions_Backup.md)Session 29.
Phase 5 — Extended Paper Trading 0/0
Phase 6 — Go Live 0/0
Phase 7 — Marketing & Growth 8/8
- ✓ aiPosting Strategy defined4 content pillars. 10 ready-to-publish posts.
- ✓ aiPosting Strategy v1.1: variable reinforcement + flag-it-when-it-happensSession 11. No calendar. Publish when it matters.
- ✓ bothPosts on X with @BagHolderAI (22 posts, first autonomous AI post live)Session 33. AI → Telegram approval → Tweepy. Signed posts.
- ✓ bothPublic roadmap page on siteYou're looking at it.
- ✓ bothHow We Work page on siteSession 12. The process is the product.
- ✓ bothTelegram channel for daily reportsSession 12. Daily reports broadcast to the channel.
- ✓ bothDiary page on site (/diary)Session 14. Construction log has its own page.
- ✓ aiX scanner weekly cron2026-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.
Open backlog 22/25
- ✓ aiExchange filters: direct step_size read, Decimal rounding, BTC sells unblockedSession 33. precision.amount was misinterpreted as decimal count.
- ✓ aiDust: round buy amount to step_size (3 callsites)Session 33. SOL dust was eating ~15% of per-trade profit.
- ✓ aiprofit_target_pct: propagation fix + admin field + sublabelsSession 33. Ghost parameter was blocking all BTC exits.
- ✓ aiAdmin: Allocation ($) moved to Trading Parameters (always visible)Session 33.
- ✓ aiIdle recalibrate: Path A (re-entry) vs Path B (reset reference, no buy)Session 33.
- ✓ aiIdle recalibrate: stop spam (self-heal was clobbering _last_trade_time)Session 33.
- ✓ aiEconomic dust: MIN_NOTIONAL lots popped from sell queue (no spam)Session 33.
- ✓ aiUmami: data-domains corrected to bagholderai.lol + www variantSession 33. 4 days of analytics lost from typo.
- ✓ aiRefund policy: no-refunds for digital goods (EU Dir. 2011/83 Art 16m)Session 33. Free preview as try-before-you-buy.
- ✓ aiX poster system: Haiku draft → Telegram approval → TweepySession 33. AI-authored posts with human gate.
- ✓ aiX poster: 250-char limit, bagholderai.lol signature, specific error logsSession 33. Iterative refinement.
- ✓ aiX poster v3: latest diary + 24h config changes + Supabase pending + 36h stalenessSession 36. Drafts survive restarts via Supabase.
- ✓ aiTrend-follower: signal=NO_SIGNAL for coins absent from scanSession 33.
- bothX API cost monitoring ($0.01/post)Discovered Session 33. Not free.
- ✓ aiSmart last-lot logic: sell all remaining / buy all in + reset referenceBoth branches live in grid_bot. Reference resets to sell price after all lots sold.
- aiCommentary archive after 7 days on dashboardNot urgent until 20-30 entries accumulate.
- bothBusiness plan: monthly running costs vs micro-profitsDeferred until project is stable.
- ✓ bothActivate skim_pct on all coins (paper mode)Reserve accumulation active on all 3 grid instances.
- ✓ aiAlert: bot active with capital but 0 trades for X hoursIdle re-entry alerts fire on Telegram. TF bots default to 1h, manual to 24h.
- ✓ aiTelegram sell message translated to EnglishSession 27.
- ✓ aiP&L breakdown redesign: realized split (reinvested/skimmed), skim % of profits, 2×2 grid layoutSession 27.
- ✓ aiFooter disclaimer on all pages (WIP + contact email)Session 27.
- ✓ aiCover image optimized for web (4.3MB PNG → 54KB JPEG)Session 30. sips resize 600px, quality 85.
- ✓ aiUmami: data-domains restricted to bagholderai.lol (no local dev tracking)Session 30.
- ✓ aiUniform bottom bar on all pages + footer mailto linkSession 30. Consistent cta-link bar.
Phase 9 — Validation & Control System 0/0
Phase 10 — Infrastructure & Observability 15/15
- ✓ aiOrchestrator graceful shutdown propagates to subprocesses2026-04-17. SIGINT to children so KeyboardInterrupt handlers run.
- ✓ aiOrchestrator shutdown race: stop-loss vs daily-PnL floor2026-04-18. Daily-PnL short-circuit was beating pending_liquidation cleanup, causing orchestrator to respawn the bot.
- ✓ aiLogs unified under /Volumes/Archivio/bagholderai/logs/2026-04-18. x_poster/ subfolder joins grid_*.log + orchestrator.log + trend_follower.log.
- ✓ aiQuieter Telegram: single summary on orchestrator start/stop2026-04-18. Per-bot started/stopped suppressed; exceptional events still notify.
- ✓ aiOrchestrator rate-limit for main-loop exception TelegramBrief 44a (2026-04-21). 15-min cooldown on the send; logging unchanged.
- ✓ aiObservability v1: bot_events_log (structured event log)Brief 43a (2026-04-20). 15 call-sites emitting severity/category/event/details JSONB. Non-raising contract.
- ✓ aiObservability v1: bot_state_snapshots every 15 minBrief 43b (2026-04-20). Captures holdings, avg_buy, cash, unrealized/realized PnL, open lots, greed tier, safety flags.
- ✓ aiOrphan-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.
- ✓ aiOrchestrator spawns on is_active=True regardless of pending_liquidation2026-04-21. Follow-up to 45. Filter loosened: is_active=True alone is enough.
- ✓ aiUI /tf + /admin: simpler Total P&L subtitle + dedicated Fees card + dust filter2026-04-21. Replaced old subtitle with '= Net Worth − starting capital'. Dust v3 filters holdings × price < $5.
- ✓ aiUI /tf: closed-cycles banner uses realized_pnl + idle-cash alert fix2026-04-20. Banner switched to sum(realizedPnl) for consistency with Previous coins list.
- ✓ ai47a counterfactual batch limit raised 100→5000Session 48 (2026-04-26). 100-row cap produced permanent backlog; raise to 5000 drained it.
- ✓ aiReports & 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.
- ✓ aiFIFO integrity — 4 fixes + dust hotfix2026-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.
- ✓ aiDB retention policy2026-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.
Phase 11 — Website Restructure & Analytics 18/18
- ✓ aiSite restructure: narrative landing + dedicated /dashboardBrief 'Site Restructure' (2026-04-22/23). Landing rewritten as storytelling. All data widgets moved to /dashboard route.
- ✓ aiUnified header/nav across all 10 public pagesSession 45. 7 links + current-page highlighted. Subtitle has fixed 2-line min-height as visual anchor.
- ✓ aiSitewide width bump to 880px (from 720px)Session 45. Original layout felt cramped once the new header took over.
- ✓ aiDashboard fade-in fix: no AADS layout shiftSession 45. Wrapper always in flow with placeholders, staggered fade-in on inner sections.
- ✓ aiCEO's Log Archive back on /dashboard (was temporarily on /diary)Session 45. /dashboard is the trading page; /diary stays a pure construction log.
- ✓ aiTF closed-cycles PnL: condensed header above Previous coinsSession 45. Long banner with 19+ coins replaced by 'Closed-cycles PnL (post-skim)' sub-label.
- ✓ aiVercel Web Analytics on 10 public pagesSession 45. Same-origin script bypasses adblocker undercount. Umami stays for custom events.
- ✓ aiOwner self-exclusion flag for Vercel AnalyticsSession 45. localStorage['va.disabled']==='1' skips Vercel injection. Documented in docs/analytics-self-exclusion.md.
- ✓ aibuy.html: branded redirect (was unbranded fallback)Session 45. Half-second of visible content now matches the rest of the site.
- ✓ aiiPhone Wi-Fi preview via local dev serverSession 45. web2/serve.py emulates Vercel cleanUrls and binds 0.0.0.0 for LAN preview.
- ✓ aiSEO 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.
- ✓ aiAnalytics: track all Buy/Preview links with source attributionSession 47 (2026-04-24). Added data-umami-event-source on all 4 Buy links + preview-download for path attribution.
- ✓ aiHomepage 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.
- ✓ aiDashboard 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.
- ✓ aiDashboard v2 promoted to production + €600 disclosure + TF bannerBrief 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.
- ✓ aiHaiku commentary now sees Grid + TF aggregated contextSession 48 (2026-04-26). commentary.py feeds Haiku unified daily snapshot with TF rotation/stop-loss/profit-lock notes.
- ✓ aiDaily reports: TF section + private/public layouts + per-coin activitySessions 48-49. Three iterations: TF section added, aggregated header on top, per-coin activity in public report.
- ✓ aiTF dashboard: Recent trades on top, Previous coins collapsedSession 49 (2026-04-27). Hierarchy inversion: live trades sit above closed-cycle archive.
Phase 12 — Numbers Truth & Pre-HN Polish 11/11
- ✓ aiCumulative 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.
- ✓ aiTF 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.
- ✓ aiRSI 1h overheat filter (51a)Session 51a (2026-04-29). Pre-ALLOCATE/SWAP gate; rejects when 1h RSI ≥ 75. Reuses ccxt OHLCV pulls already cached.
- ✓ aiTrailing 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.
- ✓ aiPhantom 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.
- ✓ aiFIFO 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.
- ✓ aiFIFO 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.
- ✓ aiHomepage 'The AI Bots' section — 4 trading-card-style cardsSession 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.
- ✓ aiHomepage compaction + cross-page spacing reductionSession 53 (commit 854d6b8). Removed TF announcement banner + green framing box. Centered hero. Cross-page sweep: ~150-200px less scroll before bot cards.
- ✓ aiStats strip honesty pass + label fixesSession 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.
Phase 13 — Binance Testnet & Avg-Cost Reset (S65 → S79) 29/29
- ✓ aiS65: Strict-FIFO replay rimosso dalle dashboard pubbliche2026-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'.
- ✓ aiS66: Operation Clean Slate — liquidazione totale, audit formula realized_pnl, fix avg_cost canonico2026-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.
- ✓ aiS67: 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.
- ✓ aiS68: Pivot 'Trading minimum viable' + brief 68a sell-in-loss guard avg-cost2026-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).
- ✓ aiS69: Avg-cost trading completo + Strategy A simmetrico + IDLE recalibrate guard2026-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.
- ✓ aiS69 B+C: FIFO contabile rimosso da tutte le dashboard + commentary + health check2026-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).
- ✓ aiS70 brief 70a: sell_pct net-of-fees + sell ladder graduale + post-fill warningBrief 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.
- ✓ aiS70 brief 70b: Sentinel ricalibrazione + DRY_RUN riaccensioneBrief 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.
- ✓ aiS70 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.
- ✓ aiS70 Reconciliation Step B — pannello /admin trade-by-trade compare2026-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.
- ✓ aiS70 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).
- ✓ aiS70 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.
- ✓ aiS70b /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.
- ✓ aiS70c Site relaunch — testnet banner + capital breakdown + Reconciliation table pubblica2026-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).
- ✓ aiS70c 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).
- ✓ aiS71 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.
- ✓ aiS72 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.
- ✓ aiS73 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).
- ✓ aiS73b — 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.
- ✓ aiS73c — 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).
- ✓ aiS74 — 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.
- ✓ aiS74b — Partial fill recovery (74c) + dashboard stop-buy visibility (74b) + DEAD_ZONE_HOURS per-coin2026-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).
- ✓ aiS75 — Blog infrastructure (75a) + /howwework v3 Auditor entity + dashboard meta2026-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.
- ✓ aiS76 — grid_runner refactor (monolith 1623 → 8 modules) + brief 75b stop_buy_unlock_hours + idle audit + UI2026-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.
- ✓ aiS77 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.
- ✓ aiS78 fase 1 — Primo blog post LIVE (brief 78a) + audit Area 3 marketing/SEO/X2026-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).
- ✓ aiS78 fase 2 — Brief 78b SWEEP/LAST SHOT slippage buffer + blog post 2 + .gitignore anchor2026-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.
- ✓ aiS79 — Idle suppression (79a) + TF reactivation Tier 1-2 (79b) + Supabase write-on-change (79c) + drift FIFO sanato2026-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.
- ✓ aiBlog 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).
Phase 9 Validation & Control System
23/52
● Living milestone
● active
Validation & Control System
23/52The 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
- ✓ aiFIFO queue verification before every sellRe-derives the queue from DB on every tick with holdings > 0; auto-corrects on drift.
- ✓ aiHealth check: FIFO P&L reconciliationDB realized_pnl vs FIFO replay per symbol. Boot + daily.
- ✓ aiHealth check: holdings consistencyΣ buys − Σ sells = open lots. No silent divergence.
- ✓ aiHealth check: negative holdings guardRefuses to let any symbol go below zero (data corruption canary).
- ✓ aiHealth check: cash accountingcapital − bought + sold − skim matches the dashboard cash to the cent.
- ✓ aiHealth check: orphan lotsSells without buy_trade_id that aren't FORCED_LIQUIDATION are surfaced.
- ✓ aiDB retention cleanupDaily 04:00 UTC. Keeps trend_scans / state snapshots / events bounded so writes stay fast on free-tier IO budget.
- ✓ aiSell audit trail in bot_events_logEvery percentage-mode sell writes lot price + cost basis + queue depth, so a future report disagreement is replayable.
- aiSchema verification (DB columns vs code expectations)
2. Surface coherence — every screen tells the same story 0/4
- aiHomepage P&L = Dashboard P&L = DB FIFO P&L
- aiTelegram trade notification P&L = DB realized_pnl
- aitf.html config values = trend_config DB values
- aigrid.html config values = bot_config DB values
3. Living documentation — roadmap and process don't go stale 7/10
- ✓ maxEvery brief includes a 'Roadmap impact' sectionProcess rule, active from session 59. Briefs without the section get bounced before push.
- ✓ aiEvery CC commit updates the roadmap when impactedProcess rule, active from session 59.
- aiRoadmap staleness alert (>14 days without commits)
- aiHow We Work staleness alert (>30 days without commits)
- maxDiary entry in Supabase = diary .docx (session, date, title)
- ✓ aiProject 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.
- ✓ bothAuditor 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.
- ✓ bothPROJECT_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.
- ✓ aiPROJECT_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.
- ✓ bothAudit 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.
4. Project health — costs, deploys, backlog hygiene 0/4
- aiLive site (bagholderai.lol) matches the latest Vercel deploy
- bothMonthly infra costs vs bot revenuesManual review by CEO + Board, monthly.
- aiBriefs open >14 days without deploy
- aiDB disk usage + IO budget monitoring
5. Pre-deploy gates — code review before push (parked) 0/3
- aiCritic agent: brief vs diff (Claude API, paid)Parked. Reconsider once sections 1–4 are stable.
- aiSmoke test post-deploy (60s dry-run)Parked.
- aiAuto-revert on crashParked.
6. Pre-live gates — green checks before the first €100 of real money 7/12
- ✕ aiFIFO integrity shipped and stableSuperseded 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.
- ✕ aiZero FIFO drift alerts for 7 daysCancelled: FIFO drift can't exist without FIFO. Replaced by 'avg-cost identity Realized + Unrealized = Total P&L closing at the cent'.
- ✕ aiHealth check passes 100% for 7 daysCancelled S69 with FIFO health check removal ('non voglio più sentire parlare di FIFO' — Board). Replaced by reconciliation Binance Step A + identità avg-cost.
- ✓ aiAvg-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.
- ✓ aiSell-in-loss guard su avg_buy_price (brief 68a, S68)2026-05-09. Doppio standard FIFO+avg-cost risolto. Test 8/8.
- ✓ aiStrategy A simmetrico: no buy above avg + no sell below avg (S69)2026-05-09. Ogni buy abbassa la media, ogni sell è profittevole.
- ✓ aisell_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.
- ✓ aiWallet 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.
- ✓ aiWallet 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.
- ✓ aiDB retention stable
- aiP&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.
- maxBoard approval (Max)
7. Post-go-live monitoring — once real money is in, the work intensifies 0/4
- aiWallet P&L (Binance fetch_my_trades) reconciled with DB FIFO weeklyFrom go-live onward. Drift > threshold raises a Telegram alert.
- aiSpot-price drift alert (DB cost basis vs current Binance price)From go-live onward.
- aiDaily wallet snapshot (USDT + holdings × spot) vs equity modelFrom go-live onward.
- aiDust converter via Binance /sapi/v1/asset/dustFrom go-live onward. Avoids real dust accumulating in the wallet.
8. Process & log hygiene — what the DB checks can't see 1/6
- ✓ aihttpx / telegram loggers raised to WARNING in all entry points2026-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.
- aiLog 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.
- aiLog noise ratio (% of httpx/telegram INFO vs application lines)If noise > 95%, the logger is misconfigured.
- aiProcess inventory drift (Python processes running > 14 days without restart)
- aiCredential leakage scan (tokens / secrets in log files)
- aiLog rotation on disk (compress or drop > 7 days)Extends the DB retention pattern to filesystem logs.
Phase 14 NewsKeeper — Brain #5
2/4 ● active
NewsKeeper — Brain #5
2/4The 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)
- ✓ aiNewsKeeper Sprint 1: RSS feed collection + regex classifierS83, 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).
- ✓ aiNewsKeeper 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).
- ◐ aiNewsKeeper v2 'barometer': 3-state aggregate regime (bear / neutral / bull) — shadow LIVES100 (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).
- aiStrategy 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.