Home › Rules › Kiro custom agents
Kiro custom agents and subagents: the config file, examples and permissions
Short answer: a Kiro custom agent is one file in .kiro/agents/ (one project) or ~/.kiro/agents/ (every project). It can be JSON, or Markdown with the settings in a YAML header and the system prompt in the body. The file decides which tools the agent can see (tools), what those tools may do without asking (permissions), what it reads at the start (resources), and which model it uses. Switch to it with the agent picker in the IDE, /agent swap in the CLI, or kiro-cli --agent name. Any custom agent can also run as a subagent: the main agent hands it a task, it works in its own context window, and it reports back. In CLI V3 and the IDE, a subagent never gets more permission than the session that started it.
What a custom agent is for
Out of the box, Kiro's default agent can use every tool but asks before most actions. Kiro's docs say custom agents let you pre-approve the operations you trust, take away tools a job doesn't need, load the right files automatically, and share the same setup with your team through git. So a custom agent is mostly about access. If you only want to change how Kiro writes code, Kiro's own tip is to use steering files instead, or both together.
| Feature (Kiro's tables) | IDE | CLI | Web | Mobile |
|---|---|---|---|---|
Project agents (.kiro/agents/) | Yes | Yes | Yes | No |
Global agents (~/.kiro/agents/) | Yes | Yes | No | No |
| Switch agents in the UI | Yes | Yes | No | No |
| Custom agents as subagents | Yes | Yes | Yes | No |
On Kiro Web you can't pick a custom agent as the main agent, but the main agent can hand work to the ones committed in .kiro/agents/. Personal agents for cloud sessions are uploaded under Agent Config > Cloud Config in Kiro Web. Mobile only uses Kiro's built-in agents. Kiro Crew has its own agent setup plus long-running bots: see Kiro Crew.
The agents Kiro already has
Before you write one, check the built-ins. Kiro ships Default (the general agent every session starts with), Spec, Quick Spec and Bug Fix (they write requirements, design and task files in .kiro/specs/; see Kiro specs), and Plan, which is read-only: it can read files and search the web but can't write files, run commands or use MCP tools. The CLI adds Guide (/guide, answers from Kiro's docs for your installed version). Inside, Kiro also uses two subagents of its own, one that gathers context and a general-purpose one. In the IDE they show up in the / menu as /context-gatherer and /general-task-execution. More on planning first in our plan mode guide.
Where agent files go
my-project/
└── .kiro/
└── agents/
├── backend-dev.md # Markdown: settings in the header, prompt in the body
├── code-reviewer.json # JSON: prompt goes in the "prompt" field
└── team/
└── planner.md # nested folder: the agent is called team/planner
~/.kiro/agents/ # global agents, available in every project
Free rules starter pack for Cursor, Claude Code, Codex and Antigravity
One shared AGENTS.md that works across Cursor, Claude Code, Codex, Copilot and Antigravity, plus database and test rules in each tool's format. Unzip it into your project and fill in two sections. I'll email you the link.
Free. No spam. Unsubscribe anytime. See our privacy note.
- Project agents go in
.kiro/agents/. They're shared through git, and Kiro only loads them if you trust the workspace. - Global agents go in
~/.kiro/agents/and work in every folder. - Same name in both? The project one wins, and the CLI shows a warning.
- Subfolders are allowed. The name is the path without the extension, so
team/planner.mdis the agentteam/planner. - JSON and Markdown agents can sit side by side in the same folder.
The file format, JSON or Markdown
Both formats take the same fields. Kiro's advice: Markdown when the system prompt is long and you want to read it as prose, JSON when a script writes the file. This is Kiro's quick-start agent:
---
name: backend-dev
description: Backend development specialist
model: claude-sonnet-4.6
tools: ["read", "write", "shell"]
permissions:
rules:
- capability: shell
match: ["npm *", "git *"]
effect: allow
---
You are a backend engineer focused on Node.js and TypeScript.
Always use async/await. All database queries must be parameterized.
In JSON the prompt goes in a "prompt" field instead, either as text or as "file://./prompts/my-prompt.md". A relative file:// path in prompt is read from the folder the agent file is in.
| Field | What it does |
|---|---|
name | The agent's name. Optional; Kiro uses the filename if it's missing. |
description | What it's for. The main agent reads this to decide when to use it as a subagent, so be specific. |
prompt | The system prompt (JSON only; in Markdown it's the body). |
model | A model ID from /model, like claude-sonnet-4.6. If that model isn't available, the first prompt can fail instead of falling back. |
tools | Which tools the agent can see: read, write, shell, web, subagent, @mcp, @builtin, @server, @server/tool, or * for everything. |
excludedTools | Tools to take away even if tools would allow them. |
permissions | Rules for what tools may do without asking (next section). |
resources | What it loads: file:// files at startup, skill:// skills (name and description first, the rest when needed), or a knowledgeBase to search. |
mcpServers | MCP servers just for this agent (command + args, or url + headers). Use ${VAR} for secrets. |
includeMcpJson | true adds the servers from your .kiro/settings/mcp.json files too. |
includePowers | Adds powers you installed in the IDE. |
hooks | Hooks that only run with this agent, CLI V3 only. See the warning below. |
welcomeMessage | Shown when you switch to the agent. |
Watch out with hooks: Kiro's IDE 1.0 field table says the IDE "ignores agents containing this field". If an agent shows up in the CLI but not the IDE, that's the first thing to check. For hooks that work in both, use standalone files in .kiro/hooks/ (Kiro hooks).
File limits: in Kiro CLI 3.1.0+ and IDE 1.4.86+, an agent loads at most 32 file:// files and 100,000 characters in total. A file over 50,000 characters is cut, and a file over 1 MiB is skipped. Once a limit is hit, the rest of the files aren't loaded, so list the important ones first.
Tools vs permissions (the part people mix up)
tools decides what the agent can see. permissions decides what those tools may do without asking you. They use different names: tools takes tags like read and write, while permission rules take capabilities like fs_read, fs_write, shell, web_fetch, mcp and subagent.
Each rule has a capability, a match list of patterns (file paths, command prefixes, or MCP server/tool names), an effect (allow runs silently, ask prompts you, deny blocks), and an optional exclude. A deny anywhere beats an allow anywhere. Most actions no rule covers will ask you first. This is Kiro's code-review agent from its examples page:
{
"name": "code-review-agent",
"description": "Specialized agent for code review and quality analysis",
"prompt": "You are a code review specialist focused on quality, security, and best practices",
"tools": ["read", "shell"],
"permissions": {
"rules": [
{ "capability": "shell", "match": ["grep *", "find *", "git diff *", "git log *", "eslint *", "pylint *"], "effect": "allow" },
{ "capability": "shell", "match": ["rm *", "sudo *"], "effect": "deny" }
]
},
"resources": [
"file://CONTRIBUTING.md",
"file://docs/coding-standards.md",
"file://.eslintrc.json",
"file://pyproject.toml"
],
"hooks": [
{
"name": "changed-files",
"trigger": "SessionStart",
"action": { "type": "command", "command": "git diff --name-only HEAD~1" }
}
]
}
Kiro's reference also warns that with write or shell on, an agent can change anything your user account can, including everything under ~/.kiro: other agents, skills, steering and mcp.json. Keep match patterns narrow, and give an agent write without shell when that's enough.
How to create a custom agent
- By hand (IDE or CLI): make the
.kiro/agents/folder and add a.mdor.jsonfile. In the IDE, click the agent name (for example "Default") at the bottom of the chat box and pick it. The new tools and permissions apply from your next message. - Let Kiro write it (CLI): type
/agent createin a chat. It asks for a name, a description, where to save it, and which MCP servers to include, then writes the file for you./agent create my-agent --manualopens a blank file in your editor instead, and--from other-agentcopies an existing one. - From the terminal:
kiro-cli agent create my-agent. Without--directory workspace, it saves to the global folder. - Use it:
/agent swap(picker) or/agent swap my-agentin a chat, or start withkiro-cli --agent my-agent. Your agents also show up in the IDE's/menu. - Check it:
/agent listshows which agents loaded and from where, and/agent schemashows the format to compare against.
Kiro custom agent examples you can copy
Kiro's examples page has an AWS specialist, a development workflow agent, the code reviewer above, a Docker and database project agent, and remote MCP agents. The ones below are ours, written against the current format. They're built to work together, and the third one hands work to the first two. Try them on a spare branch first.
Our example (VibeKits): a docs writer that can't touch your code
---
name: docs-writer
description: Writes and updates README and docs/ pages. Use for documentation changes only, never for source code.
tools: ["read", "write"]
permissions:
rules:
- capability: fs_write
match: ["docs/**", "README.md", "CHANGELOG.md"]
effect: allow
- capability: fs_write
match: ["src/**", ".env*", "package.json"]
effect: deny
resources:
- file://README.md
- file://.kiro/steering/**/*.md
welcomeMessage: "Docs only. Which page should I update?"
---
You write plain, short documentation for this project.
- Explain what a thing does before how it works.
- Every command you show must be one you found in package.json or the existing docs.
- Never change files outside docs/, README.md or CHANGELOG.md. If code looks wrong, say so in your reply instead of fixing it.
It has no shell tool at all, so it can't run commands. The two fs_write rules let it write docs without asking and block src/, .env files and package.json outright. Anything else it tries to write still asks you.
Our example (VibeKits): a test runner that only runs tests
{
"name": "test-runner",
"description": "Runs the test suite and reports which tests fail and why. Use after code changes, before saying a task is done. Does not edit files.",
"prompt": "You run tests and report results. Run the tests, read the failures, and reply with a short list: test name, file, the error, and your best guess at the cause. Do not edit any file.",
"tools": ["read", "shell"],
"permissions": {
"rules": [
{ "capability": "shell", "match": ["npm test", "npm test *", "npx vitest run *", "git diff *", "git status"], "effect": "allow" },
{ "capability": "shell", "match": ["git push *", "git reset *", "rm *", "sudo *"], "effect": "deny" }
]
},
"resources": ["file://package.json"]
}
Swap npm test for your own test command. It has read and shell but no write, so the prompt's "do not edit any file" is backed up by the config, not just a request.
Our example (VibeKits): a lead agent that uses the other two as subagents
{
"name": "ship-it",
"description": "Builds a small change, then has test-runner check it and docs-writer update the docs.",
"prompt": "file://./prompts/ship-it.md",
"tools": ["read", "write", "shell", "subagent/test-runner", "subagent/docs-writer"],
"permissions": {
"rules": [
{ "capability": "subagent", "match": ["test-runner", "docs-writer"], "effect": "allow" },
{ "capability": "shell", "match": ["npm test", "npm test *", "npx vitest run *", "git diff *", "git status"], "effect": "allow" },
{ "capability": "fs_write", "match": ["src/**", "tests/**", "docs/**", "README.md", "CHANGELOG.md"], "effect": "allow" },
{ "capability": "shell", "match": ["git push *", "rm -rf *", "sudo *"], "effect": "deny" },
{ "capability": "fs_write", "match": [".env*"], "effect": "deny" }
]
},
"resources": ["file://README.md", "file://.kiro/steering/**/*.md"]
}
You make one small change at a time.
1. Make the change the user asked for in src/ and tests/.
2. Ask the test-runner agent to run the tests. If it reports failures, fix them and ask it again. Stop after 3 tries and tell the user what is still failing.
3. When the tests pass, ask the docs-writer agent to update the docs for the change.
4. Finish with a short summary: files changed, test result, docs updated.
Three things make this work, all from Kiro's subagents page. subagent/test-runner and subagent/docs-writer in tools mean it can start only those two. There's no @builtin or *, because either one would let it start any agent. The subagent rule lets it start them without asking. And the test commands and docs paths are repeated in the lead agent's own rules, because in CLI V3 a subagent's allow only works when the parent session allows the same thing (more below). The 3-try limit is in the prompt because Kiro's docs don't describe a built-in retry cap for this kind of loop.
Our example (VibeKits): a global "explain this" agent for beginners
---
name: explain
description: Explains code in plain English for a beginner. Read-only. Use when I ask what a file, function or error means.
tools: ["read"]
---
Explain like I'm new to coding. Start with one sentence on what the code is for,
then walk through it in short steps. Define any jargon the first time you use it.
Don't suggest changes unless I ask.
Kiro subagents: how delegation works
A subagent is a custom agent (or one of Kiro's built-ins) that the main agent starts for one piece of work. It gets its own context window, its own tools and permissions, and it hands its findings back when it's done. Kiro picks one based on each agent's description, or you can name it: "Use the code-reviewer agent to check src/auth/ for security issues."
- Parallel: several subagents can run at once, for example refactoring three services at the same time.
- Task order: Kiro can plan a chain where later steps wait for earlier ones. The whole plan is set before anything starts and can't change mid-run.
- Review loops: a later step can send work back to an earlier one when its output contains a trigger word like
NEEDS_CHANGES, up to 1 to 10 times. A step can't loop to itself, and the trigger has to be at least four characters. - What it shares: steering files, MCP servers, workspace files and the permissions setup. What's separate: conversation history, context window, spec state and hook triggers.
- Watching them (CLI): press
Ctrl+Gto open the monitor,Ctrl+D/Ctrl+Uto move between subagents, andqto go back to your chat. - An orchestrator needs the tool: a custom agent can only hand off work if
subagent(orsubagent/name, or@builtin) is in itstools. - Files: a subagent with its own
file://resources loads those instead of the parent's. One with none gets the parent's.
Subagent permissions in CLI V3 and the IDE
This is the part that causes "why is it still asking me?" Kiro checks every subagent tool call against two policies, the parent session's (your permissions.yaml files, the parent agent's rules, and approvals you've already given) and the subagent's own. The stricter one wins:
| Situation | What happens |
|---|---|
Either side says deny | Blocked |
Either side says ask | You get a prompt |
| Subagent allows it, the parent has no rule for it | You get a prompt anyway |
| Both allow it | Runs without asking |
| Headless run (no one to answer) | Prompts are denied |
A subagent's own allow rules only count on their own when you run it as the main agent (kiro-cli chat --agent name). To make its calls quiet as a subagent, put the same allow rules in the parent agent's permissions, or in ~/.kiro/settings/permissions.yaml (every agent) or your workspace permissions.yaml. --trust-all-tools approves everything in that session except deny rules. To limit which subagents can be started, and start them without a prompt, Kiro's example is:
{
"tools": ["read", "write", "shell", "web", "subagent/reviewer", "subagent/tester"],
"permissions": {
"rules": [
{ "capability": "subagent", "match": ["reviewer", "tester"], "effect": "allow" }
]
}
}
CLI 2.x did this with toolsSettings.subagent (availableAgents and trustedAgents). CLI V3 ignores toolsSettings, and /upgrade-agent converts it. A converted trustedAgents entry only skips the "start this subagent?" prompt; it doesn't approve the subagent's tool calls.
{
"toolsSettings": {
"subagent": {
"availableAgents": ["reviewer", "tester", "docs-*"],
"trustedAgents": ["reviewer", "tester"]
}
}
}
Kiro custom agents vs steering, skills, and other tools' subagents
- Agents vs steering: steering is rules the agent reads. An agent file decides what it's allowed to do. "Write tests for every function" is steering; "may run
npm testwithout asking, may never rungit push" is an agent. - Agents vs skills: a skill is a recipe any agent can pick up. An agent is the worker. Give an agent skills with
skill://inresources. - Agents vs hooks: hooks run on events no matter which agent is active. Hooks inside an agent file only run with that agent, and only in the CLI.
- Kiro vs Claude Code subagents: Claude Code subagents are Markdown files in
.claude/agents/withnameanddescriptionrequired and tools listed by name, likeRead, Grep. Kiro's Markdown agents look similar, but the tool names (read,shell) and the separatepermissionsrules are Kiro's own. Kiro's docs don't describe importing Claude Code agents, so copy the prompt and rewrite the header. - Kiro vs Antigravity: Antigravity's custom agents live in
.agents/agents/. Same idea, different folder and fields.
Upgrading old agents (IDE 0.x and CLI 2.x)
IDE 0.x JSON agents keep working in IDE 1.0. CLI 2.x agents that still use allowedTools or toolsSettings without a permissions block are skipped by CLI V3 until you convert them. Run /upgrade-agent: it scans .kiro/agents/ and ~/.kiro/agents/, lists only the agents that need it, saves the original as <filename>.json.bak, and converts in place. It turns allowed and denied commands and write paths into permissions.rules, old tool names like fs_read and execute_bash into read and shell, and object-style hooks into a hooks array. /upgrade-agent diagnostics shows warnings afterwards. toolAliases and keyboardShortcut aren't part of the V3 format.
Kiro custom agent not working? 9 things to check
- Not in
/agent list. Check the folder (.kiro/agents/or~/.kiro/agents/) and that the file is readable. Project agents only load in a trusted workspace. - Broken JSON or YAML. A trailing comma or a missing quote stops it loading. Run it through a checker and compare with
/agent schema. - Shows in the CLI, not the IDE. Remove the
hooksfield; the IDE ignores agents that have one. Use.kiro/hooks/files instead. - An old CLI 2.x file. If it has
allowedToolsortoolsSettingsand nopermissions, CLI V3 skips it. Run/upgrade-agent. - The wrong copy loads. A project agent with the same name beats your global one.
- It still asks for permission.
toolsdoesn't pre-approve anything. Add anallowrule with the right capability name (fs_write, notwrite). As a subagent, the parent needs the same rule. /toolsis empty or short. Check spelling intoolsand the@server/toolform for MCP tools, and that the MCP server actually starts.- The first message fails. The
modelID isn't available to you. Pick one from/model. - It can't hand off work. Add
subagentorsubagent/nameto the lead agent'stools. An unknown subagent name fails instead of falling back to the default agent; check names withkiro-cli agent list.
Where Kiro's own docs disagree
- The troubleshooting page is behind. It still says to make sure the file "has a
.jsonextension" and to list tools in "bothtoolsandallowedTools". Markdown agents are supported, and CLI V3 usespermissions, notallowedTools. Follow the configuration reference. - Do subagents get the parent's context? The subagents page lists steering files as shared with the main agent. The configuration reference says a subagent with its own
file://resources loads those in place of the parent's. Both can be true for different kinds of files, but if a subagent seems to miss a file, list it in its ownresources. - Where
/agent createsaves. The creating page says agents go to the global folder when you don't pass--directory, but its own/agent createwalkthrough asks for a scope and shows "Local (current workspace)". Pass--directory workspaceorglobalto be sure. - Version numbers in the subagents page. A note about "V3 sessions with Workflows" says "Kiro CLI 2.34 or later", while everything around it is about CLI V3. Check
/settings featuresin your own install.
Related setups
Custom agents are one part of a Kiro setup. The others: steering files for your rules, skills for step-by-step jobs, hooks for automation, and AGENTS.md, which Kiro reads too. In other tools: Claude Code subagents and Antigravity subagents. Not sure what rules to give the agent? The free rules generator writes a starting AGENTS.md.
Best value
All 6 kits for $29 — or $20.30 with code WELCOME30 (through Nov 30)
Agents decide who does the work and what they're allowed to touch. The kits tell them what to build, step by step: a small game, a Discord bot, an email-triage agent, an MVP, or a cleanup of messy code.
Get all 6 kits for $29 → See what's in each kit
$29 instead of $48 for the six kits bought separately; WELCOME30 takes 30% off that at checkout ($20.30). Instant download from Gumroad. 7-day refund, no questions asked.
Related
- Kiro steering files (.kiro/steering, inclusion modes, AGENTS.md, examples)
- Kiro skills (SKILL.md, .kiro/skills, skills vs steering vs powers)
- Kiro hooks (.kiro/hooks JSON, every trigger, exit codes, examples)
- Kiro Crew (install, bots, steering, skills, Crew vs the IDE)
- Kiro specs (requirements.md, design.md, tasks.md, Quick Spec, examples)
- Claude Code subagents examples (7 copy-paste subagents)
- Google Antigravity subagents (custom agents, agents folder, examples)
- Plan mode guide (6 tools + 6 plan prompts)
- AGENTS.md examples (Kiro reads AGENTS.md as steering)
- Vibe coding security checklist (12 checks before you launch)
- Free rules file generator
Sources
- Kiro docs: Custom agents
- Kiro docs: Built-in agents
- Kiro docs: Creating custom agents
- Kiro docs: Agent configuration reference
- Kiro docs: Invoking as sub-agents
- Kiro docs: Agent examples
- Kiro docs: Troubleshooting custom agents
- Kiro docs: What's new in IDE 1.0, Agent config changes
- Kiro docs: Upgrading agent configs (CLI V3)
- Kiro docs: Slash commands (IDE)
Every field, folder, command and permission rule here was checked Nov 11, 2026 on Kiro's own docs. Kiro changes often, so the Custom agents pages in Kiro's docs win over this page. If something here no longer matches, tell us at [email protected].