📖 AI Instructions

⬇️ Download .md

ไฟล์ markdown นี้คือ aggregated user_cmd + ai_response + what_changed จากทุกโปรเจกต์ทุกเวอร์ชั่น ให้ AI ตัวอ่าน ingest ไฟล์นี้เพื่อเข้าใจ CodeHub ทั้งหมดในรอบเดียว

# CodeHub — AI-Readable Instructions

> Generated: 2026-07-08 06:33 UTC
> Total projects: 7
> Total versions: 12

---

## สำหรับ AI ตัวอ่าน

ไฟล์นี้คือ aggregated AI instructions ของทุกโปรเจกต์ทุกเวอร์ชั่นใน CodeHub
อ่านไฟล์นี้แล้วคุณจะเข้าใจว่า:
1. ผู้ใช้สั่งอะไร (`user_cmd`)
2. AI ตอบว่าอะไร (`ai_response`)
3. มีอะไรเปลี่ยน (`what_changed`)
4. ใช้ tech อะไร
5. deploy ที่ไหน

จากนั้นคุณสามารถ:
- เพิ่มเวอร์ชั่นใหม่: ดู schema ใน CodeHub v1.0 project
- แก้ไข: ดู version ที่เกี่ยวข้อง แล้ว patch `meta.json`
- deploy ใหม่: `ssh root@5.231.28.248 'python3 /mnt/16tb/codehub/builder/generate.py'`

---

# 📦 AI Data Analyzer (ai-data-analyzer) {#ai_data_analyzer}

**Category**: Data Tools  
**Tags**: csv, xlsx, charts, auto-ai, heatmap  
**Tech**: Papa Parse, SheetJS, Chart.js, chartjs-chart-matrix  
**Created**: 2026-07-08  
**Live**: http://178.83.121.75:50900/  

**Description**: โยนไฟล์อะไรมา คอลั่มแบบไหนก็คิดและเอามาทำกราฟ — รองรับ CSV/XLSX/TSV/JSON auto-detect type

**Versions**: 3

## v1.2 — AI Data Analyzer v1.2 — Heatmap + Filters + Insights + Pagination

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +920  
**Deployed**: http://178.83.121.75:50900/  

### 🗣️ User Command

```
อยากได้ heatmap + กรองข้อมูลตาม category + insights panel + pagination
```

### 🤖 AI Response

```
เพิ่ม heatmap matrix (chartjs-chart-matrix) + filter chips per categorical column + insights panel (totals/avg/range/diversity/missing) + 50-row pagination with prev/next/jump
```

### ✅ What Changed

- Heatmap chart — cat1 × cat2 matrix with numeric z-value (avg), color intensity scale
- Filter chips — click categorical values to filter (multi-select), live re-render of all charts with filtered data
- Insights panel — 5 insight cards: total/avg of numeric col, range, date range, most diverse categorical, missing cell %
- Missing data warning (>30% = ⚠️ high missing rate)
- Pagination — 50 rows/page with « ‹ 1/3 › » buttons
- Sidebar layout — column types + filters + file meta in sticky sidebar, charts+preview in main column
- KPI shows 'After filter' count vs 'Total rows' so you see filter impact at a glance

---

## v1.1 — AI Data Analyzer v1.1 — XLSX + scatter + regression + e-commerce sample

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +600  
**Deployed**: http://178.83.121.75:50900/  

### 🗣️ User Command

```
เพิ่ม .xlsx .tsv และ chart แบบ scatter พร้อม linear regression
```

### 🤖 AI Response

```
เพิ่ม SheetJS (XLSX/XLS) + scatter chart with linear regression line + r-value display + line chart for date-time series + 3rd sample dataset (e-commerce 600 rows with order_id/category/channel/month/quantity/price/rating/returned)
```

### ✅ What Changed

- XLSX support via SheetJS (reads .xlsx and .xls, converts numeric cells to strings for consistent type detection)
- Scatter chart with linear regression — slope + intercept + r-value displayed inline in legend
- Time-series line chart — date × numeric aggregated by month with filled area
- 3rd sample dataset — e-commerce 600 orders across 12 months × 6 products × 2 channels
- Each KPI card has color-coded accent bar (green/orange/blue/purple)

---

## v1.0 — AI Data Analyzer v1.0 — Any file → Auto charts

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +460  
**Deployed**: http://178.83.121.75:50900/  

### 🗣️ User Command

```
โยนไฟล์อะไรมา คอลั่มแบบไหนก็คิดและเอามาทำกราฟ
```

### 🤖 AI Response

```
vanilla HTML + Papa Parse (CSV/TSV/JSON) + Chart.js + auto-detect column types (>85% confidence) + auto-suggest 3 chart types (histogram, top categories bar, doughnut) + 6 KPI cards + 50-row preview
```

### ✅ What Changed

- Single index.html 19KB — drop any CSV/TSV/JSON, get 3 charts auto
- Type detection — number/date/boolean/text with >85% confidence threshold
- Histogram with auto-bucketing into 12 bins
- Top 10 categories by numeric sum (horizontal bar)
- Doughnut distribution for text columns
- 2 sample datasets (sales 576 rows, survey 1000 rows)

---

# 📚 CodeHub (codehub) {#codehub}

**Category**: Dev Tools  
**Tags**: versioning, docs, ai-readable, static-site, 16tb  
**Tech**: vanilla HTML, Python build script, nginx, Let's Encrypt, XFS 16TB  
**Created**: 2026-07-08  
**Live**: https://codehub.sj88ai.com  

**Description**: เก็บ code ทุกเวอร์ชั่นพร้อม screenshot + คำสั่ง + คำตอบ AI เพื่อให้ AI ตัวอ่านอ่านแล้วทำตามได้

**Versions**: 1

## v1.0 — CodeHub v1.0 — Static foundation + AI-readable docs

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 12  
**Lines added**: +1,850  
**Deployed**: https://codehub.sj88ai.com  

### 🗣️ User Command

```
อยากทำ codehub เก็บ code เป็นเวอร์ชั่นทุกเวอร์ชั่น (ไปเก็บลูก 16tb) ทำแนวๆ http://62.84.178.0:3001/ เก็บรวม code และคำสั่ง แต่ล่ะเวอร์ชั่นและหน้าตาทุกเวอร์ชั่น และมีหน้าให้ Ai ตัวอ่านอ่านและทำตาม ผลมันต้องคล้ายๆแบบนี้คือ http://62.84.178.0:3001/ ให้เก็บทุกเวอร์ชั่น หน้าแรกมีหน้า รวม code พร้อมสกีน short พร้อม จัดหมวดหมู่ ออกแบบเวอร์ชั่นแรกมา วางแผนทำไว้ 10 เฟส ทำเฟสแรกมาก่อน ทำ SSL และ Deploy codehub.sj88ai.com points to 5.231.28.248
```

### 🤖 AI Response

```
วางแผน 10 เฟส ลุยเฟส 1: โครงสร้าง 16TB + seed 7 โปรเจกต์ + index.html แบบ journey-page + nginx+SSL + /ai-instructions.md สำหรับ AI ตัวอ่าน
```

### ✅ What Changed

- สร้าง data structure บน /mnt/16tb/codehub/ (projects.json + projects/<slug>/versions/vX/)
- สร้าง builder/generate.py ที่ scan โครงสร้างแล้ว gen static HTML ลง /mnt/16tb/codehub/www/
- หน้าแรก hero + grid โปรเจกต์แยกหมวดหมู่ พร้อม screenshot + live URL
- หน้าโปรเจกต์ journey-page แบบ 62.84.178.0:3001 มี TOC + version section (user cmd / AI response / what changed)
- endpoint /ai-instructions.md รวมทุก user_cmd + ai_response ทุกโปรเจกต์ทุกเวอร์ชั่น ให้ AI ตัวอ่านอ่านได้
- nginx vhost + Let's Encrypt SSL ที่ codehub.sj88ai.com

**Screenshots**: 3 image(s)

---

# 📦 Habit Streak (habit-streak) {#habit_streak}

**Category**: Other  
**Tags**: habit, gamification, tracker, heatmap  
**Tech**: vanilla HTML, localStorage, Chart.js  
**Created**: 2026-07-08  
**Live**: http://178.83.121.75:51001/  

**Description**: ติดตามนิสัยประจำวัน — streak, heatmap, achievement เก็บคะแนนท้าทายตัวเอง

**Versions**: 2

## v1.1 — Habit Streak v1.1 — Recurrence rules + streak freeze

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 2  
**Lines added**: +85  

### 🗣️ User Command

```
เพิ่มกฎ recurrence (ทุกวัน / วันธรรมดา / สัปดาห์) + streak freeze (หยุด 1 วันไม่หลุด)
```

### 🤖 AI Response

```
เพิ่ม enum RULES + freeze per habit
```

### ✅ What Changed

- RULES enum
- freeze per habit
- streak counter respects freeze

**Screenshots**: 1 image(s)

---

## v1.0 — Habit Streak v1.0 — ติดตามนิสัย + gamification

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +720  
**Deployed**: http://178.83.121.75:51001/  

### 🗣️ User Command

```
อยากมี app ติดตามนิสัย เห็น streak ได้ เห็น heatmap
```

### 🤖 AI Response

```
vanilla + Chart.js heatmap + localStorage + emoji-based achievements
```

### ✅ What Changed

- Add habit — ชื่อ + emoji + target
- Check-in daily — กดติ๊กทุกวัน
- Streak counter — วันต่อเนื่อง
- Heatmap calendar 1 ปี เหมือน GitHub contribution
- Achievement system — bronze/silver/gold/platinum เมื่อถึง threshold

**Screenshots**: 2 image(s)

---

# 🍳 Meal Plan (meal-plan) {#meal_plan}

**Category**: Life OS  
**Tags**: food, recipes, shopping-list, calendar  
**Tech**: vanilla HTML, localStorage, drag-drop  
**Created**: 2026-07-08  
**Live**: http://178.83.121.75:51004/  

**Description**: วางแผนมื้ออาหาร + สูตรอาหาร + shopping list อัตโนมัติ

**Versions**: 1

## v1.0 — Meal Plan v1.0 — วางแผนอาหาร + shopping list

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +600  
**Deployed**: http://178.83.121.75:51004/  

### 🗣️ User Command

```
อยากวางแผนอาหาร + shopping list อัตโนมัติ
```

### 🤖 AI Response

```
vanilla HTML + localStorage + drag-drop weekly calendar
```

### ✅ What Changed

- Recipe library — เพิ่มสูตร + ingredients + steps
- Weekly calendar drag-drop — ลากสูตรลงวัน/มื้อ
- Shopping list auto-aggregate — รวม ingredients ทุกมื้อในสัปดาห์
- Filter by category (breakfast/lunch/dinner/snack)

**Screenshots**: 2 image(s)

---

# 🧠 Memo AI (memo-ai) {#memo_ai}

**Category**: AI Apps  
**Tags**: chatbot, memory, byok, openai, claude  
**Tech**: vanilla HTML, marked.js, localStorage, OpenAI API, Anthropic API  
**Created**: 2026-07-01  
**Live**: http://178.83.121.75:50200/  

**Description**: Chat with memory — แชทคุยกับ AI ที่จำทุกบทสนทนา ใช้ API key ของคุณเอง (OpenAI / Anthropic)

**Versions**: 3

## v1.2 — Memo AI v1.2 — Token count + cost estimate

**Date**: 2026-07-05  
**Status**: released  
**Files changed**: 1  
**Lines added**: +180  
**Deployed**: http://178.83.121.75:50200/  

### 🗣️ User Command

```
ขอดู token count กับ cost estimate ด้วย จะได้รู้ว่าใช้ไปเท่าไหร่
```

### 🤖 AI Response

```
เพิ่ม gpt-tokenizer + cost table ต่อ model
```

### ✅ What Changed

- Live token count ของ input/output
- Cost estimate based on current pricing
- Model selector: gpt-4o-mini / gpt-4o / claude-3-5-sonnet / claude-3-haiku

**Screenshots**: 1 image(s)

---

## v1.1 — Memo AI v1.1 — Multi-conversation + export

**Date**: 2026-07-03  
**Status**: released  
**Files changed**: 1  
**Lines added**: +320  
**Deployed**: http://178.83.121.75:50200/  

### 🗣️ User Command

```
อยากเก็บหลาย conversation และ export แชทเป็น markdown ได้
```

### 🤖 AI Response

```
เพิ่ม sidebar รายชื่อ conversation + export .md button
```

### ✅ What Changed

- Sidebar รายการ conversation พร้อม new/rename/delete
- Export to Markdown — ดาวน์โหลด .md พร้อม metadata
- Search across all conversations

**Screenshots**: 2 image(s)

---

## v1.0 — Memo AI v1.0 — Chat with memory, BYOK

**Date**: 2026-07-01  
**Status**: released  
**Files changed**: 1  
**Lines added**: +1,450  
**Deployed**: http://178.83.121.75:50200/  

### 🗣️ User Command

```
อยากได้แชทบอทที่จำทุกบทสนทนา ใช้ API key ของตัวเองได้ทั้ง OpenAI และ Claude
```

### 🤖 AI Response

```
vanilla HTML + localStorage + OpenAI/Anthropic API direct (CORS-friendly with anthropic-dangerous-direct-browser-access)
```

### ✅ What Changed

- single index.html 61KB — UI + state + API calls ทั้งหมด
- BYOK settings panel — ใส่ key ครั้งเดียว เก็บ localStorage
- Memory = array ของ {role, content} ต่อ conversation
- Markdown render ด้วย marked.js CDN

**Screenshots**: 1 image(s)

---

# 🌸 Mood Garden (mood-garden) {#mood_garden}

**Category**: Life OS  
**Tags**: mood, journal, garden, canvas  
**Tech**: vanilla HTML, canvas, localStorage  
**Created**: 2026-07-08  
**Live**: http://178.83.121.75:51002/  

**Description**: บันทึกอารมณ์รายวัน ปลูกต้นไม้ตามอารมณ์ — แต่ละวันคือเมล็ดพันธุ์ ดูแลสวนในใจ

**Versions**: 1

## v1.0 — Mood Garden v1.0 — ปลูกต้นไม้ตามอารมณ์

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +680  
**Deployed**: http://178.83.121.75:51002/  

### 🗣️ User Command

```
อยากมี app บันทึกอารมณ์ อยากให้มันเป็นสวนที่โตตามเวลา
```

### 🤖 AI Response

```
vanilla HTML + canvas-based garden + localStorage
```

### ✅ What Changed

- Daily mood — เลือก 1 ใน 7 อารมณ์ + note
- Garden canvas — แต่ละวันคือต้นไม้ 1 ต้น โตเมื่อ check-in ต่อเนื่อง
- Weather effect — happy = ฟ้าใส / sad = ฝนตก
- Garden gallery — ดูสวนย้อนหลังทุกเดือน

**Screenshots**: 2 image(s)

---

# 💰 Wallet (wallet) {#wallet}

**Category**: Finance  
**Tags**: expense, income, ai-ocr, receipt, vision  
**Tech**: vanilla HTML, Chart.js, OpenAI Vision, Anthropic Vision  
**Created**: 2026-07-08  
**Live**: http://178.83.121.75:52000/  

**Description**: รายรับรายจ่าย + AI สแกนบิล — ถ่ายรูปใบเสร็จ AI ดึงข้อมูลและจัดหมวดหมู่ให้อัตโนมัติ

**Versions**: 1

## v1.0 — Wallet v1.0 — รายรับรายจ่าย + AI Bill Scanner

**Date**: 2026-07-08  
**Status**: released  
**Files changed**: 1  
**Lines added**: +1,300  
**Deployed**: http://178.83.121.75:52000/  

### 🗣️ User Command

```
เพิ่มส่วนของรายรับรายจ่าย ส่งบิล แล้วให้ Ai โยนไปหมวดหมู่
```

### 🤖 AI Response

```
vanilla + Chart.js + AI Vision (gpt-4o-mini / claude-3-5-sonnet) สกัด merchant/date/total/items/category จากใบเสร็จ
```

### ✅ What Changed

- Bill scanner — drag/drop รูป → AI vision extract → confirm → save
- AI auto-categorize — 'กาแฟ Starbucks 75 บาท' → category ทันที
- Keyword fallback — รู้จัก merchant ที่พบบ่อยแม้ไม่มี API key
- 12 expense categories + 7 income categories พร้อม emoji+color
- Trend chart 6 เดือน + doughnut category
- Multi-currency THB/USD/EUR/JPY/GBP/SGD/CNY
- Recurring detection — merchant+amount เดิมๆ → 🔁 flag

**Screenshots**: 3 image(s)

---
📚 CodeHub — version-controlled code, screens & AI instructions
Storage: /mnt/16tb/codehub/ · SSL: Let's Encrypt · Server: nginx · Built: 2026-07-08 06:33 UTC