Kawe Agent CLI
AI coding agent ที่ทำงานใน terminal — binary เดียว ไม่ต้องติดตั้งอะไรเพิ่ม เริ่มใช้ได้ทันที AI coding agent in your terminal — single binary, zero dependencies, instant startup
ติดตั้งInstallation
Windows
วิธีที่ 1: PowerShell (แนะนำ)Method 1: PowerShell (recommended)
irm https://get.kaweai.com/install.ps1 | iex
วิธีที่ 2: ผ่าน WSL (ใช้ bash tool ได้เต็ม)Method 2: WSL (full bash support)
wsl --install
จากนั้นเปิด WSL (Ubuntu):Then open WSL (Ubuntu):
curl -fsSL https://get.kaweai.com/install.sh | sh
E:\Project\MyApp
💡 Both Native and WSL can read/write files on Windows drives, e.g. E:\Project\MyApp
macOS
curl -fsSL https://get.kaweai.com/install.sh | sh
Linux
curl -fsSL https://get.kaweai.com/install.sh | sh
ตรวจสอบว่าติดตั้งสำเร็จ:Verify installation:
kawe --version
เริ่มต้นใช้งานGetting Started
1. Login
kawe auth login
- Browser จะเปิดอัตโนมัติ → login ด้วยบัญชีของคุณBrowser opens automatically → login with your account
- ถ้า browser ไม่เปิด (เช่น SSH): copy URL จาก terminal ไปเปิดเองIf browser doesn't open (e.g. SSH): copy URL from terminal
- รอจน terminal แสดง "Login successful"Wait for "Login successful" in terminal
2. เริ่ม Chat2. Start Chat
cd your-project kawe chat
เข้า directory ของโปรเจคก่อน → Kawe จะรู้จัก project ของคุณอัตโนมัติ (อ่าน package.json, go.mod, etc.)Enter your project directory first → Kawe auto-detects your project (reads package.json, go.mod, etc.)
3. สั่งงาน3. Give Commands
| พิมพ์Type | AI จะทำAI Will |
|---|---|
| อ่าน codebase นี้แล้วสรุปให้หน่อย | สแกนโปรเจค → อ่านไฟล์สำคัญ → สรุปโครงสร้างScan project → read key files → summarize |
| สร้าง README.md ให้ | วิเคราะห์ project → เขียน README → สร้างไฟล์Analyze → write → create file |
| หา bug ใน main.go แล้วแก้ | อ่านไฟล์ → วิเคราะห์ → แก้ → verify ด้วย testRead → analyze → fix → verify |
| เขียน unit test ให้ function Login | อ่าน function → เขียน test → run testRead → write test → run |
| สร้าง presentation สรุปโปรเจค 5 slides | สแกนโปรเจค → สร้าง .pptxScan → create .pptx |
4. Slash Commands ที่ใช้บ่อย4. Common Slash Commands
/help | แสดงคำสั่งทั้งหมดShow all commands |
/model | เปลี่ยน AI modelChange AI model |
/usage | ดู credits ที่ใช้ไปCheck credits used |
/compact | บีบอัด context (ลด cost)Compress context (reduce cost) |
/undo | ย้อนไฟล์กลับก่อนแก้Revert file to before edit |
/diff | ดูไฟล์ที่ AI แก้ไขไปView files AI changed |
วิธีใช้งานUsage Modes
แบบสนทนา (Interactive)Interactive
kawe chat
พิมพ์ข้อความ → AI ตอบ → พิมพ์ต่อ → วนไปจนกว่าจะพิมพ์ /quit หรือ Ctrl+CType → AI responds → continue until /quit or Ctrl+C
แบบสั่งครั้งเดียว (One-shot)One-shot
kawe chat -p "แก้ typo ใน README.md" --auto-approve
สั่งงานทีเดียว ไม่ต้องโต้ตอบ — เหมาะสำหรับ CI/CD หรือ automationRun once, no interaction — great for CI/CD
kawe chat -p "สวัสดี" --json
ผลลัพธ์เป็น JSON — เหมาะกับ scriptingJSON output — great for scripting
CLI Flags
-p, --prompt "..." | สั่งงานครั้งเดียว (non-interactive) เช่น kawe chat -p "fix the bug"One-shot mode (non-interactive) e.g. kawe chat -p "fix the bug" |
--model <name> | ระบุ model ที่จะใช้ (override default)Specify model to use (override default) |
--auto-approve | ไม่ถาม confirm ทุก operationSkip all confirmations |
--resume | ต่อจาก session ล่าสุดContinue last session |
--path <dir> | ระบุ project directorySpecify project directory |
--json | ผลลัพธ์เป็น JSONJSON output |
--output <file> | เขียน output ลงไฟล์Write output to file |
Pipe
cat error.log | kawe chat -p "อธิบาย error นี้"
เปลี่ยน RoleChange Role
ใช้คำสั่ง /agent ระหว่าง chat:Use /agent command during chat:
/agent qa → ให้ AI เป็น QA — หา bugs, เขียน tests /agent architect → ให้ AI เป็น Architect — ออกแบบระบบ /agent writer → ให้ AI เป็น Technical Writer — เขียน docs /agent dev → ให้ AI เป็น Developer — เขียนโค้ด
ตัวอย่างการใช้งานUsage Examples
| สถานการณ์Scenario | Prompt | AI ทำอะไรAI Does |
|---|---|---|
| แก้ BugFix Bug | มี bug ใน login — user login ไม่ได้ ช่วยหาให้ | อ่านโค้ด → หาสาเหตุ → แก้ → testRead → find cause → fix → test |
| สร้าง FeatureAdd Feature | เพิ่ม dark mode ใน settings page | อ่านโค้ดเดิม → เขียนเพิ่ม → testRead existing → implement → test |
| Review | /agent reviewer แล้ว review โค้ดนี้ให้ | ตรวจ quality, security, performanceCheck quality, security, perf |
| สร้างเอกสารDocs | สร้าง API documentation จาก source code | อ่าน endpoints → เขียน docsRead endpoints → write docs |
| Research | หาข้อมูลเรื่อง OAuth 2.0 แล้วสรุปให้ | ค้นหา web → สรุป → แสดงผลSearch → summarize → display |
Auto-approve
ให้ AI ทำงานโดยไม่ต้องถาม confirm ทุกขั้นตอน:Let AI work without asking for confirmation:
# ผ่าน flag kawe chat -p "run tests and fix failures" --auto-approve # หรือพิมพ์ระหว่าง chat /trust-all
File Lock — ป้องกันไฟล์สำคัญFile Lock — Protect Important Files
กำหนดไฟล์ที่ AI จะไม่แตะ ใน .kawerc:Define files AI won't touch in .kawerc:
{
"lockedFiles": ["config.prod.yml", ".env*", "*.key", "docker-compose.prod.yml"]
}
AI จะปฏิเสธการแก้ไขไฟล์ที่ตรง pattern เหล่านี้AI will refuse to edit files matching these patterns
Session & Undo
- Auto-save — ทุก turn บันทึกอัตโนมัติEvery turn saved automatically
- Resume — ใช้
kawe chat --resumeเพื่อต่อจาก session ล่าสุดของ project นั้นUsekawe chat --resumeto continue last session for that project - Undo —
/undoย้อนไฟล์กลับก่อนที่ AI แก้revert file to before AI edit - Rewind —
/rewindย้อนกลับทั้ง session ไปจุดก่อนหน้าrewind entire session to earlier point
Keyboard Shortcuts
Enter | ส่งข้อความSend message |
Ctrl+C | ระหว่าง stream: หยุด response / มีข้อความ: ล้างบรรทัด / ว่าง: ถามก่อนออกDuring stream: stop / has text: clear line / empty: ask to quit |
Ctrl+D | ออก (เมื่อบรรทัดว่าง)Exit (when line empty) |
Ctrl+J / Alt+Enter | ขึ้นบรรทัดใหม่ (multi-line input)New line (multi-line input) |
Ctrl+W | ลบคำก่อนหน้าDelete previous word |
Ctrl+U | ล้างทั้งบรรทัดClear entire line |
Ctrl+L | Clear screen |
↑ / ↓ | เลื่อนดู history / เลือก autocompleteNavigate history / autocomplete |
Tab | เลือก autocomplete suggestionSelect autocomplete |
Esc | ปิด autocompleteClose autocomplete |
Esc×2 | เปิดเมนู RewindOpen Rewind menu |
ตั้งค่าConfiguration
Kawe ใช้ 2 อย่างที่ชื่อคล้ายกัน:Kawe uses 2 similar-named things:
.kawerc— ตั้งค่า ตัวโปรแกรม (timeout, theme, sandbox, ไฟล์ที่ห้ามแก้)Configure the program (timeout, theme, sandbox, locked files).kawe/— ตั้งค่า ตัว AI (กฎ, บทบาท, คำสั่งพิเศษ, skills)Configure the AI (rules, roles, commands, skills)
.kawerc — ตั้งค่าตัวโปรแกรมProgram Settings
ไฟล์ JSON ที่บอกโปรแกรม Kawe ว่าทำงานยังไง (AI ไม่ได้อ่านไฟล์นี้)JSON file that tells the Kawe program how to behave (AI doesn't read this)
ชื่อไฟล์: เลือกอย่างใดอย่างหนึ่ง (เนื้อหาเหมือนกัน):File name: pick either (same content):
.kawerc— ไม่มีนามสกุล (เหมือน .eslintrc)no extension (like .eslintrc).kawerc.json— มีนามสกุล (editor จะ highlight syntax ให้)with extension (editor syntax highlighting)
| ที่Location | ใช้เมื่อUse For | ตัวอย่างExample |
|---|---|---|
~/.kawerc (home) | ตั้งค่าส่วนตัว ใช้ทุกโปรเจคPersonal, all projects | theme, timeout |
<project>/.kawerc (project root) | ตั้งค่าเฉพาะโปรเจคนี้Per-project | lockedFiles, sandbox, autoSnapshot |
ลำดับการอ่าน: default → ~/.kawerc → <project>/.kawerc (ค่าหลังทับค่าก่อน)Load order: default → ~/.kawerc → <project>/.kawerc (later overrides earlier)
ตัวอย่าง Global (~/.kawerc):Global example (~/.kawerc):
{
"theme": "dark",
"timeout": 180000
}
ตัวอย่าง Project (my-project/.kawerc):Project example:
{
"sandbox": { "enabled": true },
"lockedFiles": ["*.env", "config.prod.*", "docker-compose.prod.yml"]
}
| Option | Default (ไม่ตั้งก็ใช้ค่านี้)Default | ควรอยู่Level | คำอธิบายDescription |
|---|---|---|---|
timeout | 120000 (2 นาทีmin) | Global | Timeout สำหรับ API (มิลลิวินาที)API timeout (ms) |
theme | "auto" | Global | ธีมสี: "dark", "light", "auto" (ตรวจจาก terminal) — หมายเหตุ: auto ใช้ COLORFGBG env var ซึ่งไม่ทุก terminal ส่งมา ถ้าสีผิดให้ตั้งเป็น dark/light ตรงๆColor theme: "dark", "light", "auto" (detects from terminal) — Note: auto uses COLORFGBG env var which not all terminals provide; set dark/light explicitly if colors look wrong |
autoSnapshot | true | Project | บันทึก checkpoint อัตโนมัติทุก turn (ใช้กับ /rewind)Auto-save checkpoint every turn (for /rewind) |
lockedFiles | [] (ไม่ล็อค) | Project | Glob patterns ของไฟล์ที่ AI ห้ามแตะFiles AI won't touch |
sandbox.enabled | false | Project | รัน bash tool ใน Docker sandboxRun bash in Docker sandbox |
sandbox.image | default image | Project | Docker image ที่ใช้รัน sandboxDocker image for sandbox |
sandbox.allowNetwork | false | Project | เปิด network ใน sandbox (ปิดโดย default)Enable network in sandbox (off by default) |
💡 Project config จะ override global (ยกเว้น API URL ที่ project เปลี่ยนไม่ได้)💡 Project overrides global (except API URL)
.kawe/ — ตั้งค่าตัว AIAI Settings
โฟลเดอร์ที่บอก AI ว่าควรทำตัวยังไง (โปรแกรมอ่านแล้ว inject เข้าไปให้ AI)Folder that tells AI how to behave (program reads and injects for AI)
my-project/.kawe/ ├── steering/ ← กฎที่ AI ต้องปฏิบัติตามเสมอRules AI must always follow ├── commands/ ← คำสั่ง slash ที่คุณสร้างเองCustom slash commands ├── roles/ ← บทบาท AI ที่คุณสร้างเองCustom AI roles ├── skills/ ← skills ที่ติดตั้งInstalled skills └── hooks.json ← script ที่รันก่อน/หลัง AI ใช้ toolScripts run before/after tool use
Steering — กฎสำหรับ AIRules for AI
# .kawe/steering/rules.md - ตอบภาษาไทยเสมอ - ใช้ Go idioms ห้ามใช้ panic - เขียน test ทุกครั้งที่สร้าง function ใหม่
Custom Commands
# .kawe/commands/deploy.md Deploy โปรเจคนี้: 1. รัน tests ก่อน 2. Build production 3. Push ไป registry
ใช้งาน: พิมพ์ /deploy ระหว่าง chatUsage: type /deploy during chat
Skills
# ติดตั้ง skill จาก GitHub /skill add github.com/user/my-skill --skill my-skill # เปิดใช้ / ดูรายการ / ลบ /skill enable <name> /skill # list skills ที่ติดตั้ง /skill remove <name> # หรือวางเอง mkdir -p .kawe/skills echo "..." > .kawe/skills/my-skill.md
AI จะใช้ skill อัตโนมัติเมื่อบริบทตรงกันAI uses skills automatically when context matches
# .kawe/roles/devops.md ## Role: DevOps Engineer คุณคือ DevOps engineer เชี่ยวชาญ Docker, Kubernetes, CI/CD
ใช้งาน: /agent devopsUsage: /agent devops
Hooks
// .kawe/hooks.json
[{"event": "PostToolUse", "matcher": "fs_write", "command": "npm run lint --fix"}]
ทุกครั้งที่ AI แก้ไขไฟล์ (fs_write) → lint จะรันอัตโนมัติEvery time AI edits a file (fs_write) → lint runs automatically
matcher— ชื่อ tool ที่จะ trigger (คั่นด้วย comma ได้ เช่น"fs_write,bash"หรือ"*"= ทุก tool)Tool name to trigger (comma-separated, or"*"for all)- Event ที่ใช้บ่อยที่สุด:
PreToolUse,PostToolUseMost common events:PreToolUse,PostToolUse
ดู event ทั้งหมด (advanced)See all events (advanced)
Events: SessionStart, SessionEnd, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, SubagentStart, SubagentEnd, Stop, Notification
อัพเดทUpdate
kawe update
Reference: Tools (20 tools)
AI ใช้ tools เหล่านี้ทำงานให้อัตโนมัติAI uses these tools automatically
| Tool | ทำอะไรDescription |
|---|---|
fs_read | อ่านไฟล์Read file |
fs_write | สร้าง/แก้ไขไฟล์ (พร้อม backup)Create/edit files (with backup) |
glob | ค้นหาไฟล์ด้วย patternFind files by pattern |
grep | ค้นหา text ด้วย regexSearch text with regex |
bash | รันคำสั่ง shellRun shell commands |
delegate | มอบงานให้ sub-agentDelegate to sub-agent |
web_search | ค้นหาข้อมูลจาก webSearch the web |
web_fetch | ดึงเนื้อหาจาก URLFetch URL content |
doc_create | สร้างเอกสาร (PDF, DOCX, XLSX, PPTX, CSV, MD, TXT)Create docs (PDF, DOCX, XLSX, PPTX, CSV, MD, TXT) |
doc_read | อ่านเอกสาร (DOCX, XLSX, PPTX, CSV, JSON, MD, TXT — ไม่รองรับ PDF)Read docs (DOCX, XLSX, PPTX, CSV, JSON, MD, TXT — no PDF) |
doc_convert | แปลงรูปแบบเอกสารConvert document formats |
image_read | อ่าน/วิเคราะห์รูปภาพRead/analyze images |
memory | จดจำข้อเท็จจริงRemember facts |
todo | จัดการ task listManage task list |
lsp | ตรวจ errors/warnings ในโค้ดCheck code errors/warnings |
monitor | เฝ้าดูการเปลี่ยนแปลงWatch for changes |
cron | รันงานตาม scheduleRun scheduled tasks |
skill | เปิด/ปิด skill ที่ติดตั้งไว้Enable/disable an installed skill |
mcp_resource_read | อ่าน resource จาก MCP server ที่เชื่อมต่อRead a resource from a connected MCP server |
request_secret | ขอ secret จาก user แบบปลอดภัย (ไม่เก็บ ไม่ log)Securely prompt the user for a secret (never stored or logged) |
Reference: Slash Commands (39 คำสั่งcommands)
รายการนี้ไม่รวม skill/custom commands ที่ติดตั้งเพิ่มได้ — พิมพ์ /help เพื่อดูรายการที่ active อยู่จริง
Excludes installed skill/custom commands — type /help to see what's actually active
คลิกที่ชื่อคำสั่งเพื่อดูรายละเอียด ตัวอย่าง และ sub-commands Click a command name to see details, examples, and sub-commands
| Command | คำอธิบายDescription |
|---|---|
| SESSION & HISTORY | |
/clear | ล้าง conversation ทั้งหมดClear conversation history |
/compact | บีบอัด context เป็น summary (ลด cost)Compress context into a summary (reduce cost) |
/context | ดู token usage / จัดการ context filesView token usage / manage context files |
/forget [N] | ลบ N turns ล่าสุด (default: 1)Remove last N turns (default: 1) |
/retry | ส่งข้อความล่าสุดอีกครั้งResend last user message |
/recap | สรุป session ปัจจุบันSummarize current session |
/rewind [N] | ย้อน session กลับไป checkpointRestore session to a checkpoint |
| FILES | |
/diff | ดูไฟล์ที่ AI แก้ไขใน session นี้View files changed in this session |
/undo [--list] | ย้อนไฟล์กลับก่อน AI แก้Restore file from before AI edit |
/review | ส่งไฟล์ที่แก้ไปให้ AI reviewSend modified files for AI review |
/scan | สแกน project และสร้าง project mapScan project and generate map |
| MODEL & MODE | |
/model [name] | ดู/เปลี่ยน AI modelShow or switch AI model |
/effort [level] | ตั้งระดับ effort (low/medium/high/xhigh)Set effort level (low/medium/high/xhigh) |
/plan | Toggle plan mode — read-only วิเคราะห์ก่อนลงมือToggle plan mode — read-only investigation first |
/auto | Toggle auto mode (ข้าม confirmations)Toggle auto mode (skip confirmations) |
/trust-all | Auto-approve ทุก tool ใน session นี้Auto-approve all tools this session |
/trust-hooks | เปิด hooks + skill shell สำหรับ project นี้Enable hooks and skill shell for this project |
| AGENTS & MEETING | |
/agent [role] | ดู/เปลี่ยน/สร้าง role ของ AIShow/switch/create AI role |
/agents | ดู/สร้าง agent definitions สำหรับ delegate toolView/create agent definitions for the delegate tool |
/meeting <type> <topic> | เริ่ม meeting mode (เพิ่ม --deep สำหรับ 5-perspective)Start meeting mode (add --deep for 5-perspective) |
/spawn <task> | spawn sub-agent ทำงาน asyncSpawn a sub-agent for a task asynchronously |
| RULES & CONFIG | |
/rules | ตั้งกฎ deterministic สำหรับ auto-mode (deny/confirm ต่อ tool)Set deterministic auto-mode rules (deny/confirm per tool) |
/steering | ดู steering rules ที่ active อยู่View active steering rules |
| SKILLS & PLUGINS | |
/skill [sub] | ดู/เปิด/ปิด/ติดตั้ง skillsList/enable/disable/install skills |
/marketplace | ติดตั้ง plugin bundles (skills+commands+hooks+agents) จาก GitHubInstall plugin bundles (skills+commands+hooks+agents) from GitHub |
| MEMORY & TASKS | |
/memory | ดู/จัดการ memoriesView/manage memories |
/remember <fact> | บันทึก fact ให้ AI จำStore a fact for AI to remember |
/todo | ดู task list ของ projectView project task list |
| INTEGRATIONS | |
/mcp | ดู/จัดการ MCP serversView/manage MCP servers |
/hooks | ดู/จัดการ hooksView/manage hooks |
/monitors | ดู/หยุด background processesView/stop background processes |
/cron | ดู/จัดการ scheduled tasksView/manage scheduled tasks |
| UI & INFO | |
/help | แสดงคำสั่งทั้งหมดShow all available commands |
/usage | ดู credits และ plan ที่ใช้อยู่View credits and current plan |
/stats | ดู request stats สำหรับ debugView request stats for debugging |
/sidebar | ดูภาพรวม context, tools, shortcutsOverview panel: context, tools, shortcuts |
/copy | Copy response ล่าสุดไป clipboardCopy last response to clipboard |
/logout | ล้าง credentials แล้วออกClear credentials and exit |
/quit | ออกจาก kaweExit kawe |
Reference: Agent Roles (11 roles)
| Role | คำอธิบายDescription |
|---|---|
default | Coding assistant ทั่วไปGeneral coding assistant |
dev | Full-stack developer |
writer | Technical writer |
qa | QA — หา bugs, เขียน testsQA — find bugs, write tests |
architect | System architect |
reviewer | Code reviewer |
novelist | นักเขียนนิยายFiction writer |
copywriter | Marketing copy |
researcher | นักวิจัย/วิเคราะห์Research analyst |
pm | Product manager |
analyst | Business analyst |
สร้าง custom role: วาง .md ใน .kawe/roles/Custom roles: place .md in .kawe/roles/
Reference: Meeting Mode (4 templates × 2 โหมด)
2 โหมดการใช้งาน2 Usage Modes
| โหมดMode | Syntax | การทำงานHow it works | ต้นทุนCost |
|---|---|---|---|
| ปกติStandard | /meeting <template> <topic> | AI จำลองหลายมุมมองเองใน 1 คำตอบเดียว (ไม่เรียก sub-agent)AI simulates multiple perspectives in a single response (no sub-agents) | 1 API call1 API call |
| Deep | /meeting --deep <template> <topic> | เรียก sub-agent จริงหลายตัว: 3 perspective roles (ตามหัวข้อ) + Red-Team (หาจุดอ่อน) + Synthesis (สรุป+ตัดสินใจ) = 5 API calls จริงRuns real sub-agents: 3 perspective roles (varies by template) + Red-Team (challenge) + Synthesis (summarize+decide) = 5 real API calls | ~5 API calls ⚠️~5 API calls ⚠️ |
⚠️ --deep จะถามยืนยันก่อนรัน ("will make ~5 API calls") เพราะใช้เครดิตมากกว่าปกติ⚠️ --deep prompts for confirmation ("will make ~5 API calls") as it costs significantly more
Deep Mode — 3 Perspectives ตามหัวข้อDeep Mode — 3 Perspectives per Template
| Template | 3 มุมมอง3 Perspectives |
|---|---|
design | Proponent · Skeptic · Pragmatist |
review | Author · Security Reviewer · Maintainability Advocate |
sprint | Product Owner · Tech Lead · QA Engineer |
brainstorm | Visionary · Critic · Synthesizer |
Templates (4 หัวข้อtypes)
| Template | คำอธิบายDescription |
|---|---|
design | Design Review — นำเสนอ → หาจุดอ่อน → หาทางเลือก → สรุปDesign Review — present → weaknesses → alternatives → consensus |
review | Code Review — walk through → หาปัญหา → แนะนำ → อนุมัติ/ไม่อนุมัติCode Review — walk through → issues → suggest → approve/reject |
sprint | Sprint Planning — ดู backlog → ประเมิน → assign → set goalSprint Planning — backlog → estimate → assign → goal |
brainstorm | Brainstorm — ระบุปัญหา → หาไอเดีย → ประเมิน → เลือก top 3Brainstorm — problem → ideas → evaluate → top 3 |
ตัวอย่างExamples
# โหมดปกติ (1 API call) /meeting design ระบบ auth ใหม่ /meeting brainstorm ไอเดีย team building Q4 # Deep mode (5 API calls — ถามยืนยันก่อนรัน) /meeting --deep review internal/auth/login.go /meeting --deep sprint สรุปงาน sprint 14 # ไม่ใส่ template → เปิดเมนูเลือก /meeting # ไม่ใส่ topic → ใช้ "general discussion" /meeting design
📄 ผลลัพธ์ทุกครั้งถูกบันทึกอัตโนมัติที่ .kawe/docs/meeting-<template>[-deep]-<timestamp>.md — เปิดอ่านย้อนหลังได้เสมอ📄 Every result is auto-saved to .kawe/docs/meeting-<template>[-deep]-<timestamp>.md — always accessible later