# โครงสร้างข้อมูลงาน

> Task คือ JSON object ที่มีโครงสร้างดังนี้:

Source: https://bifrost5.com/th/foundry/docs/task-schema/

# โครงสร้างข้อมูลงาน

Information

Describe an idea in plain words and get back a checked, ready-to-run task list from the Production-Grade planning companion.

[See editions](/th/foundry/docs/editions)

Task คือ JSON object ที่มีโครงสร้างดังนี้:

| ฟิลด์ | ประเภทข้อมูล | จำเป็นต้องระบุ | คำอธิบาย |
| --- | --- | --- | --- |
| `task_id` | string | ใช่ | รหัสระบุเฉพาะ (Unique identifier) |
| `project_id` | string | ใช่ | ชื่อไดเรกทอรี sandbox ภายใต้ `sandbox/` |
| `intent` | string | ใช่ | คำอธิบายโดยย่อ |
| `tool` | string | ไม่ | `cursor` \| `gemini` \| `copilot` \| `codex` \| `claude` \| `ollama` ใช้กำหนด provider แทนค่าเดิม หากเว้นไว้ ระบบจะเลือกตาม strategy |
| `instructions` | string | ใช่ | คำสั่งและรายละเอียดการทำงานสำหรับ agent |
| `acceptance_criteria` | string[] | ใช่ | เงื่อนไขทั้งหมดที่ต้องผ่านเพื่อให้งานเสร็จสมบูรณ์ |
| `retry_policy` | object | ไม่ | `max_retries`, `backoff_strategy` (linear \| exponential) |
| `status` | string | ไม่ | `pending` \| `in_progress` \| `completed` \| `blocked` |
| `working_directory` | string | ไม่ | พาธสัมพัทธ์เทียบจาก sandbox root |
| `agent_mode` | string | ไม่ | เช่น `opus-4.5`, `auto` |
| `affects_files` | string[] | ใช่ (กรณีรันแบบ parallel) | ไฟล์ที่งานนี้จะแก้ไข ใช้สำหรับทำ file locking |
| `depends_on` | string[] | ไม่ | Task ID ที่ต้องทำงานให้เสร็จก่อน โดยจะเลื่อนขึ้นมาทำงานอัตโนมัติเมื่อเงื่อนไขครบ |
| `test_command` | string | ไม่ | คำสั่งที่ใช้รันเพื่อตรวจสอบความถูกต้อง |
| `tests_required` | boolean | ไม่ | กำหนดว่าต้องรันเทสต์ผ่านหรือไม่ |

## ตัวอย่างไฟล์ Task

```
[
  {
    "task_id": "frontend-001",
    "intent": "Extend existing React component",
    "tool": "gemini",
    "instructions": "Extend the existing App.tsx component to add user authentication.",
    "acceptance_criteria": [
      "App.tsx includes authentication logic",
      "Uses existing React Router setup"
    ],
    "retry_policy": { "max_retries": 2 },
    "status": "pending"
  }
]
```

## วงจรการทำงานของ Task

**Pending** → **In progress** → **Completed** (ผ่านการตรวจสอบ) หรือ **Blocked** (ไม่สำเร็จหลังลองซ้ำครบจำนวนครั้งสูงสุดแล้ว)
