Rolldown Agent Rules

A Rust-based JavaScript and TypeScript bundler with a TypeScript API.

On this page

Overview

Rolldown uses its root guide for context the code cannot show: a three-layer runtime, generated bindings, and the CI jobs required for browser, Windows, and WebContainer changes.

Documents

├── 
├──  · symlink → AGENTS.md
├── docs
│   └── apis
│       └── 
└── internal-docs
    ├── path-manipulation
    │   └── 
    ├── template
    │   └──  — Design and implementation templates
    ├── watch-mode
    │   └── 
    └──  — Feature design and implementation documents

Patterns in this file

01

Separate rationale from machinery

Internal documentation has distinct design and implementation files. A feature only needs a design file when there is reasoning worth retaining, so the structure does not require inventing rationale for every feature.

Source excerpt starting at line 19.
- **Structure:** one folder per feature, holding up to two files — `design.md` (the _why_: principles, goals, trade-offs, rejected alternatives, unresolved questions) and `implementation.md` (the _how_: components, data flow, file pointers, invariants). A feature with no recorded rationale keeps only `implementation.md`; add `design.md` when there's a _why_ worth capturing. The two files cross-link each other.

02 / Context budgeting

Remove context that code now explains

The guide asks maintainers to trim completed details while retaining decisions, failure modes, and unresolved questions. Documentation is maintained for the context it adds, not for a complete inventory of implementation.

Source excerpt starting at line 24.
- **Maintain like a garden:** Docs that drift from reality are worse than no docs. Trim what's been implemented and is now obvious from the code. Keep what's still valuable — the "why" behind decisions, failure modes, unresolved questions.

03 / Verification by change type

Specify what CI activation actually requires

The Windows rule requires both a label and rerunning jobs on the current PR commit. It explains why adding the label alone is insufficient.

Source excerpt starting at line 90.
- For Windows coverage on a PR, add the `ci: windows` label, then rerun all jobs in the latest `CI` workflow run whose event is `pull_request` and whose head SHA matches the PR. Adding the label alone does not start a workflow. Keep the label so later PR pushes also run the Windows jobs.

04 / Verification by change type

Distinguish execution tests from package installation tests

The WebContainer guidance separates the default wasm suite from a suite that installs and builds packed artifacts. Changes to bindings and their packaging therefore need an additional kind of evidence.

Source excerpt starting at line 99.
- **ALWAYS add this label when a PR touches anything napi-rs related** (napi / emnapi / wasm-runtime versions, the binding loader and glue, the `napi` config, `webcontainer-fallback.cjs`, binding packaging or publish steps). Pure wasm behavior changes don't need it — the default CI's `wasi` job already runs the test suite against the wasm binding; this label checks that the packed packages install and work inside WebContainer.

05 / Behavioral framing

Explain an internal compatibility exception

The root tips state that the internal Rust crates do not promise semver stability. Reviews should check in-repository callers rather than report a public compatibility violation that the project does not claim.

Source excerpt starting at line 9.
- The `rolldown_*` Rust crates do not follow semver (see `docs/apis/rust-crates.md`). Breaking API changes are expected and acceptable in any version — do not raise them as code-review findings as long as in-repo callers are updated.

Ideas for your repo

  1. Separate design decisions from implementation descriptions.
  2. Remove documentation that no longer adds context beyond the code.
  3. Explain how optional CI coverage is activated.
  4. Distinguish runtime behavior from packaged-installation behavior.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Rolldown. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works