Skip to content

knowledge-sweep-unity

Unity Reuse Loop: Ask the Studio Before You Build

Section titled “Unity Reuse Loop: Ask the Studio Before You Build”

Before writing new Unity code, find out whether the studio already has it. Loads when Unity files are touched. Procedure: skill t1k:unity:base:knowledge-sweep.

Before you author a new class, system, service, ScriptableObject or prefab, and before a plan or brainstorm proposes one. Skip only when the exact symbol is already known.

  1. doc_search (mcp__knowledge-retrieval__), engine unity, before anything else.

  2. Code graphs: code-graph-unity (studio library), then code-graph-unity-games (games, demos).

  3. Grep the working tree, never skipped. Look first in the studio library, TheOneFeature (TOF), TheOneRPG and unity-dots-library, then Assets/.

  4. Record one line in the turn, then act on it:

    reuse-verdict: NEW — <symbol or package> — scope: <what you searched> — reason: <the game-specific part>

    Write ONE word and then the dash: the gate rejects a REUSE|EXTEND|… alternation. NEW here may be any accepted verdict — REUSE, EXTEND, CONTRIBUTE, KEEP or unverified. REUSE use it, never copy it · EXTEND change it at its source, library first · NEW only after a miss, for game-specific code: reason: names the game-specific part (20+ chars, as for KEEP). A full reuse-search: record (docs/reuse-search-record.md) also counts.

Features and the meta layer (hub, shop, ads, wallet, quests, FTUE, save, time) COME FROM the studio libs (TOF, TheOneRPG, gdk.core, UITemplate, unity-dots-library, studio packages); generic game code GOES BACK to them.

  1. Search the libs first; pick the owner with t1k-lib-registry (resolve --engine unity --category <c>).
  2. Adapt through the lib’s seams. Never fork or locally patch a package or submodule.
  3. Not found → classify:
    • Reusable (no game-specific names, content, data, tuning or rules) → CONTRIBUTE: PR to the lib via /t1k:lib-contribute (skill t1k-lib-contribute) in the SAME task; compile-gate it on the game. The game consumes the UPM package, never a copy.
    • Game-specific → NEW/KEEP in the game, with a one-line reason naming the game-specific part. “Only this game needs it” is not a reason.
  4. Default when unsure: CONTRIBUTE.
  5. Not merged yet: consume the branch or pre-release, never a permanent copy; re-pin in the PR body.
  6. Split mixed code: the mechanism goes to the lib; data, config and content stay in the game.

Detail, examples and the core-hook enforcement: docs/library-first-contribute-back.md.

A tool that is missing is graph: unavailable or unverified, never a negative. A miss states its scope (negative-result-scope.md): never a bare “greenfield”.