---
title: "AGENTS.md: path และรูปแบบ · DotsAgent"
description: "ตำแหน่งของ AGENTS.md รูปแบบและ frontmatter วิธีผสานไฟล์ระดับ global กับไฟล์ในโฟลเดอร์ย่อย และเครื่องมือที่อ่านไฟล์นี้ ตรวจสอบเมื่อ 2026-10-01"
url: https://dotsagent.io/th/instructions/files/agents-md
---

AGENTS.md

# AGENTS.md: ตำแหน่งไฟล์และวิธีที่เครื่องมืออ่าน

AGENTS.md เป็นไฟล์คำสั่งของโปรเจกต์ในรูปแบบ Markdown ธรรมดา ซึ่ง coding agent ส่วนใหญ่อ่านได้โดยไม่ต้องตั้งค่าเพิ่มเติม OpenAI มอบไฟล์นี้ให้ Agentic AI Foundation ภายใต้ Linux Foundation และมีโปรเจกต์โอเพนซอร์สกว่า 60k แห่งใช้งาน

## ตำแหน่งไฟล์

- AGENTS.md ที่ root ของ repository ใช้กับทั้งโปรเจกต์
- ไฟล์ AGENTS.md ที่ซ้อนอยู่ในไดเรกทอรีย่อยหรือแพ็กเกจ โดย agent จะใช้ไฟล์ที่อยู่ใกล้ที่สุดในโครงสร้าง
- OpenAI Codex: ใช้ ~/.codex/AGENTS.override.md ระดับ global หรือใช้ ~/.codex/AGENTS.md หากไฟล์นั้นว่างหรือไม่มีอยู่
- Cline: ใช้ ~/.agents/AGENTS.md ระดับ global
- Claude Code รองรับ .claude/AGENTS.md ด้วย

## รูปแบบ

Markdown ธรรมดา ไม่มี frontmatter หรือฟิลด์บังคับ ใช้หัวข้อแบบใดก็ได้ รูปแบบนี้ไม่ได้กำหนดขนาดสูงสุด แต่ OpenAI Codex จะหยุดอ่านเมื่อถึง project_doc_max_bytes ซึ่งค่าเริ่มต้นคือ 32 KiB

`AGENTS.md`

```
# Acme web app

Customer-facing web app with an admin area and a REST API.

## Commands

- Install: `pnpm install`
- Test: `pnpm test`
- Lint and type-check: `pnpm lint && pnpm tsc --noEmit`

## Code style

- TypeScript strict mode; no `any` in new code.
- Keep database access in `src/db/`.

## Never

- Never commit secrets or .env files.
- Never edit files under `src/generated/` by hand.
```

## ลำดับความสำคัญและการผสาน

AGENTS.md ที่อยู่ใกล้ไฟล์ที่กำลังแก้ไขที่สุดจะมีผลเหนือกว่า และคำสั่งที่ระบุไว้ในแชตจะมีผลเหนือกว่าไฟล์ทุกไฟล์ OpenAI Codex นำไฟล์หนึ่งไฟล์จากแต่ละไดเรกทอรีมาต่อกัน ตั้งแต่ root ของโปรเจกต์ไปจนถึงไดเรกทอรีทำงาน ดังนั้นไฟล์ที่อยู่ใกล้กว่าจะอยู่ท้ายสุดและมีความสำคัญกว่า โดยค่าเริ่มต้น Claude Code จะไม่อ่าน AGENTS.md หากมี CLAUDE.md อยู่

## เครื่องมือที่อ่านไฟล์นี้

| เครื่องมือ | การรองรับ |
| --- | --- |
| [OpenAI Codex](https://developers.openai.com/codex/guides/agents-md) | รองรับโดยตรง อ่านไฟล์ระดับ global แล้วอ่านได้ไม่เกินหนึ่งไฟล์ต่อไดเรกทอรี ไล่จาก root ไปยังไดเรกทอรีทำงาน โดยค่าเริ่มต้นจำกัดที่ 32 KiB |
| [Claude Code](https://code.claude.com/docs/en/memory) | รองรับโดยตรงตั้งแต่ v2.1.277 แต่จะใช้เฉพาะเมื่อไม่มี CLAUDE.md หรือ CLAUDE.local.md เว้นแต่จะตั้งค่าเป็น claude-md-and-agents-md |
| [Cursor](https://cursor.com/docs/context/rules) | รองรับโดยตรงทั้งไฟล์ที่ root และไฟล์ที่ซ้อนอยู่ ไฟล์ที่ซ้อนอยู่จะใช้ร่วมกับไฟล์ในไดเรกทอรีแม่ โดยไฟล์ที่เจาะจงกว่าจะมีผลเหนือกว่า |
| [GitHub Copilot (cloud agent, code review, VS Code)](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions) | รองรับโดยตรงในทุกตำแหน่งของ repository โดยไฟล์ที่อยู่ใกล้ที่สุดจะมีผล |
| [Devin Desktop (formerly Windsurf)](https://docs.windsurf.com/windsurf/cascade/memories) | รองรับโดยตรง ไฟล์ที่ root จะมีผลเสมอ ส่วนไฟล์ในไดเรกทอรีย่อยจะมีผลกับไดเรกทอรีนั้น |
| [Cline](https://docs.cline.bot/features/cline-rules) | รองรับโดยตรง และรองรับ ~/.agents/AGENTS.md ระดับ global ด้วย เปิดหรือปิดได้ในแผง Rules |
| [Gemini CLI](https://geminicli.com/docs/cli/gemini-md/) | ต้องเปิดใช้เอง: เพิ่ม AGENTS.md ลงใน context.fileName ใน .gemini/settings.json |
| [Aider](https://agents.md/) | ต้องเปิดใช้เอง: เพิ่ม read: AGENTS.md ลงใน .aider.conf.yml |
| [OpenClaw](https://docs.openclaw.ai/concepts/agent) | รองรับโดยตรงในฐานะไฟล์คำสั่งการทำงานที่จำเป็นใน workspace ของ agent |
| [Listed on agents.md (not individually re-verified)](https://github.com/agentsmd/agents.md/blob/main/components/CompatibilitySection.tsx) | เป็นหนึ่งในเครื่องมือ 23 รายการในรายชื่อของ agents.md ซึ่งรวมถึง Amp, Jules, Zed, Warp, goose, opencode และ JetBrains Junie เราไม่ได้ตรวจสอบเครื่องมือเหล่านี้ทีละรายการ |

## เคล็ดลับ

- กำลังเปลี่ยนชื่อ AGENT.md เดิมใช่ไหม? agents.md แนะนำให้ใช้ mv AGENT.md AGENTS.md && ln -s AGENTS.md AGENT.md เพื่อให้ทั้งสองชื่อยังใช้งานได้
- ระบุคำสั่งทดสอบและ lint: agent จะพยายามเรียกใช้การตรวจสอบที่พบ และแก้ไขข้อผิดพลาดก่อนเสร็จงาน
- ใน monorepo ให้เพิ่ม AGENTS.md สั้น ๆ แยกแต่ละแพ็กเกจ แทนการขยายไฟล์ที่ root ให้ยาวขึ้น
- ใน OpenAI Codex ไฟล์ AGENTS.override.md จะมีผลเหนือกว่า AGENTS.md ในไดเรกทอรีเดียวกัน

สร้าง AGENTS.md และไฟล์กฎที่ตรงกันสำหรับเครื่องมือ 5 รายการจากแบบฟอร์มเดียว [เปิดตัวสร้าง AGENTS.md →](https://dotsagent.io/th/instructions)

## ไฟล์คำสั่งอื่น ๆ

[CLAUDE.md](https://dotsagent.io/th/instructions/files/claude-md)

[GEMINI.md](https://dotsagent.io/th/instructions/files/gemini-md)

[.cursor/rules/*.mdc](https://dotsagent.io/th/instructions/files/cursor-rules)

[.github/copilot-instructions.md](https://dotsagent.io/th/instructions/files/github-copilot-instructions)

[.devin/rules/*.md](https://dotsagent.io/th/instructions/files/windsurf-rules)

[.clinerules/](https://dotsagent.io/th/instructions/files/cline-rules)

[~/.openclaw/workspace/AGENTS.md](https://dotsagent.io/th/instructions/files/openclaw-workspace)

## แหล่งข้อมูล

1. [agents.md](https://agents.md/)/
2. [github.com](https://github.com/agentsmd/agents.md)/agentsmd/agents.md
3. [linuxfoundation.org](https://www.linuxfoundation.org/press/linux-foundation-announces-the-formation-of-the-agentic-ai-foundation)/press/linux-foundation-announces-the-formation-of-the-agentic-ai-foun
4. [openai.com](https://openai.com/index/agentic-ai-foundation/)/index/agentic-ai-foundation/
5. [developers.openai.com](https://developers.openai.com/codex/guides/agents-md)/codex/guides/agents-md

แหล่งอ้างอิงอิสระสำหรับผู้สร้าง AI agent ไม่มีส่วนเกี่ยวข้องกับผู้ให้บริการที่กล่าวถึง

© 2026 DotsAgent · ตรวจสอบข้อมูลเมื่อ 1 ตุลาคม 2569
