KB-6585

DOT + Khai sinh Audit — Task Orchestration

7 min read Revision 1
reportauditdot-toolstask-orchestrationbirth-registry

DOT + Khai sinh Audit — Task Orchestration

Ngày: 2026-03-28 | Session: S142-b


1. DOT TOOLS HIỆN CÓ (liên quan task/comment)

Trong dot/bin/ (file thực thi)

Code Name Chức năng Dùng cho task orchestration?
DOT-078 dot-schema-tasks-ensure Tạo schema collection tasks Infra — đã chạy
DOT-066 dot-schema-comments-extend Extend schema task_comments Infra — đã chạy
dot-schema-comments-ensure Tạo schema comments (generic) Infra — đã chạy
DOT-033 dot-flow-setup-tasks-sync Setup Directus→AD sync flows cho tasks Sync — đã chạy
DOT-019 dot-content-create Tạo item trên BẤT KỲ collection CÓ THỂ DÙNG cho tasks
DOT-022 dot-content-update Cập nhật item trên BẤT KỲ collection CÓ THỂ DÙNG cho tasks
DOT-018 dot-content-approve Đổi status item CÓ THỂ DÙNG cho tasks
DOT-021 dot-content-list Liệt kê items CÓ THỂ DÙNG cho tasks
DOT-020 dot-content-delete Xóa item Có thể dùng

Nhận xét

  • dot-content-* là generic tools, nhận <collection> làm argument đầu tiên
  • dot-content-create tasks --json '{...}' SẼ HOẠT ĐỘNG
  • dot-content-update tasks 16 --json '{...}' SẼ HOẠT ĐỘNG
  • KHÔNG CẦN tạo dot-task-create riêng — dùng dot-content-create + collection=tasks

2. DOT TOOLS CẦN CHO QUY TRÌNH vs HIỆN CÓ

Thao tác DOT cần Hiện có? Cách dùng
Tạo task mới dot-task-create (generic) dot-content-create tasks --json '{...}'
Cập nhật task field dot-task-update (generic) dot-content-update tasks <id> --json '{...}'
Đổi task status dot-task-status (generic) dot-content-approve <id> tasks <status>
Tạo comment dot-task-comment THIẾU Cần tạo hoặc dùng dot-content-create task_comments
Đọc task + comments dot-task-read THIẾU Không có dot-content-read. Dùng API/MCP trực tiếp.
Approve/reject (action) dot-task-approve THIẾU dot-content-approve chỉ đổi status, KHÔNG set action field

THIẾU THỰC SỰ (3 tools)

# Tên đề xuất Thao tác Ưu tiên Lý do
1 dot-task-comment Tạo comment với tab_scope + agent_type P1 Quy trình cốt lõi — mỗi bước điều hành = 1 comment
2 dot-task-read Đọc task + tất cả comments (formatted) P2 Agent cần context trước khi làm việc
3 dot-task-approve Set action=approve/reject trên comment P3 Checkpoint L1 — AI review

CÓ THỂ DÙNG NGAY (workaround)

  • Tạo comment: dot-content-create task_comments --json '{"task_id":16,"tab_scope":"prompt","agent_type":"claude_code","content":"...","status":"active"}'
  • Đọc task: Directus API hoặc MCP directus_get_item tasks 16
  • Approve: dot-content-update task_comments <id> --json '{"action":"approve"}'

3. KHAI SINH

Collection meta_catalog birth_registry species labels
tasks CAT-009 (7 records, actual=7) ✅ 7/7 KHỚP ✅ SPE-TSK (governed) ✅ Chưa kiểm tra
task_comments THIẾU 98 births (>75 records — có orphan) ⚠️ checkpoint_support (observed) ✅ Chưa kiểm tra

Vấn đề

  • task_comments KHÔNG CÓ trong meta_catalog → pivot_count() không đếm, Registries không hiện
  • birth_registry có 98 records nhưng task_comments chỉ 75 → 23 orphan births (có thể do xóa comments)
  • tasks species = task (governed) — đúng
  • task_comments species = checkpoint_support (observed) — hợp lý cho comment

4. REGISTRIES

Collection collection_registry Governance Dòng
tasks COL-098 ✅ governed group: — (root)
task_comments COL-097 ✅ observed group: tasks
task_checkpoints COL-096 ✅ observed group: tasks
ai_discussion_comments COL-002 ✅ observed
comments (generic) COL-115 ✅ observed

DOT tools registration gap

  • 145 files trong dot/bin/ vs 114 registered trong dot_tools table
  • 31 tools CHƯA đăng ký (bao gồm dot-birth-backfill, dot-inspect-pen, dot-species-register, dot-collection-register, etc.)
  • Tất cả DOT trong DB đều CÓ file tương ứng (0 orphan DB entries)

5. WEB UI

Trang URL HTTP Có Nuxt page?
Task list /knowledge/current-tasks 200 ✅ index.vue ✅
Task detail /knowledge/current-tasks/16 302 → redirect [id]/index.vue ✅
Task detail + tab /knowledge/current-tasks/16/prompt [id]/[tab].vue ✅
Modules list /knowledge/modules 200 ✅ index.vue ✅
Module detail (M-001) /knowledge/modules/7 200 ✅ [id].vue ✅

User giám sát tại:

  • Tasks: https://vps.incomexsaigoncorp.vn/knowledge/current-tasks
  • Task #16 (M3.5): https://vps.incomexsaigoncorp.vn/knowledge/current-tasks/16
  • Modules: https://vps.incomexsaigoncorp.vn/knowledge/modules

6. KẾT LUẬN

Sẵn sàng chạy quy trình: CÓ (với workaround)

Dùng dot-content-create/update trên collection tasks và task_comments là ĐỦ để vận hành. Không cần tạo DOT mới để bắt đầu.

Thiếu (ưu tiên tạo sau):

  1. P1: dot-task-comment — wrapper cho dot-content-create task_comments (thêm defaults: status=active, agent_type tự detect)
  2. P2: dot-task-read — đọc task + comments formatted (hiện dùng MCP)
  3. P3: dot-task-approve — set action field (hiện dùng dot-content-update)
  4. P2: meta_catalog entry cho task_comments — hiện THIẾU, cần khai sinh CAT-xxx
  5. P3: Cleanup 23 orphan births trong task_comments birth_registry
  6. P3: 31 DOT tools chưa đăng ký trong dot_tools table

Có thể bắt đầu NGAY:

  • Tạo task: dot-content-create tasks --json '{...}'
  • Tạo comment: dot-content-create task_comments --json '{"task_id":X,"tab_scope":"prompt","agent_type":"claude_code","content":"...","status":"active"}'
  • Đổi status: dot-content-approve <id> tasks active
  • Web UI: user mở /knowledge/current-tasks để giám sát