From a510991ca2c697326778186c846ff3737a0acab8 Mon Sep 17 00:00:00 2001 From: paramveer singh Date: Thu, 12 Nov 2026 16:05:30 +0530 Subject: [PATCH] Keep the Ask agent out of the map's generated files 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 --- CHANGELOG.md | 4 ++++ skills/floorplan/assets/serve.mjs | 3 +++ tests/ask.test.mjs | 1 + 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8443093..22ef56e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- **Asking a question on the map no longer fails with “Prompt is too long”:** the Ask bar lets Claude Code read and search the project, and it could open the map’s own generated `floorplan/index.html` (about 2 MB on one line). One short question could then grow past the context limit and stop with “Prompt is too long”, after using a lot of the person’s allowance. Claude Code is now told not to read that file or the map’s other generated files. + ## 0.7.3 (2026-11-10) - **A long description no longer covers the map in a short window:** when the map opened in a window that isn’t very tall (a laptop screen, or the map inside a frame), the heading’s description could run over the top row of boxes, because only part of the heading was kept clear when the map was fitted. The whole heading is now kept clear (up to just under half the window), and in a window under 760 pixels tall a long description folds to three lines with a More / Less toggle, as it already did on phones. diff --git a/skills/floorplan/assets/serve.mjs b/skills/floorplan/assets/serve.mjs index 09134e6..360dd0d 100644 --- a/skills/floorplan/assets/serve.mjs +++ b/skills/floorplan/assets/serve.mjs @@ -325,6 +325,9 @@ const failCode = (msg) => /not logged in|logged out|\/login|log ?in again|sign i function claudeRun(body, mode) { const args = [...cli.args, '-p', '--output-format', 'stream-json', '--verbose', '--json-schema', JSON.stringify(mode.schema), '--append-system-prompt', mode.instructions, + // Keep the agent out of the map's own generated files. floorplan/index.html inlines the layout engine and + // fonts (about 2 MB on one line), and reading it can push a single question past the context limit. + '--disallowedTools', 'Read(floorplan/index.html)', 'Read(floorplan/serve.mjs)', 'Read(floorplan/page-safety.mjs)', 'Read(floorplan/.cache/**)', '--tools', 'Read,Grep,Glob,Bash', '--allowedTools', 'Bash(node floorplan/query.mjs:*)', 'Read', 'Grep', 'Glob']; if (body.session) args.push('--resume', String(body.session)); if (model) args.push('--model', model); diff --git a/tests/ask.test.mjs b/tests/ask.test.mjs index dae569c..19cdfc2 100644 --- a/tests/ask.test.mjs +++ b/tests/ask.test.mjs @@ -117,6 +117,7 @@ test('the Claude Code CLI comes first for a map Claude built, with read-only too const [first, second] = s.calls(); assert.ok(first.args.includes('-p')); assert.deepEqual(first.args.slice(first.args.indexOf('--allowedTools') + 1), ['Bash(node floorplan/query.mjs:*)', 'Read', 'Grep', 'Glob']); + assert.ok(first.args.slice(first.args.indexOf('--disallowedTools') + 1).includes('Read(floorplan/index.html)'), 'the generated map page is off limits'); assert.equal(first.input, 'How do refunds work?'); assert.equal(second.args[second.args.indexOf('--resume') + 1], 'test-session'); });