@stackmemoryai/stackmemory 1.8.1 → 1.10.2

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.
@@ -24,7 +24,8 @@ class MCPToolDefinitions {
24
24
  ...this.getTeamTools(),
25
25
  ...this.getCordTools(),
26
26
  ...this.getDigestTools(),
27
- ...this.getDesirePathTools()
27
+ ...this.getDesirePathTools(),
28
+ ...this.getProvenantTools()
28
29
  ];
29
30
  }
30
31
  /**
@@ -391,6 +392,56 @@ class MCPToolDefinitions {
391
392
  type: "object",
392
393
  properties: {}
393
394
  }
395
+ },
396
+ {
397
+ name: "linear_create_comment",
398
+ description: "Create a comment on a Linear issue (useful for workpad updates)",
399
+ inputSchema: {
400
+ type: "object",
401
+ properties: {
402
+ issue_id: {
403
+ type: "string",
404
+ description: "Linear issue ID or identifier (e.g. STA-123 or UUID)"
405
+ },
406
+ body: {
407
+ type: "string",
408
+ description: "Comment body (supports markdown)"
409
+ }
410
+ },
411
+ required: ["issue_id", "body"]
412
+ }
413
+ },
414
+ {
415
+ name: "linear_update_comment",
416
+ description: "Update an existing comment on a Linear issue",
417
+ inputSchema: {
418
+ type: "object",
419
+ properties: {
420
+ comment_id: {
421
+ type: "string",
422
+ description: "Comment ID to update"
423
+ },
424
+ body: {
425
+ type: "string",
426
+ description: "New comment body (supports markdown)"
427
+ }
428
+ },
429
+ required: ["comment_id", "body"]
430
+ }
431
+ },
432
+ {
433
+ name: "linear_list_comments",
434
+ description: "List comments on a Linear issue (useful for finding workpad)",
435
+ inputSchema: {
436
+ type: "object",
437
+ properties: {
438
+ issue_id: {
439
+ type: "string",
440
+ description: "Linear issue ID or identifier (e.g. STA-123 or UUID)"
441
+ }
442
+ },
443
+ required: ["issue_id"]
444
+ }
394
445
  }
395
446
  ];
396
447
  }
@@ -1421,6 +1472,104 @@ class MCPToolDefinitions {
1421
1472
  }
1422
1473
  ];
1423
1474
  }
1475
+ /**
1476
+ * Provenant decision graph tools
1477
+ */
1478
+ getProvenantTools() {
1479
+ return [
1480
+ {
1481
+ name: "provenant_search",
1482
+ description: "Search the decision graph for past decisions, patterns, and context by meaning",
1483
+ inputSchema: {
1484
+ type: "object",
1485
+ properties: {
1486
+ query: {
1487
+ type: "string",
1488
+ description: "Natural language search query"
1489
+ },
1490
+ actor: {
1491
+ type: "string",
1492
+ description: "Filter by decision maker"
1493
+ },
1494
+ since: {
1495
+ type: "string",
1496
+ description: "ISO date \u2014 only include decisions after this date"
1497
+ },
1498
+ limit: {
1499
+ type: "number",
1500
+ description: "Max results to return",
1501
+ default: 10
1502
+ }
1503
+ },
1504
+ required: ["query"]
1505
+ }
1506
+ },
1507
+ {
1508
+ name: "provenant_log",
1509
+ description: "Log a decision to the graph. Use when a product or technical decision is made during a session.",
1510
+ inputSchema: {
1511
+ type: "object",
1512
+ properties: {
1513
+ content: {
1514
+ type: "string",
1515
+ description: "The decision content"
1516
+ },
1517
+ actor: {
1518
+ type: "string",
1519
+ description: "Who made this decision"
1520
+ },
1521
+ reasoning: {
1522
+ type: "string",
1523
+ description: "Why this decision was made"
1524
+ }
1525
+ },
1526
+ required: ["content"]
1527
+ }
1528
+ },
1529
+ {
1530
+ name: "provenant_status",
1531
+ description: "Get decision graph overview: node count, edges, open contradictions, review queue depth",
1532
+ inputSchema: {
1533
+ type: "object",
1534
+ properties: {}
1535
+ }
1536
+ },
1537
+ {
1538
+ name: "provenant_contradictions",
1539
+ description: "List open contradictions in the decision graph \u2014 conflicting beliefs that need human resolution",
1540
+ inputSchema: {
1541
+ type: "object",
1542
+ properties: {}
1543
+ }
1544
+ },
1545
+ {
1546
+ name: "provenant_resolve",
1547
+ description: "Resolve a contradiction between two nodes by picking a winner or dismissing",
1548
+ inputSchema: {
1549
+ type: "object",
1550
+ properties: {
1551
+ node_a: {
1552
+ type: "string",
1553
+ description: "First node ID or prefix"
1554
+ },
1555
+ node_b: {
1556
+ type: "string",
1557
+ description: "Second node ID or prefix"
1558
+ },
1559
+ winner: {
1560
+ type: "string",
1561
+ description: "Winning node ID or prefix"
1562
+ },
1563
+ dismiss: {
1564
+ type: "boolean",
1565
+ description: "Dismiss as noise instead of resolving"
1566
+ }
1567
+ },
1568
+ required: ["node_a", "node_b"]
1569
+ }
1570
+ }
1571
+ ];
1572
+ }
1424
1573
  /**
1425
1574
  * Get tool definition by name
1426
1575
  */
@@ -1466,6 +1615,8 @@ class MCPToolDefinitions {
1466
1615
  return this.getDigestTools();
1467
1616
  case "desire_paths":
1468
1617
  return this.getDesirePathTools();
1618
+ case "provenant":
1619
+ return this.getProvenantTools();
1469
1620
  default:
1470
1621
  return [];
1471
1622
  }
@@ -0,0 +1,488 @@
1
+ import { fileURLToPath as __fileURLToPath } from 'url';
2
+ import { dirname as __pathDirname } from 'path';
3
+ const __filename = __fileURLToPath(import.meta.url);
4
+ const __dirname = __pathDirname(__filename);
5
+ import { spawn, execSync } from "child_process";
6
+ import { existsSync, mkdirSync, writeFileSync, appendFileSync } from "fs";
7
+ import { join } from "path";
8
+ import { tmpdir } from "os";
9
+ import { logger } from "../../core/monitoring/logger.js";
10
+ const STUCK_TIMEOUT_MS = 5 * 60 * 1e3;
11
+ const LOOP_COOLDOWN_MS = 3e3;
12
+ const TMP_DRAFT_DIR = join(tmpdir(), "loopmax-drafts");
13
+ class LoopMaxRunner {
14
+ config;
15
+ state;
16
+ stateFile;
17
+ logFile;
18
+ activeProcess = null;
19
+ stopped = false;
20
+ workDir;
21
+ constructor(config) {
22
+ this.config = {
23
+ task: config.task,
24
+ criteria: config.criteria,
25
+ cwd: config.cwd || process.cwd(),
26
+ useWorktree: config.useWorktree ?? true,
27
+ maxStuckBeforeRespawn: config.maxStuckBeforeRespawn ?? 3,
28
+ maxLoops: config.maxLoops ?? 0,
29
+ commitEvery: config.commitEvery ?? 25,
30
+ model: config.model || "sonnet",
31
+ verbose: config.verbose ?? true
32
+ };
33
+ if (!existsSync(TMP_DRAFT_DIR)) {
34
+ mkdirSync(TMP_DRAFT_DIR, { recursive: true });
35
+ }
36
+ this.workDir = this.config.cwd;
37
+ this.stateFile = join(TMP_DRAFT_DIR, `state-${Date.now()}.json`);
38
+ this.logFile = join(TMP_DRAFT_DIR, `log-${Date.now()}.jsonl`);
39
+ this.state = {
40
+ task: this.config.task,
41
+ criteria: this.config.criteria,
42
+ startedAt: Date.now(),
43
+ loop: 0,
44
+ totalCommits: 0,
45
+ iterations: [],
46
+ status: "running"
47
+ };
48
+ this.saveState();
49
+ this.writeHookState();
50
+ }
51
+ /** Main entry — runs forever until criteria met or stopped */
52
+ async run() {
53
+ this.log(`LoopMax starting: ${this.config.task}`);
54
+ this.log(`Criteria: ${this.config.criteria}`);
55
+ this.log(`State: ${this.stateFile}`);
56
+ this.log(`Log: ${this.logFile}`);
57
+ if (this.config.useWorktree) {
58
+ await this.setupWorktree();
59
+ }
60
+ const cleanup = () => {
61
+ this.stopped = true;
62
+ this.commitAndSummarize("SIGINT received \u2014 saving progress");
63
+ if (this.activeProcess) {
64
+ this.activeProcess.kill("SIGTERM");
65
+ }
66
+ };
67
+ process.on("SIGINT", cleanup);
68
+ process.on("SIGTERM", cleanup);
69
+ let consecutiveStuck = 0;
70
+ while (!this.stopped) {
71
+ if (this.config.maxLoops > 0 && this.state.loop >= this.config.maxLoops) {
72
+ this.log(`Max loops (${this.config.maxLoops}) reached. Stopping.`);
73
+ break;
74
+ }
75
+ this.state.loop++;
76
+ this.log(`
77
+ ${"=".repeat(60)}`);
78
+ this.log(`LOOP ${this.state.loop} starting`);
79
+ this.log(`${"=".repeat(60)}`);
80
+ const iteration = await this.runOneLoop();
81
+ this.state.iterations.push(iteration);
82
+ if (iteration.stuck) {
83
+ consecutiveStuck++;
84
+ this.log(
85
+ `Stuck count: ${consecutiveStuck}/${this.config.maxStuckBeforeRespawn}`
86
+ );
87
+ if (consecutiveStuck >= this.config.maxStuckBeforeRespawn) {
88
+ this.log(
89
+ "Max stuck reached \u2014 committing, summarizing, respawning fresh"
90
+ );
91
+ this.commitAndSummarize(
92
+ `Stuck after ${consecutiveStuck} loops \u2014 saving checkpoint`
93
+ );
94
+ consecutiveStuck = 0;
95
+ }
96
+ } else {
97
+ consecutiveStuck = 0;
98
+ }
99
+ if (await this.checkCriteria()) {
100
+ this.log("ALL CRITERIA MET \u2014 loop complete!");
101
+ this.state.status = "completed";
102
+ this.commitAndSummarize("LoopMax complete \u2014 all criteria met");
103
+ break;
104
+ }
105
+ this.saveState();
106
+ if (!this.stopped) {
107
+ this.log(
108
+ `Cooling down ${LOOP_COOLDOWN_MS / 1e3}s before next loop...`
109
+ );
110
+ await sleep(LOOP_COOLDOWN_MS);
111
+ }
112
+ }
113
+ if (this.stopped) {
114
+ this.state.status = "stopped";
115
+ }
116
+ this.saveState();
117
+ this.printSummary();
118
+ process.removeListener("SIGINT", cleanup);
119
+ process.removeListener("SIGTERM", cleanup);
120
+ }
121
+ /** Run a single Claude Code loop iteration */
122
+ async runOneLoop() {
123
+ const iteration = {
124
+ loop: this.state.loop,
125
+ pid: 0,
126
+ startedAt: Date.now(),
127
+ exitCode: null,
128
+ commitsMade: 0,
129
+ stuck: false
130
+ };
131
+ const prompt = this.buildPrompt();
132
+ const draftFile = join(TMP_DRAFT_DIR, `prompt-loop-${this.state.loop}.md`);
133
+ writeFileSync(draftFile, prompt);
134
+ this.log(`Prompt saved to ${draftFile}`);
135
+ try {
136
+ const result = await this.spawnClaude(prompt);
137
+ iteration.pid = result.pid;
138
+ iteration.exitCode = result.exitCode;
139
+ iteration.stuck = result.stuck;
140
+ iteration.endedAt = Date.now();
141
+ iteration.commitsMade = this.autoCommit(
142
+ `loopmax: loop ${this.state.loop} (exit=${result.exitCode})`
143
+ );
144
+ this.state.totalCommits += iteration.commitsMade;
145
+ } catch (err) {
146
+ this.log(`Loop ${this.state.loop} error: ${err.message}`);
147
+ iteration.exitCode = -1;
148
+ iteration.endedAt = Date.now();
149
+ iteration.stuck = true;
150
+ iteration.commitsMade = this.autoCommit(
151
+ `loopmax: loop ${this.state.loop} crashed \u2014 saving progress`
152
+ );
153
+ this.state.totalCommits += iteration.commitsMade;
154
+ }
155
+ appendFileSync(this.logFile, JSON.stringify(iteration) + "\n");
156
+ return iteration;
157
+ }
158
+ /** Spawn claude -p with --dangerously-skip-permissions */
159
+ spawnClaude(prompt) {
160
+ return new Promise((resolve, reject) => {
161
+ const args = [
162
+ "-p",
163
+ prompt,
164
+ "--dangerously-skip-permissions",
165
+ "--output-format",
166
+ "text",
167
+ "--model",
168
+ this.config.model
169
+ ];
170
+ this.log(`Spawning: claude ${args.slice(0, 4).join(" ")} ...`);
171
+ const child = spawn("claude", args, {
172
+ cwd: this.workDir,
173
+ stdio: ["ignore", "pipe", "pipe"],
174
+ env: {
175
+ ...process.env,
176
+ LOOPMAX: "1",
177
+ LOOPMAX_LOOP: String(this.state.loop),
178
+ LOOPMAX_STATE: this.stateFile,
179
+ LOOPMAX_TASK: this.config.task,
180
+ LOOPMAX_CRITERIA: this.config.criteria,
181
+ LOOPMAX_MODEL: this.config.model
182
+ }
183
+ });
184
+ this.activeProcess = child;
185
+ let lastOutputAt = Date.now();
186
+ let stuck = false;
187
+ let output = "";
188
+ const stuckCheck = setInterval(() => {
189
+ if (Date.now() - lastOutputAt > STUCK_TIMEOUT_MS) {
190
+ this.log("Stuck detected (no output for 5min) \u2014 killing agent");
191
+ stuck = true;
192
+ child.kill("SIGTERM");
193
+ setTimeout(() => {
194
+ if (!child.killed) child.kill("SIGKILL");
195
+ }, 5e3);
196
+ }
197
+ }, 3e4);
198
+ child.stdout?.on("data", (data) => {
199
+ lastOutputAt = Date.now();
200
+ const text = data.toString();
201
+ output += text;
202
+ if (this.config.verbose) {
203
+ process.stdout.write(text);
204
+ }
205
+ });
206
+ child.stderr?.on("data", (data) => {
207
+ lastOutputAt = Date.now();
208
+ const text = data.toString();
209
+ if (this.config.verbose) {
210
+ process.stderr.write(text);
211
+ }
212
+ });
213
+ child.on("error", (err) => {
214
+ clearInterval(stuckCheck);
215
+ this.activeProcess = null;
216
+ reject(err);
217
+ });
218
+ child.on("close", (code) => {
219
+ clearInterval(stuckCheck);
220
+ this.activeProcess = null;
221
+ const outputFile = join(
222
+ TMP_DRAFT_DIR,
223
+ `output-loop-${this.state.loop}.txt`
224
+ );
225
+ writeFileSync(outputFile, output);
226
+ resolve({
227
+ pid: child.pid || 0,
228
+ exitCode: code ?? -1,
229
+ stuck
230
+ });
231
+ });
232
+ });
233
+ }
234
+ /** Build the prompt for Claude Code */
235
+ buildPrompt() {
236
+ const priorContext = this.getPriorContext();
237
+ return [
238
+ `# Task`,
239
+ ``,
240
+ this.config.task,
241
+ ``,
242
+ `# Completion Criteria`,
243
+ ``,
244
+ this.config.criteria,
245
+ ``,
246
+ `# Mode: LoopMax`,
247
+ ``,
248
+ `You are in LoopMax mode. Rules:`,
249
+ `1. DO NOT PLAN. Just start coding immediately.`,
250
+ `2. Run tests often. Fix what breaks. Repeat.`,
251
+ `3. Commit to git frequently to preserve your work.`,
252
+ `4. If tests pass and lint is clean, you're done.`,
253
+ `5. If you get stuck, commit what you have and describe the blocker.`,
254
+ `6. Save any drafts or experiments to /tmp/loopmax-drafts/`,
255
+ `7. Be aggressive \u2014 try things, break things, fix things.`,
256
+ `8. Do NOT ask for permission. Do NOT explain your reasoning at length.`,
257
+ `9. Prefer action over analysis. Code over comments.`,
258
+ ``,
259
+ `# Working Directory`,
260
+ ``,
261
+ this.workDir,
262
+ ``,
263
+ priorContext ? `# Prior Context (from previous loops)
264
+
265
+ ${priorContext}
266
+ ` : "",
267
+ `# GO. No planning. Just start.`
268
+ ].filter(Boolean).join("\n");
269
+ }
270
+ /** Get summary of what happened in prior loops */
271
+ getPriorContext() {
272
+ if (this.state.iterations.length === 0) return "";
273
+ const recent = this.state.iterations.slice(-3);
274
+ const lines = recent.map((it) => {
275
+ const duration = it.endedAt ? Math.round((it.endedAt - it.startedAt) / 1e3) : "?";
276
+ const status = it.stuck ? "STUCK" : it.exitCode === 0 ? "OK" : `EXIT=${it.exitCode}`;
277
+ return `- Loop ${it.loop}: ${status}, ${duration}s, ${it.commitsMade} commits${it.summary ? ` \u2014 ${it.summary}` : ""}`;
278
+ });
279
+ try {
280
+ const log = execSync("git log --oneline -5", {
281
+ cwd: this.workDir,
282
+ encoding: "utf-8",
283
+ timeout: 5e3
284
+ }).trim();
285
+ lines.push("", "Recent commits:", log);
286
+ } catch {
287
+ }
288
+ try {
289
+ execSync("npm run test:run", {
290
+ cwd: this.workDir,
291
+ stdio: "pipe",
292
+ timeout: 12e4
293
+ });
294
+ lines.push("", "Tests: ALL PASSING");
295
+ } catch (err) {
296
+ const stderr = (err instanceof Error && "stderr" in err && err.stderr != null ? String(err.stderr) : "") || "";
297
+ const lastLines = stderr.split("\n").slice(-10).join("\n");
298
+ lines.push("", "Tests: FAILING", lastLines);
299
+ }
300
+ return lines.join("\n");
301
+ }
302
+ /** Check if completion criteria are met */
303
+ async checkCriteria() {
304
+ try {
305
+ execSync("npm run test:run", {
306
+ cwd: this.workDir,
307
+ stdio: "pipe",
308
+ timeout: 12e4
309
+ });
310
+ execSync("npm run lint", {
311
+ cwd: this.workDir,
312
+ stdio: "pipe",
313
+ timeout: 6e4
314
+ });
315
+ execSync("npm run build", {
316
+ cwd: this.workDir,
317
+ stdio: "pipe",
318
+ timeout: 6e4
319
+ });
320
+ return true;
321
+ } catch {
322
+ return false;
323
+ }
324
+ }
325
+ /** Auto-commit any changes in the working directory */
326
+ autoCommit(message) {
327
+ try {
328
+ const status = execSync("git status --porcelain", {
329
+ cwd: this.workDir,
330
+ encoding: "utf-8",
331
+ timeout: 1e4
332
+ }).trim();
333
+ if (!status) return 0;
334
+ execSync("git add -A", {
335
+ cwd: this.workDir,
336
+ stdio: "pipe",
337
+ timeout: 1e4
338
+ });
339
+ execSync(`git commit -m "${message.replace(/"/g, '\\"')}"`, {
340
+ cwd: this.workDir,
341
+ stdio: "pipe",
342
+ timeout: 1e4,
343
+ env: {
344
+ ...process.env,
345
+ GIT_AUTHOR_NAME: "LoopMax",
346
+ GIT_COMMITTER_NAME: "LoopMax"
347
+ }
348
+ });
349
+ this.log(`Committed: ${message}`);
350
+ return 1;
351
+ } catch {
352
+ return 0;
353
+ }
354
+ }
355
+ /** Commit current state and write a summary */
356
+ commitAndSummarize(reason) {
357
+ this.log(`Checkpoint: ${reason}`);
358
+ const summaryFile = join(
359
+ TMP_DRAFT_DIR,
360
+ `summary-loop-${this.state.loop}.md`
361
+ );
362
+ const summary = [
363
+ `# LoopMax Checkpoint`,
364
+ ``,
365
+ `**Reason:** ${reason}`,
366
+ `**Loop:** ${this.state.loop}`,
367
+ `**Total commits:** ${this.state.totalCommits}`,
368
+ `**Elapsed:** ${Math.round((Date.now() - this.state.startedAt) / 1e3)}s`,
369
+ ``,
370
+ `## Task`,
371
+ this.config.task,
372
+ ``,
373
+ `## Status`,
374
+ this.state.iterations.slice(-3).map((it) => {
375
+ const status = it.stuck ? "STUCK" : it.exitCode === 0 ? "OK" : `EXIT=${it.exitCode}`;
376
+ return `- Loop ${it.loop}: ${status}`;
377
+ }).join("\n")
378
+ ].join("\n");
379
+ writeFileSync(summaryFile, summary);
380
+ this.autoCommit(`loopmax: checkpoint \u2014 ${reason}`);
381
+ this.saveState();
382
+ }
383
+ /** Set up a git worktree for isolated work */
384
+ async setupWorktree() {
385
+ const branch = `loopmax/${Date.now()}`;
386
+ const worktreePath = join(tmpdir(), `loopmax-wt-${Date.now()}`);
387
+ this.log(`Creating worktree at ${worktreePath} on branch ${branch}`);
388
+ try {
389
+ execSync(`git worktree add -b "${branch}" "${worktreePath}"`, {
390
+ cwd: this.config.cwd,
391
+ stdio: "pipe",
392
+ timeout: 3e4
393
+ });
394
+ this.workDir = worktreePath;
395
+ this.state.worktreePath = worktreePath;
396
+ this.state.worktreeBranch = branch;
397
+ if (existsSync(join(worktreePath, "package.json"))) {
398
+ this.log("Installing dependencies in worktree...");
399
+ try {
400
+ execSync("npm install", {
401
+ cwd: worktreePath,
402
+ stdio: "pipe",
403
+ timeout: 12e4
404
+ });
405
+ } catch {
406
+ this.log("npm install failed \u2014 continuing anyway");
407
+ }
408
+ }
409
+ this.log(`Worktree ready: ${worktreePath}`);
410
+ } catch (err) {
411
+ this.log(`Worktree creation failed: ${err.message}`);
412
+ this.log("Falling back to working in current directory");
413
+ this.config.useWorktree = false;
414
+ }
415
+ }
416
+ /** Clean up worktree */
417
+ async cleanup() {
418
+ if (this.state.worktreePath && existsSync(this.state.worktreePath)) {
419
+ this.log(`Cleaning up worktree: ${this.state.worktreePath}`);
420
+ try {
421
+ execSync(`git worktree remove "${this.state.worktreePath}" --force`, {
422
+ cwd: this.config.cwd,
423
+ stdio: "pipe",
424
+ timeout: 3e4
425
+ });
426
+ } catch {
427
+ this.log("Worktree cleanup failed \u2014 may need manual cleanup");
428
+ }
429
+ }
430
+ }
431
+ /** Save state to /tmp */
432
+ saveState() {
433
+ writeFileSync(this.stateFile, JSON.stringify(this.state, null, 2));
434
+ }
435
+ /** Write hook state so the Stop hook can respawn independently */
436
+ writeHookState() {
437
+ const hookState = {
438
+ task: this.config.task,
439
+ criteria: this.config.criteria,
440
+ cwd: this.workDir,
441
+ loop: this.state.loop,
442
+ startedAt: this.state.startedAt,
443
+ iterations: this.state.iterations,
444
+ model: this.config.model,
445
+ status: this.state.status
446
+ };
447
+ const hookStateFile = join(TMP_DRAFT_DIR, "hook-state.json");
448
+ writeFileSync(hookStateFile, JSON.stringify(hookState, null, 2));
449
+ }
450
+ /** Print final summary */
451
+ printSummary() {
452
+ const elapsed = Math.round((Date.now() - this.state.startedAt) / 1e3);
453
+ const successLoops = this.state.iterations.filter(
454
+ (i) => i.exitCode === 0
455
+ ).length;
456
+ const stuckLoops = this.state.iterations.filter((i) => i.stuck).length;
457
+ console.log("\n" + "=".repeat(60));
458
+ console.log("LoopMax Summary");
459
+ console.log("=".repeat(60));
460
+ console.log(`Status: ${this.state.status}`);
461
+ console.log(`Total loops: ${this.state.loop}`);
462
+ console.log(`Successful: ${successLoops}`);
463
+ console.log(`Stuck: ${stuckLoops}`);
464
+ console.log(`Commits: ${this.state.totalCommits}`);
465
+ console.log(`Elapsed: ${elapsed}s`);
466
+ console.log(`State file: ${this.stateFile}`);
467
+ console.log(`Log file: ${this.logFile}`);
468
+ if (this.state.worktreePath) {
469
+ console.log(`Worktree: ${this.state.worktreePath}`);
470
+ console.log(`Branch: ${this.state.worktreeBranch}`);
471
+ }
472
+ console.log("=".repeat(60));
473
+ }
474
+ log(msg) {
475
+ const ts = (/* @__PURE__ */ new Date()).toISOString().substring(11, 19);
476
+ const line = `[${ts}] [loopmax] ${msg}`;
477
+ if (this.config.verbose) {
478
+ console.log(line);
479
+ }
480
+ logger.info(msg, { component: "loopmax", loop: this.state.loop });
481
+ }
482
+ }
483
+ function sleep(ms) {
484
+ return new Promise((resolve) => setTimeout(resolve, ms));
485
+ }
486
+ export {
487
+ LoopMaxRunner
488
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackmemoryai/stackmemory",
3
- "version": "1.8.1",
3
+ "version": "1.10.2",
4
4
  "description": "Lossless, project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, conductor orchestrator, loop/watch monitoring, snapshot capture, pre-flight overlap checks, Claude/Codex/OpenCode wrappers, Linear sync, and automatic hooks.",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
@@ -100,7 +100,7 @@
100
100
  "postinstall": "node scripts/install-claude-hooks-auto.js || true",
101
101
  "init": "node dist/scripts/initialize.js",
102
102
  "build": "rm -rf dist && node esbuild.config.js",
103
- "typecheck": "NODE_OPTIONS='--max-old-space-size=8192' tsc --noEmit",
103
+ "typecheck": "node --max-old-space-size=8192 ./node_modules/.bin/tsc --project tsconfig.check.json",
104
104
  "lint": "eslint 'src/**/*.ts' 'scripts/**/*.ts'",
105
105
  "lint:fix": "eslint 'src/**/*.ts' 'scripts/**/*.ts' --fix --max-warnings=-1",
106
106
  "lint:fast": "oxlint src scripts",