Skip to content

knowledge-sweep-cocos

Cocos Reuse Loop: Sweep, Ground, Decide, Contribute Back

Section titled “Cocos Reuse Loop: Sweep, Ground, Decide, Contribute Back”

The kit’s most important rule. Find prior art before building; reusable work goes to cocos-stdlib and is consumed back. Detail: docs/knowledge-sweep-cocos.md.

bun ".claude/skills/t1k-cocos-base-knowledge-sweep/scripts/detect-cocos-project.cjs": exit 0 = applies.

Before a plan, a new class/service/component, or a review finding; template glue included. Never copy one silently. Plan stage: docs/knowledge-sweep-cocos.md § “Plan-time check”.

  1. Sweep the corpus via t1k-cocos-base-knowledge-sweep; skip only if the exact symbol is known (skills/t1k-cocos-base-knowledge-sweep/references/doc-search-contract.md).

  2. Ground in the graph: absent → graph: unavailable, never dead-code.

  3. Grep to ground the hit, never skipped: assets/packages/@playablelabs/, assets/scripts/, embedded framework folders.

  4. Record one verdict line per capability, then act on it:

    reuse-verdict: REUSE|EXTEND|NEW|CONTRIBUTE|KEEP|unverified — <symbol or @playablelabs/package> — scope: <N> Cocos assemblies

    REUSE installs via playableSync, never copies source · EXTEND/CONTRIBUTE runs t1k-cocos-base-stdlib-contribute · NEW/KEEP name the game-specific part in reason:.

A capability no step finds is reusable unless shown game-specific: name the game-specific part (level schema, tuning, rule, content). None nameable → CONTRIBUTE, built in cocos-stdlib as @playablelabs/<name> in the same task and consumed via playableSync.

Never a reason to keep it local: “only this game needs it”, “one caller”, “faster to copy”, “stdlib not synced here”. Unsynced means search, not skip: the corpus (assembly_prefix: "packages"), then resolve-stdlib-package.cjs ($COCOS_STDLIB_DIR or a cached gh clone). A missing CPM token blocks the install, never the verdict.

Ask at task end, once, batched: an uncontributed CONTRIBUTE, or a doubtful KEEP/NEW → one AskUserQuestion (contribute now · later as tracked follow-up · keep local with reason). Sub-agents report to their parent, which asks. stdlibContribute.mode=auto skips the ask and the contribution runs. Protocol: docs § “Ask at task end”.

Sources: installed/corpus/graph/none. A negative states its scope, never a bare “greenfield”. MCP absent → unverified, never CONTRIBUTE.