Artifacts & Hệ Thống Knowledge

Task lists, implementation plans, walkthroughs, screenshots, recordings và persistent knowledge

Artifacts Là Gì?

Artifacts là structured documents mà agent tạo trong quá trình làm việc. Phục vụ communication, documentation và proof of work.

Các Loại Artifact

1. Task List (task.md)

Checklist sống theo dõi tiến trình:

# Task: Thêm Authentication

- [x] Nghiên cứu setup hiện tại
- [x] Tạo database schema
- [/] Implement login API (đang làm)
- [ ] Build login UI
- [ ] Thêm tests

2. Implementation Plan (implementation_plan.md)

Tạo ở PLANNING mode. Agent đề xuất cách tiếp cận trước khi code:

# Thêm Authentication

## Thay Đổi Đề Xuất

### Database Layer

#### [NEW] src/db/schema/users.ts

### API Layer

#### [MODIFY] src/app/api/auth/route.ts

Hành vi quan trọng: Agent yêu cầu bạn review và approve plan trước khi bắt đầu.

3. Walkthrough (walkthrough.md)

Tạo sau khi hoàn thành. Ghi lại những gì đã làm, test và results.

4. Screenshots & Browser Recordings

Agent chụp screenshots để document UI changes và record browser sessions dạng video WebP.

5. Knowledge Items

Loại artifact mạnh nhất — persistent across conversations:

Cách Knowledge hoạt động:

  1. Sau hội thoại, Knowledge Subagent review nội dung
  2. Extract thông tin và patterns hữu ích
  3. Tạo hoặc update Knowledge Items
  4. Ở hội thoại sau, agent check items này TRƯỚC

Agent học theo thời gian. Hội thoại thứ 10 về project của bạn hiệu quả hơn đáng kể so với lần đầu.

Luồng Artifact Trong Thực Tế

1. Bạn: "Thêm dark mode toggle"
2. Agent tạo task.md → Checklist các bước
3. Agent tạo implementation_plan.md → BẠN APPROVE
4. Agent EXECUTION → Code, cập nhật task.md
5. Agent VERIFICATION → Screenshots, walkthrough
6. Knowledge Subagent → Tạo "Theme System" knowledge item

Best Practices

  1. Review plans — Đừng skip implementation plan review
  2. Check walkthroughs — Bắt lỗi bạn có thể miss
  3. Tận dụng knowledge — Hỏi “bạn biết gì về project này?”
  4. Giữ artifacts sạch — Xóa knowledge items cũ
  5. Dùng screenshots — Đặc biệt cho UI work

Tiếp Theo

Ở bài cuối, chúng ta sẽ kết hợp tất cả với ví dụ workflow thực tế.