Build a Python 3.12+ pure-Python NMOS 6502 instruction-core reference implementation named "6502-python-r3". Follow the sibling "z80-python" project's design philosophy: readable, dependency-free, oracle-validated, and embeddable rather than a complete machine. ## Revision note (round 3, 2026-08-27) This is a fresh third attempt. Round 1 produced a working documented-opcode core but required substantial supervision. Round 2 stopped in phase 1 after four decomposed tasks produced passing child sets and passing deterministic merged-child reviews, because each reconstructed parent still required a separate supervisor acceptance. Round 3 uses an explicit campaign policy that automatically passes a decomposed parent only after all children and that merged-child review pass. Failed coherence must still stop the campaign. The target repository is independent. Do not read, copy, import, or depend on source, tests, documentation, configuration, commits, or corpus checkouts from the round-1 `6502-python` or round-2 `6502-python-r2` repositories. The technical goal and verified operational lessons below are the only inherited context. Make all 151 documented-opcode vector files an explicit intermediate milestone before implementing the 105 undocumented values. This is the matched autonomy comparison point, not permission to stop or retain expected failures. Final completion requires all 256 opcode files to pass. ## Task-contract constraints learned from round 2 - Every planned task must fit at most 6 changed files and 400 changed lines. Split work in the initial plan when it cannot fit those ceilings. - A declared required artifact must be a real, nonempty deliverable. Do not use empty placeholder files or files under ignored corpus/build directories as required artifacts. - Mark a task red-first only when it creates a focused test that must fail before its dependent implementation. A passing scaffold/contract smoke test is an ordinary task, not a red-regression task. - A red-first task may change only its declared test files. The dependent implementation task owns production changes that make those tests pass. - Verification commands must name project-relative test files or markers when the task policy prohibits an unscoped full-suite run. - Keep all generated, fetched, cloned, and built artifacts inside this checkout. ## Scope: all 256 NMOS opcode bytes - Implement all 151 officially documented NMOS 6502 opcodes and addressing modes: accumulator, implied, immediate, zero page, zero page,X, zero page,Y, absolute, absolute,X, absolute,Y, indirect, (indirect,X), (indirect),Y, and relative. - Implement the behavior represented by all 105 undocumented opcode byte values in the pinned SingleStepTests NMOS 6502 corpus. This includes SLO, RLA, SRE, RRA, SAX, LAX, DCP, ISC/ISB, undocumented NOP forms, immediate and unstable families, high-byte-masked stores, LAS, aliases, and all 12 JAM/KIL bytes. - Treat the pinned vectors as the acceptance authority for undocumented and unstable forms. Document that these can vary with chip revision or analog effects; do not claim prediction of every physical NMOS 6502. - JAM/KIL is a supported terminal CPU condition, not an unsupported-opcode exception. Match the oracle's one-instruction outcome: one-byte PC advance, 11 cycles, registers and status unchanged. Preserve explicit jammed state so later `step()` calls cannot fetch until RESET clears it through the normal reset lifecycle. - Implement authentic NMOS decimal ADC/SBC. N, V, and Z derive from the binary intermediate where required rather than being made to reflect the decimal result. - Implement RESET, IRQ, NMI, and BRK at instruction boundaries, including the 7-cycle vector sequence, pushed B-bit behavior, IRQ during NMI, and NMI hijacking BRK. - Do not implement a memory map, cartridge, device, or specific host machine. The host supplies memory reads/writes and IRQ/NMI line state. ## Packaging - Python 3.12+ and hatchling build backend. - Flat importable top-level package such as `sixfiveohtwo`; document how the import name maps to the distribution name. - pytest tests and Ruff lint/format configuration. - README documenting the embeddable memory, IRQ, NMI, and RESET host contract. - No runtime dependencies. ## Immutable validation inputs Use these already verified inputs without spending task turns rediscovering them: - `SingleStepTests/65x02` commit `2f6980a2d95757486c7bee24355c360e40e2a224`. - `Klaus2m5/6502_65C02_functional_tests` commit `7954e2dbb49c469ea286070bf46cdd71aeb29e4b`; functional binary SHA-256 `fa12bfc761e6f9057e4cc01a665a7b800ff01ae91f598af1e39a1201d01953f`. - `amb5l/6502_65C02_functional_tests` commit `966b1a35049f9d8be44ad092ec6d43d5ba1831b3`; expected decimal binary SHA-256 `b179ca4c5a305de2d0cde9ccaa04861be965e2a85b9d3d1230dcc47a396ca43`. Warn rather than fail if another cc65 version produces a different hash. - This Windows host has `ca65` and `ld65` in WSL Ubuntu-24.04 at `/usr/bin`. If absent from native PATH, invoke them through `wsl -d Ubuntu-24.04 -- ca65` and `wsl -d Ubuntu-24.04 -- ld65`. ## Validation plan Every task reads and writes only relative paths inside this checkout. Never use `../`, absolute sibling paths, or assumed external directories. Fetch external artifacts beneath `tests/`, ignore them in Git, and never commit them. 1. SingleStepTests oracle Create a project-local fetcher that clones the pinned revision into gitignored `tests/6502_test_vectors/`. Use `git clone --filter=blob:none --sparse` and `sparse-checkout set 6502` so the unrelated CPU variants do not consume constrained disk space. The corpus contains 256 opcode files, 10,000 records per file, about 2.56 million records and 1 GB uncompressed. Parametrize one pytest test per opcode file and stream its 10,000 records inside that test. Never parametrize every record. Collection should stay under roughly 10 seconds. First record and preserve an explicit result for all 151 documented files. Then complete all 256 files. When the corpus is present, no opcode may use a blanket skip/xfail, first-record shortcut, or unsupported-opcode exception. 2. Comprehensive exercisers Fetch the pinned Klaus repository beneath gitignored `tests/dormann/`, verify `bin_files/6502_functional_test.bin` against the expected SHA-256, and add an opt-in `integration` test that runs from the documented load address to the success trap with a finite instruction budget. Build Bruce Clark's decimal test from the pinned amb5l fork's `ca65/6502_decimal_test.ca65` and `ca65/example.cfg`. Keep every checkout, temporary file, object, and binary beneath `tests/dormann/`. If cc65 is truly unavailable, provisioning may skip with an actionable message; do not drop the exerciser. 3. Validation documentation Record exact revisions and hashes in `docs/validation.md`. State clearly that this is an instruction-level reference core, not a cycle-accurate bus-pin model or complete machine. ## Runtime bounds The complete all-256 vector suite is expected to take roughly 390-450 seconds, but that is only an estimate. Any task that runs the complete suite must use a verification timeout of at least 600 seconds. Prefer focused files or markers for ordinary development checks. ## Out of scope - Any host-specific PPU/APU, cartridge, mapper, video, or device emulation. - 65C02 or 65816 extended instructions.