messages ─► LLM ─► tool_use? ─ no ─► answer, stop
▲ │ yes
│ ▼
observation ◄─ run tools
Vòng while: gọi LLM, chạy tool nó yêu cầu, nối kết quả, gọi lại, dừng khi không còn tool call.A while loop: call the LLM, run the tools it asks for, append results, repeat until no tool call remains.
- Dùng choUse for
- Sửa bug nhiều file, tra cứu nhiều bước, tự động hoá thao tác hệ thống.Multi-file bug fixes, multi-step research, system automation.
- ĐượcGain
- Lõi vài chục dòng; thêm năng lực bằng thêm tool.A few dozen lines of core; new capability means a new tool.
- MấtLose
- Có thể lặp vô hạn; chi phí khó đoán.Can loop forever; cost is hard to predict.
Đổi khả năng dự đoán lấy khả năng xử lý việc không viết trước được kịch bản.Trades predictability for handling work you can't script in advance.
Nhận biết:Sign: bạn không liệt kê trước được các bước.you can't list the steps up front.
C2Context & compaction
LõiCore
before: [sys][m1 … m40][m41 … m50]
after: [sys][summary ][m41 … m50]
└ *tail ┘
Gần đầy context window thì tóm tắt phần cũ, giữ nguyên phần đuôi gần nhất.Near the limit, summarise the old part and keep the recent tail verbatim.
- Dùng choUse for
- Phiên hàng giờ, refactor hàng chục file, agent chạy nền.Hours-long sessions, large refactors, background agents.
- ĐượcGain
- Phiên gần như không giới hạn; ít token mỗi lượt.Near-unlimited sessions; fewer tokens per turn.
- MấtLose
- Mất chi tiết; phá prompt cache; tóm tắt sai thì lỗi lan âm thầm.Lost detail; broken prompt cache; a bad summary spreads silently.
Đổi độ trung thực của lịch sử lấy độ dài phiên.Trades fidelity of history for session length.
Nhận biết:Sign: phiên bình thường đã vượt nửa context window.a normal session already passes half the window.
C3Headless harness
LõiCore
TUI ┐
CLI ┼─► harness.run(task) ─► events:
Cron ┘ text, tool_start, tool_end, ask, done
Lõi agent không gắn với giao diện nào; nhận task, phát luồng sự kiện.The agent core with no UI attached; takes a task, emits events.
- Dùng choUse for
- Chạy cả local lẫn cloud, chạy song song, eval trên code production.Local and cloud alike, parallel runs, evals on production code.
- ĐượcGain
- Một lõi, nhiều giao diện; kiểm thử không cần UI.One core, many shells; tests without a UI.
- MấtLose
- Phải thiết kế giao thức sự kiện từ đầu; mọi chỗ hỏi người cần phương án tự động.Event protocol designed up front; every human prompt needs an automated answer.
Đổi công thiết kế ban đầu lấy việc dùng lại một lõi ở mọi môi trường.Trades up-front design for one core reused everywhere.
Nhận biết:Sign: cần gọi agent từ nơi không có người.you need to call the agent where nobody is sitting.
I1Interactive
Giao diệnInterface
human ─► TUI ─► [queue] ─► gate ─► harness
▲ │ Esc: straight through
└──── streamed events ◄──┘
TUI có steering queue (tin nhắn chờ chèn ở ranh giới lượt), priority gate (lệnh ngắt đi thẳng) và luồng sự kiện streaming.A TUI with a steering queue (messages injected at turn boundaries), a priority gate (interrupts go straight through) and streamed events.
- Dùng choUse for
- Pair-programming, việc cần chỉnh hướng, khám phá codebase lạ.Pair-programming, mid-course corrections, exploring unfamiliar code.
- ĐượcGain
- Sửa hướng sớm đỡ tốn token; người duyệt quyền tại chỗ.Early correction saves tokens; humans approve on the spot.
- MấtLose
- Chèn sai lúc phá cặp tool_use/tool_result; huỷ giữa chừng để lại trạng thái dở.Bad timing breaks tool_use/tool_result pairs; cancels leave partial state.
Đổi khả năng mở rộng lấy chất lượng nhờ có người lái theo thời gian thực.Trades scale for quality from real-time human steering.
Nhận biết:Sign: người dùng hay muốn nói "khoan, không phải file đó".users keep wanting to say "wait, not that file".
I2Remote
Giao diệnInterface
CLI ─┐ ┌─► harness #1 ─► PR
Hook ┼─► job queue ┼─► harness #2 ─► PR
Cron ┘ └─► harness #N ─► PR
Chạy không cần người trông, kích hoạt qua CLI, webhook hoặc cron; N phiên song song, mỗi phiên một sandbox.Unattended runs triggered by CLI, webhook or cron; N parallel sessions, one sandbox each.
- Dùng choUse for
- Tự sửa khi CI thất bại, phân loại issue, báo cáo hằng đêm.Auto-fixing CI, issue triage, nightly reports.
- ĐượcGain
- Chạy 24/7; thông lượng nhân N.Runs 24/7; throughput times N.
- MấtLose
- Không ai duyệt quyền; lỗi âm thầm nhân N lần; trigger bị spam thì chi phí bùng nổ.No one approves; silent failures times N; spammed triggers explode cost.
Đổi sự giám sát của con người lấy thông lượng.Trades human oversight for throughput.
Nhận biết:Sign: có trigger rõ ràng và đầu ra kiểm chứng được.a clear trigger and a verifiable output.
loop ─► provider (internal fmt) ─┬─► Anthropic
├─► OpenAI
└─► local
Lớp trừu tượng chuẩn hoá tin nhắn, tool call, streaming và lỗi giữa các nhà cung cấp.An abstraction normalising messages, tool calls, streaming and errors across vendors.
- Dùng choUse for
- Định tuyến sang model rẻ, dự phòng khi sập, so sánh trong eval.Routing to cheaper models, failover, eval comparisons.
- ĐượcGain
- Đổi model bằng một dòng config.Swap models with one config line.
- MấtLose
- Rơi về mẫu số chung, mất caching, thinking, citations.Lowest common denominator; lose caching, thinking, citations.
Đổi tính năng riêng của từng model lấy sự độc lập nhà cung cấp.Trades vendor-specific features for vendor independence.
Nhận biết:Sign: cần đổi model mà không đụng vào vòng lặp.you need to swap models without touching the loop.
new session ─► load CLAUDE.md / AGENTS.md
─► work ─► (optional) write lessons
Thông tin sống qua các phiên: quy ước dự án, lệnh build/test, bài học cũ.Information that survives sessions: project conventions, build/test commands, past lessons.
- Dùng choUse for
- Quy ước code, lệnh chính xác, lỗi từng gặp.Code conventions, exact commands, known pitfalls.
- ĐượcGain
- Không dạy lại mỗi phiên; chỉ vài trăm token.No re-teaching; a few hundred tokens.
- MấtLose
- Memory cũ được tin như chân lý; injection lọt vào thì sống mãi.Stale memory trusted as truth; injected text persists forever.
Đổi một phần context cố định mỗi lượt lấy việc không phải dạy lại.Trades a fixed slice of context each turn for never re-teaching.
Nhận biết:Sign: sang phiên thứ hai đã phải nhắc lại.you repeat yourself by session two.
context: [pdf: "read/write PDFs"] [release: …]
│ relevant?
▼
load skills/pdf/SKILL.md ─► follow
Thư mục hướng dẫn và script; chỉ mô tả nằm sẵn trong context, nội dung nạp khi cần.Folders of instructions and scripts; only the description sits in context, the body loads on demand.
- Dùng choUse for
- Quy trình nội bộ, định dạng file đặc thù, checklist review.Internal procedures, unusual file formats, review checklists.
- ĐượcGain
- Hàng chục skill gần như không tốn context.Dozens of skills at near-zero context cost.
- MấtLose
- Mô tả kém thì không bao giờ được nạp.A weak description means it never loads.
Đổi sự chắc chắn hướng dẫn được đọc lấy context gọn.Trades certainty of being read for a lean context.
Nhận biết:Sign: hướng dẫn dài nhưng chỉ cần cho một nhóm việc.long instructions needed for only one kind of task.
tools ─► [ own fs | net: allowlist | no secrets ]
─► result
Môi trường cô lập để chạy lệnh và sửa file: container, microVM hoặc cloud (Modal là một lựa chọn).An isolated place to run commands and edit files: container, microVM or cloud (Modal is one option).
- Dùng choUse for
- Chạy code model viết, chạy song song, thao tác có thể phá máy.Running model-written code, parallel runs, risky operations.
- ĐượcGain
- Thiệt hại nằm trong hộp; mỗi phiên môi trường sạch.Damage stays in the box; clean env per session.
- MấtLose
- Khởi động lạnh, đồng bộ file và secret phức tạp, tốn compute.Cold starts, tricky file and secret sync, compute cost.
Đổi độ trễ và độ phức tạp hạ tầng lấy giới hạn thiệt hại khi model sai.Trades latency and infra complexity for contained damage.
Nhận biết:Sign: agent có tool bash.your agent has a bash tool.
tool_call ─► policy ─┬─ allow ─► run
├─ ask ─► human / deny if headless
└─ deny ─► reason back to model
Chính sách allow / ask / deny theo tool, đường dẫn, lệnh; khai báo trong config.An allow / ask / deny policy per tool, path and command, declared in config.
- Dùng choUse for
- git push, rm, migration, API tốn tiền.git push, rm, migrations, paid APIs.
- ĐượcGain
- Chặn trước khi xảy ra; có dấu vết audit.Blocks before it happens; audit trail.
- MấtLose
- Hỏi nhiều thì người bấm "đồng ý" theo phản xạ; khớp chuỗi dễ bị lách.Too many prompts train reflex "yes"; string matching is bypassable.
Đổi tốc độ và sự tự chủ của agent lấy an toàn.Trades agent speed and autonomy for safety.
Nhận biết:Sign: tool có tác dụng phụ không hoàn tác được.the tool has irreversible side effects.
edit ─► file changed ─► LSP ─► errors
─► into observation
Chạy language server để lấy lỗi, định nghĩa, tham chiếu như IDE.Runs a language server for errors, definitions and references, like an IDE.
- Dùng choUse for
- Đổi tên toàn codebase, bắt lỗi type ngay sau khi sửa.Codebase-wide renames, catching type errors after edits.
- ĐượcGain
- Phản hồi lỗi tức thì, chính xác hơn grep.Instant error feedback, sharper than grep.
- MấtLose
- Tốn RAM, mỗi ngôn ngữ một server, warning gây nhiễu.Memory-hungry, one server per language, noisy warnings.
Đổi một tiến trình vận hành thêm lấy phản hồi tức thì về độ đúng của code.Trades an extra process to run for instant correctness feedback.
Nhận biết:Sign: ngôn ngữ có type checker, codebase vài chục file trở lên.a typed language and a codebase of dozens of files or more.
E1Evals & observability
Đo lườngMeasurement
change ─► benchmark ─► vs baseline ─► better ─► merge
└ worse ─► replay trace
Benchmarks để chấm, regressions để chạy lại sau mỗi thay đổi, replays để phát lại lần chạy lỗi; trace mọi lượt.Benchmarks to score, regressions to re-run after each change, replays to re-play failures; trace every turn.
- Dùng choUse for
- Trước khi đổi model, sau khi sửa prompt, điều tra job lỗi.Before model swaps, after prompt edits, investigating failed jobs.
- ĐượcGain
- Số thay cảm tính. Tác giả khoá học dẫn LangChain: chỉ đổi harness, Terminal-Bench từ khoảng 53% lên 67%.Numbers over gut feel. The course author cites LangChain: harness-only changes took Terminal-Bench from about 53% to 67%.
- MấtLose
- Bộ task tốt tốn công nhất; phải chạy nhiều lần vì không tất định.Good task sets are the costliest part; non-determinism needs repeat runs.
Đổi tốc độ ra tính năng lúc đầu lấy việc biết chắc mình đang tiến hay lùi.Trades early velocity for knowing whether you're moving forward or back.
Nhận biết:Sign: không trả lời được "thay đổi này tốt hơn hay tệ hơn".you can't say whether a change helped or hurt.