builder-codex / template
AGENTS.md1 starsChanged 4 months agoMITView on GitHub
- Deletes or force-pushes
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- concurrency-and-hidden-bugsSkill
- debugging-disciplineSkill
- backing-up-solo-projectsSkill
- complying-with-thai-pdpaSkill
- preparing-mobile-store-submissionSkill
- verifying-ai-outputSkill
- writing-feature-specsSkill
- verifying-ai-outputSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Run locally: เปิดไฟล์ใน browser หรือ python3 -m http.server 8000
- Distinctive: line 23
All assumptions explicit. ถ้า context หาย → state assumption ชัดเจน ห้าม hallucinate infra หรือ invent service ที่ไม่มี …
- Very specific: line 64
Run npm ls หรือ check import จริง — กัน hallucination (P-23)
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Entry point for AI coding agents. <150 lines by design. Full reference →
BUILDER_CODEX.md(Tier 3 master) +skills/(Tier 2 on-demand)
Imports (load every session)
@MEMORY.md @CAPTURE_LOG.md
Project
Stack: Single-file HTML/JS + Firebase Realtime Database (asia-southeast1) + Cloudflare Workers Build system: None (vanilla) — เปิด HTML file ใน browser run ได้เลย Source of truth: Git repo (commit ทันทีหลัง agent เสร็จ) Audience: Thai market — UI ภาษาไทย, code/comment ภาษาอังกฤษ
Commands
- Run locally: เปิดไฟล์ใน browser หรือ
python3 -m http.server 8000 - Deploy:
git push origin main→ Cloudflare Pages auto-deploy - DB rules: Firebase Console > Realtime Database > Rules tab
🛑 Behavioral Guardrails (กัน 4 AI misbehaviors)
NO MAGIC — don't guess (กัน "เดา")
All assumptions explicit. ถ้า context หาย → state assumption ชัดเจน ห้าม hallucinate infra หรือ invent service ที่ไม่มี ถ้าไม่รู้ว่าไฟล์/path อยู่ไหน → ถาม อย่าเดา
VERIFY BEFORE DONE — no "done" without evidence (กัน "โกหก")
ห้ามอ้าง "เสร็จแล้ว" โดยไม่ run verification "แก้ไฟล์แล้ว" = ไม่ใช่เสร็จ "แก้ไฟล์แล้ว + run output นี้" = เสร็จ ห้าม "should work now" → evidence ก่อน assertion เสมอ
SCOPE DRIFT — flag scope creep (กัน "ทำเกิน")
Track stated goal vs actual execution Flag เมื่อ:
- "ขอเพิ่มอีกนิด" สะสมมาก
- Nice-to-have ถูก treat เป็น must-have
- ขอ "fix bug X" แต่กำลัง "refactor ทั้ง module"
LEARNING CAPTURE — log to MEMORY.md (กัน "ลืม")
เจอ pattern failure / operational mistake → log ลง MEMORY.md ทันที 3 fields: what happened / root cause / correct behavior กฎ: correct behavior ต้องเป็น "command ที่ทำตามได้" ไม่ใช่ "feeling"
REVERSIBILITY CLASSIFICATION (R0/R1/R2) — ดู P-31
- R0 (irreversible): STOP. ถามก่อนทำเสมอ (rm -rf, force push, revoke key, delete data, store submission)
- R1 (costly to reverse): Do it, but report what + why + how to rollback (migration, major version, deploy prod)
- R2 (easily reversed): Just do it. Brief report (lint, format, edit comment, install dev dep)
Hard Rules (technical — ห้ามฝ่าฝืน)
- Render functions =
function(){}+ string concat ONLY — ห้าม nested backtick template literal - onclick =
data-idpattern + event delegation — ห้าม inline string escape - localStorage = check quota before setItem + fallback ทุกครั้ง (P-15, P-16)
- Firebase write = ต้องมี error handler (P-01)
- ZERO duplicate logic — extend existing, ห้ามสร้าง parallel
- ทุก feature = single source of truth — บอกชื่อ function/section ก่อนแก้
Before Writing Code (Plan phase — P-29)
- อ่าน
spec.md"Current state" → รู้ว่าอยู่ตรงไหน - ระบุ existing function/section ที่กระทบ
- ระบุ single source of truth ที่จะแก้
- List side effects + classify (R0/R1/R2)
- ถ้า scope ไม่ชัด → ถามก่อน ห้ามเดาแล้วเขียนทับ
After Writing Code (Review phase)
- Run
npm lsหรือ check import จริง — กัน hallucination (P-23) - ตรวจ schema กับ Firebase rules จริง ไม่ใช่ memory
- ทดสอบใน sandbox 1 รอบก่อน commit
- Update spec.md "Current state" + "Done" — ไม่ update = ไม่เสร็จ
📋 Data Contracts (interface ระหว่าง components)
AI agent ห้ามแก้ contract เหล่านี้ โดยไม่ flag ก่อน Update เมื่อ interface เปลี่ยน + log ลง MEMORY.md
- Firebase order schema: { branchId: string, items: [...], vat: number, ts: number }
- Telegram payload: { branchId: string, text: string, retry: number }
- Health ping: { ts: number, deviceId: string, version: string, storageKB: number }Known Bug Patterns (ห้าม trigger)
- Nested backtick crash → string concat เท่านั้นใน render
- localStorage overflow > 3 เดือน → archive/cleanup strategy
- Context loss in long session → /compact ที่ 60% token (P-26)
- onclick escape issues → data-id + delegation
- AI hallucinated imports → verify ทุก import (P-23)
Solo Builder Constraints
- ไม่มี peer review → ใช้ AI #2 review (P-30) ก่อน merge
- เครื่องเดียวเสีย = ทุก project หาย → backup weekly (P-24)
- ไม่มี ops team → cost dashboard ดู 1 ครั้ง/สัปดาห์ (P-25)
Communication Style
- Thai casual สำหรับ discussion / English สำหรับ code, variable, comment
- Direct fix > lengthy explanation
- Flag risk ก่อน implement
- Token ยาว → suggest splitting
When in Doubt
- อ่าน
BUILDER_CODEX.mdPattern Library ที่ตรง issue - อ่าน
MEMORY.mdมี case นี้แล้วไหม - อ่าน
CAPTURE_LOG.mdWin/Loss ที่ relevant - ถาม human ก่อน assume
Forbidden
- ❌ Refactor ที่ไม่ได้ขอ
- ❌ Silent error catch (ต้อง report/log เสมอ)
- ❌ Hide secret ใน client code (P-11)
- ❌ Revoke credential เก่าก่อนทดสอบใหม่ (P-07)
- ❌ Patch ด้วย redesign (P-21)
- ❌ R0 action โดยไม่ถาม (P-31)
Pattern reference: ดู BUILDER_CODEX.md § Pattern Library (P-01 → P-31)
Skill reference: ดู skills/*/SKILL.md
Version: AGENTS.md v3.1.0 sync with Builder Codex 3.1.0 (2026-06-22)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

