guardrails
Guide for guardrails
Agent Guardrails
These guardrails must be followed by all agents to ensure code quality and consistency.
Code Quality Standards
- Strict Clippy & Format Checks:
- Before finishing ANY task involving Rust code changes, you MUST run:
cargo fmt --all -- --checkcargo clippy --workspace
- You are NOT ALLOWED to ignore these errors or bypass them.
- If
cargo fmtfails, apply the changes withcargo fmt --all. - IMPORTANT: Follow the
/rust-clean-codeworkflow for coding patterns that prevent warnings.
- Before finishing ANY task involving Rust code changes, you MUST run:
- Writing Clean Rust Code (See
/rust-clean-codefor full details):- Struct Initialization: Use
..Default::default()or constructors instead of verbose literals - Async: Only mark functions
asyncwhen they contain.await(except Axum handlers) - Error Handling: Use
?operator,anyhow::Result, avoidunwrap()in production - Casts: Explicit casts like
x as i32are allowed and preferred for clarity - SQL: Use raw strings
r"..."orr#"..."#for SQL queries
- Struct Initialization: Use
- Regression History (Learn from past mistakes):
- Regression:
mutkeyword inloh-gamematcharms.- Root Cause: Agent did not run
cargo clippyon modified files. - Fix: Removed
mutkeyword; fixedmatcharms.
- Root Cause: Agent did not run
- Regression:
missing fields(E0063) in struct literals in tests.- Root Cause: Tests used verbose struct literals that broke when new fields were added.
- Fix: Use
..Default::default()or constructors. See/rust-clean-codeworkflow.
- Regression:
- No Unjustified #[allow]:
- Do not add
#[allow(...)]directives unless absolutely necessary. - If you must use
#[allow], add a comment explaining WHY it is safe to ignore.
- Do not add
- Test Verification:
- Always run tests related to your changes (
cargo test -p <crate>). - Ensure tests compile and pass before declaring a task complete.
- Always run tests related to your changes (
Workflow Enforcements
- Turbo Mode: Some workflows allow auto-running commands. Use judgement but generally prefer efficiency.
- Task Boundaries: Use
task_boundaryto structure your work and keep the user informed.
World Building Guidelines
- NO OSRS/RS3 References:
- You are STRICTLY PROHIBITED from using location names, NPC names, or lore specific to Old School RuneScape (OSRS) or RuneScape 3 (RS3).
- Examples of BANNED names: Varrock, Falador, Lumbridge, Al Kharid, Zanaris, Edgeville, Karamja, Draynor, Gnome Stronghold.
- Use original, generic, or Vedic-themed names (e.g., "Capital City", "Forest Hub", "Hastinapur", "Dandaka Forest").
Data Engineering Guardrails
- Naming Conventions:
- IDs must be
snake_case. - No spaces or special characters in IDs.
- IDs must be
- No OSRS/RS3 Content:
- Do not use names like "Mithril", "Adamant", "Rune" in
id,name,description, ornote_id. - Use Vedic equivalents: "Soma", "Meteoric", "Divya".
- Do not use names like "Mithril", "Adamant", "Rune" in
- JSON Validity:
- Ensure the
datacolumn in CSVs contains valid JSON. - Use
checksumtools if available to verify integrity.
- Ensure the
Knowledge Base Standards
- Frontmatter Required:
- ALL KB markdown files must have YAML frontmatter with
last_updatedandstatusfields. - When editing any KB file, you MUST update
last_updatedto the current date.
- ALL KB markdown files must have YAML frontmatter with
- Status Management:
active- Current, authoritative documentation.superseded- Replaced by a newer document (must link to replacement).deprecated- No longer relevant, pending removal.
- Directory Structure:
- Follow existing conventions. See
/maintain-knowledge-baseworkflow for placement rules. - Do not create orphaned docs outside the established hierarchy.
- Follow existing conventions. See
- MCP Integration:
- Use MCP tools (
search_kb,read_kb_file) to discover existing docs before creating new ones. - Avoid duplicating information already in the KB.
- Use MCP tools (