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.
…- 1
~/.kimi-code/AGENTS.mdYour Kimi-only instructions for every project. - 2
~/.agents/AGENTS.mdYour cross-tool instructions, shared with other agents. - 3
AGENTS.md, root to working folderUltraciteIn each directory from the git root down, after that directory’s.kimi-code/AGENTS.md. A lowercaseagents.mdstands in when there’s noAGENTS.md. - 4
Deeper 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 = falseturns watching off. - Relocating
KIMI_CODE_HOMEmoves~/.kimi-code/AGENTS.md;~/.agents/AGENTS.mdstays in your real home.- Custom prompts
- A custom
SYSTEM.mdor agent file includesAGENTS.mdonly where its template uses theagents_mdvariable.
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*)"- 01Kimi changes a file with its
EditorWritetool. - 02Following
AGENTS.md, it runsnpx ultracite fixornpx ultracite checkwith itsBashtool. - 03The
allowrule matches that command, so it runs without a prompt even in Always Ask mode. - 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,GreporBashcall touches a folder whoseAGENTS.mdisn’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.mdand 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 -pruns one prompt without the interface in Never Ask mode, so every tool call,ultraciteincluded, runs without approval.--yoloand--autocan’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 skillinitinstalls in.agents/skills/. Run/skill:ultraciteto 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 everyAGENTS.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. OnlyPreToolUse,StopandUserPromptSubmitcan block or reply;PostToolUseis 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 Pythonkimi-cli, andkimi migratebrings your configuration and session history across. Ultracite calls the agentkimi-code, the id to pass toinit;kimi-cli, its old id, still works. - How do I let Kimi run Ultracite without asking?
- Add a
[[permission.rules]]entry withdecision = "allow"andpattern = "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.
Keep going
- AgentQwen CodeThe Qwen team’s open-source terminal coding agent, with editor and desktop front ends.
- AgentMistral VibeMistral AI’s open-source terminal coding agent, also usable in editors over ACP.
- AgentCrushCharm’s terminal coding agent that works with many model providers, with LSP context and MCP.
- DocsAgent rulesWhat
initwrites for every agent, and how to keep it current.
Ship less slop
One command sets up your linter, formatter, editor and agents. Works with Oxlint, Biome and ESLint.