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 repository artifacts generated or modified by agents, including:
- Code comments (
//,///,//!) - Documentation and README content
- Log messages and tracing output
- Error messages, panic text, diagnostics
- User-facing strings stored in the codebase (CLI, UI, HTTP responses)
- Commit messages, summaries, and explanations written into repository files
They do not constrain interactive chat responses outside the repository. For chat, use the language requested or implied by the user (for example, Chinese when the user is speaking Chinese).
Global requirements for repository artifacts:
- 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 for repository artifacts.
If these rules conflict with higher-priority instructions (system, developer, or user), follow the higher-priority instruction and briefly note the conflict in your response.
Use the workspace’s cargo make tasks when they are the best fit for the job. These tasks are convenience wrappers for common workflows:
cargo make fmtcargo make clippycargo make nextestcargo make sqlx
You may use raw cargo commands when they are more appropriate for the specific task or when explicitly requested.
Run verification commands only when requested or when you need evidence before claiming completion.
Do not set DATABASE_URL manually when running cargo make tasks.
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. “Unexpected” means any modified file you did not touch or any change not required by the request.
- 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 Treat any file with a “Generated by” or “Do not edit” header, or any file under directories named target/, dist/, build/, gen/, or .next/ as generated.
- Modify only what the explicit request requires.
- No opportunistic refactors.
- No
unwrap()in non-test code. expect()is allowed only in global or static initialization and one-time startup initialization where failure should terminate the process immediately with a clear message.- Never block inside async (
thread::sleep, blocking I/O).
- Never infer missing requirements.
- Choose the smallest valid change.
- Ask clarifying questions only when requirements are ambiguous or there are multiple reasonable interpretations. Otherwise proceed.
Rust formatting and style conventions live in docs/guide/development/rust_style_guide.md.
These rules apply only when editing Rust code and do not override
the global behavior and language rules in this file.