For My Programmer Friend

การใช้ AI เป็น OS
ไม่ใช่ Chatbot

ระบบทำงานจริงของ Wong · 7 Layer · 11+ Real Case Studies · 1 Owner-operator

Claude Code (primary) Codex CLI ChatGPT 15+ MCPs Cloudflare Workers n8n Custom Skills Multi-Agent
TL;DR

ผมไม่ได้ใช้ AI แบบ "พิมพ์คำถาม → ได้คำตอบ" เหมือนเดิมแล้ว ผมตั้ง AI ให้เป็น OS ที่มี Memory ถาวร, Skills ที่ทำงานซ้ำได้, MCP ที่ต่อ tools ตรง, และ Sub-agents ที่ทำงานคู่ขนาน — ผลคือลด re-explain ทุก session, ทำงานเอกสาร/วิจัย/deploy ได้เร็วกว่าเดิม 3-10×, และให้ AI ทำงาน background ระหว่างผมหลับได้.

7
Layers
11+
Case Studies
110+
Tools Indexed
3
Prod Deployments

The Stack — รวมทุก layer ใน 1 ภาพ

L1 AI Client Claude Code · ChatGPT · Codex CLI · Perplexity
L2 Memory Hotcache · Wiki · auto-memory · claude-mem
L3 Skills Repeatable workflow-as-code
L4 Tools / MCP Notion · GDrive · Cloudflare · Supabase · etc.
L5 Agents Sub-agents · parallel · background
L6 Orchestration Task Intake Protocol · Multi-LLM handoff · cron
L7 Output Structured folder · Hub registry · auto-open

ทำไมต้องมี 7 Layer?

คนส่วนใหญ่ใช้ AI แบบ stateless conversation — เปิด chat ใหม่ทุกครั้ง, re-explain ทุก context, copy-paste ข้าม window. มันเหมือนใช้คอมพิวเตอร์โดยไม่มี hard disk.

ผมเลยตั้งระบบใหม่ — มอง AI เป็น OS ที่มี state ของตัวเอง, รู้จักธุรกิจผมตั้งแต่ session แรก, ต่อ tools ได้โดยตรง, สั่งงาน background ได้, และต่อ AI หลายตัวเข้าด้วยกันให้แต่ละตัวทำสิ่งที่ตัวเองเก่ง.

"ถ้าต้อง re-explain ทุก session — แปลว่า system fail. AI ที่ดีต้องจำ business เราได้เหมือนพนักงานที่ทำงานมา 2 ปี."

4 Core Pillars

PILLAR 01

Memory > Prompt

Context ที่ใช้ซ้ำต้องอยู่ในไฟล์ที่ AI อ่านอัตโนมัติทุก session — ไม่ใช่ใน prompt ที่ต้องพิมพ์ซ้ำ.

❌ "บริษัทผมทำ catering..." (พิมพ์ทุกครั้ง)
hotcache.md โหลดอัตโนมัติ
PILLAR 02

Skills > Custom Prompt

Workflow ที่ทำซ้ำต้องเป็น first-class code ที่มี trigger word, ไม่ใช่ paste prompt template.

❌ Notion doc "Proposal Template" → copy ทุกครั้ง
/mongkol-a4-proposal สั่ง 1 คำ
PILLAR 03

MCP > Manual Tool

AI ต้องคุยกับ tools (Notion, Cloudflare, GDrive) ได้โดยตรง — ไม่ใช่ copy-paste ระหว่าง browser tabs.

❌ "ช่วยเขียน SQL ให้หน่อย" → paste ใน Supabase
✅ MCP รัน query ใน DB เลย
PILLAR 04

Multi-LLM > Single Tool

แต่ละ LLM/agent ทำสิ่งที่ตัวเองเก่ง. Claude=plan, Codex=browser exec, Sonnet=long doc, Haiku=cheap loop.

❌ Opus ทำทุกอย่าง (แพง + ช้า)
✅ Claude (plan) → Codex (exec) → Claude (review)
💡 Net effect: ทุก task เริ่มจาก "AI มี context อยู่แล้ว" ไม่ใช่ "AI ลืมเรา". Setup เวลา 1-2 สัปดาห์แรก แต่หลังจากนั้นทุก session ประหยัด 15-30 นาทีจากการ context-setup.

7 Layers — แตกทีละชั้น

Each layer มี role เฉพาะ. ไม่ครบทุก layer ก็ทำงานได้ แต่ระบบจะ "lossy" — ต้อง compensate ด้วยมือ.

L1

AI Client

หน้าจอที่เราคุยกับ AI · จุดที่ทุก layer อื่น hook เข้ามา

Claude Code (primary) — CLI + Desktop app. เลือกเพราะ: skills, MCP, sub-agents, persistent memory, file system access.

ChatGPT — สำหรับงาน UI ที่ Claude ทำไม่ได้ + image gen (มี subscription อยู่แล้ว)

Codex CLI — ใช้คู่ Claude Code สำหรับ browser automation + image gen (ฟรีกับ ChatGPT sub)

Perplexity — research-heavy queries

Cost: Claude Code ~$20-200/mo (Max plan) · ChatGPT $20/mo · Perplexity Pro $20/mo
L2

Memory & Context

State ของ AI ระหว่าง session · ตัวที่ทำให้ "AI จำเราได้"

Hotcachehotcache.md ใน Second Brain folder, มี top-of-mind context (preferences, current projects, recent decisions). โหลดทุก session ผ่าน CLAUDE.md instruction.

LLM Wiki — long-term knowledge base. มี index.md + log.md + multi-agent locks (Claude+Codex แชร์กันได้). โครงสร้าง: concepts/, entities/, analyses/, sources/.

auto-memory — Claude Code built-in memory ที่ index ผ่าน MEMORY.md, แตกเป็น individual files (user, feedback, project, reference).

claude-mem MCP — semantic search across session transcripts (cross-session memory).

Real: 1,484 LINE OA conversations + 50+ memory files + 30+ wiki pages indexed
L3

Skills

Repeatable workflow as code · trigger ด้วยคำ → ทำ task ครบทั้งชุด

Skills คือ markdown files (+ optional scripts) อยู่ใน ~/.claude/skills/ หรือ .claude/skills/ ใน project. แต่ละ skill มี frontmatter ที่ระบุ trigger conditions — เมื่อ user พูดบางคำ AI จะเรียก skill นั้นอัตโนมัติ.

3 ประเภท: User-level (ทุก project), Plugin (marketing/sales/etc), Project-level (เฉพาะ repo)

Real: mongkol-a4-proposal · mongkol-menu-cards · wiki-lint (custom-built)
Reuse rate: 1 skill ใช้ 10-50 ครั้ง/เดือน vs paste prompt ทุกครั้ง
L4

Tools / MCP Servers

AI ↔ external services · ไม่ต้อง copy-paste ระหว่าง tabs

MCP (Model Context Protocol) = standard ของ Anthropic สำหรับให้ AI ต่อ tool ได้โดยตรง. แต่ละ MCP server expose tools (functions) ที่ AI เรียกได้.

ที่ผมใช้: Notion · Google Calendar/Gmail/Drive · Cloudflare · Supabase · Figma · Canva · PDF Tools · Windows-MCP · Computer Use · Claude in Chrome · scheduled-tasks · claude-mem · pdf-viewer

Real: 15+ MCPs active · ใช้บ่อยสุด: Notion, GDrive, Cloudflare, Supabase
Most MCPs ฟรี + open-source · setup ครั้งละ 5-15 นาที

7 Layers (ต่อ)

L5

Agents / Sub-agents

Specialized AI workers · parallel execution · background tasks

แทนที่จะให้ Opus ทำทุกอย่าง — แตกเป็น sub-agents ที่ทำเฉพาะทาง. แต่ละ agent อิสระจากกัน, มี context window ของตัวเอง, ใช้ model ที่เหมาะกับ task.

ผมใช้บ่อย: Explore (search codebase, returns excerpts), Plan (architecture planning), brand-voice (content gen), general-purpose (multi-step research)

Pattern สำคัญ: Parallel agents — งานอิสระ ≥2 อันยิงพร้อมกันใน single message → ลดเวลา 50-70%

Real: 3-skill parallel UI/UX audit (web-design + ui-ux-pro-max + frontend-design) · Workspace audit Sprint 1
L6

Orchestration / Workflow

กฎเกณฑ์ของระบบ · routing · multi-LLM handoff · scheduling

Task Intake Protocol — ก่อนเริ่ม task ใหญ่: Plan (2-5 bullets) → Sweet Spot block (model+effort+cost) → Filter (over-engineer/ROI/อย่าทำ) → Skill check → Confirm. Encoded ใน CLAUDE.md.

Multi-LLM Handoff Pattern — Claude เขียน Brief → Codex อ่าน, เขียน FEEDBACK_ACK.md, ทำงาน, เขียน HANDOFF_TO_CLAUDE.md → Claude review, log feedback.

Scheduled tasks — cron-like execution (scheduled-tasks MCP + Windows Task Scheduler fallback) สำหรับงาน recurring เช่น wiki lint, brief review, backup.

Hooks — PreToolUse / PostToolUse / Stop hooks ใน settings.json สำหรับ auto-format, validation, summary.

L7

Output & Artifacts

ที่เก็บผลงาน · index · navigation

Structured Output Folder — ทุกไฟล์ใหม่ไป output/{ProjectName}/YYYY-MM-DD_name.ext. ไม่แน่ใจไป output/_INBOX/.

Hub RegistryD:\Mongkol Hub\registry.yaml เป็น central index ของทุก output. SPA dashboard ที่ D:\Mongkol Hub\index.html ให้ search+filter+open ได้.

Auto-open — หลังสร้างไฟล์ใหม่ AI สั่ง start เปิดให้อัตโนมัติ (ไม่ต้องไป double-click ใน Explorer).

Wiki indexing — output ที่ durable ต้องถูก index ใน LLM Wiki (Output/LLM Wiki/index.md + log.md) เพื่อให้ AI session ถัดไปหาเจอ.

Real: 110+ outputs indexed · Mongkol Hub dashboard SPA · auto-open enabled
✅ จบ Layer Tour: Layer 1-4 = foundation (จำเป็นต้องมี), Layer 5-7 = multiplier (เพิ่มทีหลังได้). เริ่มจาก L1+L2 ก่อนก็พอ → ค่อยๆ add L3 L4 L5 ตามต้องการ.

Case Studies — งานจริงที่ผมทำ

5 cases ที่ใช้ระบบ 7-layer นี้สร้าง — แต่ละ case จะบอกว่าใช้ layer ไหน, ผลคืออะไร, ถ้าเอาไปทำในงาน programmer จะคล้าย use case อะไร.

CASE 01 · DASHBOARD / INDEX
Mongkol Hub — Single-Page Business OS
SPA dashboard ที่ index ทุก output, tool, document ในธุรกิจไว้ที่เดียว

Problem

หลังใช้ Claude สร้าง output ไปเยอะๆ (proposal, audit, analysis, HTML report, calculator) ผมเริ่มหาไม่เจอ — ไฟล์กระจัดกระจายใน Drive, Desktop, output folder. เปิด file 1 ตัวต้อง search 5 ที่.

Solution Stack

L1 Claude Code L3 Custom Skill L7 Hub Registry

สร้าง registry.yaml เป็น central index + HTML SPA ที่อ่าน registry → render เป็น searchable card grid. Claude update registry อัตโนมัติทุกครั้งที่สร้างไฟล์ใหม่.

Approach

  • Output folder structure: output/{Project}/YYYY-MM-DD_name.ext
  • Auto-append entry ใน registry.yaml ทุกครั้งที่สร้างไฟล์ (rule ใน CLAUDE.md)
  • SPA index.html อ่าน YAML → renders cards, filters by tag, opens file ด้วย file:// protocol
  • Bat files (Start Hub.bat, Auto Start Hub.bat) เปิด local server + browser

Results

Tools indexed:110+
Time saved:5-10 min/lookup
Search time:~2 sec (was 1-3 min)
Build effort:~4 hr initial + ongoing
👉 ถ้าเอาไปทำในงาน programmer: เหมือนสร้าง internal dev portal — index ทุก service/API/runbook/dashboard ของบริษัทไว้ที่เดียว. แทนที่จะต้องไป Confluence / Notion / Wiki ต่างๆ → 1 dashboard search ได้หมด. หรือทำ "tool inventory" สำหรับ DevOps — list ทุก script + last-run + owner.
CASE 02 · MULTI-LLM PIPELINE
Codex Multi-LLM Audit (Brief v2 → v9)
Claude วาง plan + Codex รัน browser + Claude review = audit รอบใหญ่ 9 รอบ

Problem

ต้องตรวจสอบเว็บไซต์ตัวเองทั้งหมด (mongkolcatering.com) — GA4, Google Ads, Search Console, GTM, plugins, performance, SEO. งานนี้ต้องเข้า browser, login, ถ่ายภาพหน้าจอ, download data — Claude ทำในเครื่อง user ไม่ได้, แต่ Codex CLI (มี browser automation) ทำได้.

Solution Stack

L1 Claude + Codex L2 LLM Wiki L4 MCP (browser) L6 Brief/ACK/Handoff L7 Structured runs/

Pattern: Claude เขียน Brief (task list + expected output + format spec) → Codex อ่าน Brief, เขียน FEEDBACK_ACK.md (ยืนยันเข้าใจ + ระบุ blockers) → Codex รัน task (browser, screenshot, JSON manifests) → Codex เขียน HANDOFF_TO_CLAUDE.md (สรุปสิ่งที่ทำ + ข้อสังเกต) → Claude review + append feedback log.

Approach (key disciplines)

  • _CODEX_FEEDBACK_LOG.md = long-term memory ของ Codex (อ่านทุก brief)
  • _CODEX_HANDOFF.md = state ส่งต่อระหว่าง LLM
  • JSON manifests cap ที่ 1MB/file (ป้องกัน Codex context overflow)
  • Folder convention: runs/YYYY-MM-DD-task-slug/artifacts/
  • Locks file (locks/active-locks.md) ป้องกัน Claude+Codex แก้ไฟล์ wiki พร้อมกัน

Results

Audit rounds:9 (v2 → v9)
Files generated:110+ (PNG + JSON + MD)
Coverage:GA4 + Ads + GSC + GTM + plugins
Time vs manual:~10 hr (vs 40+ hr manual)
👉 ถ้าเอาไปทำในงาน programmer: Pattern นี้คือ "agent handoff with structured artifacts" — เอาไปใช้กับ: (1) E2E test pipeline Claude เขียน test plan → Playwright agent รัน → Claude วิเคราะห์ flaky tests (2) Incident response Claude triage Sentry → Sub-agent ดึง logs/metrics → Claude propose fix (3) Codebase migration Claude plan refactor → Codex execute file-by-file → Claude PR review. Key takeaway: Brief / ACK / Handoff = git for AI agents.
CASE 03 · DOMAIN SKILLS
3 Production Custom Skills
Workflow ที่ใช้ซ้ำ → encode เป็น skill → trigger ด้วย 1 คำ

Problem

ผมต้องสร้าง proposal A4 ให้ลูกค้าทุก 1-2 สัปดาห์, ต้องสร้างเมนูการ์ดสำหรับงาน catering, ต้อง lint LLM Wiki เพื่อเช็ค orphan pages. แต่ละงานมี recipe ชัดเจน — แต่ถ้าทำเป็น prompt ใน chat ต้อง paste 200+ บรรทัดทุกครั้ง, ยังเสี่ยง model "ลืม" หรือเปลี่ยน format.

Solution Stack

L3 Skills L2 Memory (catalog ref) L4 MCP (Codex CLI image gen)

Skill = markdown file ใน ~/.claude/skills/{name}/SKILL.md ที่มี frontmatter (trigger words, description) + body (instructions, examples, format spec). Claude scan trigger ทุก message — match → execute.

3 Skills ที่ deployed

  • mongkol-a4-proposal — สร้าง HTML A4 proposal/pricing/brochure 4 brand (Mongkol/SAMA/Mariée/Vow). อ้างราคาจาก catalog-master.md เป็น SSoT. Trigger: "สร้าง proposal", "ทำใบเสนอราคา"
  • mongkol-menu-cards — เมนูการ์ดงาน catering, 2.5×3.8 inch, TH+EN, AI background ผ่าน Codex CLI (ฟรีกับ ChatGPT sub). Trigger: "สร้างเมนูการ์ด"
  • wiki-lint — health check บน LLM Wiki: orphan pages, broken wikilinks, stale, schema violations. ~30ms รัน, read-only. Trigger: "lint wiki", "/wiki-lint"

Results

Proposal time:~5 min (was 1-2 hr)
Menu cards:฿0 image gen cost
Wiki lint:30ms vs 30 min manual
Reuse/month:10-30× per skill
👉 ถ้าเอาไปทำในงาน programmer: Custom skill = "encode your team's best practices into commands". Examples:
  • /scaffold-api-endpoint — สร้าง route + controller + DTO + test ตาม convention ทีม
  • /pr-review-checklist — apply team's review standards (security, perf, accessibility)
  • /deploy-staging — run pre-deploy checks + tag + announce ใน Slack
  • /incident-postmortem — template + auto-fill จาก Sentry/PagerDuty
Skill จะ "เรียนรู้" pattern ของทีมและ enforce อัตโนมัติ.
CASE 04 · MULTI-AGENT WIKI
LLM Wiki with Lock-Based Coordination
Claude + Codex แชร์ knowledge base เดียวกัน, ใช้ lock file กัน race condition

Problem

เมื่อมี AI 2 ตัว (Claude + Codex) ทำงานบน wiki เดียวกัน → ถ้าทั้งคู่ edit ไฟล์เดียวกันพร้อมกันจะเกิด conflict / lost write. ต้องมี coordination mechanism ที่ไม่ต้องใช้ git lock หรือ DB.

Solution Stack

L2 Memory (Wiki) L6 Lock Protocol

ใช้ markdown table file (locks/active-locks.md) เป็น semaphore. Agent ต้อง read lock file → check no conflict → add row "active" → edit → mark "released". ทุก step encoded ใน agent.md schema file.

Key Design

  • Lock = append-only history (ไม่ลบ, มีแค่ status change)
  • stale-released sweep หลัง 2 hr ถ้า agent crash
  • Multi-target locks: ระบุ file paths ที่ touch ใน 1 row
  • Conflict recovery protocol: preserve ทั้ง 2 versions, log ใน log.md

Results

Conflicts:0 จาก 30+ multi-agent runs
Overhead:~5 sec/edit
Recovery:Auto-detect stale
👉 Programmer use case: Distributed agent coordination without infrastructure. ใช้ลักษณะเดียวกันสำหรับ AI agents ที่แก้ codebase พร้อมกัน, หรือ multi-agent CI runs ที่ share state file. Markdown lock = lightweight alternative ของ DB-backed lock.
CASE 05 · END-TO-END DEPLOYMENT
B2B Sales Database → Cloudflare Pages
687 prospects → searchable web app → deployed live ใน 1 session

Problem

น้องชาย (กร) ทำ ISO sales ที่ Bureau Veritas, ต้อง list 687 บริษัท Thai ที่ qualify เป็น prospects. ต้องการ web app ที่ search/filter/note ได้, share link ให้ทีมเปิดบนมือถือ.

Solution Stack

L1 Claude Code L4 Cloudflare MCP L7 Output + deploy

Approach

  • Claude analyze raw company list (Excel) → categorize L1/L2 prospects
  • Build static SPA (HTML + vanilla JS) ที่ search/filter/note prospects
  • Deploy to Cloudflare Pages ผ่าน wrangler CLI
  • 3 iterations (v1 → v3.5) ภายใน session เดียว based on feedback

Results

Prospects:687 (103 L1 + 584 L2)
Build → Deploy:~3 hr (1 session)
URL:bv-prospects-2026.pages.dev
Cost:฿0 (CF Pages free tier)
👉 Programmer use case: "Idea to live URL in 1 afternoon" สำหรับ internal tools, demo apps, prototype data viewers. แทนที่จะรอ DevOps setup pipeline → AI agent ออกแบบ + code + deploy ใน 1 conversation. Pattern เดียวกันใช้กับ Vercel/Netlify/Fly.io.

Pattern 01 — Claude → Codex Compounding Loop

Case 02 เล่าว่าใช้ Claude + Codex audit เว็บไซต์. จุดที่สำคัญที่สุดของระบบนี้คือ Codex ฉลาดขึ้นทุกรอบ เพราะมี feedback loop ที่ encode เป็นไฟล์ — Claude เห็นความผิดพลาดเก่าก่อนเขียน brief ใหม่.

The Loop — 5 ขั้นต่อ 1 brief

STEP 1 · CLAUDE

เขียน Brief

Claude อ่าน _CODEX_FEEDBACK_LOG.md (lessons เก่า) ก่อน → เขียน brief ที่หลีกเลี่ยง pattern ที่เคยพลาด

STEP 2 · CODEX

FEEDBACK_ACK.md

Codex อ่าน brief → เขียน ACK file ยืนยันความเข้าใจ + ระบุ blockers/assumptions ก่อน เริ่มทำงาน

STEP 3 · CODEX

Execute Task

รัน browser, screenshot, ดึง data, JSON manifests → save ลง runs/YYYY-MM-DD-slug/artifacts/

STEP 4 · CODEX

HANDOFF_TO_CLAUDE.md

สรุปสิ่งที่ทำ + key findings + ติดปัญหา + ข้อเสนอแนะ — handoff state ให้ Claude อ่านต่อ

STEP 5 · CLAUDE ⟲ COMPOUND

Review + Append to _CODEX_FEEDBACK_LOG.md

Claude review handoff + artifacts → append ✅ Strengths confirmed + ⚠️ Gaps found + 🔧 Fix for next brief. Log นี้ Codex จะอ่าน ทุก brief ถัดไป → improvement compounds เหมือน git history สำหรับ AI.

Brief Evolution — Mongkol Audit v2 → v9

8 รอบใน ~2 สัปดาห์ — แต่ละรอบ Codex เรียน lesson ที่แท้จริงจาก Claude review:

BriefScopeWhat Codex Learned
v2-v3Initial page capturesJSON manifest cap 1MB (context budget protection)
v4+ Ads diagnosticsFolder convention 0X-area/ prefix + paired PNG+manifest pattern
v5+ Plugin auditSurface critical findings (gaDebugModeEnabled) เป็น top-priority ใน HANDOFF, ไม่ใช่ฝังท้าย
v6GA4 behavioral deepVar-name uniqueness ใน REPL — const fs ครั้งที่ 2 = collision error
v7+ GSC + GA4 ExplorePath verification ก่อน read — _CODEX_AGENT.md ไม่อยู่ทุก project
v8Excel downloads + multi-accountPlaywright: getByRole > getByText regex (unreliable bridge)
v9GSC live dataERR_BLOCKED_BY_CLIENT workaround documented inline — proactive ไม่รอ Claude ถาม
📈 Why this compounds: รอบแรก Codex ทำช้า + ลืม pattern. รอบที่ 9 Codex proactive — ใส่ workaround + path verification + manifest cap โดยไม่ต้องบอก. Feedback log = persistent memory ของ Codex ที่ทำให้ improvement portable ข้าม session, audit-able, vendor-neutral.
👉 Programmer use case: Pattern นี้คือ "Retrospective-driven AI agent": Key: state-as-files ทำให้ AI improvement portable, diff-able, ไม่ติด vendor.

Pattern 02 — LLM Wiki เป็น Compounding Learning System

Memory layer (L2) ไม่ใช่แค่ "เก็บข้อมูล" — เป็นระบบที่ เรียนรู้: รู้จักผม, รู้บริบทธุรกิจ, จำความผิดพลาด, ปรับ behavior ของ AI ตามเวลา. แต่ละ session ที่ผ่านไป AI ฉลาดขึ้น โดยอัตโนมัติ.

3 ระดับของการเรียนรู้

LEVEL 1

Business Context — "รู้จักผม"

Wiki เก็บข้อมูลที่ไม่อยู่ใน code — ลูกค้า, venues, partner, brand

Session ใหม่ open → AI อ่าน hotcache.md + relevant wiki pages → รู้บริบทตั้งแต่ message แรก. ไม่ต้อง re-explain ว่าธุรกิจทำอะไร, ลูกค้าเป็นใคร, ราคาสินค้าเท่าไหร่.

Real: 30+ entity pages (mongkol-business-reality, mariee-avenue-package, korn-iso-prospects) + concept pages (mongkol-quote-logic, claude-operating-preferences)
LEVEL 2

Operating Preferences — "รู้ว่าผมชอบทำงานแบบไหน"

auto-memory + CLAUDE.md เก็บ behavior preferences

ตอบสั้นไม่ยืดยาว, HTML ต้องลงตัว A4 print, ใช้ไทย+tech English, propose Sweet Spot ก่อน task ใหญ่, plan ต้องมี Filter 3-section, ห้ามเดาธุรกิจ — ทุกข้อบันทึกครั้งเดียว ใช้ได้ตลอด.

Real: 18 feedback memory files — feedback_html_a4_print.md, feedback_model_selection.md, feedback_plan_proposal_format.md, etc.
LEVEL 3

Lessons from Mistakes — "ไม่ทำผิดซ้ำ"

เมื่อ approach ใดล้มเหลว → save "why failed" + "do instead"

AI session ถัดไปไม่ลองเส้นทางที่ตันแล้ว. ทุก mistake = future-proofing.

Real: project_line_chat_download_failed.md (Don't retry Playwright/CDP — use CSV export) · feedback_claude_code_worktree.md (worktree hides 80% files — use Local mode)

4-Tier Memory Stack

LayerPathTTLPurpose
Hotcache D:\Nut Second Brain\hotcache.md Days-weeks Top-of-mind: current projects, recent decisions, today's context
LLM Wiki Output/LLM Wiki/ Months-yrs Durable: business reality, concepts, entities, analyses (with locks for multi-agent)
auto-memory ~/.claude/projects/<p>/memory/ Persistent 4 types: user / feedback / project / reference (Claude Code built-in)
claude-mem MCP SQLite + semantic index Persistent Semantic search ALL session transcripts (cross-session recall)

The "Save Marker" Discipline

ทุก turn ที่มี decision สำคัญ / lesson learned / new business knowledge → AI ต้อง save ทันที + แจ้ง 1 บรรทัด:

💾 บันทึกแล้ว: [สิ่งที่บันทึก] → [hotcache / auto-memory / LLM Wiki]
👉 Programmer use case: "Persistent context engineering" สำหรับงานเขียนโค้ด: Key insight: plain markdown + good index = AI memory ที่ portable, diff-able, version-controlled — ไม่ต้องใช้ vector DB.
CASE 06 · LIVE OBSERVABILITY
Claude Workspace Dashboard (workspace.html)
Live dashboard ที่ดูทุกวัน — AI ทำอะไรอยู่, อะไรเสร็จแล้ว, อะไรกำลังจะมา

Problem

AI ทำงานเก่งขึ้น — แต่งานที่ AI ทำ มองไม่เห็น. Sessions มาแล้วก็ไป. Output กระจาย. Codex briefs ค้างครึ่งๆ กลางๆ. งานเสร็จแล้วจำไม่ได้ว่า "3 วันก่อนทำอะไรบ้าง". Need: 1 ที่ ที่เห็นทุกอย่าง — ไม่ต้องพิมพ์เอง.

Solution Stack

L7 Hub (workspace.html) L6 Auto-start (Task Scheduler) L4 Auto-collect

SPA ที่ D:\Mongkol Hub\workspace.html มี 6 widgets ที่ auto-collected จาก file mtime + git log + cron status + runs.json — ไม่มี input form. Pin tab ใน Chrome → reload ทุกครั้งที่อยาก refresh.

6 Widgets

▸ Runs

Active LLM work sessions อ่านจาก runs/*/run.json

▸ Today's Focus

Top tasks วันนี้ จาก hotcache priority lines

▸ Codex Briefs

Pending/active briefs — กดเปิด resume ได้

▸ Recent Completed 7d

Artifact ship ใน 7 วัน (จาก file mtime)

▸ Automation Status

cron + graphify + scheduled tasks — health check, stale alert

▸ Quick Actions

"➕ New Run", "Copy Graphify Cmd", "Open Hub" — 1-click

Key Design Principles

  • Auto-collection > Manual entry — ทุก widget push-based: อ่านจาก file mtime / git log / cron status / session log. ไม่มี input form. (Notion fail เพราะข้อนี้)
  • Persistence-by-default — Task Scheduler รัน Auto Start Hub.bat ตอน Windows logon → server.py background (pythonw, no console) → Hub พร้อมใช้ทันที
  • Pinned tab pattern — Chrome pinned tab + reload → no separate app, no notification overhead, no install

Results

Daily check:~30 sec (was 5-10 min)
Stale detection:Auto (mtime threshold)
Manual entry:0 — push-based ทั้งหมด
Setup effort:~6 hr initial + ongoing
👉 Programmer use case: "DevOps dashboard สำหรับ AI workflow":
  • PR queue — AI-generated PRs ที่รอ review
  • Failed runs — agent task ที่ exit ≠ 0 — diagnose ที่เดียว
  • Cost monitor — token usage / model selection / cache hit rate
  • Skill analytics — skill ไหนถูกเรียกบ่อย → optimize ก่อน
Tech stack เดียวกัน — Python static server + HTML SPA + auto-collect filesystem/git. ไม่ต้อง backend complex หรือ DB.

5 Use Cases สำหรับงานเขียนโค้ดของแก

เอา 7-layer architecture มา map กับ developer workflow — ดูว่า ลงทุน setup เท่าไหร่ ได้ ประหยัดเวลาเท่าไหร่/สัปดาห์.

UC 01 Project-aware memory · ไม่ต้อง re-explain codebase ทุก session Effort: Low
Stack:
L2 Memory (CLAUDE.md + ~/.claude/projects/)
Setup:
30-60 min initial
Saves:
15-20 min/session × 5 sessions/week = ~1.5 hr/wk
How:
Write CLAUDE.md with: tech stack, conventions, gotchas, runbooks links
UC 02 Custom skill encoding team conventions · PR review, scaffolding Effort: Medium
Stack:
L3 Skills
Setup:
2-4 hr/skill (start with 1)
Saves:
20-40 min/use × 3-5 uses/week = ~2-3 hr/wk
How:
Create ~/.claude/skills/team-pr-review/SKILL.md ที่มี checklist + style guide
UC 03 Parallel sub-agents สำหรับ investigation/refactor Effort: Low (built-in)
Stack:
L5 Agents (Explore + Plan + general-purpose)
Setup:
0 (built-in to Claude Code)
Saves:
50-70% time on complex investigations
How:
เมื่อต้อง search + plan + analyze พร้อมกัน → ยิง 3 agents in single message
UC 04 MCP สำหรับ GitHub / Sentry / Linear / DB direct access Effort: Medium
Stack:
L4 MCP
Setup:
15-30 min/MCP (start with 2-3)
Saves:
10-20 min/incident + cleaner context
How:
Install GitHub MCP first (PR review, issue search). Then Sentry/DB MCP based on stack
UC 05 Scheduled background tasks · security/deps/lint scans Effort: Medium
Stack:
L6 Orchestration (scheduled-tasks MCP / cron)
Setup:
30 min/task
Saves:
2-5 hr/week + catches issues early
How:
Schedule daily: npm audit + check stale deps + lint diff vs main → AI emails report
📊 Net effect: ถ้าเริ่มจาก UC1+UC2+UC3 (low effort) — ประหยัด ~5 hr/week ภายใน 2 สัปดาห์แรก. เพิ่ม UC4+UC5 ในเดือนที่ 2 — รวมประหยัด ~10-15 hr/week. ลดงาน "context-setup" และ "boring task" ได้เกือบหมด.

Trade-offs ที่ต้องรู้ก่อนเริ่ม

Trade-off Cost Mitigation
Setup time 1-2 สัปดาห์แรกช้ากว่าใช้ ChatGPT ปกติ เริ่มจาก 1 layer (memory) → expand ตามต้องการ ไม่ต้องทำครบทุก layer ทันที
Token cost $50-200/mo ที่ heavy use (Claude Code Max + ChatGPT + Perplexity) ใช้ Haiku สำหรับ routine work · set budget cap · monitor token spent
Vendor lock-in Skills เป็น Claude-specific format · CLAUDE.md ก็เช่นกัน MCPs เป็น cross-vendor (Anthropic + OpenAI + Cursor). Memory files เป็น plain markdown — portable.
Cognitive overhead ต้องจำว่า task ไหนใช้ skill อะไร / agent ตัวไหน Encode rules ใน CLAUDE.md ให้ AI แนะนำเอง · trigger words ทำให้ skill auto-fire
Maintenance Memory drift (stale facts) · skills outdated · MCPs deprecate Quarterly cleanup ritual · wiki-lint skill (auto-detect orphans) · log every change
Privacy AI อ่าน memory + project files ทุก session Local files only (ไม่ sync cloud) · separate sensitive memory · review MCP permissions

ROI Ranking — เริ่มจากตรงไหน?

Priority Action Setup time Payoff
DAY 1 Install Claude Code + create CLAUDE.md with project context 30 min Instant — every session
DAY 1 Setup ~/.claude/CLAUDE.md global = personal preferences 15 min Instant — across all projects
WEEK 1 Install GitHub MCP + try parallel agents pattern 30 min 10-20 min/PR
WEEK 1 Build 1 custom skill (start with /pr-review or /scaffold-X) 2-4 hr 20-40 min/use
WEEK 2+ Add 2-3 more MCPs (Sentry / Linear / DB) 15-30 min each Compounds with daily work
WEEK 2+ Setup 1 scheduled task (daily security scan or deps check) 30 min 2-5 hr/wk + early catch
WEEK 2+ Try multi-LLM handoff pattern (Claude plan → Codex exec) for 1 task 1 hr learn Unlocks browser/desktop tasks
🚫 อย่าทำตอนนี้ (common mistakes):

📚 Docs ที่ต้องอ่าน

Claude Code — Official Docs docs.claude.com/en/docs/claude-code MCP — Model Context Protocol modelcontextprotocol.io MCP Servers (open-source registry) github.com/modelcontextprotocol/servers Sub-agents Documentation docs.claude.com/.../sub-agents Skills (Agent Skills) docs.claude.com/.../skills Memory & CLAUDE.md docs.claude.com/.../memory
Final note: ระบบนี้ใช้เวลาประมาณ 6 เดือนสร้าง (iteration), แต่ถ้ารู้แล้วว่าจะทำอะไร — ใช้เวลาประมาณ 2-3 สัปดาห์ ก็ได้พื้นฐานที่ใช้งานจริงได้. เริ่มจาก L1+L2 (Claude Code + Memory) ก่อน. ถ้าติดอะไรถามผมได้ตลอด.