These rules apply when working with the agent-md project.
agent-md is a Rust-based Markdown editor designed for AI agents. It provides CLI tools for reading, writing, editing, and validating Markdown files with JSON output.
For any development task:
- On task completion, you must:
- Update documentation in the
docs/directory - Update
README.md - Write unit tests for your changes
- Update "./CHANGELOG.md" file with summary of your changes.
- Update documentation in the
- Validate completion:
- Run linting:
cargo clippy --all-targets --all-features -- -D warnings - Run formatter:
cargo fmt - Run tests:
cargo test
- Run linting:
After creating or updating any markdown file, always run agent-md lint path/to/file.md to validate the content before considering the task complete.
- NEVER start with grep/rg for definitions, signatures, class names, or type declarations, use
vfsCLI first. Ifvfsdoesn't work, then use grep/rg.
Whenever you finish a task or change codes, always log your work using the l-log bash command (llm-lean-log-cli package) with the following format:
l-log add ./logs/chat.csv "<Task Name>" --tags="<tags>" --problem="<problem>" --solution="<solution>" --action="<action>" --files="<files>" --tech-stack="<tech>" --created-by-agent="<agent-name>"
Note: --last-commit-short-sha is optional and will be auto-populated by the CLI if not provided.
Before run:
- Install the l-log CLI if not already installed:
bun add -g llm-lean-log-cli. - If need, run CLI help command:
l-log -hfor more information. - log path:
./logs/chat.csv.
When writing Markdown files in this project, follow these critical rules:
- No bold text: Double asterisks and double underscores are NOT allowed
- Use italics instead of bold for emphasis
- Use headings for structure
- Use code formatting for technical terms with backticks
Additional rules enforced by agent-md linter:
- Simple table syntax (5 columns or fewer, 3-dash separators)
- No useless links (link text must differ from URL)
- No ASCII graphs (use JSON, CSV, or Mermaid)
- Proper heading hierarchy (no level skipping)
- Code blocks must specify language
- No duplicate headings
- Single H1 title per document
cargo build --release # Build release version
cargo test # Run tests
cargo fmt # Format code
cargo fmt --check # Check code formatting
cargo clippy --all-targets --all-features -- -D warnings # Run clippy lints
cargo audit # Security audit- Cognitive complexity 30 or less
- Function arguments 7 or fewer
- Type complexity 250 or less
- Documentation required for public items
- No unwrap/expect in production code
- Maximum line width: 100 characters
- 4 spaces for indentation
- Vertical trailing commas
- Reordered imports
- Build fails: Check Rust version in
rust-toolchain.toml(requires 1.94.0) - Formatting errors: Run
cargo fmt - Clippy warnings: Address linting issues in code
- Test failures: Check test output for specific errors
For comprehensive project information, use the agent-md skill when available.