Unity Repository Bootstrap
Create an idempotent, repository-specific AGENTS.md workflow for an existing Unity project. Do not create Cursor configuration or overwrite existing instructions.
Confirm the project
- Locate the intended repository or project root instead of assuming the current directory is correct.
- Require
Assets/ and ProjectSettings/ProjectVersion.txt. If either is absent, stop and explain that the target is not identifiable as a Unity project.
- Read any existing root
AGENTS.md and AGENTS.override.md before proposing changes. An AGENTS.override.md shadows AGENTS.md at the same level; do not create misleading inactive guidance. Ask the user which file should remain authoritative before changing that situation.
Discover project facts
Read only enough project data to make the guidance accurate:
ProjectSettings/ProjectVersion.txt for the exact Editor version.
Packages/manifest.json and Packages/packages-lock.json for package versions and local or embedded dependencies.
- Relevant graphics and quality settings plus package IDs to identify Built-in, URP, HDRP, or a custom render pipeline.
- Existing
.asmdef and .asmref files to understand runtime, Editor, platform, and test assemblies.
- Existing test folders, CI workflows, build scripts, repository docs, and tool wrappers to find commands that actually work here.
- Existing source layout and naming conventions. Do not impose
Assets/_Game or another personal layout when the repository uses something else.
Record uncertainty honestly. Do not infer a render pipeline, test command, or installed Editor path when the inspected files do not establish it.
Create or merge AGENTS.md
Use assets/AGENTS.unity.md as a fragment, not as a file to copy blindly.
- If
AGENTS.md does not exist, create it with an adapted Unity section.
- If it exists, preserve all current content and merge a
## Unity project workflow section with apply_patch.
- If a Unity section already exists, update that section instead of appending a duplicate.
- Replace or remove every template placeholder. Include only commands and paths supported by inspected repository files.
- Keep broad organization policy at the root and place specialized guidance in a nested
AGENTS.md only when the repository layout genuinely needs a narrower override.
The resulting guidance should cover:
- The exact Unity Editor version and known render pipeline.
- Relevant source, package, settings, test, and assembly-definition paths.
- Generated directories that Codex must not edit or broadly scan:
Library/,
Temp/, obj/, Obj/, and Logs/. An exact current Editor or test log may
be read narrowly when it is the primary failure signal.
- Serialized asset and
.meta handling, including GUID preservation.
- The repository's real compile, EditMode, PlayMode, build, or visual-validation commands.
- A requirement to report when the matching Editor, license, target platform, or visual path was unavailable.
Safety boundaries
- Never overwrite or replace an existing
AGENTS.md; merge narrowly and preserve unrelated user content.
- Never create
.cursorignore, .cursor/rules/, or other Cursor configuration as part of this workflow.
- Do not add
.codex/config.toml, hooks, rules, packages, tests, or CI files unless the user separately requests them.
- Do not open or upgrade the project in Unity merely to initialize Codex guidance.
- Do not write personal absolute Editor paths, credentials, license data, or machine-specific secrets into repository instructions.
- Do not edit generated Unity directories or generated IDE project files. Do
not broadly scan generated directories; a targeted read of an exact current
Editor or test log is allowed when diagnosing that failure.
Validate the bootstrap
- Re-read the final
AGENTS.md and inspect its diff.
- Confirm that discovered version, pipeline, paths, and commands match the files inspected.
- Confirm that no template placeholders, duplicate Unity sections, Cursor-only syntax, or unsupported commands remain.
- Report the file changed, facts recorded, and any unresolved validation command or shadowing
AGENTS.override.md.
Codex reads project instruction files when a run starts. State that newly written guidance governs subsequent Codex runs; do not claim it governed work already completed in the current run.
1---2name: unity-init3description: Bootstrap or repair Codex guidance for an existing Unity repository by inspecting its Unity version, packages, render pipeline, layout, and validation commands, then creating or carefully merging a root AGENTS.md. Use when the user asks to initialize, bootstrap, or configure Codex for a Unity project. Do not trigger merely because AGENTS.md is absent.4---56# Unity Repository Bootstrap78Create an idempotent, repository-specific `AGENTS.md` workflow for an existing Unity project. Do not create Cursor configuration or overwrite existing instructions.910## Confirm the project11121. Locate the intended repository or project root instead of assuming the current directory is correct.132. Require `Assets/` and `ProjectSettings/ProjectVersion.txt`. If either is absent, stop and explain that the target is not identifiable as a Unity project.143. Read any existing root `AGENTS.md` and `AGENTS.override.md` before proposing changes. An `AGENTS.override.md` shadows `AGENTS.md` at the same level; do not create misleading inactive guidance. Ask the user which file should remain authoritative before changing that situation.1516## Discover project facts1718Read only enough project data to make the guidance accurate:1920- `ProjectSettings/ProjectVersion.txt` for the exact Editor version.21- `Packages/manifest.json` and `Packages/packages-lock.json` for package versions and local or embedded dependencies.22- Relevant graphics and quality settings plus package IDs to identify Built-in, URP, HDRP, or a custom render pipeline.23- Existing `.asmdef` and `.asmref` files to understand runtime, Editor, platform, and test assemblies.24- Existing test folders, CI workflows, build scripts, repository docs, and tool wrappers to find commands that actually work here.25- Existing source layout and naming conventions. Do not impose `Assets/_Game` or another personal layout when the repository uses something else.2627Record uncertainty honestly. Do not infer a render pipeline, test command, or installed Editor path when the inspected files do not establish it.2829## Create or merge `AGENTS.md`3031Use [assets/AGENTS.unity.md](assets/AGENTS.unity.md) as a fragment, not as a file to copy blindly.3233- If `AGENTS.md` does not exist, create it with an adapted Unity section.34- If it exists, preserve all current content and merge a `## Unity project workflow` section with `apply_patch`.35- If a Unity section already exists, update that section instead of appending a duplicate.36- Replace or remove every template placeholder. Include only commands and paths supported by inspected repository files.37- Keep broad organization policy at the root and place specialized guidance in a nested `AGENTS.md` only when the repository layout genuinely needs a narrower override.3839The resulting guidance should cover:40411. The exact Unity Editor version and known render pipeline.422. Relevant source, package, settings, test, and assembly-definition paths.433. Generated directories that Codex must not edit or broadly scan: `Library/`,44 `Temp/`, `obj/`, `Obj/`, and `Logs/`. An exact current Editor or test log may45 be read narrowly when it is the primary failure signal.464. Serialized asset and `.meta` handling, including GUID preservation.475. The repository's real compile, EditMode, PlayMode, build, or visual-validation commands.486. A requirement to report when the matching Editor, license, target platform, or visual path was unavailable.4950## Safety boundaries5152- Never overwrite or replace an existing `AGENTS.md`; merge narrowly and preserve unrelated user content.53- Never create `.cursorignore`, `.cursor/rules/`, or other Cursor configuration as part of this workflow.54- Do not add `.codex/config.toml`, hooks, rules, packages, tests, or CI files unless the user separately requests them.55- Do not open or upgrade the project in Unity merely to initialize Codex guidance.56- Do not write personal absolute Editor paths, credentials, license data, or machine-specific secrets into repository instructions.57- Do not edit generated Unity directories or generated IDE project files. Do58 not broadly scan generated directories; a targeted read of an exact current59 Editor or test log is allowed when diagnosing that failure.6061## Validate the bootstrap62631. Re-read the final `AGENTS.md` and inspect its diff.642. Confirm that discovered version, pipeline, paths, and commands match the files inspected.653. Confirm that no template placeholders, duplicate Unity sections, Cursor-only syntax, or unsupported commands remain.664. Report the file changed, facts recorded, and any unresolved validation command or shadowing `AGENTS.override.md`.6768Codex reads project instruction files when a run starts. State that newly written guidance governs subsequent Codex runs; do not claim it governed work already completed in the current run.