All guides

Keep Project Working Conventions in Kilo Code

Write coding style and testing conventions into AGENTS.md so Kilo Code loads them each session, with per-directory additions for specific folders.

AINavWritten / Updated Sources checked
On this page

At a glance

Repeating the naming style or the checks to run at the start of every session is tedious and easy to forget. The official documentation says Kilo Code automatically discovers instruction files at the project root and in parent directories, with AGENTS.md as the primary file, and that AGENTS.md files in subdirectories are loaded dynamically when the agent reads a file there. This tutorial uses an invented project called sample-shop to write one root-level file and one subdirectory supplement, check that both take effect, and then switch them off.

Workflow

  1. Check discovery

    AGENTS.md, CLAUDE.md and CONTEXT.md are recognized at the project root; prefer AGENTS.md as the primary file.

  2. Check scope

    The root file applies project-wide. A subdirectory AGENTS.md is added only when a file in that directory is read, and need not repeat root rules.

  3. Check extra sources

    If you use the instructions list in kilo.jsonc, confirm every path exists. A URL that does not respond within 5 seconds is silently skipped.

Each stage cites official sources.

Before you start

  • The Kilo Code extension is installed in VS Code with the practice project open.
  • You can list three to five conventions your team really follows, such as naming, documentation and testing rules.
  • The conventions contain no passwords or tokens, because the file content is injected into the conversation.
  • Create docs/ if missing and docs/intro.md with a short sample page, providing the concrete input for the read trigger.

1. Pick conventions worth keeping

In a scratch note, write three to five rules you keep repeating, such as camelCase for functions, a test note for every new feature, or Title Case for documentation headings. Keep each to one checkable sentence and avoid vague requests like write good code. The documentation names coding style, documentation standards, testing requirements and workflow guidelines as typical content.

2. Create AGENTS.md at the project root

Create AGENTS.md in the project root and write your rules as short bullet items. The documentation calls it the primary instruction file; CLAUDE.md is supported for compatibility and CONTEXT.md adds project context. A project that already has CLAUDE.md can keep it, and a new project can simply use AGENTS.md.

3. Add a supplement for a specific folder

If docs/ has rules that differ from the rest of the project, create docs/AGENTS.md containing only what is specific to that folder, such as heading format. The documentation says subdirectory files supplement rather than replace, so root rules need not be copied. The file is loaded when the agent's Read tool accesses a file in that directory. Create docs/ if missing and docs/intro.md with a short sample page, providing the concrete input for the read trigger.

4. Add extra instruction sources if needed

If rules already live in other files, list paths, globs or URLs in the instructions array of kilo.jsonc, for example ./docs/coding-standards.md. You can also manage them under Agent Behaviour, in the Rules subtab of Settings. URLs are fetched at session start with a 5-second timeout and skipped silently if unreachable, so do not keep important rules only at a URL.

5. Start a new session and trigger the reads

After saving, open a fresh session and ask something the root rules affect, such as: following the project conventions, how should a new function be named? Then ask it to read a file under docs/ and state the heading format, which should trigger loading of the subdirectory file.

6. Compare, revise or switch off

Compare the answers with each rule you wrote. If one was ignored, make it shorter and more specific; if none applies, check that the file is in the root or the intended subdirectory. To stop using them, rename the file (for example AGENTS.md.bak) or delete it, remove matching entries from the instructions array, and start a new session to confirm the conventions no longer appear.

Original example

Invented project sample-shop. Root AGENTS.md: - Use camelCase for function names. - Every new feature needs a one-line test note. - Never put credentials in code or comments. docs/AGENTS.md: - Page titles use Title Case. Optional kilo.jsonc fragment (illustrative):

json
{
  "instructions": ["./docs/coding-standards.md"]
}

In a new session, ask about function naming first, then ask it to read docs/intro.md and state the heading format, and check both answers against the two files. Create docs/ if missing and docs/intro.md with a short sample page, providing the concrete input for the read trigger.

Completion checks

  • The root file is named exactly AGENTS.md and sits in the project root.
  • In a new session, answers reflect the root items, and after reading a docs/ file they also reflect the subdirectory item.
  • Every path in the instructions list exists, and no key rule depends only on a URL.
  • After switching off, a new session no longer cites these conventions.

Limits

  • Instructions guide behavior but do not enforce it; to hard-limit file edits, use an agent's permission rules rather than AGENTS.md alone.
  • A global AGENTS.md at ~/.config/kilo/AGENTS.md affects every project, and project-level instructions load before global ones. This guide covers only project-level files.
  • The global fallback at ~/.claude/CLAUDE.md ends once Claude Code Migration has been attempted, while project-level CLAUDE.md files keep working.
  • Legacy .kilocoderules files still load through auto-migration, but new projects are advised to use AGENTS.md.

Verification scope

This guide is based only on reading the official documentation. Login, installation, product API execution, file upload and generated output were not tested. The sample file contents are original and illustrative; actual session behavior may differ in your version.

Article sources

Original editorial content; official descriptions and checking suggestions are distinguished.

  1. Kilo Code · Official sources
    View details