agentleFS
laaielichterlaaielichter/Godotwright/AGENTS.md

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.

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
  1. Distinctive:

    Never write to stdout in code the MCP server runs: stdout is the protocol channel.

    line 217
  2. Distinctive:

    Prefer Node built-ins over new dependencies.

    line 223
  3. Distinctive:

    Every new feature comes with tests.

    line 225
  4. Very specific:

    Never game code: no code, file contents, paths, or project, file or node names in lessons, hints, reports, learned data or anything sent.

    line 232
  5. Very specific:

    Never into the repository and never online: learned data goes to untracked folders (.godot/ when git ignores it) or Godotwright's state …

    line 236
  6. Distinctive:

    No trailers, chat or session links, or personal information in commits or files.

    line 243
  7. Very specific:

    Update the status list in ROADMAP.md when a step is done.

    line 244

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 --help

Layout

  • 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, .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 with runGodot (godot.ts): it passes --log-file with a temp file, so Godotwright's runs never write or rotate the project's user://logs/godot.log, which godot_logs reads for the user's own runs. Other programs (dotnet) go through runProcess, with their arguments as given. script-warnings.ts is the @warning_ignore_start line every runner script (play, session, screenshot, checker, shader compile) puts after extends, 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 what runGodot started 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.ts finds user:// and the log as Godot does (no I/O but project.godot and override.cfg), follow.ts follows the log across runs and Godot's rotation with a cursor, logs.ts reads and formats the entries.
  • src/uid/sync.ts: godot_uid (uid sync, uid check): pairs .uid files 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.ts is the JSON-RPC client with LSP framing, server.ts starts godot --editor --headless --lsp-port and 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.ts holds the ops and output. csharp.ts is the second server, for .cs files: csharp-ls over stdio, through the same RpcConnection, LanguageServer and LanguageServerPool (code.ts picks 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 one dotnet tool (MIT), built on Roslyn, so its diagnostics are the compiler's and Godot's source generators run in it (SignalName.X resolves, and breaks when the delegate is renamed, which is what godot_rename relies 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 through workspace/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) for godot_shader, and the checker of godot_check. runner.ts is the GDScript it runs, log.ts reads Godot's shader errors, hints.ts names the Godot 4 form of Godot 3 shader code, and shaders.ts maps each error to the line in the .gdshader, .gdshaderinc or .tres/.tscn. godotwright shaders, check --shaders and shader --gpu use it; src/shader/shader.ts (godot_shader) puts the static review, the headless compile and this pass together.
  • src/screenshot/: screenshot.ts renders a scene or model with Godot; png.ts is the one PNG reader and writer, diff.ts the pixel compare (areas of change, moves, blank pictures; diffs in red), and baseline.ts the one baseline implementation ("auto", a .png path, or a name with its settings in JSON) that screenshots, scenario screenshot steps and godotwright ci share. 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.ts resolves classes, types, members and scene nodes; checks/ holds one file per category (pitfalls.ts and runtime.ts hold the rules that came from lessons; nullflow.ts, returns.ts, overrides.ts and exports.ts the null flow, missing returns, orphaned overrides and unset exports); rules.ts lists every rule. control.ts is what the review reports: ignores in code and godotwright.json "review" (#150), and the rule, category and severity filters (#220). New rules need a test in test/review.test.ts (shader rules in test/review-shader.test.ts), and must stay quiet on the official demo projects (test/integration/review-demos.test.ts).
  • src/model/: checks .glb and .gltf files without Godot. inspect.ts reads what is in a model, lint.ts and rules.ts hold the AAA model review, contract.ts reads and checks model.contract.json, and gltf.ts is the glTF reader.
  • src/build/: makes models from code. mesh.ts and shapes.ts are the mesh kit, glb.ts writes the GLB, generators/ holds the ready-made kinds (house, terrain, sea), spec.ts builds a JSON model spec, recipes.ts loads data/recipes/, and run.ts builds a model and lints it.
  • src/library/: the asset library (model library, godot_model_library). kit.ts is the authoring kit (node and parameter builders, combos, rng), palette.ts the named materials, families/<category>/ one file per family (each a Family that makes its variants as specs), library.ts loads and searches them (English and Dutch words), and format.ts prints them and makes LIBRARY.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 with LIBRARY_FAMILY=<id>, every extreme with LIBRARY_EXTREMES=all, and keep the .glbs with LIBRARY_DUMP=<dir>). test/integration/library-godot.test.ts imports and loads them in Godot (LIBRARY_GODOT=all for every asset), and scripts/render-library.mjs renders contact sheets in Godot (--out <dir> [category] [family]), or the README gallery docs/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, from data/archetypes/ (library.ts loads it). identify.ts matches a name in English or Dutch, check.ts checks a model against its archetype, and format.ts prints 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.ts is 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.ts finds 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: .gitattributes and the clone's git config).
  • src/bisect/: godot_bisect: the review run on copies of the project at earlier commits (git archive into 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 of godot_scene_edit (create_scene, rename_node, move_node, duplicate_node, set_groups, add_nodes); test/integration/scene-structure-corpus.test.ts runs them on real scenes.
  • src/format/: godot_format. tokenizer.ts is a full GDScript tokenizer, format.ts the formatter with its guard (the tokens before and after must be the same; otherwise the file is left alone), project.ts runs it on a project. csharp.ts is the C# side: dotnet format restricted to the files, then the outline compared before and after and a build; formatProjectAll runs both languages into one report and one journal entry.
  • src/rename/: godot_rename. rename.ts plans 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.ts holds 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.ts is the GDScript migration and the project runner, shader.ts the shaders, csharp.ts Godot 3 C# and the .csproj (the same rename table, with the names in C# form; csharp-names.ts holds 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 through test/integration/migrate-csharp.test.ts.
  • src/scaffold/project.ts writes the .csproj byte for byte as Godot 4.7.2's ProjectGenerator does (sanitizeNamespace is Godot's IdentifierUtils); keep GODOT_ENGINE_VERSION at the Godot version it was compared with. src/migrate/csharp.ts is 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.ts resolves partial classes and base classes for the project map; src/review/checks/csharp.ts holds the C# rules; src/check/csharp-build.ts runs dotnet build and 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 need dotnet or csharp-ls (test/integration/*csharp*.test.ts) are skipped without them. Godotwright never installs either.
  • src/editor/: godot_editor: bridge.ts is the client of the editor addon in data/editor-bridge/ (localhost, token from .godot/godotwright_bridge.json), install.ts copies 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.md has 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.ts reads and writes tile_map_data, plan.ts is the plan, journal and load_steps code that src/animation/ shares. src/animation/: godot_animation.
  • src/scaffold/: godot_new (project.ts, script.ts with the templates), godot_preset (presets.ts) and godot_translations (translations.ts).
  • Corpus tests (test/integration/*-corpus.test.ts) run on real projects: set GODOTWRIGHT_CORPUS=<folder>. They never write there.
  • src/impact/: godot_impact: the file graph of src/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 by scripts/build-api.ts; never edit by hand.
  • src/collector/: the reference collector for shared reports and the aggregation into data/learned.json (k-anonymity: at least 3 installs). src/learn/bundled.ts loads that file at runtime.
  • src/lessons/: lessons from real projects. data/lessons.json holds the bundled ones (library.ts loads it), search.ts finds them by words, Godot message, rule and archetype and ranks them by feedback, local.ts keeps the lessons learned on this machine, anonymize.ts scrubs names, paths, codes and source code from them (bundled lessons must pass it unchanged; test/lessons.test.ts checks this), hints.ts adds lessons to check and review output, and format.ts prints lessons and gaps. A new rule that comes from a lesson names it in the lesson's rules.
  • src/mcp/server.ts: the MCP tools and the cheap/premium profiles. Register tools with tool(...), never server.registerTool: every tool must be in one set in src/mcp/toolsets.ts (--tools, --read-only and the read-only refusals), src/mcp/instructions.ts holds the server instructions (filtered by the enabled tools), and src/mcp/structured.ts the outputSchemas and structuredContent of review, check, doctor and test.
  • src/mcp/lean.ts: lean mode (--lean): the tools are kept out of the tool list and run through godot, with godot_help for their parameters. A tool needs nothing extra for it; keep its title short, 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; runGodot uses 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 through JournalWriter or calls assertWritable itself.
  • 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 through plugins/godotwright/hooks/run.mjs, which starts the same godotwright version as the plugin's MCP server.
  • src/learn/: local learning. store.ts reads and writes the learning file, learn.ts turns reviews, checks, lookups and feedback into counters and applies them, hooks.ts is what the CLI and MCP server call, share.ts builds and sends the opt-in anonymous report (see PRIVACY.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.ts turns 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 through src/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.ts reads 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 match package.json (mcpName, version); a test checks this.
  • Install packages, kept in step with package.json by scripts/sync-version.mjs (which npm version runs) and checked by test/install.test.ts:
    • .claude-plugin/marketplace.json and plugins/godotwright/: the Claude Code marketplace and plugin (MCP server in .mcp.json, skills in skills/, subagents in agents/, hooks in hooks/). Skills and agents may only name MCP tools the server has; test/install.test.ts checks it.
    • gemini-extension.json: the Gemini CLI extension.
    • mcpb/: the Claude Desktop bundle manifest and icon; npm run build:mcpb builds build/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). See bench/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.ts points GODOTWRIGHT_HOME at a temp dir, so tests never touch the real learning file. test/fixtures/demo is a small, valid Godot 4.7 project; keep it error-free. test/fixtures/broken has known errors. test/fixtures/messy has one example of most review findings.
  • test/integration/: tests that need a real Godot binary in $GODOT (and $GODOT_DEMOS for the official demo projects), or the Claude Code and Codex CLIs (AGENT_CLIS=1). CI runs them. The *csharp* ones need dotnet on PATH (and NuGet for the first restore), some also csharp-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 .js extension (./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.md when 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, run npm version X.Y.Z (it also writes the version into server.json, the Claude Code plugin and the Gemini CLI extension), then push the commit and the tag vX.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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.