kiro-agents 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,512 @@
1
+ ---
2
+ inclusion: always
3
+ description: Generic agent activation system with instruction commands for seamless agent management
4
+ ---
5
+
6
+ # Agent System
7
+
8
+ Generic agent activation and management system for Kiro using instruction commands with parameter support.
9
+
10
+ ## Instruction Alias with Parameters
11
+
12
+ ### Parameter Substitution Protocol
13
+
14
+ When processing instructions, if you encounter an XML structure `<alias>` with variables in `{curly_braces}`:
15
+
16
+ ```xml
17
+ <alias>
18
+ <trigger>COMMAND {param1} {param2}</trigger>
19
+ <definition>
20
+ Instructions with {param1} and {param2} placeholders
21
+ </definition>
22
+ </alias>
23
+ ```
24
+
25
+ **Processing steps:**
26
+ 1. **Extract parameter names** from `<trigger>` (e.g., `{param1}`, `{param2}`)
27
+ 2. **Match user command** - When user types matching command pattern
28
+ 3. **Extract parameter values** - Capture actual values from user input
29
+ 4. **Replace placeholders** - Substitute all `{param}` in `<definition>` with actual values
30
+ 5. **Execute instructions** - Run resulting instructions immediately
31
+
32
+ ### Example
33
+
34
+ **Alias definition:**
35
+ ```xml
36
+ <alias>
37
+ <trigger>/greet {name}</trigger>
38
+ <definition>Say hello to {name} enthusiastically!</definition>
39
+ </alias>
40
+ ```
41
+
42
+ **User types:** `/greet Alice`
43
+ **System executes:** "Say hello to Alice enthusiastically!"
44
+
45
+ ## Agent Commands
46
+
47
+ ### Command 1: Activate Specific Agent
48
+
49
+ <alias>
50
+ <trigger>/agent {agent_name}</trigger>
51
+ <definition>
52
+ ## Agent Activation: {agent_name}
53
+
54
+ You are now activating the **{agent_name}** agent.
55
+
56
+ ### Step 1: Load Agent Definition and Strict Mode
57
+
58
+ Read `.kiro/agents/{agent_name}.md` into context.
59
+
60
+ This file contains:
61
+ - Agent capabilities and responsibilities
62
+ - Interaction protocols and workflows
63
+ - Mandatory protocols and rules
64
+ - Examples and best practices
65
+ - Integration requirements
66
+
67
+ **Also load `strict-mode.md` steering document** to enable `/strict {state}` command for this agent session. STRICT_MODE defaults to OFF but user can activate it anytime with `/strict on`.
68
+
69
+ ### Step 2: Assume Agent Role
70
+
71
+ For this session, you are **{agent_name}**.
72
+
73
+ You will:
74
+ - Follow ALL protocols and instructions from `.kiro/agents/{agent_name}.md`
75
+ - Apply agent-specific interaction patterns
76
+ - Use capabilities defined in the agent definition
77
+ - Maintain this role until user switches agents or ends session
78
+ - Override any conflicting instructions with agent protocols
79
+
80
+ ### Step 3: Begin Interaction
81
+
82
+ Start interaction according to **{agent_name}**'s protocols defined in the `.md` file.
83
+
84
+ If the agent uses **chit-chat mode**:
85
+ - Begin with diff block showing current state
86
+ - Provide numbered choice list (4-6 options, up to 16 if needed)
87
+ - Maintain single focus per message
88
+ - Use visual formatting (bold, code blocks)
89
+
90
+ Otherwise:
91
+ - Begin according to the agent's defined interaction protocol
92
+ - Follow agent-specific response structure
93
+ - Apply agent-specific formatting rules
94
+
95
+ ---
96
+
97
+ **You are now {agent_name}. Begin interaction.**
98
+ </definition>
99
+ </alias>
100
+
101
+ ### Command 2: Interactive Agent Management
102
+
103
+ <alias>
104
+ <trigger>/agents</trigger>
105
+ <definition>
106
+ ## Agent Management Mode
107
+
108
+ You are now in **agent management mode** using chit-chat interaction protocol.
109
+
110
+ ### Step 1: Load Chit-Chat Mode
111
+
112
+ Apply protocols from `chit-chat.md` steering document:
113
+ - Use diff blocks to show progress
114
+ - Provide numbered choice lists (4-6 options, up to 16 if needed)
115
+ - Maintain single focus per message
116
+ - Use visual formatting (bold, code blocks, lists)
117
+ - Optimize for ADHD-C (minimal cognitive load)
118
+
119
+ ### Step 2: Auto-Setup and Scan Agents Directory
120
+
121
+ **First, check if `.kiro/agents/` directory exists:**
122
+
123
+ If directory doesn't exist OR directory is empty:
124
+ 1. Create `.kiro/agents/` directory if missing
125
+ 2. Create `kiro-master.md` agent automatically using the enhanced description from "Available Agents" section
126
+ 3. Show diff block indicating setup completion
127
+ 4. Continue to Step 3 with kiro-master as available agent
128
+
129
+ If directory exists with agents:
130
+ - List all available agents from `.kiro/agents/` directory
131
+ - Find all `*.md` files
132
+ - Extract agent names from filenames
133
+ - Read frontmatter metadata for descriptions
134
+ - Categorize by agent type if metadata available
135
+
136
+ ### Step 3: Present Agent Selection
137
+
138
+ Use this response structure:
139
+
140
+ ```diff
141
+ 👉 Agent management mode
142
+ ⏳ Agent selection or management
143
+ ```
144
+
145
+ **Current Focus**: Agent selection and management
146
+
147
+ **Available agents in `.kiro/agents/`:**
148
+
149
+ [List each agent with format:]
150
+ - **{agent-name}** - {description from frontmatter or .md}
151
+
152
+ **What would you like to do?**
153
+
154
+ 1. **Activate agent** - Choose agent to activate immediately
155
+ 2. **Create new agent** - Start agent creation wizard
156
+ 3. **Manage existing agent** - Modify agent configuration
157
+ 4. **View agent details** - Show full agent definition
158
+ 5. **List all commands** - Show available slash commands
159
+ 6. **Agent system help** - Explain how agents work
160
+ 7. **Exit** - Return to normal mode
161
+
162
+ ### Step 4: Handle User Choice
163
+
164
+ Based on user selection:
165
+
166
+ **Option 1 - Activate agent:**
167
+ - Show numbered list of available agents
168
+ - User selects agent by number
169
+ - Execute `/agent {selected_agent_name}` command
170
+ - Agent activates immediately
171
+
172
+ **Option 2 - Create new agent:**
173
+ - Start agent creation workflow (similar to kiro-master)
174
+ - Ask for agent type (code-focused, documentation, testing, etc.)
175
+ - Collect agent name, description, capabilities
176
+ - Generate `.md` file with all agent definition
177
+ - Offer to activate new agent
178
+
179
+ **Option 3 - Manage existing agent:**
180
+ - Show numbered list of available agents
181
+ - User selects agent to manage
182
+ - Offer management options:
183
+ - Modify capabilities
184
+ - Update instructions
185
+ - Change interaction protocol
186
+ - Add/remove integrations
187
+ - Delete agent
188
+
189
+ **Option 4 - View agent details:**
190
+ - Show numbered list of available agents
191
+ - User selects agent to view
192
+ - Display full `.md` content with formatting
193
+ - Show agent protocols and capabilities summary
194
+ - Offer to activate or manage agent
195
+
196
+ **Option 5 - List all commands:**
197
+ - Show all available slash commands in the system
198
+ - Display command syntax and brief description
199
+ - Group by category (agents, modes, utilities)
200
+ - Format as table for quick reference:
201
+
202
+ ```
203
+ Available Commands:
204
+
205
+ AGENT COMMANDS
206
+ /agent {name} Activate specific agent
207
+ /agents Interactive agent management
208
+
209
+ MODE COMMANDS (see modes-system.md)
210
+ /mode {name} Switch Kiro mode (vibe/spec)
211
+ /modes Interactive mode management
212
+ /strict {state} Control strict mode (on/off)
213
+
214
+ Note: Commands are defined in steering documents.
215
+ New commands can be added via Instruction Alias pattern.
216
+ ```
217
+
218
+ **Option 6 - Agent system help:**
219
+ - Explain agent system architecture
220
+ - Show command usage examples
221
+ - Describe agent file structure
222
+ - Explain how to create custom agents
223
+ - Document best practices
224
+
225
+ **Option 7 - Exit:**
226
+ - Confirm exit from agent management mode
227
+ - Return to normal Kiro interaction
228
+ - Preserve any changes made
229
+
230
+ ### Step 5: Maintain Chit-Chat Mode
231
+
232
+ Continue using diff blocks and numbered choices throughout agent management session.
233
+
234
+ After each action:
235
+ - Update diff block with progress
236
+ - Show current focus
237
+ - Provide next action choices
238
+ - Allow going back or canceling
239
+
240
+ ---
241
+
242
+ **Begin agent management mode now.**
243
+ </definition>
244
+ </alias>
245
+
246
+ ## Agent Activation Protocol
247
+
248
+ When `/agent {name}` is executed:
249
+
250
+ 1. **Discover agent file**
251
+ - Check `.kiro/agents/{name}.md` exists
252
+ - If file missing, show error and suggest `/agents` command
253
+
254
+ 2. **Load agent definition**
255
+ - Read `.kiro/agents/{name}.md` into context
256
+ - **Load `strict-mode.md`** steering document (enables `/strict` commands)
257
+ - Parse frontmatter metadata
258
+ - Understand agent capabilities and workflows
259
+ - Identify mandatory protocols
260
+ - Note interaction patterns
261
+ - Check integration requirements
262
+
263
+ 3. **Apply protocols**
264
+ - Follow all mandatory protocols from definition
265
+ - Load required steering documents
266
+ - Apply agent-specific overrides
267
+ - Set up agent context
268
+
269
+ 4. **Assume role**
270
+ - Become the agent completely
271
+ - Maintain role until user switches agents
272
+ - Apply agent personality and style
273
+ - Use agent-specific tools and workflows
274
+
275
+ 5. **Begin interaction**
276
+ - Start according to agent's interaction protocol
277
+ - Use agent's response structure
278
+ - Apply agent's formatting rules
279
+ - Maintain agent's focus and priorities
280
+
281
+ ## Agent Management Protocol
282
+
283
+ When `/agents` is executed:
284
+
285
+ 1. **Activate chit-chat mode**
286
+ - Load chit-chat.md steering
287
+ - Use diff blocks for progress
288
+ - Provide numbered choices
289
+ - Maintain single focus
290
+
291
+ 2. **Scan agents directory**
292
+ - List all `.md` files in `.kiro/agents/`
293
+ - Exclude `.instructions.md` files
294
+ - Extract agent metadata
295
+ - Categorize agents by type
296
+
297
+ 3. **Present choices**
298
+ - Show available agents with descriptions
299
+ - Offer management operations
300
+ - Provide help and documentation
301
+ - Allow exit to normal mode
302
+
303
+ 4. **Handle operations**
304
+ - Agent activation → Execute `/agent {name}`
305
+ - Agent creation → Start creation wizard
306
+ - Agent management → Modify agent files
307
+ - Agent viewing → Display agent details
308
+ - Help → Explain agent system
309
+ - Exit → Return to normal mode
310
+
311
+ 5. **Maintain context**
312
+ - Use diff blocks to show progress
313
+ - Preserve user decisions
314
+ - Allow going back
315
+ - Enable canceling operations
316
+
317
+ ## Agent Directory Structure
318
+
319
+ ```
320
+ .kiro/agents/
321
+ └── {agent-name}.md # Complete agent definition
322
+ ├── Frontmatter metadata
323
+ ├── Core responsibilities
324
+ ├── Capabilities and workflows
325
+ ├── Interaction protocols
326
+ ├── Mandatory protocols
327
+ ├── Examples and best practices
328
+ ├── Integration rules
329
+ └── Conflict priorities
330
+ ```
331
+
332
+ ### Agent Definition File (.md)
333
+
334
+ **Required sections:**
335
+ - Frontmatter with name, type, metadata
336
+ - Core Responsibilities
337
+ - Capabilities (detailed list)
338
+ - Interaction Protocol (how agent responds)
339
+ - Mandatory Protocols (rules agent must follow)
340
+ - Workflows (step-by-step processes)
341
+ - Examples (interaction patterns)
342
+
343
+ **Recommended sections:**
344
+ - Best Practices
345
+ - Integration Points (with other agents/steering)
346
+ - Conflict Priorities (ordered list)
347
+ - Advanced Features
348
+ - Error Handling
349
+ - Success Metrics
350
+
351
+ ## Available Agents
352
+
353
+ Agents are discovered automatically from `.kiro/agents/` directory.
354
+
355
+ **Current agents:**
356
+ - **kiro-master** - Interactive Kiro feature management with CRUD operations for MCP servers, hooks, agents, specs, and steering documents. Includes .kiro/ directory maintenance, steering optimization, refactoring, and comprehensive analysis capabilities
357
+
358
+ ## Usage Examples
359
+
360
+ ### Activate Specific Agent
361
+
362
+ ```
363
+ /agent refactor-architect
364
+ ```
365
+
366
+ **Result:** AI immediately assumes refactor-architect role, loads agent files, applies protocols, and begins interaction according to agent's style.
367
+
368
+ ### Interactive Agent Management
369
+
370
+ ```
371
+ /agents
372
+ ```
373
+
374
+ **Result:** Chit-chat mode activates, shows available agents, offers management options with numbered choices.
375
+
376
+ ### Switch Between Agents
377
+
378
+ ```
379
+ /agent kiro-master
380
+ ```
381
+
382
+ **Result:** Switch from current agent (e.g., refactor-architect) to kiro-master. Previous agent context is suspended, new agent context is loaded.
383
+
384
+ ### Create New Agent
385
+
386
+ ```
387
+ /agents
388
+ [Choose option 2: Create new agent]
389
+ [Follow wizard prompts]
390
+ ```
391
+
392
+ **Result:** Interactive agent creation wizard guides through agent setup, generates files, offers activation.
393
+
394
+ ## Integration with Existing System
395
+
396
+ ### Compatibility
397
+
398
+ - **Works alongside steering documents** - Agents can load additional steering
399
+ - **Compatible with chit-chat mode** - Agents can use chit-chat protocols
400
+ - **Preserves ADHD-C optimizations** - Single focus, visual formatting maintained
401
+ - **Maintains language rules** - Spanish chat, English files
402
+ - **Respects user preferences** - Confirmation before changes, choice-based interaction
403
+ - **Mode system** - Works seamlessly with modes (see `modes-system.md`)
404
+ - **Context preservation** - File changes and conversation history persist across agent switches
405
+
406
+ ### Steering Document Loading
407
+
408
+ Agents can specify required steering documents in their `.md` definition file:
409
+
410
+ ```markdown
411
+ ## Integration Points
412
+
413
+ ### Required Steering Documents
414
+ - `[steering-name].md` - Always loaded when agent is active
415
+ - `[another-steering].md` - Core rules for agent behavior
416
+
417
+ ### Optional Steering Documents
418
+ - `[conditional-steering].md` - Loaded based on file context
419
+ - `[manual-steering].md` - Loaded when explicitly needed
420
+ ```
421
+
422
+ ### Agent Coordination
423
+
424
+ **Multiple agents can coordinate through:**
425
+ - **Handoff procedures** - Agent A passes control to Agent B
426
+ - **Context sharing** - Agents share relevant information
427
+ - **Conflict resolution** - Priority rules determine behavior
428
+ - **Collaborative workflows** - Agents work together on complex tasks
429
+
430
+ ## Best Practices
431
+
432
+ ### For Agent Users
433
+
434
+ 1. **Use `/agents` for discovery** - See what agents are available
435
+ 2. **Use `/agent {name}` for direct activation** - When you know which agent you need
436
+ 3. **Let agents maintain focus** - Don't switch agents mid-task unless necessary
437
+ 4. **Provide clear context** - Help agents understand your needs
438
+ 5. **Use agent capabilities** - Leverage agent-specific tools and workflows
439
+
440
+ ### For Agent Creators
441
+
442
+ 1. **Clear agent definition** - Comprehensive `.md` with all capabilities and protocols
443
+ 2. **Focused protocols** - Clear mandatory protocols section within `.md` file
444
+ 3. **Consistent interaction** - Follow established patterns (chit-chat mode, etc.)
445
+ 4. **Good examples** - Show how agent works in practice
446
+ 5. **Integration rules** - Specify required steering documents
447
+
448
+ ### For Agent Development
449
+
450
+ 1. **Start with template** - Use existing agents as reference
451
+ 2. **Test thoroughly** - Verify agent activates and functions correctly
452
+ 3. **Document well** - Clear descriptions and examples
453
+ 4. **Keep it simple** - Don't overcomplicate agent protocols
454
+ 5. **Iterate based on use** - Improve agent based on actual usage
455
+
456
+ ## Troubleshooting
457
+
458
+ ### Agent Not Activating
459
+
460
+ **Problem:** `/agent {name}` doesn't work
461
+ **Solutions:**
462
+ - Check agent files exist in `.kiro/agents/`
463
+ - Verify filename matches command (case-sensitive)
464
+ - Ensure `.md` file contains all required sections
465
+ - Try `/agents` to see available agents
466
+
467
+ ### Agent Behaving Incorrectly
468
+
469
+ **Problem:** Agent doesn't follow expected protocols
470
+ **Solutions:**
471
+ - Review agent `.md` file for clarity in Mandatory Protocols section
472
+ - Check for conflicting steering documents
473
+ - Verify mandatory protocols are clear and comprehensive
474
+ - Test agent in isolation
475
+
476
+ ### Agent Management Not Working
477
+
478
+ **Problem:** `/agents` command doesn't activate
479
+ **Solutions:**
480
+ - Verify `agent-system.md` is in `.kiro/steering/`
481
+ - Check `inclusion: always` in frontmatter
482
+ - Ensure `chit-chat.md` exists
483
+ - Try reloading steering documents
484
+
485
+ ## Future Enhancements
486
+
487
+ Potential improvements to agent system:
488
+
489
+ **Agent enhancements:**
490
+ - **Agent parameters** - `/agent refactor-architect --mode=strict`
491
+ - **Agent chaining** - `/agent kiro-master then refactor-architect`
492
+ - **Agent templates** - Quick agent creation from templates
493
+ - **Agent marketplace** - Share agents with community
494
+ - **Agent versioning** - Track agent changes over time
495
+ - **Agent testing** - Automated agent validation
496
+
497
+ **Integration enhancements:**
498
+ - **Task sessions** - Agents create sub-tasks with own context
499
+ - **Session continuation** - Resume interrupted work with full context
500
+ - **Enhanced mode integration** - Better coordination with modes system
501
+
502
+ ## Notes
503
+
504
+ - This system is a **prototype** - Kiro doesn't natively support agents
505
+ - Commands are implemented via **Instruction Alias pattern**
506
+ - System relies on **AI understanding and following instructions**
507
+ - May need **iteration based on actual usage**
508
+ - Consider **proposing as Kiro feature request** if successful
509
+
510
+ ---
511
+
512
+ **Agent system ready. Use `/agents` to begin or `/agent {name}` to activate specific agent.**