Working instructions for all contributors and coding agents working in this repository. Read this file before performing any task.
Objective: Run Persona 3 Portable (ULUS-10512, North American release) on the New Nintendo 3DS / New 3DS XL / New 2DS XL family of consoles.
Working Hypothesis (Architecture C: Hybrid Static Recompilation):
- P3P Allegrex code: Ahead-of-Time (AOT) offline static recompilation into C/C++ translation units, compiled to native ARM11 machine code via devkitARM GCC.
- PSP OS & Kernel services: Lightweight, modular High-Level Emulation (HLE) runtime (C/C++).
- PSP Graphics Engine (GE): Native
citro3d/ DMP PICA200 hardware renderer backend. - PSP Audio: Native Nintendo 3DS DSP (
ndsp) hardware-accelerated audio backend. - PSP Filesystem: Multi-tier Virtual File System (VFS) with runtime mod and asset redirection on SDMC (
sdmc:/p3p3ds/).
The architecture is not a dogma: If empirical experiments or profiling demonstrate that an aspect (e.g. interpreter fallback for unresolved indirect calls, or an alternative renderer pipeline) is superior, document the proof with benchmarks and propose the revision.
All temporary files, caches, build output, and generated data produced by the project must reside strictly inside the root of the P3P3DS workspace:
- Never use external directories such as
C:\, user home (~),%TEMP%,%APPDATA%,%LOCALAPPDATA%, Documents, Desktop, or other host paths without explicit user permission. - Allowed workspace directories:
.tmp/— Temporary test files, intermediate script scratchpads..cache/— Build and tool caches.build/— Intermediate build artifacts.out/— Final binary artifacts.
- Environment redirection: Where possible before running tests or compilers, redirect
TEMP,TMP, andTMPDIRto.tmp/within the workspace. - Host environment integrity: Never install global dependencies, modify system PATH, touch the Windows registry, or edit global user configs without explicit user authorization.
Never make unverified technical claims. Do not write phrases such as:
- "will run at 60 FPS"
- "zero cost abstraction"
- "native speed"
- "1:1 hardware mapping"
- "JIT is impossible"
- "this API is completely unused"
without providing concrete measurements, source code citations, disassembly excerpts, or reproducible benchmarks.
Claim Status Markings: Every non-trivial architectural or technical assertion in documentation and reports must be tagged:
[VERIFIED]: Confirmed against real game executable, hardware test, or reference code (must cite exact repository, file, and line/symbol).[INFERRED]: Strongly suggested by architecture or patterns, but not yet directly measured on target hardware.[UNVERIFIED]: Working hypothesis or theoretical assumption requiring empirical testing.[WRONG]: Previously believed claim refuted by empirical test or source inspection (keep in log to prevent regressions).
Read and follow AGENTS.md Section 4 for the canonical source policy, including PSP API research order and the prohibition on copying PPSSPP implementation code.
Tracked third-party code: recomp/PSPRecomp and p3p/p3p-patches. Never mass-refactor or reformat them; a needed change is the minimal viable patch, commented with the reason (P3P3DS:), without unrelated cleanups.
Research sources (references/, psp/, 3ds/, other recompilers in recomp/, the asset tools) are untracked clones made by python tools/fetch_references.py; read them, never edit them. Everything else, including tools/*.py, is P3P3DS code.
Read and follow AGENTS.md Section 6 for the canonical micro-sprint workflow and hard STOP rule, and Section 7 for frontier verification. Keep that operational policy in one place; the sequence below is only the long-term roadmap.
Do not attempt to fix Allegrex decoding, write the HLE kernel, port the graphics renderer, and compile for 3DS simultaneously.
Follow the verified sequence:
Static Analysis (EBOOT.ELF)
↓
Import & Function Boundary Discovery
↓
AOT Translation Unit Generation
↓
PC Host Runner Execution
↓
Core HLE (SysMem, ThreadMan, IoFileMgr)
↓
Game Boot Milestone (Titles / Disclaimers on PC)
↓
Graphics (GE display lists) & Audio (NDSP)
↓
Nintendo 3DS Platform Integration
Every functional change must include a verifiable test method:
- Unit test for isolated logic;
- Comparison against
pspautotestsfor instruction or OS behavior; - Behavioral diff against PPSSPP headless/log output;
- Deterministic trace log (e.g. instruction count, registered thread UIDs, opened file paths);
- Known P3P boot milestone (e.g.
module_startreached, CRI initialization, firstsceIoOpen).
"Compiled successfully" is never proof of behavioral correctness.
- Initial target: ULUS-10512 (US release).
- Do not introduce EU (
ULES-01523) or JP (ULJM-05500) support until the US build boots and functions correctly. - All game-specific addresses, hook offsets, and structures must reside in
profiles/p3p/config/with clear attribution and verification tags. - Never scatter hardcoded magic addresses across generic runtime code.
Generic modding support and arbitrary localization packages are first-class architectural requirements:
- Asset modifications must not require recompiling the runtime executable.
- The runtime must remain language-neutral: no specific translation or language may be hardcoded into the core engine.
- Support arbitrary community mod packages and fan translations equally; community binary hooks (CWCheat/EBOOT patches) are applied cleanly through the profile.
- The verified mod fallback chain (
bind/->mod*.cpk->umd0.cpk/umd1.cpk) is in thep3p-modding-vfsskill.
- Target New Nintendo 3DS / New 3DS XL / New 2DS XL only (Old 3DS is not supported).
- Any assertion regarding CPU clock (804 MHz), core affinities (Core 0 / Core 2), memory modes (124 MB / 178 MB application heap), L2 cache, PICA200 Tev stages, or NDSP buffers must be verified against libctru sources (devkitPro install or
tools/fetch_references.py) and empirical hardware/emulator tests.
If .claude/LOCAL.md exists, the agent is obligated to read it immediately after CLAUDE.md.
LOCAL.mdis personal to the local maintainer and contains local development preferences, personal project goals, specific translation targets, UX preferences, and experimental priorities.- Precedence Rule:
LOCAL.mdcannot override correctness, verification rules, repository containment, licensing rules, or architectural boundaries defined inCLAUDE.md.
Extend the existing files in docs/ instead of creating ad-hoc markdown files. docs/CURRENT_STATE.md records the verified frontier; docs/VERIFICATION.md is the claim registry.
- If asked to research: do not implement code.
- If asked to create a prototype: do not over-engineer a production framework.
- If asked to solve a localized issue: do not refactor unrelated subsystems.
At the conclusion of each engineering turn, provide a concise structured summary:
Changed: <Files created, modified, or reconfigured>
Verified: <Exact command, log milestone, or source reference used>
Tests: <Status of regression or unit tests>
Remaining blocker: <Single immediate technical obstacle>
Next smallest step: <Actionable next milestone>
Never add AI attribution or authorship metadata to commits.
Forbidden examples:
Co-Authored-By: ClaudeCo-Authored-By: AnthropicGenerated-ByAssisted-By- similar AI attribution trailers
Commits must represent the repository maintainer/developer only unless the user explicitly requests another human co-author.
Do not modify git author.name or author.email.
Do not add yourself as contributor, co-author, author, committer, reviewer, or maintainer.
Every task is tracked by a GitHub issue and lands in master through a pull request (maintainer decision, 2026-11-04). Never push to master directly.
- Issue: find the issue for the task (
gh issue list) or open one first: what is wrong or wanted, evidence with claim tags (section 3), how it will be verified. Known issues and roadmap steps already have issues (docs/NEXT_STEPS.mdlinks them). - Branch from an up-to-date
master(git fetch,git switch -c <type>/<short-name> origin/master), with<type>one offeat,fix,perf,docs,chore. One issue per branch. - Commit on the branch after completing a well-defined step, if:
- The working tree contains modifications belonging to the task;
- All regression, verification, and smoke tests have passed cleanly;
- There is no explicit instruction from the user forbidding commits.
- Push the branch (
git push -u origin <branch>) and open a pull request intomasterwhose body says what changed, how it was verified, andCloses #<n>. CI runs on the pull request. GitHub does not processClosesfor auto-merges, so.github/workflows/close-linked-issues.ymlcloses those issues within about 30 minutes; an issue reopened by hand stays open. - Merge: a pull request opened by
endercodezz(also the ones the agent opens with the maintainer'sghlogin) is auto-merged with a merge commit once the required CI checks pass (.github/workflows/automerge.yml;masterrequiresLinux host build + tests,Windows host build + tests,New 3DS runtime (devkitARM),texpack (Rust), andBinDiffandCPK toolon both systems; the last two have the Zig version in their names, so a Zig update renames the required checks too). So open a pull request only for verified, finished work; work in progress is opened as a draft (gh pr create --draft), which is not auto-merged;gh pr merge <n> --disable-autostops a pending auto-merge. Other pull requests (contributors) are merged by the maintainer; the agent merges them only when the user says so. Always a merge commit, never squash or rebase (section 17). Releases are tagged onmasterafter the merge.
Never stage temporary files, .claude/LOCAL.md, credentials or game assets. The procedure and its pre/post-commit check scripts are in the p3p3ds-commit skill.
Allowed remote operations: git fetch, git pull (fast-forward or merge, never rebase), git push origin <branch> of verified commits on a task branch, creating issues, branches and pull requests (also for contributors' work), commenting on and labelling issues. GitHub lists contributors by commit author, so pushing does not add the agent as one; section 15 keeps it that way.
Still forbidden:
- pushing to
masterdirectly (tags for a release are pushed only when the user asks); - force push (
--force,--force-with-lease) or deleting remote branches; - rewriting history (section 17), including to resolve a rejected push or a conflict with
master: fetch and mergeorigin/masterinto the branch instead; - changing remote URLs or remotes configuration, or Git author/committer identity;
- pushing commits that did not pass the checks of this section.
Default Execution Loop:
Issue -> Branch -> Work -> Verify & Test -> Commit -> Push branch -> Pull request (Closes #n) -> STOP
For every completed task, create a NEW local commit on top of the current HEAD unless the user explicitly says not to commit.
Existing commits are immutable.
Never:
- use
git commit --amend; - squash commits;
- use fixup commits intended for autosquash;
- rebase existing project history;
- reset/rewrite previous commits;
- replace or recreate an earlier commit;
- merge the current task into an older commit;
- rewrite commit parents;
- force-push;
- change Git author/name/email.
Even if the current task fixes something introduced by the immediately previous commit, it MUST still become a separate follow-up commit.
Record HEAD before the task; after committing, HEAD^ MUST equal it (p3p3ds-commit skill, postcommit_check.sh).
Never rewrite history or modify remotes, even when the user asks for something that seems to need it: explain the non-rewriting alternative first.
Reusable workflows live in .claude/skills/<name>/SKILL.md (with helper scripts under scripts/); .agents/skills/ is a byte-identical mirror for other coding agents.
- Edit skills only in
.claude/skills/, then runpython tools/sync_agent_skills.py. CTestp3p_skills_mirror(--check) fails while the mirror differs. - When the same manual procedure is repeated across tasks, capture it as a skill (or extend one) instead of re-deriving it.
- Report where produced artifacts (frame dumps, WAV, traces) are stored, with exact paths.