Godotwright
AGENTS.md3 starsChanged 35 days agoMITView on GitHub
Guide for coding agents working on this repository. Godotwright is a coding toolkit for Godot 4.7.x: a CLI and (later) an MCP server that make any coding agent better at Godot. See ROADMAP.md for the plan and the "done" check of each step. - src/cli.ts: executable entry point (godotwright bin). Keep it tiny. - src/program.ts: builds the commander program. Commands are added here. - src/commands/: one file per CLI command. - src/godot/: readers for Godot file formats (Variant text, project.godot,…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,196 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 217
Never write to stdout in code the MCP server runs: stdout is the protocol channel.
- Distinctive: line 223
Prefer Node built-ins over new dependencies.
- Distinctive: line 225
Every new feature comes with tests.
- Very specific: line 232
Never game code: no code, file contents, paths, or project, file or node names in lessons, hints, reports, learned data or anything sent.
- Very specific: line 236
Never into the repository and never online: learned data goes to untracked folders (.godot/ when git ignores it) or Godotwright's state …
- Distinctive: line 243
No trailers, chat or session links, or personal information in commits or files.
- Very specific: line 244
Update the status list in ROADMAP.md when a step is done.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guide for coding agents working on this repository.
What this is
Godotwright is a coding toolkit for Godot 4.7.x: a CLI and (later) an MCP server
that make any coding agent better at Godot. See ROADMAP.md for the plan and the
"done" check of each step.
Commands
npm ci # install exact dependencies
npm run typecheck # tsc, no output files
npm test # vitest
npm run build # compile src/ to dist/
npm run check # all of the above, run this before every commit
node dist/cli.js --helpLayout
src/cli.ts: executable entry point (godotwrightbin). Keep it tiny.src/program.ts: builds the commander program. Commands are added here.src/commands/: one file per CLI command.src/godot/: readers for Godot file formats (Variant text, project.godot, .tscn/.tres, GDScript outline). No I/O in here.src/project/: finding the project root and listing its files.scene-path.ts(resolveScenePath) turns a scene the user or project.godot names (uid://,res://or bare) into its res:// path; play, session, screenshot and check use it.src/scan/: builds the project map and formats it (brief, full, JSON).src/check/: runs Godot headless (import, checker script, optional run) and turns its output into diagnostics. Start Godot withrunGodot(godot.ts): it passes--log-filewith a temp file, so Godotwright's runs never write or rotate the project'suser://logs/godot.log, whichgodot_logsreads for the user's own runs. Other programs (dotnet) go throughrunProcess, with their arguments as given.script-warnings.tsis the@warning_ignore_startline every runner script (play, session, screenshot, checker, shader compile) puts afterextends, so a project that sets GDScript warnings to Error cannot stop it; it names only warnings every supported Godot knows (an unknown name is a parse error).process-end.ts(cleanupOnEnd) stops whatrunGodotstarted in its own process group at exit and on SIGINT, SIGTERM and SIGHUP.src/logs/:godot_logs, the errors of a game the user ran (F5/F6) from the log file it writes.userdir.tsfinds user:// and the log as Godot does (no I/O but project.godot and override.cfg),follow.tsfollows the log across runs and Godot's rotation with a cursor,logs.tsreads and formats the entries.src/uid/sync.ts:godot_uid(uid sync,uid check): pairs.uidfiles left behind by moves outside the editor with the file that moved (git renames, references, committed content, a declared name; never a guess between two) and moves them back through the journal.src/lsp/: Godot's own GDScript language server (godot_code).jsonrpc.tsis the JSON-RPC client with LSP framing,server.tsstartsgodot --editor --headless --lsp-portand keeps one warm server per project (idle stop, killed on exit, restarted when a class_name, project.godot or a file that needs an import changes; a restart waits for the calls queued on the old server),code.tsholds the ops and output.csharp.tsis the second server, for.csfiles: csharp-ls over stdio, through the sameRpcConnection,LanguageServerandLanguageServerPool(code.tspicks the server by the file's extension). Why csharp-ls: a C# server for Godotwright must start without an editor, speak plain LSP over stdio, load a Godot.NET.Sdk project as it is, and be something a user can install with one command and no licence question. csharp-ls is onedotnet tool(MIT), built on Roslyn, so its diagnostics are the compiler's and Godot's source generators run in it (SignalName.Xresolves, and breaks when the delegate is renamed, which is whatgodot_renamerelies on). OmniSharp is in maintenance and needs its own protocol or a wrapper; Microsoft's Roslyn language server ships inside the C# extension for VS Code, is not a documented standalone tool and its C# Dev Kit part is not open source. Measured with csharp-ls 0.16.0 (the last release for .NET 8; each release targets one .NET): it loads a generated Godot project in 2-4 s, answers nothing before the load ends ($/progress"end"), keeps an opened document's text after didClose, and sees files changed on disk only throughworkspace/didChangeWatchedFiles. Godotwright never installs it:csharpLsMissing()names the command for the user's SDK.src/shaders/: the GPU pass over shaders: draws every shader in Godot (Compatibility renderer, xvfb-run on Linux without a display), for what only the GPU driver rejects (a uniform block that is too big, a sampler array indexed by a variable). Language errors are found headless, without it:src/check/shader-compile.ts(Shader.get_rid()runs Godot's full shader compiler on the dummy renderer) forgodot_shader, and the checker ofgodot_check.runner.tsis the GDScript it runs,log.tsreads Godot's shader errors,hints.tsnames the Godot 4 form of Godot 3 shader code, andshaders.tsmaps each error to the line in the .gdshader, .gdshaderinc or .tres/.tscn.godotwright shaders,check --shadersandshader --gpuuse it;src/shader/shader.ts(godot_shader) puts the static review, the headless compile and this pass together.src/screenshot/:screenshot.tsrenders a scene or model with Godot;png.tsis the one PNG reader and writer,diff.tsthe pixel compare (areas of change, moves, blank pictures; diffs in red), andbaseline.tsthe one baseline implementation ("auto", a .png path, or a name with its settings in JSON) that screenshots, scenario screenshot steps andgodotwright cishare. Option names released in 0.5.0 (baseline,threshold,tolerance,update_baseline) keep their meaning.src/api/: lookup and search over the bundled Godot 4.7 class reference.src/review/: the AAA review.src/review/model.tsresolves classes, types, members and scene nodes;checks/holds one file per category (pitfalls.tsandruntime.tshold the rules that came from lessons;nullflow.ts,returns.ts,overrides.tsandexports.tsthe null flow, missing returns, orphaned overrides and unset exports);rules.tslists every rule.control.tsis what the review reports: ignores in code andgodotwright.json"review"(#150), and the rule, category and severity filters (#220). New rules need a test intest/review.test.ts(shader rules intest/review-shader.test.ts), and must stay quiet on the official demo projects (test/integration/review-demos.test.ts).src/model/: checks.glband.gltffiles without Godot.inspect.tsreads what is in a model,lint.tsandrules.tshold the AAA model review,contract.tsreads and checksmodel.contract.json, andgltf.tsis the glTF reader.src/build/: makes models from code.mesh.tsandshapes.tsare the mesh kit,glb.tswrites the GLB,generators/holds the ready-made kinds (house,terrain,sea),spec.tsbuilds a JSON model spec,recipes.tsloadsdata/recipes/, andrun.tsbuilds a model and lints it.src/library/: the asset library (model library,godot_model_library).kit.tsis the authoring kit (node and parameter builders,combos,rng),palette.tsthe named materials,families/<category>/one file per family (each aFamilythat makes its variants as specs),library.tsloads and searches them (English and Dutch words), andformat.tsprints them and makesLIBRARY.md(npm run build:library; a test keeps it in sync). Every asset must build clean against its archetype at its defaults and parameter extremes (test/library/; run one family withLIBRARY_FAMILY=<id>, every extreme withLIBRARY_EXTREMES=all, and keep the .glbs withLIBRARY_DUMP=<dir>).test/integration/library-godot.test.tsimports and loads them in Godot (LIBRARY_GODOT=allfor every asset), andscripts/render-library.mjsrenders contact sheets in Godot (--out <dir> [category] [family]), or the README gallerydocs/library.png(npm run render:library): look at them, a clean lint does not mean a model looks good.src/archetype/: what a thing is, fromdata/archetypes/(library.tsloads it).identify.tsmatches a name in English or Dutch,check.tschecks a model against its archetype, andformat.tsprints the results.src/project/git.ts: the little of git the tools need (which project files changed against a commit, a file as it was there). Read-only; commit names are checked before they reach git.src/diff/:godot_diff, the diff by meaning: scenes and resources (diffResourceText), scripts (diffScriptText), settings, shaders and import files, and what each removal breaks elsewhere in the project.src/merge/:godot_merge.merge.tsis the three-way merge of one file (mergeText: sections by identity, properties one by one, resource ids aligned first, then a repair pass so nothing points at a dropped resource or parent);project.tsfinds the three versions (a merge in progress from the git index, or a branch against HEAD), is the git merge driver (merge --driver) and installs it (merge --install:.gitattributesand the clone's git config).src/bisect/:godot_bisect: the review run on copies of the project at earlier commits (git archiveinto a temp folder), halving the range to the first commit with the problem. Nothing in the working tree or the repository changes.src/scene/structure.ts: the structure operations ofgodot_scene_edit(create_scene, rename_node, move_node, duplicate_node, set_groups, add_nodes);test/integration/scene-structure-corpus.test.tsruns them on real scenes.src/format/:godot_format.tokenizer.tsis a full GDScript tokenizer,format.tsthe formatter with its guard (the tokens before and after must be the same; otherwise the file is left alone),project.tsruns it on a project.csharp.tsis the C# side:dotnet formatrestricted to the files, then the outline compared before and after and a build;formatProjectAllruns both languages into one report and one journal entry.src/rename/:godot_rename.rename.tsplans and applies a rename by name (GDScript, scenes, settings) or of a file;csharp.ts(renameAnywhere, what the CLI and the MCP tool call) renames a symbol declared in C# through the language server and then updates scenes, resources and GDScript. C# code is never renamed as text.scenes.tsholds what a rename by name changes in scenes and resources beyond the usages: node paths through a renamed node (also through instances), saved values of a renamed export, InputEventAction values and script_class headers.src/migrate/:godot_migrate.migrate.tsis the GDScript migration and the project runner,shader.tsthe shaders,csharp.tsGodot 3 C# and the.csproj(the same rename table, with the names in C# form;csharp-names.tsholds the Godot 4 classes whose C# name is not the engine's). A C# rule must be certain from the text alone; what is not becomes a TO DO.GODOT3_MONO_DEMOS=<folder>runs the official Godot 3 C# demos throughtest/integration/migrate-csharp.test.ts.src/scaffold/project.tswrites the.csprojbyte for byte as Godot 4.7.2's ProjectGenerator does (sanitizeNamespaceis Godot's IdentifierUtils); keepGODOT_ENGINE_VERSIONat the Godot version it was compared with.src/migrate/csharp.tsis the Godot 3 C# migration;migrateProjectChecked(src/migrate/migrate.ts) builds its result on a temp copy and turns every compiler error left into a TO DO.src/godot/csharp.ts: the outline of a Godot C# script;src/scan/csharp.tsresolves partial classes and base classes for the project map;src/review/checks/csharp.tsholds the C# rules;src/check/csharp-build.tsrunsdotnet buildand reads MSBuild's diagnostics. The C# tools were run with dotnet 8.0.134, Godot.NET.Sdk 4.7.0 and 4.7.2, and csharp-ls 0.16.0; the integration tests that needdotnetorcsharp-ls(test/integration/*csharp*.test.ts) are skipped without them. Godotwright never installs either.src/editor/:godot_editor:bridge.tsis the client of the editor addon indata/editor-bridge/(localhost, token from.godot/godotwright_bridge.json),install.tscopies and enables the addon. The addon cannot be run in CI: a test checks every engine method it calls against the bundled API data;docs/editor-bridge.mdhas the manual test.src/metrics/:godot_metrics:complexity.ts,signals.ts(signal flow and its three bug lists),stats.ts.src/tilemap/:godot_tilemap:codec.tsreads and writestile_map_data,plan.tsis the plan, journal andload_stepscode thatsrc/animation/shares.src/animation/:godot_animation.src/scaffold/:godot_new(project.ts,script.tswith the templates),godot_preset(presets.ts) andgodot_translations(translations.ts).- Corpus tests (
test/integration/*-corpus.test.ts) run on real projects: setGODOTWRIGHT_CORPUS=<folder>. They never write there. src/impact/:godot_impact: the file graph ofsrc/deps/walked backwards from the changed files to scenes, tests and saved scenarios, and the checks to run.src/collisions/:godot_collisions: physics layers and masks read from the scenes, who detects whom, and what can never work. A new problem rule must stay quiet where code makes shapes or sets layers.data/godot-api.json.gz: generated byscripts/build-api.ts; never edit by hand.src/collector/: the reference collector for shared reports and the aggregation intodata/learned.json(k-anonymity: at least 3 installs).src/learn/bundled.tsloads that file at runtime.src/lessons/: lessons from real projects.data/lessons.jsonholds the bundled ones (library.tsloads it),search.tsfinds them by words, Godot message, rule and archetype and ranks them by feedback,local.tskeeps the lessons learned on this machine,anonymize.tsscrubs names, paths, codes and source code from them (bundled lessons must pass it unchanged;test/lessons.test.tschecks this),hints.tsadds lessons to check and review output, andformat.tsprints lessons and gaps. A new rule that comes from a lesson names it in the lesson'srules.src/mcp/server.ts: the MCP tools and the cheap/premium profiles. Register tools withtool(...), neverserver.registerTool: every tool must be in one set insrc/mcp/toolsets.ts(--tools,--read-onlyand the read-only refusals),src/mcp/instructions.tsholds the server instructions (filtered by the enabled tools), andsrc/mcp/structured.tstheoutputSchemas andstructuredContentof review, check, doctor and test.src/mcp/lean.ts: lean mode (--lean): the tools are kept out of the tool list and run throughgodot, withgodot_helpfor their parameters. A tool needs nothing extra for it; keep itstitleshort, it is the tool's line in the catalogue.src/check/progress.ts: the run context of a tool call: progress messages from Godot's output and cancellation;runGodotuses it, so code that starts Godot needs nothing extra.src/project/protect.ts: protected paths (godotwright.json"protect",$GODOTWRIGHT_PROTECT). Every write Godotwright makes to a project goes throughJournalWriteror callsassertWritableitself.src/hooks/agent-hooks.ts: hooks for coding agents (godotwright hook <event>, Claude Code hook JSON on stdin): review after an edit, lessons under Godot errors in command output, open errors before the agent stops, a project brief at the start. A hook must never fail the agent: on any problem it prints nothing. The plugin calls it throughplugins/godotwright/hooks/run.mjs, which starts the same godotwright version as the plugin's MCP server.src/learn/: local learning.store.tsreads and writes the learning file,learn.tsturns reviews, checks, lookups and feedback into counters and applies them,hooks.tsis what the CLI and MCP server call,share.tsbuilds and sends the opt-in anonymous report (seePRIVACY.md; keep it in sync). Learning must never break a tool, and must never store code, names or paths. Local lessons are free text: they are scrubbed when kept and are never part of a report (only counts per bundled lesson id are).src/dream/: dreaming (godotwright dream,godot_dream).dream.tsturns the learning file, the journal's log of undone writes and (only when asked) session transcripts into numbered proposals with evidence, applies them through the journal (lessons throughsrc/lessons/local.ts, so they are scrubbed), keeps the "Godotwright lessons for agents" note in the private dream folder (src/project/local-dir.ts: the project's untracked.godot/godotwright/, else Godotwright's state folder), and holds the due logic the session-start hook uses.transcripts.tsreads Claude Code and Codex transcripts into anonymous facts only (tool names, message templates, Godot API names): never let their text reach an output, a lesson or a report. Deterministic: no model calls, no network.src/version.ts: package version and the Godot target version.server.json: the MCP Registry entry. Its name and versions must matchpackage.json(mcpName,version); a test checks this.- Install packages, kept in step with
package.jsonbyscripts/sync-version.mjs(whichnpm versionruns) and checked bytest/install.test.ts:.claude-plugin/marketplace.jsonandplugins/godotwright/: the Claude Code marketplace and plugin (MCP server in.mcp.json, skills inskills/, subagents inagents/, hooks inhooks/). Skills and agents may only name MCP tools the server has;test/install.test.tschecks it.gemini-extension.json: the Gemini CLI extension.mcpb/: the Claude Desktop bundle manifest and icon;npm run build:mcpbbuildsbuild/godotwright.mcpb, and the Release workflow attaches it to every release.docs/install.html: every client, with the Cursor and VS Code one-click links.Dockerfile: builds the MCP server from this repository, for directories such as Glama that build and test servers in a container.llms-install.md: install steps written for agents such as Cline.
src/index.ts: public library exports.bench/: the benchmark (tasks with Godot behavior tests, runner, grader). Seebench/README.md. Task tests run in CI by the Bench workflow.docs/: the GitHub Pages site (index.html,demo.svg,og.png), deployed by the Pages workflow. Keep its claims in sync with the README.test/: vitest tests, one file per area.test/setup.tspointsGODOTWRIGHT_HOMEat a temp dir, so tests never touch the real learning file.test/fixtures/demois a small, valid Godot 4.7 project; keep it error-free.test/fixtures/brokenhas known errors.test/fixtures/messyhas one example of most review findings.test/integration/: tests that need a real Godot binary in$GODOT(and$GODOT_DEMOSfor the official demo projects), or the Claude Code and Codex CLIs (AGENT_CLIS=1). CI runs them. The*csharp*ones needdotneton PATH (and NuGet for the first restore), some alsocsharp-ls; they are skipped where those are missing.- Never write to stdout in code the MCP server runs: stdout is the protocol channel.
Conventions
- Node.js >= 22.12, TypeScript in strict mode, ES modules only.
- Relative imports use the
.jsextension (./program.js), as NodeNext requires. - Prefer Node built-ins over new dependencies. Add a dependency only when it clearly pays for itself.
- Every new feature comes with tests. Tests must not need a Godot install unless they are marked as integration tests.
- Output meant for agents is compact and stable, so it is cheap to read and easy to parse.
Privacy
- Never game code: no code, file contents, paths, or project, file or node names in lessons, hints, reports, learned
data or anything sent. Scrub free text (
src/lessons/anonymize.ts) and drop what still looks like code or a name. - Private data only on the user's machine, and only with their permission: reading session transcripts and applying dreams are opt-in per run; automatic applies need the user's one-time consent on that machine.
- Never into the repository and never online: learned data goes to untracked folders (
.godot/when git ignores it) or Godotwright's state folder, never into AGENTS.md, CLAUDE.md or any tracked file. - Learning across machines only anonymously, through the existing opt-in sharing (
src/learn/share.ts,PRIVACY.md).
Commits and content
- Small commits with a short imperative subject (
Add project scan). - No trailers, chat or session links, or personal information in commits or files.
- Update the status list in
ROADMAP.mdwhen a step is done. - Pull requests do not edit
CHANGELOG.md; the maintainer adds the entry, with credit to the contributor, when it is merged. This keeps pull requests from conflicting with each other. - Releases: add the version's section to
CHANGELOG.md, runnpm version X.Y.Z(it also writes the version intoserver.json, the Claude Code plugin and the Gemini CLI extension), then push the commit and the tagvX.Y.Z. The Publish workflow publishes to npm and the MCP Registry; the Release workflow writes the notes and attaches the Claude Desktop bundle. Bump the version only in the release commit: the plugin and the extension start that exact npm version.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

