kiro-agents 1.15.4 → 2.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.
package/README.md CHANGED
@@ -78,7 +78,7 @@ Automatically installed alongside kiro-agents, this Power provides protocols (ag
78
78
  Protocols load only when needed, keeping your context clean. Base system uses just 1.35K tokens.
79
79
 
80
80
  **Your Agents, Your Files**
81
- Agents you create are saved as `.md` files in `.kiro/agents/`. Edit them like any document, version control them with git, reuse them across projects.
81
+ Agents you create are saved as `.md` files in `.kiro/kiro-agents/`. Edit them like any document, version control them with git, reuse them across projects.
82
82
 
83
83
  ## Documentation
84
84
 
@@ -28,7 +28,8 @@ var __dirname2 = dirname(__filename2);
28
28
  var STEERING_INSTALL_DIR = join(homedir(), ".kiro", "steering", "kiro-agents");
29
29
  var POWER_INSTALL_DIR = join(homedir(), ".kiro", "powers", "kiro-protocols");
30
30
  var POWER_INSTALLED_DIR = join(homedir(), ".kiro", "powers", "installed", "kiro-protocols");
31
- var REGISTRY_PATH = join(homedir(), ".kiro", "powers", "registry.json");
31
+ var INSTALLED_JSON_PATH = join(homedir(), ".kiro", "powers", "installed.json");
32
+ var USER_ADDED_JSON_PATH = join(homedir(), ".kiro", "powers", "registries", "user-added.json");
32
33
  var STEERING_FILES = [
33
34
  "aliases.md",
34
35
  "agents.md",
@@ -69,32 +70,6 @@ async function setReadOnly(filePath) {
69
70
  console.warn(`⚠️ Could not set read-only: ${filePath}`);
70
71
  }
71
72
  }
72
- async function extractPowerMetadata(powerMdPath) {
73
- const { readFile } = await import("fs/promises");
74
- const content = await readFile(powerMdPath, "utf-8");
75
- const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
76
- if (!frontmatterMatch || !frontmatterMatch[1]) {
77
- throw new Error("No frontmatter found in POWER.md");
78
- }
79
- const frontmatter = frontmatterMatch[1];
80
- const extractField = (pattern, defaultValue) => {
81
- const match = frontmatter.match(pattern);
82
- return match && match[1] ? match[1].trim() : defaultValue;
83
- };
84
- const extractKeywords = () => {
85
- const match = frontmatter.match(/^keywords:\s*\[(.*?)\]$/m);
86
- if (!match || !match[1])
87
- return [];
88
- return match[1].split(",").map((k) => k.trim().replace(/["']/g, ""));
89
- };
90
- return {
91
- name: extractField(/^name:\s*["']?([^"'\n]+)["']?$/m, "kiro-protocols"),
92
- displayName: extractField(/^displayName:\s*["']?([^"'\n]+)["']?$/m, "Kiro Protocols"),
93
- description: extractField(/^description:\s*["']?([^"'\n]+)["']?$/m, ""),
94
- keywords: extractKeywords(),
95
- author: extractField(/^author:\s*["']?([^"'\n]+)["']?$/m, "")
96
- };
97
- }
98
73
  async function copyRecursive(src, dest) {
99
74
  const { stat, readdir, mkdir, copyFile } = await import("fs/promises");
100
75
  const stats = await stat(src);
@@ -108,90 +83,73 @@ async function copyRecursive(src, dest) {
108
83
  await copyFile(src, dest);
109
84
  }
110
85
  }
111
- async function createSymbolicLinks() {
112
- const { readdir, mkdir, symlink, rm, stat } = await import("fs/promises");
113
- const { platform } = await import("os");
114
- let warningCount = 0;
86
+ async function installPowerFiles() {
87
+ const { readdir, mkdir, rm, stat, copyFile } = await import("fs/promises");
115
88
  if (existsSync(POWER_INSTALLED_DIR)) {
116
89
  await rm(POWER_INSTALLED_DIR, { recursive: true, force: true });
117
90
  }
118
91
  await mkdir(POWER_INSTALLED_DIR, { recursive: true });
119
92
  const entries = await readdir(POWER_INSTALL_DIR);
120
93
  for (const entry of entries) {
121
- const sourcePath = join(POWER_INSTALL_DIR, entry);
122
- const targetPath = join(POWER_INSTALLED_DIR, entry);
123
- try {
124
- const stats = await stat(sourcePath);
125
- const isDirectory = stats.isDirectory();
126
- if (platform() === "win32") {
127
- await symlink(sourcePath, targetPath, isDirectory ? "junction" : "file");
128
- } else {
129
- await symlink(sourcePath, targetPath);
130
- }
131
- console.log(`✅ Linked: ${entry}`);
132
- } catch (error) {
133
- try {
134
- await copyRecursive(sourcePath, targetPath);
135
- console.log(`\uD83D\uDCCB Copied: ${entry} (symlink not available)`);
136
- } catch (copyError) {
137
- console.warn(`⚠️ Could not link or copy ${entry}:`, error instanceof Error ? error.message : error);
138
- warningCount++;
94
+ if (entry === "icon.png")
95
+ continue;
96
+ const srcPath = join(POWER_INSTALL_DIR, entry);
97
+ const destPath = join(POWER_INSTALLED_DIR, entry);
98
+ const stats = await stat(srcPath);
99
+ if (stats.isDirectory()) {
100
+ await copyRecursive(srcPath, destPath);
101
+ const subEntries = await readdir(destPath);
102
+ for (const subEntry of subEntries) {
103
+ await setReadOnly(join(destPath, subEntry));
139
104
  }
105
+ } else {
106
+ await copyFile(srcPath, destPath);
107
+ await setReadOnly(destPath);
140
108
  }
109
+ console.log(`✅ Installed: ${entry}`);
141
110
  }
142
- return warningCount;
143
111
  }
144
- async function registerPowerInRegistry() {
112
+ async function registerPower() {
145
113
  const { readFile, writeFile, mkdir } = await import("fs/promises");
146
- const registryDir = dirname(REGISTRY_PATH);
147
- await mkdir(registryDir, { recursive: true });
148
- let registry;
149
- if (existsSync(REGISTRY_PATH)) {
150
- const content = await readFile(REGISTRY_PATH, "utf-8");
151
- registry = JSON.parse(content);
114
+ await mkdir(dirname(USER_ADDED_JSON_PATH), { recursive: true });
115
+ let installed;
116
+ if (existsSync(INSTALLED_JSON_PATH)) {
117
+ const content = await readFile(INSTALLED_JSON_PATH, "utf-8");
118
+ installed = JSON.parse(content);
119
+ } else {
120
+ installed = { version: "1.0.0", installedPowers: [], dismissedAutoInstalls: [] };
121
+ }
122
+ const alreadyInstalled = installed.installedPowers.some((p) => p.name === "kiro-protocols");
123
+ if (!alreadyInstalled) {
124
+ installed.installedPowers.push({ name: "kiro-protocols", registryId: "user-added" });
125
+ }
126
+ await writeFile(INSTALLED_JSON_PATH, JSON.stringify(installed, null, 2), "utf-8");
127
+ let userAdded;
128
+ if (existsSync(USER_ADDED_JSON_PATH)) {
129
+ const content = await readFile(USER_ADDED_JSON_PATH, "utf-8");
130
+ userAdded = JSON.parse(content);
152
131
  } else {
153
- registry = {
154
- version: "1.0.0",
155
- powers: {},
156
- repoSources: {},
157
- lastUpdated: new Date().toISOString()
158
- };
132
+ userAdded = { powers: [] };
159
133
  }
160
- const powerMdPath = join(POWER_INSTALL_DIR, "POWER.md");
161
- const metadata = await extractPowerMetadata(powerMdPath);
162
- const repoId = "local-kiro-protocols";
163
- registry.powers[metadata.name] = {
164
- name: metadata.name,
165
- displayName: metadata.displayName,
166
- description: metadata.description,
167
- mcpServers: [],
168
- author: metadata.author,
169
- keywords: metadata.keywords,
170
- installed: true,
171
- installedAt: new Date().toISOString(),
172
- installPath: POWER_INSTALLED_DIR,
134
+ const existingIdx = userAdded.powers.findIndex((p) => p.name === "kiro-protocols");
135
+ const entry = {
136
+ name: "kiro-protocols",
137
+ description: `Custom power from ${POWER_INSTALL_DIR}`,
173
138
  source: {
174
- type: "repo",
175
- repoId,
176
- repoName: POWER_INSTALL_DIR
177
- },
178
- sourcePath: POWER_INSTALL_DIR
179
- };
180
- registry.repoSources[repoId] = {
181
- name: POWER_INSTALL_DIR,
182
- type: "local",
183
- enabled: true,
184
- addedAt: new Date().toISOString(),
185
- path: POWER_INSTALL_DIR,
186
- lastSync: new Date().toISOString(),
187
- powerCount: 1
139
+ type: "local",
140
+ path: POWER_INSTALL_DIR
141
+ }
188
142
  };
189
- registry.lastUpdated = new Date().toISOString();
190
- await writeFile(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
143
+ if (existingIdx >= 0) {
144
+ userAdded.powers[existingIdx] = entry;
145
+ } else {
146
+ userAdded.powers.push(entry);
147
+ }
148
+ await writeFile(USER_ADDED_JSON_PATH, JSON.stringify(userAdded, null, 2), "utf-8");
191
149
  console.log("✅ Power registered in Kiro registry");
192
150
  return true;
193
151
  }
194
- async function installFile(relativePath, installDir, sourceDir) {
152
+ async function installFile(relativePath, installDir, sourceDir, readOnly = true) {
195
153
  const destPath = join(installDir, relativePath);
196
154
  if (existsSync(destPath)) {
197
155
  await setWritable(destPath);
@@ -202,13 +160,14 @@ async function installFile(relativePath, installDir, sourceDir) {
202
160
  const destDir = dirname(destPath);
203
161
  await mkdir(destDir, { recursive: true });
204
162
  await writeFile(destPath, content);
205
- await setReadOnly(destPath);
163
+ if (readOnly) {
164
+ await setReadOnly(destPath);
165
+ }
206
166
  console.log(`✅ Installed: ${relativePath}`);
207
167
  }
208
168
  async function install() {
209
169
  console.log(`\uD83D\uDE80 Installing kiro-agents system...
210
170
  `);
211
- let hasErrors = false;
212
171
  let hasWarnings = false;
213
172
  console.log("\uD83D\uDCC4 Installing steering files to ~/.kiro/steering/kiro-agents/");
214
173
  if (existsSync(STEERING_INSTALL_DIR)) {
@@ -220,45 +179,36 @@ async function install() {
220
179
  await installFile(file, STEERING_INSTALL_DIR, "dist");
221
180
  }
222
181
  console.log(`
223
- ⚡ Installing kiro-protocols power to ~/.kiro/powers/kiro-protocols/`);
182
+ ⚡ Installing kiro-protocols source to ~/.kiro/powers/kiro-protocols/`);
224
183
  if (existsSync(POWER_INSTALL_DIR)) {
225
- console.log("\uD83D\uDDD1️ Removing existing power installation...");
184
+ console.log("\uD83D\uDDD1️ Removing existing power source...");
226
185
  const { rmSync } = await import("fs");
227
186
  rmSync(POWER_INSTALL_DIR, { recursive: true, force: true });
228
187
  }
229
188
  for (const file of POWER_FILES) {
230
- await installFile(file, POWER_INSTALL_DIR, "power");
189
+ await installFile(file, POWER_INSTALL_DIR, "power", false);
231
190
  }
232
191
  console.log(`
233
- \uD83D\uDD17 Creating symbolic links in installed/ directory...`);
192
+ \uD83D\uDCCB Copying power files to ~/.kiro/powers/installed/kiro-protocols/`);
234
193
  try {
235
- const symlinkWarnings = await createSymbolicLinks();
236
- if (symlinkWarnings > 0) {
237
- hasWarnings = true;
238
- }
194
+ await installPowerFiles();
239
195
  } catch (error) {
240
- console.warn("⚠️ Warning: Could not create symbolic links:", error instanceof Error ? error.message : error);
196
+ console.warn("⚠️ Warning: Could not copy power files to installed/:", error instanceof Error ? error.message : error);
241
197
  console.warn(" Power may not appear correctly in Kiro Powers UI.");
242
198
  hasWarnings = true;
243
199
  }
244
200
  console.log(`
245
201
  \uD83D\uDCDD Registering power in Kiro registry...`);
246
202
  try {
247
- const registrySuccess = await registerPowerInRegistry();
248
- if (!registrySuccess) {
249
- hasWarnings = true;
250
- }
203
+ await registerPower();
251
204
  } catch (error) {
252
- console.warn("⚠️ Warning: Could not register power in registry:", error instanceof Error ? error.message : error);
205
+ console.warn("⚠️ Warning: Could not register power:", error instanceof Error ? error.message : error);
253
206
  console.warn(" The power files are installed but may not appear in Kiro Powers UI.");
254
- console.warn(" You can manually add the power via: Powers panel → Add Repository → Local Directory");
207
+ console.warn(" You can manually add the power via: Powers panel → Add Custom Power → Local Directory");
255
208
  console.warn(` Path: ${POWER_INSTALL_DIR}`);
256
209
  hasWarnings = true;
257
210
  }
258
- if (hasErrors) {
259
- console.log(`
260
- ❌ Installation completed with errors!`);
261
- } else if (hasWarnings) {
211
+ if (hasWarnings) {
262
212
  console.log(`
263
213
  ⚠️ Installation completed with warnings!`);
264
214
  console.log(" Core files installed successfully, but some optional features may not work.");
@@ -267,12 +217,11 @@ async function install() {
267
217
  ✨ Installation completed successfully!`);
268
218
  }
269
219
  console.log(`
270
- \uD83D\uDCC1 Steering files: ${STEERING_INSTALL_DIR}`);
271
- console.log(`\uD83D\uDCC1 Power files: ${POWER_INSTALL_DIR}`);
272
- console.log(`\uD83D\uDCC1 Installed links: ${POWER_INSTALLED_DIR}`);
220
+ \uD83D\uDCC1 Steering files: ${STEERING_INSTALL_DIR}`);
221
+ console.log(`\uD83D\uDCC1 Power source: ${POWER_INSTALL_DIR}`);
222
+ console.log(`\uD83D\uDCC1 Power installed: ${POWER_INSTALLED_DIR}`);
273
223
  console.log(`
274
224
  \uD83D\uDCA1 The kiro-protocols power should now appear as installed in Kiro Powers UI.`);
275
- console.log("\uD83D\uDCA1 Files are set to read-only. To modify them, change permissions first.");
276
225
  console.log(`
277
226
  \uD83D\uDD04 To update, simply run 'npx kiro-agents' again.`);
278
227
  }
@@ -40,7 +40,7 @@ When auto-setup detects no agents exist:
40
40
  /only-read-protocols agent-creation.md
41
41
  ```
42
42
 
43
- 2. **Create `.kiro/agents/kiro-master.md`** using the agent definition structure from agent-creation.md Step 3, with:
43
+ 2. **Create `.kiro/kiro-agents/kiro-master.md`** using the agent definition structure from agent-creation.md Step 3, with:
44
44
 
45
45
  **kiro-master** - Interactive Kiro feature management with CRUD operations for MCP servers, hooks, agents, specs, powers, and steering documents. Includes .kiro/ directory maintenance, steering optimization, refactoring, and comprehensive analysis capabilities
46
46
 
@@ -71,7 +71,7 @@ The agent activation command uses parameter substitution to load agent definitio
71
71
  You are now activating the **{agent_name}** agent.
72
72
 
73
73
  **Load and execute activation protocol:**
74
- 1. Read `.kiro/agents/{agent_name}.md` into context
74
+ 1. Read `.kiro/kiro-agents/{agent_name}.md` into context
75
75
  2. /only-read-protocols agent-activation.md
76
76
  3. Follow all steps from the "Agent Activation Steps" section in agent-activation.md protocol file
77
77
  4. Use `{agent_name}` as the agent identifier throughout the protocol
@@ -20,7 +20,7 @@ Enables reflection system for the currently active agent for this session.
20
20
 
21
21
  **Step 1: Check if agent has Reflections section**
22
22
 
23
- Read the agent definition file: `.kiro/agents/{agent-name}.md`
23
+ Read the agent definition file: `.kiro/kiro-agents/{agent-name}.md`
24
24
 
25
25
  **If agent already has `## Reflections` section:**
26
26
  - Load capture protocol: `/only-read-protocols reflect-agent-insights.md`
@@ -32,7 +32,7 @@ Read the agent definition file: `.kiro/agents/{agent-name}.md`
32
32
 
33
33
  **Step 2: Add Reflections section to agent file**
34
34
 
35
- Use `fsAppend` to add the following section to `.kiro/agents/{agent-name}.md`:
35
+ Use `fsAppend` to add the following section to `.kiro/kiro-agents/{agent-name}.md`:
36
36
 
37
37
  ````markdown
38
38
 
@@ -243,7 +243,7 @@ No initialization required! Files created automatically when:
243
243
 
244
244
  ## Learn More
245
245
 
246
- - **Curator Agent:** `.kiro/agents/reflection-curator.md`
246
+ - **Curator Agent:** `.kiro/kiro-agents/reflection-curator.md`
247
247
 
248
248
  ---
249
249
 
@@ -8,7 +8,7 @@ When activating agent `{agent_name}`:
8
8
 
9
9
  ### Step 1: Load Agent Definition and Strict Mode
10
10
 
11
- Read `.kiro/agents/{agent_name}.md` into context.
11
+ Read `.kiro/kiro-agents/{agent_name}.md` into context.
12
12
 
13
13
  This file contains:
14
14
  - Agent capabilities and responsibilities
@@ -49,7 +49,7 @@ If chit-chat.md is in context from a previous session, its patterns do not apply
49
49
  For this session, you are **{agent_name}**.
50
50
 
51
51
  You will:
52
- - Follow ALL protocols and instructions from `.kiro/agents/{agent_name}.md`
52
+ - Follow ALL protocols and instructions from `.kiro/kiro-agents/{agent_name}.md`
53
53
  - Apply agent-specific interaction patterns
54
54
  - Use capabilities defined in the agent definition
55
55
  - Maintain this role until user switches agents or ends session
@@ -328,7 +328,7 @@ Requirements:
328
328
  - Lowercase with hyphens (e.g., `refactor-architect`)
329
329
  - No spaces or special characters
330
330
  - Descriptive of agent's purpose
331
- - Must be unique (check `.kiro/agents/` directory)
331
+ - Must be unique (check `.kiro/kiro-agents/` directory)
332
332
 
333
333
  #### 2.3: Agent Description
334
334
 
@@ -487,7 +487,7 @@ Once confirmed, generate complete agent definition using the AI-analyzed capabil
487
487
 
488
488
  ## Step 3: Generate Agent Definition File
489
489
 
490
- Create `.kiro/agents/{agent-name}.md` with this structure:
490
+ Create `.kiro/kiro-agents/{agent-name}.md` with this structure:
491
491
 
492
492
  ```markdown
493
493
  ---
@@ -612,7 +612,7 @@ Show summary to user:
612
612
 
613
613
  **Agent Created:** `{agent-name}`
614
614
 
615
- **Location:** `.kiro/agents/{agent-name}.md`
615
+ **Location:** `.kiro/kiro-agents/{agent-name}.md`
616
616
 
617
617
  **Summary:**
618
618
  - Type: {type}
@@ -26,16 +26,16 @@ Begin with a diff block showing:
26
26
 
27
27
  ### Step 2: Scan Agents Directory
28
28
 
29
- **CRITICAL: You MUST execute `listDirectory` tool on `.kiro/agents/` to get the actual list of agents.**
29
+ **CRITICAL: You MUST execute `listDirectory` tool on `.kiro/kiro-agents/` to get the actual list of agents.**
30
30
 
31
31
  **DO NOT rely on open editor files or context - always scan the directory explicitly.**
32
32
 
33
- Execute `listDirectory` on `.kiro/agents/`:
33
+ Execute `listDirectory` on `.kiro/kiro-agents/`:
34
34
 
35
35
  **If directory doesn't exist OR directory is empty:**
36
36
  1. **Load agent creation protocol**:
37
37
  - Call `kiroPowers` with action="readSteering", powerName="kiro-protocols", steeringFile="agent-creation.md"
38
- 2. Create `.kiro/agents/kiro-master.md` agent automatically using the description from "Initial Agent" section
38
+ 2. Create `.kiro/kiro-agents/kiro-master.md` agent automatically using the description from "Initial Agent" section
39
39
  3. Follow the agent definition structure from agent-creation.md protocol
40
40
  4. Show diff block indicating setup completion
41
41
  5. Continue to Step 3 with kiro-master as available agent
@@ -58,7 +58,7 @@ Use this response structure:
58
58
 
59
59
  **Current Focus**: Agent selection and management
60
60
 
61
- **Available agents in `.kiro/agents/`:**
61
+ **Available agents in `.kiro/kiro-agents/`:**
62
62
 
63
63
  [List each agent with format:]
64
64
  - **{agent-name}** - {description from frontmatter or .md}
@@ -16,7 +16,7 @@ This protocol enables batch enablement of reflection system across multiple agen
16
16
  **Scan agent directory:**
17
17
 
18
18
  ```
19
- .kiro/agents/
19
+ .kiro/kiro-agents/
20
20
  ├── agent-1.md
21
21
  ├── agent-2.md
22
22
  ├── agent-3.md
@@ -107,7 +107,7 @@ For each selected agent:
107
107
  #### 5a. Read Agent Definition
108
108
 
109
109
  ```
110
- Read: .kiro/agents/{agent-name}.md
110
+ Read: .kiro/kiro-agents/{agent-name}.md
111
111
  ```
112
112
 
113
113
  #### 5b. Check Current State
@@ -166,9 +166,9 @@ Processed: {total} agents
166
166
  └─ Skipped: {skipped-count}
167
167
 
168
168
  Modified agent definitions:
169
- - .kiro/agents/{agent-1}.md
170
- - .kiro/agents/{agent-2}.md
171
- - .kiro/agents/{agent-3}.md
169
+ - .kiro/kiro-agents/{agent-1}.md
170
+ - .kiro/kiro-agents/{agent-2}.md
171
+ - .kiro/kiro-agents/{agent-3}.md
172
172
  ...
173
173
 
174
174
  Next steps:
@@ -142,7 +142,7 @@ ACTIVE_AGENT: none | {agent-name}
142
142
 
143
143
  **Agent activation:**
144
144
  - Triggered by `/agents {agent-name}` command
145
- - Loads `.kiro/agents/{agent-name}.md` into context
145
+ - Loads `.kiro/kiro-agents/{agent-name}.md` into context
146
146
  - Executes agent-activation protocol
147
147
  - Sets ACTIVE_AGENT = {agent-name}
148
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-agents",
3
- "version": "1.15.4",
3
+ "version": "2.0.0",
4
4
  "description": "Advanced AI agent system for Kiro IDE - Create specialized AI agents, switch interaction modes, and enhance development workflows with minimal cognitive overhead",
5
5
  "homepage": "https://github.com/Theadd/kiro-agents#readme",
6
6
  "repository": {