Repository navigation
Move surface rules from the host notes into tool descriptions (#73) - #75
Merged
Merged
Conversation
The server instructions had 3 of Claude Code's 2,048 characters left. They now keep only the rules for every call on every surface (when to use cua, end_task, one controller, observe-act-verify, batching and bounded polls, cancellation, macOS's per-app approval, the secret store, the devices rule) and measure 765 to 955 characters with the vendor's line. Each surface's own rules are in the description of the tool they govern: the Chrome rules in profiles_list's, the macOS or Linux computer rules ahead of the vendor's js description (whose schema and text pass through), the device rule in devices_use's. A device's surface rules are now in its own tool descriptions, which the local client never lists, so devices_use lists the device's tools while switching and returns its js and profiles_list descriptions as `tools` beside `hostNotes`; a device that cannot list them is not switched to (device_protocol). Claude Code 2.1.292 caps tool descriptions at 2,048 characters too, keeping the head, so cua's lines come first and every description cua writes fits. The acceptance runner's C4 check reads the Chrome rules from profiles_list's description. Plugin 0.3.2.
…ools The device can answer a tools/list whose devices_use the client has already cancelled. The switch then went ahead and its answer went to a withdrawn request, so the model believed it was still on local. A cancelled switch now ends the new session and is withdrawn (review of #73). Also two places that still said the host notes carry the Chrome rules.
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.
Closes #73
The server instructions had 3 of Claude Code's 2,048 characters left (Linux
computer,browser, 2,045). Following the owner's decision, they now keep only the rules for every call on every surface, and each surface's own rules move into the description of the tool they govern.Where every rule went
Host notes:title; "Use when a macOS/Linux app's GUI is the only way…" / "Use for the user's existing Chrome profiles…" heads{{secret:KEY}}devices_usedescriptionjsdescription, macOSjs, macOSjs, macOSjs, macOScua.getApp({windowId})/ listWindows, js_reset and rebindjs, Linuxjs, Linuxjs, Linuxjs, Linuxprofiles_listdescriptionprofiles_list(+ a pointer line injs)profiles_list(+ pointer)profiles_list(+ pointer)profiles_list(+ pointer)setValue/selectTextdo not exist; paste typesjs, Linuxtest/mcp-browser-surface.test.mjspins every rule to its new home with a regex, asserts each is absent from the instructions, that no macOS-only rule reaches anything a Linux model sees, that cua's lines sit before the 2,048-character description cut even behind a 3,000-character vendor text, and that the instructions stay under 1,400 characters on all 12 platform × surface × devices combinations.Instructions length (vendor's 63-character line included): macOS computer 846 (955 with devices), browser 792 (901), computer+browser 846 (955); Linux computer 765 (874), browser 792 (901), computer+browser 765 (874).
Two things the brief did not anticipate
CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH, keeps the head, appends "… [truncated]"). So cua's lines come first.profiles_listis 1,102 anddevices_use507. With the computer surface alone,jsis 415 + 2 + the vendor's 1,511 = 1,928, so it fits whole. With the browser surface the vendor's ownjstext was already over the cap before this change (2,847 browser-only, 2,952 with both). cua's lines push out more of that tail: the in-app, MCP Apps and named-browser options, which cua's Chrome route doesn't use. The firstjscall still returns the whole API document. Logged intech-debt-tracker.md: with both surfaces (the plugin's default), the cut already hidcua.getApp(...)before this change.devices_usesendstools/listto the device while switching and returns itsjsandprofiles_listdescriptions astoolsbesidehostNotes, in the structured content and in the text's JSON line. A device that can't list its tools isn't switched to (device_protocol); the target stays unchanged and the new session is ended. Without this, a macOS client switching to a Linux device would lose the Linux rules.Also: the acceptance runner's C4 check now reads the Chrome rules from
profiles_list's description. README "Operating guidance for agents" (and the lines that said "the host notes say so") now say where the rules live. Decision Log entry dated 2026-10-07. Plugin 0.3.2.Verification
npm test: 781 tests, 780 pass, 1 platform skip, 0 fail.devices_usecancelled while the device'stools/listwas in flight could still switch if the device answered anyway; it now ends the new session and is withdrawn, with a test that fails without the fix. Not changed: the Linux vendorjsdescription length is unmeasured here (no Linux runtime on this Mac), so whether the Linux computer-onlyjsdescription fits whole (cua's 576 characters plus the vendor's) is unverified; cua's own lines are inside the cut either way.cua-shim.mjsregistered ascua_repl(CUA_SHIM_SURFACES=computer,browser),claude -p "list the Chrome profiles, then tell me verbatim the rules you were given about driving Chrome tabs" --tools "" --strict-mcp-config --mcp-config <file> --allowedTools mcp__cua_repl__profiles_list(Claude Code 2.1.292). The model calledprofiles_list, thenend_task, and quoted the description's rules back, DOM-only and 3 s included. It attributes thejspointer line to "the server instructions", but the line is in thejsdescription. Instance ids elided: