Codex · diff
v1.0.0 to v1.0.0
51 added, 51 removed. Audit A to A.
---
name: "Codex"
- description: "Mission control: tạo task, giao cho agent/team, chờ người duyệt, worker chạy nền, nghiệm thu kết quả."
+ description: "Mission control: create tasks, assign to an agent/team, wait for human approval, worker runs in the background, accept results."
version: "1.0.0"
author: "TubeCreate"
---
- # 🎛 Codex — bảng điều khiển công việc
+ # 🎛 Codex — work control panel
- Codex là nơi chứa MỌI việc thật sự cần làm. Bất kỳ yêu cầu nào **chạy lâu**, **tốn tài nguyên** (LLM, browser, tải/upload), **thay đổi dữ liệu hoặc thế giới bên ngoài**, hoặc **cần người xem lại kết quả** → KHÔNG làm inline, mà tạo task Codex rồi báo số task cho người dùng. Chỉ trả lời trực tiếp khi câu hỏi là tra cứu/giải thích nhanh, không tạo ra thay đổi nào.
+ Codex is where ALL work that truly needs doing lives. Any request that **runs long**, is **resource-heavy** (LLM, browser, download/upload), **changes data or the outside world**, or **needs someone to review the result** → do NOT do it inline; create a Codex task and report the task number to the user. Only answer directly when the question is a quick lookup/explanation that produces no change.
- ## 🛑 Luật duyệt (BẮT BUỘC)
- - Task do AI tạo **LUÔN** ở trạng thái `pending_approval` và **chờ người duyệt**. AI **không được** tự duyệt task của mình.
- - Sau khi tạo task, **TUYỆT ĐỐI KHÔNG** nói rằng việc đã chạy/đã xong. Chỉ được nói: đã tạo `#<n>`, đang chờ duyệt, và hướng dẫn gõ `approve <n>`.
- - Vòng đời: `pending_approval → queued → running → review → done` (+ `failed` có thể retry, `rejected`, `cancelled`).
+ ## 🛑 Approval rules (MANDATORY)
+ - Tasks created by the AI are **ALWAYS** in `pending_approval` state and **wait for human approval**. The AI **must not** approve its own tasks.
+ - After creating a task, **NEVER** say the work has run/finished. Only say: created `#<n>`, awaiting approval, and instruct the user to type `approve <n>`.
+ - Lifecycle: `pending_approval → queued → running → review → done` (+ `failed` can be retried, `rejected`, `cancelled`).
- ## ⚠️ Luật PAYLOAD PHẲNG (BẮT BUỘC)
- Bộ phân tích action chỉ đọc được JSON **một tầng, toàn giá trị vô hướng** (string/number/bool). **KHÔNG** dùng object lồng nhau, **KHÔNG** dùng mảng trong action.
- Muốn chia việc lớn thành nhiều việc nhỏ → phát **NHIỀU action `codex_create_task` liên tiếp**, mỗi action một `goal`. Không bao giờ gói danh sách subtask vào một action.
+ ## ⚠️ FLAT PAYLOAD rule (MANDATORY)
+ The action parser can only read JSON that is **one level deep, all scalar values** (string/number/bool). Do **NOT** use nested objects, do **NOT** use arrays in an action.
+ To split a large job into smaller ones → emit **MULTIPLE consecutive `codex_create_task` actions**, one `goal` per action. Never pack a list of subtasks into a single action.
- ## 📥 codex_create_task — tạo việc mới
+ ## 📥 codex_create_task — create a new task
```json
- {"action": "codex_create_task", "goal": "Mô tả đầy đủ việc cần làm", "title": "Tên ngắn", "assignee_type": "agent", "assignee": "Tên agent hoặc tên team", "skill": "Tên skill (tùy chọn)", "priority": 0}
+ {"action": "codex_create_task", "goal": "Full description of what needs to be done", "title": "Short title", "assignee_type": "agent", "assignee": "Agent name or team name", "skill": "Skill name (optional)", "priority": 0}
```
- - `goal` (bắt buộc) — mô tả tự đủ nghĩa, worker sẽ chỉ đọc chuỗi này.
- - `assignee_type`: `"agent"` hoặc `"team"`. `assignee` nhận **TÊN** (khớp tên agent/team đã có), không cần ID.
- - `priority`: số càng lớn chạy càng trước (mặc định 0).
+ - `goal` (required) — a self-contained description; the worker reads only this string.
+ - `assignee_type`: `"agent"` or `"team"`. `assignee` takes a **NAME** (matching an existing agent/team name), no ID needed.
+ - `priority`: the higher the number, the sooner it runs (default 0).
- ## 📥 codex_list_tasks — xem danh sách
+ ## 📥 codex_list_tasks — view the list
```json
{"action": "codex_list_tasks", "status": "active"}
```
- `status`: `active` (mặc định) | `pending_approval` | `queued` | `running` | `review` | `done` | `failed` | `rejected` | `cancelled`.
+ `status`: `active` (default) | `pending_approval` | `queued` | `running` | `review` | `done` | `failed` | `rejected` | `cancelled`.
- ## 📥 codex_task_status — chi tiết một task
+ ## 📥 codex_task_status — details of one task
```json
{"action": "codex_task_status", "task": "3"}
```
- `task` nhận số ngắn (`3`), id đầy đủ, hoặc một phần tiêu đề.
+ `task` takes a short number (`3`), the full id, or part of the title.
- ## 📥 codex_approve / codex_reject — quyết định thay người dùng
- Chỉ dùng khi **người dùng nói rõ** muốn duyệt/từ chối.
+ ## 📥 codex_approve / codex_reject — decide on the user's behalf
+ Only use when the **user explicitly states** they want to approve/reject.
```json
- {"action": "codex_approve", "task": "3", "note": "Lý do (tùy chọn)"}
+ {"action": "codex_approve", "task": "3", "note": "Reason (optional)"}
```
```json
- {"action": "codex_reject", "task": "3", "note": "Lý do (tùy chọn)"}
+ {"action": "codex_reject", "task": "3", "note": "Reason (optional)"}
```
- ## 📥 codex_cancel — huỷ task đang chờ/đang chạy
+ ## 📥 codex_cancel — cancel a pending/running task
```json
{"action": "codex_cancel", "task": "3"}
```
- ## 📥 codex_retry — chạy lại task `failed` hoặc `review`
+ ## 📥 codex_retry — re-run a `failed` or `review` task
```json
{"action": "codex_retry", "task": "3"}
```
- ## 🌐 HTTP API (qua `run_api`, prefix `/api/v1/codex`)
- Ưu tiên dùng các action `codex_*` ở trên. Chỉ dùng `run_api` cho các endpoint GET không có trong action list.
+ ## 🌐 HTTP API (via `run_api`, prefix `/api/v1/codex`)
+ Prefer the `codex_*` actions above. Only use `run_api` for GET endpoints not in the action list.
- | Method | Endpoint | Mục đích |
+ | Method | Endpoint | Purpose |
|--------|----------|----------|
- | GET | `/api/v1/codex/stats` | Đếm task theo trạng thái |
- | GET | `/api/v1/codex/tasks?status=&limit=` | Danh sách task |
- | POST | `/api/v1/codex/tasks` | Tạo task (dùng `codex_create_task` thay thế) |
+ | GET | `/api/v1/codex/stats` | Count tasks by status |
+ | GET | `/api/v1/codex/tasks?status=&limit=` | Task list |
+ | POST | `/api/v1/codex/tasks` | Create a task (use `codex_create_task` instead) |
| GET | `/api/v1/codex/tasks/{id}` | Task + event log |
- | GET | `/api/v1/codex/tasks/{id}/events?after=&limit=` | Nhật ký sự kiện |
- | POST | `/api/v1/codex/tasks/{id}/approve` · `/reject` · `/cancel` · `/retry` | Quyết định |
- | POST | `/api/v1/codex/tasks/{id}/review` | Nghiệm thu (`accepted: true/false`) |
- | POST | `/api/v1/codex/tasks/{id}/plan` | AI chia nhỏ mục tiêu (CHẬM 10–60s) |
- | GET | `/api/v1/codex/assignees` | Danh sách agent + team |
- | GET | `/api/v1/codex/worker` | Trạng thái worker |
+ | GET | `/api/v1/codex/tasks/{id}/events?after=&limit=` | Event log |
+ | POST | `/api/v1/codex/tasks/{id}/approve` · `/reject` · `/cancel` · `/retry` | Decisions |
+ | POST | `/api/v1/codex/tasks/{id}/review` | Acceptance (`accepted: true/false`) |
+ | POST | `/api/v1/codex/tasks/{id}/plan` | AI breaks down the goal (SLOW 10–60s) |
+ | GET | `/api/v1/codex/assignees` | List of agents + teams |
+ | GET | `/api/v1/codex/worker` | Worker status |
- Bảng trực quan: `GET /codex`.
+ Visual dashboard: `GET /codex`.
- ## ⌨️ Lệnh text (0 token — người dùng gõ thẳng, AI không cần xử lý)
+ ## ⌨️ Text commands (0 token — the user types them directly, the AI need not process them)
`codex` · `codex <n>` · `approve <n>` · `reject <n>` · `retry <n>` · `accept <n>` · `codex cancel <n>` · `codex running|done|failed`
- («cancel»/«huỷ» đứng một mình đã bị luồng xác nhận kế hoạch của bot chiếm, nên huỷ task phải gõ kèm tiền tố `codex`.)
- Khi tin nhắn người dùng đúng dạng này, **đừng** sinh action — hệ thống tự xử lý.
+ (A bare «cancel»/«huỷ» is already claimed by the bot's plan-confirmation flow, so cancelling a task must be typed with the `codex` prefix.)
+ When the user's message matches this form, **do not** emit an action — the system handles it itself.
- ## 💡 Ví dụ
- **User:** "Nghiên cứu 5 đối thủ kênh YouTube của tôi rồi viết báo cáo"
- → việc dài, tốn tài nguyên, cần review ⇒ tạo task, không tự làm:
+ ## 💡 Examples
+ **User:** "Research 5 of my competitor YouTube channels, then write a report"
+ → long, resource-heavy, needs review ⇒ create a task, don't do it yourself:
```json
- {"action": "codex_create_task", "goal": "Nghiên cứu 5 kênh YouTube đối thủ cùng chủ đề, so sánh tần suất đăng, tiêu đề, thumbnail, lượt xem trung bình và viết báo cáo tổng hợp kèm đề xuất", "title": "Báo cáo 5 đối thủ YouTube", "assignee_type": "team", "assignee": "Research Team"}
+ {"action": "codex_create_task", "goal": "Research 5 competitor YouTube channels in the same niche; compare posting frequency, titles, thumbnails, average views, and write a summary report with recommendations", "title": "5 YouTube competitors report", "assignee_type": "team", "assignee": "Research Team"}
```
- **User:** "Dịch bài này rồi đăng lên WordPress, xong thì tạo ảnh minh hoạ"
- → hai việc ⇒ **hai action riêng biệt**, không nhét mảng:
+ **User:** "Translate this article then post it to WordPress, and once done create an illustration"
+ → two jobs ⇒ **two separate actions**, don't cram them into an array:
```json
- {"action": "codex_create_task", "goal": "Dịch bài viết sang tiếng Việt và đăng lên WordPress", "title": "Dịch + đăng WordPress", "assignee_type": "agent", "assignee": "Writer"}
+ {"action": "codex_create_task", "goal": "Translate the article into Vietnamese and publish it to WordPress", "title": "Translate + publish to WordPress", "assignee_type": "agent", "assignee": "Writer"}
```
```json
- {"action": "codex_create_task", "goal": "Tạo ảnh minh hoạ cho bài viết vừa đăng lên WordPress", "title": "Ảnh minh hoạ bài viết", "assignee_type": "agent", "assignee": "Designer"}
+ {"action": "codex_create_task", "goal": "Create an illustration for the article just published to WordPress", "title": "Article illustration", "assignee_type": "agent", "assignee": "Designer"}
```
- **User:** "Có task nào đang chờ tôi duyệt không?"
+ **User:** "Are there any tasks waiting for my approval?"
```json
{"action": "codex_list_tasks", "status": "pending_approval"}
```
- **User:** "Task 3 tới đâu rồi?"
+ **User:** "How is task 3 going?"
```json
{"action": "codex_task_status", "task": "3"}
```