Nâng caoguide Claude CodeCộng đồng

Claude Code Agent Teams: Giải pháp cho vấn đề "60% done rồi context degradation"

Nghe bài viết
00:00

Điểm nổi bật

Nhấn để đến mục tương ứng

  1. 1 có thể 300-500K tokens tổng Tính toán cẩn thận trước khi spin up large teams cho simple tasks. Mỗi teammate là một separate Claude instance — nghĩa là mỗi teammate tiêu tốn tokens như một conversation độc lập. 30-80K tokens tùy task complexity 5-agent team cho một major feature:.
  2. 2 Điều này là feature, không phải bug — đây là cách separate context windows work. Teammates don't inherit the lead's conversation history, so detailed briefs are essential." Bad spawn prompt:.
  3. 3 Addy Osmani không phải người bình thường trong giới web engineering. Là Engineering Lead tại Google Chrome và tác giả của nhiều books về JavaScript performance, Osmani có credibility kỹ thuật hiếm ai bằng. bài viết của ông bắt đầu bằng một pain point mà bất kỳ developer nào đã dùng Claude Code lâu đều nhận ra:.
  4. 4 The more information in the context window, the harder it is for the model to focus on what matters right now." Khi context window đầy, model cần "compress" tất cả previous context vào một dạng có thể xử lý được — và trong quá trình đó, chi tiết bị mất.
  5. 5 Một senior engineer dedicated cho security review sẽ tìm thấy issues mà generalist reviewer bỏ lỡ — không phải vì generalist kém, mà vì focus matters. Claude Code Agent Teams (research preview, v2.1.32+) apply insight này cho AI: Core insight của Osmani là insight về human teams:.
a robotic arm is connected to a computer mouse

Addy Osmani và bài toán "60% done"

Addy Osmani không phải người bình thường trong giới web engineering. Là Engineering Lead tại Google Chrome và tác giả của nhiều books về JavaScript performance, Osmani có credibility kỹ thuật hiếm ai bằng. Khi ông viết về Claude Code Agent Teams, cộng đồng developer lắng nghe.

Và bài viết của ông bắt đầu bằng một pain point mà bất kỳ developer nào đã dùng Claude Code lâu đều nhận ra:

"The single-agent model has a well-known failure mode. You ask Claude to do something complex and it gets maybe 60% of the way there before context degrades."

Bạn giao cho Claude refactor authentication module — một task phức tạp spanning nhiều files và nhiều services. Claude bắt đầu tốt. 20% vào, mọi thứ clean và logical. 40% — vẫn ổn. 60% — bạn thấy những inconsistencies nhỏ bắt đầu xuất hiện. Đến 80%, Claude có vẻ "quên" những quyết định đã đưa ra trước đó. Và cuối cùng, bạn có một codebase nửa-refactored với subtle bugs.

Đây không phải lỗi của Claude. Đây là vật lý của transformer architecture.

Tại sao context degradation xảy ra

Osmani giải thích cơ chế:

"LLMs perform worse as context expands. The more information in the context window, the harder it is for the model to focus on what matters right now."

Khi context window đầy, model cần "compress" tất cả previous context vào một dạng có thể xử lý được — và trong quá trình đó, chi tiết bị mất. Không phải mất hoàn toàn, nhưng bị "blurred" — less accessible, less influential.

Trong practical terms: details về architecture decisions đưa ra ở turn 5 của conversation ảnh hưởng ít hơn đến output ở turn 50 so với turn 10. Đây là fundamental limitation không có workaround hoàn hảo — chỉ có cách management.

Agent Teams: Giải pháp dựa trên insight của Osmani

Core insight của Osmani là insight về human teams: specialists với focused scopes outperform generalists juggling everything. Một senior engineer dedicated cho security review sẽ tìm thấy issues mà generalist reviewer bỏ lỡ — không phải vì generalist kém, mà vì focus matters.

Claude Code Agent Teams (research preview, v2.1.32+) apply insight này cho AI:

Cấu trúc một team

  • Team lead: Tạo team, spawn teammates, coordinate work tổng thể
  • Teammates: Independent Claude Code instances với separate context windows
  • Task list: Shared work items với dependency tracking
  • Mailbox: Direct agent-to-agent messaging (không chỉ report lên lead)

Điểm khác biệt quan trọng so với subagents: teammates có thể communicate trực tiếp với nhau, không phải chỉ qua lead. Điều này cho phép organic collaboration patterns giống human teams hơn.

Bật Agent Teams

# Trong settings.json của Claude Code
{
  "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}

Sau khi enable, bạn có thể describe team trong natural language:

I need a team to refactor our authentication module. Create:
- A lead agent to coordinate
- A backend specialist for OAuth and JWT changes
- A frontend specialist for the login UI updates
- A testing specialist to write and verify tests

Claude sẽ tạo team structure dựa trên description của bạn và bắt đầu phân công work.

Use cases Agent Teams làm tốt nhất

Osmani xác định các pattern nơi agent teams excel:

1. Competing hypotheses cho debugging

Thay vì một agent theo đuổi một theory và bị anchored vào nó, nhiều agents investigate different theories đồng thời. Agent A: "Bug là race condition trong session management". Agent B: "Bug là memory leak trong cache layer". Agent C: "Bug là trong retry logic". Parallel investigation thường tìm root cause nhanh hơn và chính xác hơn.

2. Parallel code review với specialized lenses

Một teammate: security review. Một teammate: performance review. Một teammate: test coverage review. Mỗi reviewer có focused context → tìm thấy issues tốt hơn trong domain của mình.

3. Cross-layer feature work

Frontend, backend, và tests mỗi layer do một agent khác nhau xử lý. Agents có thể work simultaneously và coordinate qua task list. Điều này đặc biệt effective khi layers có ít dependencies với nhau.

4. Research và exploration

Multiple teammates investigate different approaches, share findings, và lead synthesizes kết quả. Thay vì sequential exploration, parallel exploration giảm thời gian đáng kể.

Task sizing: Sweet spot quan trọng

Osmani nhấn mạnh một insight quan trọng về task sizing:

  • Too small: Overhead coordination lớn hơn benefit. Mỗi agent tốn tokens chỉ để spawn, receive brief, và report back.
  • Too large: Teammates làm việc quá lâu không có checkpoints — bạn không biết progress và khó detect early problems.
  • Sweet spot: Tasks mất khoảng 20-40 phút mỗi task, đủ substantial để justify parallel execution nhưng đủ focused để maintain context quality.

Quản lý context trong team setup

Critical insight: teammates không inherit conversation history của lead. Điều này là feature, không phải bug — đây là cách separate context windows work. Nhưng nó có implication:

"Specify task details in spawn prompts. Teammates don't inherit the lead's conversation history, so detailed briefs are essential."

Bad spawn prompt:

Review the authentication code for security issues.

Good spawn prompt:

Review the authentication module in /src/auth/ for security issues.
Focus on:
1. SQL injection vulnerabilities in user lookup queries
2. Token storage and transmission security
3. Session management edge cases

Context: This is a Node.js/Express app, PostgreSQL backend.
We recently added OAuth2 support. The existing JWT code is in auth/jwt.ts.
Report findings in format: [CRITICAL/HIGH/MEDIUM/LOW] description + file:line.

Limitations hiện tại: Honest assessment

Osmani không oversell. Những limitations thực tế:

  • In-process teammates không thể resume sau /rewind
  • Only one team per session — no nested teams
  • Task status có thể lag, potentially blocking dependent work
  • Split pane display cần tmux hoặc iTerm2
  • Shutdown có thể chậm khi teammates đang finish requests
  • Với routine tasks, single session vẫn economical hơn

Chi phí: Cần tính toán cẩn thận

Mỗi teammate là một separate Claude instance — nghĩa là mỗi teammate tiêu tốn tokens như một conversation độc lập. Với Opus:

  • Lead agent session: có thể 50-100K tokens
  • Mỗi teammate: 30-80K tokens tùy task complexity
  • 5-agent team cho một major feature: có thể 300-500K tokens tổng

Tính toán cẩn thận trước khi spin up large teams cho simple tasks. Sử dụng Haiku hoặc Sonnet cho teammates, Opus chỉ cho lead nếu cần.

Để hiểu rõ hơn về cách quản lý chi phí trong multi-agent scenarios, rate limits và cost optimization là tài liệu quan trọng. Với context management strategies, context compaction cho thấy cách tự động xử lý context dài. Và để setup Claude Code đúng cách cho team workflows, CLAUDE.md masterclass là điểm bắt đầu.

Lesson cuối: Decomposition là skill quan trọng nhất

Osmani kết thúc với insight quan trọng nhất của bài:

"The fundamental skill isn't writing less code — it's decomposing problems into structures that agent teams can execute. Success depends on precise specification and clear correctness criteria, not just faster implementation."

Agent Teams không tự động làm mọi thứ tốt hơn. Chúng chỉ tốt hơn nếu bạn giỏi decompose problems thành tasks phù hợp. Đây là skill cần học và practice — nhưng khi bạn master nó, capability tăng không tuyến tính.

Và đây cũng là lesson lớn hơn về AI engineering 2026: tool là quan trọng, nhưng thinking là quan trọng hơn.


Nguồn tham khảo

Tính năng liên quan:agent-teamsclaude-codemulti-agent

Bai viet co huu ich khong?

Bản quyền thuộc về tác giả. Vui lòng dẫn nguồn khi chia sẻ.

Bình luận (0)
Ảnh đại diện
Đăng nhập để bình luận...
Đăng nhập để bình luận
  • Đang tải bình luận...

Đăng ký nhận bản tin

Nhận bài viết hay nhất về sản phẩm và vận hành, gửi thẳng vào hộp thư của bạn.

Bảo mật thông tin. Hủy đăng ký bất cứ lúc nào. Chính sách bảo mật.