These instructions define the execution rules, scope limits, global language requirements, and hard prohibitions for all automated agents operating in this repository.
They override typical Rust conventions or local patterns when conflicting with any rule below.
- Strict compliance: Follow every rule in this document exactly.
- Scope lock: Modify only what is strictly necessary for the explicit user request.
Forbidden out-of-scope actions:
- Unrelated refactors, renames, reorganizations, or cleanups.
- API changes or architectural shifts unless explicitly requested.
- Any improvement not required to fulfill the user request.
If unrelated issues are noticed:
- Do not modify them.
- Finish the requested task.
- Optionally list them under Future suggestions.
These requirements apply to all text produced, including:
- Code comments (
//,///,//!) - Documentation and README content
- Log messages and tracing output
- Error messages, panic text, diagnostics
- User-facing strings (CLI, UI, HTTP responses)
- Commit messages, summaries, explanations
Global requirements:
- Use clear, grammatically correct English.
- Start sentences with a capital letter and end with proper punctuation.
- Avoid slang, shorthand, and mixed languages.
- Avoid ambiguous abbreviations (
u,tho,w/, etc.). - Ignore poor style in surrounding text; follow these global rules instead.
These language rules override any conflicting rules elsewhere.
Use the workspace’s cargo make tasks:
Required:
cargo make fmtcargo make clippycargo make nextest
Forbidden unless no equivalent task exists:
cargo fmtcargo clippycargo test
If the user requests raw cargo and a matching cargo make task exists,
use the task and briefly note this.
The Rust toolchain is pinned.
Never:
- Modify
rust-toolchain.toml,.cargo/config.toml, orrustfmt.toml. - Install, update, or override toolchains.
- Invoke system package managers.
Allowed:
- Edits strictly required for the requested change.
- Minimal adjacent edits required for compilation or consistent behavior.
Forbidden:
- Reformatting unrelated files or statements.
- Reorganizing imports in untouched files.
- Renaming unrelated identifiers or modules.
- Introducing new public APIs unless explicitly requested.
Out-of-scope issues must not be fixed.
Implement exactly what the user asks. Within that scope:
- Maintain clarity and correctness.
- Apply consistent error handling.
- Add tests only when logically required by the change.
- Prefer simple, explicit constructs.
- Avoid clever or obscure code.
- Maintain module cohesion.
- Keep functions readable: aim for a single, easy-to-follow responsibility per function. If a function grows beyond what fits comfortably on one screen (~30–80 lines for typical business logic) or accumulates many branches, consider extracting helpers so the happy path stays clear. Do not split tightly coupled logic just to satisfy a line count; prioritize clarity and low cognitive load.
Before adding new code or crates:
- Prefer the standard library.
- Prefer existing repo utilities.
- Prefer existing dependencies.
Add new external crates only when necessary.
Do not change existing behavior unless explicitly required.
- Prefer
apply_patchfor edits unless generation or scripting is more appropriate. - Batch related edits; avoid scattered micro-patches.
- Never revert user-made changes.
- Never use destructive git commands (
reset --hard,checkout --). - If unexpected file changes appear: STOP and ask the user.
- Never import tracing macros; always use fully-qualified calls (
tracing::info!). - No silent failures; errors must be logged or propagated clearly.
- Avoid broad catch patterns or swallowed errors.
Violating any of these invalidates the output:
Never modify toolchain config or invoke system package managers.
Never modify:
- Generated files
target/- Vendored/third-party code
- Files outside the repository root
- Modify only what the explicit request requires.
- No opportunistic refactors.
- No
unwrap()orexpect()in non-test code. - Never block inside async (
thread::sleep, blocking I/O).
- Never infer missing requirements.
- Choose the smallest valid change.
- Ask questions only when truly blocked.
Rust formatting and style conventions live in STYLE_RUST.md.
These rules apply only when editing Rust code and do not override
the global behavior and language rules in this file.