Repository navigation
agents-md: an auto-paginated Read of a nested AGENTS.md no longer counts as delivering it - #96364
Merged
Merged
Conversation
poteat
enabled auto-merge (rebase)
September 23, 2026 13:39
stephanien-ant
approved these changes
Sep 23, 2026
This was referenced Sep 23, 2026
notitatall
approved these changes
Sep 24, 2026
This was referenced Sep 24, 2026
1 task
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
Readof a nestedAGENTS.mditself counts as delivering it when it names nooffsetorlimit, so later Reads under that directory do not attach it again. But a whole-file Read of a file over the Read tool's token cap is paginated by the tool: the model gets the first page and a banner, and the result says so (truncatedByTokenCap,numLinesshort oftotalLines). The mod marked the file delivered all the same, so the rest of the instructions never reached that loop unless the model paged through the file on its own.The
tool.callhook onReadnow reads the returned record before recording delivery: a text result that is flaggedtruncatedByTokenCap, does not start at line 1, or returned fewer lines than the file has is a partial read, as an explicitoffsetorlimitalready was, and the file is attached whole at the nextReadunder its directory. A complete read, and a result with no structured record, behave as before. The tests intests/register.test.tscover the six cases (auto-paginated, short line range, complete, explicit limit, explicit offset, unstructured result).Checked:
nested/AGENTS.mdandCLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS=3000,claude -p --plugin-dir mods/agents-mdagainst a scripted local Messages endpoint that Readsnested/AGENTS.mdand thennested/source.ts: the first Read comes back as lines 1-190 of 603; before, the second Read attaches nothing and the file's last rule is in no request; after, the second Read carriesContents of …/nested/AGENTS.md:with the whole file. With the default cap the first Read is complete and the second attaches nothing, before and after. With a 160 KB file under the default cap the same holds, the attached text handed over as a saved file with its head, as the engine does for context that long.tsc -p mods/tsconfig.json,claude plugin validate mods/agents-md,git diff --check, andclaude plugin teston all four mods (212 tests) under 2.1.277.Patch by @7487, from #91870.