Marine Team Orchestration: 9 Agents, Parallel Execution, 17 นาทีสู่ Production
Marine Team Orchestration: 9 Agents, Parallel Execution, 17 Minutes to Production
Marine Team Orchestration: 9 Agents, Parallel Execution, 17 นาทีสู่ Production
Marine Team คือ AI development team ที่ Oracle orchestrate — ไม่ใช่ single AI ที่ทำงานเรียง แต่เป็น parallel agents ที่แบ่งงานและทำพร้อมกัน ทำให้ project ที่ปกติใช้เวลาหลายชั่วโมงเสร็จใน minutes
Oracle vs Marine: บทบาทที่ชัดเจน
Oracle (Orchestrator) Marine Agents (Executors)
━━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━
✓ วิเคราะห์ requirement ✓ เขียนโค้ด
✓ สร้าง plan ✓ สร้างไฟล์
✓ assign งานให้ agents ✓ run commands
✓ verify ผลลัพธ์ ✓ test
✓ decide ทิศทาง ✓ commit
✓ present options ✓ deploy
✗ เขียนโค้ดเอง ✗ ตัดสินใจ direction
✗ run commands โดยตรง ✗ change scope โดยลำพัง
Principle: Oracle เป็น instrument panel ไม่ใช่ autopilot มนุษย์ (Haocomm) approve direction, Oracle orchestrate team, Marine execute
9 Agent Types
Marine Team มี agents หลายประเภท แต่ละตัวเชี่ยวชาญเฉพาะด้าน:
| Agent | Specialty | เมื่อใช้ | |-------|-----------|---------| | marine-pilot | Plan & architect | ทุก project เริ่มที่นี่ | | marine-frontend | React/Next.js/CSS | UI components, pages | | marine-backend | API/DB/Server | Endpoints, database | | marine-devops | Deploy/CI/nginx | Vercel, pm2, DNS | | marine-test | Testing | Unit, integration, E2E | | marine-db | Database | Schema, migrations, queries | | marine-security | Security audit | Code review, vulnerabilities | | marine-docs | Documentation | README, API docs | | marine-debug | Bug hunting | Error analysis, fixes |
Sweet Spot: 3 Agents
จาก experience จริง:
1 agent → Sequential, safe แต่ช้า
3 agents → Sweet spot: parallel แต่ยัง coordinated
5 agents → Complex coordination แต่ยังจัดการได้
9 agents → Maximum chaos point สำหรับ large projects
ทำไม 3 คือ sweet spot:
Agent 1: Core logic (เป็น dependency ของคนอื่น)
Agent 2: UI / Interface (parallel กับ Agent 3)
Agent 3: Config / Deploy (parallel กับ Agent 2)
Agent 1 ต้องเสร็จก่อน 2 และ 3 สามารถ parallel ได้โดยไม่ conflict
Workflow: Analyze → Plan → Spawn → Verify → Commit
Phase 1: Analyze
Oracle รับ requirement จาก Haocomm
↓
วิเคราะห์:
- What exactly needs to be built?
- What already exists?
- What are the dependencies?
- What can be parallel?
↓
ถาม clarifying questions ถ้า requirement ไม่ชัด
Phase 2: Plan
Oracle สร้าง plan ที่ชัดเจนก่อน spawn:
## Marine Plan: marine-blogParallel Group A (no dependencies):
- Agent 1: สร้าง Next.js project structure + layout
- Agent 2: สร้าง component library (Button, Card, Nav)
Sequential after Group A:
- Agent 3: สร้าง blog pages ใช้ components จาก Agent 2
- Agent 4: Config + Vercel deploy ใช้ structure จาก Agent 1
Files owned:
- Agent 1: app/layout.tsx, app/page.tsx
- Agent 2: components/**
- Agent 3: app/blog/, app/post/
- Agent 4: vercel.json, package.json, .env
Present plan ให้ Haocomm approve ก่อนเสมอ
Phase 3: Spawn
# Oracle spawn agents ด้วย delegate_task
delegate_task agent="marine-frontend" task="สร้าง layout.tsx และ page.tsx"
delegate_task agent="marine-frontend" task="สร้าง Button, Card, Nav components"รอ Group A เสร็จ แล้ว spawn Group B
delegate_task agent="marine-frontend" task="สร้าง blog pages"
delegate_task agent="marine-devops" task="configure Vercel deployment"
กฎสำคัญ: 1 ไฟล์ = 1 owner
# ❌ Conflict: 2 agents แก้ไขไฟล์เดียวกัน
Agent 1 แก้ app/layout.tsx
Agent 2 แก้ app/layout.tsx → MERGE CONFLICT✅ Clean: แต่ละ agent own ไฟล์ของตัวเอง
Agent 1: app/layout.tsx (เป็นเจ้าของคนเดียว)
Agent 2: components/Nav.tsx (import จาก Agent 1)
Phase 4: Verify
Oracle verify งานของทุก agent ก่อน proceed:
# ตรวจ build
npm run build
✓ Build successful
ตรวจ types
npx tsc --noEmit
✓ No type errors
ตรวจ tests
npm test
✓ 24/24 tests pass
ตรวจ visual (สำหรับ frontend)
Oracle review screenshots/descriptions จาก agents
Phase 5: Commit
git add src/ components/ app/
git commit -m "feat: marine-blog initial implementation- Next.js App Router with TypeScript
- Responsive layout with dark mode
- Blog post listing and detail pages
- Vercel deployment configuration
Co-Authored-By: Marine Team <marine@haocomm.cloud>"
ตัวอย่างจริง: marine-blog 17 นาที
00:00 - Haocomm: "สร้าง blog สำหรับ marine team"
00:30 - Oracle: วิเคราะห์ + draft plan
01:00 - Oracle: present plan → Haocomm approve
01:30 - Spawn Agent 1 (structure) + Agent 2 (components) parallel
05:00 - Agent 1 เสร็จ: Next.js project, layout, routing
06:00 - Agent 2 เสร็จ: Button, Card, Nav, Footer components
06:00 - Spawn Agent 3 (pages) + Agent 4 (deploy) parallel
11:00 - Agent 3 เสร็จ: blog index, post pages, MDX support
13:00 - Agent 4 เสร็จ: vercel.json, env vars, domain config
13:00 - Oracle verify: build ✓, types ✓, tests ✓
14:30 - Commit + push
15:30 - Vercel deploy triggered
17:00 - Live at marine-blog.haocomm.cloud ✓
Key insight: 2 parallel groups ทำให้เวลารวม = max(group time) ไม่ใช่ sum(all times)
ตัวอย่างจริง: FongKhumFarm 4 Features
FongKhumFarm ต้องการ 4 features พร้อมกัน:
Features:
1. Crop management dashboard
2. Water schedule automation
3. Sensor data visualization
4. Report generation (PDF)ถ้าทำ sequential: ~4 hours (1h/feature)
ทำ parallel (Marine): 1.5 hours
Spawn Group A (no deps):
Agent 1: Crop dashboard (CRUD + UI)
Agent 2: Water schedule (cron + UI)
Agent 3: Sensor viz (charts + WebSocket)Spawn after Agent 1+2 done:
Agent 4: Report gen (ใช้ data จาก Agent 1+2)
ประหยัดเวลา ~62% จาก parallel execution
Common Patterns
Pattern 1: Feature Branch per Agent
# แต่ละ agent ทำงานบน branch ของตัวเอง
Agent 1: feature/marine-layout
Agent 2: feature/marine-components
Agent 3: feature/marine-pagesOracle merge เมื่อทุก agent เสร็จ
git merge feature/marine-layout
git merge feature/marine-components
git merge feature/marine-pages
Pattern 2: Interface-First
// Oracle กำหนด interface ก่อน spawn agents
// ทุก agent ตกลง interface นี้ก่อนทำงานexport interface BlogPost {
slug: string;
title: string;
content: string;
author: string;
date: string;
}
// Agent 1 implement storage
// Agent 2 implement UI
// ทั้งคู่ใช้ BlogPost interface เดียวกัน → no conflict
Pattern 3: RTK for Token Efficiency
Marine agents ทุกตัวใช้ rtk prefix:
# ❌ Without RTK: ส่ง full output ไปยัง context
git status✅ With RTK: filtered, relevant output only
rtk git statusประหยัด 60-90% tokens ใน bash operations
Metrics จริง
Project | Agents | Sequential Est. | Actual | Savings
marine-blog | 4 | 2.5 hours | 17 min | 89%
FongKhumFarm | 4 | 4 hours | 1.5 hours| 62%
bot-polymarket | 3 | 3 hours | 45 min | 75%
polymarket-redeem | 2 | 1 hour | 20 min | 67%
สรุป
Marine Team Orchestration คือ answer สำหรับ "ทำยังไงให้ development เร็วขึ้น 5-10x":
1. Oracle orchestrates — วิเคราะห์, plan, verify, ไม่ execute เอง 2. 3 agents sweet spot — parallel แต่ยัง coordinated 3. 1 file = 1 owner — กำจัด merge conflicts 4. Interface-first — agents ตกลง contracts ก่อนทำงาน 5. RTK prefix — token efficiency สำหรับทุก bash operation
17 นาทีสู่ production ไม่ใช่โชค — เป็น system