kiro-memory 1.2.0 → 1.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-memory",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Persistent cross-session memory for Kiro CLI. Automatically tracks context, observations, and summaries across coding sessions.",
5
5
  "keywords": [
6
6
  "kiro",
@@ -1082,7 +1082,7 @@ function createContextKit(config) {
1082
1082
 
1083
1083
  // src/cli/contextkit.ts
1084
1084
  import { execSync } from "child_process";
1085
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync, copyFileSync } from "fs";
1085
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync } from "fs";
1086
1086
  import { join as join3, dirname as dirname2 } from "path";
1087
1087
  import { homedir as homedir3, platform, release } from "os";
1088
1088
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -1091,7 +1091,53 @@ var command = args[0];
1091
1091
  var __filename = fileURLToPath2(import.meta.url);
1092
1092
  var __dirname2 = dirname2(__filename);
1093
1093
  var DIST_DIR = dirname2(__dirname2);
1094
- var PROJECT_ROOT = dirname2(dirname2(DIST_DIR));
1094
+ var AGENT_TEMPLATE = JSON.stringify({
1095
+ name: "contextkit-memory",
1096
+ description: "Agent with persistent cross-session memory. Uses ContextKit to remember context from previous sessions and automatically save what it learns.",
1097
+ model: "claude-sonnet-4",
1098
+ tools: ["read", "write", "shell", "glob", "grep", "web_search", "web_fetch", "@contextkit"],
1099
+ mcpServers: {
1100
+ contextkit: {
1101
+ command: "node",
1102
+ args: ["__DIST_DIR__/servers/mcp-server.js"]
1103
+ }
1104
+ },
1105
+ hooks: {
1106
+ agentSpawn: [{ command: "node __DIST_DIR__/hooks/agentSpawn.js", timeout_ms: 1e4 }],
1107
+ userPromptSubmit: [{ command: "node __DIST_DIR__/hooks/userPromptSubmit.js", timeout_ms: 5e3 }],
1108
+ postToolUse: [{ command: "node __DIST_DIR__/hooks/postToolUse.js", matcher: "*", timeout_ms: 5e3 }],
1109
+ stop: [{ command: "node __DIST_DIR__/hooks/stop.js", timeout_ms: 1e4 }]
1110
+ },
1111
+ resources: ["file://.kiro/steering/contextkit.md"]
1112
+ }, null, 2);
1113
+ var STEERING_CONTENT = `# ContextKit - Persistent Memory
1114
+
1115
+ You have access to ContextKit, a persistent cross-session memory system.
1116
+
1117
+ ## Available MCP Tools
1118
+
1119
+ ### @contextkit/search
1120
+ Search previous session memory. Use when:
1121
+ - The user mentions past work
1122
+ - You need context on previous decisions
1123
+ - You want to check if a problem was already addressed
1124
+
1125
+ ### @contextkit/get_context
1126
+ Retrieve recent context for the current project. Use at the start of complex tasks to understand what was done before.
1127
+
1128
+ ### @contextkit/timeline
1129
+ Show chronological context around an observation. Use to understand the sequence of events.
1130
+
1131
+ ### @contextkit/get_observations
1132
+ Retrieve full details of specific observations. Use after \`search\` to drill down.
1133
+
1134
+ ## Behavior
1135
+
1136
+ - Previous session context is automatically injected at startup
1137
+ - Your actions (files written, commands run) are tracked automatically
1138
+ - A summary is generated at the end of each session
1139
+ - No manual saving needed: the system is fully automatic
1140
+ `;
1095
1141
  function isWSL() {
1096
1142
  try {
1097
1143
  const rel = release().toLowerCase();
@@ -1113,43 +1159,46 @@ function commandExists(cmd) {
1113
1159
  return false;
1114
1160
  }
1115
1161
  }
1162
+ function isWindowsPath(p) {
1163
+ return p.startsWith("/mnt/c") || p.startsWith("/mnt/d") || /^[A-Za-z]:[\\\/]/.test(p);
1164
+ }
1116
1165
  function runEnvironmentChecks() {
1117
1166
  const checks = [];
1118
1167
  const wsl = isWSL();
1119
1168
  const os = platform();
1120
1169
  checks.push({
1121
- name: "Sistema operativo",
1170
+ name: "Operating system",
1122
1171
  ok: os === "linux" || os === "darwin",
1123
- message: os === "linux" ? wsl ? "Linux (WSL)" : "Linux" : os === "darwin" ? "macOS" : `${os} (non supportato ufficialmente)`
1172
+ message: os === "linux" ? wsl ? "Linux (WSL)" : "Linux" : os === "darwin" ? "macOS" : `${os} (not officially supported)`
1124
1173
  });
1125
1174
  if (wsl) {
1126
1175
  const nodePath = process.execPath;
1127
- const nodeOnWindows = nodePath.startsWith("/mnt/c") || nodePath.startsWith("/mnt/d");
1176
+ const nodeOnWindows = isWindowsPath(nodePath);
1128
1177
  checks.push({
1129
- name: "WSL: Node.js nativo",
1178
+ name: "WSL: Native Node.js",
1130
1179
  ok: !nodeOnWindows,
1131
- message: nodeOnWindows ? `Node.js punta a Windows: ${nodePath}` : `Node.js nativo Linux: ${nodePath}`,
1132
- fix: nodeOnWindows ? "Installa Node.js dentro WSL:\n curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -\n sudo apt-get install -y nodejs\n Oppure usa nvm: https://github.com/nvm-sh/nvm" : void 0
1180
+ message: nodeOnWindows ? `Node.js points to Windows: ${nodePath}` : `Native Linux Node.js: ${nodePath}`,
1181
+ fix: nodeOnWindows ? "Install Node.js inside WSL:\n curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -\n sudo apt-get install -y nodejs\n Or use nvm: https://github.com/nvm-sh/nvm" : void 0
1133
1182
  });
1134
1183
  try {
1135
1184
  const npmPrefix = execSync("npm prefix -g", { encoding: "utf8" }).trim();
1136
- const prefixOnWindows = npmPrefix.startsWith("/mnt/c") || npmPrefix.startsWith("/mnt/d");
1185
+ const prefixOnWindows = isWindowsPath(npmPrefix);
1137
1186
  checks.push({
1138
1187
  name: "WSL: npm global prefix",
1139
1188
  ok: !prefixOnWindows,
1140
- message: prefixOnWindows ? `npm global prefix punta a Windows: ${npmPrefix}` : `npm global prefix: ${npmPrefix}`,
1141
- fix: prefixOnWindows ? `Correggi il prefix npm:
1189
+ message: prefixOnWindows ? `npm global prefix points to Windows: ${npmPrefix}` : `npm global prefix: ${npmPrefix}`,
1190
+ fix: prefixOnWindows ? `Fix npm prefix:
1142
1191
  mkdir -p ~/.npm-global
1143
1192
  npm config set prefix ~/.npm-global
1144
1193
  echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
1145
1194
  source ~/.bashrc
1146
- Poi reinstalla: npm install -g kiro-memory` : void 0
1195
+ Then reinstall: npm install -g kiro-memory` : void 0
1147
1196
  });
1148
1197
  } catch {
1149
1198
  checks.push({
1150
1199
  name: "WSL: npm global prefix",
1151
1200
  ok: false,
1152
- message: "Impossibile determinare npm prefix"
1201
+ message: "Unable to determine npm prefix"
1153
1202
  });
1154
1203
  }
1155
1204
  }
@@ -1158,22 +1207,22 @@ function runEnvironmentChecks() {
1158
1207
  name: "Node.js >= 18",
1159
1208
  ok: nodeVersion >= 18,
1160
1209
  message: `Node.js v${process.versions.node}`,
1161
- fix: nodeVersion < 18 ? "Aggiorna Node.js:\n nvm install 22 && nvm use 22\n Oppure: https://nodejs.org/" : void 0
1210
+ fix: nodeVersion < 18 ? "Upgrade Node.js:\n nvm install 22 && nvm use 22\n Or visit: https://nodejs.org/" : void 0
1162
1211
  });
1163
1212
  let sqliteOk = false;
1164
1213
  let sqliteMsg = "";
1165
1214
  try {
1166
1215
  __require("better-sqlite3");
1167
1216
  sqliteOk = true;
1168
- sqliteMsg = "Modulo nativo caricato correttamente";
1217
+ sqliteMsg = "Native module loaded successfully";
1169
1218
  } catch (err) {
1170
- sqliteMsg = err.code === "ERR_DLOPEN_FAILED" ? "Binario nativo incompatibile (ELF header invalido \u2014 probabile mismatch piattaforma)" : `Errore: ${err.message}`;
1219
+ sqliteMsg = err.code === "ERR_DLOPEN_FAILED" ? "Incompatible native binary (invalid ELF header \u2014 likely platform mismatch)" : `Error: ${err.message}`;
1171
1220
  }
1172
1221
  checks.push({
1173
1222
  name: "better-sqlite3",
1174
1223
  ok: sqliteOk,
1175
1224
  message: sqliteMsg,
1176
- fix: !sqliteOk ? wsl ? "In WSL, ricompila il modulo nativo:\n npm rebuild better-sqlite3\n Se non funziona, reinstalla:\n npm install -g kiro-memory --build-from-source" : "Reinstalla il modulo nativo:\n npm rebuild better-sqlite3" : void 0
1225
+ fix: !sqliteOk ? wsl ? "In WSL, rebuild the native module:\n npm rebuild better-sqlite3\n If that fails, reinstall:\n npm install -g kiro-memory --build-from-source" : "Rebuild the native module:\n npm rebuild better-sqlite3" : void 0
1177
1226
  });
1178
1227
  if (os === "linux") {
1179
1228
  const hasMake = commandExists("make");
@@ -1184,12 +1233,12 @@ function runEnvironmentChecks() {
1184
1233
  if (!hasMake || !hasGcc) missing.push("build-essential");
1185
1234
  if (!hasPython) missing.push("python3");
1186
1235
  checks.push({
1187
- name: "Build tools (moduli nativi)",
1236
+ name: "Build tools (native modules)",
1188
1237
  ok: allPresent,
1189
- message: allPresent ? "make, g++, python3 disponibili" : `Mancanti: ${missing.join(", ")}`,
1190
- fix: !allPresent ? `Installa i pacchetti richiesti:
1238
+ message: allPresent ? "make, g++, python3 available" : `Missing: ${missing.join(", ")}`,
1239
+ fix: !allPresent ? `Install required packages:
1191
1240
  sudo apt-get update && sudo apt-get install -y ${missing.join(" ")}
1192
- Poi reinstalla: npm install -g kiro-memory --build-from-source` : void 0
1241
+ Then reinstall: npm install -g kiro-memory --build-from-source` : void 0
1193
1242
  });
1194
1243
  }
1195
1244
  return checks;
@@ -1212,34 +1261,26 @@ function printChecks(checks) {
1212
1261
  return { hasErrors };
1213
1262
  }
1214
1263
  async function installKiro() {
1215
- console.log("\n=== Kiro Memory - Installazione ===\n");
1216
- console.log("[1/3] Diagnostica ambiente...");
1264
+ console.log("\n=== Kiro Memory - Installation ===\n");
1265
+ console.log("[1/3] Running environment checks...");
1217
1266
  const checks = runEnvironmentChecks();
1218
1267
  const { hasErrors } = printChecks(checks);
1219
1268
  if (hasErrors) {
1220
- console.log("\x1B[31mInstallazione annullata.\x1B[0m Risolvi i problemi sopra e riprova.");
1221
- console.log("Dopo aver risolto, esegui: kiro-memory install\n");
1269
+ console.log("\x1B[31mInstallation aborted.\x1B[0m Fix the issues above and retry.");
1270
+ console.log("After fixing, run: kiro-memory install\n");
1222
1271
  process.exit(1);
1223
1272
  }
1224
1273
  const distDir = DIST_DIR;
1225
- const agentTemplatePath = join3(PROJECT_ROOT, "kiro-agent", "contextkit.json");
1226
- const steeringSourcePath = join3(PROJECT_ROOT, "kiro-agent", "steering.md");
1227
- if (!existsSync3(agentTemplatePath)) {
1228
- console.error(`\x1B[31mErrore:\x1B[0m Template agent non trovato: ${agentTemplatePath}`);
1229
- console.error("Prova a reinstallare: npm install -g kiro-memory");
1230
- process.exit(1);
1231
- }
1232
1274
  const kiroDir = process.env.KIRO_CONFIG_DIR || join3(homedir3(), ".kiro");
1233
1275
  const agentsDir = join3(kiroDir, "agents");
1234
1276
  const settingsDir = join3(kiroDir, "settings");
1235
1277
  const steeringDir = join3(kiroDir, "steering");
1236
1278
  const dataDir = process.env.CONTEXTKIT_DATA_DIR || join3(homedir3(), ".contextkit");
1237
- console.log("[2/3] Installazione configurazione Kiro...\n");
1279
+ console.log("[2/3] Installing Kiro configuration...\n");
1238
1280
  for (const dir of [agentsDir, settingsDir, steeringDir, dataDir]) {
1239
1281
  mkdirSync3(dir, { recursive: true });
1240
1282
  }
1241
- const agentTemplate = readFileSync2(agentTemplatePath, "utf8");
1242
- const agentConfig = agentTemplate.replace(/__CONTEXTKIT_DIST__/g, distDir);
1283
+ const agentConfig = AGENT_TEMPLATE.replace(/__DIST_DIR__/g, distDir);
1243
1284
  const agentDestPath = join3(agentsDir, "contextkit.json");
1244
1285
  writeFileSync(agentDestPath, agentConfig, "utf8");
1245
1286
  console.log(` \u2192 Agent config: ${agentDestPath}`);
@@ -1259,33 +1300,31 @@ async function installKiro() {
1259
1300
  writeFileSync(mcpFilePath, JSON.stringify(mcpConfig, null, 2), "utf8");
1260
1301
  console.log(` \u2192 MCP config: ${mcpFilePath}`);
1261
1302
  const steeringDestPath = join3(steeringDir, "contextkit.md");
1262
- if (existsSync3(steeringSourcePath)) {
1263
- copyFileSync(steeringSourcePath, steeringDestPath);
1264
- console.log(` \u2192 Steering: ${steeringDestPath}`);
1265
- }
1303
+ writeFileSync(steeringDestPath, STEERING_CONTENT, "utf8");
1304
+ console.log(` \u2192 Steering: ${steeringDestPath}`);
1266
1305
  console.log(` \u2192 Data dir: ${dataDir}`);
1267
- console.log("\n[3/3] Installazione completata!\n");
1268
- console.log("Per usare Kiro con memoria persistente:");
1306
+ console.log("\n[3/3] Installation complete!\n");
1307
+ console.log("To use Kiro with persistent memory:");
1269
1308
  console.log(" kiro-cli --agent contextkit-memory\n");
1270
- console.log("Per creare un alias permanente:");
1309
+ console.log("To create a permanent alias:");
1271
1310
  console.log(` echo 'alias kiro="kiro-cli --agent contextkit-memory"' >> ~/.bashrc`);
1272
1311
  console.log(" source ~/.bashrc\n");
1273
- console.log("Il worker si avvia automaticamente alla prima sessione.");
1274
- console.log(`Dashboard web: http://localhost:3001
1312
+ console.log("The worker starts automatically when a Kiro session begins.");
1313
+ console.log(`Web dashboard: http://localhost:3001
1275
1314
  `);
1276
1315
  }
1277
1316
  async function runDoctor() {
1278
- console.log("\n=== Kiro Memory - Diagnostica ===");
1317
+ console.log("\n=== Kiro Memory - Diagnostics ===");
1279
1318
  const checks = runEnvironmentChecks();
1280
1319
  const kiroDir = process.env.KIRO_CONFIG_DIR || join3(homedir3(), ".kiro");
1281
1320
  const agentPath = join3(kiroDir, "agents", "contextkit.json");
1282
1321
  const mcpPath = join3(kiroDir, "settings", "mcp.json");
1283
1322
  const dataDir = process.env.CONTEXTKIT_DATA_DIR || join3(homedir3(), ".contextkit");
1284
1323
  checks.push({
1285
- name: "Agent config Kiro",
1324
+ name: "Kiro agent config",
1286
1325
  ok: existsSync3(agentPath),
1287
- message: existsSync3(agentPath) ? agentPath : "Non trovato",
1288
- fix: !existsSync3(agentPath) ? "Esegui: kiro-memory install" : void 0
1326
+ message: existsSync3(agentPath) ? agentPath : "Not found",
1327
+ fix: !existsSync3(agentPath) ? "Run: kiro-memory install" : void 0
1289
1328
  });
1290
1329
  let mcpOk = false;
1291
1330
  if (existsSync3(mcpPath)) {
@@ -1296,15 +1335,15 @@ async function runDoctor() {
1296
1335
  }
1297
1336
  }
1298
1337
  checks.push({
1299
- name: "MCP server configurato",
1338
+ name: "MCP server configured",
1300
1339
  ok: mcpOk,
1301
- message: mcpOk ? "contextkit registrato in mcp.json" : "Non configurato",
1302
- fix: !mcpOk ? "Esegui: kiro-memory install" : void 0
1340
+ message: mcpOk ? "contextkit registered in mcp.json" : "Not configured",
1341
+ fix: !mcpOk ? "Run: kiro-memory install" : void 0
1303
1342
  });
1304
1343
  checks.push({
1305
1344
  name: "Data directory",
1306
1345
  ok: existsSync3(dataDir),
1307
- message: existsSync3(dataDir) ? dataDir : "Non creata (verr\xE0 creata al primo uso)"
1346
+ message: existsSync3(dataDir) ? dataDir : "Not created (will be created on first use)"
1308
1347
  });
1309
1348
  let workerOk = false;
1310
1349
  try {
@@ -1319,15 +1358,15 @@ async function runDoctor() {
1319
1358
  checks.push({
1320
1359
  name: "Worker service",
1321
1360
  ok: true,
1322
- // Non bloccante: si avvia automaticamente
1323
- message: workerOk ? "Attivo su porta 3001" : "Non in esecuzione (si avvia automaticamente con Kiro)"
1361
+ // Non-blocking: starts automatically with Kiro
1362
+ message: workerOk ? "Running on port 3001" : "Not running (starts automatically with Kiro)"
1324
1363
  });
1325
1364
  const { hasErrors } = printChecks(checks);
1326
1365
  if (hasErrors) {
1327
- console.log("Alcuni check sono falliti. Risolvi i problemi indicati sopra.\n");
1366
+ console.log("Some checks failed. Fix the issues listed above.\n");
1328
1367
  process.exit(1);
1329
1368
  } else {
1330
- console.log("Tutto OK! Kiro Memory \xE8 pronto.\n");
1369
+ console.log("All good! Kiro Memory is ready.\n");
1331
1370
  }
1332
1371
  }
1333
1372
  async function main() {