เอาจริงๆ พอเราใช้ tool ตัวนึงทุกวันจนชิน เราก็มักจะมองมันเป็นกล่องดำครับ พิมพ์เข้าไป มันก็ทำงานออกมา แต่ผมว่าบางทีการเปิดฝากล่องดูข้างในเนี่ย มันได้เรียนรู้อะไรเยอะกว่าที่คิด ผมเลยลองมานั่งแกะ source code ของ Claude Code ดูแบบ digital forensics เลยว่าข้างในมันมีอะไรซ่อนอยู่บ้าง

สิ่งที่เจอคือ string และ flag ภายในแปลกๆ ที่ทีมเค้าตั้งชื่อกันเอง เช่นพวก ultrathink, tengu_escape, หรือพวก flag ที่ดูเหมือนใช้ track อารมณ์/บริบทของ session อย่าง sentiment_flag มันทำให้เห็นว่าเบื้องหลัง prompt ที่เราพิมพ์เข้าไปสั้นๆ จริงๆ แล้วมีกลไกหลายชั้นคอยจัดการอยู่ ทั้งการตัดสินใจว่าเมื่อไหร่ควรคิดหนัก เมื่อไหร่ควรหยุด

ส่วนตัวผมว่าการอ่าน source แบบนี้มันมีประโยชน์สองอย่างครับ หนึ่งคือเราเข้าใจ tool ที่เราใช้มากขึ้น พอรู้ว่ามันคิดยังไง เราก็เขียน prompt หรือวาง workflow ให้เข้าทางมันได้ดีขึ้น สองคือมันเป็นบทเรียนเรื่องการออกแบบระบบ agent ดีๆ ว่าของจริงที่ใช้งานระดับโลกเค้าวางโครงสร้างกันยังไง ตั้งชื่อ flag ยังไง จัดการ context ยังไง

ยาวไปไม่อ่าน สรุปก็คือ:

  1. ลองเปิดฝา tool ที่เราใช้ทุกวันดูบ้าง อย่ามองมันเป็นกล่องดำ
  2. ใน source ของ Claude Code มี flag/string ภายในแปลกๆ ที่บอกใบ้กลไกเบื้องหลังเยอะ
  3. เข้าใจข้างใน = เขียน prompt และวาง workflow ให้เข้าทางมันได้ดีขึ้น และได้เรียนรู้การออกแบบ agent ของจริงไปด้วย

When you use a tool every single day, you start treating it as a black box. You type something in, it does its thing, you move on. But I think there’s a lot to learn from actually opening the box. So I sat down and went through the source of Claude Code, almost like a little digital forensics exercise, just to see what’s hiding inside.

What you find are odd internal strings and flags the team named for themselves — things like ultrathink, tengu_escape, and flags that look like they track the mood or context of a session, such as sentiment_flag. It makes you realize that behind the short prompt you type, there are several layers of machinery deciding when to think harder and when to stop.

Personally I think reading source like this is useful in two ways. First, you understand the tool you use far better — once you know how it reasons, you can write prompts and design workflows that play to its strengths. Second, it’s a free lesson in agent design: you get to see how a real, world-class tool is actually structured, how it names its flags, and how it manages context.

TL;DR:

  1. Open up the tools you use daily — don’t treat them as black boxes.
  2. Claude Code’s source is full of internal flags and strings that hint at the machinery underneath.
  3. Understanding the internals lets you write better prompts and workflows, and teaches you how a real agent is designed.