AGENTS.md@internal/compressionA
AGENTS.md@internal/compression from iohub/yagent is an AGENTS.md file: the standing instructions coding agents read in that repo.
mdr add iohub/yagent/internal/compression/AGENTS.md@git:20261028.19903d6Pins git:20261028.19903d6 in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 14 of 14 checks passed
- Kind
- AGENTS.md file
- Repository
- iohub/yagent
- Path
internal/compression/AGENTS.md- Versions recorded
- 3
- Latest version
- git:20261028.19903d6, committed Oct 28, 2026
- First version recorded
- Oct 21, 2026
- Size
- 6,281 bytes
- Repository stars
- 31
- License
- Apache-2.0
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# internal/compression — 三档上下文压缩 > 范围:本目录内不可派生的约束。全局摘要见仓库根 `AGENTS.md` §6.5。 > (原 `docs/compression-trigger-design.md` 已不存在,规格由本文件持有。) ## 边界 把"是否超阈值"和"超了怎么削"的三档算法收在一处。**不负责**决定何时调用自己(两个循环各两处调用点, 共四处)、不持有会话、不写 rollout。 ## 硬约束 **1. 判定只有一处实现:`OverThreshold`,严格大于(等于不触发)**(`truncate.go:99-107`)。 不要再抄 `EstimateMessagesTokens(messages) > threshold`——抄开的表现是"子 Agent 与 Director 的 触发时机不一致"。四处调用点漏改一处的情况由 `internal/agents/executor_prefix_trigger_test.go` 跨包盯着(本包单测在那种情况下是全绿的)。 **2. `ResolveThreshold` 两个来源都是上限、取小**(`threshold.go:49-59`):目录回答"这个模型装得下多少", 配置回答"我愿意为此付多少"。**provider 的 `context_window` 完全不参与**(它只影响 TUI 进度条)。 `YAGENT_COMPRESS_THRESHOLD` 是第 0 级、只给调试用,且**每次现读不缓存**(`:21-22,60-62`)—— 生产配置不要用它,它绕过一切、会让压缩早于模型真实容量触发。 **3. ⚠️ 同一个函数有两种调用语义。** 压缩触发传配置值;**重放预算传 `0`**(要纯模型容量,不参与取小), 见 `:56-59`。把取小套到重放预算上,能让本来可重放的委派**全部**降级成交接报告(不报错,只是恢复不了)。 **4. 计量口径 `Prefix` 只在可用时使用**(`truncate.go:73-99`):`Refresh` 三条规则(失败保留 / 无 usage 作废 / 成功以 sentLen 为界)两个循环共用(`:108-121`)。作废后逐字回落到全量本地估算, 那才是改动前的行为。**偏差一律偏大,所以这个数只用于判定,`stats` 一律保持本地口径**(`:88-99`、 `truncate_results.go:40-46`)——否则 TUI ⧉ 面板的百分比是两个基数混在一起。 **5. token 估算包含 `Reasoning` 与工具调用参数**(`truncate.go:47-58`)。漏算不是"少几个 token", 是压缩触发时机系统性偏晚。 …
Read the whole file at its exact version.
How to install
mdr add iohub/yagent/internal/compression/AGENTS.md@sha256:f69eba8e0ad90517The line at the top of this page pins the label git:20261028.19903d6, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_zegqhtsbe65nx67m)
2 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 3 versions of this file, between Oct 21, 2026 and Oct 28, 2026, about one every 3 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20261028.19903d6 latest | 2026-10-28 | 19903d6 | 6,281 B | A | view · diff |
| git:20261024.9b44441 | 2026-10-24 | 9b44441 | 6,219 B | A | view · diff |
| git:20261021.9f5bf87 | 2026-10-21 | 9f5bf87 | 4,589 B | A | view |
Audit of the latest version
- pass: Size between 200 bytes and 200 KB (6281 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
iohub/yagent · 31 stars · license Apache-2.0 · pushed 2026-11-05 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_zegqhtsbe65nx67m GET https://markdownregistry.com/api/v1/resolve?ref=iohub/yagent/internal/compression/AGENTS.md GET https://markdownregistry.com/api/v1/blob/f69eba8e0ad905175004b707005df79ceff1f9e8722b0e9d9bdd9d65bfc33177
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: how to write a good AGENTS.md · AGENTS.md vs CLAUDE.md · which agent file does what.