Copilot OS #2: เบื้องหลัง Morning Brief — prompt จริง + architecture
Morning Brief ของผมแยกการ fetch ข้อมูลเป็น JSON ออกจาก prompt ที่ให้ claude -p สังเคราะห์ ใส่ interpretation rules ไว้ใน prompt และให้ AI ถก bull/bear ในใจก่อนเขียน
Copilot OS #2 — เบื้องหลัง Morning Brief
โพสต์ที่แล้วผมโชว์ว่ารัน 35 cron jobs บน VPS ตัวเดียว วันนี้จะเจาะลึกตัวที่สำคัญที่สุด: Morning Brief
ทุกเช้า 07:00 ผมได้สรุปตลาดใน Telegram ที่ AI สังเคราะห์จาก 11 data sources ไม่ต้องเปิด TradingView ไม่ต้อง scroll Twitter
ตัวอย่างจริง ดูได้ที่ isagi0x.com/brief — auto-generate ทุกวัน
Architecture: แยก fetch กับ synthesize
ระบบแบ่งเป็น 2 ขั้นตอน:
ขั้นที่ 1 — fetch-market-data.sh (cron ก่อนหน้า)
- ดึง API ทั้งหมด เก็บเป็น JSON ใน /data/market/
- CoinGecko, DefiLlama, Polymarket, Binance Futures, FRED, DexScreener, GeckoTerminal...
- ถ้า API ตัวไหนล้ม ไฟล์เก่ายังอยู่ — prompt ไม่พัง
ขั้นที่ 2 — morning brief prompt (Claude Code headless: claude -p)
- อ่าน JSON ทั้งหมด
- สังเคราะห์เป็น briefing 1 หน้า
- ส่งเข้า Telegram
ทำไมแยก?
- fetch ล้มเหลวไม่กระทบ prompt
- เปลี่ยน data source ไม่ต้องแก้ prompt
- debug ง่าย — เปิด JSON ดู data ได้เลยว่า input ถูกรึเปล่า
Prompt จริง (ย่อ แต่ logic เหมือนกัน)
You are a market intelligence analyst.
Read cached data and generate a daily briefing.
Data sources to read:
- crypto-prices.json — BTC, ETH, SOL prices + 24h change
- fear-greed.json — Fear & Greed index
- defi-tvl.json — Top 20 DeFi protocols by TVL
with 1d/7d changes
- polymarket.json — Prediction market probabilities
+ 24h volume
- macro.json — SPY, VIX, 10Y yield, gold, USD index,
BTC dominance
- fred.json — Fed Funds Rate, yield curve,
breakeven inflation, unemployment,
trade-weighted USD, high yield spread
- macd-signals.json — Multi-timeframe technicals
(1h + 4h) with conviction scores 0-100
- liquidations.json — Binance Futures long/short ratios,
retail vs whale positioning, open interest trends
- twitter-list.json — Latest tweets from curated
crypto/macro list
- dexscreener.json — Top boosted tokens
(attention signal)
- geckoterminal.json — Trending DEX pools
across all networks
Interpretation rules:
- Retail vs whale divergence is the highest-value
signal. Retail heavily long + whales short
= bearish flush setup.
- Rising OI + flat price = overleveraged.
Falling OI = deleveraging.
- MACD conviction >65 bullish or <35 bearish
= call it out. 1h vs 4h disagreement
= higher-value signal than agreement.
- Yield curve negative = inverted = recession signal.
Post-inversion normalization
= recession arrives 6-18 months.
- High yield spread below 3% = complacency.
Above 5% = fear.
Before writing, run an internal bull/bear debate:
1. BULL — strongest argument for upside next 48h
2. BEAR — strongest argument for downside
3. SYNTHESIS — which side has more structural
evidence?
Don't output the debate.
Let it sharpen the final briefing.
One voice that has already considered both sides.
Generate the intelligence briefing.
ทำไม prompt นี้ถึงทำงานได้ดี — 3 design decisions
Interpretation rules ใส่ใน prompt ไม่ใช่ใน data. ถ้าใส่ใน data AI จะ parrot ตัวเลข. ใส่ใน prompt AI จะ think about ตัวเลข. "retail vs whale divergence is the highest-value signal" บอก AI ว่าดูอะไรก่อน
Bull/bear debate ก่อน output. AI ถูกบังคับให้คิดทั้งสองฝั่งก่อนเขียน ผลคือ briefing ไม่ bias ไปทาง bullish หรือ bearish เกินไป. "Don't output the debate" = ความคิดที่ดีที่สุดไม่ต้องโชว์ process
Conviction score เป็นตัวเลข ไม่ใช่คำ. "bullish" กว้างเกินไป. conviction 72 กับ 95 ต่างกันมาก. ตัวเลขทำให้ AI สร้าง output ที่ precise กว่า
ลองดัดแปลงเป็น version ของตัวเอง
ไม่จำเป็นต้องดู crypto เปลี่ยน data sources ได้:
- VC funding rounds (Crunchbase API)
- Tech layoffs tracker
- HackerNews top stories
- Product Hunt launches
- หรือแม้แต่ข่าวกีฬา ข่าวหุ้นไทย
Logic เดิมใช้ได้หมด: fetch → JSON → prompt อ่าน → synthesize → ส่ง Telegram
สิ่งที่ต้องปรับคือ interpretation rules — บอก AI ว่าอะไรสำคัญสำหรับคุณ
โพสต์หน้า: Copilot OS #3 — Accountability Loop ที่ไม่ให้โกหกตัวเอง
