# Custom Instructions

> Provide custom instructions to guide Kilo Code

- 网址：https://funcoding.ai/agents/kilo-code/customize/custom-instructions/
- 来源：Kilo Code 官方文档原文（英文），MIT 许可，同步于 2026-10-11
- 官方原文：https://kilo.ai/docs/customize/custom-instructions

---
Custom Instructions allow you to personalize how Kilo Code behaves, providing specific guidance that shapes responses, coding style, and decision-making processes. Both the **VSCode** and **CLI** versions support custom instructions, though the mechanisms differ.

## What Are Custom Instructions?

Custom Instructions define specific Extension behaviors, preferences, and constraints beyond Kilo's basic role definition. Examples include coding style, documentation standards, testing requirements, and workflow guidelines.

**VSCode**

The extension provides multiple layers of instruction configuration — from per-agent prompts in the Settings UI to auto-discovered files in your project and global config.

## Per-Agent Prompts

Each agent can have its own custom prompt configured through the settings UI:

1. Open **Settings → Agent Behaviour → Agents** subtab
2. Select the agent you want to customize
3. Enter your instructions in the markdown text area under the agent's `prompt` field
4. Save your changes

These prompts are injected into the agent's system prompt and apply across all sessions using that agent.

## Instruction Files

Kilo automatically discovers instruction files at your project root and in parent directories (via `findUp`). The following filenames are recognized:

- **`AGENTS.md`** — The primary instruction file for Kilo
- **`CLAUDE.md`** — Also supported for compatibility
- **`CONTEXT.md`** — Additional project context

Place any of these files at your project root to provide project-wide instructions to the agent.

### Global Instructions

For instructions that apply across all your projects, place an `AGENTS.md` file in your global config directory:

- **Kilo:** `~/.config/kilo/AGENTS.md`
- **Claude-compatible:** `~/.claude/CLAUDE.md`, until [Claude Code Migration](https://funcoding.ai/agents/kilo-code/getting-started/settings/#claude-code-migration) has been attempted. Migration ends this global fallback; project-level `CLAUDE.md` files keep working.

Project-level instructions are loaded before global instructions and apply to every session.

### Per-Directory Instructions

You can place `AGENTS.md` files in any subdirectory of your project. These are loaded dynamically — when the agent's Read tool accesses a file in that directory, the corresponding `AGENTS.md` is discovered and its contents are injected into the conversation as `<system-reminder>` tags.

This is useful for providing context-specific guidance for different parts of a monorepo or project. The subdirectory file does not need to duplicate root-level instructions; it supplements them for tasks within that directory.

## Additional Instruction Sources

The `instructions` key in `kilo.jsonc` accepts an array of paths, globs, or URLs pointing to additional instruction files. You can manage these in **Settings → Agent Behaviour → Rules** subtab.

```yaml
# Examples of instruction sources
instructions:
  - ./docs/coding-standards.md
  - ./teams/frontend-rules.md
  - https://example.com/team-instructions.md
```

<div class="callout callout-note">

**URL-Based Instructions**

URL-based instruction sources are fetched at session start with a 5-second timeout. If the URL is unreachable, the instruction source is silently skipped.

</div>

## Legacy `.kilocoderules` Support

If your project contains `.kilocoderules` files from the VSCode extension, these are still loaded via auto-migration. However, migrating to `AGENTS.md` is recommended for new projects.

**CLI**

The CLI provides multiple layers of instruction configuration — from per-agent prompts in agent definition files to auto-discovered files in your project and global config.

## Per-Agent Prompts

Each agent can have its own custom prompt defined in its `.md` file (the markdown body) or via the `agent.<name>.prompt` key in `kilo.jsonc`:

```jsonc
// kilo.jsonc
{
  "agent": {
    "code": {
      "prompt": "You are a Python specialist. Follow PEP8 strictly.",
    },
  },
}
```

Or as the markdown body in `.kilo/agents/code.md`:

```markdown
---
description: Python specialist
---

You are a Python specialist. Follow PEP8 strictly.
```

These prompts are injected into the agent's system prompt and apply across all sessions using that agent.

## Instruction Files

Kilo automatically discovers instruction files at your project root and in parent directories (via `findUp`). The following filenames are recognized:

- **`AGENTS.md`** — The primary instruction file for Kilo
- **`CLAUDE.md`** — Also supported for compatibility
- **`CONTEXT.md`** — Additional project context

Place any of these files at your project root to provide project-wide instructions to the agent.

### Global Instructions

For instructions that apply across all your projects, place an `AGENTS.md` file in your global config directory:

- **Kilo:** `~/.config/kilo/AGENTS.md`
- **Claude-compatible:** `~/.claude/CLAUDE.md`, until [Claude Code Migration](https://funcoding.ai/agents/kilo-code/getting-started/settings/#claude-code-migration) has been attempted. Migration ends this global fallback; project-level `CLAUDE.md` files keep working.

Project-level instructions are loaded before global instructions and apply to every session.

### Per-Directory Instructions

You can place `AGENTS.md` files in any subdirectory of your project. These are loaded dynamically — when the agent's Read tool accesses a file in that directory, the corresponding `AGENTS.md` is discovered and its contents are injected into the conversation as `<system-reminder>` tags.

This is useful for providing context-specific guidance for different parts of a monorepo or project. The subdirectory file does not need to duplicate root-level instructions; it supplements them for tasks within that directory.

## Additional Instruction Sources

The `instructions` key in `kilo.jsonc` accepts an array of paths, globs, or URLs pointing to additional instruction files. Configure these in your `kilo.jsonc`:

```jsonc
// kilo.jsonc
{
  "instructions": [
    "./docs/coding-standards.md",
    "./teams/frontend-rules.md",
    "https://example.com/team-instructions.md",
  ],
}
```

<div class="callout callout-note">

**URL-Based Instructions**

URL-based instruction sources are fetched at session start with a 5-second timeout. If the URL is unreachable, the instruction source is silently skipped.

</div>

## Legacy `.kilocoderules` Support

If your project contains `.kilocoderules` files from the VSCode extension, these are still loaded via auto-migration. However, migrating to `AGENTS.md` is recommended for new projects.

## Related Features

- [Custom Modes](https://funcoding.ai/agents/kilo-code/customize/custom-modes/)
- [Custom Rules](https://funcoding.ai/agents/kilo-code/customize/custom-rules/)
- [Settings Management](https://funcoding.ai/agents/kilo-code/getting-started/settings/)
- [Auto-Approval Settings](https://funcoding.ai/agents/kilo-code/getting-started/settings/auto-approving-actions/)
