kiro-memory 1.4.2 → 1.5.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/package.json +1 -1
- package/plugin/dist/cli/contextkit.js +61 -61
- package/plugin/dist/hooks/agentSpawn.js +18 -18
- package/plugin/dist/hooks/kiro-hooks.js +30 -30
- package/plugin/dist/hooks/postToolUse.js +19 -19
- package/plugin/dist/hooks/stop.js +18 -18
- package/plugin/dist/hooks/userPromptSubmit.js +18 -18
- package/plugin/dist/index.js +23 -18
- package/plugin/dist/sdk/index.js +22 -18
- package/plugin/dist/servers/mcp-server.js +49 -49
- package/plugin/dist/services/search/ChromaManager.js +4 -4
- package/plugin/dist/services/search/HybridSearch.js +4 -4
- package/plugin/dist/services/search/index.js +4 -4
- package/plugin/dist/services/sqlite/Database.js +6 -6
- package/plugin/dist/services/sqlite/index.js +7 -6
- package/plugin/dist/shared/paths.js +4 -4
- package/plugin/dist/utils/logger.js +2 -2
- package/plugin/dist/viewer.js +1 -1
- package/plugin/dist/worker-service.js +8 -8
package/plugin/dist/index.js
CHANGED
|
@@ -488,7 +488,7 @@ var Logger = class {
|
|
|
488
488
|
mkdirSync(logsDir, { recursive: true });
|
|
489
489
|
}
|
|
490
490
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
491
|
-
this.logFilePath = join(logsDir, `
|
|
491
|
+
this.logFilePath = join(logsDir, `kiro-memory-${date}.log`);
|
|
492
492
|
} catch (error) {
|
|
493
493
|
console.error("[LOGGER] Failed to initialize log file:", error);
|
|
494
494
|
this.logFilePath = null;
|
|
@@ -504,7 +504,7 @@ var Logger = class {
|
|
|
504
504
|
if (existsSync(settingsPath)) {
|
|
505
505
|
const settingsData = readFileSync(settingsPath, "utf-8");
|
|
506
506
|
const settings = JSON.parse(settingsData);
|
|
507
|
-
const envLevel = (settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
507
|
+
const envLevel = (settings.KIRO_MEMORY_LOG_LEVEL || settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
508
508
|
this.level = LogLevel[envLevel] ?? 1 /* INFO */;
|
|
509
509
|
} else {
|
|
510
510
|
this.level = 1 /* INFO */;
|
|
@@ -682,9 +682,9 @@ function getDirname() {
|
|
|
682
682
|
return dirname(fileURLToPath(import.meta.url));
|
|
683
683
|
}
|
|
684
684
|
var _dirname = getDirname();
|
|
685
|
-
var DATA_DIR = process.env.CONTEXTKIT_DATA_DIR || join2(homedir2(), ".contextkit");
|
|
685
|
+
var DATA_DIR = process.env.KIRO_MEMORY_DATA_DIR || process.env.CONTEXTKIT_DATA_DIR || join2(homedir2(), ".contextkit");
|
|
686
686
|
var KIRO_CONFIG_DIR = process.env.KIRO_CONFIG_DIR || join2(homedir2(), ".kiro");
|
|
687
|
-
var PLUGIN_ROOT = join2(KIRO_CONFIG_DIR, "plugins", "
|
|
687
|
+
var PLUGIN_ROOT = join2(KIRO_CONFIG_DIR, "plugins", "kiro-memory");
|
|
688
688
|
var ARCHIVES_DIR = join2(DATA_DIR, "archives");
|
|
689
689
|
var LOGS_DIR = join2(DATA_DIR, "logs");
|
|
690
690
|
var TRASH_DIR = join2(DATA_DIR, "trash");
|
|
@@ -704,7 +704,7 @@ function ensureDir(dirPath) {
|
|
|
704
704
|
var SQLITE_MMAP_SIZE_BYTES = 256 * 1024 * 1024;
|
|
705
705
|
var SQLITE_CACHE_SIZE_PAGES = 1e4;
|
|
706
706
|
var dbInstance = null;
|
|
707
|
-
var
|
|
707
|
+
var KiroMemoryDatabase = class {
|
|
708
708
|
db;
|
|
709
709
|
constructor(dbPath = DB_PATH) {
|
|
710
710
|
if (dbPath !== ":memory:") {
|
|
@@ -1024,11 +1024,11 @@ init_Prompts();
|
|
|
1024
1024
|
init_Search();
|
|
1025
1025
|
|
|
1026
1026
|
// src/sdk/index.ts
|
|
1027
|
-
var
|
|
1027
|
+
var KiroMemorySDK = class {
|
|
1028
1028
|
db;
|
|
1029
1029
|
project;
|
|
1030
1030
|
constructor(config = {}) {
|
|
1031
|
-
this.db = new
|
|
1031
|
+
this.db = new KiroMemoryDatabase(config.dataDir);
|
|
1032
1032
|
this.project = config.project || this.detectProject();
|
|
1033
1033
|
}
|
|
1034
1034
|
detectProject() {
|
|
@@ -1128,7 +1128,7 @@ var ContextKitSDK = class {
|
|
|
1128
1128
|
return getSummariesByProject2(this.db.db, this.project, limit);
|
|
1129
1129
|
}
|
|
1130
1130
|
/**
|
|
1131
|
-
*
|
|
1131
|
+
* Advanced search with FTS5 and filters
|
|
1132
1132
|
*/
|
|
1133
1133
|
async searchAdvanced(query, filters = {}) {
|
|
1134
1134
|
const { searchObservationsFTS: searchObservationsFTS2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
@@ -1140,21 +1140,21 @@ var ContextKitSDK = class {
|
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
1142
1142
|
/**
|
|
1143
|
-
*
|
|
1143
|
+
* Retrieve observations by ID (batch)
|
|
1144
1144
|
*/
|
|
1145
1145
|
async getObservationsByIds(ids) {
|
|
1146
1146
|
const { getObservationsByIds: getObservationsByIds2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
1147
1147
|
return getObservationsByIds2(this.db.db, ids);
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
1150
|
-
* Timeline:
|
|
1150
|
+
* Timeline: chronological context around an observation
|
|
1151
1151
|
*/
|
|
1152
1152
|
async getTimeline(anchorId, depthBefore = 5, depthAfter = 5) {
|
|
1153
1153
|
const { getTimeline: getTimeline2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
1154
1154
|
return getTimeline2(this.db.db, anchorId, depthBefore, depthAfter);
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
|
-
*
|
|
1157
|
+
* Create or retrieve a session for the current project
|
|
1158
1158
|
*/
|
|
1159
1159
|
async getOrCreateSession(contentSessionId) {
|
|
1160
1160
|
const { getSessionByContentId: getSessionByContentId2, createSession: createSession2 } = await Promise.resolve().then(() => (init_Sessions(), Sessions_exports));
|
|
@@ -1177,27 +1177,27 @@ var ContextKitSDK = class {
|
|
|
1177
1177
|
return session;
|
|
1178
1178
|
}
|
|
1179
1179
|
/**
|
|
1180
|
-
*
|
|
1180
|
+
* Store a user prompt
|
|
1181
1181
|
*/
|
|
1182
1182
|
async storePrompt(contentSessionId, promptNumber, text) {
|
|
1183
1183
|
const { createPrompt: createPrompt2 } = await Promise.resolve().then(() => (init_Prompts(), Prompts_exports));
|
|
1184
1184
|
return createPrompt2(this.db.db, contentSessionId, this.project, promptNumber, text);
|
|
1185
1185
|
}
|
|
1186
1186
|
/**
|
|
1187
|
-
*
|
|
1187
|
+
* Complete a session
|
|
1188
1188
|
*/
|
|
1189
1189
|
async completeSession(sessionId) {
|
|
1190
1190
|
const { completeSession: completeSession2 } = await Promise.resolve().then(() => (init_Sessions(), Sessions_exports));
|
|
1191
1191
|
completeSession2(this.db.db, sessionId);
|
|
1192
1192
|
}
|
|
1193
1193
|
/**
|
|
1194
|
-
* Getter
|
|
1194
|
+
* Getter for current project name
|
|
1195
1195
|
*/
|
|
1196
1196
|
getProject() {
|
|
1197
1197
|
return this.project;
|
|
1198
1198
|
}
|
|
1199
1199
|
/**
|
|
1200
|
-
* Getter
|
|
1200
|
+
* Getter for direct database access (for API routes)
|
|
1201
1201
|
*/
|
|
1202
1202
|
getDb() {
|
|
1203
1203
|
return this.db.db;
|
|
@@ -1209,9 +1209,11 @@ var ContextKitSDK = class {
|
|
|
1209
1209
|
this.db.close();
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
|
-
function
|
|
1213
|
-
return new
|
|
1212
|
+
function createKiroMemory(config) {
|
|
1213
|
+
return new KiroMemorySDK(config);
|
|
1214
1214
|
}
|
|
1215
|
+
var ContextKitSDK = KiroMemorySDK;
|
|
1216
|
+
var createContextKit = createKiroMemory;
|
|
1215
1217
|
|
|
1216
1218
|
// src/index.ts
|
|
1217
1219
|
init_Search();
|
|
@@ -1321,12 +1323,15 @@ async function runHook(name, handler) {
|
|
|
1321
1323
|
// src/index.ts
|
|
1322
1324
|
var VERSION = "1.0.0";
|
|
1323
1325
|
export {
|
|
1324
|
-
ContextKitDatabase,
|
|
1326
|
+
KiroMemoryDatabase as ContextKitDatabase,
|
|
1325
1327
|
ContextKitSDK,
|
|
1326
1328
|
DatabaseManager,
|
|
1329
|
+
KiroMemoryDatabase,
|
|
1330
|
+
KiroMemorySDK,
|
|
1327
1331
|
LogLevel,
|
|
1328
1332
|
VERSION,
|
|
1329
1333
|
createContextKit,
|
|
1334
|
+
createKiroMemory,
|
|
1330
1335
|
detectProject,
|
|
1331
1336
|
formatContext,
|
|
1332
1337
|
getDatabase,
|
package/plugin/dist/sdk/index.js
CHANGED
|
@@ -488,7 +488,7 @@ var Logger = class {
|
|
|
488
488
|
mkdirSync(logsDir, { recursive: true });
|
|
489
489
|
}
|
|
490
490
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
491
|
-
this.logFilePath = join(logsDir, `
|
|
491
|
+
this.logFilePath = join(logsDir, `kiro-memory-${date}.log`);
|
|
492
492
|
} catch (error) {
|
|
493
493
|
console.error("[LOGGER] Failed to initialize log file:", error);
|
|
494
494
|
this.logFilePath = null;
|
|
@@ -504,7 +504,7 @@ var Logger = class {
|
|
|
504
504
|
if (existsSync(settingsPath)) {
|
|
505
505
|
const settingsData = readFileSync(settingsPath, "utf-8");
|
|
506
506
|
const settings = JSON.parse(settingsData);
|
|
507
|
-
const envLevel = (settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
507
|
+
const envLevel = (settings.KIRO_MEMORY_LOG_LEVEL || settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
508
508
|
this.level = LogLevel[envLevel] ?? 1 /* INFO */;
|
|
509
509
|
} else {
|
|
510
510
|
this.level = 1 /* INFO */;
|
|
@@ -682,9 +682,9 @@ function getDirname() {
|
|
|
682
682
|
return dirname(fileURLToPath(import.meta.url));
|
|
683
683
|
}
|
|
684
684
|
var _dirname = getDirname();
|
|
685
|
-
var DATA_DIR = process.env.CONTEXTKIT_DATA_DIR || join2(homedir2(), ".contextkit");
|
|
685
|
+
var DATA_DIR = process.env.KIRO_MEMORY_DATA_DIR || process.env.CONTEXTKIT_DATA_DIR || join2(homedir2(), ".contextkit");
|
|
686
686
|
var KIRO_CONFIG_DIR = process.env.KIRO_CONFIG_DIR || join2(homedir2(), ".kiro");
|
|
687
|
-
var PLUGIN_ROOT = join2(KIRO_CONFIG_DIR, "plugins", "
|
|
687
|
+
var PLUGIN_ROOT = join2(KIRO_CONFIG_DIR, "plugins", "kiro-memory");
|
|
688
688
|
var ARCHIVES_DIR = join2(DATA_DIR, "archives");
|
|
689
689
|
var LOGS_DIR = join2(DATA_DIR, "logs");
|
|
690
690
|
var TRASH_DIR = join2(DATA_DIR, "trash");
|
|
@@ -703,7 +703,7 @@ function ensureDir(dirPath) {
|
|
|
703
703
|
// src/services/sqlite/Database.ts
|
|
704
704
|
var SQLITE_MMAP_SIZE_BYTES = 256 * 1024 * 1024;
|
|
705
705
|
var SQLITE_CACHE_SIZE_PAGES = 1e4;
|
|
706
|
-
var
|
|
706
|
+
var KiroMemoryDatabase = class {
|
|
707
707
|
db;
|
|
708
708
|
constructor(dbPath = DB_PATH) {
|
|
709
709
|
if (dbPath !== ":memory:") {
|
|
@@ -905,11 +905,11 @@ init_Prompts();
|
|
|
905
905
|
init_Search();
|
|
906
906
|
|
|
907
907
|
// src/sdk/index.ts
|
|
908
|
-
var
|
|
908
|
+
var KiroMemorySDK = class {
|
|
909
909
|
db;
|
|
910
910
|
project;
|
|
911
911
|
constructor(config = {}) {
|
|
912
|
-
this.db = new
|
|
912
|
+
this.db = new KiroMemoryDatabase(config.dataDir);
|
|
913
913
|
this.project = config.project || this.detectProject();
|
|
914
914
|
}
|
|
915
915
|
detectProject() {
|
|
@@ -1009,7 +1009,7 @@ var ContextKitSDK = class {
|
|
|
1009
1009
|
return getSummariesByProject2(this.db.db, this.project, limit);
|
|
1010
1010
|
}
|
|
1011
1011
|
/**
|
|
1012
|
-
*
|
|
1012
|
+
* Advanced search with FTS5 and filters
|
|
1013
1013
|
*/
|
|
1014
1014
|
async searchAdvanced(query, filters = {}) {
|
|
1015
1015
|
const { searchObservationsFTS: searchObservationsFTS2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
@@ -1021,21 +1021,21 @@ var ContextKitSDK = class {
|
|
|
1021
1021
|
};
|
|
1022
1022
|
}
|
|
1023
1023
|
/**
|
|
1024
|
-
*
|
|
1024
|
+
* Retrieve observations by ID (batch)
|
|
1025
1025
|
*/
|
|
1026
1026
|
async getObservationsByIds(ids) {
|
|
1027
1027
|
const { getObservationsByIds: getObservationsByIds2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
1028
1028
|
return getObservationsByIds2(this.db.db, ids);
|
|
1029
1029
|
}
|
|
1030
1030
|
/**
|
|
1031
|
-
* Timeline:
|
|
1031
|
+
* Timeline: chronological context around an observation
|
|
1032
1032
|
*/
|
|
1033
1033
|
async getTimeline(anchorId, depthBefore = 5, depthAfter = 5) {
|
|
1034
1034
|
const { getTimeline: getTimeline2 } = await Promise.resolve().then(() => (init_Search(), Search_exports));
|
|
1035
1035
|
return getTimeline2(this.db.db, anchorId, depthBefore, depthAfter);
|
|
1036
1036
|
}
|
|
1037
1037
|
/**
|
|
1038
|
-
*
|
|
1038
|
+
* Create or retrieve a session for the current project
|
|
1039
1039
|
*/
|
|
1040
1040
|
async getOrCreateSession(contentSessionId) {
|
|
1041
1041
|
const { getSessionByContentId: getSessionByContentId2, createSession: createSession2 } = await Promise.resolve().then(() => (init_Sessions(), Sessions_exports));
|
|
@@ -1058,27 +1058,27 @@ var ContextKitSDK = class {
|
|
|
1058
1058
|
return session;
|
|
1059
1059
|
}
|
|
1060
1060
|
/**
|
|
1061
|
-
*
|
|
1061
|
+
* Store a user prompt
|
|
1062
1062
|
*/
|
|
1063
1063
|
async storePrompt(contentSessionId, promptNumber, text) {
|
|
1064
1064
|
const { createPrompt: createPrompt2 } = await Promise.resolve().then(() => (init_Prompts(), Prompts_exports));
|
|
1065
1065
|
return createPrompt2(this.db.db, contentSessionId, this.project, promptNumber, text);
|
|
1066
1066
|
}
|
|
1067
1067
|
/**
|
|
1068
|
-
*
|
|
1068
|
+
* Complete a session
|
|
1069
1069
|
*/
|
|
1070
1070
|
async completeSession(sessionId) {
|
|
1071
1071
|
const { completeSession: completeSession2 } = await Promise.resolve().then(() => (init_Sessions(), Sessions_exports));
|
|
1072
1072
|
completeSession2(this.db.db, sessionId);
|
|
1073
1073
|
}
|
|
1074
1074
|
/**
|
|
1075
|
-
* Getter
|
|
1075
|
+
* Getter for current project name
|
|
1076
1076
|
*/
|
|
1077
1077
|
getProject() {
|
|
1078
1078
|
return this.project;
|
|
1079
1079
|
}
|
|
1080
1080
|
/**
|
|
1081
|
-
* Getter
|
|
1081
|
+
* Getter for direct database access (for API routes)
|
|
1082
1082
|
*/
|
|
1083
1083
|
getDb() {
|
|
1084
1084
|
return this.db.db;
|
|
@@ -1090,10 +1090,14 @@ var ContextKitSDK = class {
|
|
|
1090
1090
|
this.db.close();
|
|
1091
1091
|
}
|
|
1092
1092
|
};
|
|
1093
|
-
function
|
|
1094
|
-
return new
|
|
1093
|
+
function createKiroMemory(config) {
|
|
1094
|
+
return new KiroMemorySDK(config);
|
|
1095
1095
|
}
|
|
1096
|
+
var ContextKitSDK = KiroMemorySDK;
|
|
1097
|
+
var createContextKit = createKiroMemory;
|
|
1096
1098
|
export {
|
|
1097
1099
|
ContextKitSDK,
|
|
1098
|
-
|
|
1100
|
+
KiroMemorySDK,
|
|
1101
|
+
createContextKit,
|
|
1102
|
+
createKiroMemory
|
|
1099
1103
|
};
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
CallToolRequestSchema,
|
|
9
9
|
ListToolsRequestSchema
|
|
10
10
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
-
console.log = (...args) => console.error("[
|
|
12
|
-
var WORKER_HOST = process.env.
|
|
13
|
-
var WORKER_PORT = process.env.
|
|
11
|
+
console.log = (...args) => console.error("[kiro-memory-mcp]", ...args);
|
|
12
|
+
var WORKER_HOST = process.env.KIRO_MEMORY_WORKER_HOST || "127.0.0.1";
|
|
13
|
+
var WORKER_PORT = process.env.KIRO_MEMORY_WORKER_PORT || "3001";
|
|
14
14
|
var WORKER_BASE = `http://${WORKER_HOST}:${WORKER_PORT}`;
|
|
15
15
|
async function callWorkerGET(endpoint, params = {}) {
|
|
16
16
|
const url = new URL(endpoint, WORKER_BASE);
|
|
@@ -35,41 +35,41 @@ async function callWorkerPOST(endpoint, body) {
|
|
|
35
35
|
var TOOLS = [
|
|
36
36
|
{
|
|
37
37
|
name: "search",
|
|
38
|
-
description: "
|
|
38
|
+
description: "Search Kiro Memory. Returns observations and summaries matching the query. Use this tool to find context from previous sessions.",
|
|
39
39
|
inputSchema: {
|
|
40
40
|
type: "object",
|
|
41
41
|
properties: {
|
|
42
|
-
query: { type: "string", description: "
|
|
43
|
-
project: { type: "string", description: "
|
|
44
|
-
type: { type: "string", description: "
|
|
45
|
-
limit: { type: "number", description: "
|
|
42
|
+
query: { type: "string", description: "Text to search in observations and summaries" },
|
|
43
|
+
project: { type: "string", description: "Filter by project name (optional)" },
|
|
44
|
+
type: { type: "string", description: "Filter by observation type: file-write, command, research, tool-use (optional)" },
|
|
45
|
+
limit: { type: "number", description: "Max number of results (default: 20)" }
|
|
46
46
|
},
|
|
47
47
|
required: ["query"]
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
name: "timeline",
|
|
52
|
-
description: "
|
|
52
|
+
description: "Show chronological context around a specific observation. Useful to understand what happened before and after an event.",
|
|
53
53
|
inputSchema: {
|
|
54
54
|
type: "object",
|
|
55
55
|
properties: {
|
|
56
|
-
anchor: { type: "number", description: "ID
|
|
57
|
-
depth_before: { type: "number", description: "
|
|
58
|
-
depth_after: { type: "number", description: "
|
|
56
|
+
anchor: { type: "number", description: "Observation ID as reference point" },
|
|
57
|
+
depth_before: { type: "number", description: "Number of observations before (default: 5)" },
|
|
58
|
+
depth_after: { type: "number", description: "Number of observations after (default: 5)" }
|
|
59
59
|
},
|
|
60
60
|
required: ["anchor"]
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
name: "get_observations",
|
|
65
|
-
description: '
|
|
65
|
+
description: 'Retrieve full details of specific observations by ID. Use after "search" to get the complete content.',
|
|
66
66
|
inputSchema: {
|
|
67
67
|
type: "object",
|
|
68
68
|
properties: {
|
|
69
69
|
ids: {
|
|
70
70
|
type: "array",
|
|
71
71
|
items: { type: "number" },
|
|
72
|
-
description: "Array
|
|
72
|
+
description: "Array of observation IDs to retrieve"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
required: ["ids"]
|
|
@@ -77,11 +77,11 @@ var TOOLS = [
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
name: "get_context",
|
|
80
|
-
description: "
|
|
80
|
+
description: "Retrieve recent context for a project: observations, summaries, and recent prompts.",
|
|
81
81
|
inputSchema: {
|
|
82
82
|
type: "object",
|
|
83
83
|
properties: {
|
|
84
|
-
project: { type: "string", description: "
|
|
84
|
+
project: { type: "string", description: "Project name" }
|
|
85
85
|
},
|
|
86
86
|
required: ["project"]
|
|
87
87
|
}
|
|
@@ -98,16 +98,16 @@ var handlers = {
|
|
|
98
98
|
const obs = result.observations || [];
|
|
99
99
|
const sums = result.summaries || [];
|
|
100
100
|
if (obs.length === 0 && sums.length === 0) {
|
|
101
|
-
return "
|
|
101
|
+
return "No results found for the query.";
|
|
102
102
|
}
|
|
103
|
-
let output = `##
|
|
103
|
+
let output = `## Search Results: "${args.query}"
|
|
104
104
|
|
|
105
105
|
`;
|
|
106
106
|
if (obs.length > 0) {
|
|
107
|
-
output += `###
|
|
107
|
+
output += `### Observations (${obs.length})
|
|
108
108
|
|
|
109
109
|
`;
|
|
110
|
-
output += "| ID |
|
|
110
|
+
output += "| ID | Type | Title | Date |\n|---|---|---|---|\n";
|
|
111
111
|
obs.forEach((o) => {
|
|
112
112
|
output += `| ${o.id} | ${o.type} | ${o.title} | ${o.created_at?.split("T")[0] || ""} |
|
|
113
113
|
`;
|
|
@@ -115,13 +115,13 @@ var handlers = {
|
|
|
115
115
|
output += "\n";
|
|
116
116
|
}
|
|
117
117
|
if (sums.length > 0) {
|
|
118
|
-
output += `###
|
|
118
|
+
output += `### Summaries (${sums.length})
|
|
119
119
|
|
|
120
120
|
`;
|
|
121
121
|
sums.forEach((s) => {
|
|
122
|
-
if (s.learned) output += `- **
|
|
122
|
+
if (s.learned) output += `- **Learned**: ${s.learned}
|
|
123
123
|
`;
|
|
124
|
-
if (s.completed) output += `- **
|
|
124
|
+
if (s.completed) output += `- **Completed**: ${s.completed}
|
|
125
125
|
`;
|
|
126
126
|
});
|
|
127
127
|
}
|
|
@@ -135,9 +135,9 @@ var handlers = {
|
|
|
135
135
|
});
|
|
136
136
|
const entries = result.timeline || result || [];
|
|
137
137
|
if (!Array.isArray(entries) || entries.length === 0) {
|
|
138
|
-
return `
|
|
138
|
+
return `No context found around observation ${args.anchor}.`;
|
|
139
139
|
}
|
|
140
|
-
let output = `## Timeline
|
|
140
|
+
let output = `## Timeline around observation #${args.anchor}
|
|
141
141
|
|
|
142
142
|
`;
|
|
143
143
|
entries.forEach((e) => {
|
|
@@ -154,29 +154,29 @@ var handlers = {
|
|
|
154
154
|
const result = await callWorkerPOST("/api/observations/batch", { ids: args.ids });
|
|
155
155
|
const obs = result.observations || result || [];
|
|
156
156
|
if (!Array.isArray(obs) || obs.length === 0) {
|
|
157
|
-
return "
|
|
157
|
+
return "No observations found for the specified IDs.";
|
|
158
158
|
}
|
|
159
|
-
let output = `##
|
|
159
|
+
let output = `## Observation Details
|
|
160
160
|
|
|
161
161
|
`;
|
|
162
162
|
obs.forEach((o) => {
|
|
163
163
|
output += `### #${o.id}: ${o.title}
|
|
164
164
|
`;
|
|
165
|
-
output += `- **
|
|
165
|
+
output += `- **Type**: ${o.type}
|
|
166
166
|
`;
|
|
167
|
-
output += `- **
|
|
167
|
+
output += `- **Project**: ${o.project}
|
|
168
168
|
`;
|
|
169
|
-
output += `- **
|
|
169
|
+
output += `- **Date**: ${o.created_at}
|
|
170
170
|
`;
|
|
171
|
-
if (o.text) output += `- **
|
|
171
|
+
if (o.text) output += `- **Content**: ${o.text}
|
|
172
172
|
`;
|
|
173
|
-
if (o.narrative) output += `- **
|
|
173
|
+
if (o.narrative) output += `- **Narrative**: ${o.narrative}
|
|
174
174
|
`;
|
|
175
|
-
if (o.concepts) output += `- **
|
|
175
|
+
if (o.concepts) output += `- **Concepts**: ${o.concepts}
|
|
176
176
|
`;
|
|
177
|
-
if (o.files_read) output += `- **
|
|
177
|
+
if (o.files_read) output += `- **Files read**: ${o.files_read}
|
|
178
178
|
`;
|
|
179
|
-
if (o.files_modified) output += `- **
|
|
179
|
+
if (o.files_modified) output += `- **Files modified**: ${o.files_modified}
|
|
180
180
|
`;
|
|
181
181
|
output += "\n";
|
|
182
182
|
});
|
|
@@ -186,27 +186,27 @@ var handlers = {
|
|
|
186
186
|
const result = await callWorkerGET(`/api/context/${encodeURIComponent(args.project)}`);
|
|
187
187
|
const obs = result.observations || [];
|
|
188
188
|
const sums = result.summaries || [];
|
|
189
|
-
let output = `##
|
|
189
|
+
let output = `## Context: ${args.project}
|
|
190
190
|
|
|
191
191
|
`;
|
|
192
192
|
if (sums.length > 0) {
|
|
193
|
-
output += `###
|
|
193
|
+
output += `### Recent Summaries
|
|
194
194
|
|
|
195
195
|
`;
|
|
196
196
|
sums.forEach((s) => {
|
|
197
|
-
if (s.request) output += `**
|
|
197
|
+
if (s.request) output += `**Request**: ${s.request}
|
|
198
198
|
`;
|
|
199
|
-
if (s.learned) output += `-
|
|
199
|
+
if (s.learned) output += `- Learned: ${s.learned}
|
|
200
200
|
`;
|
|
201
|
-
if (s.completed) output += `-
|
|
201
|
+
if (s.completed) output += `- Completed: ${s.completed}
|
|
202
202
|
`;
|
|
203
|
-
if (s.next_steps) output += `-
|
|
203
|
+
if (s.next_steps) output += `- Next steps: ${s.next_steps}
|
|
204
204
|
|
|
205
205
|
`;
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
if (obs.length > 0) {
|
|
209
|
-
output += `###
|
|
209
|
+
output += `### Recent Observations (${obs.length})
|
|
210
210
|
|
|
211
211
|
`;
|
|
212
212
|
obs.slice(0, 10).forEach((o) => {
|
|
@@ -219,7 +219,7 @@ var handlers = {
|
|
|
219
219
|
};
|
|
220
220
|
async function main() {
|
|
221
221
|
const server = new Server(
|
|
222
|
-
{ name: "
|
|
222
|
+
{ name: "kiro-memory", version: "1.0.0" },
|
|
223
223
|
{ capabilities: { tools: {} } }
|
|
224
224
|
);
|
|
225
225
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -230,7 +230,7 @@ async function main() {
|
|
|
230
230
|
const handler = handlers[name];
|
|
231
231
|
if (!handler) {
|
|
232
232
|
return {
|
|
233
|
-
content: [{ type: "text", text: `
|
|
233
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
234
234
|
isError: true
|
|
235
235
|
};
|
|
236
236
|
}
|
|
@@ -245,23 +245,23 @@ async function main() {
|
|
|
245
245
|
return {
|
|
246
246
|
content: [{
|
|
247
247
|
type: "text",
|
|
248
|
-
text: `
|
|
249
|
-
|
|
248
|
+
text: `Kiro Memory worker unreachable at ${WORKER_BASE}.
|
|
249
|
+
Start the worker with: cd <kiro-memory-dir> && npm run worker:start`
|
|
250
250
|
}],
|
|
251
251
|
isError: true
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
254
|
return {
|
|
255
|
-
content: [{ type: "text", text: `
|
|
255
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
256
256
|
isError: true
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
const transport = new StdioServerTransport();
|
|
261
261
|
await server.connect(transport);
|
|
262
|
-
console.log("
|
|
262
|
+
console.log("Kiro Memory MCP server started on stdio");
|
|
263
263
|
}
|
|
264
264
|
main().catch((err) => {
|
|
265
|
-
console.error("
|
|
265
|
+
console.error("MCP server startup error:", err);
|
|
266
266
|
process.exit(1);
|
|
267
267
|
});
|
|
@@ -39,7 +39,7 @@ var Logger = class {
|
|
|
39
39
|
mkdirSync(logsDir, { recursive: true });
|
|
40
40
|
}
|
|
41
41
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
42
|
-
this.logFilePath = join(logsDir, `
|
|
42
|
+
this.logFilePath = join(logsDir, `kiro-memory-${date}.log`);
|
|
43
43
|
} catch (error) {
|
|
44
44
|
console.error("[LOGGER] Failed to initialize log file:", error);
|
|
45
45
|
this.logFilePath = null;
|
|
@@ -55,7 +55,7 @@ var Logger = class {
|
|
|
55
55
|
if (existsSync(settingsPath)) {
|
|
56
56
|
const settingsData = readFileSync(settingsPath, "utf-8");
|
|
57
57
|
const settings = JSON.parse(settingsData);
|
|
58
|
-
const envLevel = (settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
58
|
+
const envLevel = (settings.KIRO_MEMORY_LOG_LEVEL || settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
59
59
|
this.level = LogLevel[envLevel] ?? 1 /* INFO */;
|
|
60
60
|
} else {
|
|
61
61
|
this.level = 1 /* INFO */;
|
|
@@ -246,8 +246,8 @@ var ChromaManager = class {
|
|
|
246
246
|
try {
|
|
247
247
|
await this.client.heartbeat();
|
|
248
248
|
this.collection = await this.client.getOrCreateCollection({
|
|
249
|
-
name: "
|
|
250
|
-
metadata: { description: "
|
|
249
|
+
name: "kiro-memory-observations",
|
|
250
|
+
metadata: { description: "Kiro Memory observation embeddings" }
|
|
251
251
|
});
|
|
252
252
|
this.isAvailable = true;
|
|
253
253
|
logger.info("CHROMA", "ChromaDB initialized successfully");
|
|
@@ -101,7 +101,7 @@ var Logger = class {
|
|
|
101
101
|
mkdirSync(logsDir, { recursive: true });
|
|
102
102
|
}
|
|
103
103
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
104
|
-
this.logFilePath = join(logsDir, `
|
|
104
|
+
this.logFilePath = join(logsDir, `kiro-memory-${date}.log`);
|
|
105
105
|
} catch (error) {
|
|
106
106
|
console.error("[LOGGER] Failed to initialize log file:", error);
|
|
107
107
|
this.logFilePath = null;
|
|
@@ -117,7 +117,7 @@ var Logger = class {
|
|
|
117
117
|
if (existsSync(settingsPath)) {
|
|
118
118
|
const settingsData = readFileSync(settingsPath, "utf-8");
|
|
119
119
|
const settings = JSON.parse(settingsData);
|
|
120
|
-
const envLevel = (settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
120
|
+
const envLevel = (settings.KIRO_MEMORY_LOG_LEVEL || settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
121
121
|
this.level = LogLevel[envLevel] ?? 1 /* INFO */;
|
|
122
122
|
} else {
|
|
123
123
|
this.level = 1 /* INFO */;
|
|
@@ -308,8 +308,8 @@ var ChromaManager = class {
|
|
|
308
308
|
try {
|
|
309
309
|
await this.client.heartbeat();
|
|
310
310
|
this.collection = await this.client.getOrCreateCollection({
|
|
311
|
-
name: "
|
|
312
|
-
metadata: { description: "
|
|
311
|
+
name: "kiro-memory-observations",
|
|
312
|
+
metadata: { description: "Kiro Memory observation embeddings" }
|
|
313
313
|
});
|
|
314
314
|
this.isAvailable = true;
|
|
315
315
|
logger.info("CHROMA", "ChromaDB initialized successfully");
|
|
@@ -101,7 +101,7 @@ var Logger = class {
|
|
|
101
101
|
mkdirSync(logsDir, { recursive: true });
|
|
102
102
|
}
|
|
103
103
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
104
|
-
this.logFilePath = join(logsDir, `
|
|
104
|
+
this.logFilePath = join(logsDir, `kiro-memory-${date}.log`);
|
|
105
105
|
} catch (error) {
|
|
106
106
|
console.error("[LOGGER] Failed to initialize log file:", error);
|
|
107
107
|
this.logFilePath = null;
|
|
@@ -117,7 +117,7 @@ var Logger = class {
|
|
|
117
117
|
if (existsSync(settingsPath)) {
|
|
118
118
|
const settingsData = readFileSync(settingsPath, "utf-8");
|
|
119
119
|
const settings = JSON.parse(settingsData);
|
|
120
|
-
const envLevel = (settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
120
|
+
const envLevel = (settings.KIRO_MEMORY_LOG_LEVEL || settings.CONTEXTKIT_LOG_LEVEL || "INFO").toUpperCase();
|
|
121
121
|
this.level = LogLevel[envLevel] ?? 1 /* INFO */;
|
|
122
122
|
} else {
|
|
123
123
|
this.level = 1 /* INFO */;
|
|
@@ -308,8 +308,8 @@ var ChromaManager = class {
|
|
|
308
308
|
try {
|
|
309
309
|
await this.client.heartbeat();
|
|
310
310
|
this.collection = await this.client.getOrCreateCollection({
|
|
311
|
-
name: "
|
|
312
|
-
metadata: { description: "
|
|
311
|
+
name: "kiro-memory-observations",
|
|
312
|
+
metadata: { description: "Kiro Memory observation embeddings" }
|
|
313
313
|
});
|
|
314
314
|
this.isAvailable = true;
|
|
315
315
|
logger.info("CHROMA", "ChromaDB initialized successfully");
|