KM
บทที่ 4 · THE EVOLUTION

PromptContextHarnessSkill

ยิ่งโมเดลเก่งขึ้น จุดคานงัดยิ่งเลื่อนขึ้นบันได — จากการเลือกคำ ไปสู่การเลือกข้อมูลและเครื่องมือที่ส่งให้โมเดล

~2020Prompt Engineering
2024Context Engineering
2024–2025Agent Harness
ต.ค. 2025 →Skills + MCP

บันได 4 ชั้น

THE STACK — คลิกแต่ละชั้นเพื่อสำรวจ

ยิ่งโมเดลเก่งขึ้น leverage เลื่อนขึ้นชั้น — แต่ละชั้นยังใช้ชั้นล่างเป็นฐาน

"+1 for 'context engineering' over 'prompt engineering'… the delicate art and science of filling the context window with just the right information for the next step."

— Andrej Karpathy · X · 25 Jun 2025

1

Prompt Engineering

~2020–2023

หน่วยงาน (Unit of Work)

One prompt

คำถามสำคัญ

"How do I phrase this?"

สิ่งที่ผลิต (Artifact)

The prompt string

พนักงานใหม่ที่เก่งมาก

สอนพนักงานใหม่ด้วยการบอกงานให้ชัดเจน: ขอบเขต ฟอร์แมต และตัวอย่าง

เทคนิคสำคัญ

Be clear & directGive the WHYFew-shot examplesXML tagsRole prompting

ก่อน (ไม่ดี)

สร้าง dashboard วิเคราะห์ข้อมูล

หลัง (ดีกว่า)

สร้าง dashboard วิเคราะห์ข้อมูลยอดขาย ใส่กราฟแท่งรายเดือน ตารางเปรียบเทียบ YoY และ KPI card 4 ตัว ใช้ theme สีเข้ม

ยุคแรกที่ทุกคนแข่งกันหาคำวิเศษ — ใครเขียน prompt เก่งกว่า ผลลัพธ์ดีกว่า

แต่ละชั้นยืนบนชั้นล่าง — Skills (4) ต้องมี Harness (3) ก่อน; Harness ต้องมี Context (2) ก่อน; ทุกชั้นสร้างบน Prompt (1)

ชั้น 1 · Prompt Engineering

ศิลปะการเขียน Prompt ที่ดี

โมเดล AI เหมือน 'พนักงานใหม่ที่เก่งมากแต่ยังไม่รู้บริบท' — ต้องบอกให้ชัดเจน

Golden Rule

"ให้เพื่อนที่ไม่รู้บริบทอ่าน prompt ของคุณ — ถ้าเพื่อนงง โมเดลก็งงเช่นกัน"

Anthropic Prompt Engineering Docs · 2025

กรณี: ขอ Dashboard

สร้าง analytics dashboard

XML Tags — จัดระเบียบ prompt ให้อ่านง่าย

<instructions>
  สรุปเอกสารที่แนบมาเป็นภาษาไทย ความยาว 3 ย่อหน้า
</instructions>

<context>
  ผู้อ่านคือผู้บริหารระดับกลาง ไม่ใช่นักเทคนิค
</context>

<document>
  {{ เนื้อหาเอกสาร }}
</document>

XML tags ลด misinterpretation — โมเดลรู้ชัดเจนว่าส่วนไหนคือคำสั่ง บริบท หรือข้อมูล

วิวัฒนาการ

Prefill Trick เลิกใช้แล้วบน Claude 4.6+

เทคนิคการใส่คำต้นไว้ใน assistant turn (prefill) เพื่อบังคับรูปแบบ ถูกยกเลิกบน Claude 4.6+ แล้ว — เพราะโมเดลรุ่นใหม่เข้าใจคำสั่งโดยตรงได้ดีกว่าบทเรียน: เทคนิคการเลือกคำจะ "หมดอายุ" เมื่อโมเดลเก่งขึ้น — leverage เลื่อนขึ้นชั้นถัดไปเสมอ

ชั้น 2 · Context Engineering

บริหาร Context Window เหมือน Attention Budget

ไม่ใช่แค่ 'เขียน prompt ครั้งเดียว' — ทุก turn ต้องตัดสินใจว่า token ไหนควรอยู่ใน context ตอนนี้

"Find the smallest set of high-signal tokens that maximize the likelihood of your desired outcome."

— Anthropic Engineering · Effective Context Engineering for AI Agents · Sep 2025

Attention Budget Widget

ลาก slider เพื่อดูว่า recall quality ลดลงอย่างไรเมื่อ context โตขึ้น

Context: 50K tokens

Recall: 87%

10K100K250K500K

ดี — เริ่มมี noise บ้าง

Context window ใหญ่ขึ้น ≠ ฟรี — โมเดลมีประสบการณ์น้อยกับ context-wide dependencies และ recall ตกเมื่อ token มาก (Chroma research)

"Right Altitude" — ความเฉพาะเจาะจงที่พอดี

เจาะจงเกิน

if-else ยาว ๆ ที่แตกง่าย — โมเดลทำตามตัวอักษรไม่ใช่เจตนา

พอดี

หลักการที่ยืดหยุ่น — โมเดลตัดสินใจด้วยตัวเองได้ในกรอบที่กำหนด

⚠️

กว้างเกิน

ไม่มีทิศทาง — โมเดลเดาว่าต้องการอะไร ผลลัพธ์ไม่แน่นอน

3 เทคนิค Long-Horizon Tasks

📦

Compaction

สรุป conversation เก่า + reinitialize context ใหม่ โดยเก็บข้อมูลสำคัญ (decisions, bugs, constraints) ไว้

Claude Code ทำ compaction อัตโนมัติเมื่อ context ใกล้เต็ม

📝

Structured Note-Taking

เก็บ memory ไว้นอก context window — NOTES.md, to-do list, state snapshot ที่โหลดได้ตามต้องการ

Claude เล่น Pokémon รักษา map และ quest log ข้ามหลายพัน steps ด้วย notes file

🤖

Sub-Agents

แตก task ออกเป็น agent ย่อย ๆ ที่ทำงานใน context สะอาด แล้วส่งคืน summary ~1–2K tokens

Orchestrator ส่ง sub-agent ไปวิเคราะห์ไฟล์แต่ละไฟล์แยกกัน — ไม่ยัดทุกอย่างใน window เดียว

Shift

Pre-retrieval RAG → Just-in-Time Agentic Search

แทนที่จะยัด document ทั้งหมดใน context ตั้งแต่ต้น ให้เก็บแค่ identifier (paths, links) แล้วโหลดเมื่อจำเป็น — เหมือนมนุษย์ที่มี file system, inbox, bookmarks

Claude Code ใช้ grep/read แทนการอ่านทั้ง repo — โหลดเฉพาะไฟล์ที่เกี่ยวข้องกับ task ปัจจุบัน

ชั้น 3 · Agent Harness

Agent = Model + Harness

ทุก software รอบข้าง — tools, loop, permission, memory — คือ harness ที่ทำให้โมเดลลงมือทำงานจริงได้

2025 Equation

Agent=Model+Harness

"every piece of code, configuration, and execution logic that isn't the model itself"

The Agentic Loop

🔍Gatherรวบรวมบริบท

grep, read, sub-agents, compaction

Loop = self-correction = reliability — โมเดลแก้บักตัวเองได้โดยไม่ต้องถาม

Agentic loop diagram — Gather, Act, Verify, Repeat

วงจร Agentic Loop — โมเดลวนซ้ำจนงานสำเร็จ โดยไม่ต้องมีคนคอย supervise ทุก step

ส่วนประกอบของ Harness

🔧

Tools

file read/write, bash, web search, browser control

🔒

Permission & Sandbox

กำหนดขอบเขตว่า agent ทำอะไรได้ — ไม่ได้

🧠

Memory

context management, compaction, external notes

🤖

Sub-Agents

spawn agents ย่อยสำหรับ parallel work

🔁

Loop Runner

Gather → Act → Verify → Repeat อัตโนมัติ

ตัวอย่าง Harness จริง

Claude Code

Agentic coding ใน terminal

Codex CLI

OpenAI coding agent

Gemini CLI

Google agentic terminal

Cursor

AI code editor w/ harness

"Give your agents a computer, allowing them to work like humans do." — Anthropic

Workflows

Predefined Paths

code paths ถูกกำหนดล่วงหน้า — เหมาะกับงาน structured ที่รู้ขั้นตอนแน่นอน (chaining, routing, parallelization)

Agents

Dynamic Self-Direction

โมเดลตัดสินใจ process เองแบบ dynamic — เหมาะกับ open-ended tasks ที่ไม่รู้ล่วงหน้า

ชั้น 4 · Skills + MCP

ความเชี่ยวชาญที่โหลด On Demand

แทนที่จะสอนโมเดลใหม่ทุกครั้ง — บรรจุความรู้ไว้ใน SKILL.md แล้วให้โหลดเฉพาะตอนจำเป็น

อุปมา

"คู่มือ onboarding ที่จัดเล่มดี: สารบัญ → บทเนื้อหา → ภาคผนวก"

โมเดลอ่านสารบัญทุกครั้ง (ราคาถูก) แต่เปิดบทเฉพาะเมื่อเกี่ยวข้อง (ประหยัด context)

SKILL.md — 3 ระดับของ Progressive Disclosure

name + description ที่บอกว่า skill นี้ทำอะไร — โมเดลอ่านทุก skill ตอนเริ่ม แต่กินแค่ token น้อยมาก

---
name: excel-form-generator
description: >
  Generates Excel files with forms,
  pivot tables, and charts from
  structured data. Trigger when asked
  to create .xlsx or Excel reports.
---
🔌

MCP — Model Context Protocol

"USB-C ของ AI" — มาตรฐานเปิดเชื่อม AI กับ tools/data ทุกชนิด

Nov 2024

Anthropic เปิดตัว MCP

Mar 2025

OpenAI adopt MCP

Apr 2025

Google DeepMind adopt

Dec 2025

Donated to Linux Foundation (Agentic AI Foundation)

ขนาดของ Ecosystem

100K → 8M+ downloads (Apr 2025) · 10,000+ public MCP servers

Skills vs MCP — ต่างกันอย่างไร

SkillsMCP
จุดประสงค์Expertise — รู้วิธีทำConnectivity — เชื่อมกับ external systems
ค่า TokenFrontmatter: หลักสิบ tokensอาจกินหมื่น tokens (เช่น GitHub MCP)
โหลดเมื่อจำเป็นเท่านั้น (progressive)ตั้งแต่ต้น session
ต้องการHarness ที่มี filesystem + code execMCP client (Claude Desktop, Claude Code)
ทำงานร่วมกันSkill สอน workflow ที่ใช้ MCP toolsMCP ให้ tools ที่ skill เรียกใช้

Simon Willison: "Claude Skills are awesome, maybe a bigger deal than MCP" — token math ชนะ: skill frontmatter = dozens vs GitHub MCP = tens-of-thousands

1 วัน

→ 1 ชม.

Rakuten — Financial Analysis

งานวิเคราะห์การเงินที่เคยใช้เวลาเต็มวัน — ลดเหลือ 1 ชั่วโมง ด้วย Agent Skills ที่บรรจุ workflow และ domain knowledge ไว้ล่วงหน้า

— Anthropic Agent Skills launch · Oct 2025

Recap

สรุปบทที่ 4 — บันได 4 ชั้น

ยิ่งโมเดลเก่ง จุดคานงัดเลื่อนขึ้นเสมอ — แต่ทุกชั้นยังใช้ชั้นล่างเป็นฐาน

01Prompt Engineering

การเขียน prompt ที่ดีเหมือนบอกงาน 'พนักงานใหม่ที่เก่งแต่ไม่รู้บริบท' — ชัดเจน มีเหตุผล มีตัวอย่าง

02Context Engineering

Context window คือ attention budget — หยิบเฉพาะ high-signal tokens ที่จำเป็น ณ ขณะนั้น ไม่ยัดทุกอย่าง

03Agent Harness

Agent = Model + Harness — software loop ที่ให้โมเดลลงมือทำงาน วน Gather → Act → Verify → Repeat

04Skills + MCP

บรรจุความเชี่ยวชาญใน SKILL.md — โหลด on demand ด้วย token น้อยกว่า MCP หลายเท่า

Deprecated

Prefill trick บน Claude 4.6+

เทคนิคเลือกคำหมดอายุเมื่อโมเดลเก่งขึ้น

Dozens vs 10K+

Skill tokens vs GitHub MCP tokens

Context scarcity ทำให้ Skills ชนะ MCP ในแง่ประสิทธิภาพ

บทถัดไป

บทที่ 5 — ใช้ AI วันนี้: Cloud · Desktop · CLI

รู้ stack แล้ว — คราวนี้ลงมือเลือกเครื่องมือที่เหมาะกับงานจริง: เว็บแอป, Desktop + MCP, หรือ CLI / Agentic tools

อ้างอิง