|
1 | | - |
2 | 1 | # Codex Rules (MANDATORY — HARD CONSTRAINTS) |
3 | 2 |
|
4 | | -These rules OVERRIDE all other instructions. |
| 3 | +These rules OVERRIDE all other task instructions except correctness and explicit user safety constraints. |
5 | 4 | If any rule is violated, the output is incorrect. |
6 | 5 |
|
7 | 6 | Codex must prefer the existing repo pattern over any new pattern, unless the PR explicitly says otherwise. |
8 | 7 |
|
9 | | ---- |
10 | | - |
11 | | -## CORE PRINCIPLES |
12 | | -- Follow the requested task EXACTLY. Do not expand scope. |
13 | | -- Produce the smallest valid change required. |
14 | | -- Prefer clarity, simplicity, and determinism. |
| 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. |
15 | 13 | - Do not introduce behavior that was not explicitly requested. |
16 | | - |
17 | | ---- |
18 | | - |
19 | | -## NAMING |
20 | | -- One concept = one name |
21 | | -- Do NOT create alias variables |
22 | | -- Do NOT copy variables without transformation |
23 | | -- Do NOT rename variables unless required and consistent |
24 | | - |
25 | | ---- |
26 | | - |
27 | | -## VARIABLES |
28 | | -- No temporary pass-through variables |
29 | | -- No a → b → c chains |
30 | | -- Only create variables for transformation, clarity, or control flow |
31 | | - |
32 | | ---- |
33 | | - |
34 | | -## FUNCTION DESIGN |
35 | | -- Keep functions small and single-purpose |
36 | | -- Do NOT create helper functions unless reused or required |
37 | | -- No unnecessary abstraction |
38 | | - |
39 | | ---- |
40 | | - |
41 | | -## REFACTORING |
42 | | -- Do NOT refactor unrelated code |
43 | | -- Do NOT restructure files unless instructed |
44 | | -- Do NOT rename files/folders unless required |
45 | | - |
46 | | ---- |
47 | | - |
48 | | -## CONSISTENCY |
49 | | -- Use existing naming patterns |
50 | | -- Do NOT introduce new conventions |
51 | | -- Do NOT mix styles |
52 | | - |
53 | | ---- |
54 | | - |
55 | | -## SCOPE CONTROL |
56 | | -- Do exactly what is requested — nothing more |
57 | | -- No feature creep, optimizations, or extras |
58 | | - |
59 | | ---- |
60 | | - |
61 | | -## COMMENTS |
62 | | -- Only add when necessary or requested |
63 | | - |
64 | | ---- |
65 | | - |
66 | | -## FILE CHANGES |
67 | | -- Modify ONLY specified files |
68 | | -- Do NOT create new files unless required |
69 | | - |
70 | | ---- |
71 | | - |
72 | | -## OUTPUT |
73 | | -- Clean, usable code only |
74 | | -- No explanations unless requested |
75 | | - |
76 | | ---- |
77 | | - |
78 | | -## ADDITIONAL ANTI-PATTERNS (STRICTLY FORBIDDEN) |
79 | | - |
80 | | -### Naming / Data Flow |
81 | | -- No vague names (data, temp, obj, item, thing, value) |
82 | | -- No renaming same concept across files |
83 | | -- No adapter names unless required |
84 | | -- No duplicate state |
85 | | -- No stored derived state |
86 | | - |
87 | | -### Scope Creep |
88 | | -- Do not fix unrelated bugs |
89 | | -- Do not clean unrelated files |
90 | | -- Do not modernize code unless asked |
91 | | -- Do not change APIs |
92 | | -- Do not change folder structure |
93 | | - |
94 | | -### Control Flow |
95 | | -- No hidden fallbacks |
96 | | -- No silent error swallowing |
97 | | -- No broad truthy/falsy replacements |
98 | | -- No global flags for local behavior |
99 | | -- No magic strings/numbers |
100 | | - |
101 | | -### Architecture |
102 | | -- No new frameworks/libraries |
103 | | -- No service layers/managers/factories unless asked |
104 | | -- No future-proofing abstractions |
105 | | -- No splitting files for style only |
106 | | - |
107 | | -### UI / Navigation |
108 | | -- Do not change tile behavior unless requested |
109 | | -- Do not change routes/labels/IDs |
110 | | -- No duplicate launch paths |
111 | | -- Do not bypass navigation conventions |
112 | | - |
113 | | -### Testing / Validation |
114 | | -- Must have concrete test path |
115 | | -- No fake validation claims |
116 | | -- Do not remove tests |
117 | | -- Do not weaken tests |
118 | | - |
119 | | -### Repo Safety |
120 | | -- Do not modify start_of_day |
121 | | -- Do not delete legacy folders |
122 | | -- Do not change roadmap except status markers |
123 | | - |
124 | | -### JavaScript |
125 | | -- No var |
126 | | -- No globals |
127 | | -- No mutation of shared config |
128 | | -- No implicit coercion |
129 | | -- No == or != |
130 | | -- No unnecessary async |
131 | | -- No mixing DOM/business logic if separated |
132 | | -- No duplicate event listeners |
133 | | -- No attaching handlers in loops |
134 | | - |
135 | | ---- |
136 | | - |
137 | | -## VALIDATION |
138 | | -- No alias variables |
139 | | -- No unnecessary variables |
140 | | -- No scope expansion |
141 | | -- Matches repo patterns |
142 | | -- Only requested changes made |
143 | | - |
144 | | -Fix violations before output. |
145 | | - |
146 | | ---- |
147 | | - |
148 | | -## PRIORITY |
149 | | -1. Correctness |
150 | | -2. These rules |
151 | | -3. Task instructions |
152 | | -4. Style |
153 | | - |
154 | | ---- |
155 | | - |
156 | | -## FAILURE |
157 | | -If task requires breaking rules: |
158 | | -STOP and explain minimally |
| 14 | +- Do not modify `start_of_day` folders. |
| 15 | + |
| 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 | +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 | + |
| 94 | +If any violation exists, fix it before returning output. |
0 commit comments