{"version":"beb61a6fb9c7","site":"https://ai9k.vercel.app","languages":["vi","en"],"default_language":"vi","base":{"vi":"","en":"/en"},"about":{"vi":{"name":"Từ điển AI Coding","description":"Từ vựng về lập trình với AI, giải thích bằng tiếng Việt dễ hiểu."},"en":{"name":"AI Coding Dictionary","description":"The vocabulary of AI coding, translated into plain English."}},"repository":"https://github.com/khanhlegood3/dictionary-of-ai-coding","upstream":"https://github.com/mattpocock/dictionary-of-ai-coding","files":{"llms":"/llms.txt","llms_en":"/en/llms.txt","llms_full":"/llms-full.txt","llms_full_en":"/en/llms-full.txt","index":"/data/index.json","term":"/data/terms/{slug}.json","graph":"/data/graph.json","corpus":"/data/corpus.json","sitemap":"/sitemap.xml","robots":"/robots.txt","markdown":"/{slug}.md","markdown_en":"/en/{slug}.md","openapi":"/openapi.json","server_card":"/.well-known/mcp/server-card.json","skills":"/.well-known/agent-skills/index.json","skill":"/.well-known/agent-skills/ai-coding-dictionary/SKILL.md","mcp":"/api/mcp","api":"/api/v1","status":"/status.json","docs":"/agents/mcp"},"sections":[{"number":1,"title":{"vi":"Mô hình","en":"The Model"}},{"number":2,"title":{"vi":"Phiên, cửa sổ ngữ cảnh và lượt","en":"Sessions, Context Windows & Turns"}},{"number":3,"title":{"vi":"Công cụ và môi trường","en":"Tools & Environment"}},{"number":4,"title":{"vi":"Các kiểu lỗi","en":"Failure Modes"}},{"number":5,"title":{"vi":"Bàn giao","en":"Handoffs"}},{"number":6,"title":{"vi":"Bộ nhớ và điều hướng","en":"Memory and Steering"}},{"number":7,"title":{"vi":"Các cách làm việc","en":"Patterns of Work"}}],"terms":[{"slug":"ai","term":"AI","section":1,"position":1,"links":["model","token","harness","agent","context"],"text":{"vi":{"description":"Một cái nhãn luôn dịch chuyển, không phải một công nghệ. Nó chỉ vào thứ máy tính vừa làm được một cách ấn tượng, hiện nay là mô hình ngôn ngữ lớn.","body":"Một cái nhãn luôn dịch chuyển, không phải một công nghệ. \"AI\" không gọi tên một thứ cố định như [mô hình](https://ai9k.vercel.app/model) hay [token](https://ai9k.vercel.app/token). Nó chỉ vào bất cứ điều gì máy tính vừa mới làm được một cách ấn tượng. Hiện nay nó chỉ vào các mô hình ngôn ngữ lớn. Trước đây nó từng chỉ vào những thứ rất khác:\n\n| Thời kỳ   | \"AI\" khi đó nghĩa là gì                                                                              |\n| --------- | ---------------------------------------------------------------------------------------------------- |\n| 1950s     | Suy luận ký hiệu: chương trình chứng minh định lý, chương trình chơi cờ đam.                         |\n| 1960s–70s | Chương trình ký hiệu dựa trên luật: ELIZA, SHRDLU.                                                   |\n| 1980s     | Hệ chuyên gia: hàng nghìn luật nếu-thì viết tay để mã hoá kiến thức của chuyên gia.                  |\n| 1990s     | Tìm kiếm trên cây trò chơi: Deep Blue thắng Kasparov (1997). Giới nghiên cứu khi đó né hẳn chữ \"AI\". |\n| 2000s     | Học máy thống kê: lọc thư rác, hệ gợi ý. Vẫn được bán dưới tên \"machine learning\", không phải \"AI\".  |\n| 2010s     | Học sâu: nhận dạng ảnh (AlexNet, 2012), AlphaGo (2016).                                              |\n| 2020s     | Mô hình ngôn ngữ lớn: ChatGPT (2022) khiến \"AI\" đồng nghĩa với chatbot.                              |\n\nCái nhãn dịch chuyển theo một cơ chế đã được biết rõ, đôi khi gọi là hiệu ứng AI: khi một kỹ thuật chạy ổn định, người ta đổi tên nó thành \"chỉ là\" tìm kiếm, \"chỉ là\" thống kê, và \"AI\" trượt tới bài toán chưa giải được tiếp theo. Nhận xét này đã có từ lâu. Năm 1971, Bertram Raphael viết: \"AI là tên gọi chung cho những bài toán mà ta chưa biết cách giải cho tử tế bằng máy tính.\" Phiên bản của Larry Tesler, khoảng năm 1979: \"Trí tuệ là bất cứ thứ gì máy chưa làm được.\"\n\nĐó là lý do các cuộc trao đổi về AI hay lệch nhau. Một câu như \"AI không biết suy luận\" hay \"AI bị thổi phồng\" luôn mang một mốc thời gian ngầm. Nó có thể nói về hệ chuyên gia, về bộ phân loại ảnh của thập niên 2010, hoặc về LLM của tháng trước, và mỗi đối tượng dẫn tới một kết luận khác. Khi một cuộc thảo luận về AI bế tắc, cách gỡ thường là thay chữ đó bằng thuật ngữ chính xác mà người nói thực sự muốn chỉ: mô hình, [harness](https://ai9k.vercel.app/harness), [agent](https://ai9k.vercel.app/agent), hay [ngữ cảnh](https://ai9k.vercel.app/context) mà nó được cung cấp.\n\n_Nên tránh:_ dùng \"AI\" trong bất kỳ nhận định kỹ thuật nào. Hãy gọi tên đúng bộ phận bạn muốn nói. Dùng \"AI coding\" để gọi tên cách làm việc thì được; nói \"AI đang bị ảo giác\" thì không.","usage":"\"CTO muốn biết AI có xử lý được hàng đợi phân loại ticket không.\"\n\n\"Dịch câu đó ra trước khi ước lượng phạm vi. Ý chị ấy là một LLM đặt trong harness, có quyền truy cập hệ thống ticket. Riêng chữ 'AI' thì chưa phải là spec.\"","translated":true},"en":{"description":"A moving label, not a technology. Points at whatever computers can newly, impressively do — right now, large language models.","body":"A moving label, not a technology. \"AI\" doesn't name a fixed thing the way [model](https://ai9k.vercel.app/en/model) or [token](https://ai9k.vercel.app/en/token) does — it points at whatever computers can newly, impressively do. Right now it points at large language models. It has pointed at very different things before:\n\n| Era       | What \"AI\" meant                                                                                       |\n| --------- | ----------------------------------------------------------------------------------------------------- |\n| 1950s     | Symbolic reasoning — theorem provers, checkers programs.                                              |\n| 1960s–70s | Rule-based symbolic programs — ELIZA, SHRDLU.                                                         |\n| 1980s     | Expert systems — thousands of hand-written if-then rules encoding human expertise.                    |\n| 1990s     | Game-tree search — Deep Blue beating Kasparov (1997). Researchers avoided the word \"AI\" entirely      |\n| 2000s     | Statistical machine learning — spam filters, recommenders. Still sold as \"machine learning\", not \"AI\" |\n| 2010s     | Deep learning — image recognition (AlexNet, 2012), AlphaGo (2016).                                    |\n| 2020s     | Large language models — ChatGPT (2022) made \"AI\" mean chatbots                                        |\n\nThe pointer moves by a known mechanism, sometimes called the AI effect: once a technique works reliably, it gets renamed — it's \"just\" search, \"just\" statistics — and \"AI\" slides forward to the next unsolved thing. The observation is old. Bertram Raphael put it this way in 1971: \"AI is a collective name for problems which we do not yet know how to solve properly by computer.\" Larry Tesler's version, from around 1979: \"Intelligence is whatever machines haven't done yet.\"\n\nThis is why conversations about AI so often talk past each other. A claim like \"AI can't reason\" or \"AI is overhyped\" carries a hidden timestamp — it may be about expert systems, about 2010s image classifiers, or about last month's LLM, and each reference supports a different conclusion. When a discussion about AI stalls, the fix is usually to swap the word for whichever precise term is actually meant: the model, the [harness](https://ai9k.vercel.app/en/harness), the [agent](https://ai9k.vercel.app/en/agent), the [context](https://ai9k.vercel.app/en/context) it was given.\n\n_Avoid:_ \"AI\" in any technical claim — name the part you mean instead. \"AI coding\" as a label for the practice is fine; \"the AI is hallucinating\" is not.","usage":"\"The CTO wants to know whether AI could handle the triage queue.\"\n\n\"Translate that before scoping it — she means an LLM in a harness with access to the ticket system. 'AI' on its own isn't a spec.\"","translated":true}}},{"slug":"model","term":"Model","section":1,"position":2,"links":["parameters","stateless","next-token-prediction","harness","token","model-provider-request","agent","tool","model-provider","session","context","system-prompt"],"text":{"vi":{"name":"Mô hình","description":"Chính là các tham số. Không lưu trạng thái, chỉ làm một việc là dự đoán token tiếp theo. Tự nó không thể hành động như một agent.","body":"Chính là các [tham số](https://ai9k.vercel.app/parameters). [Không lưu trạng thái](https://ai9k.vercel.app/stateless), chỉ làm một việc là [dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction). \"Claude Opus 4.x\" và \"GPT-5.x\" là các mô hình. Tự nó, mô hình không thể hành động như một agent; nó phải được đặt trong một [harness](https://ai9k.vercel.app/harness).\n\nMô hình không đọc được tệp, không chạy được lệnh, không duyệt web, không nhớ được hôm qua. Nó nhận [token](https://ai9k.vercel.app/token) vào và dự đoán token ra, mỗi lần một [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request). Mọi thứ trông giống một [agent](https://ai9k.vercel.app/agent) đang làm việc, như chọn [công cụ](https://ai9k.vercel.app/tool), đọc kết quả, lặp lại cho tới khi xong việc, thực chất là harness điều phối nhiều lần dự đoán như vậy nối tiếp nhau.\n\n[Nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider) phát hành mô hình theo nhiều hạng: một bản lớn, thông minh nhất nhưng chậm và đắt, cùng các bản nhỏ hơn, nhanh và rẻ hơn nhưng kém năng lực hơn. Chọn hạng nào là một quyết định cần cân nhắc: bản nặng cho việc lập kế hoạch và gỡ lỗi khó, bản nhẹ cho các thay đổi máy móc. Harness cho phép bạn đổi mô hình giữa [phiên](https://ai9k.vercel.app/session).\n\nDùng từ này cho chặt cũng giúp chẩn đoán chính xác hơn. \"Mô hình làm việc này kém\" là một nhận định cụ thể. Cùng mô hình đó, đặt trong harness khác hoặc với [ngữ cảnh](https://ai9k.vercel.app/context) khác, thường hành xử khác hẳn. Trước khi đổ lỗi cho mô hình, hãy xem nó đã được cung cấp những gì: phần lớn kết quả đáng thất vọng bắt nguồn từ ngữ cảnh hoặc harness, không phải từ tham số.","usage":"\"Mình có nên đổi mô hình từ Sonnet sang Opus cho bước lập kế hoạch không?\"\n\n\"Cứ thử, nhưng với việc này harness mới là thứ gánh phần lớn. Đổi mô hình cũng không giúp gì nếu [system prompt](https://ai9k.vercel.app/system-prompt) và công cụ đang sai.\"","translated":true},"en":{"description":"The parameters. Stateless — does next-token prediction and nothing else. Cannot do anything agentic on its own.","body":"The [parameters](https://ai9k.vercel.app/en/parameters). [Stateless](https://ai9k.vercel.app/en/stateless) — does [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) and nothing else. \"Claude Opus 4.x\" and \"GPT-5.x\" are models. On its own a model can't do anything agentic; it has to be [harnessed](https://ai9k.vercel.app/en/harness).\n\nModels can't read files, run commands, browse the web, or remember yesterday — it takes [tokens](https://ai9k.vercel.app/en/token) in and predicts tokens out, once per [model provider request](https://ai9k.vercel.app/en/model-provider-request). Everything that feels like an [agent](https://ai9k.vercel.app/en/agent) working — choosing [tools](https://ai9k.vercel.app/en/tool), reading results, looping until the task is done — is the harness orchestrating many of those predictions in a row.\n\n[Model providers](https://ai9k.vercel.app/en/model-provider) ship models in tiers: a large one that's smartest but slow and expensive, and smaller ones that are faster and cheaper but less capable. Picking a tier is a real decision — heavyweight for planning and hard debugging, lightweight for mechanical changes — and harnesses let you switch mid-[session](https://ai9k.vercel.app/en/session).\n\nBeing strict about the word also sharpens diagnosis. \"The model is bad at this\" is a specific claim — the same model in a different harness, or with a different [context](https://ai9k.vercel.app/en/context), often behaves completely differently. Before blaming the model, check what it was given: most disappointing output traces back to context or harness, not parameters.","usage":"\"Should we switch the model from Sonnet to Opus for the planning step?\"\n\n\"Try it — but the harness is doing most of the lifting on this task. The model swap won't help if the [system prompt](https://ai9k.vercel.app/en/system-prompt) and tools are wrong.\"","translated":true}}},{"slug":"parameters","term":"Parameters","section":1,"position":3,"links":["model","training","inference","next-token-prediction","token","context-window","parametric-knowledge","session","stateless","knowledge-cutoff","context"],"text":{"vi":{"name":"Tham số","description":"Những con số bên trong mô hình, thường tới hàng tỷ, được tinh chỉnh khi huấn luyện. Mọi điều mô hình biết đều nằm ở đó. Còn gọi là trọng số.","body":"Những con số bên trong một [mô hình](https://ai9k.vercel.app/model), thường tới hàng tỷ, được tinh chỉnh trong quá trình [huấn luyện](https://ai9k.vercel.app/training). Mọi điều mô hình \"biết\" đều nằm trong đó. Huấn luyện đặt giá trị cho chúng; [suy luận](https://ai9k.vercel.app/inference) dùng chúng mà không thay đổi gì. Còn gọi là _trọng số_ (weights).\n\nVề mặt cơ học, tham số là thứ biến đầu vào thành đầu ra. [Dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) là một phép tính khổng lồ: các [token](https://ai9k.vercel.app/token) trong [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) đi vào, được nhân qua các tham số, và một dự đoán cho token kế tiếp đi ra. Bên trong mô hình không có cơ sở dữ liệu sự kiện, không có bảng tra cứu mã nguồn. Chỉ có những con số này, được sắp xếp sao cho phép tính thường cho ra kết quả hữu ích. Những điều mô hình thuộc lòng từ lúc huấn luyện, chẳng hạn API của một thư viện chuẩn, là [kiến thức tham số](https://ai9k.vercel.app/parametric-knowledge): được lưu trong tham số, không phải truy xuất từ đâu cả.\n\nĐiều đáng ghi nhớ là tham số bị đóng băng sau khi huấn luyện. Không việc gì bạn làm trong một [phiên](https://ai9k.vercel.app/session) thay đổi được chúng: không lời sửa nào của bạn, không codebase nào bạn cho nó xem, không lỗi nào nó rút kinh nghiệm được. Phiên nào cũng chạy trên cùng những con số ấy. Đó là lý do mô hình [không lưu trạng thái](https://ai9k.vercel.app/stateless), kiến thức có sẵn của nó dừng ở [mốc kiến thức](https://ai9k.vercel.app/knowledge-cutoff), và mọi thứ riêng của dự án phải đến qua [ngữ cảnh](https://ai9k.vercel.app/context). Cách duy nhất để tham số thay đổi là huấn luyện thêm, và việc đó trên thực tế tạo ra một mô hình khác.","usage":"\"Mình fine-tune nó trên codebase của mình được không?\"\n\n\"Làm vậy sẽ cập nhật tham số, tức là sau đó thành một mô hình khác. Với một dự án thì nạp codebase làm ngữ cảnh gần như luôn rẻ hơn huấn luyện lại.\"","translated":true},"en":{"description":"The numbers inside a model — often billions — tuned during training. Everything the model knows lives in them. Also called weights.","body":"The numbers inside a [model](https://ai9k.vercel.app/en/model) — often billions of them — tuned during [training](https://ai9k.vercel.app/en/training). Everything the model \"knows\" lives in them. Training sets them; [inference](https://ai9k.vercel.app/en/inference) uses them unchanged. Also called _weights_.\n\nMechanically, the parameters are what turn input into output. [Next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) is a giant calculation: the [tokens](https://ai9k.vercel.app/en/token) in the [context window](https://ai9k.vercel.app/en/context-window) go in, get multiplied through the parameters, and a prediction for the next token comes out. There is no database of facts inside the model, no code lookup table — just these numbers, arranged so that the calculation tends to produce useful output. Facts the model can recite from training, like a standard library API, are [parametric knowledge](https://ai9k.vercel.app/en/parametric-knowledge): stored in the parameters, not retrieved from anywhere.\n\nThe detail worth internalising is that parameters are frozen after training. Nothing you do in a [session](https://ai9k.vercel.app/en/session) changes them — no correction you make, no codebase you show it, no mistake it learns from. Every session runs on the same numbers. This is why the model is [stateless](https://ai9k.vercel.app/en/stateless), why its built-in knowledge stops at the [knowledge cutoff](https://ai9k.vercel.app/en/knowledge-cutoff), and why anything project-specific has to arrive via [context](https://ai9k.vercel.app/en/context) instead. The only way parameters change is more training — which produces, in effect, a different model.","usage":"\"Can we fine-tune it on our codebase?\"\n\n\"That'd update the parameters — different model afterwards. For one project it's almost always cheaper to load the codebase as context than to retrain.\"","translated":true}}},{"slug":"training","term":"Training","section":1,"position":4,"links":["model","parameters","next-token-prediction","model-provider","token","parametric-knowledge","knowledge-cutoff","context"],"text":{"vi":{"name":"Huấn luyện","description":"Quá trình đặt giá trị cho tham số của mô hình: cho nó đọc lượng văn bản khổng lồ và điều chỉnh để dự đoán token tiếp theo tốt hơn.","body":"Quá trình đặt giá trị cho [tham số](https://ai9k.vercel.app/parameters) của một [mô hình](https://ai9k.vercel.app/model), bằng cách cho nó tiếp xúc với lượng văn bản khổng lồ và điều chỉnh tham số để [dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) tốt hơn. Đây là quá trình làm một lần, tốn kém, do [nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider) thực hiện. Nó gồm cả tiền huấn luyện (đợt chạy chính) và hậu huấn luyện (các tinh chỉnh về sau như làm theo chỉ dẫn và an toàn); ở mức của bảng thuật ngữ này, sự phân biệt đó không quan trọng.\n\nCơ chế là lặp lại ở quy mô lớn: đưa cho mô hình một đoạn văn bản, để nó dự đoán [token](https://ai9k.vercel.app/token) tiếp theo, đẩy nhẹ tham số về phía token thực sự xuất hiện, rồi lặp lại qua hàng nghìn tỷ token. Không có gì được lưu dưới dạng sự kiện hay quy tắc. Mọi điều mô hình \"biết\" là hệ quả phụ của việc dự đoán ngày càng tốt hơn, được nén vào tham số thành [kiến thức tham số](https://ai9k.vercel.app/parametric-knowledge).\n\nCó hai hệ quả ảnh hưởng tới công việc hằng ngày. Huấn luyện kết thúc tại một thời điểm, nên mô hình có [mốc kiến thức](https://ai9k.vercel.app/knowledge-cutoff): nó chưa từng thấy phiên bản thư viện bạn vừa nâng cấp tháng trước. Và huấn luyện không phải việc bạn làm được. Khi mô hình không biết codebase, quy ước hay API nội bộ của bạn, cách giải quyết không bao giờ là \"dạy mô hình\", mà là đưa những tài liệu đó vào [ngữ cảnh](https://ai9k.vercel.app/context), đầu vào duy nhất bạn kiểm soát.","usage":"\"Có cách nào để nó biết API nội bộ của mình không?\"\n\n\"Không phải qua huấn luyện, đó là quá trình kéo dài hàng tháng của nhà cung cấp mô hình. Hãy nạp tài liệu API vào ngữ cảnh, đó mới là đòn bẩy bạn thực sự có.\"","translated":true},"en":{"description":"The process that sets a model's parameters by exposing it to vast amounts of text and adjusting to improve next-token prediction.","body":"The process that sets a [model](https://ai9k.vercel.app/en/model)'s [parameters](https://ai9k.vercel.app/en/parameters), by exposing it to vast amounts of text and adjusting parameters to improve [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction). A one-time, expensive process done by the [model provider](https://ai9k.vercel.app/en/model-provider). Encompasses both pre-training (the bulk run) and post-training (later refinements like instruction-following and safety); the distinction doesn't matter at this glossary's level.\n\nThe mechanism is repetition at scale: show the model a stretch of text, have it predict the next [token](https://ai9k.vercel.app/en/token), nudge the parameters toward whatever the actual next token was, and repeat across trillions of tokens. Nothing is stored as facts or rules — everything the model \"knows\" is a side effect of getting better at prediction, compressed into the parameters as [parametric knowledge](https://ai9k.vercel.app/en/parametric-knowledge).\n\nTwo consequences matter day to day. Training ends at a point in time, so the model has a [knowledge cutoff](https://ai9k.vercel.app/en/knowledge-cutoff) — it hasn't seen the library version you upgraded to last month. And training is not something you can do: when the model doesn't know your codebase, your conventions, or your internal APIs, the fix is never \"teach the model\" — it's putting that material into [context](https://ai9k.vercel.app/en/context), the one input you control.","usage":"\"Can we get it to know our internal API?\"\n\n\"Not via training — that's a months-long process by the model provider. Load the API docs into context instead, that's the lever you actually have.\"","translated":true}}},{"slug":"inference","term":"Inference","section":1,"position":5,"links":["model","model-provider-request","parameters","next-token-prediction","context","training","token","session","stateless","context-window","memory-system","input-tokens","output-tokens","tool","turn"],"text":{"vi":{"name":"Suy luận","description":"Chạy một mô hình đã huấn luyện để sinh đầu ra. Việc này xảy ra ở mỗi yêu cầu tới nhà cung cấp mô hình. Tham số giữ nguyên.","body":"Chạy một [mô hình](https://ai9k.vercel.app/model) đã huấn luyện để sinh đầu ra. Việc này xảy ra ở mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request). [Tham số](https://ai9k.vercel.app/parameters) giữ nguyên; mô hình chỉ [dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) trên [ngữ cảnh](https://ai9k.vercel.app/context) được cung cấp. Rẻ so với [huấn luyện](https://ai9k.vercel.app/training), nhưng được tính tiền theo [token](https://ai9k.vercel.app/token) và là chi phí chủ yếu khi dùng mô hình.\n\nVòng đời của một mô hình chia làm hai giai đoạn:\n\n| Giai đoạn  | Xảy ra khi nào                | Làm gì                                                            | Tham số       |\n| ---------- | ----------------------------- | ----------------------------------------------------------------- | ------------- |\n| Huấn luyện | Một lần, trước khi phát hành  | Tạo ra tham số từ một kho dữ liệu huấn luyện                      | Đang được ghi |\n| Suy luận   | Mỗi khi có ai đó dùng mô hình | Chạy các tham số đã đóng băng trên ngữ cảnh của bạn để sinh token | Chỉ đọc       |\n\nKhông việc gì bạn làm lúc suy luận được ghi ngược lại vào tham số. Đó là lý do một lời sửa hôm nay không còn hiệu lực vào ngày mai. Khi mô hình lặp lại đúng lỗi cũ ở [phiên](https://ai9k.vercel.app/session) sau, dù bạn đã giải thích cẩn thận cách sửa, nó không phớt lờ bạn; nó không có khả năng học từ cuộc trao đổi đó. Mô hình [không lưu trạng thái](https://ai9k.vercel.app/stateless). Tính liên tục phải đến từ bên ngoài nó: từ [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) hoặc một [hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system).\n\nCơ chế này cũng giải thích cách bạn bị tính tiền. Mỗi yêu cầu chạy mô hình trên toàn bộ ngữ cảnh, nên chi phí tăng theo [token đầu vào](https://ai9k.vercel.app/input-tokens) và [token đầu ra](https://ai9k.vercel.app/output-tokens), và một agent thực hiện hàng chục lần gọi [công cụ](https://ai9k.vercel.app/tool) phải trả tiền suy luận cho từng vòng. Vì vậy kích thước ngữ cảnh vừa là câu hỏi về chất lượng, vừa là câu hỏi về chi phí.","usage":"\"Sao hoá đơn lại tăng theo mức sử dụng mà không phải một khoản phí bản quyền cố định?\"\n\n\"Bạn đang trả tiền cho suy luận. Mỗi yêu cầu tới nhà cung cấp mô hình đều chạy mô hình trên phần cứng của họ. Huấn luyện thì đã xong từ trước, nhưng chi phí suy luận cộng dồn theo từng yêu cầu, và một [lượt](https://ai9k.vercel.app/turn) có thể nở ra thành nhiều yêu cầu khi có gọi công cụ.\"","translated":true},"en":{"description":"Running a trained model to generate output — what happens on every model provider request. Parameters stay fixed.","body":"Running a trained [model](https://ai9k.vercel.app/en/model) to generate output — what happens on every [model provider request](https://ai9k.vercel.app/en/model-provider-request). [Parameters](https://ai9k.vercel.app/en/parameters) stay fixed; the model just does [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) over the [context](https://ai9k.vercel.app/en/context) it's given. Cheap relative to [training](https://ai9k.vercel.app/en/training), but billed per [token](https://ai9k.vercel.app/en/token) and the dominant cost of using a model.\n\nA model's life splits into two phases:\n\n| Phase     | When it happens                  | What it does                                                    | Parameters    |\n| --------- | -------------------------------- | --------------------------------------------------------------- | ------------- |\n| Training  | Once, before release             | Produces the parameters from a training corpus                  | Being written |\n| Inference | Every time anyone uses the model | Runs the frozen parameters over your context to generate tokens | Read-only     |\n\nNothing you do at inference time writes back to the parameters — that's the reason a correction you make today doesn't stick tomorrow. The model that makes the same mistake next [session](https://ai9k.vercel.app/en/session), after you carefully explained the fix, hasn't ignored you; it's incapable of learning from the exchange. The model is [stateless](https://ai9k.vercel.app/en/stateless) — continuity has to come from outside it — from the [context window](https://ai9k.vercel.app/en/context-window) or a [memory system](https://ai9k.vercel.app/en/memory-system).\n\nThis mechanism also explains how you're billed. Every request runs the model over the full context, so cost scales with [input tokens](https://ai9k.vercel.app/en/input-tokens) and [output tokens](https://ai9k.vercel.app/en/output-tokens), and an agent making dozens of [tool](https://ai9k.vercel.app/en/tool) calls pays for inference on each round trip. This is why context size is a cost question as well as a quality one.","usage":"\"Why does the bill scale with usage instead of being a flat license?\"\n\n\"You're paying for inference — every model provider request runs the model on the provider's hardware. Training already happened, but inference costs accrue per request, and a single [turn](https://ai9k.vercel.app/en/turn) can expand into many requests when tools are called.\"","translated":true}}},{"slug":"effort","term":"Effort","section":1,"position":6,"links":["model","model-provider-request","inference","harness","token","output-tokens","session"],"text":{"vi":{"name":"Mức nỗ lực","description":"Núm chỉnh lượng suy nghĩ của mô hình trước khi trả lời. Effort cao hơn tốn thêm token đầu ra để có cơ hội giải bài toán khó tốt hơn.","body":"Effort (mức nỗ lực) là núm chỉnh lượng suy nghĩ mà một [mô hình](https://ai9k.vercel.app/model) thực hiện trước khi trả lời. Nó được đặt cho từng [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request) và quyết định độ dài phần suy nghĩ mô hình đi qua trước khi bắt đầu viết câu trả lời bạn thấy. Phần suy nghĩ đó được sinh ra lúc [suy luận](https://ai9k.vercel.app/inference) như mọi thứ khác. [Harness](https://ai9k.vercel.app/harness) thường ẩn nó đi, nhưng đó là công việc thật mà mô hình đang làm.\n\nEffort cao hơn thì tốn hơn và chậm hơn. Phần suy nghĩ được phát ra dưới dạng [token](https://ai9k.vercel.app/token), được tính tiền như [token đầu ra](https://ai9k.vercel.app/output-tokens) kể cả khi bạn không bao giờ thấy chúng, và được sinh từng token một. Vì vậy tăng effort sẽ kéo dài thời gian chờ trước khi có câu trả lời và làm hoá đơn tăng thêm. Bạn đổi tốc độ và chi phí lấy sự cân nhắc kỹ hơn.\n\nPhần lớn harness đưa ra effort dưới dạng một thang ngắn:\n\n| Mức    | Dùng cho việc gì                                                         |\n| ------ | ------------------------------------------------------------------------ |\n| Low    | Chỉnh sửa máy móc, tra cứu, thay đổi đã mô tả rõ và chỉ có một cách làm. |\n| Medium | Lập trình hằng ngày. Đây thường là mặc định.                             |\n| High   | Lỗi khó, quyết định thiết kế, kế hoạch nhiều bước.                       |\n| Max    | Những bài toán khó nhất, nơi một câu trả lời sai rất tốn công gỡ lại.    |\n\nĐặt sai thì có triệu chứng ở cả hai chiều. Đặt effort quá thấp cho một bài toán khó, bạn nhận được câu trả lời tự tin nhưng nông, bỏ qua phần suy luận mà bài toán cần. Nó đọc thì ổn, nhưng sai theo kiểu khiến bạn trả giá về sau. Đặt max cho một lần đổi tên một dòng, bạn ngồi chờ một đợt suy nghĩ dài mà kết quả không khác gì mức thấp nhất.\n\nHãy chọn effort theo việc, không theo [phiên](https://ai9k.vercel.app/session). Tăng lên cho phần thực sự khó suy luận, rồi hạ xuống cho những việc lặp lại xung quanh nó.","usage":"\"Nó cứ làm hỏng bản sửa lỗi concurrency này. Mình giải thích lại ba lần rồi.\"\n\n\"Tăng effort lên. Đây là lỗi cần suy luận nhiều, mà ở mức mặc định nó chưa nghĩ đủ lâu trước khi chốt một hướng làm.\"","translated":true},"en":{"description":"A dial for how much reasoning the model does before it answers. More effort spends more output tokens for a better shot at hard problems.","body":"Effort is a dial for how much reasoning a [model](https://ai9k.vercel.app/en/model) does before it answers. Set per [model provider request](https://ai9k.vercel.app/en/model-provider-request), it controls the length of the thinking the model works through before it starts writing the response you see. That thinking is generated at [inference](https://ai9k.vercel.app/en/inference) time like everything else; the [harness](https://ai9k.vercel.app/en/harness) often hides it, but it's real work the model is doing.\n\nHigher effort costs more and runs slower. The reasoning is emitted as [tokens](https://ai9k.vercel.app/en/token), billed as [output tokens](https://ai9k.vercel.app/en/output-tokens) even when you never see them, and produced one token at a time — so turning effort up lengthens the wait before the answer arrives and adds to the bill. The trade is more deliberation against speed and cost.\n\nMost harnesses expose effort as a small ladder:\n\n| Level  | What it's for                                                          |\n| ------ | ---------------------------------------------------------------------- |\n| Low    | Mechanical edits, lookups, well-specified changes with one clear path. |\n| Medium | Everyday coding — the usual default.                                   |\n| High   | Tricky bugs, design decisions, multi-step plans.                       |\n| Max    | The hardest problems, where a wrong answer is expensive to unwind.     |\n\nThe symptom of getting it wrong cuts both ways. Set effort too low on a hard problem and you get a confident, shallow answer that skipped the reasoning the problem needed — it reads fine and is wrong in a way that costs you later. Set it to max for a one-line rename and you sit through a long think that produces nothing the lowest setting wouldn't have.\n\nMatch effort to the task, not the [session](https://ai9k.vercel.app/en/session). Turn it up for the part that's genuinely hard to reason about, and back down for the rote work around it.","usage":"\"It keeps botching this concurrency fix — I've re-explained it three times.\"\n\n\"Bump the effort up. That's a reasoning-heavy bug, and on the default setting it's not thinking long enough before it commits to an approach.\"","translated":true}}},{"slug":"token","term":"Token","section":1,"position":7,"links":["model","context-window","training","next-token-prediction","input-tokens","output-tokens"],"text":{"vi":{"description":"Đơn vị nhỏ nhất mà mô hình đọc và viết. Gần bằng một từ nhưng không hẳn. Kích thước cửa sổ ngữ cảnh, chi phí và độ trễ đều đếm bằng token.","body":"Đơn vị nhỏ nhất mà một [mô hình](https://ai9k.vercel.app/model) đọc và viết. Gần bằng một từ nhưng không hẳn: từ thông dụng là một token, từ hiếm hoặc dài bị tách thành vài token. Kích thước [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window), chi phí và độ trễ đều được đếm bằng token.\n\nVăn bản trở thành token qua một tokenizer: một bộ từ vựng cố định gồm hàng chục nghìn mảnh, được học trước khi [huấn luyện](https://ai9k.vercel.app/training), dùng để tách bất kỳ đầu vào nào thành một chuỗi các mục trong bộ từ vựng. Mô hình không bao giờ thấy ký tự hay từ. Mọi đoạn văn bản được đổi thành token trên đường vào, và [dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) sinh đầu ra từng token một trên đường ra.\n\nTheo kinh nghiệm, một token bằng khoảng ba phần tư một từ tiếng Anh, nên một nghìn token là khoảng 750 từ. Mã nguồn thì khó đoán hơn: từ khoá và cách viết thông dụng được mã hoá gọn, còn định danh sinh tự động, mã hash, khối base64 và mã đã minify bị tách thành nhiều token cho mỗi \"từ\". Quy luật là: văn bản xuất hiện nhiều trong dữ liệu gốc của tokenizer được mã hoá ngắn và hiệu quả; văn bản không xuất hiện thì bị cắt thành nhiều mảnh nhỏ. Một mã hash như `a3f9c2e1` chưa từng xuất hiện ở đâu, nên nó bị tách thành nhiều token, còn `function` chỉ là một. Vì vậy một tệp trông nhỏ nhưng chứa đầy chuỗi lạ có thể chiếm một phần lớn bất ngờ của cửa sổ ngữ cảnh.\n\nToken là đơn vị để đo mọi thứ khác. Chi phí tính theo token, và nhà cung cấp tính [token đầu vào](https://ai9k.vercel.app/input-tokens) và [token đầu ra](https://ai9k.vercel.app/output-tokens) riêng. Tốc độ là số token mỗi giây, vì đầu ra được sinh từng token một. Và cửa sổ ngữ cảnh là một số token cố định, nên số token của các tệp quyết định chứa vừa được bao nhiêu.\n\n_Nên tránh:_ \"từ\". Ranh giới token không trùng ranh giới từ, và token mỗi giây hay token mỗi đô la mới là những đơn vị thực sự quan trọng.","usage":"\"Prompt này sẽ lớn cỡ nào?\"\n\n\"Chạy nó qua tokenizer đi. Schema thì gọn nhưng các khoá JSON khá lạ, nên chúng sẽ tách thành nhiều token hơn bạn nghĩ.\"","translated":true},"en":{"description":"The atomic unit a model reads and writes. Roughly word-sized but not exactly. Context window size, cost, and latency all count tokens.","body":"The atomic unit a [model](https://ai9k.vercel.app/en/model) reads and writes. Roughly word-sized but not exactly — common words are one token, rare or long ones split into several. [Context window](https://ai9k.vercel.app/en/context-window) size, cost, and latency are all counted in tokens.\n\nText becomes tokens via a tokenizer: a fixed vocabulary of tens of thousands of fragments, learned before [training](https://ai9k.vercel.app/en/training), that splits any input into a sequence of vocabulary entries. The model never sees characters or words — every piece of text is converted to tokens on the way in, and [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) produces output one token at a time on the way out.\n\nAs a rule of thumb, a token is about three-quarters of an English word, so a thousand tokens is roughly 750 words. Code is less predictable: common keywords and idioms tokenize compactly, while generated identifiers, hashes, base64 blobs, and minified output split into many tokens per \"word\". The pattern: text that appeared often in the tokenizer's source material gets short, efficient encodings; text that didn't gets chopped into many small pieces. A hash like `a3f9c2e1` never appeared anywhere, so it splits into many tokens, while `function` is one. This is why a small-looking file full of unusual strings can occupy a surprising share of the context window.\n\nTokens are the unit everything else is measured in. Cost is per token — providers bill [input tokens](https://ai9k.vercel.app/en/input-tokens) and [output tokens](https://ai9k.vercel.app/en/output-tokens) separately. Speed is tokens per second, since output is generated one token at a time. And the context window is a fixed number of tokens, so the token count of your files decides how much fits.\n\n_Avoid:_ \"word\" — token boundaries don't match word boundaries, and tokens-per-second / tokens-per-dollar are the units that actually matter.","usage":"\"How big is this prompt going to be?\"\n\n\"Run it through the tokenizer — the schema's compact but the JSON keys are weird, so they'll split into more tokens than you think.\"","translated":true}}},{"slug":"next-token-prediction","term":"Next-token prediction","section":1,"position":8,"links":["model","context","token","tool-call","context-window","parameters","non-determinism","hallucination","output-tokens","agent","harness"],"text":{"vi":{"name":"Dự đoán token tiếp theo","description":"Việc mô hình thực sự làm. Lấy mẫu một token tiếp theo từ ngữ cảnh, nối vào, rồi chạy lại. Đây là cách hoạt động duy nhất của nó.","body":"Việc [mô hình](https://ai9k.vercel.app/model) thực sự làm. Cho trước một [ngữ cảnh](https://ai9k.vercel.app/context), nó lấy mẫu một [token](https://ai9k.vercel.app/token) tiếp theo, nối vào, rồi chạy lại. Mọi đầu ra, dù là một câu, một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) hay một tệp nghìn dòng, đều được dựng từng token một. Mô hình không có cách hoạt động nào khác.\n\nBước nào cũng diễn ra như nhau: các token trong [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) được chạy qua các [tham số](https://ai9k.vercel.app/parameters), cho ra xác suất của từng token trong bộ từ vựng. Token này rất có khả năng đứng kế tiếp, token kia ít hơn. Một token được lấy mẫu theo các xác suất đó, được nối vào, và vòng lặp chạy lại với ngữ cảnh dài hơn một chút. Bước lấy mẫu là lý do cùng một prompt cho ra kết quả khác nhau ở các lần chạy khác nhau: [tính bất định](https://ai9k.vercel.app/non-determinism) nằm sẵn trong cơ chế, không phải một lỗi chồng thêm lên trên.\n\nNắm chắc cơ chế này sẽ giải thích được những hành vi thoạt nhìn có vẻ lạ. Mô hình không bao giờ kiểm tra một token có _đúng_ hay không trước khi phát ra, mà chỉ xét nó có _khả dĩ_ hay không. Đó là gốc rễ của [ảo giác](https://ai9k.vercel.app/hallucination). Nó chốt từng token ngay khi sinh ra, nên một câu mở đầu nghe tự tin có thể kéo cả phần còn lại của câu trả lời đi sai hướng. Và vì [token đầu ra](https://ai9k.vercel.app/output-tokens) được sinh tuần tự từng cái một, tốc độ sinh đặt ra giới hạn dưới cho thời gian làm việc của bất kỳ [agent](https://ai9k.vercel.app/agent) nào.","usage":"\"Agent 'quyết định' gọi công cụ bằng cách nào?\"\n\n\"Nó không quyết định gì cả, từ trên xuống dưới chỉ là dự đoán token tiếp theo. Lệnh gọi công cụ chỉ là một chuỗi có cấu trúc mà [harness](https://ai9k.vercel.app/harness) tách ra từ dòng đầu ra.\"","translated":true},"en":{"description":"What the model actually does. Samples one next token from the context, appends it, and runs again. Its only mode of operation.","body":"What the [model](https://ai9k.vercel.app/en/model) actually does. Given a [context](https://ai9k.vercel.app/en/context), it samples one next [token](https://ai9k.vercel.app/en/token), appends it, and runs again. Every output — a sentence, a [tool call](https://ai9k.vercel.app/en/tool-call), a thousand-line file — is built one token at a time. The model has no other mode of operation.\n\nEach step works the same way: the tokens in the [context window](https://ai9k.vercel.app/en/context-window) are run through the [parameters](https://ai9k.vercel.app/en/parameters), which produce a probability for every token in the vocabulary — this one is very likely next, that one less so. One token is sampled from those probabilities, appended, and the loop runs again with the slightly longer context. That sampling step is why the same prompt produces different output on different runs: [non-determinism](https://ai9k.vercel.app/en/non-determinism) is built into the mechanism, not a bug layered on top.\n\nHolding onto this mechanism explains behaviour that otherwise looks strange. The model never checks whether a token is _true_ before emitting it — only whether it's _likely_ — which is the root of [hallucination](https://ai9k.vercel.app/en/hallucination). It commits to each token as it goes, so a confident-sounding opening sentence can steer the rest of the answer wrong. And because [output tokens](https://ai9k.vercel.app/en/output-tokens) are produced strictly one at a time, generation speed puts a floor on how fast any [agent](https://ai9k.vercel.app/en/agent) can work.","usage":"\"How does the agent 'decide' to call a tool?\"\n\n\"It doesn't — it's next-token prediction all the way down. The tool call is just a structured string the [harness](https://ai9k.vercel.app/en/harness) parses out of the output stream.\"","translated":true}}},{"slug":"non-determinism","term":"Non-determinism","section":1,"position":9,"links":["model","context","model-provider","model-provider-request","inference","token","agent","automated-check"],"text":{"vi":{"name":"Tính bất định","description":"Cùng một đầu vào có thể cho ra đầu ra khác nhau. Đây là đặc tính của cách mô hình sinh văn bản và cách nhà cung cấp phục vụ yêu cầu.","body":"Cùng một đầu vào có thể cho ra đầu ra khác nhau. Chạy một [mô hình](https://ai9k.vercel.app/model) hai lần với [ngữ cảnh](https://ai9k.vercel.app/context) giống hệt, bạn có thể nhận hai câu trả lời khác nhau: có khi khác một từ, có khi là một hướng tiếp cận hoàn toàn khác. Không cần thay đổi gì trong mã của bạn thì điều này vẫn xảy ra.\n\nĐây là đặc tính của cách mô hình sinh văn bản và cách [nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider) phục vụ [yêu cầu](https://ai9k.vercel.app/model-provider-request). Khi [suy luận](https://ai9k.vercel.app/inference), mô hình tạo ra một phân phối xác suất trên các [token](https://ai9k.vercel.app/token) có thể đứng kế tiếp, và một token được lấy mẫu từ đó. Việc lấy mẫu thường cố ý có chút ngẫu nhiên, vì luôn chọn token khả dĩ nhất sẽ cho ra văn bản lặp lại và kém chất lượng hơn. Một token được lấy mẫu khác đi ở đầu câu trả lời làm thay đổi mọi token sau nó. Đó là cách một từ khác đi trở thành một hướng tiếp cận hoàn toàn khác. Phía nhà cung cấp còn thêm biến động nữa: các yêu cầu được gộp thành lô trên phần cứng dùng chung, và những sai khác rất nhỏ về dấu phẩy động giữa các lô có thể làm nghiêng một lựa chọn sít sao giữa hai token. Không có thiết lập nào để bạn tắt hết những điều này.\n\nHãy chờ đợi một dải kết quả khi giao cùng một việc cho một [agent](https://ai9k.vercel.app/agent). Phần lớn câu trả lời nằm trong một đường cong chuông hợp lý về chất lượng, nhờ vậy tính bất định mới chấp nhận được. Nhưng hai đuôi của phân phối là có thật: có ngày mô hình tỏ ra sắc sảo, có ngày nó như mất phương hướng. Cùng một việc, khác lần gieo xúc xắc. Điều này dẫn tới hai hệ quả thực tế. Thử lại là một chiến lược chính đáng: một lần thất bại chỉ là một lần rút từ phân phối, và một lần thử mới cho cùng việc đó có thể đơn giản là rơi vào chỗ tốt hơn. Và việc kiểm chứng quan trọng hơn so với khi dùng công cụ tất định. Bạn không thể kiểm thử hành vi của agent một lần rồi tin rằng nó sẽ lặp lại, nên các [kiểm tra tự động](https://ai9k.vercel.app/automated-check) phải bắt được những lần rút xấu.\n\nCẩn thận đừng dựng thành câu chuyện quá mức. Con người là cỗ máy tìm quy luật, và một chuỗi lần chạy tệ có thể tạo cảm giác như bằng chứng rằng \"tuần này mô hình kém đi\". Thường thì đó chỉ là phân phối.","usage":"\"Hôm nay Claude tệ quá. Họ vừa phát hành bản kém hơn à?\"\n\n\"Chắc là không. Đầu ra của mô hình có tính bất định. Với cùng một việc, bạn sẽ có ngày tốt và ngày xấu. Mai thử lại đã, rồi hãy đi tìm nguyên nhân.\"","translated":true},"en":{"description":"The same input can produce different output. A property of how models generate text and how providers serve requests.","body":"The same input can produce different output. Run a [model](https://ai9k.vercel.app/en/model) twice with identical [context](https://ai9k.vercel.app/en/context) and you may get two different answers — sometimes a word, sometimes a completely different approach. Nothing in your code has to change for this to happen.\n\nIt's a property of how models generate text, and how [model providers](https://ai9k.vercel.app/en/model-provider) serve [requests](https://ai9k.vercel.app/en/model-provider-request). During [inference](https://ai9k.vercel.app/en/inference), the model produces a probability distribution over possible next [tokens](https://ai9k.vercel.app/en/token) and one is sampled from it — usually with some randomness on purpose, since always picking the most likely token produces repetitive, lower-quality text. One differently-sampled token early in a response changes every token after it, which is how a single different word becomes a completely different approach. Provider-side serving adds more variation on top: requests are batched together on shared hardware, and tiny floating-point differences between batches can tip a close call between two tokens. There's no setting you can flip to make it all go away.\n\nExpect a spread of results from an [agent](https://ai9k.vercel.app/en/agent) on the same task. Most responses fall within a reasonable bell curve of quality — that's why the non-determinism is tolerable at all — but the tails are real: some days the model will feel sharp; some days it'll feel like it's lost the plot. Same task, different rolls of the dice. This has two practical consequences. Retrying is a legitimate strategy: a failed attempt is one draw from the distribution, and a fresh attempt at the same task may simply land better. And verification matters more than it would with deterministic tools — you can't test an agent's behaviour once and rely on it repeating, so [automated checks](https://ai9k.vercel.app/en/automated-check) have to catch the bad draws.\n\nBe careful not to over-narrativize this. Humans are pattern-matching machines, and a string of bad runs can feel like proof that \"the model got worse this week.\" Usually it's just the distribution.","usage":"\"Claude has been awful today. Did they ship a worse version?\"\n\n\"Probably not — model output is non-deterministic. You're going to have good days and bad days on the same task. Try again tomorrow before you go looking for a cause.\"","translated":true}}},{"slug":"model-provider","term":"Model provider","section":1,"position":10,"links":["model","inference","harness","parameters","model-provider-request","token","agent","session","turn","input-tokens","output-tokens","prefix-cache"],"text":{"vi":{"name":"Nhà cung cấp mô hình","description":"Bên phục vụ mô hình để suy luận. Thường là dịch vụ từ xa (Anthropic, OpenAI, Google), nhưng cũng có thể chạy cục bộ (Ollama, llama.cpp).","body":"Bên phục vụ một [mô hình](https://ai9k.vercel.app/model) để [suy luận](https://ai9k.vercel.app/inference). Thường là một dịch vụ từ xa (Anthropic, OpenAI, Google), nhưng cũng có thể chạy cục bộ: Ollama, LM Studio, llama.cpp trên máy của chính bạn. [Harness](https://ai9k.vercel.app/harness) không tự chạy mô hình; nó nhờ một nhà cung cấp làm việc đó.\n\nNhà cung cấp sở hữu bộ máy: các [tham số](https://ai9k.vercel.app/parameters) nằm trên phần cứng của họ, và mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request) là harness gửi [token](https://ai9k.vercel.app/token) qua mạng rồi nhận dự đoán về. Vì vậy nhà cung cấp là nguồn gốc của cả một nhóm vấn đề hay bị quy nhầm cho mô hình hoặc harness: giới hạn tốc độ, năng lực phục vụ suy giảm và sự cố ngừng dịch vụ đều nằm ở đây. Khi [agent](https://ai9k.vercel.app/agent) khựng lại giữa [phiên](https://ai9k.vercel.app/session) hoặc báo lỗi ở mọi [lượt](https://ai9k.vercel.app/turn), trang trạng thái của nhà cung cấp là thứ nên xem trước tiên.\n\nNhà cung cấp cũng đặt ra điều khoản thương mại: giá theo token cho [token đầu vào](https://ai9k.vercel.app/input-tokens) và [token đầu ra](https://ai9k.vercel.app/output-tokens), mức giảm giá nhờ [bộ đệm tiền tố](https://ai9k.vercel.app/prefix-cache), và có những mô hình nào để dùng. Lưu ý rằng nhà cung cấp và bên làm ra mô hình có thể là hai công ty khác nhau: Bedrock, Vertex và OpenRouter phục vụ mô hình của bên khác.\n\nNhà cung cấp cục bộ đổi năng lực lấy quyền kiểm soát: các mô hình chạy vừa trên phần cứng của bạn nhỏ hơn nhiều so với các mô hình hàng đầu, nhưng không có gì rời khỏi máy và không có hoá đơn theo token.","usage":"\"Mình chạy cái này offline cho khách hàng dùng mạng cách ly được không?\"\n\n\"Đổi nhà cung cấp mô hình sang bản cục bộ, Ollama hoặc llama.cpp trên máy của họ. Harness không quan tâm, nó chỉ gọi tới một endpoint khác.\"","translated":true},"en":{"description":"Whatever serves a model for inference. Usually remote (Anthropic, OpenAI, Google), but can also be local (Ollama, llama.cpp).","body":"Whatever serves a [model](https://ai9k.vercel.app/en/model) for [inference](https://ai9k.vercel.app/en/inference). Usually a remote service (Anthropic, OpenAI, Google), but can also be local — Ollama, LM Studio, llama.cpp running on your own machine. The [harness](https://ai9k.vercel.app/en/harness) doesn't run the model itself; it asks a provider to.\n\nThe provider owns the machinery: the [parameters](https://ai9k.vercel.app/en/parameters) live on its hardware, and every [model provider request](https://ai9k.vercel.app/en/model-provider-request) is the harness sending [tokens](https://ai9k.vercel.app/en/token) over the network and getting predictions back. That makes the provider the source of a whole category of problems that get misattributed to the model or the harness — rate limits, degraded capacity, and outages all live here. When the [agent](https://ai9k.vercel.app/en/agent) stalls mid-[session](https://ai9k.vercel.app/en/session) or errors on every [turn](https://ai9k.vercel.app/en/turn), the provider's status page is worth checking before anything else.\n\nThe provider also sets the commercial terms: per-token pricing for [input](https://ai9k.vercel.app/en/input-tokens) and [output tokens](https://ai9k.vercel.app/en/output-tokens), [prefix cache](https://ai9k.vercel.app/en/prefix-cache) discounts, and which models are available at all. Note that the provider and the model's maker can be different companies — Bedrock, Vertex, and OpenRouter serve other people's models.\n\nLocal providers trade capability for control: the models that fit on your own hardware are far smaller than the frontier ones, but nothing leaves the machine and there's no bill per token.","usage":"\"Can we run this offline for the air-gapped client?\"\n\n\"Swap the model provider to a local one — Ollama or llama.cpp on their box. The harness doesn't care, it just hits a different endpoint.\"","translated":true}}},{"slug":"harness","term":"Harness","section":1,"position":11,"links":["model","agent","tool","system-prompt","context-window","turn","context","model-provider-request","tool-call","tool-result","session","compaction","agentsmd","filesystem"],"text":{"vi":{"description":"Mọi thứ bao quanh mô hình để biến nó thành agent: công cụ, system prompt, quản lý cửa sổ ngữ cảnh, phân quyền, hook.","body":"Mọi thứ bao quanh [mô hình](https://ai9k.vercel.app/model) để biến nó thành một [agent](https://ai9k.vercel.app/agent): [công cụ](https://ai9k.vercel.app/tool), [system prompt](https://ai9k.vercel.app/system-prompt), [quản lý cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window), phân quyền, hook. **Claude.ai** và **Claude Code** chạy trên cùng một mô hình nhưng hành xử khác nhau vì harness của chúng khác nhau.\n\nBản thân mô hình chỉ làm một việc: nhận văn bản vào, sinh văn bản ra. Nó không đọc được tệp, không chạy được lệnh, không nhớ được [lượt](https://ai9k.vercel.app/turn) trước. Harness cung cấp tất cả những thứ đó. Nó lắp ghép [ngữ cảnh](https://ai9k.vercel.app/context) cho từng [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request), thực thi các [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) mà mô hình yêu cầu, đưa [kết quả công cụ](https://ai9k.vercel.app/tool-result) trở lại, lưu lịch sử [phiên](https://ai9k.vercel.app/session), xin phép bạn trước các hành động rủi ro, và quyết định khi nào cần [nén ngữ cảnh](https://ai9k.vercel.app/compaction). Vòng lặp agent, tức là mô hình đề xuất, harness thực thi, rồi lặp lại, do harness điều khiển.\n\nĐiều này quan trọng khi chẩn đoán. Khi hành vi khác nhau giữa hai sản phẩm, hoặc giữa hôm qua và hôm nay, biến số thường không phải mô hình mà là harness. Một system prompt khác, một bộ công cụ khác, một mặc định phân quyền bị đổi, hay một chiến lược quản lý ngữ cảnh mới đều làm hành vi thay đổi mà mô hình không hề đổi. Nó cũng có nghĩa harness là nơi chứa phần lớn cấu hình của bạn: các tệp [AGENTS.md](https://ai9k.vercel.app/agentsmd), thiết lập phân quyền và hook đều là chỉ dẫn cho harness, không phải cho mô hình.\n\nVí dụ: Claude Code, Cursor, Codex CLI, và cả Claude.ai, vốn là harness để trò chuyện chứ không phải để lập trình.","usage":"\"Cùng một mô hình, sao Claude Code thì sửa tệp còn Claude.ai chỉ trả lời câu hỏi?\"\n\n\"Harness khác nhau. Claude Code có công cụ làm việc với [hệ thống tệp](https://ai9k.vercel.app/filesystem), system prompt khác, và một lớp phân quyền. Ở đây mô hình không phải là biến số.\"","translated":true},"en":{"description":"Everything around the model that turns it into an agent: tools, system prompt, context-window management, permissions, hooks.","body":"Everything around the [model](https://ai9k.vercel.app/en/model) that turns it into an [agent](https://ai9k.vercel.app/en/agent): [tools](https://ai9k.vercel.app/en/tool), [system prompt](https://ai9k.vercel.app/en/system-prompt), [context-window management](https://ai9k.vercel.app/en/context-window), permissions, hooks. **Claude.ai** and **Claude Code** run on the same model but behave differently because their harnesses differ.\n\nThe model itself only does one thing: take text in, produce text out. It can't read a file, run a command, or remember the last [turn](https://ai9k.vercel.app/en/turn). The harness supplies all of that. It assembles the [context](https://ai9k.vercel.app/en/context) for each [model provider request](https://ai9k.vercel.app/en/model-provider-request), executes the [tool calls](https://ai9k.vercel.app/en/tool-call) the model asks for, feeds the [tool results](https://ai9k.vercel.app/en/tool-result) back in, stores the [session](https://ai9k.vercel.app/en/session) history, asks you for permission before risky actions, and decides when to [compact](https://ai9k.vercel.app/en/compaction). The agent loop — model proposes, harness executes, repeat — is run by the harness.\n\nThis matters for diagnosis. When behaviour differs between two products, or between yesterday and today, the model is often not the variable — the harness is. A different system prompt, a different set of tools, a changed permission default, or a new context-management strategy all change behaviour without any change to the model. It also means the harness is where most of your configuration lives: [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) files, permission settings, and hooks are all instructions to the harness, not the model.\n\nExamples: Claude Code, Cursor, Codex CLI — and Claude.ai, which is a chat harness rather than a coding one.","usage":"\"Same model, why is Claude Code editing files and Claude.ai just answering questions?\"\n\n\"Different harnesses — Claude Code has [filesystem](https://ai9k.vercel.app/en/filesystem) tools, a different system prompt, and a permission layer. The model isn't the variable here.\"","translated":true}}},{"slug":"model-provider-request","term":"Model provider request","section":1,"position":12,"links":["harness","model-provider","context","tool-call","agent","tool","tool-result","system-prompt","model","stateless","prefix-cache","input-tokens","output-tokens","turn","token","session"],"text":{"vi":{"name":"Yêu cầu tới nhà cung cấp mô hình","description":"Một vòng đi về từ harness tới nhà cung cấp mô hình. Harness gửi ngữ cảnh; nhà cung cấp trả về một phản hồi.","body":"Một vòng đi về từ [harness](https://ai9k.vercel.app/harness) tới [nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider). Harness gửi [ngữ cảnh](https://ai9k.vercel.app/context) hiện tại; nhà cung cấp trả về một phản hồi (một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) hoặc câu trả lời cuối). Một tin nhắn của người dùng có thể sinh ra nhiều yêu cầu tới nhà cung cấp mô hình nếu [agent](https://ai9k.vercel.app/agent) gọi [công cụ](https://ai9k.vercel.app/tool): mỗi [kết quả công cụ](https://ai9k.vercel.app/tool-result) kích hoạt thêm một yêu cầu.\n\nMỗi yêu cầu mang theo tất cả: [system prompt](https://ai9k.vercel.app/system-prompt), toàn bộ cuộc trò chuyện tới lúc đó, mọi kết quả công cụ. [Mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên nhà cung cấp không giữ lại gì giữa các yêu cầu. Yêu cầu thứ bốn mươi gửi lại những gì yêu cầu thứ ba mươi chín đã gửi, cộng thêm một kết quả công cụ. [Bộ đệm tiền tố](https://ai9k.vercel.app/prefix-cache) tồn tại để sự lặp lại này có giá chấp nhận được.\n\nYêu cầu cũng là đơn vị tính tiền. [Token đầu vào](https://ai9k.vercel.app/input-tokens), [token đầu ra](https://ai9k.vercel.app/output-tokens) và mức giảm giá nhờ cache đều được đếm theo từng yêu cầu. Vì thế một câu hỏi trông vô hại có thể tốn nhiều bất ngờ: chi phí không tỷ lệ với tin nhắn của bạn, mà tỷ lệ với số yêu cầu nhân với kích thước ngữ cảnh mỗi yêu cầu mang theo.\n\nNên phân biệt yêu cầu với [lượt](https://ai9k.vercel.app/turn). Một lượt là một lần trao đổi với bạn, và một lượt duy nhất, chẳng hạn \"sửa bài test đang lỗi\", diễn ra thành một chuỗi yêu cầu:\n\n| Yêu cầu | Mô hình trả về                          | Harness sau đó                     |\n| ------- | --------------------------------------- | ---------------------------------- |\n| 1       | Lệnh gọi công cụ: chạy test             | Chạy test, nối thêm đầu ra báo lỗi |\n| 2       | Lệnh gọi công cụ: đọc tệp test          | Nối thêm nội dung tệp              |\n| 3       | Lệnh gọi công cụ: đọc tệp mã nguồn      | Nối thêm nội dung tệp              |\n| 4       | Lệnh gọi công cụ: sửa tệp mã nguồn      | Áp dụng thay đổi, nối thêm kết quả |\n| 5       | Lệnh gọi công cụ: chạy lại test         | Chạy test, nối thêm đầu ra báo đạt |\n| 6       | Câu trả lời cuối: \"đã sửa, test đã đạt\" | Hiển thị cho bạn                   |\n\nSáu yêu cầu cho một lượt, và yêu cầu nào cũng gửi lại toàn bộ ngữ cảnh. Khi bạn tự hỏi [token](https://ai9k.vercel.app/token) đã đi đâu, hãy đếm số yêu cầu, đừng đếm số lượt.","usage":"\"Một câu hỏi mà đốt hết bốn mươi nghìn token?\"\n\n\"Nhìn các lệnh gọi công cụ xem: mười hai lần grep, tám lần đọc, bốn lần sửa. Mỗi kết quả công cụ sinh thêm một yêu cầu tới nhà cung cấp mô hình, và toàn bộ phần đầu của [phiên](https://ai9k.vercel.app/session) được gửi lại mỗi lần.\"","translated":true},"en":{"description":"One round-trip from the harness to the model provider. The harness sends context; the provider returns one response.","body":"One round-trip from the [harness](https://ai9k.vercel.app/en/harness) to the [model provider](https://ai9k.vercel.app/en/model-provider). The harness sends the current [context](https://ai9k.vercel.app/en/context); the provider returns one response (a [tool call](https://ai9k.vercel.app/en/tool-call) or a final answer). A single user message can spawn many model provider requests if the [agent](https://ai9k.vercel.app/en/agent) calls [tools](https://ai9k.vercel.app/en/tool) — each [tool result](https://ai9k.vercel.app/en/tool-result) triggers another request.\n\nEach request carries everything: the [system prompt](https://ai9k.vercel.app/en/system-prompt), the full conversation so far, every tool result. The [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless), so the provider keeps nothing between requests — request forty re-sends what request thirty-nine sent, plus one more tool result. The [prefix cache](https://ai9k.vercel.app/en/prefix-cache) exists to make this repetition affordable.\n\nThe request is also the unit of billing. [Input tokens](https://ai9k.vercel.app/en/input-tokens), [output tokens](https://ai9k.vercel.app/en/output-tokens), and cache discounts are all counted per request, which is why an innocuous-looking question can cost a surprising amount: the cost isn't proportional to your message, it's proportional to the number of requests times the size of the context each one carries.\n\nIt's worth keeping the request distinct from the [turn](https://ai9k.vercel.app/en/turn). A turn is one exchange with you, and a single turn — \"fix the failing test\" — plays out as a chain of requests:\n\n| Request | Model returns                     | Harness then                          |\n| ------- | --------------------------------- | ------------------------------------- |\n| 1       | Tool call: run the tests          | Runs them, appends the failure output |\n| 2       | Tool call: read the test file     | Appends the file contents             |\n| 3       | Tool call: read the source file   | Appends the file contents             |\n| 4       | Tool call: edit the source file   | Applies the edit, appends the result  |\n| 5       | Tool call: run the tests again    | Runs them, appends the pass output    |\n| 6       | Final answer: \"fixed, tests pass\" | Shows it to you                       |\n\nSix requests for one turn — each one re-sending the whole context. When you wonder where the [tokens](https://ai9k.vercel.app/en/token) went, count the requests, not the turns.","usage":"\"One question burned forty thousand tokens?\"\n\n\"Look at the tool calls — twelve grep, eight read, four edits. Each tool result spawns another model provider request, and the whole [session](https://ai9k.vercel.app/en/session) prefix re-sends every time.\"","translated":true}}},{"slug":"input-tokens","term":"Input tokens","section":1,"position":13,"links":["token","harness","model-provider-request","system-prompt","tool-result","model","output-tokens","ai","stateless","turn","session","prefix-cache","cache-tokens","clearing","compaction","agent"],"text":{"vi":{"name":"Token đầu vào","description":"Các token harness gửi đi ở mỗi yêu cầu tới nhà cung cấp mô hình. Được tính giá thấp hơn token đầu ra.","body":"Các [token](https://ai9k.vercel.app/token) mà [harness](https://ai9k.vercel.app/harness) gửi đi ở mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request): [system prompt](https://ai9k.vercel.app/system-prompt), lịch sử trò chuyện, [kết quả công cụ](https://ai9k.vercel.app/tool-result), tức là mọi thứ [mô hình](https://ai9k.vercel.app/model) đọc trước khi viết. Chúng được tính giá thấp hơn [token đầu ra](https://ai9k.vercel.app/output-tokens), vì xử lý chúng ít tốn kém hơn.\n\nKhi lập trình với [AI](https://ai9k.vercel.app/ai), token đầu vào chiếm phần lớn hoá đơn. Mô hình [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên mỗi [lượt](https://ai9k.vercel.app/turn) gửi lại toàn bộ [phiên](https://ai9k.vercel.app/session) làm đầu vào: tin nhắn đầu tiên của bạn, mọi phản hồi, mọi kết quả công cụ kể từ đó. Đầu vào của lượt thứ năm mươi chứa cả bốn mươi chín lượt trước. Một yêu cầu tới nhà cung cấp mô hình có thể chỉ sinh vài trăm token đầu ra nhưng gửi lại một trăm nghìn token đầu vào là lịch sử tích luỹ.\n\n[Bộ đệm tiền tố](https://ai9k.vercel.app/prefix-cache) làm giảm chi phí này: phần lịch sử khớp chính xác với một yêu cầu trước đó được tính như [token đã cache](https://ai9k.vercel.app/cache-tokens) giá rẻ thay vì đầu vào nguyên giá. Khi chi phí đầu vào vẫn còn cao, cách xử lý là thu nhỏ phần bị gửi lại: [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) hoặc [nén ngữ cảnh](https://ai9k.vercel.app/compaction) giữa các việc.","usage":"\"Hoá đơn cao mà [agent](https://ai9k.vercel.app/agent) hầu như chẳng viết gì.\"\n\n\"Là do token đầu vào. Mỗi lượt gửi lại cả phiên. Không có bộ đệm tiền tố thì yêu cầu nào bạn cũng trả lại tiền cho phần lịch sử.\"","translated":true},"en":{"description":"Tokens the harness sends on each model provider request. Billed at a lower rate than output tokens.","body":"[Tokens](https://ai9k.vercel.app/en/token) the [harness](https://ai9k.vercel.app/en/harness) sends on each [model provider request](https://ai9k.vercel.app/en/model-provider-request) — the [system prompt](https://ai9k.vercel.app/en/system-prompt), the conversation history, [tool results](https://ai9k.vercel.app/en/tool-result), everything the [model](https://ai9k.vercel.app/en/model) reads before it writes. Billed at a lower rate than [output tokens](https://ai9k.vercel.app/en/output-tokens), because they are less expensive to process than output tokens.\n\nWhen doing [AI](https://ai9k.vercel.app/en/ai) coding, input tokens make up most of your bill. The model is [stateless](https://ai9k.vercel.app/en/stateless), so each [turn](https://ai9k.vercel.app/en/turn) re-sends the entire [session](https://ai9k.vercel.app/en/session) as input: your first message, every response, every tool result since. The input for turn fifty contains the previous forty-nine turns. A single model provider request might produce a few hundred output tokens but re-send a hundred thousand input tokens of accumulated history.\n\nThe [prefix cache](https://ai9k.vercel.app/en/prefix-cache) reduces the cost: history that exactly matches a previous request is billed as cheap [cache tokens](https://ai9k.vercel.app/en/cache-tokens) rather than full-price input. When input costs still hurt, the fix is to shrink what gets re-sent — [clearing](https://ai9k.vercel.app/en/clearing) or [compacting](https://ai9k.vercel.app/en/compaction) between tasks.","usage":"\"Bill's high but the [agent](https://ai9k.vercel.app/en/agent)'s barely writing anything.\"\n\n\"It's the input tokens — every turn re-sends the whole session. Without the prefix cache you re-pay for the history each request.\"","translated":true}}},{"slug":"output-tokens","term":"Output tokens","section":1,"position":14,"links":["token","model","input-tokens","tool-call","harness","effort","session","turn"],"text":{"vi":{"name":"Token đầu ra","description":"Các token mô hình sinh ra để trả về. Được tính giá cao hơn token đầu vào, vì tốn nhiều năng lực tính toán hơn để tạo ra.","body":"Các [token](https://ai9k.vercel.app/token) mà [mô hình](https://ai9k.vercel.app/model) sinh ra để trả về. Chúng được tính giá cao hơn [token đầu vào](https://ai9k.vercel.app/input-tokens), thường khoảng gấp năm lần, vì tốn nhiều năng lực tính toán hơn để tạo ra.\n\nMọi thứ mô hình viết đều được tính: phần văn bạn đọc, mã nó phát ra, các [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call), và bất kỳ phần suy nghĩ mở rộng nào mô hình thực hiện trước khi trả lời. Điểm cuối hay làm mọi người bất ngờ: token suy luận được tính là đầu ra kể cả khi [harness](https://ai9k.vercel.app/harness) thường không cho bạn thấy chúng, và tăng [effort](https://ai9k.vercel.app/effort) sẽ tiêu nhiều token loại này hơn.\n\nToken đầu ra cũng quyết định nhịp độ của một [phiên](https://ai9k.vercel.app/session). Mô hình đọc đầu vào nhanh nhưng sinh đầu ra từng token một, nên khi một [lượt](https://ai9k.vercel.app/turn) có vẻ chậm, hầu như luôn là do đầu ra đang được viết chứ không phải đầu vào đang được đọc. Chờ lâu thường nghĩa là một câu trả lời dài sắp tới.","usage":"\"Phiên refactor này đang ngốn credit dù đầu vào nhỏ.\"\n\n\"Agent đang viết lại cả tệp thay vì vá từng chỗ. Token đầu ra đắt khoảng gấp năm lần đầu vào. Bảo nó phát ra các chỉnh sửa thôi là hoá đơn giảm.\"","translated":true},"en":{"description":"Tokens the model generates back. Billed at a higher rate than input tokens, since they cost more compute to produce.","body":"[Tokens](https://ai9k.vercel.app/en/token) the [model](https://ai9k.vercel.app/en/model) generates back. Billed at a higher rate than [input tokens](https://ai9k.vercel.app/en/input-tokens) — commonly around five times the rate — since they cost more compute to produce.\n\nEverything the model writes counts: the prose you read, the code it emits, [tool calls](https://ai9k.vercel.app/en/tool-call), and any extended thinking the model does before answering. That last one surprises people — reasoning tokens are billed as output even when the [harness](https://ai9k.vercel.app/en/harness) often doesn't show them to you, and turning up [effort](https://ai9k.vercel.app/en/effort) spends more of them.\n\nOutput tokens also set the pace of a [session](https://ai9k.vercel.app/en/session). The model reads input quickly but generates output one token at a time, so when a [turn](https://ai9k.vercel.app/en/turn) feels slow, it's almost always the output being written, not the input being read. A long wait usually means a long answer is coming.","usage":"\"The refactor session is burning through credit even though the inputs are small.\"\n\n\"Agent's rewriting whole files instead of patching. Output tokens cost roughly five times the input rate — get it emitting edits and the bill drops.\"","translated":true}}},{"slug":"prefix-cache","term":"Prefix cache","section":1,"position":15,"links":["model-provider","model-provider-request","system-prompt","token","cache-tokens","input-tokens","session","turn","harness"],"text":{"vi":{"name":"Bộ đệm tiền tố","description":"Kho lưu phía nhà cung cấp, giúp các yêu cầu liên tiếp không phải xử lý lại phần đầu chung và tính các token đó với giá thấp hơn.","body":"Kho lưu phía [nhà cung cấp](https://ai9k.vercel.app/model-provider), giúp các [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request) liên tiếp không phải xử lý lại phần đầu (tiền tố) chung. Khi phần đầu của một yêu cầu khớp với phần đầu của một yêu cầu gần đây, tức là cùng [system prompt](https://ai9k.vercel.app/system-prompt), cùng lịch sử tới một điểm nào đó, nhà cung cấp dùng lại công việc đã làm và tính các [token](https://ai9k.vercel.app/token) đó như [token đã cache](https://ai9k.vercel.app/cache-tokens) với giá thấp hơn nhiều.\n\nBộ đệm có lợi vì phiên chỉ lớn lên bằng cách nối thêm vào cuối. Mỗi yêu cầu gửi lại toàn bộ lịch sử làm [token đầu vào](https://ai9k.vercel.app/input-tokens) (xem mục đó để biết lý do), và trong một [phiên](https://ai9k.vercel.app/session) bình thường, lịch sử chỉ thay đổi ở cuối: mỗi yêu cầu là yêu cầu trước cộng thêm vài tin nhắn mới. Nhà cung cấp xử lý phần đầu chung dài đó một lần, lưu kết quả, rồi tiếp tục từ chỗ tiền tố kết thúc. Không có bộ đệm, một phiên 50 [lượt](https://ai9k.vercel.app/turn) sẽ phải trả tiền xử lý lại lượt một tới năm mươi lần.\n\nBộ đệm cũng hết hạn. Một mục được giữ ấm bao lâu thì tuỳ nhà cung cấp mô hình, thường là vài phút chứ không phải vài giờ. Để phiên nghỉ quá khoảng đó thì yêu cầu kế tiếp phải dựng lại tiền tố với giá đầy đủ một lần trước khi việc cache tiếp tục. Đây chủ yếu là mối quan tâm của người xây dựng [harness](https://ai9k.vercel.app/harness). Với người dùng, tác động nhìn thấy được là các yêu cầu sau một quãng nghỉ dài tốn hơn các yêu cầu trước đó.","usage":"\"Sao hoá đơn lại vọt lên giữa phiên?\"\n\n\"Harness bắt đầu chèn giờ hiện tại vào system prompt ở mỗi lượt. Bộ đệm tiền tố gãy ngay tại token đầu tiên bị đổi, nên mọi yêu cầu sau đó đều bị tính nguyên giá.\"","translated":true},"en":{"description":"The provider-side store that lets consecutive requests skip re-processing a shared prefix, billing those tokens at a lower rate.","body":"The [provider](https://ai9k.vercel.app/en/model-provider)-side store that lets consecutive [model provider requests](https://ai9k.vercel.app/en/model-provider-request) skip re-processing a shared prefix. When the start of a request matches the start of a recent one — same [system prompt](https://ai9k.vercel.app/en/system-prompt), same history up to some point — the provider reuses its prior work and bills those [tokens](https://ai9k.vercel.app/en/token) as [cache tokens](https://ai9k.vercel.app/en/cache-tokens) at a much lower rate.\n\nThe cache pays off because sessions grow append-only. Every request re-sends the whole history as [input tokens](https://ai9k.vercel.app/en/input-tokens) (see that entry for why), and in a normal [session](https://ai9k.vercel.app/en/session) the history only changes at the end — each request is the previous one plus a few new messages. The provider processes the long shared beginning once, stores the result, and picks up from where the prefix ends. Without the cache, a 50-[turn](https://ai9k.vercel.app/en/turn) session would pay to re-process turn one fifty times.\n\nCaches also expire. How long an entry stays warm varies per model provider — typically minutes, not hours. Leave a session idle past the window and the next request rebuilds the prefix at full price once before caching resumes. This is mostly a [harness](https://ai9k.vercel.app/en/harness) builder's concern; as a user, the visible effect is that requests after a long pause cost more than the ones before it.","usage":"\"Why did the bill spike halfway through the session?\"\n\n\"Harness started injecting the current time into the system prompt every turn. Prefix cache breaks at the first changed token, so every request after that billed at full rate.\"","translated":true}}},{"slug":"cache-tokens","term":"Cache tokens","section":1,"position":16,"links":["input-tokens","model-provider","model-provider-request","prefix-cache","session","turn","model","stateless","system-prompt","tool-result","harness"],"text":{"vi":{"name":"Token đã cache","description":"Token đầu vào mà nhà cung cấp đã lưu từ một yêu cầu trước qua bộ đệm tiền tố, được tính với giá thấp hơn nhiều.","body":"[Token đầu vào](https://ai9k.vercel.app/input-tokens) mà [nhà cung cấp](https://ai9k.vercel.app/model-provider) đã lưu lại từ một [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request) trước đó để không phải xử lý lại. Khi các yêu cầu liên tiếp có chung phần đầu, nhà cung cấp dùng lại công việc đã làm qua [bộ đệm tiền tố](https://ai9k.vercel.app/prefix-cache) và tính phần đã cache với giá thấp hơn nhiều. Đây là đòn bẩy giúp các [phiên](https://ai9k.vercel.app/session) dài có chi phí chấp nhận được. Không có nó, mỗi [lượt](https://ai9k.vercel.app/turn) phải trả lại tiền cho toàn bộ lịch sử.\n\nĐiều này quan trọng vì cách phiên được tính tiền. [Mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên mỗi yêu cầu gửi lại toàn bộ cuộc trò chuyện, gồm [system prompt](https://ai9k.vercel.app/system-prompt), mọi tin nhắn, mọi [kết quả công cụ](https://ai9k.vercel.app/tool-result), dưới dạng token đầu vào. Tới lượt thứ năm mươi, mỗi yêu cầu mang theo năm mươi lượt lịch sử, và lần nào bạn cũng trả nguyên giá cho tất cả. Bộ đệm làm phép tính thay đổi: các token nhà cung cấp đã xử lý trong một tiền tố giống hệt được tính là token đã cache, thường bằng một phần mười giá đầu vào hoặc thấp hơn. Trong một phiên dài, phần lớn những gì bạn gửi là token đã cache, và hoá đơn giữ ở mức hợp lý.\n\nVí dụ sau cho thấy khi nào token được cache và khi nào không. Mỗi chữ cái là một khối nội dung của cuộc trò chuyện; mỗi yêu cầu gửi cuộc trò chuyện tới thời điểm đó:\n\n| Yêu cầu gửi | Đã cache | Tính nguyên giá | Vì sao                                               |\n| ----------- | -------- | --------------- | ---------------------------------------------------- |\n| `AB`        | không có | `AB`            | Yêu cầu đầu tiên, chưa có gì để so khớp              |\n| `ABC`       | `AB`     | `C`             | `AB` là tiền tố chính xác của yêu cầu trước          |\n| `ABCD`      | `ABC`    | `D`             | Tiền tố vẫn nguyên vẹn                               |\n| `AXCD`      | `A`      | `XCD`           | Một chỉnh sửa đổi `B` thành `X`; việc khớp dừng ở đó |\n\nBộ đệm dễ gãy theo một cách cụ thể: nó chỉ khớp các tiền tố chính xác. Nếu có gì thay đổi ở phần trước của cuộc trò chuyện, như [harness](https://ai9k.vercel.app/harness) sắp xếp lại nội dung, một dấu thời gian được cập nhật, hay cách biểu diễn một tệp bị đổi, thì từ điểm đó trở đi bộ đệm không khớp nữa và mọi thứ phía sau bị tính nguyên giá đầu vào. Bộ đệm cũng hết hạn sau vài phút không hoạt động, nên một phiên được tiếp tục sau quãng nghỉ dài phải trả lại tiền cho lịch sử một lần. Khi chi phí của một phiên vọt lên mà không rõ nguyên nhân, hãy so token đã cache với token đầu vào trong báo cáo sử dụng. Bộ đệm bị gãy sẽ lộ ra ở đó trước tiên.","usage":"\"Chi phí cho phiên dài cao kinh khủng, tám đô cho một lần refactor.\"\n\n\"Xem token đã cache đi. Nếu harness sắp xếp lại system prompt hoặc các tệp giữa các lượt, tiền tố bị gãy và yêu cầu nào bạn cũng trả nguyên giá đầu vào.\"","translated":true},"en":{"description":"Input tokens the provider has cached from a previous request via its prefix cache, billed at a much lower rate.","body":"[Input tokens](https://ai9k.vercel.app/en/input-tokens) the [provider](https://ai9k.vercel.app/en/model-provider) has cached from a previous [model provider request](https://ai9k.vercel.app/en/model-provider-request) so it doesn't have to re-process them. When consecutive requests share a prefix, the provider reuses the work via its [prefix cache](https://ai9k.vercel.app/en/prefix-cache) and bills the cached portion at a much lower rate. The lever that makes long [sessions](https://ai9k.vercel.app/en/session) affordable — without it, every [turn](https://ai9k.vercel.app/en/turn) re-pays for the whole history.\n\nThe reason this matters is how sessions are billed. The [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless), so every request resends the entire conversation — [system prompt](https://ai9k.vercel.app/en/system-prompt), every message, every [tool result](https://ai9k.vercel.app/en/tool-result) — as input tokens. By turn fifty, each request carries fifty turns of history, and you'd pay full rate on all of it, every time. The cache changes the maths: tokens the provider has already processed in an identical prefix are billed as cache tokens, often at a tenth of the input rate or less. On a long session, most of what you send is cache tokens, and the bill stays sane.\n\nAn example shows when tokens are cached and when they're not. Each letter stands for a block of conversation content; each request sends the conversation so far:\n\n| Request sends | Cached  | Billed at full rate | Why                                               |\n| ------------- | ------- | ------------------- | ------------------------------------------------- |\n| `AB`          | nothing | `AB`                | First request — nothing to match against          |\n| `ABC`         | `AB`    | `C`                 | `AB` is an exact prefix of the previous request   |\n| `ABCD`        | `ABC`   | `D`                 | Prefix still intact                               |\n| `AXCD`        | `A`     | `XCD`               | An edit changed `B` to `X`; the match fails there |\n\nThe cache is fragile in a specific way: it matches exact prefixes. If anything changes earlier in the conversation — the [harness](https://ai9k.vercel.app/en/harness) reorders content, a timestamp updates, a file's representation shifts — the cache misses from that point onward and everything after it is billed at full input rate. Caches also expire after a few minutes of inactivity, so a session resumed after a long pause re-pays its history once. When a session's cost jumps without an obvious cause, compare cache tokens to input tokens in the usage report — a broken cache shows up there first.","usage":"\"Cost on long sessions is brutal — eight bucks for a refactor.\"\n\n\"Check the cache tokens. If the harness is reordering the system prompt or files between turns, the prefix breaks and you re-pay full input rate every request.\"","translated":true}}},{"slug":"stateless","term":"Stateless","section":2,"position":17,"links":["model","model-provider-request","context-window","agent","session","stateful","parameters","training","inference","harness","agentsmd","memory-system","handoff-artifact","context","clearing"],"text":{"vi":{"name":"Không lưu trạng thái","description":"Không mang thông tin nào sang lần sau. Mô hình không lưu trạng thái giữa các yêu cầu; agent mặc định không lưu trạng thái giữa các phiên.","body":"Không mang thông tin nào sang lần sau. [Mô hình](https://ai9k.vercel.app/model) không lưu trạng thái giữa các [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request): mỗi yêu cầu gửi lại toàn bộ [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window), vì mô hình không có cách nào thấy được thứ gì khác. Một [agent](https://ai9k.vercel.app/agent) mặc định không lưu trạng thái giữa các [phiên](https://ai9k.vercel.app/session): phiên mới bắt đầu trống trơn, không còn dấu vết của các phiên trước. Đối lập với [có lưu trạng thái](https://ai9k.vercel.app/stateful).\n\nBản thân mô hình vĩnh viễn không lưu trạng thái: [tham số](https://ai9k.vercel.app/parameters) của nó bị đóng băng sau khi [huấn luyện](https://ai9k.vercel.app/training), và không việc gì bạn làm lúc [suy luận](https://ai9k.vercel.app/inference) thay đổi được chúng. Mô hình không học từ lời sửa của bạn, không nhớ hôm qua đã được dặn đúng điều đó, và không dần hiểu bạn hơn, dù cuộc trò chuyện có tạo cảm giác ngược lại tới đâu. Cảm giác liên tục trong một phiên là do [harness](https://ai9k.vercel.app/harness) tạo ra: nó giữ bản ghi cuộc trò chuyện và gửi lại ở mỗi yêu cầu. Mô hình không nhớ cuộc trò chuyện; nó đọc lại cuộc trò chuyện.\n\nHệ quả thực tế: nếu muốn điều gì được nhớ qua các phiên, bạn phải ghi nó ra một nơi mà agent sẽ đọc lại. Các tệp [AGENTS.md](https://ai9k.vercel.app/agentsmd), [hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system) và [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) chính là như vậy: những tệp được nạp vào [ngữ cảnh](https://ai9k.vercel.app/context) của các phiên sau, thay cho trí nhớ mà mô hình không có. Khi agent cứ lặp lại một lỗi bạn đã sửa trước đây, câu hỏi không phải là vì sao nó không học được, vì nó không thể, mà là lời sửa đó nên được ghi ở đâu để mọi phiên sau đều đọc thấy.","usage":"\"Sao lần nào mình [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) nó cũng quên quy ước?\"\n\n\"Mô hình không lưu trạng thái, phiên mới bắt đầu trống trơn. Muốn mang theo thì ghi vào AGENTS.md hoặc một tệp bộ nhớ mà harness nạp lúc bắt đầu phiên.\"","translated":true},"en":{"description":"Carries no information forward. The model is stateless across requests; an agent is stateless across sessions by default.","body":"Carries no information forward. The [model](https://ai9k.vercel.app/en/model) is stateless across [model provider requests](https://ai9k.vercel.app/en/model-provider-request) — each request resends the full [context window](https://ai9k.vercel.app/en/context-window), because the model has no way to see anything else. An [agent](https://ai9k.vercel.app/en/agent) is stateless across [sessions](https://ai9k.vercel.app/en/session) by default: a new session starts empty, with no trace of prior ones. Counterpart to [stateful](https://ai9k.vercel.app/en/stateful).\n\nThe model itself is permanently stateless: its [parameters](https://ai9k.vercel.app/en/parameters) are frozen after [training](https://ai9k.vercel.app/en/training), and nothing you do at [inference](https://ai9k.vercel.app/en/inference) changes them. The model doesn't learn from your corrections, doesn't remember being told the same thing yesterday, and isn't getting to know you — however much the conversation feels otherwise. The feeling of continuity within a session is manufactured by the [harness](https://ai9k.vercel.app/en/harness), which keeps the transcript and re-sends it with every request. The model isn't remembering the conversation; it's re-reading it.\n\nThe practical consequence: if you want something remembered across sessions, you have to write it down somewhere the agent will read it back. That's what [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) files, [memory systems](https://ai9k.vercel.app/en/memory-system), and [handoff artifacts](https://ai9k.vercel.app/en/handoff-artifact) are — files that get loaded into the [context](https://ai9k.vercel.app/en/context) of future sessions, standing in for the memory the model doesn't have. When the agent keeps making a mistake you've corrected before, the question isn't why it didn't learn — it can't — but where that correction should be written down so every future session reads it.","usage":"\"Why does it forget the convention every time I [clear](https://ai9k.vercel.app/en/clearing)?\"\n\n\"The model's stateless — the new session starts empty. If you want it carried, write it to AGENTS.md or a memory file the harness loads at session start.\"","translated":true}}},{"slug":"context","term":"Context","section":2,"position":18,"links":["agent","context-window","session","token","harness","attention-degradation"],"text":{"vi":{"name":"Ngữ cảnh","description":"Những thông tin liên quan mà agent đang có trong tay lúc này, tức là những gì agent biết và cần cho việc đang làm.","body":"Những thông tin liên quan mà [agent](https://ai9k.vercel.app/agent) đang có trong tay lúc này. Đây là một danh từ trừu tượng. Nó không phải đầu vào thô mà mô hình nhìn thấy (đó là [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window)), cũng không phải lịch sử đang chạy (đó là [phiên](https://ai9k.vercel.app/session)), mà là _những gì agent biết và cần cho việc đang làm_. \"Nạp thứ gì đó vào ngữ cảnh\" nghĩa là đưa nó vào tập hợp này; \"context engineering\" là kỹ năng chọn lọc tập hợp ấy.\n\nBa thuật ngữ tách bạch rõ ràng:\n\n| Thuật ngữ       | Nó gọi tên cái gì                                               |\n| --------------- | --------------------------------------------------------------- |\n| Ngữ cảnh        | Thông tin liên quan tới công việc mà agent hiện có              |\n| Cửa sổ ngữ cảnh | Chuỗi [token](https://ai9k.vercel.app/token) thực tế mà mô hình thấy ở mỗi yêu cầu |\n| Phiên           | Cuộc trò chuyện đang diễn ra mà [harness](https://ai9k.vercel.app/harness) lưu giữ |\n\nSự tách bạch này quan trọng vì ngữ cảnh là thước đo chất lượng, không phải số lượng. Một cửa sổ ngữ cảnh có thể gần đầy mà ngữ cảnh vẫn nghèo: hàng nghìn token đầu ra công cụ đã cũ, không cái nào nói về việc đang làm. Nó cũng có thể gần trống mà ngữ cảnh lại rất tốt: đúng một định nghĩa kiểu dữ liệu mà cả công việc xoay quanh.\n\nPhần lớn sự cố hằng ngày đều truy về ngữ cảnh. Khi agent bịa ra một API, làm trái một quyết định, hay đoán mò một schema, câu hỏi đầu tiên là lúc đó trong ngữ cảnh có gì. Thường thì dữ kiện liên quan chưa từng được nạp, hoặc bị vùi lấp do [suy giảm chú ý](https://ai9k.vercel.app/attention-degradation). Cách xử lý là chọn lọc: nạp những gì công việc cần, để ngoài những gì nó không cần.","usage":"\"Nó cứ bịa ra những trường không có trong kiểu dữ liệu.\"\n\n\"Tệp định nghĩa kiểu không nằm trong ngữ cảnh. Nó đang đọc các chỗ gọi rồi đoán. Cho nó đọc phần định nghĩa trước đã.\"","translated":true},"en":{"description":"The relevant information the agent has access to right now — what the agent knows that's pertinent to the task.","body":"The relevant information the [agent](https://ai9k.vercel.app/en/agent) has access to right now. The abstract noun — not the raw input the model sees (that's the [context window](https://ai9k.vercel.app/en/context-window)), not the running history (that's the [session](https://ai9k.vercel.app/en/session)), but _what the agent knows that's pertinent to the task_. \"Loading something into context\" means making it part of this set; \"context engineering\" is the discipline of curating it.\n\nThe three terms separate cleanly:\n\n| Term           | What it names                                                       |\n| -------------- | ------------------------------------------------------------------- |\n| Context        | The task-relevant information the agent currently has               |\n| Context window | The literal [token](https://ai9k.vercel.app/en/token) sequence the model sees per request |\n| Session        | The running conversation the [harness](https://ai9k.vercel.app/en/harness) stores         |\n\nThe separation matters because context is a measure of quality, not quantity. A context window can be nearly full and the context still poor — thousands of tokens of stale tool output, none of it about the task at hand. It can also be nearly empty and the context excellent: the one type definition the task turns on.\n\nMost day-to-day failures trace back to context. When the agent invents an API, contradicts a decision, or guesses at a schema, the first question is what was in context when it did — usually the relevant fact was never loaded, or was buried under [attention degradation](https://ai9k.vercel.app/en/attention-degradation). The fix is curation: load what the task needs, keep out what it doesn't.","usage":"\"It keeps inventing fields that aren't in the type.\"\n\n\"The type file isn't in context — it's reading the call sites and guessing. Read the definition in first.\"","translated":true}}},{"slug":"context-window","term":"Context window","section":2,"position":19,"links":["model","model-provider-request","token","system-prompt","tool-result","harness","tool-call","session","compaction","clearing","attention-budget","memory-system"],"text":{"vi":{"name":"Cửa sổ ngữ cảnh","description":"Mọi thứ mô hình thấy ở mỗi yêu cầu tới nhà cung cấp mô hình. Hữu hạn, tuỳ từng mô hình, và là bề mặt duy nhất để mô hình nhận biết.","body":"Mọi thứ [mô hình](https://ai9k.vercel.app/model) thấy ở mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request). Nó hữu hạn, tuỳ từng mô hình, và là bề mặt _duy nhất_ để mô hình nhận biết bất cứ điều gì.\n\nĐó là một chuỗi [token](https://ai9k.vercel.app/token) duy nhất: [system prompt](https://ai9k.vercel.app/system-prompt), cuộc trò chuyện tới lúc đó, mọi [kết quả công cụ](https://ai9k.vercel.app/tool-result) mà [harness](https://ai9k.vercel.app/harness) đã đưa trở lại. Thứ gì nằm trong chuỗi đó thì mô hình dùng được; thứ gì không nằm trong đó thì mô hình không biết là nó tồn tại: codebase của bạn, tệp bạn sửa hôm qua, chỉ dẫn bạn đưa ra ba phiên trước đều vậy. Bất cứ thứ gì nằm ngoài cửa sổ phải được đưa vào, thường qua một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call), rồi mới có thể ảnh hưởng tới điều gì.\n\nHữu hạn nghĩa là nó sẽ đầy. Mỗi lượt nối thêm nội dung: tin nhắn của bạn, phản hồi của mô hình, kết quả công cụ. Một [phiên](https://ai9k.vercel.app/session) dài cuối cùng sẽ chạm giới hạn, buộc phải [nén ngữ cảnh](https://ai9k.vercel.app/compaction) hoặc [xoá ngữ cảnh](https://ai9k.vercel.app/clearing). Hữu hạn cũng nghĩa là mọi thứ trong cửa sổ cạnh tranh với nhau: mỗi token bạn nạp vào là bớt đi một token cho phần còn lại, và nội dung bạn không cần vẫn chiếm [sự chú ý](https://ai9k.vercel.app/attention-budget) của mô hình. Thái độ thực tế là coi cửa sổ như một ngân sách: nạp những gì công việc cần, để phần còn lại ở ngoài.\n\n_Nên tránh:_ \"bộ nhớ\". Cửa sổ ngữ cảnh là trạng thái làm việc và không tồn tại qua các phiên. [Bộ nhớ](https://ai9k.vercel.app/memory-system) là một khái niệm riêng, xếp chồng lên trên.","usage":"\"Mình dán cả monorepo vào prompt luôn được không?\"\n\n\"Cửa sổ ngữ cảnh là 200k token, chắc chỉ bằng một phần năm repo. Chọn những tệp mà công việc đụng tới, phần còn lại để sau một lệnh gọi công cụ.\"","translated":true},"en":{"description":"Everything the model sees on each model provider request. Finite, model-specific, the only surface through which the model perceives.","body":"Everything the [model](https://ai9k.vercel.app/en/model) sees on each [model provider request](https://ai9k.vercel.app/en/model-provider-request). Finite, model-specific, and the _only_ surface through which the model perceives anything.\n\nIt's a single sequence of [tokens](https://ai9k.vercel.app/en/token): the [system prompt](https://ai9k.vercel.app/en/system-prompt), the conversation so far, every [tool result](https://ai9k.vercel.app/en/tool-result) the [harness](https://ai9k.vercel.app/en/harness) has fed back in. If something is in that sequence, the model can use it; if it isn't, the model doesn't know it exists — not your codebase, not the file you edited yesterday, not the instruction you gave three sessions ago. Anything outside the window has to be brought in, usually via a [tool call](https://ai9k.vercel.app/en/tool-call), before it can affect anything.\n\nFinite means it fills up. Every turn appends more — your messages, the model's responses, tool results — and a long [session](https://ai9k.vercel.app/en/session) will eventually hit the limit, forcing [compaction](https://ai9k.vercel.app/en/compaction) or [clearing](https://ai9k.vercel.app/en/clearing). It also means everything in the window competes: each token you load is one less available for the rest, and content you didn't need still occupies the model's [attention](https://ai9k.vercel.app/en/attention-budget). The practical stance is to treat the window as a budget — load what the task needs, leave the rest out.\n\n_Avoid:_ \"memory\" — the context window is working state and doesn't persist across sessions. [Memory](https://ai9k.vercel.app/en/memory-system) is a separate concept layered on top.","usage":"\"Can I just paste the whole monorepo into the prompt?\"\n\n\"The context window's 200k tokens — that's maybe a fifth of the repo. Pick the files the task touches, leave the rest behind a tool call.\"","translated":true}}},{"slug":"stateful","term":"Stateful","section":2,"position":20,"links":["session","turn","context","smart-zone","agent","memory-system","environment","model","harness","stateless","parameters","tool-result","agentsmd","handoff-artifact","clearing"],"text":{"vi":{"name":"Có lưu trạng thái","description":"Mang thông tin sang lần sau. Phiên có lưu trạng thái qua các lượt; agent có thể lưu trạng thái qua các phiên nhờ hệ thống bộ nhớ.","body":"Mang thông tin sang lần sau. Một [phiên](https://ai9k.vercel.app/session) có lưu trạng thái qua các [lượt](https://ai9k.vercel.app/turn): [ngữ cảnh](https://ai9k.vercel.app/context) tích luỹ dần khi phiên chạy, và đó là lý do phiên dài trôi dần vào [vùng đần](https://ai9k.vercel.app/smart-zone). Một [agent](https://ai9k.vercel.app/agent) có thể được làm cho có lưu trạng thái qua các **phiên** bằng cách thêm một [hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system), thứ ghi thông tin xuống [môi trường](https://ai9k.vercel.app/environment) và nạp lại khi các phiên sau bắt đầu. [Mô hình](https://ai9k.vercel.app/model) thì không bao giờ lưu trạng thái; mọi sự liên tục trông thấy được đều là [harness](https://ai9k.vercel.app/harness) nạp lại ngữ cảnh. Đối lập với [không lưu trạng thái](https://ai9k.vercel.app/stateless).\n\nTrạng thái nằm ở đâu trong từng tầng:\n\n| Tầng       | Có lưu trạng thái? | Bằng cách nào                                                                                                         |\n| ---------- | ------------------ | --------------------------------------------------------------------------------------------------------------------- |\n| Mô hình    | Không bao giờ      | [Tham số](https://ai9k.vercel.app/parameters) bị đóng băng; nó chỉ thấy những gì có trong từng yêu cầu                                   |\n| Phiên      | Qua các lượt       | Harness nối mọi tin nhắn và [kết quả công cụ](https://ai9k.vercel.app/tool-result) vào ngữ cảnh                                        |\n| Harness    | Qua các phiên      | Tệp bộ nhớ, [AGENTS.md](https://ai9k.vercel.app/agentsmd), [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact): được ghi ra rồi nạp lại về sau |\n| Môi trường | Luôn luôn          | Tệp vẫn tồn tại dù có phiên nào đang chạy hay không                                                                   |\n\nKhả năng lưu trạng thái của mỗi tầng được dựng nên bằng cách đọc lại thứ được lưu ở tầng dưới nó: phiên có cảm giác liên tục vì harness gửi lại lịch sử tin nhắn cho mô hình không lưu trạng thái, và agent nhớ được qua các phiên vì harness nạp lại các tệp từ môi trường. Không có trạng thái nào được lưu trong chính mô hình.\n\nKhông phải lúc nào cũng nên có trạng thái. Mọi thứ được mang theo đều ảnh hưởng tới những gì đến sau, nên một giả định sai ở đầu phiên cũng được mang theo. [Xoá ngữ cảnh](https://ai9k.vercel.app/clearing) là hành động có chủ ý: bỏ trạng thái của phiên đi và bắt đầu lại từ những gì đã được ghi ra.","usage":"\"Nó nhớ các tuỳ chọn của mình từ hôm qua. Vậy là mô hình đã học được chúng à?\"\n\n\"Không, agent có lưu trạng thái vì harness đã ghi chúng vào một tệp bộ nhớ và nạp lại lúc bắt đầu phiên. Bản thân mô hình không thấy gì của hôm qua cả.\"","translated":true},"en":{"description":"Carries information forward. Sessions are stateful across turns; agents can be made stateful across sessions via a memory system.","body":"Carries information forward. A [session](https://ai9k.vercel.app/en/session) is stateful across [turns](https://ai9k.vercel.app/en/turn) — [context](https://ai9k.vercel.app/en/context) accumulates as the session runs, which is why long sessions drift into the [dumb zone](https://ai9k.vercel.app/en/smart-zone). An [agent](https://ai9k.vercel.app/en/agent) can be made stateful across **sessions** by adding a [memory system](https://ai9k.vercel.app/en/memory-system) that persists information into the [environment](https://ai9k.vercel.app/en/environment) and reloads it at the start of future sessions. The [model](https://ai9k.vercel.app/en/model) is never stateful; any apparent continuity is the [harness](https://ai9k.vercel.app/en/harness) re-feeding context. Counterpart to [stateless](https://ai9k.vercel.app/en/stateless).\n\nWhere state lives at each layer:\n\n| Layer       | Stateful?       | How                                                                                                                    |\n| ----------- | --------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| Model       | Never           | [Parameters](https://ai9k.vercel.app/en/parameters) are frozen; it sees only what's in each request                                          |\n| Session     | Across turns    | The harness appends every message and [tool result](https://ai9k.vercel.app/en/tool-result) to the context                                 |\n| Harness     | Across sessions | Memory files, [AGENTS.md](https://ai9k.vercel.app/en/agentsmd), [handoff artifacts](https://ai9k.vercel.app/en/handoff-artifact) — written down, reloaded later |\n| Environment | Always          | Files persist whether or not any session is running                                                                    |\n\nEach layer's statefulness is built by re-reading something stored a layer below: the session feels continuous because the harness re-sends the message history to the stateless model, and the agent remembers across sessions because the harness re-loads files from the environment. No state is ever stored in the model itself.\n\nState isn't always wanted. Everything carried forward influences what comes next, so a wrong assumption made early in a session is carried forward too. [Clearing](https://ai9k.vercel.app/en/clearing) is the deliberate act of throwing session state away and starting from what's written down.","usage":"\"It remembered my preferences from yesterday — does that mean the model learned them?\"\n\n\"No, the agent's stateful because the harness wrote them to a memory file and reloaded them at session start. The model itself saw nothing of yesterday.\"","translated":true}}},{"slug":"agent","term":"Agent","section":2,"position":21,"links":["model","harness","tool","system-prompt","context-window","turn","parameters","ai"],"text":{"vi":{"description":"Một mô hình đặt trong harness với công cụ, system prompt và cửa sổ ngữ cảnh, trao đổi theo lượt với người dùng. Mô hình khi vận hành.","body":"Một [mô hình](https://ai9k.vercel.app/model) đặt trong [harness](https://ai9k.vercel.app/harness) với [công cụ](https://ai9k.vercel.app/tool), [system prompt](https://ai9k.vercel.app/system-prompt) và [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window), trao đổi theo [lượt](https://ai9k.vercel.app/turn) với người dùng. _Claude Code là một agent. Cursor là một agent. Claude.ai là một agent._ Agent là thứ bạn thực sự nói chuyện cùng: đó là mô hình khi vận hành, được cấu hình cho một mục đích.\n\nKhác với phần lớn thuật ngữ trong từ điển này, \"agent\" không gọi tên một bộ phận cơ học. Mô hình là một tệp [tham số](https://ai9k.vercel.app/parameters); harness là phần mềm bạn có thể chỉ vào. Agent không phải cái nào trong hai thứ đó. Nó là đơn vị bạn đang nói chuyện cùng. Người ta nhân cách hoá [AI](https://ai9k.vercel.app/ai) liên tục, và agent chính là đơn vị được nhân cách hoá: thứ bạn giao việc, thứ đọc tin nhắn của bạn và trả lời, chữ \"nó\" trong câu \"nó lại làm hỏng build rồi\". Khi bạn nói agent đã làm gì đó, ý bạn là mô hình cộng harness đã làm, nhưng bạn đang gọi cả tổ hợp ấy như một tác nhân duy nhất.\n\nÝ tưởng này có trước làn sóng AI hiện nay. Software agent, tức chương trình mà bạn giao cho một mục tiêu và nó hành động thay bạn, là khái niệm đã có từ khi có AI.\n\n_Nên tránh:_ \"con AI\", \"con bot\". Chúng quá mơ hồ, che mất việc bạn đang nói tới các tham số hay thứ đã được đặt trong harness.","usage":"\"Bạn đang dùng agent nào cho đợt migration?\"\n\n\"Claude Code ở máy, Cursor cho phần giao diện. Bên dưới là cùng một mô hình, chỉ khác harness.\"","translated":true},"en":{"description":"A model harnessed with tools, a system prompt, and a context window, that takes turns with a user. The model in motion.","body":"A [model](https://ai9k.vercel.app/en/model) [harnessed](https://ai9k.vercel.app/en/harness) with [tools](https://ai9k.vercel.app/en/tool), a [system prompt](https://ai9k.vercel.app/en/system-prompt), and a [context window](https://ai9k.vercel.app/en/context-window), that takes [turns](https://ai9k.vercel.app/en/turn) with a user. _Claude Code is an agent. Cursor is an agent. Claude.ai is an agent._ An agent is what you actually talk to — it's the model in motion, configured for a purpose.\n\nUnlike most terms in this dictionary, \"agent\" doesn't name a mechanical part. The model is a file of [parameters](https://ai9k.vercel.app/en/parameters); the harness is software you can point at. The agent is neither — it's the unit you're speaking to. People anthropomorphize [AI](https://ai9k.vercel.app/en/ai) constantly, and the agent is the anthropomorphized unit: the thing you delegate to, the thing that reads your message and answers, the \"it\" in \"it broke the build again\". When you say the agent did something, you mean the model-plus-harness did it, but you're addressing the combination as a single actor.\n\nThe idea is older than this wave of AI. Software agents — programs you delegate a goal to, which act on your behalf — have been a concept for as long as AI has.\n\n_Avoid:_ \"the AI\", \"the bot\" (too vague — they hide whether you mean the parameters or the harnessed thing).","usage":"\"Which agent are you using for the migration?\"\n\n\"Claude Code locally, Cursor for the UI work — same model underneath, different harnesses.\"","translated":true}}},{"slug":"system-prompt","term":"System prompt","section":2,"position":22,"links":["harness","model-provider-request","agent","tool","session","token","input-tokens","turn","agentsmd","model","prefix-cache"],"text":{"vi":{"description":"Các chỉ dẫn harness đặt vào đầu mỗi yêu cầu tới nhà cung cấp mô hình, là bản chỉ thị thường trực của agent. Thường giữ nguyên suốt phiên.","body":"Các chỉ dẫn mà [harness](https://ai9k.vercel.app/harness) đặt vào đầu mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request). Đây là bản chỉ thị thường trực của [agent](https://ai9k.vercel.app/agent): nó là ai, hành xử thế nào, được gọi những [công cụ](https://ai9k.vercel.app/tool) nào, theo quy ước gì. Thường giữ nguyên suốt một [phiên](https://ai9k.vercel.app/session).\n\nSystem prompt do hãng làm harness viết, không phải bạn, và trong các harness lập trình thì nó lớn: thường hàng chục nghìn [token](https://ai9k.vercel.app/token) gồm quy tắc hành xử, mô tả công cụ và cách xử lý tình huống biên, tất cả đều được trả tiền như [token đầu vào](https://ai9k.vercel.app/input-tokens) ở mỗi [lượt](https://ai9k.vercel.app/turn). Các chỉ dẫn thường trực của riêng bạn đi kèm với nó: những tệp như [AGENTS.md](https://ai9k.vercel.app/agentsmd) được nạp cạnh system prompt lúc bắt đầu phiên, nên [mô hình](https://ai9k.vercel.app/model) đọc chỉ thị của hãng và của bạn cùng nhau trước khi thấy tin nhắn của bạn.\n\nVì giống hệt nhau ở mọi yêu cầu, nó tạo thành phần mở đầu của [bộ đệm tiền tố](https://ai9k.vercel.app/prefix-cache). Đó là một phần lý do harness giữ nó cố định suốt phiên thay vì sửa dần trong lúc chạy.\n\nMô hình được huấn luyện để ưu tiên system prompt hơn tin nhắn người dùng. Vì vậy khi agent khăng khăng theo một quy ước bạn chưa từng yêu cầu, hoặc định dạng đầu ra theo kiểu bạn không sao bỏ được, thường là nó đang tuân theo system prompt, và tin nhắn của bạn đang thua trong cuộc tranh luận đó. Một số harness cho phép tuỳ biến: chúng cho bạn toàn quyền truy cập system prompt, để bạn đọc được agent thực sự đang được dặn gì và thay đổi nó.","usage":"\"Hai harness, cùng một mô hình, mà hành xử khác hẳn với cùng một prompt.\"\n\n\"System prompt khác nhau. Một cái được tinh chỉnh để sửa mã ngắn gọn, cái kia để giải thích. Sự khác biệt nằm ở đó, trước cả khi tin nhắn của bạn tới.\"","translated":true},"en":{"description":"The instructions the harness prepends to every model provider request — the agent's standing brief. Usually stable across a session.","body":"The instructions the [harness](https://ai9k.vercel.app/en/harness) prepends to every [model provider request](https://ai9k.vercel.app/en/model-provider-request) — the [agent](https://ai9k.vercel.app/en/agent)'s standing brief: who it is, how to behave, which [tools](https://ai9k.vercel.app/en/tool) it can call, what conventions to follow. Usually stable across a [session](https://ai9k.vercel.app/en/session).\n\nThe system prompt is written by the harness vendor, not by you, and in coding harnesses it's big — often tens of thousands of [tokens](https://ai9k.vercel.app/en/token) of behavioural rules, tool descriptions, and edge-case handling, all paid as [input tokens](https://ai9k.vercel.app/en/input-tokens) on every [turn](https://ai9k.vercel.app/en/turn). Your own standing instructions ride along with it: files like [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) are loaded next to the system prompt at the start of the session, so the [model](https://ai9k.vercel.app/en/model) reads the vendor's brief and yours together before it ever sees your message.\n\nBecause it's identical on every request, it forms the start of the [prefix cache](https://ai9k.vercel.app/en/prefix-cache) — which is part of why harnesses keep it fixed for a whole session rather than editing it as they go.\n\nModels are trained to prioritise the system prompt over user messages. So when an agent insists on a convention you never asked for, or formats output in a way you can't shake, it's usually obeying its system prompt — and your message is losing the argument. Some harnesses are customisable: they give you full access to the system prompt, so you can read what the agent is actually being told and change it.","usage":"\"Two harnesses, same model, totally different behavior on the same prompt.\"\n\n\"Different system prompts. One's tuned for terse code edits, the other for explaining — that's where the divergence lives, before your message even arrives.\"","translated":true}}},{"slug":"session","term":"Session","section":2,"position":23,"links":["agent","tool-result","clearing","compaction","context-window","model","stateless","model-provider-request","filesystem","handoff","memory-system","agentsmd","turn"],"text":{"vi":{"name":"Phiên","description":"Một đợt tương tác có giới hạn với agent. Bắt đầu trống, tích luỹ dần, kết thúc khi bị xoá, đóng, hoặc được nén thành một phiên mới.","body":"Một đợt tương tác có giới hạn với một [agent](https://ai9k.vercel.app/agent). Nó bắt đầu trống, tích luỹ tin nhắn, [kết quả công cụ](https://ai9k.vercel.app/tool-result) và các tệp đã đọc, rồi kết thúc khi bị [xoá](https://ai9k.vercel.app/clearing), bị đóng, hoặc được [nén](https://ai9k.vercel.app/compaction) thành một phiên mới. Phiên là thứ _lấp đầy_ [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window): nếu cửa sổ ngữ cảnh là cái hộp thì phiên là những thứ đang từ từ làm đầy nó. Công việc quá lớn cho một cửa sổ ngữ cảnh phải được chia ra nhiều phiên.\n\nLịch sử tin nhắn của phiên là bộ nhớ làm việc của agent. [Mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên mọi thứ nó có vẻ nhớ, như bạn đã yêu cầu gì, test báo gì, ba lượt trước nó quyết định gì, đều nằm trong lịch sử tin nhắn và được gửi lại ở mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request). Thứ gì không có trong phiên thì không tồn tại đối với agent.\n\nBộ nhớ đó kết thúc cùng với phiên. Phiên mới bắt đầu từ con số không: agent hiểu rõ codebase của bạn vào cuối phiên hôm qua thì sáng nay không biết gì về nó. Thứ còn lại là [hệ thống tệp](https://ai9k.vercel.app/filesystem). Tệp được ghi trong phiên này có thể được phiên sau đọc, và đó là thứ mà [bàn giao](https://ai9k.vercel.app/handoff), [hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system) và [AGENTS.md](https://ai9k.vercel.app/agentsmd) dựa vào.\n\nBạn là người chọn nơi phiên kết thúc. Mọi thứ trong phiên đều ảnh hưởng tới mọi [lượt](https://ai9k.vercel.app/turn) về sau, nên các việc không liên quan làm chung một phiên sẽ để lại dư âm làm lệch câu trả lời kế tiếp. Mỗi phiên một việc giúp ngữ cảnh luôn liên quan; làm xong một việc là thời điểm tự nhiên để xoá ngữ cảnh.","usage":"\"Một phiên chạy được bao lâu thì bắt đầu rệu rã?\"\n\n\"Tuỳ việc. Một đợt refactor tập trung giữ được sự sắc bén lâu hơn một đợt nghiên cứu mở. Khi phiên đã phình to thì bàn giao hoặc nén lại, đừng cố chạy tiếp.\"","translated":true},"en":{"description":"One bounded run of interaction with an agent. Starts empty, accumulates, ends when cleared, closed, or compacted into a fresh session.","body":"One bounded run of interaction with an [agent](https://ai9k.vercel.app/en/agent). Starts empty, accumulates messages, [tool results](https://ai9k.vercel.app/en/tool-result), and files read, and ends when [cleared](https://ai9k.vercel.app/en/clearing), closed, or [compacted](https://ai9k.vercel.app/en/compaction) into a fresh session. The session is what _fills_ the [context window](https://ai9k.vercel.app/en/context-window): if the context window is the box, the session is the stuff slowly filling it up. Work too large for a single context window must be split across sessions.\n\nThe session's message history is the agent's working memory. The [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless), so everything it appears to remember — what you asked for, what the tests said, what it decided three turns ago — is in the message history, re-sent with every [model provider request](https://ai9k.vercel.app/en/model-provider-request). Whatever isn't in the session doesn't exist for the agent.\n\nThat memory ends with the session. A new session starts from nothing: the agent that knew your codebase well at the end of yesterday's session knows none of it this morning. What survives is the [filesystem](https://ai9k.vercel.app/en/filesystem) — files written during one session can be read by the next, which is what [handoffs](https://ai9k.vercel.app/en/handoff), [memory systems](https://ai9k.vercel.app/en/memory-system), and [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) rely on.\n\nYou choose where a session ends. Everything in a session influences every later [turn](https://ai9k.vercel.app/en/turn), so unrelated tasks done in one session leave residue that colours the next answer. One task per session keeps the context relevant; finishing a task is a natural point to clear.","usage":"\"How long can one session run before it falls apart?\"\n\n\"Depends on the work — a focused refactor stays sharp longer than open-ended research. Once the session bloats, hand off or compact, don't push through.\"","translated":true}}},{"slug":"turn","term":"Turn","section":2,"position":24,"links":["agent","model-provider-request","tool","session","afk","harness","tool-call"],"text":{"vi":{"name":"Lượt","description":"Một tin nhắn của người dùng cộng mọi việc agent làm để đáp lại, cho tới khi trả quyền về người dùng. Gồm một hoặc nhiều yêu cầu.","body":"Một tin nhắn của người dùng cộng với mọi việc [agent](https://ai9k.vercel.app/agent) làm để đáp lại, cho tới khi nó trả quyền về cho người dùng. Một lượt gồm một hoặc nhiều [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request), và sẽ là nhiều nếu agent gọi [công cụ](https://ai9k.vercel.app/tool). Một câu hỏi làm rõ sẽ khép lượt lại; câu trả lời của bạn mở lượt kế tiếp. Thứ bậc là [phiên](https://ai9k.vercel.app/session) **> Lượt > Yêu cầu tới nhà cung cấp mô hình**.\n\nLượt đáng được đặt tên vì độ dài của nó do agent quyết định, không phải bạn. Bạn đưa một tin nhắn; agent quyết định nối bao nhiêu lệnh gọi công cụ trước khi trả quyền. Một lượt có thể là câu trả lời một câu, hoặc hai mươi phút đọc, sửa và chạy test. Đó là cùng một đặc tính nhìn từ hai phía: lượt dài là thứ giúp làm việc kiểu [AFK](https://ai9k.vercel.app/afk) khả thi, và lượt dài cũng là nơi mọi thứ đi sai khi không ai giám sát. Tới lúc agent trả quyền, có thể nó đã trôi rất xa khỏi ý bạn.\n\nLượt cũng là đơn vị tự nhiên để điều hướng. Mọi thứ bên trong một lượt diễn ra mà không có bạn; khoảng giữa các lượt là nơi bạn chỉnh hướng. Phần lớn [harness](https://ai9k.vercel.app/harness) làm mềm điều này: bạn có thể ngắt giữa lượt để dừng agent và chỉnh hướng nó, hoặc gõ tin nhắn trong lúc nó làm việc, và tin nhắn đó được đọc khi lượt kết thúc. Nếu bạn nhiều lần không hài lòng với nơi các lượt kết thúc, cách xử lý thường là yêu cầu lượt nhỏ hơn: lập kế hoạch trước, mỗi lần một bước. Bạn đổi sự tự chủ của agent lấy nhiều khoảng trống hơn để điều hướng.","usage":"\"Một lượt mà mất hai phút?\"\n\n\"Trong lượt đó nó thực hiện mười bốn [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call), mỗi lệnh là một yêu cầu tới nhà cung cấp mô hình riêng. Độ trễ cộng dồn lại trước khi agent trả quyền về cho bạn.\"","translated":true},"en":{"description":"One user message plus everything the agent does in response, up until it yields back to the user. Contains one or more provider requests.","body":"One user message plus everything the [agent](https://ai9k.vercel.app/en/agent) does in response, up until it yields back to the user. Contains one or more [model provider requests](https://ai9k.vercel.app/en/model-provider-request) — many, if the agent calls [tools](https://ai9k.vercel.app/en/tool). A clarifying question closes the turn; your reply opens the next one. The hierarchy is [session](https://ai9k.vercel.app/en/session) **> Turn > Model provider request**.\n\nWhat makes the turn worth naming is that its length is the agent's decision, not yours. You hand over one message; the agent decides how many tool calls to chain before yielding. A turn can be a one-sentence answer or twenty minutes of reading, editing, and running tests. That's the same property from two angles: long turns are what make [AFK](https://ai9k.vercel.app/en/afk) work possible, and long turns are also where things go wrong unsupervised — by the time the agent yields, it may have drifted a long way from what you meant.\n\nThe turn is also the natural unit for steering. Everything inside a turn happens without you; the gaps between turns are where you redirect. Most [harnesses](https://ai9k.vercel.app/en/harness) soften this: you can interrupt mid-turn to stop the agent and redirect it, or type a message while it works, which gets read once the turn completes. If you find yourself repeatedly unhappy with where turns end up, the fix is usually to ask for smaller ones — a plan first, one step at a time — trading autonomy for more frequent gaps to steer in.","usage":"\"One turn took two minutes?\"\n\n\"It made fourteen [tool calls](https://ai9k.vercel.app/en/tool-call) inside that turn — each one is a separate model provider request. Latency stacks up before the agent finally yields back to you.\"","translated":true}}},{"slug":"environment","term":"Environment","section":3,"position":25,"links":["agent","harness","tool-result","tool-call","agentsmd","context-window","filesystem","stateful","session","memory-system","handoff-artifact","sandbox","tool","ax"],"text":{"vi":{"name":"Môi trường","description":"Thế giới mà agent tác động lên: mọi thứ nằm ngoài harness mà agent nhận biết qua kết quả công cụ và thay đổi qua lệnh gọi công cụ.","body":"Thế giới mà [agent](https://ai9k.vercel.app/agent) tác động lên: mọi thứ nằm ngoài [harness](https://ai9k.vercel.app/harness) mà agent nhận biết qua [kết quả công cụ](https://ai9k.vercel.app/tool-result) và thay đổi qua [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call). Harness _chạy_ agent; môi trường là nơi agent _làm việc_. Một tệp như [`AGENTS.md`](https://ai9k.vercel.app/agentsmd) nằm trong môi trường; harness là thứ nạp nó vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window). [Hệ thống tệp](https://ai9k.vercel.app/filesystem) là loại môi trường phổ biến nhất, nhưng không phải duy nhất (một cơ sở dữ liệu, một API từ xa, một phiên trình duyệt đều có thể là môi trường).\n\nAgent chỉ thấy môi trường khi nó nhìn. Mọi điều nó biết về môi trường đều đến qua một kết quả công cụ, nên bức tranh của nó là một tập ảnh chụp, mỗi ảnh đúng tại thời điểm chụp. Nếu một tệp thay đổi sau khi agent đọc, vì bạn sửa tay hoặc một bước build sinh lại nó, agent vẫn suy luận từ bản cũ cho tới khi có gì đó khiến nó đọc lại. Một agent tự tin mô tả một tệp vốn không còn trông như vậy thường là trường hợp này: môi trường đã đổi, ảnh chụp thì chưa.\n\nMôi trường cũng là tầng tồn tại lâu dài, tầng duy nhất luôn [có lưu trạng thái](https://ai9k.vercel.app/stateful). Ngữ cảnh của một [phiên](https://ai9k.vercel.app/session) mất đi khi phiên kết thúc, nhưng các tệp đã ghi vào môi trường vẫn còn đó để phiên sau đọc. [Hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system), [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) và `AGENTS.md` đều dựa vào điều này. Bất cứ điều gì agent cần còn biết vào ngày mai đều phải được đưa vào môi trường.\n\nBạn quyết định môi trường lớn tới đâu. Một [sandbox](https://ai9k.vercel.app/sandbox) thu hẹp nó, giới hạn những gì agent với tới được; thêm một [công cụ](https://ai9k.vercel.app/tool) thì mở rộng nó, đưa một cơ sở dữ liệu hay một API vào tầm với. Những gì nằm trong ranh giới là thứ agent nhận biết và thay đổi được; mọi thứ bên ngoài không tồn tại đối với agent. Mức độ môi trường được sắp đặt tốt để hỗ trợ công việc của agent chính là [AX](https://ai9k.vercel.app/ax) của codebase.\n\n_Nên tránh:_ dùng \"môi trường\" để chỉ runtime hoặc chính harness. Harness là lớp vỏ bọc, môi trường là không gian làm việc.","usage":"\"Agent không thấy được schema của DB staging.\"\n\n\"Nối nó vào môi trường: cho agent một công cụ `psql` giới hạn chỉ đọc trên staging. Harness thì ổn, chỉ là nó chưa có gì để tác động lên.\"","translated":true},"en":{"description":"The world the agent acts on — anything outside the harness that the agent perceives via tool results and changes via tool calls.","body":"The world the [agent](https://ai9k.vercel.app/en/agent) acts on — anything outside the [harness](https://ai9k.vercel.app/en/harness) that the agent perceives through [tool results](https://ai9k.vercel.app/en/tool-result) and changes through [tool calls](https://ai9k.vercel.app/en/tool-call). The harness _runs_ the agent; the environment is what the agent _works in_. A file like [`AGENTS.md`](https://ai9k.vercel.app/en/agentsmd) lives in the environment; the harness is what loads it into the [context window](https://ai9k.vercel.app/en/context-window). A [filesystem](https://ai9k.vercel.app/en/filesystem) is the most common kind of environment, but not the only one (a database, a remote API, a browser session can all be environments).\n\nThe agent only sees the environment when it looks. Everything it knows about the environment arrived through a tool result, so its picture is a collection of snapshots, each accurate at the moment it was taken. If a file changes after the agent read it — you edit it by hand, a build step regenerates it — the agent keeps reasoning from the stale copy until something prompts a re-read. An agent confidently describing a file that no longer looks like that is usually this: the environment moved, the snapshot didn't.\n\nThe environment is also the layer that persists — the only one that is always [stateful](https://ai9k.vercel.app/en/stateful). A [session](https://ai9k.vercel.app/en/session)'s context is gone when the session ends, but files written to the environment remain for the next session to read — which is what [memory systems](https://ai9k.vercel.app/en/memory-system), [handoff artifacts](https://ai9k.vercel.app/en/handoff-artifact), and `AGENTS.md` rely on. Anything an agent should still know tomorrow has to end up in the environment.\n\nYou decide how big the environment is. A [sandbox](https://ai9k.vercel.app/en/sandbox) shrinks it, limiting what the agent can reach; adding a [tool](https://ai9k.vercel.app/en/tool) extends it, bringing a database or an API into reach. What's inside the boundary is what the agent can perceive and change; everything outside it doesn't exist for the agent. How well the environment is set up to support the agent's work is the codebase's [AX](https://ai9k.vercel.app/en/ax).\n\n_Avoid:_ using \"environment\" for the runtime or the harness itself — the harness is the wrapper, the environment is the workspace.","usage":"\"The agent can't see the staging DB schema.\"\n\n\"Wire it into the environment — give it a `psql` tool scoped to read-only on staging. The harness is fine, it just has nothing to act on.\"","translated":true}}},{"slug":"filesystem","term":"Filesystem","section":3,"position":26,"links":["agent","environment","agentsmd","skill","tool","harness","tool-call","context-window","context-pointer","sandbox"],"text":{"vi":{"name":"Hệ thống tệp","description":"Cây tệp và thư mục mà agent đọc, ghi và chạy lệnh trong đó. Đây là môi trường mặc định của một agent lập trình.","body":"Cây tệp và thư mục mà [agent](https://ai9k.vercel.app/agent) đọc, ghi và chạy lệnh trong đó. Đây là loại [môi trường](https://ai9k.vercel.app/environment) mặc định của một agent lập trình. [AGENTS.md](https://ai9k.vercel.app/agentsmd), các [skill](https://ai9k.vercel.app/skill), mã nguồn, script build và cấu hình [công cụ](https://ai9k.vercel.app/tool) đều nằm trong một hệ thống tệp. Khi một [harness](https://ai9k.vercel.app/harness) \"khởi động trong dự án của bạn\", nó đang trỏ agent vào một hệ thống tệp.\n\nAgent chỉ chạm tới nó qua [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call): đọc một tệp, ghi một tệp, chạy một lệnh shell. Không có gì trên đĩa nằm trong [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) cho tới khi một lệnh gọi công cụ nạp nó vào. Nhờ vậy agent làm việc được trong một kho mã lớn hơn cửa sổ rất nhiều: hệ thống tệp chứa mọi thứ, ngữ cảnh chỉ chứa những gì việc hiện tại đã đọc. Một số harness mặc định nạp tên các tệp trong thư mục hiện tại vào cửa sổ ngữ cảnh, chỉ cây thư mục chứ không phải nội dung. Chúng đóng vai trò [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer): agent thấy có những gì và đọc các tệp nó cần.\n\nVà nó được dùng chung với bạn. Các tệp agent sửa chính là các tệp bạn mở trong trình soạn thảo và xem diff trong git. Hệ thống tệp là không gian làm việc chung, nơi bạn xem lại những gì agent đã làm.","usage":"\"Sao nó không nhận AGENTS.md của mình?\"\n\n\"Nó đang chạy trên một hệ thống tệp khác. [Sandbox](https://ai9k.vercel.app/sandbox) đã mount thư mục cha chứ không phải thư mục gốc của dự án. Trỏ lại harness đi.\"","translated":true},"en":{"description":"A tree of files and directories the agent reads from, writes to, and executes within — the default environment for a coding agent.","body":"A tree of files and directories the [agent](https://ai9k.vercel.app/en/agent) reads from, writes to, and executes within — the default kind of [environment](https://ai9k.vercel.app/en/environment) for a coding agent. [AGENTS.md](https://ai9k.vercel.app/en/agentsmd), [skills](https://ai9k.vercel.app/en/skill), source code, build scripts, and [tool](https://ai9k.vercel.app/en/tool) configs all live in a filesystem. When a [harness](https://ai9k.vercel.app/en/harness) \"starts in your project,\" it's pointing the agent at a filesystem.\n\nThe agent touches it only through [tool calls](https://ai9k.vercel.app/en/tool-call) — reading a file, writing one, running a shell command. Nothing on disk is in the [context window](https://ai9k.vercel.app/en/context-window) until a tool call loads it, which is what lets the agent work in a repository far larger than the window: the filesystem holds everything, the context holds only what the current task has read. Some harnesses do load the current directory's filenames into the context window by default — not the contents, just the tree — which act as [context pointers](https://ai9k.vercel.app/en/context-pointer): the agent sees what exists and reads the files it needs.\n\nAnd it's shared with you. The files the agent edits are the same ones you open in your editor and diff in git — the filesystem is the common workspace where you review what the agent did.","usage":"\"Why isn't it picking up my AGENTS.md?\"\n\n\"It's running against a different filesystem — the [sandbox](https://ai9k.vercel.app/en/sandbox) mounted the parent dir, not the project root. Repoint the harness.\"","translated":true}}},{"slug":"tool","term":"Tool","section":3,"position":27,"links":["harness","agent","environment","tool-result","tool-call","model-provider-request","filesystem","model","token","mcp","context"],"text":{"vi":{"name":"Công cụ","description":"Một hàm harness đưa ra cho agent gọi: Read, Write, Bash, Search. Đây là cách agent nhận biết và tác động lên môi trường.","body":"Một hàm mà [harness](https://ai9k.vercel.app/harness) đưa ra cho [agent](https://ai9k.vercel.app/agent) gọi: Read, Write, Bash, Search. Công cụ là cách agent nhận biết và tác động lên [môi trường](https://ai9k.vercel.app/environment): nó không thấy được môi trường nếu không qua [kết quả công cụ](https://ai9k.vercel.app/tool-result), và không thay đổi được môi trường nếu không qua [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call). Mỗi lệnh gọi công cụ tốn thêm một [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request), vì kết quả phải quay về mô hình thì nó mới quyết định được bước tiếp theo.\n\nCác công cụ mà phần lớn agent lập trình có sẵn:\n\n| Công cụ | Nó làm gì                                                     |\n| ------- | ------------------------------------------------------------- |\n| Read    | Trả về nội dung một tệp dưới dạng kết quả công cụ             |\n| Write   | Tạo hoặc sửa một tệp trong [hệ thống tệp](https://ai9k.vercel.app/filesystem)    |\n| Bash    | Chạy một lệnh shell và trả về đầu ra                          |\n| Search  | Tìm các tệp hoặc đoạn văn bản khớp một mẫu trên toàn codebase |\n\nMột công cụ được định nghĩa bởi ba thứ: tên, mô tả nó làm gì, và schema cho các tham số. Harness gửi các định nghĩa này cho [mô hình](https://ai9k.vercel.app/model) ở mọi yêu cầu, và mô hình chọn công cụ theo đúng cách nó tạo ra mọi thứ khác: viết [token](https://ai9k.vercel.app/token), ở đây là một lệnh gọi có cấu trúc kèm đối số. Mô hình không bao giờ tự thực thi gì; harness đọc lệnh gọi, chạy hàm, rồi gửi kết quả về.\n\nDanh sách công cụ quy định agent làm được gì. Một mô hình giỏi với bộ công cụ hẹp là một agent hẹp: nó sẽ dồn mọi việc qua bất cứ thứ gì nó có. Đó là lý do agent dựa rất nhiều vào Bash, vì shell là một công cụ với tới được gần hết hệ thống. Để cho agent một năng lực một cách gọn gàng, hãy thêm công cụ cho việc đó; [MCP](https://ai9k.vercel.app/mcp) là chuẩn để cắm công cụ từ bên ngoài harness vào.\n\nĐịnh nghĩa công cụ chiếm [ngữ cảnh](https://ai9k.vercel.app/context) ở mọi yêu cầu, nên một bộ công cụ lớn có chi phí thường trực trước khi bất kỳ công cụ nào được gọi. Nhiều công cụ có mô tả na ná nhau cũng khiến mô hình chọn đúng công cụ kém hơn.","usage":"\"Agent có truy vấn thẳng staging được không?\"\n\n\"Thêm một công cụ `psql` vào harness, giới hạn chỉ đọc trên staging. Không có công cụ cho việc đó thì agent mù với mọi thứ ngoài hệ thống tệp.\"","translated":true},"en":{"description":"A function the harness exposes for the agent to call — Read, Write, Bash, Search. How an agent perceives and acts on the environment.","body":"A function the [harness](https://ai9k.vercel.app/en/harness) exposes for the [agent](https://ai9k.vercel.app/en/agent) to call — Read, Write, Bash, Search. Tools are how an agent perceives and acts on the [environment](https://ai9k.vercel.app/en/environment): it can't see the environment except through [tool results](https://ai9k.vercel.app/en/tool-result), and can't change it except through [tool calls](https://ai9k.vercel.app/en/tool-call). Each tool call costs an extra [model provider request](https://ai9k.vercel.app/en/model-provider-request), since the result has to go back to the model before it can decide what to do next.\n\nTools most coding agents ship with:\n\n| Tool   | What it does                                                 |\n| ------ | ------------------------------------------------------------ |\n| Read   | Returns a file's contents as a tool result                   |\n| Write  | Creates or edits a file in the [filesystem](https://ai9k.vercel.app/en/filesystem) |\n| Bash   | Runs a shell command and returns its output                  |\n| Search | Finds files or text matching a pattern across the codebase   |\n\nA tool is defined by three things: a name, a description of what it does, and a schema for its parameters. The harness sends these definitions to the [model](https://ai9k.vercel.app/en/model) with every request, and the model chooses a tool the same way it produces everything else — by writing [tokens](https://ai9k.vercel.app/en/token), in this case a structured call with arguments. The model never executes anything itself; the harness reads the call, runs the function, and sends back the result.\n\nThe tool list sets what the agent can do. A capable model with a narrow tool set is a narrow agent: it will route everything through whatever it has, which is why agents lean so heavily on Bash — a shell is one tool that reaches most of the system. To give an agent a capability cleanly, add a tool for it; [MCP](https://ai9k.vercel.app/en/mcp) is the standard for plugging in tools from outside the harness.\n\nTool definitions occupy [context](https://ai9k.vercel.app/en/context) on every request, so a large tool set has a standing cost before any tool is called — and many similarly-described tools make the model worse at picking the right one.","usage":"\"Can the agent query staging directly?\"\n\n\"Add a `psql` tool to the harness, scoped read-only on staging. Without a tool for it, the agent's blind to anything outside the filesystem.\"","translated":true}}},{"slug":"tool-call","term":"Tool call","section":3,"position":28,"links":["model","tool","harness","model-provider-request","system-prompt","permission-mode","tool-result","turn","agent","next-token-prediction"],"text":{"vi":{"name":"Lệnh gọi công cụ","description":"Đầu ra của mô hình nêu tên một công cụ và các đối số, chỉ là văn bản có cấu trúc. Harness phải đọc nó và thực thi.","body":"Đầu ra của [mô hình](https://ai9k.vercel.app/model) nêu tên một [công cụ](https://ai9k.vercel.app/tool) và các đối số của nó, chỉ là văn bản có cấu trúc. Tự nó không làm được gì; [harness](https://ai9k.vercel.app/harness) phải đọc nó và thực thi. Mô hình tạo ra nó trong một [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request).\n\nVòng đời của một lệnh gọi công cụ:\n\n| Bước | Ai      | Điều gì xảy ra                                                                       |\n| ---- | ------- | ------------------------------------------------------------------------------------ |\n| 1    | Mô hình | Biết có những công cụ nào qua các mô tả trong [system prompt](https://ai9k.vercel.app/system-prompt)  |\n| 2    | Mô hình | Phát ra một lệnh gọi, gồm tên công cụ và đối số, thường là JSON, rồi dừng            |\n| 3    | Harness | Phân tích lệnh gọi và đối chiếu với [chế độ phân quyền](https://ai9k.vercel.app/permission-mode)      |\n| 4    | Harness | Thực thi nếu được phép                                                               |\n| 5    | Harness | Gửi kết quả về dưới dạng [kết quả công cụ](https://ai9k.vercel.app/tool-result) trong yêu cầu kế tiếp |\n\nMột [lượt](https://ai9k.vercel.app/turn) làm việc của [agent](https://ai9k.vercel.app/agent) thường là nhiều vòng đi về như vậy nối với nhau.\n\nVì lệnh gọi được sinh ra bằng [dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) như mọi thứ khác, nó có thể sai theo cách mọi đầu ra của mô hình có thể sai: một đường dẫn không tồn tại, một cờ mà lệnh không có, các đối số nghe hợp lý chứ không đúng. Harness thực thi cái đã được viết ra, không phải cái được định viết. Một đường dẫn gõ nhầm không báo lỗi nhẹ nhàng; nó sửa nhầm tệp.","usage":"\"Nó bảo đã chạy test nhưng thời gian sửa đổi của các tệp không hề thay đổi.\"\n\n\"Xem bản ghi phiên đi. Nó có thực sự phát ra lệnh gọi công cụ không, hay chỉ mô tả việc chạy test? Mô hình tạo ra lệnh gọi, nhưng nếu harness không thực thi thì chẳng có gì xảy ra cả.\"","translated":true},"en":{"description":"The model's output naming a tool and its arguments — just structured text. The harness has to read it and execute.","body":"The [model](https://ai9k.vercel.app/en/model)'s output naming a [tool](https://ai9k.vercel.app/en/tool) and its arguments — just structured text. It doesn't do anything on its own; the [harness](https://ai9k.vercel.app/en/harness) has to read it and execute. Produced by the model in one [model provider request](https://ai9k.vercel.app/en/model-provider-request).\n\nThe lifecycle of a tool call:\n\n| Step | Who     | What happens                                                                            |\n| ---- | ------- | --------------------------------------------------------------------------------------- |\n| 1    | Model   | Learns which tools exist from descriptions in the [system prompt](https://ai9k.vercel.app/en/system-prompt) |\n| 2    | Model   | Emits a call — tool name plus arguments, usually JSON — and stops                       |\n| 3    | Harness | Parses the call and checks it against the [permission mode](https://ai9k.vercel.app/en/permission-mode)     |\n| 4    | Harness | Executes it if allowed                                                                  |\n| 5    | Harness | Sends the outcome back as a [tool result](https://ai9k.vercel.app/en/tool-result) in the next request       |\n\nOne [turn](https://ai9k.vercel.app/en/turn) of [agent](https://ai9k.vercel.app/en/agent) work is usually many of these round trips chained together.\n\nBecause the call is generated by [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) like everything else, it can be wrong the way any model output can be wrong: a path that doesn't exist, a flag the command doesn't have, arguments that are plausible rather than correct. The harness executes what was written, not what was meant — a mistyped path doesn't error gracefully, it edits the wrong file.","usage":"\"It said it ran the tests but the file timestamps haven't changed.\"\n\n\"Look at the transcript — did it actually emit a tool call, or just describe running them? The model produces the call, but if the harness didn't execute it, nothing happened.\"","translated":true}}},{"slug":"tool-result","term":"Tool result","section":3,"position":29,"links":["harness","tool-call","agent","environment","model","model-provider-request","turn","context","session","token","context-window"],"text":{"vi":{"name":"Kết quả công cụ","description":"Thứ harness gửi về sau khi thực thi một lệnh gọi công cụ: nội dung tệp, đầu ra hoặc lỗi. Cách duy nhất để agent thấy môi trường.","body":"Thứ [harness](https://ai9k.vercel.app/harness) gửi về sau khi thực thi một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call): nội dung tệp, đầu ra của lệnh, thông báo lỗi. Đây là cách duy nhất để [agent](https://ai9k.vercel.app/agent) thấy [môi trường](https://ai9k.vercel.app/environment). Nó quay về [mô hình](https://ai9k.vercel.app/model) trong [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request) _kế tiếp_, nơi mô hình quyết định làm gì với nó. Lệnh gọi công cụ và kết quả công cụ là hai đầu của cùng một lần trao đổi, cả hai nằm trong một [lượt](https://ai9k.vercel.app/turn).\n\nVòng đời của một kết quả công cụ:\n\n| Bước | Ai      | Điều gì xảy ra                                                                       |\n| ---- | ------- | ------------------------------------------------------------------------------------ |\n| 1    | Harness | Thực thi lệnh gọi công cụ: chạy lệnh, đọc tệp                                        |\n| 2    | Harness | Ghi nhận kết quả: đầu ra, nội dung hoặc lỗi                                          |\n| 3    | Harness | Nối nó vào [ngữ cảnh](https://ai9k.vercel.app/context) như một tin nhắn                                 |\n| 4    | Harness | Gửi toàn bộ ngữ cảnh cho nhà cung cấp trong yêu cầu tới nhà cung cấp mô hình kế tiếp |\n| 5    | Mô hình | Đọc kết quả và quyết định: gọi thêm công cụ, hay đưa ra câu trả lời cuối             |\n\nKết quả nằm lại trong ngữ cảnh cho tới hết [phiên](https://ai9k.vercel.app/session). Kết quả công cụ thường chiếm phần lớn ngữ cảnh của một phiên lập trình: mỗi lần đọc tệp, chạy test, tìm kiếm đều được đưa vào đầy đủ và tiếp tục chiếm [token](https://ai9k.vercel.app/token) rất lâu sau khi hết hữu ích. Vài kết quả lớn, như một log test dài dòng hay một tệp sinh tự động được đọc nguyên, có thể đẩy phiên tới sát giới hạn [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) nhanh hơn chính cuộc trò chuyện.\n\nVì kết quả là tất cả những gì mô hình thấy, mô hình không có cách nào kiểm tra môi trường đằng sau nó. Nếu đầu ra bị cắt bớt, lệnh thất bại âm thầm, hoặc harness trả về lỗi thay vì nội dung, mô hình suy luận từ thứ nó nhận được. Khi hình dung của agent về hệ thống của bạn có vẻ sai, kết quả công cụ là nơi cần xem: ở đâu đó trong bản ghi phiên có một kết quả nói khác với điều bạn biết là đúng.","usage":"\"Nó đang suy luận về tệp đó như thể tệp trống.\"\n\n\"Kết quả công cụ trả về là một lần bị từ chối quyền, không phải nội dung. Mô hình chỉ thấy chuỗi báo lỗi. Nó không có cách nào khác để thấy tệp.\"","translated":true},"en":{"description":"What the harness sends back after executing a tool call — file contents, output, or error. The agent's only view of the environment.","body":"What the [harness](https://ai9k.vercel.app/en/harness) sends back after executing a [tool call](https://ai9k.vercel.app/en/tool-call) — the file contents, the command output, the error. The [agent](https://ai9k.vercel.app/en/agent)'s only view of the [environment](https://ai9k.vercel.app/en/environment). Travels back to the [model](https://ai9k.vercel.app/en/model) in the _next_ [model provider request](https://ai9k.vercel.app/en/model-provider-request), where the model decides what to do with it. Tool call and tool result are two ends of the same exchange, both inside one [turn](https://ai9k.vercel.app/en/turn).\n\nThe lifecycle of a tool result:\n\n| Step | Who     | What happens                                                               |\n| ---- | ------- | -------------------------------------------------------------------------- |\n| 1    | Harness | Executes the tool call — runs the command, reads the file                  |\n| 2    | Harness | Captures the outcome: output, contents, or error                           |\n| 3    | Harness | Appends it to the [context](https://ai9k.vercel.app/en/context) as a message                     |\n| 4    | Harness | Sends the whole context to the provider in the next model provider request |\n| 5    | Model   | Reads the result and decides: another tool call, or a final answer         |\n\nThe result stays in the context for the rest of the [session](https://ai9k.vercel.app/en/session). Tool results are usually the bulk of a coding session's context: every file read, every test run, every search lands in full and keeps occupying [tokens](https://ai9k.vercel.app/en/token) long after it stopped being useful. A few large results — a verbose test log, a generated file read whole — can push a session toward the edge of the [context window](https://ai9k.vercel.app/en/context-window) faster than the conversation itself does.\n\nBecause the result is all the model sees, the model has no way to check the environment behind it. If the output was truncated, the command silently failed, or the harness returned an error instead of the contents, the model reasons from what it was given. When the agent's picture of your system seems wrong, the tool results are where to look: somewhere in the transcript is a result that says something different from what you know to be true.","usage":"\"It's reasoning about the file like it's empty.\"\n\n\"The tool result came back as a permission denial, not the contents. The model only saw the error string — it has no other way to see the file.\"","translated":true}}},{"slug":"mcp","term":"MCP","section":3,"position":30,"links":["harness","agent","tool","context","model","context-window","session","token","attention-budget","context-pointer"],"text":{"vi":{"description":"Giao thức để cắm các máy chủ công cụ bên ngoài vào harness. Đây là cách agent có thêm công cụ ngoài những thứ harness có sẵn.","body":"**Model Context Protocol.** Một giao thức để cắm các máy chủ công cụ bên ngoài vào [harness](https://ai9k.vercel.app/harness). Đây là cách [agent](https://ai9k.vercel.app/agent) có thêm [công cụ](https://ai9k.vercel.app/tool) ngoài những thứ harness có sẵn. Agent không bao giờ \"gọi MCP\"; nó gọi một công cụ, và harness tình cờ lấy công cụ đó từ một máy chủ MCP. Giao thức cũng cung cấp resource (dữ liệu chỉ đọc) và prompt (mẫu dùng lại được), nhưng cung cấp công cụ là công dụng chính.\n\nGiao thức giải quyết một bài toán tích hợp. Không có chuẩn chung, mỗi harness sẽ cần bản tích hợp Linear riêng, bản tích hợp Slack riêng, bản tích hợp cơ sở dữ liệu riêng, mỗi cái được viết và bảo trì riêng. Với MCP, phần tích hợp được viết một lần dưới dạng máy chủ, và harness nào tương thích MCP cũng dùng được. Harness kết nối tới máy chủ, máy chủ công bố nó có những công cụ gì, và các công cụ đó trở nên sẵn dùng cho agent bên cạnh các công cụ dựng sẵn.\n\nCái giá được trả bằng [ngữ cảnh](https://ai9k.vercel.app/context). Mỗi công cụ mà máy chủ công bố đi kèm một định nghĩa, gồm tên, mô tả, schema tham số, và [mô hình](https://ai9k.vercel.app/model) chỉ gọi được những công cụ nó biết. Cách làm ngây thơ là nạp sẵn mọi định nghĩa vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window): cài vài máy chủ nhiều công cụ là một [phiên](https://ai9k.vercel.app/session) bắt đầu với hàng nghìn [token](https://ai9k.vercel.app/token) schema công cụ trước khi bạn gõ gì, tiêu [ngân sách chú ý](https://ai9k.vercel.app/attention-budget) vào những công cụ mà công việc sẽ không bao giờ dùng.\n\nNhiều harness hiện giảm nhẹ điều này bằng tìm kiếm công cụ: thay vì định nghĩa đầy đủ, ngữ cảnh chỉ giữ một [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) tới các công cụ có sẵn. Agent tìm công cụ theo tên hoặc mục đích và chỉ nạp định nghĩa khi cần. Nếu harness của bạn không làm vậy, chi phí trả trước vẫn còn, và bạn chỉ nên bật những máy chủ mà dự án thực sự cần.","usage":"\"Agent cần đọc ticket từ Linear.\"\n\n\"Cấu hình harness dùng máy chủ MCP của Linear. Nó đưa API của Linear ra thành các công cụ agent gọi được. Bạn đỡ phải viết lớp bọc công cụ riêng.\"","translated":true},"en":{"description":"A protocol for plugging external tool servers into a harness — how an agent gets tools beyond what the harness ships with.","body":"**Model Context Protocol.** A protocol for plugging external tool servers into a [harness](https://ai9k.vercel.app/en/harness) — how an [agent](https://ai9k.vercel.app/en/agent) gets [tools](https://ai9k.vercel.app/en/tool) beyond what the harness ships with. The agent never \"calls MCP\"; it calls a tool, and the harness happens to have gotten that tool from an MCP server. Also exposes resources (read-only data) and prompts (reusable templates), but tool provision is the primary use.\n\nThe protocol solves an integration problem. Without a standard, every harness would need its own Linear integration, its own Slack integration, its own database integration — written and maintained separately for each. With MCP, the integration is written once as a server, and any MCP-compatible harness can use it. The harness connects to the server, the server advertises what tools it offers, and those tools become available to the agent alongside the built-in ones.\n\nThe cost is paid in [context](https://ai9k.vercel.app/en/context). Every tool a server advertises arrives as a definition — name, description, parameter schema — and the [model](https://ai9k.vercel.app/en/model) can only call tools it knows about. The naive approach loads every definition into the [context window](https://ai9k.vercel.app/en/context-window) up front: install a few generous servers and a [session](https://ai9k.vercel.app/en/session) starts with thousands of [tokens](https://ai9k.vercel.app/en/token) of tool schemas before you've typed anything, spending [attention budget](https://ai9k.vercel.app/en/attention-budget) on tools the task will never use.\n\nMany harnesses now mitigate this with tool search: instead of the full definitions, the context holds a [context pointer](https://ai9k.vercel.app/en/context-pointer) to the available tools — the agent searches for a tool by name or purpose and loads its definition only when it needs it. If your harness doesn't do this, the up-front cost still applies, and it's worth enabling only the servers a project actually needs.","usage":"\"The agent needs to read tickets from Linear.\"\n\n\"Configure the harness to use the Linear MCP server — it exposes the Linear API as tools the agent can call. Saves you writing custom tool wrappers.\"","translated":true}}},{"slug":"permission-request","term":"Permission request","section":3,"position":31,"links":["harness","tool-call","model","tool-result","human-in-the-loop","permission-mode","session","agent","afk","sandbox","tool"],"text":{"vi":{"name":"Yêu cầu cấp quyền","description":"Thứ harness hiển thị cho người dùng trước khi thực thi một lệnh gọi công cụ chưa được duyệt sẵn. Cơ chế đưa con người vào vòng lặp.","body":"Thứ [harness](https://ai9k.vercel.app/harness) hiển thị cho người dùng trước khi thực thi một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) chưa được duyệt sẵn. [Mô hình](https://ai9k.vercel.app/model) tạo ra lệnh gọi công cụ; thay vì chạy ngay, harness dừng lại và hỏi. Đồng ý thì nó chạy; từ chối thì harness báo việc từ chối về cho mô hình dưới dạng [kết quả công cụ](https://ai9k.vercel.app/tool-result). Đây là cơ chế để harness đưa [con người vào vòng lặp](https://ai9k.vercel.app/human-in-the-loop) với những hành động rủi ro hoặc nhạy cảm.\n\nVòng đời của một yêu cầu cấp quyền:\n\n| Bước | Ai         | Điều gì xảy ra                                                                    |\n| ---- | ---------- | --------------------------------------------------------------------------------- |\n| 1    | Mô hình    | Tạo ra một lệnh gọi công cụ                                                       |\n| 2    | Harness    | Đối chiếu với [chế độ phân quyền](https://ai9k.vercel.app/permission-mode) và các phê duyệt đã lưu |\n| 3    | Harness    | Đã duyệt sẵn: thực thi ngay. Nếu chưa: dừng lại và hiển thị yêu cầu               |\n| 4    | Người dùng | Đồng ý một lần, đồng ý cho tới hết [phiên](https://ai9k.vercel.app/session), hoặc từ chối            |\n| 5    | Harness    | Thực thi lệnh gọi, hoặc gửi việc từ chối về dưới dạng kết quả công cụ             |\n\nTừ chối một yêu cầu là một cách điều hướng agent. Mô hình đọc lời từ chối như mọi kết quả công cụ khác và phản ứng lại: nó thử cách khác, hoặc hỏi bạn muốn thế nào. Phần lớn harness cho bạn đính kèm một tin nhắn vào lời từ chối, biến yêu cầu thành một điểm điều hướng: câu \"đừng làm vậy, dùng script migration đi\" tới đúng lúc mô hình đang quyết định bước tiếp theo.\n\nCái giá là mỗi yêu cầu là một lần chờ đồng bộ vào bạn. [Agent](https://ai9k.vercel.app/agent) bị chặn cho tới khi bạn trả lời. Điều đó ổn khi bạn đang theo dõi và thành vấn đề khi bạn không có mặt: một agent liên tục kích hoạt yêu cầu thì không thể để tự làm việc kiểu [AFK](https://ai9k.vercel.app/afk). Chế độ phân quyền là núm chỉnh: lệnh gọi nào được chạy tự do, lệnh nào phải hỏi trước, và lý tưởng là có một [sandbox](https://ai9k.vercel.app/sandbox) để việc mở rộng nhóm chạy tự do được an toàn.","usage":"\"Nó bị chặn ở một yêu cầu cấp quyền mười phút rồi. Lúc đó mình đang họp.\"\n\n\"Đó là cái giá của việc có con người trong vòng lặp. Duyệt sẵn các [công cụ](https://ai9k.vercel.app/tool) an toàn để yêu cầu chỉ bật lên với những lệnh gọi thực sự rủi ro.\"","translated":true},"en":{"description":"What the harness shows the user before executing a tool call that isn't pre-approved. The mechanism for putting a human in the loop.","body":"What the [harness](https://ai9k.vercel.app/en/harness) shows the user before executing a [tool call](https://ai9k.vercel.app/en/tool-call) that isn't pre-approved. The [model](https://ai9k.vercel.app/en/model) produces a tool call; instead of running it immediately, the harness pauses and asks. Approve and it runs; deny and the harness reports the denial back to the model as a [tool result](https://ai9k.vercel.app/en/tool-result). The mechanism by which a harness puts a human in the [loop](https://ai9k.vercel.app/en/human-in-the-loop) for risky or sensitive actions.\n\nThe lifecycle of a permission request:\n\n| Step | Who     | What happens                                                                            |\n| ---- | ------- | --------------------------------------------------------------------------------------- |\n| 1    | Model   | Produces a tool call                                                                    |\n| 2    | Harness | Checks it against the [permission mode](https://ai9k.vercel.app/en/permission-mode) and any saved approvals |\n| 3    | Harness | Pre-approved: executes immediately. Otherwise: pauses and shows the request             |\n| 4    | User    | Approves once, approves for the rest of the [session](https://ai9k.vercel.app/en/session), or denies          |\n| 5    | Harness | Executes the call, or sends the denial back as a tool result                            |\n\nDenying a request steers the agent. The model reads the denial like any other tool result and reacts to it — it tries a different approach, or asks what you'd prefer. Most harnesses let you attach a message to the denial, which turns the request into a steering point: \"not like that, use the migration script instead\" lands exactly when the model is deciding what to do next.\n\nThe cost is that every request is a synchronous wait on you. The [agent](https://ai9k.vercel.app/en/agent) sits blocked until you answer, which is fine while you're watching and a problem when you're not — an agent that triggers requests constantly can't be left to work [AFK](https://ai9k.vercel.app/en/afk). The permission mode is the dial: which calls run freely, which ask first, ideally with a [sandbox](https://ai9k.vercel.app/en/sandbox) making it safe to widen the free set.","usage":"\"It's been blocked on a permission request for ten minutes — I was in a meeting.\"\n\n\"That's the cost of human-in-the-loop. Pre-approve the safe [tools](https://ai9k.vercel.app/en/tool) so the request only fires on the actually-risky calls.\"","translated":true}}},{"slug":"permission-mode","term":"Permission mode","section":3,"position":32,"links":["agent-mode","tool-call","permission-request","harness","sandbox","afk","agent","tool","human-in-the-loop","session"],"text":{"vi":{"name":"Chế độ phân quyền","description":"Phần kiểm soát quyền của một chế độ agent: lệnh gọi công cụ nào kích hoạt yêu cầu cấp quyền và lệnh nào được chạy tự động.","body":"Phần kiểm soát quyền của một [chế độ agent](https://ai9k.vercel.app/agent-mode): [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) nào kích hoạt một [yêu cầu cấp quyền](https://ai9k.vercel.app/permission-request) và lệnh nào được chạy tự động. Đây là mục đích ban đầu của các hệ thống chế độ, trước khi [harness](https://ai9k.vercel.app/harness) bắt đầu gói thêm chỉ dẫn hành vi lên trên.\n\nHarness đưa ra một thang các chế độ như sau:\n\n| Chế độ             | Đọc     | Ghi và shell                | Thường dùng cho                                       |\n| ------------------ | ------- | --------------------------- | ----------------------------------------------------- |\n| Read-only / plan   | Tự động | Bị chặn                     | Nghiên cứu, lập kế hoạch, review                      |\n| Default            | Tự động | Hỏi                         | Công việc hằng ngày có giám sát                       |\n| Auto-edit          | Tự động | Sửa tự động, shell phải hỏi | Repo đáng tin, thay đổi máy móc                       |\n| \"Yolo\" / full-auto | Tự động | Tự động                     | [Sandbox](https://ai9k.vercel.app/sandbox), các đợt chạy [AFK](https://ai9k.vercel.app/afk) |\n\nChọn một nấc là đánh đổi giữa an toàn và bị ngắt quãng, và cả hai kiểu thất bại đều cảm nhận được. Chặt quá thì bạn thành nút thắt cổ chai: [agent](https://ai9k.vercel.app/agent) dừng lại vài giây một lần cho những thao tác đọc vô hại, bạn bấm đồng ý như máy, và các lần phê duyệt không còn ý nghĩa gì. Duyệt cho có là tệ nhất của cả hai phía: chịu đủ sự ngắt quãng mà không được bảo vệ gì. Lỏng quá thì agent sửa tệp và chạy những lệnh mà lẽ ra bạn muốn xem trước.\n\nĐầu lỏng dễ biện minh nhất khi ở trong sandbox, nơi phạm vi thiệt hại của một lệnh gọi [công cụ](https://ai9k.vercel.app/tool) sai được khoanh lại. Ở ngoài sandbox, phần lớn mọi người chọn tự động duyệt thao tác đọc và giữ [con người trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop) cho bất cứ điều gì không đảo ngược được.","usage":"\"Nó dừng ở từng lần grep, phá hỏng cả đợt chạy AFK.\"\n\n\"Nới chế độ phân quyền cho các công cụ chỉ đọc, vẫn hỏi với thao tác ghi và shell. Phần lớn yêu cầu cấp quyền trong một [phiên](https://ai9k.vercel.app/session) nghiên cứu chỉ là nhiễu.\"","translated":true},"en":{"description":"The permission-gating slice of an agent mode — which tool calls trigger a permission request and which run automatically.","body":"The permission-gating slice of an [agent mode](https://ai9k.vercel.app/en/agent-mode) — which [tool calls](https://ai9k.vercel.app/en/tool-call) trigger a [permission request](https://ai9k.vercel.app/en/permission-request) and which run automatically. The original purpose of mode systems before [harnesses](https://ai9k.vercel.app/en/harness) started bundling behavioral instructions on top.\n\nHarnesses ship a ladder of these modes:\n\n| Mode               | Reads | Writes & shell         | Typical use                                     |\n| ------------------ | ----- | ---------------------- | ----------------------------------------------- |\n| Read-only / plan   | Auto  | Blocked                | Research, planning, reviewing                   |\n| Default            | Auto  | Ask                    | Day-to-day supervised work                      |\n| Auto-edit          | Auto  | Edits auto, shell asks | Trusted repos, mechanical changes               |\n| \"Yolo\" / full-auto | Auto  | Auto                   | [Sandboxes](https://ai9k.vercel.app/en/sandbox), [AFK](https://ai9k.vercel.app/en/afk) runs |\n\nChoosing a rung is a trade between safety and interruption, and both failure modes are felt. Too tight, and you become the bottleneck: the [agent](https://ai9k.vercel.app/en/agent) stops every few seconds for harmless reads, you click approve on autopilot, and the approvals stop meaning anything — rubber-stamping is the worst of both worlds, all the interruption with none of the protection. Too loose, and the agent edits files and runs commands you'd have wanted to see first.\n\nThe loose end is most defensible inside a sandbox, where the blast radius of a bad [tool](https://ai9k.vercel.app/en/tool) call is contained. Outside one, most people settle on auto-approving reads and keeping a [human in the loop](https://ai9k.vercel.app/en/human-in-the-loop) for anything irreversible.","usage":"\"It paused on every grep — totally killed the AFK run.\"\n\n\"Loosen the permission mode for read-only tools, keep prompting on writes and shell. Most permission requests on a research [session](https://ai9k.vercel.app/en/session) are noise.\"","translated":true}}},{"slug":"agent-mode","term":"Agent mode","section":3,"position":33,"links":["agent","permission-mode","system-prompt","session","tool-call","afk","sandbox"],"text":{"vi":{"name":"Chế độ agent","description":"Một thiết lập sẵn, gói chế độ phân quyền cùng các chỉ dẫn hành vi được chèn vào system prompt. Có thể đổi giữa phiên.","body":"Một thiết lập sẵn định hình cách [agent](https://ai9k.vercel.app/agent) vận hành lúc chạy. Nó gói một [chế độ phân quyền](https://ai9k.vercel.app/permission-mode) cùng các chỉ dẫn hành vi được chèn vào [system prompt](https://ai9k.vercel.app/system-prompt). Ví dụ: chế độ mặc định hỏi trước các lệnh gọi rủi ro, **plan mode** chặn chỉnh sửa và hướng agent sang nghiên cứu, chế độ **accept-edits** tự động duyệt chỉnh sửa, chế độ **bypass permissions** (thường gọi vui là **YOLO mode**) tự động duyệt mọi thứ. Có thể đổi [giữa phiên](https://ai9k.vercel.app/session).\n\nViệc gói chung là thứ phân biệt một chế độ với một thiết lập quyền đơn thuần. Chế độ phân quyền chỉ là một cái cổng: nó quyết định [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) nào được đi qua. Chỉ có cổng thì bạn có một agent muốn sửa mà không sửa được: nó đề xuất thao tác ghi, bị chặn, rồi thử đường khác. Các chỉ dẫn được chèn vào gỡ bỏ cái muốn đó: plan mode không chỉ chặn chỉnh sửa, nó còn bảo agent rằng đang ở giai đoạn lập kế hoạch, nên agent đọc, hỏi và đề xuất thay vì cố vượt cổng. Cổng và hướng dẫn cùng chỉ về một phía.\n\nTrên thực tế, bạn đổi chế độ khi mức tin tưởng của bạn thay đổi trong quá trình làm một việc. Cùng một việc có thể đi qua vài chế độ: plan mode khi hướng làm còn đang được định hình, chế độ mặc định có hỏi cho những chỉnh sửa tế nhị đầu tiên, accept-edits khi agent đã cho thấy nó hiểu thay đổi, bypass cho một đợt chạy [AFK](https://ai9k.vercel.app/afk) bên trong [sandbox](https://ai9k.vercel.app/sandbox). Đổi chế độ không tốn gì: cuộc trò chuyện tiếp tục đúng chỗ cũ, với quyền mới và chỉ dẫn mới. Nếu bạn thấy mình duyệt mọi câu hỏi mà không đọc, chế độ đang chặt hơn mức tin tưởng thật của bạn; nếu bạn cứ từ chối các chỉnh sửa, nó đang lỏng hơn.\n\n_Thuật ngữ của các hãng:_ Claude Code gọi chúng là \"permission modes\", Codex gọi là \"approval modes\". Cả hai tên đều có trước việc gói thêm chỉ dẫn hành vi.","usage":"\"Nó cứ sửa tệp trong khi mình chỉ muốn một bản kế hoạch.\"\n\n\"Chuyển sang plan mode. Nó sẽ chặn thao tác ghi và chỉ nghiên cứu.\"\n\n\"Còn đợt chạy AFK lát nữa thì sao?\"\n\n\"Bypass mode, nhưng chỉ ở trong sandbox.\"","translated":true},"en":{"description":"A preset bundling a permission mode with behavioral instructions injected into the system prompt. Can flip mid-session.","body":"A preset that shapes how the [agent](https://ai9k.vercel.app/en/agent) operates at runtime — bundles a [permission mode](https://ai9k.vercel.app/en/permission-mode) with behavioral instructions injected into the [system prompt](https://ai9k.vercel.app/en/system-prompt). Examples: a default that prompts on risky calls, a **plan mode** that blocks edits and steers the agent toward research, an **accept-edits** mode that auto-approves edits, a **bypass permissions** mode (colloquially **YOLO mode**) that auto-approves everything. Can flip [mid-session](https://ai9k.vercel.app/en/session).\n\nThe bundling is what distinguishes a mode from a bare permission setting. A permission mode is only a gate: it decides which [tool calls](https://ai9k.vercel.app/en/tool-call) go through. A gate alone produces an agent that wants to edit but can't — it proposes the write, gets blocked, and tries another way. The injected instructions remove the want: plan mode doesn't just block edits, it tells the agent it's in a planning phase, so it reads, asks, and proposes instead of straining against the gate. Gate and steer point the same direction.\n\nIn practice, you change mode as your trust changes over the course of a task. The same task can pass through several modes: plan mode while the approach is still being shaped, the prompting default for the first delicate edits, accept-edits once the agent has shown it understands the change, bypass for an [AFK](https://ai9k.vercel.app/en/afk) run inside a [sandbox](https://ai9k.vercel.app/en/sandbox). Changing mode costs you nothing: the conversation continues exactly where it was, with new permissions and new instructions. If you find yourself approving every prompt without reading it, the mode is set tighter than your actual trust; if you keep rejecting edits, it's set looser.\n\n_Vendor terms:_ Claude Code calls these \"permission modes,\" Codex calls them \"approval modes\" — both predate behavioral bundling.","usage":"\"It keeps editing files when I just want a plan.\"\n\n\"Switch to plan mode — it'll block writes and stay in research.\"\n\n\"What about for the AFK run later?\"\n\n\"Bypass mode, but only inside the sandbox.\"","translated":true}}},{"slug":"sandbox","term":"Sandbox","section":3,"position":34,"links":["environment","agent","filesystem","afk","permission-mode","human-in-the-loop","agent-mode"],"text":{"vi":{"description":"Môi trường cách ly mà agent chạy bên trong: container, máy ảo hoặc shell bị hạn chế. Giới hạn phạm vi thiệt hại do hành động của agent.","body":"Một [môi trường](https://ai9k.vercel.app/environment) cách ly mà [agent](https://ai9k.vercel.app/agent) chạy bên trong: container, máy ảo, [hệ thống tệp](https://ai9k.vercel.app/filesystem) tạm thời, hoặc shell bị hạn chế quyền. Nó giới hạn phạm vi thiệt hại do hành động của agent: kể cả khi agent chạy lệnh phá hoại hoặc tải về thứ gì độc hại, thiệt hại vẫn được khoanh lại. Đây là nền tảng an toàn giúp làm việc kiểu [AFK](https://ai9k.vercel.app/afk) khả thi.\n\nSandbox và [chế độ phân quyền](https://ai9k.vercel.app/permission-mode) giải cùng một bài toán từ hai đầu ngược nhau. Phân quyền hỏi trước khi một hành động chạy; sandbox giới hạn những gì hành động với tới được nếu nó chạy. Phân quyền cần bạn có mặt [trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop), mỗi câu hỏi là một lần ngắt quãng, và một phiên hỏi liên tục thì hầu như không còn tự chủ. Sandbox tiêu hạ tầng thay cho sự chú ý: cách ly càng mạnh, càng ít câu hỏi cần đặt ra.\n\nCách ly có nhiều mức:\n\n| Mức              | Nó là gì                                                          | Nó khoanh lại được gì                      |\n| ---------------- | ----------------------------------------------------------------- | ------------------------------------------ |\n| Shell bị hạn chế | Giam ở mức hệ điều hành quanh từng lệnh                           | Thao tác ghi ra ngoài dự án, truy cập mạng |\n| Container        | Hệ thống tệp mới, không mount thông tin xác thực, dùng xong bỏ đi | Mọi thứ agent làm với chính máy của nó     |\n| Máy ảo / cloud   | Một máy hoàn toàn riêng, thường do harness cung cấp               | Tất cả, kể cả việc thoát ra ở mức kernel   |\n\nThứ không sandbox nào khoanh lại được: những hành động rời khỏi nó một cách hợp lệ. Một agent có thông tin xác thực git của bạn thì push được; agent có truy cập mạng thì gọi được API production. Hãy quyết định cái gì được đi qua ranh giới trước khi quyết định làm ranh giới dày tới đâu.","usage":"\"Mình muốn để nó chạy [bypass-permissions](https://ai9k.vercel.app/agent-mode) qua đêm nhưng chưa sẵn sàng cho việc đó.\"\n\n\"Cho nó vào sandbox: container mới, không mount thông tin xác thực, không cho ra mạng. Tệ nhất thì nó xoá sạch hệ thống tệp của chính nó và bạn bỏ container đi.\"","translated":true},"en":{"description":"An isolated environment the agent runs inside — container, VM, or restricted shell. Limits the blast radius of agent actions.","body":"An isolated [environment](https://ai9k.vercel.app/en/environment) the [agent](https://ai9k.vercel.app/en/agent) runs inside — a container, VM, ephemeral [filesystem](https://ai9k.vercel.app/en/filesystem), or restricted-permission shell. Limits the blast radius of agent actions: even if the agent runs destructive commands or fetches something malicious, the damage is contained. The safety substrate that makes [AFK](https://ai9k.vercel.app/en/afk) practical.\n\nThe sandbox and the [permission mode](https://ai9k.vercel.app/en/permission-mode) solve the same problem from opposite ends. Permissions ask before an action runs; a sandbox limits what the action can reach if it does run. Permissions need you running [in the loop](https://ai9k.vercel.app/en/human-in-the-loop) — every prompt is an interruption — and a session that asks constantly is barely autonomous. A sandbox spends infrastructure instead of attention: the stronger the isolation, the fewer questions need asking.\n\nIsolation comes in grades:\n\n| Grade            | What it is                                                 | What it contains                           |\n| ---------------- | ---------------------------------------------------------- | ------------------------------------------ |\n| Restricted shell | OS-level confinement around each command                   | Writes outside the project, network access |\n| Container        | Fresh filesystem, no credentials mounted, discarded after  | Anything the agent does to its own machine |\n| VM / cloud       | A separate machine entirely, often provided by the harness | Everything, including kernel-level escapes |\n\nWhat no sandbox contains: actions that leave it legitimately. An agent with your git credentials can push; one with network access can call production APIs. Decide what crosses the boundary before deciding how thick to make it.","usage":"\"I want to let it run [bypass-permissions](https://ai9k.vercel.app/en/agent-mode) overnight but I'm not ready for that.\"\n\n\"Put it in a sandbox — fresh container, no credentials mounted, no network out. Worst case it nukes its own filesystem and you discard the container.\"","translated":true}}},{"slug":"sycophancy","term":"Sycophancy","section":4,"position":35,"links":["model","training","clearing"],"text":{"vi":{"name":"Xu nịnh","description":"Đầu ra của mô hình đồng tình một cách tự tin. Nguyên nhân là huấn luyện khiến mô hình ưu tiên câu trả lời con người thích, kể cả sự đồng tình.","body":"Đầu ra của [mô hình](https://ai9k.vercel.app/model) đồng tình một cách tự tin (xu nịnh). Nguyên nhân nằm ở [huấn luyện](https://ai9k.vercel.app/training): mô hình được định hình để ưu tiên những câu trả lời con người thích, và con người thường thích được đồng tình hơn là bị bảo rằng mình sai. Vì vậy mô hình học được rằng đồng tình thì được thưởng, kể cả khi sự đồng tình đó không đúng.\n\n_Biểu hiện:_\n\n- _Xuôi theo khi bị phản bác:_ đảo ngược một câu trả lời đúng khi bạn hỏi \"bạn chắc không?\".\n- _Khen đầu vào tệ:_ đồng ý rằng kế hoạch hỏng của bạn thật xuất sắc trước khi phân tích nó.\n- _Đóng khung thiên lệch:_ bản review nghiêng về tích cực khi bạn ra dấu rằng bạn là người viết; nghiêng về tiêu cực khi bạn ra dấu rằng người khác viết. Cùng một sản phẩm, khác phán quyết.\n- _Bắt chước:_ lặp lại sai sót của bạn cho chính bạn như một lời xác nhận.\n\n_Phép thử chẩn đoán:_ nếu không có sự dẫn dắt của bạn thì mô hình có nói điều này không? Nếu thứ duy nhất thay đổi là giọng điệu hay cách đặt vấn đề của bạn, đó là xu nịnh, không phải thay đổi thật trong phân tích.\n\n_Cách xử lý:_ giấu ưu tiên của bạn đi. Viết prompt trung tính: \"review đoạn mã này\", không phải \"đoạn mã này có tốt không?\".\n\n_Nên tránh:_ dùng \"xu nịnh\" cho bất kỳ câu trả lời sai nào tình cờ làm bạn hài lòng. Không có phép thử chẩn đoán thì thuật ngữ này không có giá trị gì hơn chữ \"sai\".","usage":"\"Nó bảo kế hoạch refactor của mình trông rất ổn, rồi mình hỏi 'bạn chắc không?' là nó rút lại hết.\"\n\n\"Xu nịnh điển hình. Lúc đầu nó đồng tình vì bạn nghe có vẻ tự tin, sau đó xuôi theo vì bạn nghe có vẻ nghi ngờ. Chất lượng kế hoạch không đổi, giọng điệu của bạn mới đổi. [Xoá ngữ cảnh](https://ai9k.vercel.app/clearing) rồi hỏi lại mà không ra dấu theo hướng nào.\"","translated":true},"en":{"description":"Confidently agreeable model output. Caused by training that shaped the model to favor answers humans liked — including agreement.","body":"Confidently agreeable [model](https://ai9k.vercel.app/en/model) output. Caused by [training](https://ai9k.vercel.app/en/training): the model was shaped to favor answers humans liked, and humans tend to like agreement more than they like being told they're wrong. So the model learned that agreeing is rewarded — even when the agreement is incorrect.\n\n_Surfaces as:_\n\n- _Caving under pushback_ — reverses a correct answer when you say \"are you sure?\".\n- _Praising bad input_ — agrees your broken plan is brilliant before analysing it.\n- _Biased framing_ — review skews positive when you signal you wrote it; negative when you signal someone else did. Same artifact, different verdict.\n- _Mimicry_ — repeats your mistakes back to you as confirmation.\n\n_Diagnostic test:_ would the model have said this without your steer? If the only thing that changed was your tone or framing, it's sycophancy, not a real shift in analysis.\n\n_Fix:_ hide your preferences. Phrase prompts neutrally — \"review this code\" not \"is this code good?\".\n\n_Avoid:_ using \"sycophancy\" for any wrong answer that happens to please you. Without the diagnostic test, the term has no more value than \"wrong.\"","usage":"\"It said my refactor plan looked great, then I asked 'are you sure?' and it walked the whole thing back.\"\n\n\"Classic sycophancy — it agreed first because you sounded confident, then caved because you sounded doubtful. The plan's quality didn't change, your tone did. [Clear](https://ai9k.vercel.app/en/clearing) and re-ask without signalling either way.\"","translated":true}}},{"slug":"hallucination","term":"Hallucination","section":4,"position":36,"links":["model","parametric-knowledge","knowledge-cutoff","contextual-knowledge","attention-degradation","smart-zone","clearing","compaction","next-token-prediction","turn"],"text":{"vi":{"name":"Ảo giác","description":"Đầu ra của mô hình sai nhưng tự tin. Có hai loại: sai sự thật (bịa ra dữ kiện) và thiếu trung thành (lệch khỏi ngữ cảnh đã nạp).","body":"Đầu ra của [mô hình](https://ai9k.vercel.app/model) sai nhưng tự tin (ảo giác). Có hai loại với nguyên nhân và cách xử lý khác nhau:\n\n| Loại                | Sai ở đâu                                                                                                              | Nguyên nhân                                                                                                            | Cách xử lý                                                         |\n| ------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| _Sai sự thật_       | Dữ kiện về thế giới bị bịa ra hoặc sai: một hàm không tồn tại, một chữ ký API sai, một trích dẫn giả                   | Lỗ hổng trong [kiến thức tham số](https://ai9k.vercel.app/parametric-knowledge), thường là sau [mốc kiến thức](https://ai9k.vercel.app/knowledge-cutoff) | Nạp đúng [kiến thức ngữ cảnh](https://ai9k.vercel.app/contextual-knowledge)         |\n| _Thiếu trung thành_ | Đầu ra lệch khỏi kiến thức ngữ cảnh đã nạp, khỏi chỉ dẫn của người dùng, hoặc khỏi chính lập luận trước đó của mô hình | [Suy giảm chú ý](https://ai9k.vercel.app/attention-degradation); nặng hơn khi ở [vùng đần](https://ai9k.vercel.app/smart-zone)                           | [Xoá ngữ cảnh](https://ai9k.vercel.app/clearing) hoặc [nén ngữ cảnh](https://ai9k.vercel.app/compaction) |\n\n[Dự đoán token tiếp theo](https://ai9k.vercel.app/next-token-prediction) tạo ra đầu ra trôi chảy dù dữ kiện bên dưới có thật hay không. Mô hình không có tín hiệu nội tại nào báo rằng nó không biết điều gì đó, nên một phương thức bịa ra xuất hiện với cùng giọng chắc chắn như một phương thức đúng. Mã bị ảo giác thì hợp lý ngay từ cách nó được tạo: đó là hình dạng API _sẽ có_ nếu nó tồn tại, và chính điều đó khiến nó lọt qua một lần review lướt và chỉ hỏng khi chạy.\n\nBạn cần biết mình đang gặp loại nào, vì cách xử lý loại này làm loại kia tệ hơn. Sai sự thật nghĩa là thiếu kiến thức: cách xử lý là thêm ngữ cảnh, như tài liệu, định nghĩa kiểu, tệp. Thiếu trung thành nghĩa là kiến thức có đó nhưng đang thua trong cuộc cạnh tranh giành sự chú ý: cách xử lý là bớt ngữ cảnh. Chẩn đoán nhầm thiếu trung thành thành sai sự thật thì bạn dán thêm tài liệu vào, làm ngữ cảnh lớn thêm và độ lệch nặng hơn. Khi agent làm sai điều gì, hãy kiểm tra xem thông tin đúng đã có trong ngữ cảnh chưa rồi mới quyết định bạn đang gặp vấn đề nào.\n\n_Nên tránh:_ dùng \"ảo giác\" như một từ đồng nghĩa trần trụi của \"sai\". Không nêu rõ loại thì thuật ngữ này không có giá trị chẩn đoán.","usage":"\"Nó bịa ra một phương thức `parseAsync` trên schema.\"\n\n\"Sai sự thật hay thiếu trung thành?\"\n\n\"Phương thức đó có trong tài liệu mình đã dán. Chỉ là sau [lượt](https://ai9k.vercel.app/turn) thứ bốn mươi nó thôi không đọc nữa.\"\n\n\"Vậy là thiếu trung thành. Nén ngữ cảnh rồi nạp lại, đừng thêm tài liệu làm gì.\"","translated":true},"en":{"description":"Confidently-wrong model output. Two flavors: factuality (invented facts) and faithfulness (drift from loaded context).","body":"Confidently-wrong [model](https://ai9k.vercel.app/en/model) output. Two flavors with different causes and fixes:\n\n| Flavor         | What goes wrong                                                                                                        | Cause                                                                                                                | Fix                                                                |\n| -------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| _Factuality_   | Invented or wrong facts about the world — a function that doesn't exist, a wrong API signature, a fake citation        | [Parametric knowledge](https://ai9k.vercel.app/en/parametric-knowledge) gaps, often past the [knowledge cutoff](https://ai9k.vercel.app/en/knowledge-cutoff) | Load the right [contextual knowledge](https://ai9k.vercel.app/en/contextual-knowledge) |\n| _Faithfulness_ | Output drifts from the contextual knowledge that's loaded, the user's instructions, or the model's own prior reasoning | [Attention degradation](https://ai9k.vercel.app/en/attention-degradation); worsens in the [dumb zone](https://ai9k.vercel.app/en/smart-zone)                 | [Clear](https://ai9k.vercel.app/en/clearing) or [compact](https://ai9k.vercel.app/en/compaction)               |\n\n[Next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) produces fluent output whether or not the underlying fact is real — the model has no internal signal that it doesn't know something, so an invented method arrives in the same assured register as a correct one. Hallucinated code is plausible by construction: it's what the API _would_ look like if it existed, which is exactly what makes it slip past a skim-level review and fail only when run.\n\nYou need to know which flavor you're looking at, because the fix for one makes the other worse. Factuality means missing knowledge: the fix is adding context — the docs, the type definitions, the file. Faithfulness means the knowledge is present but losing the competition for attention: the fix is removing context. Misdiagnose faithfulness as factuality and you paste in more docs, which grows the context and makes the drift worse. When the agent gets something wrong, check whether the correct information was already in context before deciding which problem you have.\n\n_Avoid:_ \"hallucination\" as a bare synonym for \"wrong\" — without naming the flavor, the term has no diagnostic value.","usage":"\"It hallucinated a `parseAsync` method on the schema.\"\n\n\"Factuality or faithfulness?\"\n\n\"The method exists in the docs I pasted — it just stopped reading them after [turn](https://ai9k.vercel.app/en/turn) forty.\"\n\n\"Faithfulness then. Compact and reload, don't bother adding more docs.\"","translated":true}}},{"slug":"parametric-knowledge","term":"Parametric knowledge","section":4,"position":37,"links":["model","training","parameters","contextual-knowledge","hallucination","knowledge-cutoff","context"],"text":{"vi":{"name":"Kiến thức tham số","description":"Những gì mô hình biết từ huấn luyện, lưu trong tham số. Bị đóng băng lúc huấn luyện. Đối lập với kiến thức ngữ cảnh.","body":"Những gì [mô hình](https://ai9k.vercel.app/model) \"biết\" từ [huấn luyện](https://ai9k.vercel.app/training), lưu trong [tham số](https://ai9k.vercel.app/parameters) của nó. Nó bị đóng băng lúc huấn luyện: mô hình không nhìn được tham số của chính mình, cũng không cập nhật được chúng. Chi tiết bị mất trong quá trình nén: hàng tỷ dữ kiện bị nhồi vào một số tham số cố định, và những dữ kiện hiếm thì nhoè đi. Đây là nguồn của sự trôi chảy với chủ đề phổ biến, và của sự bịa đặt với chủ đề ít gặp. Đối lập với [kiến thức ngữ cảnh](https://ai9k.vercel.app/contextual-knowledge).\n\nKiến thức tham số không được lưu dưới dạng dữ kiện. Huấn luyện không hề cho mô hình một cơ sở dữ liệu để tra cứu; nó điều chỉnh tham số cho tới khi mô hình dự đoán văn bản tốt, và một mô hình dự đoán tốt văn bản về một chủ đề thì hành xử như thể nó biết chủ đề đó. Kiến thức đáng tin tới đâu thì tuỳ vào tần suất thứ đó xuất hiện trong dữ liệu huấn luyện: chủ đề có hàng triệu ví dụ được tái hiện chính xác; với chủ đề chỉ có vài ví dụ, mô hình đoán dựa trên hình dạng của các chủ đề tương tự. Với mô hình, tái hiện và đoán là cùng một quá trình, nên nó không phân biệt được mình đang làm cái nào. Một câu trả lời bịa ra cũng trôi chảy như một câu trả lời đúng. [Ảo giác](https://ai9k.vercel.app/hallucination) là khi mô hình đoán sai.\n\nKiến thức tham số cũng cũ đi. Tham số ngừng thay đổi tại [mốc kiến thức](https://ai9k.vercel.app/knowledge-cutoff), nên một thư viện phát hành hoặc đổi tên sau ngày đó không tồn tại trong chúng, và một API đã thay đổi thì được nhớ ở dạng cũ.\n\nVới cả hai lỗ hổng, quá hiếm và quá mới, cách khắc phục là một: không thể thêm kiến thức vào tham số, nên nó phải được cung cấp dưới dạng kiến thức ngữ cảnh.","usage":"\"Nó viết React không chê vào đâu được nhưng lại bịa ra phương thức trên SDK nội bộ của mình.\"\n\n\"React có rất dày trong kiến thức tham số, hàng triệu ví dụ huấn luyện. SDK của bạn thì không, nên mô hình điền vào những hình dạng trông hợp lý. Nạp tài liệu SDK vào [ngữ cảnh](https://ai9k.vercel.app/context) đi.\"","translated":true},"en":{"description":"What the model knows from training, stored in its parameters. Frozen at training time. Counterpart to contextual knowledge.","body":"What the [model](https://ai9k.vercel.app/en/model) \"knows\" from [training](https://ai9k.vercel.app/en/training), stored in its [parameters](https://ai9k.vercel.app/en/parameters). Frozen at training time — the model can't see its own parameters or update them. Detail is lost in the squeeze: billions of facts cram into a fixed number of parameters, and the rare ones blur. Source of fluency on common topics, and of fabrication on uncommon ones. Counterpart to [contextual knowledge](https://ai9k.vercel.app/en/contextual-knowledge).\n\nParametric knowledge is not stored as facts. Training never gives the model a database to look things up in; it adjusts parameters until the model predicts text well, and a model that predicts text about a topic well behaves as if it knows the topic. How reliable the knowledge is tracks how often something appeared in the training data: a topic with millions of examples is reproduced accurately, for a topic with only a handful, the model guesses based on what similar topics look like. Reproducing and guessing are the same process to the model, so it can't tell which one it's doing. A fabricated answer arrives with the same fluency as a correct one. [Hallucination](https://ai9k.vercel.app/en/hallucination) is the model guessing wrong.\n\nParametric knowledge also ages. The parameters stop changing at the [knowledge cutoff](https://ai9k.vercel.app/en/knowledge-cutoff), so a library released or renamed after that date doesn't exist in them, and an API that changed is remembered in its old form.\n\nFor both gaps — too rare and too recent — the remedy is the same: the knowledge can't be added to the parameters, so it has to be supplied as contextual knowledge instead.","usage":"\"It writes flawless React but invents methods on our internal SDK.\"\n\n\"React is dense in the parametric knowledge — millions of training examples. Your SDK isn't, so the model fills in plausible-looking shapes. Load the SDK docs into [context](https://ai9k.vercel.app/en/context).\"","translated":true}}},{"slug":"knowledge-cutoff","term":"Knowledge cutoff","section":4,"position":38,"links":["model","parametric-knowledge","contextual-knowledge","training","parameters","context"],"text":{"vi":{"name":"Mốc kiến thức","description":"Mốc ngày mà sau đó mô hình không có kiến thức tham số. Thư viện và API ra sau mốc này là bẫy bịa đặt nếu không nạp tài liệu.","body":"Mốc ngày mà sau đó một [mô hình](https://ai9k.vercel.app/model) không có [kiến thức tham số](https://ai9k.vercel.app/parametric-knowledge). Thư viện, API và sự kiện xuất hiện sau mốc này là bẫy bịa đặt, trừ khi tài liệu của chúng được nạp làm [kiến thức ngữ cảnh](https://ai9k.vercel.app/contextual-knowledge). Mỗi bản phát hành mô hình có mốc riêng.\n\nMốc này tồn tại vì cách mô hình được tạo ra: [huấn luyện](https://ai9k.vercel.app/training) nung một bản chụp văn bản vào [tham số](https://ai9k.vercel.app/parameters) của mô hình, sau đó tham số bị đóng băng. Mô hình không biết kiến thức của mình có một đường biên. Khi được hỏi về điều gì sau mốc, nó không từ chối mà ngoại suy từ thứ gần nhất nó biết. Đó là điều khiến cái bẫy này êm: mã viết theo phiên bản cũ của một thư viện trông hợp lý, thường biên dịch được, và hỏng ở những phần đã thay đổi.\n\nCách xử lý luôn là một: đưa thông tin hiện hành vào [ngữ cảnh](https://ai9k.vercel.app/context). Nạp changelog, chỉ tới các định nghĩa kiểu của phiên bản đang cài, hoặc để agent đọc tài liệu trên web. Có gì đó trong ngữ cảnh luôn hơn là không có gì trong tham số.","usage":"\"Nó cứ viết theo cú pháp SDK v3 trong khi bọn mình dùng v5.\"\n\n\"v5 ra sau mốc kiến thức. Nạp changelog v5 làm kiến thức ngữ cảnh, không thì nó sẽ tiếp tục bịa từ phiên bản cũ hơn trong kiến thức tham số.\"","translated":true},"en":{"description":"The date past which a model has no parametric knowledge. Post-cutoff libraries and APIs are fabrication traps unless docs are loaded.","body":"The date past which a [model](https://ai9k.vercel.app/en/model) has no [parametric knowledge](https://ai9k.vercel.app/en/parametric-knowledge). Libraries, APIs, and events from after the cutoff are fabrication traps unless their docs are loaded as [contextual knowledge](https://ai9k.vercel.app/en/contextual-knowledge). Each model release ships with its own cutoff.\n\nThe cutoff exists because of how models are made: [training](https://ai9k.vercel.app/en/training) bakes a snapshot of text into the model's [parameters](https://ai9k.vercel.app/en/parameters), and after that the parameters are frozen. The model doesn't know its knowledge has an edge — asked about something past the cutoff, it doesn't refuse, it extrapolates from the nearest thing it does know. That's what makes the trap quiet: code written against an old version of a library looks plausible, often compiles, and fails on the parts that changed.\n\nThe fix is always the same: get current information into [context](https://ai9k.vercel.app/en/context). Load the changelog, point at the installed version's type definitions, or have the agent read the docs from the web. Anything in context outranks nothing-in-parameters.","usage":"\"It keeps writing the v3 SDK syntax — we're on v5.\"\n\n\"v5 shipped after the knowledge cutoff. Load the v5 changelog as contextual knowledge, otherwise it'll keep fabricating from the older parametric version.\"","translated":true}}},{"slug":"contextual-knowledge","term":"Contextual knowledge","section":4,"position":39,"links":["agent","context","tool-result","agentsmd","session","parametric-knowledge","context-window","hallucination","model","knowledge-cutoff","ai","token","attention-budget","memory-system"],"text":{"vi":{"name":"Kiến thức ngữ cảnh","description":"Các dữ kiện agent đọc được trực tiếp từ ngữ cảnh ngay lúc này. Đối lập với kiến thức tham số.","body":"Các dữ kiện mà [agent](https://ai9k.vercel.app/agent) đọc được trực tiếp từ [ngữ cảnh](https://ai9k.vercel.app/context) ngay lúc này: nhiệm vụ của người dùng, các tệp agent đã đọc, [kết quả công cụ](https://ai9k.vercel.app/tool-result), nội dung [AGENTS.md](https://ai9k.vercel.app/agentsmd) được nạp lúc bắt đầu [phiên](https://ai9k.vercel.app/session). Đối lập với [kiến thức tham số](https://ai9k.vercel.app/parametric-knowledge): kiến thức tham số được _nhớ lại_ từ tham số; kiến thức ngữ cảnh được _đọc_ từ [cửa sổ](https://ai9k.vercel.app/context-window). [Ảo giác](https://ai9k.vercel.app/hallucination) hiếm hơn nhiều khi agent làm việc từ kiến thức ngữ cảnh, vì câu trả lời nằm ngay trước mắt nó chứ không phải được vớt lên từ một ký ức đã nhoè.\n\nTrong hai loại kiến thức, chỉ kiến thức ngữ cảnh nằm trong tầm kiểm soát của bạn. Tham số đã đóng băng, nên cách duy nhất để cho [mô hình](https://ai9k.vercel.app/model) kiến thức nó thiếu, như một SDK nội bộ, một thư viện ra sau [mốc kiến thức](https://ai9k.vercel.app/knowledge-cutoff), một quyết định vừa đưa ra hôm qua, là đặt nó vào ngữ cảnh. Rất nhiều công việc thực tế khi lập trình với [AI](https://ai9k.vercel.app/ai) quy về điều này: đưa đúng dữ kiện tới trước mô hình vào lúc nó cần.\n\nKhi kiến thức ngữ cảnh và kiến thức tham số mâu thuẫn, kiến thức ngữ cảnh thường thắng. Dán tài liệu API hiện hành vào thì mô hình làm theo nó thay vì ký ức cũ về API cũ. Dù vậy phiên bản cũ vẫn có thể rỉ ra, nhất là khi đã vào sâu một phiên dài. Nếu agent cứ quay về một cách viết lỗi thời dù tài liệu đã được nạp, đó là kiến thức tham số rò qua kiến thức ngữ cảnh; nhắc lại lời sửa hoặc đưa nó tới gần chỗ làm việc hơn sẽ có ích.\n\nKhác với kiến thức tham số, dùng kiến thức ngữ cảnh thì tốn chi phí. Mọi thứ nạp vào cửa sổ đều tiêu [token](https://ai9k.vercel.app/token) và cạnh tranh [ngân sách chú ý](https://ai9k.vercel.app/attention-budget) của mô hình, nên nạp nhiều hơn không tự động là tốt hơn. Mục tiêu là các dữ kiện liên quan nằm trong cửa sổ, không phải mọi dữ kiện.\n\n_Chỉ dùng thuật ngữ này_ khi đối chiếu với kiến thức tham số; còn lại cứ nói **ngữ cảnh**.\n\n_Nên tránh:_ \"bộ nhớ làm việc\". Kiến thức ngữ cảnh là thứ đang có trong cửa sổ _lúc này_; [hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system) là thứ đưa nội dung xuyên phiên vào đó. Hai quy mô khác nhau, đừng gộp lại.","usage":"\"Sao khi mình dán tài liệu thì nó làm đúng API, còn không dán thì nó bịa?\"\n\n\"Có tài liệu thì đó là kiến thức ngữ cảnh, nó đọc ngay trên trang. Không có thì là kiến thức tham số, và các endpoint hiếm bị nhoè.\"","translated":true},"en":{"description":"Facts the agent can read directly from the context right now. Counterpart to parametric knowledge.","body":"Facts the [agent](https://ai9k.vercel.app/en/agent) can read directly from the [context](https://ai9k.vercel.app/en/context) right now — the user's task, files the agent has read in, [tool results](https://ai9k.vercel.app/en/tool-result), [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) content loaded at [session](https://ai9k.vercel.app/en/session) start. Counterpart to [parametric knowledge](https://ai9k.vercel.app/en/parametric-knowledge): parametric is _recalled_ from the parameters; contextual is _read_ from the [window](https://ai9k.vercel.app/en/context-window). [Hallucinations](https://ai9k.vercel.app/en/hallucination) are much less common when the agent works from contextual knowledge — the answer is right in front of it, not dredged up from a blurred memory.\n\nOf the two kinds of knowledge, only contextual knowledge is in your control. The parameters are frozen, so the only way to give the [model](https://ai9k.vercel.app/en/model) knowledge it lacks — an internal SDK, a library released after the [knowledge cutoff](https://ai9k.vercel.app/en/knowledge-cutoff), a decision made yesterday — is to put it in the context. A lot of practical [AI](https://ai9k.vercel.app/en/ai) coding work reduces to this: getting the right facts in front of the model at the moment it needs them.\n\nWhen contextual and parametric knowledge conflict, the contextual usually wins. Paste the current API docs and the model follows them rather than its stale memory of the old API — though the old version can still bleed through, especially deep into a long session. If the agent keeps reverting to an outdated pattern despite the docs being loaded, that's parametric knowledge leaking past the contextual; restating the correction or moving it closer to the work helps.\n\nUnlike parametric knowledge, contextual knowledge costs something to use. Everything loaded into the window spends [tokens](https://ai9k.vercel.app/en/token) and competes for the model's [attention budget](https://ai9k.vercel.app/en/attention-budget), so loading more is not automatically better — the aim is the relevant facts in the window, not all the facts.\n\n_Reach for this term_ only when contrasting with parametric knowledge; otherwise just say **context**.\n\n_Avoid:_ \"working memory\" — contextual knowledge is what's in the window _now_; a [memory system](https://ai9k.vercel.app/en/memory-system) is what gets cross-session content into it. Different scales, don't conflate.","usage":"\"Why does it nail the API when I paste the docs and fabricate it when I don't?\"\n\n\"With the docs in, it's contextual knowledge — reading off the page. Without, it's parametric and the rare endpoints blur.\"","translated":true}}},{"slug":"attention-relationship","term":"Attention relationship","section":4,"position":40,"links":["token","model","context","model-provider-request","attention-budget","attention-degradation","smart-zone"],"text":{"vi":{"name":"Quan hệ chú ý","description":"Sự ghép cặp giữa hai token. Cặp có ý nghĩa ảnh hưởng lẫn nhau nhiều hơn cặp không liên quan. Ngữ cảnh N token có khoảng N² cặp như vậy.","body":"Khi dự đoán mỗi [token](https://ai9k.vercel.app/token), [mô hình](https://ai9k.vercel.app/model) tính tới mọi token khác trong [ngữ cảnh](https://ai9k.vercel.app/context), có cái nhiều, có cái hầu như không. Sự ghép cặp giữa hai token là một **quan hệ chú ý**, và các cặp có ý nghĩa (\"cô ấy\" với \"Sarah\", hay một lời gọi `getUser()` với định nghĩa `function getUser` của nó) ảnh hưởng lẫn nhau nhiều hơn các cặp không liên quan. Một ngữ cảnh N token có số quan hệ cỡ N².\n\nCác cặp này là nơi chứa cái có vẻ là sự hiểu của mô hình. Khi nó xác định được một đại từ chỉ ai, đó là vì quan hệ chú ý giữa \"cô ấy\" và \"Sarah\" mạnh. Khi nó gọi một hàm với đúng đối số, quan hệ giữa chỗ gọi và phần định nghĩa nó đọc trước đó đang làm việc. Không có gì trong số này được tra cứu. Tất cả được tính mới ở mỗi [yêu cầu tới nhà cung cấp mô hình](https://ai9k.vercel.app/model-provider-request), cho từng cặp.\n\nCon số N² đáng để ngẫm, vì nó tăng nhanh hơn trực giác gợi ý:\n\n| Kích thước ngữ cảnh | Số cặp (~N²) |\n| ------------------- | ------------ |\n| 1.000 token         | ~1 triệu     |\n| 10.000 token        | ~100 triệu   |\n| 100.000 token       | ~10 tỷ       |\n\nMỗi cặp còn được tính nhiều hơn một lần. Mô hình có nhiều attention head. Con số chính xác của các mô hình hàng đầu không được công bố, nhưng năm mươi tới một trăm là một ước đoán hợp lý. Mỗi head tính phiên bản riêng của mọi quan hệ. Vậy mỗi cặp trong bảng trên được nhân bản qua mọi head. Đó là rất nhiều cặp.\n\nChỉ một số ít quan hệ này quan trọng với một công việc cụ thể. Cặp giữa chỉ dẫn của bạn và đoạn mã mà nó chi phối là một trong số ít cặp có giá trị; hầu hết phần còn lại là nhiễu. Và hai thứ này tăng với tốc độ khác nhau: các quan hệ quan trọng gần như giữ nguyên số lượng, còn tổng số cặp tăng theo bình phương kích thước ngữ cảnh. Ở 1.000 token, cặp bạn quan tâm là một trên một triệu; ở 100.000 token, nó là một trên mười tỷ. Đây là phép tính nằm dưới [ngân sách chú ý](https://ai9k.vercel.app/attention-budget), và [suy giảm chú ý](https://ai9k.vercel.app/attention-degradation) là điều bạn cảm thấy khi các quan hệ quan trọng nhận được phần quá mỏng.","usage":"\"Nó cứ nhầm hai ký hiệu `user` trong diff. Nghe như mình đang ở [vùng đần](https://ai9k.vercel.app/smart-zone) rồi.\"\n\n\"Ừ, quan hệ chú ý giữa mỗi chỗ gọi và phần khai báo của nó đang giành nhau với cặp kia: cùng hình dạng token, khác ràng buộc. Đổi tên một cái là các cặp rõ nét lại.\"","translated":true},"en":{"description":"The pairing between two tokens — meaningful pairs influence each other more than unrelated ones. A context of N tokens has ~N² of these.","body":"When predicting each [token](https://ai9k.vercel.app/en/token), the [model](https://ai9k.vercel.app/en/model) factors in every other token in the [context](https://ai9k.vercel.app/en/context) — some heavily, others barely at all. The pairing between two tokens is an **attention relationship**, and meaningful pairs (\"her\" with \"Sarah\", or a `getUser()` call with its `function getUser` definition) influence each other more than unrelated ones. A context of N tokens has on the order of N² relationships.\n\nThe pairings are where the model's apparent understanding lives. When it resolves a pronoun, it's because the attention relationship between \"her\" and \"Sarah\" is strong. When it calls a function with the right arguments, the relationship between the call site and the definition it read earlier is doing the work. None of this is looked up — it's computed fresh on every [model provider request](https://ai9k.vercel.app/en/model-provider-request), for every pair.\n\nThe N² figure is worth sitting with, because it grows faster than intuition suggests:\n\n| Context size   | Pairings (~N²) |\n| -------------- | -------------- |\n| 1,000 tokens   | ~1 million     |\n| 10,000 tokens  | ~100 million   |\n| 100,000 tokens | ~10 billion    |\n\nEach pairing is also computed more than once. Models have multiple attention heads — exact counts for frontier models are unpublished, but fifty to a hundred is a reasonable guess — and each head computes its own version of every relationship. So every pairing in the table above is duplicated across every head. That's a lot of pairings.\n\nOnly a small number of these relationships matter for any given task. The pairing between your instruction and the code it governs is one of a handful that count; almost everything else in the pool is noise. And the two grow at different rates: the relationships that matter stay roughly constant, while the total pool grows quadratically with context size. At 1,000 tokens, the pairing you care about is one in a million; at 100,000 tokens, it's one in ten billion. This is the arithmetic underneath the [attention budget](https://ai9k.vercel.app/en/attention-budget), and [attention degradation](https://ai9k.vercel.app/en/attention-degradation) is what it feels like when the relationships that matter get too thin a share.","usage":"\"It keeps confusing the two `user` symbols across the diff — sounds like we're in the [dumb zone](https://ai9k.vercel.app/en/smart-zone).\"\n\n\"Yeah, the attention relationship between each call site and its declaration is fighting the other one — same token shape, different bindings. Rename one and the pairings sharpen.\"","translated":true}}},{"slug":"attention-budget","term":"Attention budget","section":4,"position":41,"links":["token","context","attention-relationship","session","context-window","attention-degradation","clearing","smart-zone"],"text":{"vi":{"name":"Ngân sách chú ý","description":"Mỗi token có một lượng ảnh hưởng hữu hạn để phân bổ cho phần còn lại của ngữ cảnh. Tính theo từng token, không tăng khi ngữ cảnh lớn lên.","body":"Mỗi [token](https://ai9k.vercel.app/token) có một lượng ảnh hưởng hữu hạn để phân bổ cho phần còn lại của [ngữ cảnh](https://ai9k.vercel.app/context). Ảnh hưởng mạnh lên [một quan hệ](https://ai9k.vercel.app/attention-relationship) thì còn lại ít hơn cho các quan hệ khác. Ngân sách tính theo từng token và không tăng khi ngữ cảnh lớn lên, vì vậy các [phiên](https://ai9k.vercel.app/session) dài bị loãng đi.\n\nHãy hình dung nó như tín hiệu và nhiễu. Chỉ dẫn của bạn là một tín hiệu có âm lượng cố định; mọi token khác trong [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) là âm thanh cạnh tranh. Chỉ dẫn không hề nhỏ đi, nó vẫn ở đó, đúng từng ký tự. Nhưng khi ngữ cảnh lớn lên, căn phòng quanh nó ồn hơn và tỷ lệ tín hiệu trên nhiễu giảm xuống. Một chỉ dẫn từng là thứ to nhất ở 10k token ngữ cảnh thì thành tiếng rì rầm nền ở 150k. Đây là cơ chế đằng sau [suy giảm chú ý](https://ai9k.vercel.app/attention-degradation): mô hình không quên; tín hiệu bị lẫn vào nhiễu.\n\nTriệu chứng trông như sự bất tuân: agent đồng ý với một ràng buộc từ sớm rồi dần trôi khỏi nó, và dán lại ràng buộc chỉ có ích trong chốc lát. Nguyên nhân không phải chỉ dẫn, mà là mọi thứ khác trong cửa sổ đang cạnh tranh với nó.\n\nThứ bạn kiểm soát được là cái gì đi vào ngữ cảnh. Nội dung không phục vụ công việc không hề trung tính; nó là nhiễu đè lên mọi thứ có phục vụ. Giữ cửa sổ nhỏ, [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) khi phần ngữ cảnh tích luỹ không còn đáng giá, và nhắc lại những ràng buộc quan trọng thay vì tin rằng lần nhắc từ sớm vẫn còn hiệu lực.","usage":"\"Sao nó cứ phớt lờ schema mình dán ở đầu?\"\n\n\"Mình đã vào sâu [vùng đần](https://ai9k.vercel.app/smart-zone) rồi. Ngân sách chú ý của mỗi token là cố định, nhưng ngữ cảnh thì cứ lớn lên. Tín hiệu của schema giờ đang cạnh tranh với hàng nghìn token mới hơn.\"","translated":true},"en":{"description":"Each token has a finite amount of influence to distribute across the rest of the context. Per-token, doesn't grow when context does.","body":"Each [token](https://ai9k.vercel.app/en/token) has a finite amount of influence to distribute across the rest of the [context](https://ai9k.vercel.app/en/context). Heavy influence on [one relationship](https://ai9k.vercel.app/en/attention-relationship) leaves less for others. The budget is per-token and doesn't grow when the context does, which is why long [sessions](https://ai9k.vercel.app/en/session) dilute.\n\nThink of it as signal and noise. Your instruction is a signal at fixed volume; every other token in the [context window](https://ai9k.vercel.app/en/context-window) is competing sound. The instruction never gets quieter — it's still there, character for character — but as the context grows, the room gets louder around it, and the signal-to-noise ratio drops. An instruction that was the loudest thing at 10k tokens of context is background hum at 150k. This is the mechanism behind [attention degradation](https://ai9k.vercel.app/en/attention-degradation): the model doesn't forget; the signal gets lost in the noise.\n\nThe symptom reads as disobedience — the agent agreed to a constraint early on and then drifts from it, and re-pasting the constraint helps only briefly. The cause isn't the instruction; it's everything else in the window competing with it.\n\nWhat you can control is what goes into the context. Content that doesn't serve the task isn't neutral — it's noise over everything that does. Keep the window small, [clear](https://ai9k.vercel.app/en/clearing) when the accumulated context stops paying for itself, and restate the constraints that matter instead of trusting their early mention to hold.","usage":"\"Why does it keep ignoring the schema I pasted at the top?\"\n\n\"We're well into the [dumb zone](https://ai9k.vercel.app/en/smart-zone) — every token's attention budget is fixed, but the context kept growing. The signal on the schema is now competing with thousands of newer tokens.\"","translated":true}}},{"slug":"attention-degradation","term":"Attention degradation","section":4,"position":42,"links":["session","token","attention-budget","attention-relationship","context","model","parameters","smart-zone","turn","clearing","compaction","handoff"],"text":{"vi":{"name":"Suy giảm chú ý","description":"Khi phiên lớn lên, ngân sách chú ý của mỗi token bị chia cho nhiều đối thủ hơn; tín hiệu trên các quan hệ có ý nghĩa co lại.","body":"Khi một [phiên](https://ai9k.vercel.app/session) lớn lên, [ngân sách chú ý](https://ai9k.vercel.app/attention-budget) của mỗi [token](https://ai9k.vercel.app/token) bị chia cho nhiều đối thủ hơn. Tín hiệu trên bất kỳ [quan hệ có ý nghĩa](https://ai9k.vercel.app/attention-relationship) nào cũng co lại; nhiễu từ phần [ngữ cảnh](https://ai9k.vercel.app/context) không liên quan chen vào. Vẫn [mô hình](https://ai9k.vercel.app/model) đó, vẫn [tham số](https://ai9k.vercel.app/parameters) đó, chỉ là thêm nhiều miệng ăn chung một mâm. Đây là nguyên nhân của hiệu ứng [vùng thông minh / vùng đần](https://ai9k.vercel.app/smart-zone).\n\nNó biểu hiện như việc mô hình kém đi giữa phiên: những ràng buộc nó tuân theo suốt một giờ bắt đầu tuột, nó hỏi lại điều đã được dặn, nó viết mã bỏ qua một tệp đã đọc trước đó. Mô hình không có gì thay đổi. Biến số duy nhất là lượng ngữ cảnh mà giờ nó phải chú ý tới.\n\nNó diễn ra từ từ, và đó là điều khiến khó nhận ra khi đang ở trong phiên. Không có lỗi, không có ngưỡng; mỗi [lượt](https://ai9k.vercel.app/turn) chỉ tệ hơn lượt trước một chút, và tới lúc các lần tuột trở nên rõ ràng thì bạn đã ở vùng đần một lúc rồi.\n\nBạn hồi phục bằng cách bớt ngữ cảnh, không phải thêm. Dán lại chỉ dẫn bị phớt lờ là thêm một đối thủ nữa vào cùng cửa sổ đông đúc và chỉ có ích trong chốc lát. Những cách hiệu quả: [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) rồi chỉ nạp lại những gì công việc cần, hoặc [nén ngữ cảnh](https://ai9k.vercel.app/compaction), hoặc [bàn giao](https://ai9k.vercel.app/handoff) sang một phiên mới. Hãy coi việc làm theo chỉ dẫn kém dần là tín hiệu về độ dài ngữ cảnh, không phải về mô hình.","usage":"\"Nó vào sâu vùng đần rồi, đang bịa ra các generic không có trong tệp kiểu.\"\n\n\"Suy giảm chú ý. Các định nghĩa kiểu vẫn còn trong ngữ cảnh, nhưng tín hiệu của chúng bị vùi dưới mọi thứ mình thêm vào từ đó. Xoá ngữ cảnh rồi nạp lại đi.\"","translated":true},"en":{"description":"As a session grows, each token's attention budget spreads across more competitors; signal on meaningful relationships shrinks.","body":"As a [session](https://ai9k.vercel.app/en/session) grows, each [token](https://ai9k.vercel.app/en/token)'s [attention budget](https://ai9k.vercel.app/en/attention-budget) is spread across more competitors. The signal on any one [meaningful relationship](https://ai9k.vercel.app/en/attention-relationship) shrinks; noise from irrelevant [context](https://ai9k.vercel.app/en/context) crowds in. Same [model](https://ai9k.vercel.app/en/model), same [parameters](https://ai9k.vercel.app/en/parameters) — just more mouths to feed from the same plate. Cause of the smart zone / dumb [zone effect](https://ai9k.vercel.app/en/smart-zone).\n\nIt presents as the model getting worse mid-session: constraints it followed for an hour start slipping, it re-asks things it was told, it writes code that ignores a file it read earlier. Nothing about the model changed — the only variable is how much context it's now attending over.\n\nIt's gradual, which is what makes it hard to catch from inside the session. There's no error and no threshold; each [turn](https://ai9k.vercel.app/en/turn) is only slightly worse than the last, and by the time the slips are obvious you've been in the dumb zone for a while.\n\nYou recover by removing context, not adding more. Re-pasting the ignored instruction adds another competitor to the same crowded window and helps only briefly. What works: [clear](https://ai9k.vercel.app/en/clearing) and reload only what the task needs, or [compact](https://ai9k.vercel.app/en/compaction), or [hand off](https://ai9k.vercel.app/en/handoff) to a fresh session. Treat declining instruction-following as a signal about context length, not about the model.","usage":"\"It's deep in the dumb zone — inventing generics that aren't in the type file.\"\n\n\"Attention degradation. The type definitions are still in context, but the signal on them is buried under everything we've added since. Clear and reload.\"","translated":true}}},{"slug":"smart-zone","term":"Smart zone","section":4,"position":43,"links":["session","agent","hallucination","model","harness","context","attention-degradation","token","clearing","compaction","context-window","handoff"],"text":{"vi":{"name":"Vùng thông minh","description":"Đầu phiên, agent sắc bén và tập trung. Khi phiên lớn lên, nó trôi vào vùng đần: cẩu thả hơn, hay quên, nhiều lỗi hơn.","body":"Đầu một [phiên](https://ai9k.vercel.app/session), [agent](https://ai9k.vercel.app/agent) ở trong \"vùng thông minh\": sắc bén, tập trung, nhớ tốt. Khi phiên lớn lên, nó trôi vào \"vùng đần\": cẩu thả hơn, hay quên, nhiều lỗi hơn, và nhiều [ảo giác](https://ai9k.vercel.app/hallucination) kiểu thiếu trung thành hơn. Vẫn [mô hình](https://ai9k.vercel.app/model) đó, vẫn [harness](https://ai9k.vercel.app/harness) đó, chỉ là nhiều [ngữ cảnh](https://ai9k.vercel.app/context) hơn. Đây là hiệu ứng cảm nhận được của [suy giảm chú ý](https://ai9k.vercel.app/attention-degradation). Với các mô hình hàng đầu, vùng đần thường bắt đầu quanh 125K–150K [token](https://ai9k.vercel.app/token), dù con số này còn gây tranh cãi. Hãy [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) hoặc [nén ngữ cảnh](https://ai9k.vercel.app/compaction) khi phiên phình to; đừng cố chạy tiếp.\n\nSự sa sút diễn ra từ từ nên dễ bỏ lỡ. Không có thông báo lỗi, không có ranh giới nhìn thấy được; agent chỉ bắt đầu làm kém đi một chút, rồi kém đi rõ rệt. Dấu hiệu thường gặp: nó quên một chỉ dẫn bạn đưa hai mươi lượt trước, lặp lại một lỗi đã sửa, hoặc tự tin khẳng định điều mà ngữ cảnh nói ngược lại. Vì đường trượt rất êm, phản ứng thường thấy là cố chạy tiếp và giải thích lại, việc này thêm ngữ cảnh và làm vấn đề tệ hơn.\n\nCác vùng này không đi theo giới hạn của [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window). Một phiên có thể đã vào sâu vùng đần khi phần lớn cửa sổ vẫn còn trống: giới hạn là nơi harness từ chối chạy tiếp, nhưng chất lượng đã rơi từ rất lâu trước đó. Hãy lập kế hoạch theo vùng thông minh, không theo cửa sổ. Ngân sách thực tế cho một việc là số token mà agent còn làm việc tốt, không phải số token về lý thuyết nó chứa được.\n\nVùng thông minh là một ngân sách, và việc không liên quan tiêu mất nó. Mỗi việc làm trong phiên đều dùng hết một phần token, nên bắt đầu việc thứ hai trong cùng phiên nghĩa là bắt đầu nó gần vùng đần hơn. Mỗi phiên một việc cho mỗi việc phần sắc bén nhất của phiên. Khi một việc lớn hơn một vùng thông minh, hãy chia ra: [bàn giao](https://ai9k.vercel.app/handoff) hoặc nén ngữ cảnh ở một ranh giới tự nhiên, và để một phiên mới làm phần kế tiếp.","usage":"\"Nó làm ngon ba component đầu rồi phá nát cái thứ tư.\"\n\n\"Bạn ra khỏi vùng thông minh rồi. Vẫn mô hình đó, chỉ là giờ đã vào sâu vùng đần. Nén ngữ cảnh rồi nạp lại bản kế hoạch, component kế tiếp sẽ ổn.\"","translated":true},"en":{"description":"Early in a session the agent is sharp and focused. As the session grows it drifts into a dumb zone: sloppier, forgetful, more mistakes.","body":"Early in a [session](https://ai9k.vercel.app/en/session) the [agent](https://ai9k.vercel.app/en/agent) is in a \"smart zone\" — sharp, focused, recall is good. As the session grows it drifts into a \"dumb zone\": sloppier, forgetful, more mistakes — and more faithfulness [hallucinations](https://ai9k.vercel.app/en/hallucination). Same [model](https://ai9k.vercel.app/en/model), same [harness](https://ai9k.vercel.app/en/harness) — just more [context](https://ai9k.vercel.app/en/context). The felt effect of [attention degradation](https://ai9k.vercel.app/en/attention-degradation). On frontier models, the dumb zone commonly begins around 125K-150K [tokens](https://ai9k.vercel.app/en/token) — though this is debated. [Clear](https://ai9k.vercel.app/en/clearing) or [compact](https://ai9k.vercel.app/en/compaction) when the session bloats; don't push through.\n\nThe decline is gradual, which makes it easy to miss. There's no error message and no visible boundary; the agent just starts performing slightly worse, then noticeably worse. Common signs: it forgets an instruction you gave twenty turns ago, repeats a mistake it had already corrected, or confidently asserts something the context contradicts. Because the slide is smooth, the usual response is to push through and re-explain — which adds more context and makes the problem worse.\n\nThe zones don't track the [context window](https://ai9k.vercel.app/en/context-window) limit. A session can be deep in the dumb zone with most of the window still free: the limit is where the harness refuses to continue, but quality falls off long before that. Plan around the smart zone, not the window — the practical budget for a task is the tokens the agent works well within, not the tokens it can technically hold.\n\nThe smart zone is a budget, and unrelated work spends it. Every task done in a session uses up tokens, so starting a second task in the same session means starting it closer to the dumb zone. Doing one task per session gives each task the sharpest part of the session. When a single task is bigger than one smart zone, split it: [hand off](https://ai9k.vercel.app/en/handoff) or compact at a natural boundary, and let a fresh session do the next piece.","usage":"\"It nailed the first three components and just butchered the fourth.\"\n\n\"You're out of the smart zone — same model, just deep into the dumb zone now. Compact and reload the plan, the next component will land.\"","translated":true}}},{"slug":"clearing","term":"Clearing","section":5,"position":44,"links":["session","context-window","tool-result","model","turn","agent","context","harness","stateless","handoff-artifact","compaction"],"text":{"vi":{"name":"Xoá ngữ cảnh","description":"Kết thúc phiên hiện tại và bắt đầu một phiên mới. Tin nhắn kế tiếp mở đầu với phiên trống và cửa sổ ngữ cảnh trống.","body":"Kết thúc [phiên](https://ai9k.vercel.app/session) hiện tại và bắt đầu một phiên mới. Tin nhắn kế tiếp mở đầu với một phiên trống và một [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) trống. Thường do người dùng chủ động.\n\nXoá ngữ cảnh là thuốc chữa cho một ngữ cảnh bị ô nhiễm. Phiên tích luỹ mọi thứ: các lần thử thất bại, các hướng đi sai, [kết quả công cụ](https://ai9k.vercel.app/tool-result) đã cũ, các kế hoạch bị bỏ. [Mô hình](https://ai9k.vercel.app/model) đọc lại tất cả ở mỗi [lượt](https://ai9k.vercel.app/turn), và lịch sử xấu kéo lùi công việc mới. Vào sâu một phiên dài, [agent](https://ai9k.vercel.app/agent) trở nên mơ hồ hơn và kém nghe lời hơn: chỉ dẫn bạn nói rõ ràng bị bỏ qua, chất lượng tuột, và thúc nó làm tốt hơn cũng không ích gì, vì đống nhiễu nó phải lội qua vẫn nằm trong [ngữ cảnh](https://ai9k.vercel.app/context). Xoá ngữ cảnh loại bỏ đống nhiễu đó.\n\nXoá ngữ cảnh không xoá cuộc trò chuyện. Phần lớn [harness](https://ai9k.vercel.app/harness) giữ lịch sử phiên trên máy của bạn, nên bản ghi vẫn còn đó để đọc hoặc tiếp tục. Thứ mất đi là trạng thái làm việc của agent: mô hình [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên phiên mới không biết gì về những điều phiên cũ biết. Nếu phiên đang giữ các quyết định hoặc tiến độ mà phiên sau sẽ cần, hãy để agent viết một [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) trước, rồi bắt đầu phiên mới bằng cách chỉ vào nó.\n\nSo sánh với [nén ngữ cảnh](https://ai9k.vercel.app/compaction), vốn tóm tắt phiên vào ngữ cảnh mới thay vì bắt đầu trống. Xoá ngữ cảnh là công cụ thô hơn: không có gì được mang sang, kể cả rác.","usage":"\"Nó kẹt trong vòng lặp với bài test lỗi.\"\n\n\"Xoá ngữ cảnh đi. Bắt đầu phiên mới với tài liệu kế hoạch và tệp test. Vật lộn với ngữ cảnh hiện tại chẳng ích gì.\"","translated":true},"en":{"description":"Ending the current session and starting a fresh one. The next message begins with an empty session and an empty context window.","body":"Ending the current [session](https://ai9k.vercel.app/en/session) and starting a fresh one. The next message begins with an empty session and an empty [context window](https://ai9k.vercel.app/en/context-window). Usually user-driven.\n\nClearing is the cure for a polluted context. A session accumulates everything: failed attempts, wrong turns, stale [tool results](https://ai9k.vercel.app/en/tool-result), abandoned plans. The [model](https://ai9k.vercel.app/en/model) re-reads all of it on every [turn](https://ai9k.vercel.app/en/turn), and bad history drags on new work. Deep into a long session the [agent](https://ai9k.vercel.app/en/agent) gets vaguer and less obedient — instructions you gave clearly get ignored, quality slips, and prodding it to do better doesn't help, because the noise it's wading through is still in its [context](https://ai9k.vercel.app/en/context). Clearing removes the noise.\n\nClearing doesn't erase the conversation. Most [harnesses](https://ai9k.vercel.app/en/harness) keep session history on your computer, so the transcript is still there to read or resume. What's gone is the agent's working state: the model is [stateless](https://ai9k.vercel.app/en/stateless), so the new session knows nothing the old one knew. If the session holds decisions or progress the next one will need, have the agent write a [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) first, then start the new session by pointing at it.\n\nCompare [compaction](https://ai9k.vercel.app/en/compaction), which summarises the session into the new context instead of starting empty. Clearing is the blunter tool: nothing carries over, including the junk.","usage":"\"It's stuck looping on the failing test.\"\n\n\"Just clear it — start a fresh session with the plan doc and the test file. No point fighting the existing context.\"","translated":true}}},{"slug":"handoff","term":"Handoff","section":5,"position":45,"links":["agent","context","session","handoff-artifact","compaction","clearing","afk","context-window","model","stateless","environment"],"text":{"vi":{"name":"Bàn giao","description":"Chuyển ngữ cảnh của agent từ phiên này sang phiên khác, không có đường quay lại. Cách mang theo thì đa dạng: tài liệu, nén ngữ cảnh, v.v.","body":"Chuyển [ngữ cảnh](https://ai9k.vercel.app/context) của [agent](https://ai9k.vercel.app/agent) từ [phiên](https://ai9k.vercel.app/session) này sang phiên khác. Cách mang theo thì đa dạng: một [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) được viết ra, một bản tóm tắt nằm trong bộ nhớ ([nén ngữ cảnh](https://ai9k.vercel.app/compaction)), và các cách khác. Khác với [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) (không chuyển gì cả). Lý do cũng đa dạng: đổi vai (người lập kế hoạch → người thực hiện), khởi động một đợt chạy [AFK](https://ai9k.vercel.app/afk), toả ra nhiều phiên song song, hoặc giải phóng chỗ trong [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window).\n\nPhiên nhận bắt đầu với ngữ cảnh bằng không. [Mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless), và phiên mới không thấy được gì từ phiên cũ. Bất cứ thứ gì phiên sau cần đều phải được mang theo một cách tường minh; mọi thứ khác mất đi. \"Không có đường quay lại\" là ràng buộc định hình thứ được mang theo: phiên mới không thể hỏi phiên cũ ý nó là gì, nên tài liệu mang theo phải tự đứng vững.\n\n| Cơ chế            | Hình thức                                | Đặc điểm                                                                            |\n| ----------------- | ---------------------------------------- | ----------------------------------------------------------------------------------- |\n| Tài liệu bàn giao | Tệp trong [môi trường](https://ai9k.vercel.app/environment) | Bạn đọc và sửa được trước khi có gì phụ thuộc vào nó; dùng lại được cho nhiều phiên |\n| Nén ngữ cảnh      | Bản tóm tắt trong cửa sổ ngữ cảnh        | Tự động và rẻ; khó kiểm tra hơn; chỉ nuôi một phiên kế nhiệm                        |\n\nThất bại dễ thấy của một lần bàn giao tồi là tranh luận lại từ đầu: phiên mới mở lại những quyết định mà phiên cũ đã chốt, vì thứ được mang theo ghi lại điều gì đã được quyết định mà không ghi vì sao. Hãy đánh giá một lần bàn giao bằng việc một phiên có ngữ cảnh bằng không làm được gì với nó.","usage":"\"Phiên lập kế hoạch đang nặng dần. Mình cứ làm tiếp à?\"\n\n\"Bàn giao đi. Ghi các quyết định ra một tài liệu, xoá ngữ cảnh, rồi bắt đầu phần thực hiện trong một phiên mới đọc từ tài liệu đó.\"","translated":true},"en":{"description":"Transferring agent context from one session to another, with no return path. Carry mechanism varies — artifact, compaction, others.","body":"Transferring [agent](https://ai9k.vercel.app/en/agent) [context](https://ai9k.vercel.app/en/context) from one [session](https://ai9k.vercel.app/en/session) to another. The carry mechanism varies — a written [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact), an in-memory summary ([compaction](https://ai9k.vercel.app/en/compaction)), and others. Distinct from [clearing](https://ai9k.vercel.app/en/clearing) (no transfer at all). Reasons vary: switching roles (planner → implementer), kicking off an [AFK](https://ai9k.vercel.app/en/afk) run, fanning out to parallel sessions, or freeing up [context window](https://ai9k.vercel.app/en/context-window) room.\n\nThe receiving session starts with zero context — the [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless), and nothing from the old session is visible to the new one. Whatever the next session needs has to be carried explicitly; everything else is gone. \"No return path\" is the constraint that shapes the carry: the new session can't ask the old one what it meant, so the carried material has to stand on its own.\n\n| Mechanism        | Form                                        | Properties                                                                               |\n| ---------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------- |\n| Handoff artifact | File in the [environment](https://ai9k.vercel.app/en/environment) | You can read and correct it before anything depends on it; reusable across many sessions |\n| Compaction       | Summary in the context window               | Automatic and cheap; harder to inspect; feeds one successor                              |\n\nThe visible failure of a bad handoff is relitigation: the new session re-opens decisions the old one had settled, because the carry recorded what was decided but not why. Judge a handoff by what a session with zero context could do with it.","usage":"\"Planning session is getting heavy — should I just keep going?\"\n\n\"Do a handoff. Write the decisions to a doc, clear, start the implementation in a fresh session reading from it.\"","translated":true}}},{"slug":"primary-source","term":"Primary source","section":5,"position":46,"links":["secondary-source","agent","context-window","token","input-tokens","attention-budget","context"],"text":{"vi":{"name":"Nguồn sơ cấp","description":"Chính thứ đó: mã nguồn, bản ghi, dữ liệu thô. Đầy đủ và có thẩm quyền, nhưng tốn kém khi nạp vào ngữ cảnh.","body":"Một nguồn sự thật ở dạng nguyên gốc: mã nguồn, bản ghi cuộc trò chuyện, log thô, phản hồi API thực tế. Không phải lời kể về thứ đó, mà là chính nó. Đối lập với [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source).\n\nNếu bạn muốn biết codebase làm gì thì mã nguồn là nguồn sơ cấp. Tài liệu, sơ đồ kiến trúc và README đều là mô tả về nó: đúng vào lúc được viết, và từ đó đi theo nhịp riêng. Khi một [agent](https://ai9k.vercel.app/agent) tự tin khẳng định điều gì sai về dự án của bạn, câu hỏi cần đặt ra là nó đang dựa vào nguồn nào. Agent đọc một tài liệu thì thừa hưởng độ cũ của tài liệu đó; agent đọc mã nguồn thì đang đọc sự thật hiện hành.\n\nChi phí là thứ khiến nguồn sơ cấp không thành lựa chọn mặc định. Nạp một nguồn như vậy vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) thì đắt: cả tệp, cả bản ghi, mỗi [token](https://ai9k.vercel.app/token) đều được tính là [đầu vào](https://ai9k.vercel.app/input-tokens) và cạnh tranh [ngân sách chú ý](https://ai9k.vercel.app/attention-budget). Thứ bạn nhận lại là sự đầy đủ: chưa có gì bị lọc trước bởi phán đoán của người khác về điều gì quan trọng. Một bản tóm tắt viết tháng trước không thể chứa chi tiết mà hôm nay mới hoá ra quan trọng; nguồn sơ cấp thì vẫn chứa.\n\nHãy tìm tới nguồn sơ cấp khi cần chính xác: chữ ký chính xác, lỗi thực tế, dòng ném ra ngoại lệ. Phần lớn việc quản lý [ngữ cảnh](https://ai9k.vercel.app/context) là quyết định khi nào trả giá cho nguồn sơ cấp và khi nào nguồn thứ cấp là đủ.","usage":"\"Agent bảo logic retry lùi theo cấp số nhân, nhưng mình đang thấy nó dội liên tục vào endpoint.\"\n\n\"Nó đọc điều đó từ tài liệu thiết kế. Chỉ nó vào module retry thật. Khi hành vi là thứ quan trọng thì hãy làm việc từ nguồn sơ cấp.\"","translated":true},"en":{"description":"The thing itself — code, transcripts, raw data. Complete and authoritative, but expensive to load into context.","body":"A source of truth in its original form — the code, the conversation transcript, the raw log, the actual API response. Not an account of the thing; the thing. Counterpart to [secondary source](https://ai9k.vercel.app/en/secondary-source).\n\nIf you want to know what your codebase does, the code is the primary source. The docs, the architecture diagram, and the README are all descriptions of it — accurate when written, on their own schedule ever since. When an [agent](https://ai9k.vercel.app/en/agent) confidently asserts something wrong about your project, the question to ask is which source it was working from: an agent that read a doc inherits the doc's staleness; an agent that read the code is reading the current truth.\n\nThe cost is what keeps primary sources from being the default. Loading one into the [context window](https://ai9k.vercel.app/en/context-window) is expensive — the full file, the full transcript, every [token](https://ai9k.vercel.app/en/token) billed as [input](https://ai9k.vercel.app/en/input-tokens) and competing for [attention budget](https://ai9k.vercel.app/en/attention-budget). What you get for the cost is completeness: nothing has been pre-filtered by someone else's judgement about what mattered. A summary written last month can't contain the detail that turned out to matter today; the primary source still does.\n\nReach for the primary source when precision matters — the exact signature, the actual error, the line that throws. Much of managing [context](https://ai9k.vercel.app/en/context) is deciding when to pay for the primary source and when a secondary source is good enough.","usage":"\"The agent says the retry logic backs off exponentially, but I'm watching it hammer the endpoint.\"\n\n\"It read that out of the design doc. Point it at the actual retry module — work from the primary source when the behaviour matters.\"","translated":true}}},{"slug":"secondary-source","term":"Secondary source","section":5,"position":47,"links":["primary-source","context-window","context","compaction","session","subagent","handoff-artifact","memory-system","agent","context-pointer"],"text":{"vi":{"name":"Nguồn thứ cấp","description":"Lời kể về một nguồn sơ cấp, cách một bước: bản tóm tắt, tài liệu, bản tóm tắt khi nén. Rẻ khi nạp, mất mát thông tin ngay từ bản chất.","body":"Lời kể về một [nguồn sơ cấp](https://ai9k.vercel.app/primary-source), cách một bước: tài liệu mô tả mã nguồn, bản tóm tắt mô tả một bản ghi, báo cáo mô tả kết quả tìm kiếm. Nạp nó vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) rẻ hơn nguồn mà nó mô tả, và nó mất mát thông tin ngay từ bản chất: người viết đã quyết định điều gì quan trọng, và những gì họ bỏ đi thì vô hình với người chỉ có bản tóm tắt.\n\nPhần lớn [context](https://ai9k.vercel.app/context) engineering là việc sản xuất nguồn thứ cấp. [Nén ngữ cảnh](https://ai9k.vercel.app/compaction) biến lịch sử [phiên](https://ai9k.vercel.app/session) thành một bản tóm tắt làm hạt giống cho phiên sau. Một [subagent](https://ai9k.vercel.app/subagent) đốt ngữ cảnh riêng của nó cho một lần tìm kiếm nhiều nhiễu rồi trả về một báo cáo ngắn. Một [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) cô đọng các quyết định của một phiên thành văn bản cho phiên sau đọc. [Hệ thống bộ nhớ](https://ai9k.vercel.app/memory-system) chắt những gì phiên đã học thành ghi chú. Tất cả đều đánh đổi như nhau: độ trung thực lấy khoảng trống.\n\nNguồn thứ cấp hỏng theo hai cách. Chúng mất mát thông tin: bản tóm tắt khi nén làm mất quyết định về schema, bản báo cáo không nhắc tới trường hợp biên. Và chúng trôi lệch: nguồn sơ cấp thay đổi mà lời kể không theo kịp, nên tài liệu mô tả kiến trúc của quý trước với sự tự tin của quý này. Khi một [agent](https://ai9k.vercel.app/agent) hành động theo một nguồn thứ cấp đã hỏng theo cách nào trong hai cách đó, nó tự tin làm việc từ thông tin sai; cách xử lý là đưa nó quay lại nguồn sơ cấp.\n\nCả hai kiểu hỏng đều không khiến nguồn thứ cấp thành sai lầm. Cửa sổ ngữ cảnh hữu hạn, và nguồn sơ cấp thì đắt; không có bản tóm tắt, báo cáo và tài liệu bàn giao thì không việc lớn nào chứa vừa. Kỹ năng nằm ở chỗ biết chi tiết nào chịu được mất mát, và kiểm chứng với nguồn sơ cấp khi một chi tiết không chịu được. Một nguồn thứ cấp làm tốt có mang theo [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) về bản gốc, như bản tóm tắt nêu tên bản ghi nó được rút ra, tài liệu nêu tên tệp nó mô tả. Khi lời kể không đủ, người đọc đi theo con trỏ thay vì làm việc từ phần đã mất mát.","usage":"\"Tài liệu bàn giao ghi phần auth đã xong, nhưng phiên mới cứ gặp lỗi làm mới token.\"\n\n\"Tài liệu đó là nguồn thứ cấp. Phiên trước ghi lại điều nó tin, không phải điều đúng. Cho phiên mới chạy các test auth và tin vào nguồn sơ cấp.\"","translated":true},"en":{"description":"An account of a primary source, one step removed — summaries, docs, compaction summaries. Cheap to load, lossy by construction.","body":"An account of a [primary source](https://ai9k.vercel.app/en/primary-source), one step removed — documentation describing code, a summary describing a transcript, a report describing search results. Cheaper to load into the [context window](https://ai9k.vercel.app/en/context-window) than the source it describes, and lossy by construction: whoever wrote it decided what mattered, and whatever they dropped is invisible to a reader who only has the summary.\n\nA lot of [context](https://ai9k.vercel.app/en/context) engineering is the manufacture of secondary sources. [Compaction](https://ai9k.vercel.app/en/compaction) turns the [session](https://ai9k.vercel.app/en/session) history into a summary that seeds the next session. A [subagent](https://ai9k.vercel.app/en/subagent) burns its own context on a noisy search and returns a short report. A [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) condenses a session's decisions into a document the next session reads. [Memory systems](https://ai9k.vercel.app/en/memory-system) distil what a session learned into notes. Each makes the same trade: fidelity for headroom.\n\nSecondary sources fail in two ways. They're lossy — the compaction summary that lost the schema decision, the report that didn't mention the edge case. And they drift — the primary source changes and the account doesn't follow, so docs describe last quarter's architecture with this quarter's confidence. When an [agent](https://ai9k.vercel.app/en/agent) acts on a secondary source that has failed either way, it works confidently from wrong information; the fix is sending it back to the primary source.\n\nNeither failure makes secondary sources a mistake. The context window is finite, and primary sources are expensive; without summaries, reports, and handoff documents, nothing large fits. The skill is knowing which details can survive the loss — and verifying against the primary source when one can't. A well-made secondary source carries a [context pointer](https://ai9k.vercel.app/en/context-pointer) back to its original — the summary that names the transcript it came from, the doc that names the file it describes — so when the account isn't enough, the reader can follow the pointer rather than work from the loss.","usage":"\"The handoff doc says auth is done, but the new session keeps finding broken token refresh.\"\n\n\"The doc's a secondary source — the last session wrote down what it believed, not what's true. Have the new session run the auth tests and trust the primary source.\"","translated":true}}},{"slug":"handoff-artifact","term":"Handoff artifact","section":5,"position":48,"links":["handoff","environment","session","spec","ticket","model","stateless","clearing","context","secondary-source","primary-source","compaction","agent"],"text":{"vi":{"name":"Tài liệu bàn giao","description":"Một tài liệu dùng làm cách mang theo trong một lần bàn giao: phiên này viết ra để phiên khác đọc.","body":"Một tài liệu dùng làm cách mang theo trong một lần [bàn giao](https://ai9k.vercel.app/handoff): một [phiên](https://ai9k.vercel.app/session) viết nó vào [môi trường](https://ai9k.vercel.app/environment) để phiên khác đọc. [Spec](https://ai9k.vercel.app/spec), [ticket](https://ai9k.vercel.app/ticket) và tài liệu kế hoạch đều là tài liệu bàn giao.\n\nLý do để viết: [mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless), nên không gì trong phiên còn lại sau khi [xoá ngữ cảnh](https://ai9k.vercel.app/clearing). Các quyết định, ràng buộc, kế hoạch dang dở đều mất theo [ngữ cảnh](https://ai9k.vercel.app/context) từng chứa chúng. Môi trường thì còn lại. Ghi phần trạng thái quan trọng vào một tệp là chuyển nó tới nơi phiên sau đọc lại được.\n\nTài liệu này là một [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source): lời kể về công việc của phiên, không phải chính công việc. Nhờ vậy nó đủ nhỏ để giới thiệu việc cho một phiên mới, và cũng vì vậy nó có thể dẫn phiên đó đi sai: nó ghi lại điều phiên viết ra tin là đúng, và những gì nó bỏ sót hoặc ghi sai thì vô hình với người đọc. Chỗ nào một nhận định quan trọng, phiên sau nên kiểm chứng với [nguồn sơ cấp](https://ai9k.vercel.app/primary-source), tức mã nguồn và test, thay vì thừa hưởng nó.\n\nMột tài liệu tốt được viết để đọc vào một phiên có ngữ cảnh bằng không. Đường dẫn tệp cụ thể thay cho \"cái tệp mình đã bàn\". Điều gì đã được quyết định và vì sao, để phiên sau không tranh luận lại. Cái gì đã xong và cái gì còn lại. Nên nói cho phiên viết biết tài liệu sẽ đi đâu: \"viết tài liệu bàn giao cho một phiên mới không biết gì về việc này\".\n\nCách mang theo còn lại là [nén ngữ cảnh](https://ai9k.vercel.app/compaction), vốn tóm tắt ngay trong bộ nhớ. Tài liệu có hai lợi thế: nó nằm trên đĩa, nơi bạn đọc và sửa được trước khi có gì phụ thuộc vào nó, và nó dùng lại được, cùng một spec có thể giới thiệu việc cho năm phiên song song.","usage":"\"Mình chia việc này giữa [agent](https://ai9k.vercel.app/agent) lập kế hoạch và agent thực hiện thế nào?\"\n\n\"Cho agent lập kế hoạch viết một tài liệu bàn giao: đường dẫn tệp, quyết định, ràng buộc. Phiên của agent thực hiện mở đầu bằng một con trỏ tới tài liệu đó và làm theo nó như bản chỉ thị.\"","translated":true},"en":{"description":"A document used as the carry mechanism for a handoff — written by one session to be read by another.","body":"A document used as the carry mechanism for a [handoff](https://ai9k.vercel.app/en/handoff) — written to the [environment](https://ai9k.vercel.app/en/environment) by one [session](https://ai9k.vercel.app/en/session) to be read by another. [Specs](https://ai9k.vercel.app/en/spec), [tickets](https://ai9k.vercel.app/en/ticket), and plan docs are all handoff artifacts.\n\nThe reason to write one: the [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless), so nothing in a session survives [clearing](https://ai9k.vercel.app/en/clearing) it. Decisions, constraints, half-finished plans — all gone with the [context](https://ai9k.vercel.app/en/context) that held them. The environment persists. Writing the important state into a file moves it somewhere the next session can read it back from.\n\nThe artifact is a [secondary source](https://ai9k.vercel.app/en/secondary-source) — an account of the session's work, not the work itself. That's what makes it small enough to brief a fresh session, and also why it can mislead one: it records what the writing session believed, and anything it left out or got wrong is invisible to the reader. Where a claim matters, the next session should verify it against the [primary source](https://ai9k.vercel.app/en/primary-source) — the code, the tests — rather than inherit it.\n\nA good artifact is written to be read into a session that has zero context. Concrete file paths rather than \"the file we discussed\". What was decided and why, so the next session doesn't relitigate it. What's done and what's left. It helps to tell the writing session where the artifact is headed: \"write a handoff doc for a fresh session that knows nothing about this work\".\n\nThe alternative carry mechanism is [compaction](https://ai9k.vercel.app/en/compaction), which summarises in-memory. The artifact has two advantages: it lives on disk where you can read and correct it before anything depends on it, and it can be reused — the same spec can brief five parallel sessions.","usage":"\"How do I split this between the planning [agent](https://ai9k.vercel.app/en/agent) and the implementing one?\"\n\n\"Have the planner write a handoff artifact — file paths, decisions, constraints. The implementer's session opens with a pointer to the artifact and works from it as its brief.\"","translated":true}}},{"slug":"spec","term":"Spec","section":5,"position":49,"links":["handoff-artifact","session","ticket","context-window","context","environment","clearing","agent","smart-zone"],"text":{"vi":{"description":"Tài liệu bàn giao mô tả một phần việc kéo dài nhiều phiên: xây cái gì, không phải mỗi phiên làm phần mình thế nào. Gồm các ticket.","body":"Một [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) mô tả một phần việc kéo dài nhiều [phiên](https://ai9k.vercel.app/session): xây cái gì, không phải mỗi phiên làm phần của mình thế nào. Nó thay đổi theo tiến độ công việc. Nó gồm các [ticket](https://ai9k.vercel.app/ticket).\n\nSpec tồn tại vì phiên thì dùng xong bỏ, còn việc lớn thì không. Bất cứ việc gì cần nhiều hơn một [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) đều cần một chỗ ở ngoài [ngữ cảnh](https://ai9k.vercel.app/context): đâu đó trong [môi trường](https://ai9k.vercel.app/environment) của agent, còn lại sau khi [xoá ngữ cảnh](https://ai9k.vercel.app/clearing), dù là một tệp trong repo, một issue trên GitHub, hay một hệ thống theo dõi issue mà agent với tới được. Spec là chỗ ở đó: mục tiêu, các ràng buộc, các quyết định tới giờ, và danh sách ticket kèm trạng thái. Phiên mới nào cũng đọc được nó và biết việc đang ở đâu mà không thừa hưởng đống nhiễu tích luỹ của phiên trước.\n\nSpec có vài kiểu dễ nhận ra, phần lớn kế thừa từ cách các nhóm vốn ghi chép. Một _product requirements document_ (PRD) nghiêng về cái gì và vì sao ở phía người dùng: tính năng, hành vi, tiêu chí nghiệm thu. Một _design doc_ hay _RFC_ nghiêng về kỹ thuật: hướng được chọn, các phương án bị loại, các đánh đổi. Ở đầu nhỏ, một tệp `plan.md` đơn giản với danh sách ticket làm cùng việc đó cho một tính năng nhiều phiên. Kiểu nào không quan trọng bằng vai trò: với [agent](https://ai9k.vercel.app/agent), tất cả đều là một thứ, bản tuyên bố ý định bền vững mà nó đọc lúc bắt đầu mỗi phiên.","usage":"\"Tất cả việc này có nên làm trong một phiên không?\"\n\n\"Không, viết nó thành spec, chia thành các ticket, mỗi ticket chạy trong một phiên riêng. Cố làm hết trong một ngữ cảnh thì sẽ chạm [vùng đần](https://ai9k.vercel.app/smart-zone) trước khi được nửa đường.\"","translated":true},"en":{"description":"A handoff artifact describing a multi-session piece of work — what's being built, not how each session does its share. Made of tickets.","body":"A [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) describing a multi-[session](https://ai9k.vercel.app/en/session) piece of work — what's being built, not how each session does its share. Mutates as work progresses. Made of [tickets](https://ai9k.vercel.app/en/ticket).\n\nThe spec exists because sessions are disposable and big work isn't. Anything that takes more than one [context window](https://ai9k.vercel.app/en/context-window) of effort needs a home outside the [context](https://ai9k.vercel.app/en/context) — somewhere in the agent's [environment](https://ai9k.vercel.app/en/environment) that survives [clearing](https://ai9k.vercel.app/en/clearing), whether that's a file in the repo, a GitHub issue, or an issue tracker the agent can reach. The spec is that home: the goal, the constraints, the decisions made so far, and the list of tickets with their status. Any fresh session can read it and know where the work stands without inheriting the previous session's accumulated noise.\n\nSpecs come in recognisable styles, mostly inherited from how teams already write things down. A _product requirements document_ (PRD) leans toward the user-facing what and why — features, behaviour, acceptance criteria. A _design doc_ or _RFC_ leans technical — the chosen approach, the alternatives rejected, the trade-offs. At the small end, a plain `plan.md` with a checklist of tickets does the same job for a multi-session feature. The style matters less than the role: for the [agent](https://ai9k.vercel.app/en/agent), each of these is the same thing — the durable statement of intent it reads at the start of every session.","usage":"\"Should this all be one session?\"\n\n\"No, write it up as a spec — break it into tickets, run each one in its own session. Trying to do the whole thing in a single context will hit the [dumb zone](https://ai9k.vercel.app/en/smart-zone) before you're halfway.\"","translated":true}}},{"slug":"ticket","term":"Ticket","section":5,"position":50,"links":["handoff-artifact","session","spec","smart-zone","context","context-pointer","software-factory"],"text":{"vi":{"description":"Tài liệu bàn giao khoanh phạm vi một phiên làm việc. Đứng riêng hoặc thuộc một spec. Có thể chặn hoặc bị chặn bởi các ticket khác.","body":"Một [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) khoanh phạm vi một [phiên](https://ai9k.vercel.app/session) làm việc. Nó đứng riêng, hoặc thuộc một [spec](https://ai9k.vercel.app/spec) như một phần tử con. Ticket có thể chặn hoặc bị chặn bởi các ticket cùng cấp, nên thứ tự công việc sinh ra từ đồ thị phụ thuộc của chúng chứ không từ một kế hoạch tuyến tính.\n\nRàng buộc quyết định là kích thước: một phiên. Một ticket phải làm xong được trước khi phiên trôi khỏi [vùng thông minh](https://ai9k.vercel.app/smart-zone), và ràng buộc đó kiểm chứng được. Nếu các phiên làm ticket của bạn thường xuyên xuống cấp trước khi xong việc, ticket đang quá lớn; hãy chia ra. Nếu mỗi phiên tiêu phần lớn [ngữ cảnh](https://ai9k.vercel.app/context) để chuẩn bị rồi mới làm năm phút, ticket đang quá nhỏ; hãy gộp lại.\n\nMột ticket tốt được viết cho người đọc không có ngữ cảnh nào khác. Mục tiêu, tiêu chí nghiệm thu, và các [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) tới những tệp và quyết định liên quan: đủ để phiên bắt tay vào việc mà không phải suy lại những gì phiên trước đã biết.\n\nĐồ thị phụ thuộc cũng là thứ mở ra khả năng chạy song song. Các ticket độc lập, tức các lá của đồ thị, có thể chạy cùng lúc, mỗi cái trong phiên riêng. Đây là một cách hiệu quả để chạy nhiều agent cùng lúc. Trong một [nhà máy phần mềm](https://ai9k.vercel.app/software-factory), việc một ticket được đánh dấu sẵn sàng chính là thứ kích hoạt phiên của nó.","usage":"\"Mình bắt đầu từ đâu với spec migration?\"\n\n\"Nhìn đồ thị ticket: thay đổi schema chặn việc backfill, backfill chặn việc chuyển API. Chọn một lá và chạy một phiên cho nó.\"","translated":true},"en":{"description":"A handoff artifact scoping one session of work. Stands alone or hangs off a spec. Can block or be blocked by sibling tickets.","body":"A [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) scoping one [session](https://ai9k.vercel.app/en/session) of work. Stands alone, or hangs off a [spec](https://ai9k.vercel.app/en/spec) as one of its children. Tickets can block or be blocked by sibling tickets, so the order of work falls out of their dependency graph rather than a linear plan.\n\nThe defining constraint is the size: one session. A ticket should be completable before the session drifts out of the [smart zone](https://ai9k.vercel.app/en/smart-zone) — and that constraint is testable. If sessions on your tickets routinely degrade before the work is done, the tickets are too big; split them. If each session spends most of its [context](https://ai9k.vercel.app/en/context) on setup before doing five minutes of work, they're too small; merge them.\n\nA good ticket is written for a reader with no other context. The goal, the acceptance criteria, and [context pointers](https://ai9k.vercel.app/en/context-pointer) to the relevant files and decisions — enough that the session can start working without re-deriving what the last one knew.\n\nThe dependency graph is also what unlocks parallelism. Independent tickets — the leaves of the graph — can each run in their own session at the same time. This is an effective way of running multiple agents at once. In a [software factory](https://ai9k.vercel.app/en/software-factory), a ticket being marked ready is itself the trigger that starts its session.","usage":"\"Where do I start on the migration spec?\"\n\n\"Look at the ticket graph — the schema change blocks the backfill, the backfill blocks the API switch. Pick a leaf and run a session on it.\"","translated":true}}},{"slug":"compaction","term":"Compaction","section":5,"position":51,"links":["handoff","session","primary-source","secondary-source","autocompact","context-window","tool-result","harness","model","context-pointer","clearing","context"],"text":{"vi":{"name":"Nén ngữ cảnh","description":"Bàn giao làm ngay trong bộ nhớ: lịch sử phiên trước được tóm tắt và làm hạt giống cho phiên mới. Có mất mát: đổi chi tiết lấy khoảng trống.","body":"Một lần [bàn giao](https://ai9k.vercel.app/handoff) làm ngay trong bộ nhớ: lịch sử của [phiên](https://ai9k.vercel.app/session) trước được tóm tắt, và bản tóm tắt làm hạt giống cho một phiên mới. Nó có mất mát theo đúng thiết kế: bản ghi là [nguồn sơ cấp](https://ai9k.vercel.app/primary-source), bản tóm tắt là [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source), tức đổi chi tiết lấy khoảng trống. Nó được người dùng kích hoạt bằng tay, hoặc tự động qua [autocompact](https://ai9k.vercel.app/autocompact).\n\nCơ chế: [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) hữu hạn, và một phiên dài làm đầy nó. Mọi [kết quả công cụ](https://ai9k.vercel.app/tool-result), mọi tệp đã đọc, mọi hướng đi sai đều nằm lại trong lịch sử. Khi nó nặng lên, [harness](https://ai9k.vercel.app/harness) yêu cầu [mô hình](https://ai9k.vercel.app/model) tóm tắt phiên, bỏ lịch sử gốc đi, rồi gieo bản tóm tắt vào một phiên mới. Thứ gì không lọt vào bản tóm tắt thì mất khỏi ngữ cảnh. Một số harness làm mềm điều này bằng cách giữ bản ghi cũ trên đĩa và để một [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) tới nó trong bản tóm tắt. Nguồn thứ cấp liên kết ngược về nguồn sơ cấp của nó, nên một chi tiết bản tóm tắt làm mất có thể được lấy lại bằng cách đọc lại bản gốc.\n\nBản tóm tắt do mô hình viết, nên có thể dùng prompt để định hướng nó. \"Giữ lại các quyết định về schema\" khiến sản phẩm sinh ra có chủ ý hơn. Thời điểm cũng quan trọng: nén ở ranh giới giữa các giai đoạn, sau khi kế hoạch đã chốt, không phải giữa chừng công việc.\n\nĐối chiếu với [xoá ngữ cảnh](https://ai9k.vercel.app/clearing), vốn bỏ hết và bắt đầu nguội: nén ngữ cảnh cố mang những thứ cốt yếu sang; xoá ngữ cảnh đặt cược rằng chúng đã được ghi ở một nơi tốt hơn.","usage":"\"[Ngữ cảnh](https://ai9k.vercel.app/context) đang nặng dần mà mình còn phải làm cho test đạt.\"\n\n\"Nén trước khi bắt đầu. Ghi những gì phải được giữ vào prompt tóm tắt để phiên mới giữ các quyết định về schema và bỏ phần thăm dò.\"","translated":true},"en":{"description":"A handoff done in-memory: the previous session's history is summarised and seeds a fresh session. Lossy — detail traded for headroom.","body":"A [handoff](https://ai9k.vercel.app/en/handoff) done in-memory: the previous [session](https://ai9k.vercel.app/en/session)'s history is summarised, and the summary seeds a fresh session. Lossy by design: the transcript is a [primary source](https://ai9k.vercel.app/en/primary-source), the summary a [secondary source](https://ai9k.vercel.app/en/secondary-source) — detail traded for headroom. Triggered manually by the user, or automatically via [autocompact](https://ai9k.vercel.app/en/autocompact).\n\nThe mechanism: the [context window](https://ai9k.vercel.app/en/context-window) is finite, and a long session fills it — every [tool result](https://ai9k.vercel.app/en/tool-result), every file read, every wrong turn stays in history. When it gets heavy, the [harness](https://ai9k.vercel.app/en/harness) asks the [model](https://ai9k.vercel.app/en/model) to summarise the session, throws the original history away, and seeds a fresh session with the summary. Whatever didn't make it into the summary is gone from the context. Some harnesses soften this by keeping the old transcript on disk and leaving a [context pointer](https://ai9k.vercel.app/en/context-pointer) to it in the summary — the secondary source links back to its primary source, so a detail the summary lost can be recovered by re-reading the original.\n\nThe summary is written by the model, so it can be prompted. \"Preserve the schema decisions\" makes the generated artifact more deliberate. Timing matters too — compact at a phase boundary, after the plan is settled, not mid-task.\n\nContrast with [clearing](https://ai9k.vercel.app/en/clearing), which drops everything and starts cold: compaction tries to carry the essentials across; clearing bets they're already written down somewhere better.","usage":"\"[Context](https://ai9k.vercel.app/en/context)'s getting heavy and I still have the test pass to do.\"\n\n\"Compact before you start — write what must survive into the summary prompt so the new session keeps the schema decisions and drops the exploration.\"","translated":true}}},{"slug":"autocompact","term":"Autocompact","section":5,"position":52,"links":["compaction","harness","context-window","model","session","agent","handoff-artifact","turn"],"text":{"vi":{"description":"Nén ngữ cảnh do harness tự động kích hoạt khi cửa sổ ngữ cảnh sắp đầy.","body":"[Nén ngữ cảnh](https://ai9k.vercel.app/compaction) do [harness](https://ai9k.vercel.app/harness) tự động kích hoạt khi [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) sắp đầy.\n\nHarness theo dõi cửa sổ ngữ cảnh đầy tới đâu. Khi vượt một ngưỡng, thường quanh 80%, nó dừng lại, yêu cầu [mô hình](https://ai9k.vercel.app/model) tóm tắt [phiên](https://ai9k.vercel.app/session) tới lúc đó, rồi gieo bản tóm tắt vào một phiên mới. Công việc sau đó tiếp tục như chưa có gì xảy ra.\n\nChỉ có điều là đã có chuyện xảy ra. Nén ngữ cảnh có mất mát, và autocompact gây mất mát vào thời điểm bạn không chọn. Nén bằng tay diễn ra ở ranh giới giữa các giai đoạn, khi bạn nói được cho mô hình cần giữ gì. Autocompact nổ giữa chừng công việc, bất cứ khi nào chạm ngưỡng, có thể là giữa một đợt refactor, và bản tóm tắt tự quyết định quyết định nào của bạn đáng giữ. Triệu chứng kinh điển: [agent](https://ai9k.vercel.app/agent) tự tin làm tiếp nhưng đã âm thầm quên một ràng buộc bạn đặt ra một giờ trước, và bạn chỉ nhận ra khi công việc của nó bắt đầu trái với ràng buộc đó.\n\nCách phòng là đừng để nó nổ. Theo dõi chỉ báo ngữ cảnh và nén bằng tay ở một ranh giới tự nhiên, hoặc ghi các quyết định vào một tài liệu kế hoạch hay [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) trên đĩa, nơi không bản tóm tắt nào làm mất được. Phần lớn harness cũng cho bạn tuỳ chỉnh vùng đệm: dời ngưỡng sớm hơn hoặc muộn hơn, hoặc tắt hẳn autocompact, để bạn chỉnh được mình giữ bao nhiêu khoảng trống trước khi nó nổ.","usage":"\"Hình như nó không nhớ lúc nãy mình đã quyết định gì về schema.\"\n\n\"Autocompact đã nổ giữa các [lượt](https://ai9k.vercel.app/turn). Các quyết định ban đầu bị tóm tắt lại và chắc mình đã mất gì đó. Nạp lại tài liệu kế hoạch, hoặc lần sau nén bằng tay để bạn kiểm soát cái gì được giữ.\"","translated":true},"en":{"description":"Compaction triggered automatically by the harness when the context window approaches full.","body":"[Compaction](https://ai9k.vercel.app/en/compaction) triggered automatically by the [harness](https://ai9k.vercel.app/en/harness) when the [context window](https://ai9k.vercel.app/en/context-window) approaches full.\n\nThe harness watches how full the context window is. When it crosses a threshold — often around 80% — it pauses, asks the [model](https://ai9k.vercel.app/en/model) to summarise the [session](https://ai9k.vercel.app/en/session) so far, and seeds a fresh session with the summary. Work then continues as if nothing happened.\n\nExcept something did happen. Compaction is lossy, and autocompact is lossy at a moment you didn't choose. A manual compact happens at a phase boundary, when you can tell the model what to preserve. Autocompact fires mid-task, whenever the threshold is hit — possibly halfway through a refactor, with the summary deciding for itself which of your decisions were worth keeping. The classic symptom: the [agent](https://ai9k.vercel.app/en/agent) carries on confidently but has quietly forgotten a constraint you established an hour ago, and you only notice when its work starts contradicting it.\n\nThe defence is to not let it fire. Watch the context indicator and compact manually at a natural boundary, or write decisions into a plan doc or [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) on disk, where no summary can lose them. Most harnesses also let you customise the buffer — moving the threshold earlier or later, or turning autocompact off entirely — so you can tune how much headroom you keep before it fires.","usage":"\"It doesn't seem to remember what we decided about the schema earlier.\"\n\n\"Autocompact fired between [turns](https://ai9k.vercel.app/en/turn) — the early decisions got summarised and we must have lost something. Reload the plan doc, or compact manually next time so you control what gets kept.\"","translated":true}}},{"slug":"memory-system","term":"Memory system","section":6,"position":53,"links":["agent","stateful","session","environment","context-window","clearing","harness","agentsmd","context-pointer","secondary-source","filesystem","turn","model","stateless"],"text":{"vi":{"name":"Hệ thống bộ nhớ","description":"Hệ thống cố làm cho agent có lưu trạng thái qua các phiên bằng cách ghi xuống môi trường và nạp lại lúc bắt đầu phiên.","body":"Một hệ thống cố làm cho [agent](https://ai9k.vercel.app/agent) [có lưu trạng thái](https://ai9k.vercel.app/stateful) qua các [phiên](https://ai9k.vercel.app/session). Nó ghi thông tin xuống [môi trường](https://ai9k.vercel.app/environment) trong lúc phiên chạy và nạp lại vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) khi các phiên sau bắt đầu, nhờ đó agent giữ được sự liên tục kể cả khi người dùng [xoá ngữ cảnh](https://ai9k.vercel.app/clearing) của phiên.\n\nMột hệ thống bộ nhớ có hai nửa. Đường ghi: trong phiên, agent ghi lại những gì nó học được, như một tuỳ chọn bạn nêu ra, một dữ kiện về dự án, thành các tệp trong môi trường. Đường đọc: lúc bắt đầu phiên, [harness](https://ai9k.vercel.app/harness) nạp các tệp đó, hoặc một bảng chỉ mục của chúng, trở lại cửa sổ ngữ cảnh. Nhiều harness có sẵn hệ thống bộ nhớ riêng, `/memory` của Claude Code là một ví dụ, nhưng bạn cũng tự dựng được: một thư mục ghi chú cộng một chỉ dẫn trong [AGENTS.md](https://ai9k.vercel.app/agentsmd) bảo agent tham khảo nó.\n\nCác đánh đổi của mọi nội dung luôn được nạp cũng áp dụng ở đây. Ký ức tích luỹ dần, nên phần lớn hệ thống chỉ nạp một chỉ mục mỗi mục một dòng và để phần thân sau các [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) thay vì chèn hết vào. Và ký ức là [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source), nên chúng trôi lệch: một dữ kiện ghi hồi tháng Ba được nạp với cùng độ tự tin vào tháng Sáu, khi dự án đã đi tiếp. Hệ thống bộ nhớ cần được tỉa bớt, giống như AGENTS.md.","usage":"\"Mình cứ phải nhắc lại là mình dùng Postgres chứ không phải MySQL.\"\n\n\"Dựng một hệ thống bộ nhớ đi: ghi những gì nó học được xuống [hệ thống tệp](https://ai9k.vercel.app/filesystem) ở [lượt](https://ai9k.vercel.app/turn) đầu, nạp lại lúc bắt đầu phiên. Bản thân [mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless); tầng bộ nhớ giả lập sự liên tục.\"","translated":true},"en":{"description":"A system that attempts to make an agent stateful across sessions by persisting to the environment and reloading at session start.","body":"A system that attempts to make an [agent](https://ai9k.vercel.app/en/agent) [stateful](https://ai9k.vercel.app/en/stateful) across [sessions](https://ai9k.vercel.app/en/session). Persists information into the [environment](https://ai9k.vercel.app/en/environment) during a session and reloads it into the [context window](https://ai9k.vercel.app/en/context-window) at the start of future ones, so the agent carries continuity beyond the user [clearing](https://ai9k.vercel.app/en/clearing) the session.\n\nA memory system has two halves. The write path: during a session, the agent records what it learned — a preference you stated, a fact about the project — as files in the environment. The read path: at session start, the [harness](https://ai9k.vercel.app/en/harness) loads those files, or an index of them, back into the context window. Many harnesses ship their own memory system — Claude Code's `/memory` is one — but you can also build one yourself: a directory of notes plus an instruction in [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) to consult it.\n\nThe same trade-offs as any always-loaded content apply. Memories accumulate, so most systems load a one-line index and leave the bodies behind [context pointers](https://ai9k.vercel.app/en/context-pointer) rather than inlining everything. And memories are [secondary sources](https://ai9k.vercel.app/en/secondary-source), so they drift: a fact recorded in March is loaded with equal confidence in June, after the project has moved on. A memory system needs pruning, the same way AGENTS.md does.","usage":"\"I keep having to re-tell it I'm on Postgres, not MySQL.\"\n\n\"Wire up a memory system — write what it learns to the [filesystem](https://ai9k.vercel.app/en/filesystem) on the first [turn](https://ai9k.vercel.app/en/turn), reload it at session start. The [model](https://ai9k.vercel.app/en/model) itself is [stateless](https://ai9k.vercel.app/en/stateless); the memory layer fakes continuity.\"","translated":true}}},{"slug":"agentsmd","term":"AGENTS.md","section":6,"position":54,"links":["environment","harness","context-window","session","agent","model","stateless","progressive-disclosure","token","turn","skill","context-pointer"],"text":{"vi":{"description":"Một tệp trong môi trường mà harness nạp vào cửa sổ ngữ cảnh lúc bắt đầu phiên. Đây là bản chỉ thị thường trực của dự án cho agent.","body":"Một tệp trong [môi trường](https://ai9k.vercel.app/environment) mà [harness](https://ai9k.vercel.app/harness) nạp vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) lúc bắt đầu [phiên](https://ai9k.vercel.app/session). Đây là bản chỉ thị thường trực của dự án cho [agent](https://ai9k.vercel.app/agent). Đây là quy ước dùng chung giữa các harness; một số harness còn có biến thể riêng (của Claude Code là CLAUDE.md).\n\nVì được nạp tự động, nó là một cách để bạn khỏi phải lặp lại chính mình qua các phiên. [Mô hình](https://ai9k.vercel.app/model) [không lưu trạng thái](https://ai9k.vercel.app/stateless): một lời sửa bạn đưa ra ở phiên này mất đi ở phiên sau, và rốt cuộc bạn phải nói với mọi phiên mới rằng dự án dùng pnpm, test chạy với một cờ nhất định, một thư mục là thư mục sinh tự động và không được đụng vào. Khi bạn đã sửa agent hai lần về cùng một điều, lời sửa đó là ứng viên cho một dòng trong AGENTS.md.\n\nNội dung phù hợp là bất cứ điều gì agent không suy ra được từ mã nguồn: lệnh build và test, các quy ước mà codebase không thể hiện rõ, các ràng buộc cứng (\"không bao giờ sửa client sinh tự động\"). Ngắn gọn và mang tính khẳng định. Nó là bản chỉ thị, không phải tài liệu.\n\nĐánh đổi là mọi thứ trong đó luôn được nạp. Chỉ dẫn tích luỹ dần, phần lớn không liên quan tới một việc cụ thể, và một AGENTS.md dài vừa tốn token vừa tự làm loãng mình: càng nhiều chỉ dẫn trong ngữ cảnh, mô hình càng kém tin cậy khi làm theo từng chỉ dẫn.\n\n_Nên tránh:_ dùng AGENTS.md cho nội dung nên được [tiết lộ dần](https://ai9k.vercel.app/progressive-disclosure). Bất cứ thứ gì trong đó đều trả chi phí [token](https://ai9k.vercel.app/token) ở mỗi [lượt](https://ai9k.vercel.app/turn), trong mọi phiên, dù phiên đó có cần hay không. Một bản hướng dẫn phong cách có thể đặt sau một [skill](https://ai9k.vercel.app/skill) hoặc một [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer); hãy dành AGENTS.md cho những dòng áp dụng ở mọi nơi.","usage":"\"Sao phiên nào cũng bắt đầu với 4k token đã bị đốt sẵn?\"\n\n\"Xem AGENTS.md đi. Ai đó đã dán nguyên bản hướng dẫn phong cách vào đó thay vì đặt nó sau một skill.\"","translated":true},"en":{"description":"A file in the environment that the harness loads into the context window at session start — the project's standing brief to the agent.","body":"A file in the [environment](https://ai9k.vercel.app/en/environment) that the [harness](https://ai9k.vercel.app/en/harness) loads into the [context window](https://ai9k.vercel.app/en/context-window) at [session](https://ai9k.vercel.app/en/session) start — the project's standing brief to the [agent](https://ai9k.vercel.app/en/agent). Cross-harness convention; some harnesses also have their own variant (Claude Code's is CLAUDE.md).\n\nBecause it loads automatically, it's one way to avoid repeating yourself across sessions. The [model](https://ai9k.vercel.app/en/model) is [stateless](https://ai9k.vercel.app/en/stateless) — a correction you give in one session is gone in the next, and you end up telling every fresh session that the project uses pnpm, that tests run with a particular flag, that a directory is generated and shouldn't be touched. When you've corrected the agent for the same thing twice, that correction is a candidate line for AGENTS.md.\n\nSuitable content is whatever the agent can't derive from the code: build and test commands, conventions the codebase doesn't make obvious, hard constraints (\"never edit the generated client\"). Short and declarative — it's a brief, not documentation.\n\nThe trade-off is that everything in it is always loaded. Instructions accumulate, most of them irrelevant to any given task, and a long AGENTS.md both costs tokens and dilutes itself — the more instructions in context, the less reliably the model follows any one of them.\n\n_Avoid:_ using AGENTS.md for content that should be [progressively disclosed](https://ai9k.vercel.app/en/progressive-disclosure) — anything in it pays a [token](https://ai9k.vercel.app/en/token) cost every [turn](https://ai9k.vercel.app/en/turn), in every session, whether or not that session needs it. A style guide can go behind a [skill](https://ai9k.vercel.app/en/skill) or a [context pointer](https://ai9k.vercel.app/en/context-pointer) instead; keep AGENTS.md for the lines that apply everywhere.","usage":"\"Why is every session starting with 4k tokens already burned?\"\n\n\"Check AGENTS.md — someone pasted the entire style guide in there instead of putting it behind a skill.\"","translated":true}}},{"slug":"progressive-disclosure","term":"Progressive disclosure","section":6,"position":55,"links":["context","agent","context-pointer","token","input-tokens","turn","attention-budget","agentsmd","skill","harness","session"],"text":{"vi":{"name":"Tiết lộ dần","description":"Chỉ nạp phần ngữ cảnh agent cần ngay lúc này, kèm con trỏ ngữ cảnh tới phần còn lại. Mượn từ thiết kế giao diện.","body":"Chỉ nạp phần [ngữ cảnh](https://ai9k.vercel.app/context) mà [agent](https://ai9k.vercel.app/agent) cần ngay lúc này, kèm các [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) tới phần còn lại (tiết lộ dần). Khái niệm này mượn từ thiết kế giao diện, nơi nó nghĩa là chỉ hiển thị cho người dùng các nút điều khiển liên quan tới việc đang làm và giấu phần còn lại sau một cú nhấp.\n\nKỹ thuật này tồn tại vì ngữ cảnh tốn chi phí hai lần. Mỗi [token](https://ai9k.vercel.app/token) nạp sẵn đều được tính là [token đầu vào](https://ai9k.vercel.app/input-tokens) ở mỗi [lượt](https://ai9k.vercel.app/turn), và mỗi token đều tiêu [ngân sách chú ý](https://ai9k.vercel.app/attention-budget) dù agent có cần nó hay không. Một [AGENTS.md](https://ai9k.vercel.app/agentsmd) nhồi đầy bản hướng dẫn phong cách, quy trình triển khai và quy ước cơ sở dữ liệu khiến agent làm kém đi ở tất cả những việc đó: các chỉ dẫn quan trọng cho việc hiện tại bị pha loãng bởi những chỉ dẫn không liên quan. Dấu hiệu nhận biết là agent phớt lờ những quy tắc mà bạn biết có trong ngữ cảnh của nó: chúng có ở đó, nhưng bị vùi lấp.\n\nTiết lộ dần đảo ngược điều này. Giữ tầng luôn được nạp thật nhỏ: mỗi chủ đề một câu và một con trỏ tới nơi chứa chi tiết. Agent đọc bản hướng dẫn phong cách khi viết component, đọc quy trình triển khai khi triển khai, và không đọc cái nào khi sửa một bài test. [Skill](https://ai9k.vercel.app/skill) là mẫu hình này được dựng sẵn trong [harness](https://ai9k.vercel.app/harness): một mô tả ngắn được nạp ở mọi [phiên](https://ai9k.vercel.app/session), còn chỉ dẫn đầy đủ chỉ được nạp khi được kích hoạt.","usage":"\"Mình có nên đổ nguyên bản hướng dẫn phong cách vào AGENTS.md không?\"\n\n\"Không, hãy tiết lộ dần. Đưa bản hướng dẫn phong cách thành một skill mà agent nạp khi thực sự cần viết component. AGENTS.md thì lượt nào cũng trả chi phí token.\"","translated":true},"en":{"description":"Loading only the context an agent needs right now, with context pointers to the rest. Borrowed from UI design.","body":"Loading only the [context](https://ai9k.vercel.app/en/context) an [agent](https://ai9k.vercel.app/en/agent) needs right now, with [context pointers](https://ai9k.vercel.app/en/context-pointer) to the rest. Borrowed from UI design, where it means showing users only the controls relevant to their current task and hiding the rest behind a click.\n\nThe technique exists because context is a cost twice over. Every [token](https://ai9k.vercel.app/en/token) loaded up front is billed as [input tokens](https://ai9k.vercel.app/en/input-tokens) on every [turn](https://ai9k.vercel.app/en/turn), and every token spends [attention budget](https://ai9k.vercel.app/en/attention-budget) whether the agent needs it or not. An [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) stuffed with the full style guide, deployment runbook, and database conventions makes the agent worse at all of them — the instructions that matter for the current task are diluted by the ones that don't. The tell is an agent that ignores rules you know are in its context: they're in there, but buried.\n\nProgressive disclosure inverts this. Keep the always-loaded layer small — a sentence per topic and a pointer to where the detail lives. The agent reads the style guide when it's writing a component, the deployment runbook when it's deploying, and neither when it's fixing a test. [Skills](https://ai9k.vercel.app/en/skill) are the pattern built into the [harness](https://ai9k.vercel.app/en/harness): a short description loaded every [session](https://ai9k.vercel.app/en/session), the full instructions only when triggered.","usage":"\"Should I dump the entire style guide into AGENTS.md?\"\n\n\"No — progressive disclosure. Reference the style guide as a skill the agent loads when it actually needs to write a component. AGENTS.md pays the token cost every turn.\"","translated":true}}},{"slug":"context-pointer","term":"Context pointer","section":6,"position":56,"links":["agent","context-window","progressive-disclosure","token","agentsmd","session","tool-call","skill","home-repo","secondary-source","primary-source"],"text":{"vi":{"name":"Con trỏ ngữ cảnh","description":"Một lời nhắc trong tài liệu này trỏ tới tài liệu khác, để agent chỉ kéo nó vào ngữ cảnh khi công việc đòi hỏi.","body":"Một lời nhắc trong tài liệu này trỏ tới tài liệu khác, để [agent](https://ai9k.vercel.app/agent) chỉ kéo nó vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) khi công việc đòi hỏi. Đây là đơn vị dựng nên [tiết lộ dần](https://ai9k.vercel.app/progressive-disclosure).\n\nLý do dùng con trỏ (thay vì chèn thẳng nội dung) là chi phí. Một con trỏ là một dòng trong cửa sổ ngữ cảnh. Tài liệu đằng sau nó có thể dài hàng nghìn [token](https://ai9k.vercel.app/token), nhưng các token đó không tốn gì cho tới khi agent thực sự đi theo con trỏ. Chèn một quy trình 2.000 token vào [AGENTS.md](https://ai9k.vercel.app/agentsmd) thì [phiên](https://ai9k.vercel.app/session) nào cũng trả tiền cho nó; thay bằng \"quy trình deploy: xem `internal/deploy.md`\" thì chỉ những phiên có deploy mới nạp nó. Agent đi theo con trỏ bằng một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call) khi công việc khớp.\n\nMột con trỏ cần hai phần để hoạt động: một đường dẫn ổn định, và đủ mô tả để agent biết khi nào đáng đi theo. Một đường dẫn trơ trọi là con trỏ mà agent không có lý do gì để theo; \"xem `internal/deploy.md`\" mà không gợi ý bên trong có gì sẽ bị một phiên đang cần nó bỏ qua. Hãy viết dòng đó sao cho khớp với cách công việc xuất hiện: \"release, deploy hoặc rollback: đọc `internal/deploy.md` trước\".\n\nĐể ý thì thấy con trỏ ở khắp nơi: các dòng trong AGENTS.md, mô tả của [skill](https://ai9k.vercel.app/skill) (harness nạp phần mô tả; phần thân skill chờ phía sau), tên tệp trong danh sách thư mục, liên kết giữa các tài liệu, các dòng trong AGENTS.md của một [Home Repo](https://ai9k.vercel.app/home-repo) nêu tên từng repo khác của bạn.\n\nCon trỏ cũng có thể nối một [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source) về [nguồn sơ cấp](https://ai9k.vercel.app/primary-source) mà nó được rút ra: bản tóm tắt khi nén nêu tên bản ghi gốc, tài liệu nêu tên tệp nguồn nó mô tả. Nhờ vậy phần mất mát của nguồn thứ cấp lấy lại được: khi bản tóm tắt hoá ra không đủ, agent đi theo con trỏ và đọc bản gốc, thay vì làm việc từ những gì bản tóm tắt còn giữ.\n\n_Nên tránh:_ \"tham chiếu\" thì quá khô, không cho thấy rằng đi theo nó sẽ kéo thêm ngữ cảnh vào. \"Cổng dịch chuyển\" thì quá hoa mỹ.","usage":"\"AGENTS.md đang phình to quá.\"\n\n\"Phần lớn trong đó nên là con trỏ ngữ cảnh, không phải nội dung. Giữ các quy tắc luôn áp dụng ở dạng chèn thẳng; chuyển quy trình deploy và bản hướng dẫn phong cách thành skill rồi để lại một con trỏ ngữ cảnh.\"","translated":true},"en":{"description":"A mention in one document that points to another, so the agent can pull it into context only when the task calls for it.","body":"A mention in one document that points to another, so the [agent](https://ai9k.vercel.app/en/agent) can pull it into the [context window](https://ai9k.vercel.app/en/context-window) only when the task calls for it. The unit [progressive disclosure](https://ai9k.vercel.app/en/progressive-disclosure) is built from.\n\nThe reason to use a pointer (instead of inlining the content) is cost. A pointer is one line in the context window. The document behind it might be thousands of [tokens](https://ai9k.vercel.app/en/token), but those tokens cost nothing until the agent actually follows the pointer. Inline a 2,000-token runbook in [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) and every [session](https://ai9k.vercel.app/en/session) pays for it; replace it with \"deploy process: see `internal/deploy.md`\" and only the sessions that deploy ever load it. The agent follows the pointer with a [tool call](https://ai9k.vercel.app/en/tool-call) when the task matches.\n\nA pointer needs two parts to work: a stable path, and enough description for the agent to know when following it is worth it. A bare path is a pointer the agent has no reason to follow; \"see `internal/deploy.md`\" with no hint of what's inside gets skipped by a session that needed it. Write the line so it matches how tasks present: \"release, deploy, or rollback — read `internal/deploy.md` first\".\n\nPointers are everywhere once you look: lines in AGENTS.md, [skill](https://ai9k.vercel.app/en/skill) descriptions (the harness loads the description; the skill body waits behind it), filenames in a directory listing, links between docs, the lines in a [Home Repo](https://ai9k.vercel.app/en/home-repo)'s AGENTS.md that name each of your other repos.\n\nA pointer can also tie a [secondary source](https://ai9k.vercel.app/en/secondary-source) back to the [primary source](https://ai9k.vercel.app/en/primary-source) it was derived from — the compaction summary that names the original transcript, the doc that names the source file it describes. This makes the secondary source's lossiness recoverable: when the summary turns out not to be enough, the agent follows the pointer and reads the original, instead of working from whatever the summary kept.\n\n_Avoid:_ \"reference\" — too dry; doesn't convey that following it pulls more context in. \"Portal\" — too florid.","usage":"\"AGENTS.md is getting huge.\"\n\n\"Most of it should be context pointers, not content. Keep the always-on rules inline; turn the deploy runbook and the style guide into skills and leave a context pointer behind.\"","translated":true}}},{"slug":"skill","term":"Skill","section":6,"position":57,"links":["environment","context-pointer","context-window","progressive-disclosure","harness","agent","context","token","agentsmd","session","tool","turn"],"text":{"vi":{"description":"Một năng lực dạy được, đóng gói thành một đơn vị, nằm ngoài cửa sổ ngữ cảnh cho tới khi một con trỏ ngữ cảnh kéo nó vào cho việc đang làm.","body":"Một năng lực dạy được, đóng gói thành một đơn vị: các chỉ dẫn và tài nguyên để làm tốt một việc, nằm trong [môi trường](https://ai9k.vercel.app/environment) cho tới khi một [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer) kéo nó vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) cho việc đang làm. Đây là đơn vị của [tiết lộ dần](https://ai9k.vercel.app/progressive-disclosure) trong một [harness](https://ai9k.vercel.app/harness).\n\nSkill là một chuẩn mở, được định nghĩa tại [agentskills.io](https://agentskills.io). Chuẩn này ban đầu do Anthropic phát triển và sau đó được phần lớn harness lớn áp dụng, nên một skill viết một lần chạy được trên nhiều harness. Định dạng là một thư mục chứa:\n\n- Một tệp `SKILL.md`: siêu dữ liệu (tối thiểu là tên và mô tả) cộng với chính các chỉ dẫn\n- Tuỳ chọn: các script mà [agent](https://ai9k.vercel.app/agent) chạy được\n- Tuỳ chọn: các mẫu và tài liệu tham khảo mà chỉ dẫn trỏ tới\n\nMặc định chỉ có tên và mô tả nằm trong [ngữ cảnh](https://ai9k.vercel.app/context). Khi công việc của agent khớp, nó nạp phần còn lại. Cho tới lúc đó, skill hầu như không chiếm chỗ: một hai câu [token](https://ai9k.vercel.app/token), dù chỉ dẫn đầy đủ của nó lớn tới đâu.\n\nĐiều này phân biệt skill với [AGENTS.md](https://ai9k.vercel.app/agentsmd), thứ được nạp vào mọi [phiên](https://ai9k.vercel.app/session) bất kể công việc. Skill được đọc khi một loại việc cụ thể xuất hiện, như release, dựng khung một dịch vụ mới, viết một migration, và bị bỏ qua vào những lúc khác.\n\n_Nên tránh:_ \"[công cụ](https://ai9k.vercel.app/tool)\". Công cụ là thứ agent _gọi_; skill là chỉ dẫn agent _đọc_.","usage":"\"Mình nên đặt quy trình deploy ở đâu?\"\n\n\"Làm thành skill. Agent chỉ nạp nó khi công việc liên quan tới deploy. Để trong AGENTS.md thì nó đốt token ở mỗi [lượt](https://ai9k.vercel.app/turn) cho một thứ mình dùng mỗi tuần một lần.\"","translated":true},"en":{"description":"A teachable capability bundled as a unit — kept out of the context window until a context pointer pulls it in for the task at hand.","body":"A teachable capability bundled as a unit — instructions and resources for doing one task well, kept in the [environment](https://ai9k.vercel.app/en/environment) until a [context pointer](https://ai9k.vercel.app/en/context-pointer) pulls it into the [context window](https://ai9k.vercel.app/en/context-window) for the task at hand. The unit of [progressive disclosure](https://ai9k.vercel.app/en/progressive-disclosure) in a [harness](https://ai9k.vercel.app/en/harness).\n\nSkills are an open standard, defined at [agentskills.io](https://agentskills.io) — originally developed by Anthropic and since adopted by most major harnesses, so a skill written once works across them. The format is a folder containing:\n\n- A `SKILL.md` file — metadata (a name and description, at minimum) plus the instructions themselves\n- Optionally, scripts the [agent](https://ai9k.vercel.app/en/agent) can run\n- Optionally, templates and reference material the instructions point to\n\nOnly the name and description sit in [context](https://ai9k.vercel.app/en/context) by default. When the agent's task matches, it loads the rest. Until then, the skill takes up almost no room — a sentence or two of [tokens](https://ai9k.vercel.app/en/token), however large its full instructions are.\n\nThis distinguishes skills from [AGENTS.md](https://ai9k.vercel.app/en/agentsmd), which is loaded into every [session](https://ai9k.vercel.app/en/session) regardless of the task. A skill is read when a particular kind of work comes up — releasing, scaffolding a new service, writing a migration — and ignored the rest of the time.\n\n_Avoid:_ \"[tool](https://ai9k.vercel.app/en/tool)\" — a tool is what the agent _calls_; a skill is instructions it _reads_.","usage":"\"Where should I put the deploy runbook?\"\n\n\"As a skill — the agent loads it only when the task involves deploys. In AGENTS.md it'd burn tokens on every [turn](https://ai9k.vercel.app/en/turn) for something we use weekly.\"","translated":true}}},{"slug":"subagent","term":"Subagent","section":6,"position":58,"links":["agent","tool-call","session","context-window","tool-result","handoff","context","secondary-source"],"text":{"vi":{"description":"Một agent do agent khác sinh ra qua lệnh gọi công cụ. Chạy trong phiên riêng, trả về một kết quả công cụ. Không sinh thêm subagent được.","body":"Một [agent](https://ai9k.vercel.app/agent) do agent khác sinh ra qua một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call). Nó chạy trong [phiên](https://ai9k.vercel.app/session) riêng với [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) riêng, và trả về một [kết quả công cụ](https://ai9k.vercel.app/tool-result) duy nhất. Nó khác với [bàn giao](https://ai9k.vercel.app/handoff): agent cha chủ đích chờ kết quả trả về; bàn giao thì không có đường quay lại. **Không sinh thêm subagent được**: cây chỉ sâu một tầng. Subagent tồn tại để cách ly [ngữ cảnh](https://ai9k.vercel.app/context), không phải để dựng nên các tầng bậc.\n\nMục đích là giữ những việc nhiều nhiễu ở ngoài ngữ cảnh của agent cha. Một lần tìm kiếm rộng hay một chuyến đọc tệp dài tạo ra hàng trang kết quả công cụ, phần lớn chỉ quan trọng cho tới khi tìm ra câu trả lời. Chạy trong agent cha thì tất cả nằm lại trong ngữ cảnh của nó cho tới hết phiên. Chạy trong subagent thì nhiễu lấp vào một cửa sổ dùng xong bỏ, và chỉ bản báo cáo cuối rơi vào ngữ cảnh của agent cha. Bản báo cáo là một [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source): agent cha nhận lời kể của subagent về những gì nó tìm thấy, không phải kết quả thô, nên điều gì bản báo cáo bỏ sót thì vô hình với agent cha.\n\nSubagent cũng chạy đồng thời được: agent cha có thể toả vài subagent cùng lúc cho các phần việc độc lập.","usage":"\"Kết quả grep đang làm nổ ngữ cảnh của mình.\"\n\n\"Sinh một subagent để tìm. Nó sẽ đốt cửa sổ ngữ cảnh riêng cho phần nhiễu và báo về đúng hai đường dẫn tệp bạn thực sự cần.\"","translated":true},"en":{"description":"An agent spawned by another agent via a tool call. Runs in its own session, reports a single tool result. Cannot spawn further subagents.","body":"An [agent](https://ai9k.vercel.app/en/agent) spawned by another agent via a [tool call](https://ai9k.vercel.app/en/tool-call). Runs in its own [session](https://ai9k.vercel.app/en/session) with its own [context window](https://ai9k.vercel.app/en/context-window), and reports a single [tool result](https://ai9k.vercel.app/en/tool-result) back. Distinct from a [handoff](https://ai9k.vercel.app/en/handoff) — the parent specifically expects a return; a handoff has no return path. **Cannot spawn further subagents** — the tree is one level deep. Subagents exist to isolate [context](https://ai9k.vercel.app/en/context), not to compose hierarchies.\n\nThe point is to keep noisy work out of the parent's context. A broad search or a long file-reading expedition produces pages of tool results, most of which matter only long enough to find the answer. Run inside the parent and all of it stays in the parent's context for the rest of the session. Run inside a subagent and the noise fills a disposable window instead — only the final report lands in the parent's context. The report is a [secondary source](https://ai9k.vercel.app/en/secondary-source): the parent gets the subagent's account of what it found, not the raw results, so anything the report leaves out is invisible to the parent.\n\nSubagents also run concurrently — a parent can fan several out at once over independent pieces of work.","usage":"\"The grep results are blowing out my context.\"\n\n\"Spawn a subagent to do the search — it'll burn its own context window on the noise and report back the two file paths you actually need.\"","translated":true}}},{"slug":"home-repo","term":"Home Repo","section":6,"position":59,"links":["skill","agentsmd","agent","grilling","session","context-pointer","progressive-disclosure","software-factory","sandbox"],"text":{"vi":{"description":"Một repo chứa các skill, AGENTS.md và tài liệu dùng chung của bạn, và trỏ tới các repo khác. Bạn chạy agent từ đó.","body":"Một repository chứa các [skill](https://ai9k.vercel.app/skill), [AGENTS.md](https://ai9k.vercel.app/agentsmd) và tài liệu dùng chung của bạn, và trỏ tới các repo khác của bạn. Bạn chạy [agent](https://ai9k.vercel.app/agent) trong Home Repo, và nó mở hoặc clone các repo khác khi công việc cần.\n\nKhi một dự án trải trên nhiều repo, một agent khởi động trong một repo chỉ thấy repo đó. Mỗi repo rốt cuộc có bản sao riêng của các skill và phần thiết lập agent, các bản sao trôi lệch nhau, và việc [grilling](https://ai9k.vercel.app/grilling) một tính năng đi qua nhiều repo diễn ra mà thiếu bức tranh tổng thể. Home Repo giữ một bản duy nhất của phần dùng chung, và các [phiên](https://ai9k.vercel.app/session) bắt đầu ở đó thay vì bên trong một repo đơn lẻ.\n\n| Nằm trong Home Repo                                                          | Ở lại trong từng repo               |\n| ---------------------------------------------------------------------------- | ----------------------------------- |\n| Các skill dùng cho nhiều repo                                                | Mã nguồn của repo                   |\n| AGENTS.md, kèm một con trỏ tới từng repo                                     | AGENTS.md riêng, lệnh build và test |\n| Tài liệu dùng chung: chuẩn viết mã, bảng thuật ngữ, quyết định toàn hệ thống | Tài liệu chỉ nói về repo đó         |\n| Công cụ, chẳng hạn một CLI nối agent với các dịch vụ bên ngoài               |                                     |\n\nMỗi con trỏ là một [con trỏ ngữ cảnh](https://ai9k.vercel.app/context-pointer): một dòng nêu tên repo, nó nằm ở đâu trên đĩa, và clone từ đâu nếu chưa có. Khoảng 20 repo thì cách này chạy ổn. Tới vài trăm repo, mỗi repo một con trỏ là quá nhiều để agent chọn, nên hãy trỏ tới một tệp cho mỗi mảng nghiệp vụ và liệt kê các repo của mảng đó trong tệp ấy ([tiết lộ dần](https://ai9k.vercel.app/progressive-disclosure)). Tới hàng nghìn repo, các skill có đủ nhiều bên dùng để một chợ skill phù hợp hơn.\n\nHome Repo thay cho monorepo khi bạn không thể có monorepo: khi bạn trộn repo công khai với repo riêng tư, hoặc khi một nhóm không chịu dùng monorepo. Với một nhóm, Home Repo là thứ các bạn dùng chung. Trong một [nhà máy phần mềm](https://ai9k.vercel.app/software-factory), Home Repo được đặt vào [sandbox](https://ai9k.vercel.app/sandbox) và clone các repo khác khi cần.\n\n_Nên tránh:_ \"agent repo\" và \"meta-repo\", các tên cũ hơn của cùng thứ này.","usage":"\"Mình cứ chép cùng mấy skill đó vào từng repo, và các bản sao đã lệch nhau.\"\n\n\"Chuyển chúng vào một Home Repo. Một bản duy nhất của các skill, AGENTS.md trỏ tới từng repo, và bạn bắt đầu các phiên ở đó.\"","translated":true},"en":{"description":"One repo that holds your skills, AGENTS.md and shared docs, and points at your other repos. You run your agent from it.","body":"A repository that holds your [skills](https://ai9k.vercel.app/en/skill), your [AGENTS.md](https://ai9k.vercel.app/en/agentsmd) and your shared docs, and points at your other repos. You run your [agent](https://ai9k.vercel.app/en/agent) in the Home Repo, and it opens or clones the other repos as the task needs them.\n\nWhen a project spans several repos, an agent started in one of them sees only that repo. Each repo ends up with its own copy of the skills and the agent setup, the copies drift apart, and [grilling](https://ai9k.vercel.app/en/grilling) a feature that crosses repos happens without the whole overview. A Home Repo keeps one copy of the shared material, and [sessions](https://ai9k.vercel.app/en/session) start there rather than inside a single repo.\n\n| Lives in the Home Repo                                              | Stays in each repo                         |\n| ------------------------------------------------------------------- | ------------------------------------------ |\n| Skills used across repos                                            | The repo's code                            |\n| AGENTS.md, with a pointer to each repo                              | Its own AGENTS.md, build and test commands |\n| Shared docs: coding standards, a glossary, system-wide decisions    | Docs about that repo alone                 |\n| Tooling, such as a CLI that connects the agent to external services |                                            |\n\nEach pointer is a [context pointer](https://ai9k.vercel.app/en/context-pointer): one line naming the repo, where it lives on disk, and where to clone it from if it's missing. About 20 repos works fine this way. At a few hundred, one pointer per repo is too many for the agent to choose between, so point at one file per area of the business and list that area's repos in it ([progressive disclosure](https://ai9k.vercel.app/en/progressive-disclosure)). At thousands of repos, the skills have enough consumers that a skills marketplace fits better.\n\nA Home Repo replaces a monorepo when you can't have one: when you mix public and private repos, or when a team won't adopt a monorepo. For a team, the Home Repo is the thing you share. In a [software factory](https://ai9k.vercel.app/en/software-factory), the Home Repo goes in the [sandbox](https://ai9k.vercel.app/en/sandbox) and clones the other repos as it needs them.\n\n_Avoid:_ \"agent repo\" and \"meta-repo\", older names for the same thing.","usage":"\"I keep copying the same skills into every repo, and the copies have drifted.\"\n\n\"Move them into a Home Repo. One copy of the skills, AGENTS.md points at each repo, and you start your sessions there.\"","translated":true}}},{"slug":"human-in-the-loop","term":"Human-in-the-loop","section":7,"position":60,"links":["agent","session","afk","grilling","prototyping","automated-check","human-review","software-factory"],"text":{"vi":{"name":"Có con người trong vòng lặp","description":"Kiểu làm việc trong đó một hoặc nhiều người cặp cùng agent trong suốt phiên: xem lại, chỉnh hướng hoặc cộng tác theo thời gian thực.","body":"Kiểu làm việc trong đó một hoặc nhiều người cặp cùng [agent](https://ai9k.vercel.app/agent) trong suốt một [phiên](https://ai9k.vercel.app/session): xem lại, chỉnh hướng hoặc cộng tác theo thời gian thực (có con người trong vòng lặp). Con người có mặt và tham gia, không chỉ đứng gác từng hành động.\n\nĐối lập là làm việc kiểu [AFK](https://ai9k.vercel.app/afk), khi agent chạy không ai trông và bạn đánh giá kết quả sau đó. Có con người trong vòng lặp nghĩa là bắt vấn đề khi chúng còn rẻ: bạn thấy agent với lấy nhầm tệp, hiểu sai yêu cầu, hoặc bắt đầu đi vào ngõ cụt, và bạn chỉnh hướng nó bằng một câu, thay vì phát hiện hai mươi phút làm việc tự tin dựng trên sai lầm đó. Agent không biết một cách đáng tin khi nào mình lệch hướng; để một mình, nó thường đi tiếp thay vì dừng lại hỏi.\n\nKiểu nào phù hợp thì tuỳ việc. Việc đã mô tả rõ, rủi ro thấp, dễ kiểm chứng thì hợp với AFK. Việc mơ hồ, không đảo ngược được, hoặc việc mà bạn khó xem lại kết quả hoàn chỉnh, như một lần migration schema, một quyết định thiết kế khó, bất cứ thứ gì đụng tới production, thì hợp với việc ở lại trong vòng lặp. Về cơ bản, phán đoán ở đây là: một bước đi sai đắt tới đâu, và bạn sẽ bắt được nó muộn tới mức nào?\n\nCó những việc tự bản chất là trong vòng lặp, vì phản ứng của bạn chính là đầu vào. [Grilling](https://ai9k.vercel.app/grilling) chỉ hiệu quả khi bạn có mặt để trả lời câu hỏi; [làm bản mẫu](https://ai9k.vercel.app/prototyping) chỉ hiệu quả khi bạn có mặt để phản ứng với sản phẩm.\n\nỞ lại trong vòng lặp tốn sự chú ý của bạn, và đó là tài nguyên khan hiếm. Một phần của việc dùng agent giỏi hơn là đưa thêm nhiều việc ra khỏi vòng lặp một cách an toàn: bằng kế hoạch, [kiểm tra tự động](https://ai9k.vercel.app/automated-check), và [review của con người](https://ai9k.vercel.app/human-review) ở cuối thay cho giám sát từ đầu tới cuối. Một [nhà máy phần mềm](https://ai9k.vercel.app/software-factory) đi xa hơn bằng cách khởi động phiên từ các trigger, nên ngay cả việc bắt đầu công việc cũng không cần tới bạn.","usage":"\"Chạy cái này AFK qua đêm nhé?\"\n\n\"Không, đây là migration schema, giữ con người trong vòng lặp. Mình muốn thấy từng bước và chỉnh hướng nếu nó chọn nhầm cột để backfill.\"","translated":true},"en":{"description":"A working pattern where one or more humans pair with the agent during a session — reviewing, redirecting, or collaborating in real time.","body":"A working pattern where one or more humans pair with the [agent](https://ai9k.vercel.app/en/agent) during a [session](https://ai9k.vercel.app/en/session) — reviewing, redirecting, or collaborating in real time. The human is present and engaged, not just gating individual actions.\n\nThe contrast is with [AFK](https://ai9k.vercel.app/en/afk) work, where the agent runs unattended and you judge the result afterwards. Human-in-the-loop means catching problems while they're still cheap: you see the agent reach for the wrong file, misread the requirement, or start down a dead end, and you redirect it in one sentence — rather than discovering twenty minutes of confident work built on that mistake. Agents don't reliably know when they're off track; left alone, they tend to push forward rather than stop and ask.\n\nWhich pattern fits depends on the work. Well-specified, low-risk, easy-to-verify tasks suit AFK. Tasks that are ambiguous, irreversible, or where you'd struggle to review the finished result — a schema migration, a tricky design decision, anything touching production — suit staying in the loop. The judgement call is essentially: how expensive is a wrong turn, and how late would you catch it?\n\nSome work is in-the-loop by nature, because your reactions are the input. [Grilling](https://ai9k.vercel.app/en/grilling) only works with you there to answer the questions; [prototyping](https://ai9k.vercel.app/en/prototyping) only works with you there to react to the artifact.\n\nStaying in the loop costs your attention, which is the scarce resource. Part of getting better with agents is moving more work safely out of the loop — with plans, [automated checks](https://ai9k.vercel.app/en/automated-check), and [human review](https://ai9k.vercel.app/en/human-review) at the end instead of supervision throughout. A [software factory](https://ai9k.vercel.app/en/software-factory) takes this further by starting sessions from triggers, so even kicking off the work doesn't need you.","usage":"\"Run this AFK overnight?\"\n\n\"No, schema migration — keep it human-in-the-loop. I want to see each step and steer if it picks the wrong column to backfill from.\"","translated":true}}},{"slug":"afk","term":"AFK","section":7,"position":61,"links":["session","agent","ai","permission-mode","sandbox","grilling","spec","automated-check","automated-review","human-review","ax","agent-mode","filesystem"],"text":{"vi":{"description":"Kiểu làm việc trong đó người dùng khởi động một phiên rồi để agent tự chạy không ai trông (away from keyboard, rời bàn phím).","body":"Away from keyboard, tức rời bàn phím. Kiểu làm việc trong đó người dùng khởi động một [phiên](https://ai9k.vercel.app/session) rồi để [agent](https://ai9k.vercel.app/agent) tự chạy không ai trông. Đây là thứ nhân năng suất của lập trình với [AI](https://ai9k.vercel.app/ai): nhiều phiên AFK có thể chạy song song trong lúc bạn ngủ, ăn, hoặc làm việc khác. Để an toàn, nó thường đòi hỏi một [chế độ phân quyền](https://ai9k.vercel.app/permission-mode) dễ dãi cộng với [sandbox](https://ai9k.vercel.app/sandbox).\n\nKhi bạn không có mặt, agent xử lý sự mơ hồ theo cách khác. Lúc bạn đang theo dõi, một quyết định mơ hồ hiện ra thành câu hỏi và bạn trả lời; khi bạn đã rời đi, agent chọn một mặc định rồi đi tiếp, và mọi quyết định về sau đều dựng trên phỏng đoán đó. Kiểu thất bại đặc trưng là quay lại và thấy hàng giờ công việc hoàn chỉnh, tự tin, dựng trên một lựa chọn sai ở mười phút đầu. Công việc không cẩu thả. Nó mạch lạc, chỉ là mạch lạc về sai thứ.\n\nVì bạn không đưa được ý kiến trong lúc chạy, hãy đưa trước và sau. Trước: giải quyết sự mơ hồ từ đầu, bằng một phiên [grilling](https://ai9k.vercel.app/grilling), một bản [spec](https://ai9k.vercel.app/spec) viết ra, để có ít khoảng trống hơn cho agent tự lấp. Trong lúc chạy: [kiểm tra tự động](https://ai9k.vercel.app/automated-check) và [review tự động](https://ai9k.vercel.app/automated-review) thay cho sự chú ý mà bạn không dành ra, báo hỏng nhanh với những gì bắt được bằng máy. Sau: đợt chạy kết thúc ở thứ xem lại được, một PR chứ không phải thay đổi đã merge. AFK không bỏ [review của con người](https://ai9k.vercel.app/human-review); nó dồn tất cả về cuối, vì vậy thứ tới ở cuối phải đáng để review. Đây cũng là lý do [AX](https://ai9k.vercel.app/ax) quan trọng nhất trong các đợt chạy AFK: không ai theo dõi thì môi trường là chỗ dựa duy nhất của agent.\n\n_Nên tránh:_ \"background agent\". Cách gọi đó đặt trọng tâm vào máy (\"chạy nền\") thay vì kiểu làm việc của con người (\"người dùng đã rời đi\"). AFK gọi đúng điều quan trọng: người dùng không theo dõi.","usage":"\"Mình đang chạy cái này AFK: ba agent trong sandbox làm phần refactor, sáng mai review các PR.\"\n\n\"[Bypass permissions](https://ai9k.vercel.app/agent-mode) à?\"\n\n\"Ừ, [hệ thống tệp](https://ai9k.vercel.app/filesystem) chỉ đọc, không có mạng.\"","translated":true},"en":{"description":"A working pattern where the user kicks off a session and leaves the agent to run unattended (away from keyboard).","body":"Away from keyboard. A working pattern where the user kicks off a [session](https://ai9k.vercel.app/en/session) and leaves the [agent](https://ai9k.vercel.app/en/agent) to run unattended. The throughput multiplier of [AI](https://ai9k.vercel.app/en/ai) coding — many AFK sessions can run in parallel while you sleep, eat, or work on something else. Usually requires a permissive [permission mode](https://ai9k.vercel.app/en/permission-mode) plus [sandboxing](https://ai9k.vercel.app/en/sandbox) to be safe.\n\nWhen you're not there, the agent handles ambiguity differently. While you're watching, an ambiguous decision surfaces as a question and you answer it; once you've walked away, the agent picks a default and keeps going, and every later decision builds on that guess. The characteristic failure is coming back to hours of finished, confident work built on a wrong call made in the first ten minutes. The work isn't sloppy — it's coherent, just coherent about the wrong thing.\n\nSince you can't give input during the run, give it before and after instead. Before: resolve the ambiguity up front — a [grilling](https://ai9k.vercel.app/en/grilling) session, a written [spec](https://ai9k.vercel.app/en/spec) — so there are fewer gaps for the agent to fill alone. During: [automated checks](https://ai9k.vercel.app/en/automated-check) and [automated review](https://ai9k.vercel.app/en/automated-review) stand in for the attention you're not giving, failing fast on what can be caught mechanically. After: the run ends in something reviewable — a PR, not changes already merged. AFK doesn't remove [human review](https://ai9k.vercel.app/en/human-review); it defers all of it to the end, which is why what arrives at the end has to be worth reviewing. This is also why [AX](https://ai9k.vercel.app/en/ax) matters most in AFK runs — with no one watching, the environment is the only support the agent gets.\n\n_Avoid:_ \"background agent\" — centers the machine (\"running in the background\") rather than the human pattern (\"user has walked away\"). AFK names the fact that matters: the user isn't watching.","usage":"\"I'm running this AFK — three sandboxed agents on the refactor, reviewing the PRs in the morning.\"\n\n\"[Bypass permissions](https://ai9k.vercel.app/en/agent-mode)?\"\n\n\"Yeah, read-only [filesystem](https://ai9k.vercel.app/en/filesystem), no network.\"","translated":true}}},{"slug":"automated-check","term":"Automated check","section":7,"position":62,"links":["environment","agent","tool-call","context-window","ax","afk","automated-review","human-review","sandbox"],"text":{"vi":{"name":"Kiểm tra tự động","description":"Một phép kiểm chứng tất định chạy trong môi trường: test, kiểm tra kiểu, lint, build, pre-commit hook. Đạt hoặc không đạt, không phán đoán.","body":"Một phép kiểm chứng tất định chạy trong [môi trường](https://ai9k.vercel.app/environment): test, kiểm tra kiểu, lint, build, pre-commit hook. Đạt hoặc không đạt, không phán đoán. Đây là tín hiệu để [agent](https://ai9k.vercel.app/agent) tự sửa mà không cần tới ai khác. Một bài test chập chờn là một phép kiểm tra bị hỏng, không phải một thứ không phải kiểm tra; kiểm tra tự động là tất định _theo thiết kế_.\n\nTự sửa hoạt động như một vòng lặp. Agent thay đổi mã, chạy phép kiểm tra bằng một [lệnh gọi công cụ](https://ai9k.vercel.app/tool-call), và đầu ra báo lỗi rơi vào [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) của nó: một lỗi kiểu kèm tệp và dòng, một assertion không đạt kèm giá trị mong đợi và giá trị thực tế. Chừng đó đủ để agent sửa vấn đề và chạy lại phép kiểm tra, cứ thế cho tới khi đạt, không cần con người trong vòng lặp. Tính tất định là thứ khiến vòng lặp đáng tin: cùng một đoạn mã luôn cho cùng một phán quyết, nên một lần đạt có ý nghĩa. Một phép kiểm tra chập chờn đầu độc điều này: agent \"sửa\" đoạn mã vốn ổn, hoặc thử lại cho qua một lỗi thật.\n\nVì vậy các phép kiểm tra tốt là một phần lớn trong [AX](https://ai9k.vercel.app/ax) của codebase. Agent trong một repo có kiểu chặt chẽ, bộ test nhanh và linter sẽ bắt được phần lớn lỗi của chính nó trước khi bạn thấy; agent trong một repo không có những thứ đó thì đưa ra bất cứ thứ gì nó tạo ra. Khác biệt này quan trọng nhất trong các đợt chạy [AFK](https://ai9k.vercel.app/afk), nơi các phép kiểm tra là sự kiểm chứng duy nhất diễn ra trong lúc chạy. Nhưng một phép kiểm tra chỉ bắt được điều nó khẳng định. Kiểm tra xanh nghĩa là các thuộc tính được khẳng định đều đúng, không phải mã đúng. Những khoảng trống cần phán đoán là việc của [review tự động](https://ai9k.vercel.app/automated-review) và [review của con người](https://ai9k.vercel.app/human-review).\n\n_Nên tránh:_ \"feedback loop\" / \"backpressure\". Cả hai gộp kiểm tra với review. _Nên tránh:_ \"test\". Test là kiểm tra tự động, nhưng không phải kiểm tra tự động nào cũng là test.","usage":"\"Agent cứ đưa ra mã hỏng trong các đợt chạy AFK.\"\n\n\"Những kiểm tra tự động nào đang được nối vào [sandbox](https://ai9k.vercel.app/sandbox)?\"\n\n\"Chỉ có unit test.\"\n\n\"Thêm typecheck và lint. Nó sẽ tự sửa từ những thứ đó trước khi PR tới nơi.\"","translated":true},"en":{"description":"A deterministic verification that runs in the environment — tests, type checks, lints, build, pre-commit hooks. Pass/fail, no judgement.","body":"A deterministic verification that runs in the [environment](https://ai9k.vercel.app/en/environment) — tests, type checks, lints, build, pre-commit hooks. Pass/fail, no judgement. The signal an [agent](https://ai9k.vercel.app/en/agent) can self-correct from without involving anyone else. A flaky test is a broken check, not a non-check; automated checks are deterministic _by design_.\n\nSelf-correction works as a loop. The agent makes a change, runs the check as a [tool call](https://ai9k.vercel.app/en/tool-call), and the failure output lands in its [context window](https://ai9k.vercel.app/en/context-window) — a type error with a file and line, a failing assertion with expected and actual values. That's enough for the agent to fix the problem and run the check again, around and around until it passes, with no human in the loop. Determinism is what makes the loop trustworthy: the same code always produces the same verdict, so a pass means something. A flaky check poisons this — the agent \"fixes\" code that was fine, or retries past a real failure.\n\nThis is why good checks are a large part of a codebase's [AX](https://ai9k.vercel.app/en/ax). An agent in a repo with strict types, a fast test suite, and a linter catches most of its own mistakes before you see them; an agent in a repo with none of those ships whatever it produces. The difference matters most in [AFK](https://ai9k.vercel.app/en/afk) runs, where checks are the only verification happening during the run. But a check only catches what it asserts — green checks mean the asserted properties hold, not that the code is right. The judgement-shaped gaps are what [automated review](https://ai9k.vercel.app/en/automated-review) and [human review](https://ai9k.vercel.app/en/human-review) are for.\n\n_Avoid:_ \"feedback loop\" / \"backpressure\" — both lump checks together with review. _Avoid:_ \"test\" — tests are automated checks, but not all automated checks are tests.","usage":"\"The agent keeps shipping broken code in the AFK runs.\"\n\n\"What automated checks are wired into the [sandbox](https://ai9k.vercel.app/en/sandbox)?\"\n\n\"Just the unit tests.\"\n\n\"Add typecheck and lint — it'll self-correct from those before the PR ever lands.\"","translated":true}}},{"slug":"automated-review","term":"Automated review","section":7,"position":63,"links":["agent","model","system-prompt","subagent","automated-check","session","context-window","human-review","afk"],"text":{"vi":{"name":"Review tự động","description":"Một agent review công việc của agent khác, thường với mô hình hoặc system prompt khác. Không tất định: nó đưa ra một phán đoán.","body":"Một [agent](https://ai9k.vercel.app/agent) review công việc của agent khác, thường với [mô hình](https://ai9k.vercel.app/model) hoặc [system prompt](https://ai9k.vercel.app/system-prompt) khác. Không tất định: nó đưa ra một phán đoán. Nó chạy ở đâu cũng được: trước khi merge trên một PR, sau khi việc đã xong trên lịch sử commit, giữa phiên dưới dạng một [subagent](https://ai9k.vercel.app/subagent). Một LLM đóng vai giám khảo trong CI là review tự động, không phải [kiểm tra tự động](https://ai9k.vercel.app/automated-check). Thứ quyết định loại là phép khẳng định _làm gì_, không phải nó chạy ở đâu.\n\nSự tách rời khỏi agent đang làm việc là thứ khiến nó hiệu quả. Nhờ chính agent viết mã review việc của nó thì thu được rất ít: [phiên](https://ai9k.vercel.app/session) đã sinh ra lỗi cũng chứa lập luận đã sinh ra lỗi, và agent đọc lại kết luận của chính mình như lời xác nhận. Một bên review với [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) mới không có sự gắn bó đó: nó nhìn diff như một người lạ, và review dựa vào chính điều này. Một mô hình khác hoặc một system prompt riêng cho review làm điều này sắc hơn nữa: điểm mù khác nhau, và một system prompt khoanh vào điều bạn thực sự quan tâm (bảo mật, hợp đồng API, hiệu năng) thay vì một câu \"tìm vấn đề\" chung chung.\n\nNó nằm giữa các tầng review khác. Kiểm tra tự động thì tất định và bắt được những gì khẳng định được bằng máy; [review của con người](https://ai9k.vercel.app/human-review) thì đắt và khó mở rộng nhất. Review tự động ở giữa: nó bắt các vấn đề cần phán đoán, như một tên hàm gây hiểu lầm, một trường hợp biên bị sót, với chi phí của máy. Vì không tất định, nó có thể bỏ sót và báo nhầm những thứ không phải vấn đề. Hãy coi nó là một bộ lọc nâng mức sàn trước khi con người xem, không phải một cái cổng thay thế con người.\n\n_Nên tránh:_ \"AI review\" / \"agent review\". Quá mơ hồ để phân biệt với chính agent đang làm việc.","usage":"\"Bọn mình nhận quá nhiều PR tệ từ các đợt chạy [AFK](https://ai9k.vercel.app/afk).\"\n\n\"Thêm một bước review tự động trước khi merge: mô hình khác, system prompt riêng, khoanh vào bảo mật và các thay đổi hợp đồng.\"","translated":true},"en":{"description":"An agent reviewing another agent's work, often with a different model or system prompt. Non-deterministic: it forms a judgement.","body":"An [agent](https://ai9k.vercel.app/en/agent) reviewing another agent's work, often with a different [model](https://ai9k.vercel.app/en/model) or [system prompt](https://ai9k.vercel.app/en/system-prompt). Non-deterministic: it forms a judgement. Runs anywhere — pre-merge on a PR, post-hoc on commit history, mid-session as a [subagent](https://ai9k.vercel.app/en/subagent). An LLM-as-judge in CI is automated review, not an [automated check](https://ai9k.vercel.app/en/automated-check); what the assertion _does_ decides the category, not where it runs.\n\nThe separation from the working agent is what makes it work. Asking the agent that wrote the code to review its own work gets you very little — the [session](https://ai9k.vercel.app/en/session) that produced the bug also contains the reasoning that produced it, and the agent reads its own conclusions back as confirmation. A reviewer with a fresh [context window](https://ai9k.vercel.app/en/context-window) has none of that attachment: it sees the diff the way a stranger would, which is what review depends on. A different model or a review-specific system prompt sharpens this further — different blind spots, and a system prompt scoped to what you actually care about (security, API contracts, performance) rather than a vague \"look for problems\".\n\nIt slots between the other review layers. Automated checks are deterministic and catch what can be asserted mechanically; [human review](https://ai9k.vercel.app/en/human-review) is expensive and scales worst. Automated review sits in the middle: it catches judgement-shaped problems — a misleading function name, a missed edge case — at machine cost. Because it's non-deterministic, it can miss things and flag non-issues; treat it as a filter that raises the floor before a human looks, not a gate that replaces one.\n\n_Avoid:_ \"AI review\" / \"agent review\" — too vague to distinguish from the working agent itself.","usage":"\"We're getting too many bad PRs from the [AFK](https://ai9k.vercel.app/en/afk) runs.\"\n\n\"Add an automated review step before merge — different model, separate system prompt, scoped to security and contract changes.\"","translated":true}}},{"slug":"human-review","term":"Human review","section":7,"position":64,"links":["agent","secondary-source","primary-source","automated-check","automated-review","afk","human-in-the-loop"],"text":{"vi":{"name":"Review của con người","description":"Người dùng đọc mã agent tạo ra và tự đưa ra phán đoán về nó. Đọc diff thì tính; đọc bản tóm tắt thì không.","body":"Người dùng đọc mã mà [agent](https://ai9k.vercel.app/agent) tạo ra và tự đưa ra phán đoán về nó. Đọc diff hoặc các tệp đã thay đổi thì tính; đọc _lời mô tả_ của agent về việc nó đã làm thì không. Lời kể không phải là sản phẩm. Lời mô tả là một [nguồn thứ cấp](https://ai9k.vercel.app/secondary-source), do chính bên được review viết; diff là [nguồn sơ cấp](https://ai9k.vercel.app/primary-source), và review nghĩa là đọc nó.\n\nAgent làm tăng lượng mã được tạo ra, nên review trở thành nút thắt cổ chai. Một ý tưởng hữu ích là xếp lớp các chiến lược review khác nhau. [Kiểm tra tự động](https://ai9k.vercel.app/automated-check) bắt các lỗi máy móc, [review tự động](https://ai9k.vercel.app/automated-review) bắt các lỗi mô tả được, và review của con người được dành cho những gì chỉ bạn phán đoán được: thay đổi này có phải thay đổi đúng không, hướng làm có hợp với codebase không, thứ này có nên tồn tại không.\n\nReview càng sớm càng rẻ. Đọc một bản kế hoạch trước khi bắt đầu việc, hoặc một diff nhỏ giữa chừng, mất vài phút; đào bới một nhánh đã hoàn chỉnh sau một đợt chạy [AFK](https://ai9k.vercel.app/afk) thì lâu hơn. Đặt điểm kiểm tra review ở đâu là một quyết định về [con người trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop), không phải việc nghĩ tới sau cùng.\n\n_Nên tránh:_ chỉ nói \"code review\". Nó mơ hồ giữa con người và tự động.","usage":"\"Mình đã tự review kết quả của đợt chạy AFK rồi.\"\n\n\"Bạn đọc diff hay chỉ đọc bản tóm tắt?\"\n\n\"Diff. Bản tóm tắt bảo nó xoá mã chết, hoá ra hàm đó được gọi từ một tệp sinh tự động.\"","translated":true},"en":{"description":"The user reading the code the agent produced and forming a judgement on it. Reading the diff counts; reading the summary doesn't.","body":"The user reading the code the [agent](https://ai9k.vercel.app/en/agent) produced and forming a judgement on it. Reading the diff or the changed files counts; reading the agent's _description_ of what it did does not — narration is not the artifact. The description is a [secondary source](https://ai9k.vercel.app/en/secondary-source), written by the party being reviewed; the diff is the [primary source](https://ai9k.vercel.app/en/primary-source), and review means reading it.\n\nAgents raise the volume of code produced, so review becomes the bottleneck. One useful idea is layering different review strategies. [Automated checks](https://ai9k.vercel.app/en/automated-check) catch the mechanical failures, [automated review](https://ai9k.vercel.app/en/automated-review) catches the describable ones, and human review is reserved for what only you can judge — whether the change is the right change, whether the approach fits the codebase, whether this should exist at all.\n\nReview is also cheaper earlier. Reading a plan before work starts, or a small diff mid-flight, takes minutes; excavating a finished branch after an [AFK](https://ai9k.vercel.app/en/afk) run takes longer. Where you place the review checkpoint is a [human-in-the-loop](https://ai9k.vercel.app/en/human-in-the-loop) decision, not an afterthought.\n\n_Avoid:_ \"code review\" alone — ambiguous between human and automated.","usage":"\"I human-reviewed the AFK output.\"\n\n\"You read the diff or just the summary?\"\n\n\"Diff. The summary said it deleted dead code — turned out the function was called from a generated file.\"","translated":true}}},{"slug":"vibe-coding","term":"Vibe coding","section":7,"position":65,"links":["agent","human-review","automated-review","automated-check","prototyping","software-factory","dark-factory"],"text":{"vi":{"description":"Kiểu làm việc trong đó người dùng chấp nhận mã của agent mà không có review của con người. Diff được coi như hộp đen.","body":"Kiểu làm việc trong đó người dùng chấp nhận mã của [agent](https://ai9k.vercel.app/agent) mà không có [review của con người](https://ai9k.vercel.app/human-review). Diff được coi như hộp đen: điều quan trọng là chương trình có chạy đúng không, không phải bên trong có gì. [Review tự động](https://ai9k.vercel.app/automated-review) và [kiểm tra tự động](https://ai9k.vercel.app/automated-check) vẫn có thể chạy; vibe coding không nói gì về cả hai.\n\nThuật ngữ này đến từ Andrej Karpathy, người [đặt ra nó đầu năm 2025](https://x.com/karpathy/status/1886192184808149383): bạn \"buông hẳn theo cảm giác\" và \"quên rằng mã có tồn tại\". Bạn mô tả điều mình muốn, chấp nhận thứ được trả về, và đánh giá nó bằng cách chạy.\n\nVibe coding đổi việc xem xét lấy tốc độ. Đọc diff thường là bước chậm nhất khi làm việc với agent, nên bỏ nó đi là gỡ nút thắt chính. Với mã mà hỏng thì rẻ, như [bản mẫu](https://ai9k.vercel.app/prototyping), script dùng một lần, công cụ nội bộ, đó là một đánh đổi hợp lý. Rủi ro tăng theo tuổi thọ của mã và mức độ hệ trọng.\n\nCái giá đến sau. Các thay đổi vibe coding tích lại thành một codebase chưa ai đọc, và hành vi là thứ duy nhất được kiểm tra. Vì vậy bất cứ điều gì hành vi không làm lộ ra, như một bí mật bị ghi vào log, một trường hợp biên bị thiếu, hay xử lý dữ liệu sai âm thầm, đều được đưa đi mà không ai thấy. Lần đầu có người gỡ lỗi hệ thống cũng là lần đầu có người đọc mã. Khi review của con người không còn, những kiểm chứng tự động còn chạy, như test, kiểu, review tự động, là cánh cổng duy nhất mã đi qua. Cùng thái độ đó áp dụng cho cả một codebase, hoặc một phần của nó, mà các thay đổi đến từ một [nhà máy phần mềm](https://ai9k.vercel.app/software-factory) thì gọi là [nhà máy tối](https://ai9k.vercel.app/dark-factory).\n\n_Nên tránh:_ dùng \"vibe coding\" như từ đồng nghĩa với \"lập trình bằng AI chất lượng thấp\". Thuật ngữ này gọi tên thái độ với việc review, không phải mã thu được.","usage":"\"Bạn có đọc nó đã đổi gì trong luồng auth không?\"\n\n\"Vibe coding thôi. Đăng nhập vẫn chạy, mình chỉ kiểm tra có vậy.\"\n\n\"Đọc diff trước khi push đi. Vibe với phần auth là cách bí mật rò vào log đấy.\"","translated":true},"en":{"description":"A working pattern where the user accepts the agent's code without human review. The diff is treated as opaque.","body":"A working pattern where the user accepts the [agent](https://ai9k.vercel.app/en/agent)'s code without [human review](https://ai9k.vercel.app/en/human-review). The diff is treated as opaque — what matters is whether the program behaves, not what's inside. [Automated review](https://ai9k.vercel.app/en/automated-review) and [automated checks](https://ai9k.vercel.app/en/automated-check) may still run; vibe coding is silent on both.\n\nThe term comes from Andrej Karpathy, who [coined it in early 2025](https://x.com/karpathy/status/1886192184808149383): you \"fully give in to the vibes\" and \"forget that the code even exists\" — describe what you want, accept what comes back, and judge it by running it.\n\nVibe coding trades inspection for speed. Reading diffs is usually the slowest step in agent-driven work, so dropping it removes the main bottleneck. For code whose failures are cheap — [prototypes](https://ai9k.vercel.app/en/prototyping), one-off scripts, internal tools — that's a reasonable trade. The risk scales with the code's lifespan and stakes.\n\nThe cost arrives later. Vibe-coded changes accumulate into a codebase nobody has read, and behaviour was the only thing checked — so anything behaviour doesn't surface, like a secret written to logs, a missing edge case, or quietly wrong data handling, ships unseen. The first time someone debugs the system is the first time anyone reads the code. With human review gone, whatever automated verification still runs — tests, types, automated review — is the only gate the code passes through. The same stance applied to a whole codebase, or part of one, whose changes come from a [software factory](https://ai9k.vercel.app/en/software-factory) is a [dark factory](https://ai9k.vercel.app/en/dark-factory).\n\n_Avoid:_ \"vibe coding\" as a synonym for \"low-quality AI coding\" — the term names the review stance, not the resulting code.","usage":"\"Did you read what it changed in the auth flow?\"\n\n\"Vibe coded it — login still works, that's all I checked.\"\n\n\"Read the diff before you push, vibing on auth is how secrets leak into logs.\"","translated":true}}},{"slug":"design-concept","term":"Design concept","section":7,"position":66,"links":["agent","handoff-artifact","grilling","spec"],"text":{"vi":{"name":"Ý niệm thiết kế","description":"Sự hiểu chung về thứ đang được xây, do người dùng và agent cùng nắm giữ nhưng tách khỏi mọi tài sản cụ thể.","body":"Sự hiểu chung về thứ đang được xây, do người dùng và [agent](https://ai9k.vercel.app/agent) cùng nắm giữ nhưng tách khỏi mọi tài sản cụ thể. Đây là thuật ngữ của Brooks (_The Design of Design_): cuộc trò chuyện, các [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) và mã nguồn đều là những tài sản cố nắm bắt hoặc vươn tới ý niệm thiết kế, nhưng không cái nào _là_ nó. Chất lượng của ý niệm thiết kế được cảm nhận qua chất lượng của cuộc trò chuyện đã dựng nên nó.\n\nThuật ngữ này gọi tên khoảng trống đằng sau một nỗi bực quen thuộc: agent viết đúng thứ bạn yêu cầu mà vẫn sai. Nguyên nhân thường gặp là bạn chưa nghĩ ra trọn vẹn mình muốn gì. Ý niệm thiết kế chưa hoàn chỉnh trong chính đầu bạn: prompt của bạn nắm được những phần bạn đã nghĩ xong, và im lặng ở những phần chưa. Agent lấp các khoảng im lặng đó bằng giả định của riêng nó, vì không có gì để căn theo. Không có gì trục trặc cả. Không có ý niệm thiết kế chung, vì chưa có một ý niệm trọn vẹn để mà chia sẻ.\n\nBạn nhận ra một ý niệm thiết kế đã được chia sẻ theo đúng cách bạn nhận ra với một đồng nghiệp: bên kia bắt đầu trả lời những câu hỏi bạn chưa hỏi theo đúng cách bạn sẽ trả lời. Cho tới lúc đó, công việc là trò chuyện, và [grilling](https://ai9k.vercel.app/grilling) là phiên bản có chủ ý của nó. Viết [spec](https://ai9k.vercel.app/spec) quá sớm chỉ ghi lại sự lệch nhau vào một tài sản bền hơn. Ý niệm thiết kế cũng dịch chuyển khi bạn hiểu thêm; các tài sản đi sau nó, nên một spec trung thành với sự hiểu của tuần trước vẫn có thể dẫn phiên của tuần này đi sai.","usage":"\"Nó viết đúng thứ mình yêu cầu mà vẫn sai.\"\n\n\"Hai bên chưa có chung ý niệm thiết kế. Nó đang lấp khoảng trống bằng giả định. Cứ trao đổi tiếp cho tới khi phần huỷ đơn, hoàn tiền và giao hàng một phần đều khớp giữa hai bên rồi hãy để nó viết spec.\"","translated":true},"en":{"description":"The shared understanding of what's being built, held in common between user and agent but separate from any asset.","body":"The shared understanding of what's being built, held in common between user and [agent](https://ai9k.vercel.app/en/agent) but separate from any asset. Brooks' term (_The Design of Design_): the conversation, [handoff artifacts](https://ai9k.vercel.app/en/handoff-artifact), and the code are all assets that try to capture or reach the design concept, but none of them _are_ it. Quality of the design concept is felt through the quality of the conversation that built it.\n\nThe term names the gap behind a familiar frustration: the agent writes exactly what you asked for and it's still wrong. The usual cause is that you hadn't fully figured out what you wanted. The design concept wasn't finished in your own head — your prompt captured the parts you'd worked out, and was silent on the parts you hadn't. The agent filled those silences with its own assumptions, because there was nothing to align with. Nothing malfunctioned. There was no shared design concept, because there wasn't yet a whole one to share.\n\nYou can tell a design concept is shared the same way you can with a colleague: the other party starts answering questions you haven't asked yet the way you would. Until then, the work is conversation — [grilling](https://ai9k.vercel.app/en/grilling) is the deliberate version — and writing a [spec](https://ai9k.vercel.app/en/spec) too early just captures the misalignment in a more durable asset. The design concept also moves as you learn; assets lag it, which is why a spec faithful to last week's understanding can still mislead this week's session.","usage":"\"It's writing exactly what I asked for and it's still wrong.\"\n\n\"You don't share a design concept yet — it's filling gaps with assumptions. Keep talking until cancellation, refunds, and partial fulfilment all line up between you before you let it write a spec.\"","translated":true}}},{"slug":"grilling","term":"Grilling","section":7,"position":67,"links":["design-concept","agent","handoff-artifact","spec","human-in-the-loop","prototyping"],"text":{"vi":{"description":"Kỹ thuật phát triển ý niệm thiết kế: agent phỏng vấn người dùng theo kiểu Socrates, mỗi lần một quyết định.","body":"Một kỹ thuật phát triển [ý niệm thiết kế](https://ai9k.vercel.app/design-concept) cùng một [agent](https://ai9k.vercel.app/agent): agent phỏng vấn người dùng theo kiểu Socrates, mỗi lần một quyết định, và đề xuất một câu trả lời khuyến nghị cho từng quyết định. Nó làm chậm lại sự vội vàng đi tới một kế hoạch hoàn chỉnh: không [tài liệu bàn giao](https://ai9k.vercel.app/handoff-artifact) nào được viết cho tới khi ý niệm ổn định.\n\nKỹ thuật này tồn tại vì agent lấp khoảng trống một cách âm thầm. Được yêu cầu viết một [spec](https://ai9k.vercel.app/spec) từ một prompt hai dòng, agent không dừng lại ở những quyết định bạn chưa đưa ra. Nó chọn mặc định và ghi luôn vào. Kết quả trông hoàn chỉnh, và phỏng đoán không phân biệt được với lựa chọn, nên bạn phát hiện ra chúng muộn: lúc review, hoặc khi tính năng đã xây xử lý một trường hợp biên theo cách bạn chưa từng chọn. Grilling đảo ngược điều này: thay vì đoán, agent phải hỏi.\n\nĐây là kỹ thuật [có con người trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop): câu trả lời của bạn là đầu vào. Khi một câu hỏi không trả lời được bằng trò chuyện, vì bạn phải nhìn thấy thứ đó, hãy chuyển sang [làm bản mẫu](https://ai9k.vercel.app/prototyping).","usage":"\"Nó nhảy thẳng vào viết spec và làm sai logic huỷ đơn.\"\n\n\"Cho nó grilling bạn trước. Bắt nó hỏi bạn về huỷ một phần, hoàn tiền và thời điểm trước khi nó ghi bất cứ gì vào tài liệu. Giải quyết trong lúc trò chuyện rẻ hơn giải quyết trong mã.\"","translated":true},"en":{"description":"A technique for developing a design concept: the agent interviews the user Socratically, one decision at a time.","body":"A technique for developing a [design concept](https://ai9k.vercel.app/en/design-concept) with an [agent](https://ai9k.vercel.app/en/agent): the agent interviews the user Socratically, one decision at a time, proposing a recommended answer for each. Slows the rush to a finished plan — no [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) is written until the concept stabilises.\n\nThe technique exists because agents fill gaps silently. Asked to write a [spec](https://ai9k.vercel.app/en/spec) from a two-line prompt, the agent doesn't stop at the decisions you haven't made — it picks defaults and writes them in. The result looks complete, and the guesses are indistinguishable from the choices, so you discover them late: at review, or when the built feature handles an edge case in a way you never chose. Grilling inverts this — instead of guessing, the agent has to ask.\n\nIt's a [human-in-the-loop](https://ai9k.vercel.app/en/human-in-the-loop) technique: your answers are the input. When a question can't be answered in conversation — you'd have to see the thing — switch to [prototyping](https://ai9k.vercel.app/en/prototyping).","usage":"\"It went straight to writing the spec and got the cancellation logic wrong.\"\n\n\"Grill it first — make it ask you about partial cancels, refunds, and timing before it commits anything to the doc. Cheaper to resolve in conversation than in code.\"","translated":true}}},{"slug":"prototyping","term":"Prototyping","section":7,"position":68,"links":["agent","grilling","human-in-the-loop","spec"],"text":{"vi":{"name":"Làm bản mẫu","description":"Để agent dựng nhanh một bản thô khi trò chuyện không đủ độ chi tiết và bạn cần một sản phẩm thật để bàn.","body":"Để [agent](https://ai9k.vercel.app/agent) dựng nhanh một bản thô của thứ gì đó (làm bản mẫu), dùng khi trò chuyện không đủ độ chi tiết và bạn cần một sản phẩm thật để bàn.\n\n[Grilling](https://ai9k.vercel.app/grilling) giải quyết các quyết định thiết kế bằng trò chuyện. Trò chuyện thì rẻ, nhưng độ chi tiết thấp: có những câu hỏi không trả lời được bằng lời, như một tương tác cho cảm giác thế nào, hình dạng một API có thuận tay trong mã gọi thật không, bố cục có ổn với kích thước dữ liệu thật không. Cuộc phỏng vấn chạm tới một câu hỏi mà câu trả lời thật lòng của bạn là \"mình không biết, phải nhìn thấy mới được\". Qua điểm đó, cuộc thảo luận đi vòng quanh. Thay vào đó, hãy để agent dựng thứ đó lên, nhìn nó, rồi quay lại cuộc trò chuyện với một câu trả lời.\n\nAgent hạ chi phí xây dựng, và đó là điều khiến cách này khả thi. Một bản thô từng mất một ngày để dựng thử thì giờ mất vài phút, nên đáng làm thường xuyên. Đây là kỹ thuật [có con người trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop): bản mẫu có đó để bạn phản ứng.\n\nThường bạn không dừng ở một lần nhìn. Hãy lặp cùng bản mẫu: phản ứng, yêu cầu một thay đổi, phản ứng tiếp. Mỗi vòng giải quyết thêm một quyết định dựa trên sản phẩm thật, với độ chi tiết cao hơn mức trò chuyện cho phép.\n\nBản mẫu không nhất thiết phải thô toàn bộ. Bạn có thể dựng những phần mình thực sự đang đánh giá ở chất lượng production, để khi quyết định được chốt, component hay API bạn đã phản ứng có thể chuyển vào codebase thật. Điều này khiến bản mẫu thành tư liệu thiết yếu để [spec](https://ai9k.vercel.app/spec) tham chiếu.","usage":"\"Bọn mình đã cãi nhau nửa tiếng xem wizard nên là một trang hay ba bước.\"\n\n\"Lời nói không phân xử được đâu. Để agent làm bản mẫu cả hai. Mình bấm thử qua là năm phút sau biết ngay.\"","translated":true},"en":{"description":"Having the agent build a quick, rough version when conversation is too low-fidelity and you need a real artifact to talk about.","body":"Having the [agent](https://ai9k.vercel.app/en/agent) build a quick, rough version of something, for when conversation is too low-fidelity and you need a real artifact to talk about.\n\n[Grilling](https://ai9k.vercel.app/en/grilling) resolves design decisions in conversation. Conversation is cheap, but it's low-fidelity: some questions can't be answered in words — how an interaction feels, whether an API shape is ergonomic in real calling code, whether the layout works at real data sizes. The interview hits a question and your honest answer is \"I don't know, I'd have to see it.\" Past that point the discussion circles. Instead, have the agent build the thing, look at it, and come back to the conversation with an answer.\n\nAgents lower the cost of building, which is what makes this practical. A rough version that used to take a day to mock up now takes minutes, so it's worth doing routinely. It's a [human-in-the-loop](https://ai9k.vercel.app/en/human-in-the-loop) technique: the prototype is there for you to react to.\n\nYou usually don't stop at one look. Iterate with the prototype — react, ask for a change, react again — so each round resolves another decision against the real artifact, at a higher fidelity than conversation allows.\n\nA prototype doesn't have to be all-scrappy. You can build the pieces you're actually evaluating to production quality, so when the decision lands, the component or API you reacted to can transfer into the real codebase. This makes prototyping essential material for the [spec](https://ai9k.vercel.app/en/spec) to reference.","usage":"\"We've spent half an hour arguing about whether the wizard should be one page or three steps.\"\n\n\"Words won't settle it — have the agent prototype both. We'll click through them and know in five minutes.\"","translated":true}}},{"slug":"dx","term":"DX","section":7,"position":69,"links":["ax","stateful","stateless","agent","session","environment","tool-result","context-window","agentsmd"],"text":{"vi":{"description":"Developer experience: codebase và bộ công cụ giúp con người làm tốt việc dễ tới đâu, gồm tài liệu, tốc độ phản hồi, thông báo lỗi.","body":"Developer experience (trải nghiệm của lập trình viên): một codebase và bộ công cụ của nó giúp con người làm tốt việc dễ tới đâu. DX tốt là phản hồi nhanh, thông báo lỗi rõ ràng, tài liệu trả lời đúng câu hỏi bạn đang có, và phần cài đặt chạy được ngay lần đầu. Thuật ngữ này có từ rất lâu trước lập trình với AI; nó có trong từ điển này chủ yếu để đối chiếu với [AX](https://ai9k.vercel.app/ax).\n\nDX là sự tương tác giữa con người và codebase, không hơn. Khác biệt chính giữa hai nhóm đối tượng là con người [có lưu trạng thái](https://ai9k.vercel.app/stateful) còn agent [không lưu trạng thái](https://ai9k.vercel.app/stateless). Con người học codebase một lần và mang kiến thức đó sang mọi ngày sau, vì vậy DX kém vẫn sống được: họ đi vòng qua CI chậm bằng cách gộp các lần push, qua tài liệu thiếu bằng cách hỏi một lần trên Slack, qua cấu trúc rối bằng cách nhớ mọi thứ nằm ở đâu. Các cách đi vòng tích luỹ lại, và nhóm rốt cuộc vẫn làm việc năng suất trong một codebase chống lại họ.\n\n[Agent](https://ai9k.vercel.app/agent) đối mặt với cùng codebase đó mà không có sự tích luỹ nào. Không lưu trạng thái qua các [phiên](https://ai9k.vercel.app/session), agent học lại codebase từ đầu mỗi lần. Nó hưởng lợi từ bộ test nhanh và thông báo lỗi rõ ràng, nhưng điều gì nó nghĩ ra hôm qua đều mất, trừ khi được ghi vào [môi trường](https://ai9k.vercel.app/environment), thứ agent chỉ nhận biết qua [kết quả công cụ](https://ai9k.vercel.app/tool-result). Đó là khoảng trống mà AX gọi tên: những phần của DX còn giá trị khi lập trình viên là agent, cộng với những mối quan tâm con người không có, như giữ cho [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) còn trống.\n\nPhần trùng nhau nghĩa là đầu tư cho DX thường cải thiện luôn AX: kiểu chặt chẽ, test nhanh và cấu trúc dễ đoán giúp cả hai. Phần khác nhau nghĩa là không phải lúc nào cũng vậy: một tài liệu onboarding đẹp giúp con người trong một tuần và không giúp gì agent, trừ khi tới được nó từ [AGENTS.md](https://ai9k.vercel.app/agentsmd).","usage":"\"DX của bọn mình ổn mà, người mới làm việc được sau một tuần.\"\n\n\"Làm việc được vì có người ngồi kèm họ cả tuần đó. Agent không có tuần đó; hãy kiểm tra AX riêng.\"","translated":true},"en":{"description":"Developer experience: how easy a codebase and its toolchain make it for humans to do good work — docs, feedback speed, errors.","body":"Developer experience — how easy a codebase and its toolchain make it for humans to do good work. Good DX is fast feedback, clear error messages, documentation that answers the question you actually have, and setup that works on the first try. The term long predates AI coding; it's in this dictionary mainly as the contrast for [AX](https://ai9k.vercel.app/en/ax).\n\nDX is the interaction between the human and the codebase — nothing more. The main difference between the two audiences is that humans are [stateful](https://ai9k.vercel.app/en/stateful) and agents are [stateless](https://ai9k.vercel.app/en/stateless). A human learns the codebase once and carries that knowledge into every day after, which is why poor DX is survivable: they route around slow CI by batching their pushes, around missing docs by asking in Slack once, around confusing structure by remembering where things live. The workarounds accumulate, and a team ends up productive in a codebase that fights them.\n\n[Agents](https://ai9k.vercel.app/en/agent) face the same codebase with none of that accumulation. Stateless across [sessions](https://ai9k.vercel.app/en/session), an agent re-learns the codebase from scratch every time — it benefits from the fast test suite and the clear error messages, but anything it figured out yesterday is gone unless it was written into the [environment](https://ai9k.vercel.app/en/environment), which the agent only perceives through [tool results](https://ai9k.vercel.app/en/tool-result). That's the gap AX names: the parts of DX that survive when the developer is an agent, plus concerns humans don't have, like keeping the [context window](https://ai9k.vercel.app/en/context-window) free.\n\nThe overlap means DX investment often improves AX for free — strict types, fast tests, and predictable structure help both. The divergence means it doesn't always: a beautiful onboarding doc helps a human for a week and an agent not at all unless it's reachable from [AGENTS.md](https://ai9k.vercel.app/en/agentsmd).","usage":"\"Our DX is fine — new hires are productive in a week.\"\n\n\"Productive because someone sits with them for that week. The agent doesn't get that week; check the AX separately.\"","translated":true}}},{"slug":"ax","term":"AX","section":7,"position":70,"links":["environment","agent","dx","model","harness","automated-check","agentsmd","skill","tool","context-window","smart-zone","tool-result"],"text":{"vi":{"description":"Agent experience: môi trường được sắp đặt tốt tới đâu để agent làm tốt việc, gồm kiểm tra tự động, kiến trúc và ngữ cảnh còn trống.","body":"Agent experience (trải nghiệm của agent): [môi trường](https://ai9k.vercel.app/environment) được sắp đặt tốt tới đâu để một [agent](https://ai9k.vercel.app/agent) làm tốt việc trong một codebase. Đây là phiên bản hướng tới agent của [DX](https://ai9k.vercel.app/dx). Khi cùng một agent làm tốt ở repo này và làm tệ ở repo khác, cùng [mô hình](https://ai9k.vercel.app/model), cùng [harness](https://ai9k.vercel.app/harness), khác biệt thường là AX. Phản xạ là đổ lỗi cho mô hình hoặc viết lại prompt; cách xử lý thường nằm trong repo hơn.\n\nAX tốt có ba chiều chính:\n\n| Chiều              | AX tốt trông thế nào                                                                                                                                                                                                                            |\n| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Kiểm tra tự động   | Các [kiểm tra tự động](https://ai9k.vercel.app/automated-check) nhanh và tất định, như kiểu, test, lint, để agent tự sửa mà không cần con người                                                                                                                  |\n| Kiến trúc          | Một codebase agent đi lại được mà không phải đọc hết: cấu trúc dễ đoán, nhiều hành vi nằm sau các giao diện nhỏ, tên gọi nói rõ thứ đó làm gì                                                                                                   |\n| Ngữ cảnh còn trống | [AGENTS.md](https://ai9k.vercel.app/agentsmd), các [skill](https://ai9k.vercel.app/skill) và [công cụ](https://ai9k.vercel.app/tool) được giữ gọn, để phần lớn [cửa sổ ngữ cảnh](https://ai9k.vercel.app/context-window) dành cho công việc và agent ở lại trong [vùng thông minh](https://ai9k.vercel.app/smart-zone) thay vì chìm nghỉm |\n\nAX và DX có phần trùng nhau, vì kiểm tra tốt và kiến trúc sạch giúp cả hai nhóm đối tượng, nhưng cũng có chỗ khác. Con người chịu được kiến thức truyền miệng, CI chậm, và câu \"hỏi Sarah về module billing\"; agent thì không. Agent không hưởng lợi từ tooltip trong IDE hay dashboard đẹp; nó cần lỗi ở dạng văn bản trong một [kết quả công cụ](https://ai9k.vercel.app/tool-result). Một codebase có thể có DX tốt và AX kém.\n\n_Nên tránh:_ coi AX là từ đồng nghĩa với DX. Hai nhóm đối tượng cần những khoản đầu tư khác nhau.","usage":"\"Agent viết mã rất tốt ở repo API và viết rác ở frontend.\"\n\n\"Repo API có kiểu chặt chẽ và bộ test nhanh; frontend không có cả hai và có bốn mươi skill luôn được nạp. Đó là khoảng cách về AX, không phải vấn đề của mô hình.\"","translated":true},"en":{"description":"Agent experience: how well the environment is set up for an agent to do good work — checks, architecture, and free context.","body":"Agent experience — how well the [environment](https://ai9k.vercel.app/en/environment) is set up for an [agent](https://ai9k.vercel.app/en/agent) to do good work in a codebase. The agent-facing counterpart to [DX](https://ai9k.vercel.app/en/dx). When the same agent performs well in one repo and badly in another — same [model](https://ai9k.vercel.app/en/model), same [harness](https://ai9k.vercel.app/en/harness) — the difference is usually AX. The instinct is to blame the model or rewrite the prompt; the fix is more often in the repo.\n\nGood AX has three main dimensions:\n\n| Dimension        | What good AX looks like                                                                                                                                                                                                                              |\n| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Automated checks | Fast, deterministic [automated checks](https://ai9k.vercel.app/en/automated-check) — types, tests, lints — that the agent can self-correct from without a human                                                                                                          |\n| Architecture     | A codebase the agent can navigate without reading everything: predictable structure, a lot of behaviour behind small interfaces, names that say what things do                                                                                       |\n| Free context     | [AGENTS.md](https://ai9k.vercel.app/en/agentsmd), [skills](https://ai9k.vercel.app/en/skill), and [tools](https://ai9k.vercel.app/en/tool) kept lean, so most of the [context window](https://ai9k.vercel.app/en/context-window) is available for the task and the agent stays in the [smart zone](https://ai9k.vercel.app/en/smart-zone) instead of drowning |\n\nAX and DX overlap — good checks and clean architecture help both audiences — but they diverge. Humans tolerate tribal knowledge, slow CI, and \"ask Sarah about the billing module\"; agents can't. Agents don't benefit from IDE tooltips or pretty dashboards; they need failures as text in a [tool result](https://ai9k.vercel.app/en/tool-result). A codebase can have good DX and poor AX.\n\n_Avoid:_ treating AX as a synonym for DX — the audiences need different investments.","usage":"\"The agent writes great code in the API repo and garbage in the frontend.\"\n\n\"The API repo has strict types and a fast test suite; the frontend has neither and forty always-loaded skills. That's an AX gap, not a model problem.\"","translated":true}}},{"slug":"software-factory","term":"Software factory","section":7,"position":71,"links":["agent","session","afk","human-in-the-loop","ticket","automated-review","human-review","dark-factory"],"text":{"vi":{"name":"Nhà máy phần mềm","description":"Hệ thống làm việc trong đó trigger, không phải con người, khởi động phiên của agent, để nhiều việc chạy AFK hơn và dành thời gian con người cho chỗ cần.","body":"Một hệ thống làm việc (nhà máy phần mềm) trong đó các [phiên](https://ai9k.vercel.app/session) của [agent](https://ai9k.vercel.app/agent) được khởi động bởi trigger, như một issue được tạo, một lịch chạy, một lần CI hỏng, một phiên khác kết thúc, thay vì bởi con người. Nhờ vậy nhiều việc chạy [AFK](https://ai9k.vercel.app/afk) hơn và sự chú ý của con người được dành cho những quyết định [có con người trong vòng lặp](https://ai9k.vercel.app/human-in-the-loop) còn lại.\n\nKhông có nhà máy, phiên nào cũng bắt đầu vì có người bắt đầu nó. Ngay cả việc hoàn toàn AFK cũng chờ một người mở phiên, chỉ nó vào [ticket](https://ai9k.vercel.app/ticket) và cho nó chạy. Các nhóm muốn làm ra nhiều hơn mức đó cho phép. Nhà máy đưa con người ra khỏi việc khởi động phiên, và không nhất thiết ra khỏi việc gì khác.\n\nCác trigger thường gặp và phiên mà chúng khởi động:\n\n| Trigger                        | Phiên được khởi động        | Ví dụ                                                                                                                          |\n| ------------------------------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |\n| Issue được tạo hoặc gắn nhãn   | Thăm dò, sửa lỗi, thực hiện | Một issue gắn nhãn `ready-for-agent` được một phiên xử lý và mở PR                                                             |\n| Lịch chạy (cron)               | Bảo trì định kỳ             | Mỗi đêm sửa một quy tắc lint                                                                                                   |\n| CI hỏng hoặc cảnh báo giám sát | Chẩn đoán, thử sửa          | Một bản build hỏng trên main được một phiên tìm ra commit gây lỗi và đề xuất cách sửa                                          |\n| Một phiên khác kết thúc        | Việc nối tiếp               | Một PR do agent mở kích hoạt [review tự động](https://ai9k.vercel.app/automated-review), và các nhận xét của nó kích hoạt một phiên sửa bổ sung |\n\nNhà máy không nhất thiết phải bao trọn quy trình phần mềm. Một cron job chạy một loại phiên và mở một PR xem lại được đã là một nhà máy. Bắt đầu nhỏ như vậy có ích: một vòng lặp hẹp tạo ra các PR nhỏ, giống nhau, và việc review chúng cho thấy vòng lặp đáng tin tới đâu trước khi mở rộng.\n\nCon người có thể ngồi ở bất cứ đâu trong nhà máy: viết và gắn nhãn các issue kích hoạt phiên, duyệt kế hoạch trước khi bắt đầu thực hiện, làm [review của con người](https://ai9k.vercel.app/human-review) trước khi merge. Quyết định xem những quyết định nào vẫn do con người nắm là câu hỏi thiết kế chính. Một codebase, hoặc một phần của nó, nơi không con người nào review đầu ra của nhà máy là một [nhà máy tối](https://ai9k.vercel.app/dark-factory).","usage":"\"Ai đã sửa hết các vi phạm `no-floating-promises` vậy?\"\n\n\"Nhà máy đấy. Cron job mỗi đêm chọn một quy tắc lint rồi mở PR. Sáng ra mình chỉ review thôi.\"","translated":true},"en":{"description":"A system of work where triggers, not humans, start agent sessions, so more work runs AFK and HITL time is saved for what needs it.","body":"A system of work where [agent](https://ai9k.vercel.app/en/agent) [sessions](https://ai9k.vercel.app/en/session) are started by triggers — an issue being created, a schedule, a CI failure, another session finishing — rather than by a human, so more work runs [AFK](https://ai9k.vercel.app/en/afk) and human attention is spent on the [human-in-the-loop](https://ai9k.vercel.app/en/human-in-the-loop) decisions that remain.\n\nWithout a factory, every session starts because someone started it. Even fully AFK work waits on a person to open the session, point it at the [ticket](https://ai9k.vercel.app/en/ticket), and set it going. Teams want to ship more than that allows. A factory takes the human out of starting sessions, and not necessarily out of anything else.\n\nCommon triggers and the sessions they start:\n\n| Trigger                        | Session it starts                    | Example                                                                                                                   |\n| ------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| Issue created or labelled      | Exploration, bug fix, implementation | An issue labelled `ready-for-agent` gets a session that opens a PR                                                        |\n| Schedule (cron)                | Recurring maintenance                | One lint rule fixed per night                                                                                             |\n| CI failure or monitoring alert | Diagnosis, fix attempt               | A failing build on main gets a session that finds the breaking commit and proposes a fix                                  |\n| Another session finishing      | Follow-on work                       | A PR opened by one agent triggers an [automated review](https://ai9k.vercel.app/en/automated-review), whose comments trigger a fix-up session |\n\nA factory doesn't have to cover the whole software process. One cron job that runs one kind of session and opens one reviewable PR is a factory. Starting that small is useful: a narrow loop produces small, similar PRs, and reviewing them shows how far the loop can be trusted before it's widened.\n\nHumans can sit anywhere in a factory — writing and labelling the issues that trigger sessions, approving a plan before implementation starts, doing [human review](https://ai9k.vercel.app/en/human-review) before merge. Deciding which of those decisions stay human is the main design question. A codebase, or part of one, where no human reviews the factory's output is a [dark factory](https://ai9k.vercel.app/en/dark-factory).","usage":"\"Who fixed all the `no-floating-promises` violations?\"\n\n\"The factory. Cron job picks one lint rule a night, opens a PR. I just review it in the morning.\"","translated":true}}},{"slug":"dark-factory","term":"Dark factory","section":7,"position":72,"links":["software-factory","human-review","vibe-coding","automated-check","automated-review","agent","session","afk"],"text":{"vi":{"name":"Nhà máy tối","description":"Một codebase, hoặc một phần của nó, nơi nhà máy phần mềm viết mã và không con người nào review mã đó.","body":"Một codebase, hoặc một phần của nó, nơi một [nhà máy phần mềm](https://ai9k.vercel.app/software-factory) viết mã và không con người nào đọc mã đó (nhà máy tối). Không có [review của con người](https://ai9k.vercel.app/human-review). Con người vẫn có thể viết các issue khởi động công việc. Nhưng không ai đọc mã được tạo ra. Tên gọi đến từ các nhà máy \"tắt đèn\", nơi sản xuất mà không có người trong xưởng.\n\nNhà máy tối là [vibe coding](https://ai9k.vercel.app/vibe-coding) cho cả một vùng mã, không phải cho một thay đổi. Khi vibe coding, bạn chọn không đọc một thay đổi mà bạn đã yêu cầu. Nhưng bạn biết thay đổi đó tồn tại. Trong nhà máy tối, nhóm đưa ra lựa chọn đó một lần, cho cả vùng. Sau đó không ai yêu cầu từng thay đổi hay nhìn thấy nó. Thay đổi tới nhanh ngang với tốc độ các trigger khởi động việc mới.\n\nVấn đề lộ ra khi có gì đó hỏng. Bạn không biết cái gì đã thay đổi, vì không ai đọc các thay đổi. Bạn phải gỡ lỗi đoạn mã mà không ai trong nhóm từng đọc. Nguyên nhân có thể nằm ở bất kỳ thay đổi nào trong rất nhiều thay đổi, và cái nào cũng đã qua các phép kiểm tra.\n\n[Kiểm tra tự động](https://ai9k.vercel.app/automated-check) và [review tự động](https://ai9k.vercel.app/automated-review) là những cánh cổng duy nhất. Nếu chúng không tìm ra một vấn đề thì vấn đề đó đi vào mã.\n\n_Nên tránh:_ gọi một codebase là \"tối\" chỉ vì nhà máy của nó chạy không ai theo dõi. Nếu các [phiên](https://ai9k.vercel.app/session) của [agent](https://ai9k.vercel.app/agent) chạy [AFK](https://ai9k.vercel.app/afk) và con người review các PR của chúng thì đó là nhà máy phần mềm. Đó không phải nhà máy tối.","usage":"\"Ai đã đổi logic retry trong dịch vụ billing vậy? Không ai trong nhóm nhớ cả.\"\n\n\"Dịch vụ billing là một nhà máy tối. Các agent merge mọi thay đổi qua được CI. Không ai đọc thay đổi đó.\"","translated":true},"en":{"description":"A codebase, or part of one, where a software factory writes the code and no human ever reviews it.","body":"A codebase, or part of one, where a [software factory](https://ai9k.vercel.app/en/software-factory) writes the code and no human reads it. There is no [human review](https://ai9k.vercel.app/en/human-review). Humans can still write the issues that start the work. But nobody reads the code that comes out. The name comes from \"lights-out\" factories, which make things with no people on the floor.\n\nA dark factory is [vibe coding](https://ai9k.vercel.app/en/vibe-coding) for an area of code, not for one change. When you vibe code, you choose not to read a change that you asked for. But you know that the change exists. In a dark factory, the team makes that choice one time, for the full area. After that, no person asks for each change or sees it. Changes arrive as fast as the triggers start new work.\n\nThe problem shows when something breaks. You do not know what changed, because nobody read the changes. You must debug code that nobody on the team has read. The cause can be in any of many changes, and each one passed the checks.\n\n[Automated checks](https://ai9k.vercel.app/en/automated-check) and [automated review](https://ai9k.vercel.app/en/automated-review) are the only gates. If they do not find a problem, the problem goes into the code.\n\n_Avoid:_ calling a codebase \"dark\" only because its factory runs with nobody watching. If [agent](https://ai9k.vercel.app/en/agent) [sessions](https://ai9k.vercel.app/en/session) run [AFK](https://ai9k.vercel.app/en/afk) and a human reviews their PRs, that is a software factory. It is not a dark factory.","usage":"\"Who changed the retry logic in the billing service? Nobody on the team remembers it.\"\n\n\"The billing service is a dark factory. The agents merge all changes that pass CI. Nobody read that change.\"","translated":true}}}]}