Making AI-generated code reviewable by humans in 30 seconds.
AGENTS.md is the .eslintrc for AI agents.
cargo-kimi is the enforcer (Rust).
Score is the quality gate.
When Kimi (or any agent) opens your repo, it reads AGENTS.md automatically via ${KIMI_AGENTS_MD} and knows your invariants before it writes a single line of code.
kimi-dotfiles/
├── AGENTS.md # Root guidelines (applies to all subdirectories)
├── FORMALISM.md # Concrete patterns: Hoare triples, PhantomData, Typestate
├── GLOSSARY.md # Vocabulary: Lemma, Theorem, Axiom, Invariant, Monad
├── PIPELINE.md # Development process with complexity gates
├── SEVERITY.md # CRITICAL = axiom violation, MAJOR = proof gap, etc.
├── templates/ # AGENTS.md templates by project type
│ ├── rust/
│ │ ├── minimal/
│ │ ├── rust-only/
│ │ ├── full/
│ │ └── modular/
│ └── python/
├── strictness/ # Clippy configs: relaxed, standard, strict
├── examples/ # Example projects following the guidelines
│ ├── rust-demo/
│ └── rust-http-client/
├── languages/ # Language-specific rule sets
│ ├── rust/
│ └── python/
├── benchmarks/ # Prompt benchmarks and scoring rubrics
├── skills/ # Kimi CLI skills
└── .github/
└── actions/
└── cargo-kimi/ # Reusable GitHub Action for CI
# 1. Install the enforcer
cargo install cargo-kimi
# 2. Initialize AGENTS.md in your project
cargo kimi init --template rust-only --yes
# 3. Run the quality gate
cargo kimi check
# → src/error.rs (score: 80)
# → src/ffi.rs (score: 40) [CRITICAL] L17: unwrap() outside test
# Average score: 60/100
# 4. Watch your team improve over time
cargo kimi trend --days 30
# → 2026-05-01 ████████░░ 45/100
# → 2026-05-04 █████████░ 47/100# 1. Copy the Python guidelines
cp kimi-dotfiles/templates/python/AGENTS.md your-project/AGENTS.md
# 2. Install tools
pip install mypy ruff black hypothesis pydantic pip-audit
# 3. Run checks (or use the provided Makefile)
make checkNote:
cargo-kiminow lives in its own repository:
https://github.com/ekhodzitsky/cargo-kimi
AI coding assistants are fast—but left unchecked they produce:
unwrap()in production paths- Functions without documentation
f64wherePrice(u64)should live- No proof that types actually encode invariants
The result: a code review that takes 30 minutes instead of 30 seconds.
kimi-dotfiles fixes this by making the agent's constraints explicit, measurable, and enforcable.
| Layer | What | Where |
|---|---|---|
| Contract | AGENTS.md tells the agent your rules |
Root or .kimi/ |
| Measure | cargo kimi check scores every file 0-100 |
CI or pre-commit |
| Enforce | Clippy + contract checker block bad commits | .cargo/config.toml |
| Track | cargo kimi trend shows score history |
.kimi/score-history.jsonl |
We do not claim mathematical proof. We claim:
- Types encode invariants —
NonZeroU64beatsu64 > 0comments. - Tests find bugs — property tests catch edge cases humans miss.
- Hoare triples are documentation prompts —
/// { pre } fn foo() { post }tells the next agent (human or AI) what the function promises.
# Install once
cargo install cargo-kimi
# Initialize in any Rust project
cargo kimi init --template rust-only --yes
# Place in .kimi/ for automatic Kimi CLI discovery
cargo kimi init --template rust-only --location .kimi --yes
# Run checks
cargo kimi checkcd your-rust-project
bash /path/to/kimi-dotfiles/install.shbash /path/to/kimi-dotfiles/install.sh --template rust-only --strictness relaxed --yescp kimi-dotfiles/templates/rust/rust-only/AGENTS.md your-project/AGENTS.md
cp kimi-dotfiles/.cargo/config.toml your-project/.cargo/config.toml| Tool | Language | Repository |
|---|---|---|
cargo-kimi |
Rust | ekhodzitsky/cargo-kimi |
When you run kimi in a project directory, it automatically discovers and injects AGENTS.md into the system prompt via ${KIMI_AGENTS_MD}.
Zero configuration. Place the file and Kimi follows your rules.
Supported locations (checked in order):
.kimi/AGENTS.md— project-local config (highest priority)AGENTS.md— standard location
Files are merged root→leaf with source annotations. Deeper directories override parent rules.
Without guidelines — Kimi generates:
fn process(amount: f64, tax: f64) -> f64 {
amount * (1.0 + tax) // What if amount < 0? What if tax > 1.0?
}With guidelines — Kimi generates:
/// { price.cents() >= 0 && rate.value() <= 1.0 }
/// fn calculate(price: Price, rate: TaxRate) -> Price
/// { ret.cents() == price.cents() + tax_amount }
pub fn calculate(price: Price, rate: TaxRate) -> Price {
let tax = (price.cents() as f64 * rate.value()).round() as u64;
Price::from_cents(price.cents() + tax)
}| Strictness | Clippy | Contract Checker | Best For |
|---|---|---|---|
| relaxed | warnings only | CRITICAL only | Existing projects, gradual adoption |
| standard | deny unwrap/panic | CRITICAL + MAJOR | New projects, daily development (default) |
| strict | deny everything | all violations | Greenfield, maximum rigor |
Choose with install.sh --strictness {relaxed|standard|strict}. Default is standard.
- uses: ekhodzitsky/cargo-kimi/.github/actions/cargo-kimi@main
with:
strictness: standardThe action installs
cargo-kimifrom crates.io and runs checks automatically.
Copy pre-commit.example.yaml to .pre-commit-config.yaml to block commits without contracts.
| Document | Purpose |
|---|---|
| FORMALISM.md | Concrete patterns: Hoare triples, PhantomData, Typestate, proptest, Miri, Kani, fuzzing |
| GLOSSARY.md | Vocabulary: Lemma, Theorem, Axiom, Invariant, Monad, Homomorphism |
| PIPELINE.md | Development process with complexity gates |
| SEVERITY.md | CRITICAL = axiom violation, MAJOR = proof gap, MINOR = style, INFO = suggestion |
-
cargo kimi checkwith per-file scoring -
cargo kimi trendfor score history - Modular templates (
parts/) - MCP server for cross-agent integration
- SARIF output for GitHub Advanced Security
-
cargo kimi watchfor continuous checking - Standalone
cargo-kimirepository - Python agent guidelines
- IDE extension (real-time score in editor)
- Custom rule DSL
- TypeScript agent guidelines (
ts-kimi?) - Go agent guidelines (
go-kimi?)
See CONTRIBUTING.md for the full guide.
Quick areas where help is especially appreciated:
- New language guidelines (TypeScript, Go, Zig)
- Additional
templates/for frameworks (Axum, Actix, Django, FastAPI) - Benchmarks and prompt engineering improvements
- Documentation translations
Open an issue first if the change is larger than a typo fix.
Pin to a tag:
git clone https://github.com/ekhodzitsky/kimi-dotfiles.git
cd kimi-dotfiles
git checkout v1.6.0 # or latest tagIn your project's AGENTS.md:
<!-- kimi-dotfiles: v1.6.0 -->
<!-- Strictness: standard -->MIT