TL;DR
Addy Osmani phân tích harness engineering: agent = model + harness. Decent model với great harness luôn thắng great model với bad harness. Mỗi lỗi agent mắc phải phải trở thành permanent rule. Harness không shrink khi model improve — nó shift sang horizon mới.
Hai năm qua, cả ngành chỉ tranh cãi model nào "thông minh" nhất. Addy Osmani chỉ ra điều mọi người bỏ qua: model chỉ là 1 input. Phần còn lại — prompts, tools, hooks, sandboxes, subagents, feedback loops — mới thực sự quyết định agent làm được gì.
📰 "Agent Harness Engineering" là gì?
Concept này do @Vtrivedy10 đặt tên. Định nghĩa cốt lõi:
Harness = toàn bộ code, config, và execution logic không phải model. Bao gồm:
- System prompts, CLAUDE.md, AGENTS.md, skill files, subagent instructions
- Tools, MCP servers, và technical descriptions của chúng
- Filesystem, sandboxes, headless browsers
- Orchestration logic: spawn subagents, handoffs, routing models
- Hooks & middleware: lint checks, context compaction, deterministic execution
- Observability: logs, traces, cost & latency metering
Raw model không phải agent. Nó chỉ thành agent khi harness cung cấp state, tool execution, feedback loops, và enforceable constraints.
⚖️ Decent Model + Great Harness > Great Model + Bad Harness
Claude Code, Cursor, Codex, Aider, Cline — tất cả đều là harness. Model bên dưới có thể giống nhau, nhưng behavior bạn trải nghiệm phụ thuộc 90% vào harness.
Benchmark thực tế chứng minh: model leading chạy trong framework off-the-shelf thường score thấp hơn cùng model đó chạy trong custom harness highly-tuned. Di chuyển model sang environment có codebase tools tốt hơn, prompts chặt hơn, back-pressure sharper — capabilities bị bỏ lỡ trước đó sẽ xuất hiện.
Khoảng cách giữa "model theoretically có thể làm gì" và "bạn thực sự thấy nó làm gì" — phần lớn là harness gap.
🔧 Reframe "Skill Issue"
Khi agent làm điều vô lý, engineer mặc định đổ lỗi model: "Đợi version tiếp theo." Harness engineering từ chối mindset này.
- Agent ignore convention? → Thêm vào AGENTS.md.
- Chạy destructive command? → Viết hook block nó.
- Lost trong task 40 bước? → Tách thành planner + executor.
- Code broken khi finish? → Wire type-checking back-pressure vào loop.
HumanLayer nói thẳng: "It's not a model problem. It's a configuration problem."
⛓️ The Ratchet: Mỗi Lỗi = 1 Rule Vĩnh Viễn
Thói quen quan trọng nhất: treat agent mistakes như permanent signals, không phải one-off flukes để retry rồi quên.
Agent ship PR với test bị comment-out rồi bị merge? Đó là input. Lần sau:
- AGENTS.md phải ghi: "Never comment out tests; delete or fix them."
- Pre-commit hook auto flag
.skip(trong diff. - Reviewer subagent updated để block commented-out tests.
Constraints chỉ thêm khi observe real failure. Chỉ remove khi capable model render chúng redundant. Mỗi dòng system prompt phải trace về 1 historical failure cụ thể.
🏗️ Working Backwards From Behavior
Cách hiệu quả nhất thiết kế harness: bắt đầu từ behavior muốn có → thiết kế component để deliver nó. Mỗi phần harness phải có distinct job. Nếu không đặt tên được behavior cụ thể component đó tồn tại để deliver → remove nó.
🗂️ Filesystem & Git — Durable State
Models chỉ operate trên gì fit trong context window. Filesystem cung cấp workspace đọc data, offload intermediate work, và surface cho multiple agents coordinate. Git cho free versioning: track progress, branch experiments, rollback errors.
💻 Bash & Code Execution
ReAct loop: reason → act via tool call → observe → repeat. Bash access cho phép agent build what it needs on the fly thay vì pre-build tool cho mọi scenario.
🔒 Sandboxes & Default Tooling
Bash chỉ useful khi chạy an toàn. Sandboxes cung cấp isolated environment: pre-installed runtimes, test CLIs, headless browsers — agent observe its own work và close self-verification loop.
🧠 Memory & Search — Continual Learning
Models không có knowledge ngoài training weights và current context. Harness bridge gap bằng memory files (AGENTS.md) inject knowledge vào mỗi session. Web search và MCP tools cho real-time info.
📉 Battling Context Rot
Models degrade khi context windows fill up. Ba technique chính:
- Compaction: Summarize và offload older context.
- Tool-call offloading: Store massive outputs (2000-line logs) trong filesystem, chỉ giữ headers/footers trong context.
- Progressive disclosure: Reveal instructions/tools chỉ khi task explicitly requires, không load everything at startup.
🎯 Long-Horizon Execution
Autonomous work suffer từ early stopping và poor problem decomposition:
- Loops: Intercept attempt to exit, force continue against completion goal trong fresh context window.
- Planning: Force decompose goals into step-by-step plan file, self-verify sau mỗi step.
- Splits: Tách generation và evaluation thành distinct agents, tránh positive bias khi model grade own work.
🪝 Hooks = Enforcement Layer
Hooks bridge gap giữa request action và enforce nó. Chạy at specific lifecycles: before tool call, after file edit, before commit. Block destructive commands, enforce auto-formatting tiết kiệm tokens, run test suites.
Ideally: success silent, failures verbose. Typecheck pass → agent nghe không gì; fail → error inject trực tiếp vào loop cho self-correction.
🏭 What This Looks Like in Production
Hình ảnh rõ nhất của mature harness: Fareed Khan's breakdown of Claude Code's architecture. Hầu như mọi concept ở trên đều xuất hiện như named component:
- Context injection = knowledge layer
- Loop state trong memory store + worktree isolator
- Destructive-action hooks sau permission gate
- Subagent context firewalls = multi-agent layer
- Tool dispatch registry nơi MCP servers và bash plug in
Claude Code's trajectory không chỉ về model — ít nhất ngang bằng về harness.
📈 Harnesses Don't Shrink, They Move
Khi models improve, need for harness không biến mất — nó dịch chuyển. Model upgrade giảm need cho "context-anxiety" mitigations, nhưng floor raises thì ceiling cũng raises. Tasks trước đó unreachable giờ in play, mang theo entirely new failure modes.
Mỗi component trong harness encode assumption về model không thể tự làm gì. Khi model improve, outdated scaffolding nên removed, và new scaffolding built để reach next horizon.
🔁 Training Loop Feedback
Có active feedback loop giữa harness design và model training. Today's models thường post-trained với specific harnesses in the loop — tạo degree of overfitting. Model trở nên cực kỳ giỏi tại actions harness designers prioritize (filesystem ops, bash, subagent dispatch).
Điều này biến harness thành living system, không phải static config file. "Best" harness là harness optimized specifically cho distinct tasks và workflows của bạn.
☁️ Harness-as-a-Service (HaaS)
Ngành đang shift từ building on LLM APIs (completions) sang building on Harness APIs (runtime). SDKs giờ offer loop, tools, context management, hooks, sandboxes out of the box.
Thay vì build orchestration từ scratch, modern default là: select harness framework → configure core pillars → focus purely on domain-specific prompt và tool design.
Đây là lý do troubleshooting scalable: bạn tuning well-factored configuration surface thay vì reinvent entire agent architecture.
💬 Community Reaction: Không Phải Ai Cũng Đồng Ý
Thread của Addy nhận được rất nhiều engagement, nhưng cũng có phản biện đáng chú ý:
Điểm này valid. Harness engineering giải quyết được lỗi repeatable, nhưng judgment calls và taste vẫn là gray area mà model — dù có harness tốt — chưa chắc xử lý được.
Đúng. Harness không phải set-and-forget. Cần eval pipeline liên tục để validate harness vẫn optimal khi underlying model evolve.
🎯 Kết Luận
Addy Osmani đặt tên và tổng hợp một trend đã happening: harness engineering convergence. Top coding agents hôm nay trông giống nhau hơn so với underlying models của chúng. Patterns đang converge về loop structure, tool design, context management, và enforcement layers.
Điều này có nghĩa: interesting engineering work không còn nằm ở selecting model, mà ở designing scaffolding around it. Mỗi lỗi agent mắc phải phải trở thành permanent solution. Mỗi component harness phải trace về behavior cụ thể.
Nếu bạn đang xây agent — đừng chỉ hỏi "model nào tốt nhất?" Hãy hỏi: "Harness của tôi có đủ chặt để biến model thành reliable worker không?"
Và nhớ: harness tốt nhất không phải framework generic. Nó là harness optimized cho distinct tasks và workflows của bạn — và nó sẽ liên tục evolve cùng model.