Repository navigation
refactor(rql)!: RQL is the only value layer for Unity types (Editor and players); retire the ReflectorNet converters - #1216
Merged
Merged
Conversation
…y tool binding UnityConnectionConfig.ToolFormat and the ToolPresentationFormat enum are gone; a "toolFormat" key in an older config is skipped by the deserializer. RqlToolBinding.Apply always installs the binding. The -toolDataLayer test switch (ToolDataLayerSetUp) and the Json legs of the binding / screenshot tests are removed; tests that ran in both layers keep the RQL leg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ject
parameters is an RQL map of values by name ({go: unity.find("Player"), n: 6}). Full mode
coerces each value to the entry method's declared parameter type with the rules of set
(Vector3 pos: [1, 2, 3]; a defaulted parameter may be left out); snippet mode gives each
variable its value's type (a Unity object's type, string, bool, int, float, an array for a
list of one type, {$type: "Vector3", ...} for a struct). A ref() given a name is answered
with a pointer to unity.find. The result is the plain object RQL presents (bounded as
before); nothing returned reads Success, a typed null null. The script-execute alias follows.
Deleted: ReflectorNet_SerializedMemberList_Adapter, RqlArgumentAttribute (only for the dual
descriptions), the Serialization Check window and the runtime TestSerialization component
(both existed only to show ReflectorNet serialization).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
com.IvanMurzak.Rql ships with the Runtime (includeInBuild, like McpPlugin / ReflectorNet; the committed Rql*.dll.meta now enable every platform). The value layer moves to the Runtime assembly (Runtime/Rql): the shared adapters (vectors, Color, Quaternion, BoundsInt, LayerMask, Gradient, EntityId, Mesh, MeshFilter, Renderer, MonoBehaviour, GameObjectRef), the identity / member part of the Object, GameObject, Component, Transform and Scene adapters (the Scene member whitelist that keeps players from crashing on native getters), UnityRuntimeModule (objects / roots / scenes, unity.find, the type blacklist), RqlRuntime (an engine with reflection accessors for IL2CPP and scene-search refs) and RqlToolBindingCore. The Editor keeps its hooks: RqlUnity (Undo groups, SetDirty, saving), and *_EditorAdapter classes with priority 1 that add the Editor members on top (Undo parent, AddComponent / Destroy / Duplicate, prefabs, asset paths, import settings, Static Editor Flags, project tags / layers). RqlToolBinding is the core over the Editor engine. UnityMcpPluginRuntime installs RqlRuntime.Binding, so a game's tools take and return RQL values. link.xml preserves the Rql assemblies and the engine types the adapters configure. Vectors and Color teach the list form first ([x, y, z]); the quoted "(x, y, z)" text is the alternative (agents left the quotes out inside object literals). Tests/Runtime/RqlRuntimeToolTests: a runtime tool with a class argument (Vector3, Color, a GameObject from unity.find) and a class result, run in Play Mode and in Windows Mono and IL2CPP players (Unity 6000.6.7f1, -testPlatform StandaloneWindows64). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runtime/Converter/** (the Unity reflection and JSON converters, 6 646 lines with ExtensionsJsonElement, which only they used) and their registrations go: CreateDefaultReflector returns ReflectorNet's standard Reflector (named float literals allowed). ReflectorNet keeps McpPlugin's MethodWrapper (tool invocation, parameter plumbing) and its own protocol JSON; no remaining path serializes Unity values with it, so no converter is kept. The IReflectorModule discovery (WithReflectorModulesFromAssembly) goes with them: it existed so assemblies could add converters. Tests that only exercised those converters or ReflectorNet serialization go (5 687 lines): JsonConverters/, ReflectionConverter/, SpriteConverterTest, RunToolStructuredContentTests (the no-binding structured-content contract; its return-kind test methods move to TestReturnTypeMethods.cs for the RQL result tests), ReflectorModuleDiscoveryTests, AtomicApi/ (ReflectorNet's atomic API, which the plugin no longer calls) and SerializeTest.cs in every Unity-Tests project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ayers docs/dev/rql.md no longer calls RQL an experiment and describes the runtime value layer (Runtime/Rql), the Editor layer on top, csharp-exec's parameters and the player test run; docs/agents/architecture.md gets the data-layer note; Development.md (and its six translations), Docs/agents/structure.md and copilot-instructions.md drop the ReflectorNet converters. The three 'via ReflectorNet' tool texts of extensions.catalog.json (and its TypeScript and C# mirrors) say rql-mutate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lookups by name, cheaper runtime refs - FullSourceEntryType hands its entry class declaration to SnippetParameters.DeclaredBy (no second parse and search); EntryMethods is the one static-method filter; the Runner and the $type lookup share one default-usings list. - ForMethod maps the values by name once; Coerce is an instance method. - RqlRuntime.ResolveStableRef parses the id once and compares numbers over one component list per root instead of formatting a string per object. - Dead code: RqlUnity.FindGameObject (unity.find is registered by UnityRuntimeModule), the timing log around new Reflector(); stale ReflectorNet comments; a double blank line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat a player has csharp-exec: - the overload is chosen by the given parameter names (not their count) - `string?` / `GameObject?` parameters resolve; nested types (Outer.Inner); exact short names only - whole numbers beyond int are long - the result is presented once by RQL (bounded to its ~64 KB output, "N results (of M)") Runtime engine (players and Play Mode): - Play Mode leaves out modules of Editor-only assemblies (asked from the compilation pipeline) - the Collider adapter (material is explicit-only) is shared with players - DontDestroyOnLoad roots are part of roots/objects while the game runs - Type#id refs fall back to every loaded object (assets, kept objects) - no "asset path" hints where the engine cannot resolve one (tool type text, Mesh) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… parameters Recorded locally with ChainRecordTests (-CHAIN_RECORD_OUT / -CHAIN_BATTERY) on 2022.3.62f3, 6000.0.85f1, 6000.3.27f1 and 6000.6.7f1, canonicalized with .github/scripts/chain_fixture.py. The only changes are csharp-exec's parameter text (SnippetParameters) and the vector description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ref("Name") points to unity.find for every tool
From the AFTER evaluation of this PR:
- csharp-exec snippet mode: {target: [-3.5, 1.25, 4.75]} meant a Vector3 and compiled as float[]. A key may now
carry the C# type before the name, as Godot-MCP takes it: {"Vector3 target": [1, 2, 3], "int[] ids": [1, 2]}.
A whole value of 2 to 4 numbers without a type is an error that names that form; other lists (and lists of lists)
still infer arrays. Object / Random written there are UnityEngine's, as in the snippet. Parameter names must be C#
identifiers (a keyword as @name).
- A compile error that converts an inferred variable's type (CS0029 / CS0266 / CS1503 naming it) adds a note: which
variables took their value's type and how to write another.
- Any tool argument (RqlToolBindingCore.TryConvert, Editor and players): a ref() holding a name instead of a $ref,
e.g. spawnParent: ref("Spawner"), says what ref takes and suggests unity.find("Spawner") (an asset path: the path
as text). csharp-exec's own ref error uses the same text, only for a malformed ref.
- The parameter description, the adapter text and the skill body teach the typed key; chain fixtures re-recorded
(2022.3.62f3, 6000.0.85f1, 6000.3.27f1, 6000.6.7f1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… findings, fixed before the commit above)
The review of this delta (an independent reviewer over the uncommitted diff) found, and the fix commit already contains:
1. chain fixtures still held the old parameter text: re-recorded on the four versions
2. nested number lists ([[1, 2, 3], [4, 5, 6]]) were rejected: only a whole value of 2-4 numbers needs a type
3. a written Object / Random resolved to System's: UnityEngine's unless the usings alias the name
4. the csharp-exec ref hint fired on any "reference" error (stale refs) with an invented name: malformed refs only
5. the compile-error note fired on conversions unrelated to the parameters: only when an error names an inferred type
6. an asset path in ref() was pointed to unity.find, and ref('Name') was missed: path hint, both quote styles
7. names such as "fixed" or "a-b" reached the generated code: C# identifiers only, keywords as @name
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IvanMurzak
marked this pull request as ready for review
November 28, 2026 14:56
IvanMurzak
added a commit
that referenced
this pull request
Nov 29, 2026
…tional-unity-mcp-build - Gate generation: main released UNITY_MCP_DEPS_54 (core 1.16.0, extensions 2.1.9, published without the player constraint), so the branch moves to 55 everywhere, and `extensions.py settle` moves the extensions to 2.1.10. - com.IvanMurzak.Rql is a runtime package now: its DLL importers (written by Unity 2022.3.62f3) carry the player opt-in; Runtime asmdef keeps main's Rql references and versionDefines, loses PlayerPrefsEx, keeps the constraint. - RqlRuntime decided which modules are Editor-only by "not compiled into players", which follows the player defines: without the opt-in every gated runtime module would be left out of Play Mode. It asks for the Editor-only flag instead (as RqlTests does). - EditorPrefsValue: the PlayerPrefsEx settings of 1.16 are migrated too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IvanMurzak
added a commit
that referenced
this pull request
Nov 29, 2026
…and docs match the merged state - RqlRuntime.EditorOnlyByAssemblyName: RqlTests asked the compilation pipeline with its own copy of the rule. - NuGetConfig / NuGetPackage: the generation text names 55, IncludeInBuild says what it means with the player opt-in. - LinkExtractor comments and CHANGELOG: our link.xml keeps engine types for RQL too (main's #1216). - PlayerBuildCheck: Rql is one of our names for the compile-error hint. - docs: the runtime RQL tests in a player need the opt-in (`extensions.py prepare` adds it); why the generation moved. Skipped: deriving OurNames from ClassifyInstalled, IFilterBuildAssemblies instead of SourcesFor, IUnityLinkerProcessor instead of the merged link.xml, one Expected() for importer state, caching nuspec / AssemblyRef reads (redesigns of the reviewed feature); the leftover extensions.unity registry scope in READMEs and test projects (harmless, older plugins need it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
RQL becomes the only value layer for Unity types, in the Editor and in game builds. ReflectorNet keeps only what McpPlugin needs from it: MethodWrapper (tool invocation, schema/argument plumbing) and its standard .NET JSON for McpPlugin's own protocol data.
Draft: an agent before/after evaluation (
evals/rn-retirement-2026-11) runs before this is marked ready.Commits (one per step)
ToolFormat=Json.UnityConnectionConfig.ToolFormatandToolPresentationFormatare gone. A"toolFormat"key in an older config is skipped by the deserializer (covered by a test).RqlToolBinding.Applyalways installs the binding. Also removed: the-toolDataLayertest switch (ToolDataLayerSetUp) and the Json legs of the binding and screenshot tests. Tests that ran in both layers keep their RQL leg. CI passed no-toolDataLayerargument, and there was no settings UI for the switch.csharp-exectakes RQL values. The hiddenscript-executealias follows.parametersis an RQL map such as{go: unity.find("Player"), n: 6}:set(Vector3 pos: [1, 2, 3]). A parameter that has a default may be left out. An unknown name or a missing required name gets an error listing the method's parameters.string,bool,int,float, an array for a list of one type, or the type named by{$type: "Vector3", …}for a struct.ref("Crate")with a name fails with a pointer tounity.find("Crate"). Eval input: it used to fail as "RqlError values are not supported".N results (of M)). Nothing returned readsSuccess; a typed null readsnull.ReflectorNet_SerializedMemberList_Adapter,RqlArgumentAttribute(it only existed for the dual descriptions), the Serialization Check window (menu item, debug button, uxml/uss) and the runtimeTestSerializationcomponent. Both of the last two only showed ReflectorNet serialization.com.IvanMurzak.Rqlis nowincludeInBuild. The committedRql*.dll.metafiles in the plugin project and all 6Unity-Testsprojects enable every platform. The configurator writes the same settings, but CI skips it because the DLLs are committed.Runtime/Rql(new): the value layer shared by the Editor and players:UnityRuntimeModule:objects/roots/scenes,unity.find, the type blacklist;RqlRuntime: reflection accessors for IL2CPP;Type#idrefs resolved by a scene search, then over every loaded object (assets, DontDestroyOnLoad), because a player has no EditorUtility;roots/objectsinclude the DontDestroyOnLoad scene while the game runs; in Play Mode the engine leaves out modules of Editor-only assemblies (asked fromCompilationPipeline), so it matches a player;materialinstantiates a copy, so it is explicit-only), moved out of the Editor Physics module; the Runtime asmdef gets the samecom.unity.modules.physicsversion define;RqlToolBindingCore.RqlUnitykeeps the Undo groups, SetDirty and saving. New*_EditorAdapterclasses (priority 1, configured after the shared adapter of the same type) add the Editor members: Undo-recorded parent, AddComponent / Destroy / Duplicate, prefabs, asset paths, import settings, Static Editor Flags, and the project's tags and layers.UnityMcpPluginRuntimeinstallsRqlRuntime.BindinginApplyConfigToMcpPlugin.link.xml: preserves the Rql assemblies and the engine types the adapters configure. It does not preserve all ofUnityEngine.CoreModule, which costs about 5 MB on WebGL; the comment says how a game adds it.[x, y, z]first. Eval input: agents dropped the quotes of"(x, y, z)"inside object literals, andorigin: (2, 0, 5)does not parse.Runtime/Converter/**plusExtensionsJsonElement, which only they used, and the registrations inUnityMcpPlugin.Converters.cs. TheIReflectorModulediscovery (WithReflectorModulesFromAssembly) goes too: it only existed so other assemblies could add converters. No converter is kept: no remaining path serializes Unity values with ReflectorNet. Tool results go through the binding; prompts return text;TestResultCollectorserializes plain test-result objects.docs/dev/rql.md: the header no longer says experimental; new runtime section and test commands;docs/agents/architecture.md;docs/dev/Development*.md: English and all 6 translations;Docs/agents/structure.mdand.github/copilot-instructions.md;extensions.catalog.json, plus its TS and C# mirrors (the parity tests pass);Deleted (lines)
Runtime/Converter/**,ExtensionsJsonElement)SerializeTest.cs×6SerializedMemberListadapter,RqlArgumentAttribute, Serialization Check window (+uxml/uss),TestSerialization,ToolDataLayerSetUpWhat remains of ReflectorNet
RunTool/ MethodWrapper: method invocation and parameter plumbing. ItsMethodUtils.IsParameterNullabledecides whether a parameter is required in the RQL schema.CreateDefaultReflector(): ReflectorNet's standardReflector, only to allow named float literals. It has no Unity converters and no blacklist.ReflectorNet.Utils:MainThread,TypeUtils,AssemblyUtils.ReflectorNet.Model(JsonSchemanames).Behaviour changes for users
No Json data layer:
toolFormatis ignored. Every tool's schema, arguments and result are RQL.csharp-execparameters are an RQL map, not a list of{name, typeName, value}:[{"name": "go", "typeName": "UnityEngine.GameObject", "value": {"instanceID": 12}}]{go: ref("GameObject#12")}or{go: unity.find("Player")}.Its result is the presented value (
42, a Vector3 as(1, 2, 3), a GameObject or class with its members) instead ofSystem.Int32: 42and serialized members.Runtime tools (
UnityMcpPluginRuntime, in players and in Play Mode) now take and return RQL values, as Editor tools do: a class argument as{position: [1, 2, 3], color: [1, 0, 0], target: unity.find("Crate")}. In a player,Type#idrefs resolve to scene objects first, then to any loaded object; asset paths exist only in the Editor, and the player's type texts (Unity object refs, Mesh) no longer mention them. TheUnity.Mathematicsadapters (float3…) stay Editor-only.Removed: the Serialization Check window (Tools > AI Game Developer > Debug > Serialization Check, and the "Check" button in the main window), and the runtime
TestSerializationcomponent.Player build size: the RQL DLLs (
Rql.Contracts/Parser/Execution) ship in builds that include the plugin's Runtime assembly.link.xmlpreserves them and about 30 engine types.Migration notes
"toolFormat": "Json"loads unchanged and runs RQL. Hosts that wrote the key can stop writing it.csharp-execwith the old parameter list must pass an RQL map, as above.RqlUnity/RqlEditorApi/MemberTableExtensions, which keep their names and namespaces. No extension usesIReflectorModuleor the converters. The Cinemachine README still describes the removedcinemachine-modifytool; I left that separately versioned extension's text unchanged.com.IvanMurzak.Unity.MCP.Runtime.Rql.Adapters, andCompactText/TypeNames/ the binding core incom.IvanMurzak.Unity.MCP.Runtime.Rql.ToolFormat. The Editor'sRqlToolBinding.Instance/Applykeep their names.link.xml(e.g.<assembly fullname="UnityEngine.CoreModule" preserve="all"/>).After the AFTER evaluation (first try 18/24 → 21/24)
Typed snippet parameters: in snippet mode a key may carry the C# type before the name, as Godot-MCP takes it:
{"Vector3 target": [-3.5, 1.25, 4.75], "Color tint": "#ff8800", "int[] ids": [1, 2]}.{"Vector3 target": [...]}or{"float[] target": [...]}). Before, it becamefloat[]and failed to compile.Object/Randommeans UnityEngine's type, as in the snippet.@name.Compile hint: a compile error that converts an inferred variable's type (CS0029 / CS0266 / CS1503) adds a note saying which variables took their value's type and how to write another.
ref("Name")in any tool argument (Editor and players):spawnParent: ref("Spawner")now says that ref takes a$refand suggestsunity.find("Spawner"). An asset path inref()is told to pass the path as text instead.Verification:
RqlToolBindingTests|CSharpExecRqlToolBindingTests|CSharpExecRql|CSharpExec|ScriptRqlRuntimeToolTestsChainRecordTests(fixtures re-recorded; only the parameter text changed)One earlier EditMode run on 6000.6.7f1 stopped making progress during a csharp-exec test, and I killed it. Four later runs of the same tests, alone and in the full filter, all passed, so I could not reproduce it.
Verification
All runs are local, on Windows 11, batch mode (
-batchmode -CI true -GITHUB_ACTIONS true), against theUnity-Tests/<version>projects.Rql|CSharpExec|Script(-nographics), after the code-review fixesRql|CSharpExec|Script(-nographics), after the code-review fixesRqlRuntimeToolTests-testPlatform StandaloneWindows64 -testFilter RqlRuntimeToolTests, built and run by the test runnerRql.*andcom.IvanMurzak.Unity.MCP.Runtimeamong the included assemblies. Re-run after the code-review fixes.GameAssembly.dll, andManagedStrippedcontains the Rql DLLs.ChainRecordTests(-CHAIN_RECORD_OUT chain-record/raw.json -CHAIN_BATTERY ../../tests/chain-fixtures/battery.json), thenchain_fixture.py canonicalizeTests~/EngineFreedotnet testcheck_nuget_gate.pyThe player smoke is
RqlRuntimeToolTests. A game tool,Spawn(SpawnRequest {string name, Vector3 position, Color color, GameObject parent})returningSpawnResult(Vector3, Color, GameObject inside), is registered on a realMcpToolManager, andRqlRuntime.Bindingis installed on it. The tool is called with{name: "Crate", position: [1, 2, 3], color: [1, 0, 0], parent: unity.find("RqlRuntimeParent")}. The tests check:(1, 2, 3);(1, 2, 3), the parent's name and aGameObject#…ref;The suite failures depend on this machine (I did not run
mainfor comparison). None of them involve RQL, tool bindings or serialization:ServerVersionDecouplingTests×4: access to TEMP is denied;SkillInitialSetupTests×3: the Windows.cmdtext;ExtensionIsolationTests×1, on 6000.6 only: the PackageCache path.Eval input (BEFORE run, ai-game-dev-software#2066):
set, e.g. from[1, 2, 3](csharp-exec tests inRqlToolBindingTests).ref("Crate")fails with a pointer tounity.find("Crate"), and the parameter text teachesunity.find.[x, y, z]first.(x, y, z)without quotes is not an RQL literal; the quoted text"(x, y, z)"still works.🤖 Generated with Claude Code