kg.
A template is an agent declared with template = true. It does not generate a JSON file of its own. It exists only to be inherited by other agents.
That makes templates a good fit for shared concerns like:
- project-specific resources
- shared knowledge bases
- reusable shell permissions
- common MCP or tool configuration
A real template in this repo: project-resources
This repo already has a strong real-world example:
The local template is defined like this:
project-resourcesis reusable- it adds project context once
rustopts into it with a short local override- the template does not create its own generated agent file
Why this matters
Without templates, the easy path is copy-paste:- duplicate the same docs and knowledge in multiple agents
- tweak each agent separately
- slowly accumulate drift
rust agent intact while layering on project-specific docs and knowledge locally. That is a cleaner composition story than forking the whole agent.
What templates are good for
Templates work best when they represent one reusable concern. Good examples:- a project resource bundle
- a shared knowledge pack
- a read-only git shell policy
- a write-capable review workflow
Inspect the result
Use:rust inherits from both default and project-resources.
The useful point is not just that inheritance exists. It is that you can see exactly which source contributed which fields.
Templates and generated output
Templates do not generate standalone JSON files. Concrete agents that inherit from them still do. That meansproject-resources contributes configuration, but the generated output you care about is still:
.kiro/agents/project-resources.json.
Validation and confidence
Templates are easiest to trust when you inspect the result. Use:- what will generate?
- which files contributed to this agent?
- did my refactor change the final behavior?
Practical advice
- Keep templates focused on one concern.
- Prefer reusable context over duplicated agent bodies.
- Use templates to add shared project knowledge without forking global agents.
- Reach for
kg tree detailswhen you want to prove a template is doing what you think it is.