On-demand project context, in-chat copy, and console-command hardening
v1.5.1 cuts per-turn token cost, makes chat output easy to grab, and closes a run_console_command escape — including two community contributions from @redDwarf03.
Token optimization — on-demand project context (thanks @redDwarf03, #45)
The system prompt previously injected the full project context — up to 30 UCLASS definitions, the source directory tree, and the level actor list — on every turn. It now ships only a one-line summary (ProjectName | N files | N classes | N actors | N assets), with full detail fetched on demand:
- New
GET /mcp/project_contextendpoint exposes the full context (UCLASS list, source tree, level actors) as JSON. - New
unreal_get_project_contextMCP tool serves that detail to Claude only when it's actually needed. GetProjectContextPrompt()reduced to the summary line; static-before-dynamic prompt ordering keeps the system block fully cacheable across turns.
Net effect: −2,000 to −8,000 tokens per turn depending on project size, plus a higher prompt-cache hit rate.
In-chat copy button (thanks @redDwarf03, #43)
- New
SCopyButtonwidget on every chat message and streaming response — copies the message text to the clipboard with a brief "Copied!" confirmation. - Works mid-stream: the copy target is resolved at click time and frozen when streaming finalizes, so you always get the complete message.
- The now-redundant global "Copy Last" toolbar button (and its dead support chain —
OnCopyLast,CopyToClipboard(),LastResponse) was removed in the follow-up cleanup.
Security — run_console_command gating
run_console_command previously called GEditor->Exec directly with no approval. Combined with a denylist that missed py, a console command could launch the Python Editor Script Plugin (py ...) — unapproved arbitrary code / OS execution, reachable by any direct caller on :3000 regardless of the tool being hidden from the model.
run_console_commandnow routes throughFScriptExecutionManager(EScriptType::Console) — the same deny-by-default permission dialog asexecute_script.- Param-validator denylist extended to
py(coverspython),keybind, andsetbind. - README now documents the hidden-by-default scripting tools and how to un-hide them.
- Verified live in Lyra:
py/quitblocked in both auto-approve modes; auto-approve bypasses the dialog, not the denylist.
Docs & maintenance
- README updated for recent Claude Code billing / plan changes.
- MCP bridge submodule bumped for token-optimization completion, reviewer fixes, and test-quality follow-ups.
Pre-built Binaries
UnrealClaude-v1.5.1-Win64.zip ships the prebuilt Win64 editor module. Extract into:
<UE_5.7>/Engine/Plugins/Marketplace/UnrealClaude/
Linux and macOS users should build from source — see INSTALL_LINUX.md and INSTALL_MAC.md.
Acknowledgments
Big thanks to @redDwarf03 for the on-demand project context / token-optimization work (#45) and the in-chat copy button (#43).