{
 "standards_version": "2026-11-21.6",
 "summary": "The bytes decide whether code is right; these rules decide whether it is acceptable. A submission must pass both. refuse = not accepted even when the bytes match; flag = accepted, counted as debt on the public quality board and worth less credit until cleared.",
 "rules": [
  {
   "id": "Q1",
   "kind": "refuse",
   "title": "No codegen steering",
   "text": "No _ReadWriteBarrier, #pragma optimize, #pragma intrinsic or #pragma function, no volatile on local variables, and no __declspec(noinline) on helpers the game does not have.",
   "bad": "volatile int n = count; _ReadWriteBarrier();",
   "good": "int n = count;",
   "fix": "Write the code the way the original author would have; if the bytes only match with steering, flag the function for a header or unit fix instead.",
   "checked_by": [
    "local lint",
    "server",
    "pull request check"
   ]
  },
  {
   "id": "Q2",
   "kind": "refuse",
   "title": "No assembly",
   "text": "No inline assembly (x64 MSVC has none) and no hand-written .asm outside third_party/ and the published exception list.",
   "bad": "__asm int 3",
   "good": "__debugbreak();",
   "fix": "Use the compiler intrinsic or plain C++.",
   "checked_by": [
    "local lint",
    "server",
    "pull request check"
   ]
  },
  {
   "id": "Q3",
   "kind": "refuse",
   "title": "No decompiler leftovers",
   "text": "No undefined1/2/4/8 types, CONCAT/SUB/ZEXT macros, param_N, uVar/iVar/pVar names, decompiler stack names (local_ with a hex offset such as local_10, local_1c or local_c; in_ with a register such as in_EAX) or raw stack offsets. Ordinary names that only look similar (local_face, in_out_count) are fine.",
   "bad": "undefined8 uVar1 = *(undefined8 *)(param_1 + 0x10);",
   "good": "NiNode* parent = node->parent;",
   "fix": "Use the shared types and give every parameter and local a real name.",
   "checked_by": [
    "local lint",
    "server",
    "pull request check"
   ]
  },
  {
   "id": "Q4",
   "kind": "refuse",
   "title": "Fields by name",
   "text": "No member access through pointer arithmetic on a type the shared headers know. Where the header does not know the field yet, it is accepted but flagged until the field is added.",
   "bad": "*(int*)((char*)this + 0x48)",
   "good": "this->refCount",
   "fix": "Use the field from include/; if it is missing, propose it as a header change.",
   "checked_by": [
    "local lint",
    "server",
    "header registry"
   ]
  },
  {
   "id": "Q5",
   "kind": "refuse",
   "title": "Shared types only",
   "text": "No private redefinition of a type the shared headers (include/) define. Types and fields come from include/; new ones arrive through a header change. While the shared headers are being built, a private type for a class include/ does not define yet is accepted but flagged, and moves into include/ when it lands.",
   "bad": "struct MyActor { char pad[0x48]; int hp; };",
   "good": "#include \"Actor.h\"",
   "fix": "Include the shared header; request the type or field with a header change.",
   "checked_by": [
    "local lint",
    "server (declaration registry)"
   ]
  },
  {
   "id": "Q6",
   "kind": "refuse",
   "title": "One name, one address, one definition",
   "text": "Every function or global name binds to exactly one address and is defined in exactly one unit.",
   "bad": "Two units each defining g_dataHandler, or one name bound to two addresses.",
   "good": "One definition, extern declarations elsewhere.",
   "fix": "Use the registry's existing name for that address, or rename.",
   "checked_by": [
    "local check (f4check)",
    "server (symbol registry)",
    "nightly link"
   ]
  },
  {
   "id": "Q7",
   "kind": "refuse",
   "title": "Matched in its real file",
   "text": "A function counts only once it compiles byte-exact inside its real unit, together with every function already in that unit.",
   "bad": "Matches alone, breaks its neighbours.",
   "good": "Matches in the unit's full build.",
   "fix": "The refusal names the neighbour that changed; adjust shared declarations, not the neighbour.",
   "checked_by": [
    "server (in-file check)"
   ]
  },
  {
   "id": "Q8",
   "kind": "refuse",
   "title": "Real translation units",
   "text": "Units follow the original source files, not address windows. One compiler flag set per unit; a different flag set needs a recorded proof.",
   "bad": "A function placed in a unit it does not belong to.",
   "good": "The function in the unit the unit map gives.",
   "fix": "Use the unit named in the claim; propose a unit-map change with evidence if it is wrong.",
   "checked_by": [
    "server (unit map)"
   ]
  },
  {
   "id": "Q9",
   "kind": "flag",
   "title": "Real names",
   "text": "Names come from an allowed source with a provenance tag: RTTI, strings in the executable, public modding-community facts, Fallout 3 or New Vegas twins, or a reasoned name. FUN_ placeholders are accepted but flagged.",
   "bad": "FUN_140a12b30",
   "good": "BGSInventoryList::FindItem  // src: STRING \"FindItem\"",
   "fix": "Name it and add the provenance tag.",
   "checked_by": [
    "local check (f4check)",
    "server"
   ]
  },
  {
   "id": "Q10",
   "kind": "refuse",
   "title": "Clean comments",
   "text": "No model, tool or pipeline names (Claude, GPT-5, Opus 5.5, ...), internal paths, e-mail addresses, pack or checkpoint ids in comments. Ordinary English is fine (a magnum opus, the context pack).",
   "bad": "// written by <model> in <tool>, checkpoint chk_1234",
   "good": "// Clamps the radius to the cell's bounds.",
   "fix": "Describe the code, not how it was produced.",
   "checked_by": [
    "local lint",
    "server",
    "pull request check"
   ]
  },
  {
   "id": "Q11",
   "kind": "refuse",
   "title": "Builds clean",
   "text": "No compiler warnings at /W3 in the submitted code, and the repository's clang-format style. Neither changes the bytes.",
   "bad": "warning C4244",
   "good": "No warnings.",
   "fix": "Fix the warning with the right types; run clang-format.",
   "checked_by": [
    "local lint",
    "server",
    "pull request check"
   ]
  },
  {
   "id": "Q12",
   "kind": "refuse",
   "title": "Third-party code vendored",
   "text": "Library code with a public source (zlib 1.2.7, libpng 1.5.13, ...) lives unmodified in third_party/ with checksums; game-side changes are reviewed diffs.",
   "bad": "zlib's inflate pasted into a game unit.",
   "good": "third_party/zlib-1.2.7/inflate.c",
   "fix": "Point the unit at the vendored file.",
   "checked_by": [
    "server (layout check)"
   ]
  },
  {
   "id": "Q13",
   "kind": "flag",
   "title": "Second-executable cross-check",
   "text": "Where another build of the same code exists, the same source should also match there. A bonus when it holds; flagged when it does not.",
   "bad": "Matches one build only through shaping.",
   "good": "Matches both builds unchanged.",
   "fix": "Prefer the plain form that matches both.",
   "checked_by": [
    "nightly"
   ]
  },
  {
   "id": "Q14",
   "kind": "flag",
   "title": "Semantics-neutral shaping is counted",
   "text": "Redundant parentheses or a meaning-preserving statement order that is needed for the bytes stays allowed, but each case is counted and may be cleaned up later.",
   "bad": "((a)) + ((b))",
   "good": "a + b",
   "fix": "Remove it if the bytes still match.",
   "checked_by": [
    "local lint"
   ]
  }
 ],
 "visibility": [
  "Every pack ships STANDARDS.md and f4lint (the server's own lint); ./try runs the lint before compiling, offline.",
  "The claim answer carries standards_version, a short checklist for that function and the headers to use; MCP has standards() and explain_rule(id).",
  "Every refusal names the rule id, file and line, the offending text and the fix, with a link to /standards#<id>.",
  "Your account page and GET /api/v1/me/quality show your refusals by rule, open flags and credit changes.",
  "The public quality board sits next to the progress numbers.",
  "Rule changes bump standards_version and are announced; open claims finish under the version they were issued with.",
  "Exceptions are requested with a flag, decided in public and listed in standards_exceptions.json, which the lint reads."
 ],
 "changelog": [
  {
   "version": "2026-11-21.6",
   "effective": "2026-11-21T22:45:00Z",
   "rules_changed": [],
   "change": "Rule Q15 (published in .5 for a few minutes) is withdrawn: code from the Havok SDK is allowed in submissions. The project owner has cleared the project with Havok."
  },
  {
   "version": "2026-11-21.5",
   "effective": "2026-11-22T00:00:00Z",
   "rules_changed": [],
   "change": "Fixes from the community's reports. (1) Flags: only about 1.5% of the game's functions have a C++ exception frame (eh_functions.json, from the game's own unwind table), so f4check and the verifier now also check every other function without /EHsc; a match there integrates in a unit built without /EHsc. (2) Q3 and Q10 no longer refuse ordinary names and words (local_face, in_out_count, \"a magnum opus\", \"the context pack\"). (3) f4check: correct call and jump rows are no longer marked as differences; a /GL object gives a message; __catch$ funclets no longer count as a second definition. (4) A name bound to another address after your copy of the symbol map is renamed for you when the bytes still match (otherwise refused_standards, no strike). (5) New verdict refused_standards (no strike) replaces unfit for rule refusals; status.problems lists every refusal of the last 24 hours."
  },
  {
   "version": "2026-11-21.4",
   "effective": "2026-11-21T08:00:00Z",
   "rules_changed": [],
   "change": "Exception E1 (Q5): BSTArrayBase::IAllocatorFunctor's out-of-line constructor (0x14001fcf0) may declare its own BSTArrayBase / IAllocatorFunctor, because declaring that constructor in include/BSTArray.h would change about 800 integrated functions. Exceptions are listed in standards_exceptions.json (in the f4check kit). Rule changes from now on: for 24 hours after a change, a submission refused only by the changed rule goes back to the pool with a note and no strike."
  },
  {
   "version": "2026-11-21.3",
   "change": "Shared headers: include/BSTArray.h (BSTArrayBase, BSTArrayBase::IAllocatorFunctor, BSTArrayHeapAllocator, BSTArrayAllocatorFunctor) and include/BSSpinLock.h. Under Q5 a private redefinition of these types is now refused; claims issued before this version keep it as a flag. Q9 and Q6: the target is the one function your file defines, under its real name with a provenance tag (FUN_<address> still works and is flagged). Real names are bound to their addresses in the shared symbol map; a name already bound to another address is refused (Q6). Functions the headers declare are called by name.",
   "rules_changed": [
    "Q5"
   ],
   "effective": "2026-11-21T03:40:00Z",
   "grace_until": "2026-11-22T06:00:00Z"
  },
  {
   "version": "2026-11-21.2",
   "change": "Q5: a private type is refused only when include/ already defines it; otherwise flagged while the shared headers are built (the same rule Q4 has for fields).",
   "rules_changed": [
    "Q5"
   ],
   "effective": "2026-11-21T01:00:00Z"
  }
 ]
}