Repository navigation
Fix: Ask bar fails with "Prompt is too long" (keep the agent out of generated map files) - #120
Merged
haydenschmitty merged 1 commit intoNov 15, 2026
Conversation
The Ask bar runs `claude -p` with Read/Grep/Glob on the project. It could open floorplan/index.html (about 2 MB, inlined layout engine and fonts) and a single short question grew to roughly a million tokens and failed with "Prompt is too long". Deny Read on that file and the other generated files. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
|
Merged and released in 0.9.0, together with running questions with no MCP servers loaded. Thank you! Update with |
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.
Problem
On a small project, asking the Ask bar a one-line question ("from where it fetches words meaning ?") ended with a red Prompt is too long and nothing else.
Reproducing it by running the same
claude -pcall by hand showed the session growing to about 993,000 tokens before it hit the limit and failed to compact, so one short question used a large part of the person's allowance. The map itself (graph.json) was only ~7 KB, so it wasn't the map's size.Cause (probable)
claudeRunallowsRead,GrepandGlobover the whole project.floorplan/index.htmlis about 2 MB (it inlines the layout engine and fonts), so an agent that opens or greps it can blow past the context limit.I did not capture which exact file was read. My reproduction also left out the Ask bar's own instructions, which point the agent at
query.mjs, so the Ask bar's real call may behave a little differently from what I ran.Change
skills/floorplan/assets/serve.mjs: add--disallowedToolsforRead(floorplan/index.html),Read(floorplan/serve.mjs),Read(floorplan/page-safety.mjs)andRead(floorplan/.cache/**). It goes before--tools, so the existing check on the end of the argument list still holds.tests/ask.test.mjs: assert the deny rule is passed.CHANGELOG.md: line under Unreleased.Testing
node --test tests/ask.test.mjsandtests/serve.test.mjspass on their own (7/7 and 8/8), with and without this change.npm teston Windows had severalserve.test.mjscases fail with "server didn't start" when everything ran at once; they pass in isolation, so I think that is a timing issue from running in parallel, but I haven't confirmed it.CHECKSUMS.txt, assuming that happens at release.If you'd rather fix this another way (a size limit on reads, or answering only through
query.mjs), I'm happy to rework it.🤖 Generated with Claude Code