Imported from rsms/rsm (
AGENTS.md). Install upstream withnpx skills add rsms/rsm. Copyright stays with the author.
RSM virtual machine
This file defines the default working protocol for coding agents for this project. Scope: entire subdirectory (i.e. dirname of AGENTS.md).
1) Project overview
RSM is a virtual computer, a form of virtual machine. Read README.md
2) Engineering Principles (Normative)
These principles are mandatory. They are implementation constraints, not suggestions.
2.1 KISS (Keep It Simple, Stupid)
Required:
- Prefer straightforward control flow over meta-programming.
- Prefer explicit comptime branches and typed structs over hidden dynamic behavior.
- Keep error paths obvious and localized.
2.2 YAGNI (You Aren't Gonna Need It)
Required:
- Do not add config features, command line arguments or other features without a concrete caller/user.
- Do not introduce speculative abstractions.
- Keep unsupported paths explicit (panic or return clear error) rather than silent no-ops.
2.3 DRY (Don't Repeat Yourself) + Rule of Three ("Three strikes and you refactor")
Required:
- Duplicate small local logic when it preserves clarity.
- Extract shared helpers only after repeated, stable patterns (rule-of-three).
- When extracting, preserve module boundaries and avoid hidden coupling.
2.4 Fail fast + Explicit errors
Required:
- Prefer explicit errors for unsupported or unsafe states.
- Never silently broaden permissions or capabilities.
3) Agent Workflow (Required)
- Read before write — inspect existing implementation before editing.
- Define scope boundary — one concern per change; avoid mixed feature+refactor+infra patches.
- Implement minimal patch — apply KISS/YAGNI/DRY rule-of-three explicitly.
- Test — Write tests for new features or changes
- Incremental — Take an incremental approach: keep the program working at each step.
- Version control:
- Before committing changes, run tests that are affected by changes
- Serialize git index writes: never run
git add,git commit,git rm,git mv, or similar index-mutating commands in parallel.
4) Building and testing
./test.shbuild in debug mode and run all tests./test.sh -releasebuild in release mode (with safechecks) and run all tests./build.shbuilds rsm native in debug mode./build.sh -releasebuilds rsm native in release mode (with safechecks)./build.sh -- rsm.wasmbuilds wasm products in debug mode./build.sh -- rms rsm.wasmbuilds native and wasm products in debug mode./build.sh -j1 -- rsm.wasmbuilds wasm products in debug mode, without parallelism (useful for debugging build errors)./build.sh -analyzerun clang static analyzer on source code./build.sh -helpshows options
5) Documentation
etc/website/isa/index.mddescribes the virtual instruction set architectureetc/website/isa/op.*.mddescribes an ISA operationetc/website/ops.jsonlists all ISA operations (generated fromsrc/rsm.h)etc/website/assembler/index.mddescribes the assembly languageetc/website/virtual-memory/index.mddescribes virtual memory- Some data in the website is generated from
src/rsm.hbyetc/website/_config.jswhich is run byetc/website/build.sh