Repository navigation
feat(agents): install jq in the Claude Code image - #750
Open
kaihackney-scale wants to merge 1 commit into
Open
kaihackney-scale wants to merge 1 commit into
kaihackney-scale wants to merge 1 commit into
Conversation
The CLI saves an MCP result over its token cap to a file and tells the model to query it with jq, which the image didn't have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
Install
jqin the Claude Code agent image.Why
When an MCP tool result is over Claude Code's token cap, the CLI writes it to a file under
tool-results/and tells the model how to read it:That text is the CLI's own, not the agent wrapper's (
claude_bridge.pyand the rest of the folder add nothing to it), and it suggests jq in several places, such asjq 'type, length, keys?'as a first probe. The image doesn't have jq, so in runs whose MCP tools return large results the model's first jq call fails withjq: command not found, and it falls back to reading the file in chunks with Python. That costs the run a wasted tool call and makes the agent work against what the CLI tells it.jq is about 1 MB with its library on Debian slim, from the same
apt-getlayer that already installspoppler-utils.Changes
Dockerfile: addjqto the apt install.README.md: list jq among what the image gives the model's scripts.test_image_contract.py: assert the image installsjq(and stillpoppler-utils).Out of scope:
install.sh(install/v1) uses the target's own tools, as it does for Python packages, so it doesn't add jq to a task container or VM host.Testing
tst/unit/agents/claude_code/: 254 passed, 30 skipped (existing capability gates). The new test fails withjqtaken out of the Dockerfile.ruff checkis clean, andtst/unit/bundle/shipped_bundles_test.pypasses.mainand from this branch (linux/arm64, Docker 29.9.2). Each container ran as the image'sagentuser in/app, the CLI's cwd, and was given a ~110 KB file in the CLI's spill format ({"result": "<JSON string>"}). The probe ran the jq queries the CLI's message suggests:jq: command not found.jq-1.7;jq 'type, length, keys?'→"object" 1 ["result"]; onejq '.result | fromjson | …'call counts the records and filters them by field.Probe output, main vs this branch
main
this branch
🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge.Summary
Adds
jqto the Claude Code image so the model can query large MCP results saved to files.Reviews (1) · Last reviewed commit: "feat(agents): install jq in the Claude C..." · Reviewed by Greptile