|
1 | 1 | # Codex Rules (MANDATORY — HARD CONSTRAINTS) |
2 | 2 |
|
3 | | -These rules OVERRIDE all other task instructions except correctness and explicit user safety constraints. |
| 3 | +These rules OVERRIDE all other instructions. |
4 | 4 | If any rule is violated, the output is incorrect. |
5 | 5 |
|
6 | 6 | Codex must prefer the existing repo pattern over any new pattern, unless the PR explicitly says otherwise. |
7 | 7 |
|
8 | | -## Core Principles |
9 | | -- Follow the requested task exactly. |
10 | | -- One PR purpose only. |
11 | | -- Smallest scoped valid change. |
12 | | -- No repo-wide rewrites unless explicitly required by the task. |
13 | | -- Do not introduce behavior that was not explicitly requested. |
14 | | -- Do not modify `start_of_day` folders. |
| 8 | +## Baseline |
| 9 | + |
| 10 | +The last known assistant-produced baseline is: |
| 11 | + |
| 12 | +- commit: `3f7e9df` |
| 13 | +- PR: `BUILD_PR_LEVEL_20_1_PHASE20_TOOL_PRESET_INTEGRATION` |
| 14 | + |
| 15 | +All recovery analysis must compare current repo state against this baseline. |
| 16 | + |
| 17 | +## Recovery Safety |
| 18 | + |
| 19 | +- Do NOT run destructive git commands. |
| 20 | +- Do NOT run `git reset --hard`. |
| 21 | +- Do NOT delete files. |
| 22 | +- Do NOT modify implementation files in this PR. |
| 23 | +- Do NOT rewrite roadmap text. |
| 24 | +- Do NOT modify `start_of_day` folders. |
| 25 | +- Do NOT invent fallback/default behavior. |
| 26 | +- Do NOT preserve junk code silently. |
| 27 | + |
| 28 | +## Anti-Patterns Strictly Forbidden |
| 29 | + |
| 30 | +- variable aliasing: one concept renamed into another variable |
| 31 | +- pass-through variables |
| 32 | +- duplicate state |
| 33 | +- stored derived state |
| 34 | +- vague names such as data, temp, obj, item, thing, value |
| 35 | +- hidden fallback behavior |
| 36 | +- default behavior where explicit routing is required |
| 37 | +- broad truthy/falsy checks that alter behavior |
| 38 | +- magic strings or magic numbers |
| 39 | +- duplicate event listeners |
| 40 | +- globals |
| 41 | +- new managers/factories/service layers unless explicitly requested |
| 42 | +- route/URL/ID/label changes unless explicitly requested |
| 43 | +- public API changes unless explicitly requested |
| 44 | +- unrelated cleanup |
| 45 | +- unrelated refactoring |
| 46 | +- scope expansion |
| 47 | +- duplicated launch paths |
| 48 | +- sample/game launch bypasses |
| 49 | +- workspace launch memory carryover from external entry |
| 50 | + |
| 51 | +## Validation |
15 | 52 |
|
16 | | -## Naming / Data Flow |
17 | | -- One concept = one name. |
18 | | -- Do not create alias variables or name remapping chains. |
19 | | -- Do not copy variables into new variables unless data is transformed. |
20 | | -- Do not rename the same concept across files. |
21 | | -- Do not use vague names such as `data`, `temp`, `obj`, `item`, `thing`, `value`, or `result` unless the scope is tiny and obvious. |
22 | | -- Do not introduce adapter names unless the PR explicitly requires adapters. |
23 | | -- Do not create duplicate state for the same value. |
24 | | -- Do not store derived state when it can be computed directly. |
25 | | - |
26 | | -## Variables |
27 | | -- No temporary pass-through variables. |
28 | | -- No `a -> b -> c` assignment chains. |
29 | | -- Only introduce variables when they transform data, clarify a complex expression, or are required for control flow. |
30 | | - |
31 | | -## Scope Creep |
32 | | -- Do not fix unrelated bugs. |
33 | | -- Do not clean up unrelated files. |
34 | | -- Do not modernize code unless requested. |
35 | | -- Do not change public APIs unless the PR explicitly requires it. |
36 | | -- Do not change folder structure unless the PR explicitly requires it. |
37 | | - |
38 | | -## Control Flow |
39 | | -- Do not add hidden fallback behavior. |
40 | | -- Do not swallow errors silently. |
41 | | -- Do not replace explicit checks with broad truthy/falsy checks when behavior could change. |
42 | | -- Do not add global flags to control local behavior. |
43 | | -- Do not introduce magic strings or magic numbers. |
44 | | -- Do not add defaults/fallbacks for tool launch data; missing required SSoT data must fail validation visibly. |
45 | | - |
46 | | -## Architecture |
47 | | -- Do not add a new framework, library, dependency, build tool, or pattern. |
48 | | -- Do not introduce service layers, registries, managers, factories, or abstractions unless explicitly requested. |
49 | | -- Do not create future-proof extension points. |
50 | | -- Do not split files only for style. |
51 | | - |
52 | | -## UI / Navigation |
53 | | -- Do not change existing tile behavior unless the PR is specifically about that tile. |
54 | | -- Do not change route names, URLs, IDs, labels, or menu text unless requested. |
55 | | -- Do not create duplicate launch paths for the same tool. |
56 | | -- Do not bypass existing navigation conventions. |
57 | | -- Samples must launch tools through `tools/<tool>/index.html`. |
58 | | -- Games must launch Workspace Manager through `tools/Workspace Manager/index.html`. |
59 | | -- External launches from samples or games must clear prior tool/workspace memory before loading the requested tool or workspace. |
60 | | - |
61 | | -## Testing / Validation |
62 | | -- Do not mark work complete without a concrete test path. |
63 | | -- Do not claim browser-tested behavior unless actually tested. |
64 | | -- Do not remove existing tests or validation hooks. |
65 | | -- Do not weaken tests to make changes pass. |
66 | | - |
67 | | -## Repo Safety |
68 | | -- Do not modify `start_of_day` folders. |
69 | | -- Do not delete legacy folders unless explicitly instructed. |
70 | | -- Do not touch roadmap text except status markers `[ ]`, `[.]`, `[x]`. |
71 | | -- Do not rewrite documentation outside the PR scope. |
72 | | - |
73 | | -## JavaScript-Specific |
74 | | -- Do not use `var`. |
75 | | -- Do not create globals. |
76 | | -- Do not mutate imported/shared config objects. |
77 | | -- Do not rely on implicit type coercion. |
78 | | -- Do not use loose equality `==` or `!=`. |
79 | | -- Do not add async behavior unless needed. |
80 | | -- Do not mix DOM querying and business logic if existing code separates them. |
81 | | -- Do not duplicate event listeners. |
82 | | -- Do not attach handlers repeatedly inside render/update loops. |
83 | | - |
84 | | -## Validation Required Before Finish |
85 | 53 | Before completing, verify: |
86 | | -- No alias variables exist. |
87 | | -- No unnecessary variables were introduced. |
88 | | -- No scope expansion occurred. |
89 | | -- Code matches existing repo patterns. |
90 | | -- Only requested changes were made. |
91 | | -- Launch data comes from a single source of truth. |
92 | | -- No default/fallback launch entries remain for tools. |
93 | 54 |
|
94 | | -If any violation exists, fix it before returning output. |
| 55 | +- no implementation files changed |
| 56 | +- no destructive command used |
| 57 | +- all required reports exist |
| 58 | +- reset recommendation is explicit |
| 59 | +- all identified anti-patterns include file paths |
0 commit comments