docs(workflow): align CLAUDE.md + memory + roadmap with named-retail foundation

CLAUDE.md edits (6 surgical ranges):
  - Goal section: introduce named-retail/ as primary; old chunks
    remain as fallback for chunk-by-chunk address-range navigation.
  - Workflow renamed to "grep named -> decompile -> verify -> port"
    with a new STEP 0 GREP NAMED FIRST. Decompile demoted to a
    fallback (Step 1) for the rare obfuscated/packed minority that
    pseudo-C lacks.
  - Function-map citation updated to point at symbols.json + the
    cross-port hand-curated table.
  - "Do not guess" rule strengthened: PDB has the answer for almost
    everything; guessing is now negligence.
  - Phase completion checklist accepts named symbols + addresses.
  - Reference hierarchy table gets a new top row pointing at
    docs/research/named-retail/ as the primary oracle for any
    AC-specific algorithm — beats every other reference.

memory/project_named_decompilation.md (new): evergreen crib-sheet
with file inventory, grep examples, hard rules. Pattern matches
project_ui_architecture.md.

memory/project_retail_research_index.md: updated preamble to point
named-retail/ as first stop; older slices remain useful for
pseudocode + C# port sketches.

memory/project_collision_port.md: rewrote the "Decompiled ground
truth" section to put named-retail/ first, chunks second. The
"DECOMPILE FIRST" mandate becomes "GREP NAMED FIRST, then DECOMPILE
FALLBACK".

docs/architecture/acdream-architecture.md: Guiding Principle text
updated to introduce named-retail as the primary decomp source.

docs/plans/2026-04-11-roadmap.md: new Phase R block — Retail
research infrastructure. R.1 (corpus, shipped a9a01d8), R.2
(pdb-extract, shipped 69d884a), R.3 (actestclient vendored,
shipped a9a01d8). All marked SHIPPED 2026-04-25.

Auto-loaded MEMORY.md index updated with a new entry pointing at
project_named_decompilation.md so post-compaction sessions inherit
the workflow change automatically.

Acceptance verified:
  - grep -c "named-retail" CLAUDE.md = 9 (>= 3 required)
  - grep -c "named-retail" MEMORY.md = 1
  - dotnet build green (docs-only commit, but verified)

Foundation phases A + B + C all landed. Next: Phase D files
ISSUES #8/#9/#11 + closes #10 (KillerNotification orphan parser).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-25 17:36:53 +02:00
parent 69d884a3d6
commit 0a429a980c
6 changed files with 192 additions and 23 deletions

View file

@ -8,10 +8,17 @@ with a plugin API the original never had.
**The code is modern. The behavior is retail.**
Every AC-specific algorithm is ported from the decompiled retail client
(`docs/research/decompiled/`, 22,225 functions, 688K lines of C). The code
around those algorithms is modern C# with clean architecture. The plugin API
exposes game state through well-defined interfaces.
Every AC-specific algorithm is ported from the **named retail decomp**
at `docs/research/named-retail/` — Sept 2013 EoR build PDB (18,366
named functions, 5,371 named struct/class types) + Binary Ninja
pseudo-C with 99.6% function-name recovery + verbatim retail header
struct definitions. The older Ghidra `FUN_xxx` chunks under
`docs/research/decompiled/` (22,225 functions, 688K lines) remain a
fallback for chunk-by-chunk address-range navigation. **Grep
`named-retail/acclient_2013_pseudo_c.txt` by `class::method` BEFORE
decompiling fresh.** The code around those algorithms is modern C#
with clean architecture. The plugin API exposes game state through
well-defined interfaces.
**Architecture:** `docs/architecture/acdream-architecture.md` is the
single source of truth for how the client is structured. All work must
@ -84,19 +91,33 @@ a phase just landed, and move to the next todo item.
always yes — keep going.** The single exception is visual verification;
otherwise, act.
## Development workflow: decompile → verify → port
## Development workflow: grep named → decompile → verify → port
**This is the mandatory workflow for implementing ANY AC-specific behavior.**
The triangle-boundary Z bug cost 5 failed fix attempts from guessing.
The animation frame-swap bug cost 4 failed attempts. Every time we
checked the decompiled code first, we got it right on the first try.
**Now we have named retail symbols too — Step 0 cuts most lookups
from 30 minutes to 5 seconds.**
### For each new feature or bug fix:
1. **DECOMPILE FIRST.** Before writing any AC-specific code, find the
matching function in the decompiled client (`docs/research/decompiled/`)
or decompile a new region using `tools/decompile_acclient.py`. Use
the function map at `docs/research/acclient_function_map.md` to find
0. **GREP NAMED FIRST.** Before any decompilation work, search
`docs/research/named-retail/acclient_2013_pseudo_c.txt` by
`class::method` name. 99.6% of functions have real names from the
Sept 2013 EoR build PDB. `docs/research/named-retail/acclient.h`
has every retail struct verbatim. `docs/research/named-retail/symbols.json`
is greppable by name or address (regenerate via
`py tools/pdb-extract/pdb_extract.py refs/acclient.pdb`). Only fall
back to Step 1 below if the named pseudo-C lacks a function (rare —
covers only the obfuscated/packed minority).
1. **DECOMPILE FIRST (fallback).** Only when grep-named-first returned
nothing. Find the matching function in the older Ghidra chunks at
`docs/research/decompiled/` or decompile a new region using
`tools/decompile_acclient.py`. Use the function map at
`docs/research/acclient_function_map.md` (cross-port index) +
`docs/research/named-retail/symbols.json` (raw PDB names) to find
known functions. If the function isn't mapped yet, search by
characteristic constants (motion commands, magic numbers, string
literals).
@ -132,7 +153,11 @@ checked the decompiled code first, we got it right on the first try.
### What NOT to do:
- **Do not guess** at AC-specific algorithms, formulas, constants, wire
formats, or coordinate conventions. Ever.
formats, or coordinate conventions. Ever. **The named retail decomp
has the answer for almost everything; guessing is no longer a
recoverable error, it's negligence.** If you can't find it in
`docs/research/named-retail/`, file a research note and ASK before
writing.
- **Do not "fix" the decompiled code.** If the retail client does
something that looks wrong, it's probably right. Verify before
changing.
@ -149,7 +174,8 @@ checked the decompiled code first, we got it right on the first try.
Before marking any phase as done:
- [ ] Every AC-specific algorithm has a decompiled reference cited in
comments (function address + chunk file)
comments (named symbol + address from `named-retail/symbols.json`,
OR function address + chunk file from older `decompiled/` chunks)
- [ ] Conformance tests exist for the critical paths
- [ ] The code was cross-referenced against at least 2 reference repos
- [ ] `dotnet build` green, `dotnet test` green
@ -430,6 +456,7 @@ decompiled client code and would have fixed it in minutes.
| Domain | Primary Oracle | Secondary | Notes |
|--------|---------------|-----------|-------|
| **Any AC-specific algorithm** | **`docs/research/named-retail/`** (PDB-named decomp + verbatim retail header structs from Sept 2013 EoR build) | the existing references below | The retail client itself, fully named. 18,366 functions + 5,371 struct types + 1.4 M lines of pseudo-C in one searchable tree. Beats every other reference for "what does the real client do." |
| **Terrain** (split direction, height sampling, palCode, vertex position, normals) | **ACME `ClientReference.cs`** — decompiled retail client with exact offsets | ACME `TerrainGeometryGenerator.cs` (matches the mesh index buffer) | WorldBuilder original is SUPERSEDED for terrain algorithms. AC2D confirms the same formula. |
| **Terrain blending** (texture atlas, alpha masks, road overlays) | **ACME `LandSurfaceManager.cs`** | WorldBuilder original `LandSurfaceManager.cs` (same code, less tested) | Both use the same TexMerge pipeline. ACME has conformance tests. |
| **GfxObj / Setup rendering** (mesh extraction, multi-part assembly, ObjDesc) | **ACME `StaticObjectManager.cs`** — includes CreaturePalette, GfxObjRemapping, HiddenParts | ACViewer `Render/` namespace | ACME has the complete creature appearance pipeline in one file. |