agentsys 5.2.1 → 5.3.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,400 @@
1
+ # Learning Guide: Kiro Supervised Mode, Autopilot Mode, and Approval Workflows
2
+
3
+ **Generated**: 2026-03-02
4
+ **Sources**: 6 resources analyzed
5
+ **Depth**: brief
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ - Familiarity with Kiro IDE or CLI (see kiro-cli-agentic-files-settings.md for overview)
12
+ - Understanding of AI-assisted code generation concepts
13
+ - Knowledge of version control and code diffs
14
+ - Basic understanding of file editing workflows
15
+
16
+ ## TL;DR
17
+
18
+ - **Autopilot Mode (default)**: Kiro executes tasks autonomously without approval; you can view diffs, revert changes, or interrupt, but edits proceed immediately
19
+ - **Supervised Mode**: Kiro pauses after each turn with file edits, presenting changes as reviewable hunks; you accept/reject/discuss individual sections before proceeding
20
+ - **File Edit Approval**: Presented as granular hunks per file; you can accept all, reject all, or approve specific sections
21
+ - **Command Execution**: Treated separately from file edits; commands run without approval in both modes but can be viewed in execution logs
22
+ - **Mode Switching**: Can switch between modes mid-session via IDE settings or CLI session context
23
+ - **Agent Behavior**: Mode choice affects how agents approach task decomposition and decision-making; supervised mode encourages smaller, reviewable steps
24
+
25
+ ---
26
+
27
+ ## Core Concepts
28
+
29
+ ### Autopilot Mode (Default Behavior)
30
+
31
+ Autopilot is Kiro's default operating mode, designed for speed and autonomy.
32
+
33
+ **Characteristics:**
34
+ - Agent executes tasks end-to-end without requesting approval
35
+ - Creates and modifies files across multiple locations in the codebase
36
+ - Runs shell commands as needed
37
+ - Makes architectural decisions and trade-offs independently
38
+ - Completes the workflow in a single or minimal number of turns
39
+
40
+ **User Control Points:**
41
+ - View diffs before changes are written to disk (read-only inspection)
42
+ - Revert all changes with one command if needed
43
+ - Interrupt execution mid-task
44
+ - Modify the task prompt and restart
45
+
46
+ **When Code is Modified:**
47
+ Files are written to disk immediately upon agent completion. There is no intermediate approval gate; the agent's turn completes and changes persist.
48
+
49
+ **Agent Reasoning:**
50
+ In autopilot mode, agents typically plan comprehensive solutions and execute them with confidence, knowing they can iterate if issues arise. This leads to faster task completion but less granular control over intermediate decisions.
51
+
52
+ *Source: kiro.dev/docs/chat/autopilot*
53
+
54
+ ### Supervised Mode (Approval-Required Behavior)
55
+
56
+ Supervised mode requires human review and approval for any file edits before they become permanent.
57
+
58
+ **Characteristics:**
59
+ - Agent completes a turn (thinking, planning, proposing edits)
60
+ - Yields control to the user with proposed file changes
61
+ - Changes are presented as individual hunks (contiguous blocks of edits within a file)
62
+ - User reviews and approves/rejects changes before persistence
63
+ - Agent does not proceed until explicit approval or rejection
64
+
65
+ **User Actions:**
66
+ - Accept all changes for the turn
67
+ - Reject all changes for the turn
68
+ - Accept individual hunks within a file
69
+ - Reject individual hunks within a file
70
+ - Request discussion or clarification on specific changes
71
+ - Modify a rejection reason and ask agent to revise
72
+
73
+ **File Edit Flow:**
74
+ ```
75
+ Agent proposes edits → Kiro pauses → User reviews hunks →
76
+ [Accept/Reject per hunk] → Changes persist (if approved) →
77
+ Agent continues or cycle repeats
78
+ ```
79
+
80
+ **Command Execution in Supervised Mode:**
81
+ Commands (shell invocations) are still executed in supervised mode; they are not subject to approval. However, command output is logged and visible in the execution history, allowing the user to understand what the agent did.
82
+
83
+ **Agent Reasoning:**
84
+ In supervised mode, agents tend to approach problems more cautiously, proposing smaller, reviewable chunks of work. They may break a task into more steps, making their reasoning transparent and easier to verify.
85
+
86
+ *Source: kiro.dev/docs/chat*
87
+
88
+ ---
89
+
90
+ ## File Edit Approval Details
91
+
92
+ ### Hunk-Based Review
93
+
94
+ File edits in supervised mode are grouped into **hunks** - contiguous blocks of changes within a single file.
95
+
96
+ **Hunk Structure:**
97
+ - File path and filename
98
+ - Line range affected (e.g., lines 45-62)
99
+ - Context lines (surrounding unchanged code for orientation)
100
+ - Proposed changes (insertions, deletions, modifications)
101
+ - Diff format (similar to `git diff` or unified diff format)
102
+
103
+ **Hunk Approval Options:**
104
+ 1. **Accept this hunk** - Approve the specific change block
105
+ 2. **Reject this hunk** - Decline the change; propose alternative in next turn
106
+ 3. **Modify and discuss** - Ask agent to adjust the hunk before approval
107
+ 4. **Accept all remaining** - Approve all hunks in this turn
108
+ 5. **Reject all remaining** - Decline all hunks in this turn
109
+
110
+ ### Per-File Review Workflow
111
+
112
+ Kiro presents changes organized by file:
113
+
114
+ ```
115
+ File: src/api/routes.ts
116
+ ├─ Hunk 1 (lines 12-28): Add new route handler
117
+ │ [Accept] [Reject] [Discuss]
118
+ ├─ Hunk 2 (lines 45-51): Update imports
119
+ │ [Accept] [Reject] [Discuss]
120
+ └─ Hunk 3 (lines 89-94): Fix type annotations
121
+ [Accept] [Reject] [Discuss]
122
+
123
+ File: src/api/types.ts
124
+ └─ Hunk 1 (lines 3-15): Define new interface
125
+ [Accept] [Reject] [Discuss]
126
+ ```
127
+
128
+ ### Partial Approval
129
+
130
+ You are not required to approve all hunks in a turn. Mixed approval is supported:
131
+
132
+ - Accept hunks 1 and 3 of file A
133
+ - Reject hunk 2 of file A
134
+ - Accept all hunks of file B
135
+
136
+ Rejected hunks are not written to disk. The agent can then be asked to revise them in the next turn.
137
+
138
+ ### Acceptance Persistence
139
+
140
+ Once a hunk is accepted, it is immediately written to the target file. Rejected hunks do not affect the file. The agent sees the rejection and can propose a different approach in its next response.
141
+
142
+ *Source: kiro.dev/docs/chat, synthesized from supervised mode documentation*
143
+
144
+ ---
145
+
146
+ ## Command Execution Approval
147
+
148
+ ### Shell Command Execution
149
+
150
+ Commands executed via the `execute_bash` or `execute_shell` tool are not subject to approval in either mode (autopilot or supervised).
151
+
152
+ **Execution Behavior:**
153
+ - Agent decides when to run commands
154
+ - Commands execute immediately when invoked
155
+ - Output is captured and shown to the user
156
+ - No pre-execution approval is required
157
+
158
+ **Rationale:**
159
+ Commands are typically read-only operations (file listing, dependency checks, test runs) or setup steps (installing dependencies, creating directories). Blocking on every command would create excessive friction. Dangerous operations (deletes, force pushes) are typically not attempted by agents without explicit user direction.
160
+
161
+ ### Logging and Observability
162
+
163
+ Command execution details are logged in the session history:
164
+
165
+ - **Command text** - Exact shell command executed
166
+ - **Exit code** - Return status (0 = success, non-zero = failure)
167
+ - **STDOUT** - Standard output (typically long)
168
+ - **STDERR** - Standard error output (if any)
169
+ - **Duration** - How long the command took
170
+
171
+ Users can review these logs to understand what the agent did and catch unintended side effects (e.g., a command that created files outside the intended directory).
172
+
173
+ ### Command Hooks (Advanced)
174
+
175
+ If you need to intercept or block certain commands, you can use Kiro Hooks with `PreToolUse` event type to validate commands before execution. A hook can return exit code 2 to block the tool invocation.
176
+
177
+ *Source: kiro.dev/docs/chat, kiro.dev/docs/hooks*
178
+
179
+ ---
180
+
181
+ ## Switching Modes Mid-Session
182
+
183
+ ### IDE Mode Switching
184
+
185
+ In the Kiro IDE, you can switch between autopilot and supervised modes during a session.
186
+
187
+ **Steps:**
188
+ 1. Open Settings (`Cmd+,` on Mac / `Ctrl+,` on Windows/Linux)
189
+ 2. Search for "Autopilot" or "Approval"
190
+ 3. Toggle the **Autopilot Toggle** setting
191
+ 4. The change takes effect immediately for the next agent response
192
+
193
+ **Persistence:**
194
+ The mode selection is stored in IDE settings and persists across sessions.
195
+
196
+ ### CLI Mode Switching
197
+
198
+ The Kiro CLI does not have built-in supervised mode toggle in the same way as the IDE. However, you can:
199
+
200
+ 1. **Start a new session** in the opposite mode (manual restart)
201
+ 2. **Use hooks** to add approval-like behavior for specific tools
202
+ 3. **Use custom agents** with different configurations
203
+
204
+ For CLI users wanting approval workflows, the recommended approach is to use hooks that validate tool invocations before execution.
205
+
206
+ ### Mid-Session Behavior
207
+
208
+ If you switch from **autopilot to supervised** mid-session:
209
+ - The next agent turn will pause for approval instead of auto-executing
210
+ - Previous turns' changes remain in place (already persisted)
211
+ - You start seeing approval prompts for hunks going forward
212
+
213
+ If you switch from **supervised to autopilot** mid-session:
214
+ - The next agent turn will auto-execute without pausing for approval
215
+ - No retroactive approval is requested for prior edits
216
+ - You lose granular control for subsequent turns
217
+
218
+ ### Recommendation
219
+
220
+ Most users do not switch modes mid-session because they have different workflows:
221
+ - **Autopilot**: For prototyping, familiar codebases, rapid iteration
222
+ - **Supervised**: For learning, critical systems, code review workflows
223
+
224
+ Switching reflects a change in your comfort level with the agent's decisions.
225
+
226
+ *Source: kiro.dev/docs/chat, kiro.dev/docs/getting-started*
227
+
228
+ ---
229
+
230
+ ## How Modes Affect Agent Behavior
231
+
232
+ ### Autopilot Agent Strategy
233
+
234
+ In autopilot mode, agents:
235
+
236
+ - **Plan comprehensively** - Think through multi-step solutions before acting
237
+ - **Execute decisively** - Make design choices without hesitation
238
+ - **Batch operations** - Group related changes to minimize turns
239
+ - **Assume trust** - Proceed with confidence that you'll catch issues in review
240
+ - **Iterate externally** - If a turn doesn't work, iterate based on user feedback in the next turn
241
+
242
+ **Example Flow (Autopilot):**
243
+ ```
244
+ User: "Add user authentication to the API"
245
+
246
+ Agent [Turn 1]:
247
+ - Analyzes codebase architecture
248
+ - Designs auth strategy
249
+ - Implements middleware, routes, types
250
+ - Updates package.json
251
+ - Writes all changes to disk
252
+ - Reports completion
253
+
254
+ User: Views diffs, runs tests, decides if satisfied
255
+ ```
256
+
257
+ ### Supervised Agent Strategy
258
+
259
+ In supervised mode, agents:
260
+
261
+ - **Break down tasks** - Decompose into smaller, reviewable steps
262
+ - **Explain reasoning** - Provide context for each change
263
+ - **Request micro-approvals** - After each turn, pause for review
264
+ - **Adapt to feedback** - Respond to rejected hunks with revisions
265
+ - **Build incrementally** - Let user guide direction through approvals
266
+
267
+ **Example Flow (Supervised):**
268
+ ```
269
+ User: "Add user authentication to the API"
270
+
271
+ Agent [Turn 1]:
272
+ - Proposes auth middleware structure
273
+ - Shows hunk for new middleware file
274
+
275
+ User: Reviews, accepts hunk
276
+
277
+ Agent [Turn 2]:
278
+ - Proposes route definitions
279
+ - Shows hunks for new routes
280
+
281
+ User: Reviews, accepts some hunks, rejects others
282
+
283
+ Agent [Turn 3]:
284
+ - Revises rejected hunks based on feedback
285
+ - Shows updated route definitions
286
+
287
+ [Cycle continues until complete...]
288
+ ```
289
+
290
+ ### Tool Usage Differences
291
+
292
+ **Autopilot Mode:**
293
+ - Uses more tools per turn
294
+ - Chains operations (read, analyze, write, test)
295
+ - Makes independent decisions about which files to modify
296
+
297
+ **Supervised Mode:**
298
+ - Typically uses fewer tools per turn
299
+ - Focuses on single concerns (e.g., "update this file type")
300
+ - Waits for user approval before deciding next steps
301
+
302
+ ### Architectural Decision-Making
303
+
304
+ **Autopilot:**
305
+ - Agent might choose between multiple architectural patterns and implement the one it judges best
306
+ - Trade-offs are made implicitly (e.g., choosing Zod over Joi for validation)
307
+
308
+ **Supervised:**
309
+ - Agent might ask for direction on architectural choices
310
+ - Presents alternatives and waits for user input
311
+ - Reduces risk of committing to the wrong approach
312
+
313
+ *Source: synthesized from kiro.dev/docs/chat, mode documentation, and user workflow guides*
314
+
315
+ ---
316
+
317
+ ## Common Pitfalls
318
+
319
+ | Pitfall | Why It Happens | How to Avoid |
320
+ |---------|---------------|--------------|
321
+ | Not realizing changes auto-persist in autopilot | Expectation of approval before changes are written | Use supervised mode if you want review before persistence; always check diffs before agent finishes |
322
+ | Command execution surprises | Commands run without approval; unexpected side effects occur | Review command output carefully; use hooks to validate dangerous commands; keep commands simple |
323
+ | Mode confusion between IDE and CLI | IDE has clear toggle; CLI doesn't expose mode selection | For CLI, understand that supervised mode requires hooks or external tooling; use IDE for approval workflows |
324
+ | Partial approval deadlock | User rejects all hunks, agent re-proposes identical changes | Provide clear feedback on why hunks were rejected; ask agent to revise approach, not just the code |
325
+ | Missing mid-session mode switch awareness | User switches to supervised mode expecting retrospective approval | Understand that retroactive approval isn't possible; switching only affects future turns |
326
+ | Approval workflow slowing down development | Over-reliance on hunk-by-hunk approval for simple changes | Use autopilot for trusted tasks; reserve supervised mode for high-risk changes |
327
+
328
+ ---
329
+
330
+ ## Best Practices
331
+
332
+ ### Choosing Modes
333
+
334
+ 1. **Start in supervised mode if:**
335
+ - You're learning Kiro
336
+ - Working on unfamiliar or critical code
337
+ - Building features with undefined requirements
338
+ - Team code review is a requirement
339
+
340
+ 2. **Use autopilot mode if:**
341
+ - You have high confidence in the agent
342
+ - Working on a familiar codebase
343
+ - Speed is the priority
344
+ - Changes are low-risk (new feature, not core logic)
345
+
346
+ 3. **Hybrid approach:**
347
+ - Use supervised mode for architectural decisions
348
+ - Switch to autopilot for implementation details once direction is set
349
+ - Use supervised mode again for integration and testing phases
350
+
351
+ ### File Approval Workflow
352
+
353
+ 4. **Always review hunks in context:**
354
+ - Don't accept hunks without reading the surrounding code
355
+ - Use the diff view to understand the change
356
+ - Spot-check for subtle bugs (off-by-one errors, missing nullchecks)
357
+
358
+ 5. **Provide clear rejection feedback:**
359
+ - Don't just reject; explain why (e.g., "This violates our naming convention" vs just "No")
360
+ - Suggest the alternative you want
361
+ - Reference your project's steering files if available
362
+
363
+ 6. **Use Accept All selectively:**
364
+ - Only for low-risk changes or when you've already approved similar hunks
365
+ - Prefer granular approval on first exposure to agent's code
366
+
367
+ ### Agent Behavior Optimization
368
+
369
+ 7. **Prime the agent for supervised mode:**
370
+ - When starting supervised session, mention it explicitly: "Review carefully before proceeding"
371
+ - Break down complex requirements into phases
372
+
373
+ 8. **Understand command context:**
374
+ - Commands are not subject to approval; log them for your review
375
+ - If a command fails, the agent will attempt recovery
376
+ - Dangerous operations should be scoped in steering files
377
+
378
+ 9. **Combine modes with steering:**
379
+ - Use `.kiro/steering/` files to define approval criteria (e.g., "all API changes require explicit approval")
380
+ - Supervised mode respects steering; agent will pause at critical areas
381
+
382
+ *Source: synthesized from kiro.dev documentation and best practices guides*
383
+
384
+ ---
385
+
386
+ ## Further Reading
387
+
388
+ | Resource | Type | Why Recommended |
389
+ |----------|------|-----------------|
390
+ | [kiro.dev/docs/chat](https://kiro.dev/docs/chat/) | Official Docs | Comprehensive chat modes documentation |
391
+ | [kiro.dev/docs/chat/autopilot](https://kiro.dev/docs/chat/autopilot/) | Official Docs | Autopilot mode details and controls |
392
+ | [kiro.dev/docs/chat/vibe](https://kiro.dev/docs/chat/vibe/) | Official Docs | Vibe mode (creative mode) paired with autopilot/supervised |
393
+ | [kiro.dev/docs/steering](https://kiro.dev/docs/steering/) | Official Docs | Steering files for guiding agent behavior |
394
+ | [kiro.dev/docs/hooks](https://kiro.dev/docs/hooks/) | Official Docs | Hooks for approval-like workflows in CLI |
395
+ | [kiro.dev/docs/specs](https://kiro.dev/docs/specs/) | Official Docs | Specs as complement to supervised mode workflows |
396
+ | [Kiro IDE Getting Started](https://kiro.dev/docs/getting-started/first-project/) | Tutorial | Hands-on walkthrough using IDE modes |
397
+
398
+ ---
399
+
400
+ *This guide was synthesized from 6 primary sources including official Kiro documentation and architectural references. See `resources/kiro-supervised-autopilot-sources.json` for the full source list with quality scores.*