Skip to content
Ultracite
Esc
↑↓navigate↵open⌘Jpreview

Kimi Code CLI notices AGENTS.md files as it goes

Kimi Code CLI loads every AGENTS.md from the git root down to the folder you start in, and points the model at deeper ones when it works near them. Its hooks can’t report back after an edit, so it runs ultracite fix and check because the rules tell it to.

Kimi Code CLI by Moonshot AIChecked against Kimi Code CLI 2.1.1

# Ultracite Code Standards

This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.

## Quick Reference

- **Format code**: `npx ultracite fix`
- **Check for issues**: `npx ultracite check`
- **Diagnose setup**: `npx ultracite doctor`

Oxlint + Oxfmt (the underlying engine) provides robust linting and formatting. Most issues are automatically fixable.

…
Ultracite’s rules
Where Kimi Code CLI looks for instructions
  1. 1~/.kimi-code/AGENTS.mdYour Kimi-only instructions for every project.
  2. 2~/.agents/AGENTS.mdYour cross-tool instructions, shared with other agents.
  3. 3AGENTS.md, root to working folderUltraciteIn each directory from the git root down, after that directory’s .kimi-code/AGENTS.md. A lowercase agents.md stands in when there’s no AGENTS.md.
  4. 4Deeper AGENTS.md filesNot loaded at start. When a tool call touches a folder that has one, Kimi tells the model to read it first.

How Kimi Code CLI reads the rules

Kimi builds one instructions block from your global files and every AGENTS.md between the git root and your working folder, then keeps an eye out for the ones further down.

Size
Past 32 KiB in total, Kimi warns that the files are large. It doesn’t truncate them.
Labeled
Each file arrives under a <!-- From: path --> line, so the model knows which folder a rule came from.
No git
Outside a git repository, only the working folder’s files load, plus your global ones.
Live reload
Changes to these files are picked up mid-session. [watch] enabled = false turns watching off.
Relocating
KIMI_CODE_HOME moves ~/.kimi-code/AGENTS.md; ~/.agents/AGENTS.md stays in your real home.
Custom prompts
A custom SYSTEM.md or agent file includes AGENTS.md only where its template uses the agents_md variable.

Allow Ultracite once, then it runs

Kimi’s PostToolUse hook is observation-only: it fires after a tool succeeds, but nothing it returns reaches the model, and hooks are set in ~/.kimi-code/config.toml, not per project. So Ultracite doesn’t set one up. The commands in AGENTS.md are the check, and a permission rule lets Kimi run them without asking.

[[permission.rules]]
decision = "allow"
pattern = "Bash(npx ultracite*)"
  1. 01Kimi changes a file with its Edit or Write tool.
  2. 02Following AGENTS.md, it runs npx ultracite fix or npx ultracite check with its Bash tool.
  3. 03The allow rule matches that command, so it runs without a prompt even in Always Ask mode.
  4. 04Kimi reads the output and fixes what’s left.

Worth knowing about Kimi Code CLI

  • Deeper AGENTS.md files get flagged

    When a Read, Edit, Write, Glob, Grep or Bash call touches a folder whose AGENTS.md isn’t in the prompt, Kimi adds a reminder naming the file and telling the model to read it before changing anything there.

  • Rule changes reach a running session

    Kimi watches its instruction files while a session runs. Edit AGENTS.md and the model is told its copy is stale and to read the current file, so new rules apply without a restart.

  • kimi -p never asks

    kimi -p runs one prompt without the interface in Never Ask mode, so every tool call, ultracite included, runs without approval. --yolo and --auto can’t be combined with --prompt.

  • The Ultracite skill

    Kimi Code CLI loads skills from .kimi-code/skills/ and .agents/skills/ at the project root, plus ~/.kimi-code/skills/ and ~/.agents/skills/, so it finds the Ultracite skill init installs in .agents/skills/. Run /skill:ultracite to load it yourself.

Kimi Code CLI questions, answered

Does Kimi Code CLI read AGENTS.md?
Yes. It loads ~/.kimi-code/AGENTS.md, ~/.agents/AGENTS.md, and every AGENTS.md (with any .kimi-code/AGENTS.md) from the git root down to the folder you start in, each marked with the path it came from.
Does Kimi Code CLI support hooks?
Yes, as [[hooks]] in ~/.kimi-code/config.toml. Only PreToolUse, Stop and UserPromptSubmit can block or reply; PostToolUse is observation-only, so a lint hook there couldn’t tell the model anything. Ultracite doesn’t set one up.
Is Kimi Code CLI the same as kimi-cli?
It’s the successor. Kimi Code CLI (command kimi) replaces the legacy Python kimi-cli, and kimi migrate brings your configuration and session history across. Ultracite calls the agent kimi-code, the id to pass to init; kimi-cli, its old id, still works.
How do I let Kimi run Ultracite without asking?
Add a [[permission.rules]] entry with decision = "allow" and pattern = "Bash(npx ultracite*)" to ~/.kimi-code/config.toml, or start Kimi with --yolo (Ask When Needed mode).
Does Kimi Code CLI truncate long AGENTS.md files?
No. Past 32 KiB in total it warns that the files are large, but it still loads everything. Ultracite’s rules are about 5 KB.

Ship less slop

One command sets up your linter, formatter, editor and agents. Works with Oxlint, Biome and ESLint.