@vectorize-io/hindsight-coding-agents 0.3.2 → 0.3.3
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/dist/antigravity-hook.js +8 -1
- package/dist/antigravity-stop-hook.js +4 -1
- package/dist/claude-hook.js +8 -1
- package/dist/claude-sessionstart-hook.js +6 -2
- package/dist/claude-stop-hook.js +4 -1
- package/dist/cline.js +10 -2
- package/dist/codex-hook.js +8 -1
- package/dist/codex-sessionstart-hook.js +6 -2
- package/dist/codex-stop-hook.js +4 -1
- package/dist/copilot-hook.js +8 -1
- package/dist/copilot-sessionstart-hook.js +6 -2
- package/dist/copilot-stop-hook.js +4 -1
- package/dist/cursor-hook.js +8 -1
- package/dist/cursor-sessionstart-hook.js +6 -2
- package/dist/cursor-stop-hook.js +4 -1
- package/dist/daemon-start.js +4 -1
- package/dist/deepen.js +4 -1
- package/dist/devin-hook.js +8 -1
- package/dist/devin-sessionstart-hook.js +6 -2
- package/dist/devin-stop-hook.js +4 -1
- package/dist/grok-hook.js +8 -1
- package/dist/grok-sessionstart-hook.js +6 -2
- package/dist/grok-stop-hook.js +4 -1
- package/dist/index.js +28 -2
- package/dist/installer.js +4 -1
- package/dist/kilo.js +28 -2
- package/dist/prime-agent.js +10 -2
- package/package.json +1 -1
package/dist/antigravity-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/claude-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
package/dist/claude-stop-hook.js
CHANGED
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/cline.js
CHANGED
|
@@ -1010,11 +1010,14 @@ var log = {
|
|
|
1010
1010
|
};
|
|
1011
1011
|
|
|
1012
1012
|
// src/core/diag.ts
|
|
1013
|
+
function diagFilePath() {
|
|
1014
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
1015
|
+
}
|
|
1013
1016
|
function diag(harness, event, extra = {}) {
|
|
1014
1017
|
log.debug(harness, `diag:${event}`, extra);
|
|
1015
1018
|
try {
|
|
1016
1019
|
appendFileSync2(
|
|
1017
|
-
|
|
1020
|
+
diagFilePath(),
|
|
1018
1021
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
1019
1022
|
);
|
|
1020
1023
|
} catch {
|
|
@@ -15641,6 +15644,7 @@ function resolveClaudeBin(explicit) {
|
|
|
15641
15644
|
}
|
|
15642
15645
|
return "claude";
|
|
15643
15646
|
}
|
|
15647
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
15644
15648
|
function resolveAgentBin(harness, claudeBin) {
|
|
15645
15649
|
switch (harness) {
|
|
15646
15650
|
case "claude-code":
|
|
@@ -15761,7 +15765,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
15761
15765
|
case "opencode": {
|
|
15762
15766
|
return {
|
|
15763
15767
|
bin,
|
|
15764
|
-
args: ["run", "--agent",
|
|
15768
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
15765
15769
|
env
|
|
15766
15770
|
};
|
|
15767
15771
|
}
|
|
@@ -16476,6 +16480,7 @@ async function buildHookOutput(args) {
|
|
|
16476
16480
|
const turns = (cached2.turns ?? 0) + 1;
|
|
16477
16481
|
let reflectAnswer = cached2.reflectAnswer;
|
|
16478
16482
|
let reflectRanThisTurn = false;
|
|
16483
|
+
let reflectFailed = false;
|
|
16479
16484
|
const deferInitialReflect = cached2.deferInitialReflect === true;
|
|
16480
16485
|
if (deferInitialReflect) {
|
|
16481
16486
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -16500,6 +16505,7 @@ async function buildHookOutput(args) {
|
|
|
16500
16505
|
});
|
|
16501
16506
|
} catch (e) {
|
|
16502
16507
|
reflectAnswer = "";
|
|
16508
|
+
reflectFailed = true;
|
|
16503
16509
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
16504
16510
|
error: String(e?.message || e).slice(0, 200)
|
|
16505
16511
|
});
|
|
@@ -16547,6 +16553,8 @@ async function buildHookOutput(args) {
|
|
|
16547
16553
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
16548
16554
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
16549
16555
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
16556
|
+
} else if (reflectFailed) {
|
|
16557
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
16550
16558
|
}
|
|
16551
16559
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
16552
16560
|
}
|
package/dist/codex-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
package/dist/codex-stop-hook.js
CHANGED
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/copilot-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/cursor-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
package/dist/cursor-stop-hook.js
CHANGED
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/daemon-start.js
CHANGED
|
@@ -511,11 +511,14 @@ var log = {
|
|
|
511
511
|
};
|
|
512
512
|
|
|
513
513
|
// src/core/diag.ts
|
|
514
|
+
function diagFilePath() {
|
|
515
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
516
|
+
}
|
|
514
517
|
function diag(harness, event, extra = {}) {
|
|
515
518
|
log.debug(harness, `diag:${event}`, extra);
|
|
516
519
|
try {
|
|
517
520
|
appendFileSync2(
|
|
518
|
-
|
|
521
|
+
diagFilePath(),
|
|
519
522
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
520
523
|
);
|
|
521
524
|
} catch {
|
package/dist/deepen.js
CHANGED
|
@@ -1266,11 +1266,14 @@ var log = {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
|
|
1268
1268
|
// src/core/diag.ts
|
|
1269
|
+
function diagFilePath() {
|
|
1270
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
1271
|
+
}
|
|
1269
1272
|
function diag(harness, event, extra = {}) {
|
|
1270
1273
|
log.debug(harness, `diag:${event}`, extra);
|
|
1271
1274
|
try {
|
|
1272
1275
|
appendFileSync2(
|
|
1273
|
-
|
|
1276
|
+
diagFilePath(),
|
|
1274
1277
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
1275
1278
|
);
|
|
1276
1279
|
} catch {
|
package/dist/devin-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
package/dist/devin-stop-hook.js
CHANGED
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/grok-hook.js
CHANGED
|
@@ -374,11 +374,14 @@ var log = {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/core/diag.ts
|
|
377
|
+
function diagFilePath() {
|
|
378
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
379
|
+
}
|
|
377
380
|
function diag(harness, event, extra = {}) {
|
|
378
381
|
log.debug(harness, `diag:${event}`, extra);
|
|
379
382
|
try {
|
|
380
383
|
appendFileSync2(
|
|
381
|
-
|
|
384
|
+
diagFilePath(),
|
|
382
385
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
383
386
|
);
|
|
384
387
|
} catch {
|
|
@@ -1136,6 +1139,7 @@ async function buildHookOutput(args) {
|
|
|
1136
1139
|
const turns = (cached.turns ?? 0) + 1;
|
|
1137
1140
|
let reflectAnswer = cached.reflectAnswer;
|
|
1138
1141
|
let reflectRanThisTurn = false;
|
|
1142
|
+
let reflectFailed = false;
|
|
1139
1143
|
const deferInitialReflect = cached.deferInitialReflect === true;
|
|
1140
1144
|
if (deferInitialReflect) {
|
|
1141
1145
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -1160,6 +1164,7 @@ async function buildHookOutput(args) {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
} catch (e) {
|
|
1162
1166
|
reflectAnswer = "";
|
|
1167
|
+
reflectFailed = true;
|
|
1163
1168
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
1164
1169
|
error: String(e?.message || e).slice(0, 200)
|
|
1165
1170
|
});
|
|
@@ -1207,6 +1212,8 @@ async function buildHookOutput(args) {
|
|
|
1207
1212
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
1208
1213
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
1209
1214
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
1215
|
+
} else if (reflectFailed) {
|
|
1216
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
1210
1217
|
}
|
|
1211
1218
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
1212
1219
|
}
|
|
@@ -377,11 +377,14 @@ var log = {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
// src/core/diag.ts
|
|
380
|
+
function diagFilePath() {
|
|
381
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
382
|
+
}
|
|
380
383
|
function diag(harness, event, extra = {}) {
|
|
381
384
|
log.debug(harness, `diag:${event}`, extra);
|
|
382
385
|
try {
|
|
383
386
|
appendFileSync2(
|
|
384
|
-
|
|
387
|
+
diagFilePath(),
|
|
385
388
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
386
389
|
);
|
|
387
390
|
} catch {
|
|
@@ -1423,6 +1426,7 @@ function resolveClaudeBin(explicit) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
return "claude";
|
|
1425
1428
|
}
|
|
1429
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
1426
1430
|
function resolveAgentBin(harness, claudeBin) {
|
|
1427
1431
|
switch (harness) {
|
|
1428
1432
|
case "claude-code":
|
|
@@ -1543,7 +1547,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
1543
1547
|
case "opencode": {
|
|
1544
1548
|
return {
|
|
1545
1549
|
bin,
|
|
1546
|
-
args: ["run", "--agent",
|
|
1550
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
1547
1551
|
env
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
package/dist/grok-stop-hook.js
CHANGED
|
@@ -351,11 +351,14 @@ var log = {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/core/diag.ts
|
|
354
|
+
function diagFilePath() {
|
|
355
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
356
|
+
}
|
|
354
357
|
function diag(harness, event, extra = {}) {
|
|
355
358
|
log.debug(harness, `diag:${event}`, extra);
|
|
356
359
|
try {
|
|
357
360
|
appendFileSync2(
|
|
358
|
-
|
|
361
|
+
diagFilePath(),
|
|
359
362
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
360
363
|
);
|
|
361
364
|
} catch {
|
package/dist/index.js
CHANGED
|
@@ -1011,11 +1011,14 @@ var HindsightClient = class {
|
|
|
1011
1011
|
|
|
1012
1012
|
// src/core/diag.ts
|
|
1013
1013
|
import { appendFileSync as appendFileSync2 } from "fs";
|
|
1014
|
+
function diagFilePath() {
|
|
1015
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
1016
|
+
}
|
|
1014
1017
|
function diag(harness, event, extra = {}) {
|
|
1015
1018
|
log.debug(harness, `diag:${event}`, extra);
|
|
1016
1019
|
try {
|
|
1017
1020
|
appendFileSync2(
|
|
1018
|
-
|
|
1021
|
+
diagFilePath(),
|
|
1019
1022
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
1020
1023
|
);
|
|
1021
1024
|
} catch {
|
|
@@ -15642,6 +15645,18 @@ function resolveClaudeBin(explicit) {
|
|
|
15642
15645
|
}
|
|
15643
15646
|
return "claude";
|
|
15644
15647
|
}
|
|
15648
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
15649
|
+
var SURVEY_AGENT_CONFIG = {
|
|
15650
|
+
description: "One-time read-only structural survey that seeds this repository's Hindsight memory.",
|
|
15651
|
+
mode: "primary",
|
|
15652
|
+
permission: {
|
|
15653
|
+
"*": "deny",
|
|
15654
|
+
read: "allow",
|
|
15655
|
+
grep: "allow",
|
|
15656
|
+
glob: "allow",
|
|
15657
|
+
hindsight_ingest_document: "allow"
|
|
15658
|
+
}
|
|
15659
|
+
};
|
|
15645
15660
|
function resolveAgentBin(harness, claudeBin) {
|
|
15646
15661
|
switch (harness) {
|
|
15647
15662
|
case "claude-code":
|
|
@@ -15762,7 +15777,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
15762
15777
|
case "opencode": {
|
|
15763
15778
|
return {
|
|
15764
15779
|
bin,
|
|
15765
|
-
args: ["run", "--agent",
|
|
15780
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
15766
15781
|
env
|
|
15767
15782
|
};
|
|
15768
15783
|
}
|
|
@@ -16477,6 +16492,7 @@ async function buildHookOutput(args) {
|
|
|
16477
16492
|
const turns = (cached3.turns ?? 0) + 1;
|
|
16478
16493
|
let reflectAnswer = cached3.reflectAnswer;
|
|
16479
16494
|
let reflectRanThisTurn = false;
|
|
16495
|
+
let reflectFailed = false;
|
|
16480
16496
|
const deferInitialReflect = cached3.deferInitialReflect === true;
|
|
16481
16497
|
if (deferInitialReflect) {
|
|
16482
16498
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -16501,6 +16517,7 @@ async function buildHookOutput(args) {
|
|
|
16501
16517
|
});
|
|
16502
16518
|
} catch (e) {
|
|
16503
16519
|
reflectAnswer = "";
|
|
16520
|
+
reflectFailed = true;
|
|
16504
16521
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
16505
16522
|
error: String(e?.message || e).slice(0, 200)
|
|
16506
16523
|
});
|
|
@@ -16548,6 +16565,8 @@ async function buildHookOutput(args) {
|
|
|
16548
16565
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
16549
16566
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
16550
16567
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
16568
|
+
} else if (reflectFailed) {
|
|
16569
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
16551
16570
|
}
|
|
16552
16571
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
16553
16572
|
}
|
|
@@ -29265,6 +29284,12 @@ var jsonChatReader = (harness) => ({
|
|
|
29265
29284
|
});
|
|
29266
29285
|
|
|
29267
29286
|
// src/harness/opencode.ts
|
|
29287
|
+
var surveyAgentHook = {
|
|
29288
|
+
config: async (cfg) => {
|
|
29289
|
+
cfg.agent ??= {};
|
|
29290
|
+
cfg.agent[SURVEY_AGENT] ??= SURVEY_AGENT_CONFIG;
|
|
29291
|
+
}
|
|
29292
|
+
};
|
|
29268
29293
|
var textOf = (parts) => (parts || []).filter((p) => p?.type === "text" && p.text).map((p) => p.text).join("\n").trim();
|
|
29269
29294
|
var chatReader = jsonChatReader("opencode");
|
|
29270
29295
|
function toOpencodeTool(spec) {
|
|
@@ -29285,6 +29310,7 @@ function createRuntime(core) {
|
|
|
29285
29310
|
const tools = {};
|
|
29286
29311
|
for (const spec of core.toolSpecs()) tools[spec.name] = toOpencodeTool(spec);
|
|
29287
29312
|
return {
|
|
29313
|
+
...surveyAgentHook,
|
|
29288
29314
|
tool: tools,
|
|
29289
29315
|
// Each user turn: recall on the prompt; the injection it builds is pushed by system.transform.
|
|
29290
29316
|
"chat.message": async (input, output) => {
|
package/dist/installer.js
CHANGED
|
@@ -76,11 +76,14 @@ var log = {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
// src/core/diag.ts
|
|
79
|
+
function diagFilePath() {
|
|
80
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
81
|
+
}
|
|
79
82
|
function diag(harness, event, extra = {}) {
|
|
80
83
|
log.debug(harness, `diag:${event}`, extra);
|
|
81
84
|
try {
|
|
82
85
|
appendFileSync2(
|
|
83
|
-
|
|
86
|
+
diagFilePath(),
|
|
84
87
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
85
88
|
);
|
|
86
89
|
} catch {
|
package/dist/kilo.js
CHANGED
|
@@ -1011,11 +1011,14 @@ var HindsightClient = class {
|
|
|
1011
1011
|
|
|
1012
1012
|
// src/core/diag.ts
|
|
1013
1013
|
import { appendFileSync as appendFileSync2 } from "fs";
|
|
1014
|
+
function diagFilePath() {
|
|
1015
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
1016
|
+
}
|
|
1014
1017
|
function diag(harness, event, extra = {}) {
|
|
1015
1018
|
log.debug(harness, `diag:${event}`, extra);
|
|
1016
1019
|
try {
|
|
1017
1020
|
appendFileSync2(
|
|
1018
|
-
|
|
1021
|
+
diagFilePath(),
|
|
1019
1022
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
1020
1023
|
);
|
|
1021
1024
|
} catch {
|
|
@@ -15642,6 +15645,18 @@ function resolveClaudeBin(explicit) {
|
|
|
15642
15645
|
}
|
|
15643
15646
|
return "claude";
|
|
15644
15647
|
}
|
|
15648
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
15649
|
+
var SURVEY_AGENT_CONFIG = {
|
|
15650
|
+
description: "One-time read-only structural survey that seeds this repository's Hindsight memory.",
|
|
15651
|
+
mode: "primary",
|
|
15652
|
+
permission: {
|
|
15653
|
+
"*": "deny",
|
|
15654
|
+
read: "allow",
|
|
15655
|
+
grep: "allow",
|
|
15656
|
+
glob: "allow",
|
|
15657
|
+
hindsight_ingest_document: "allow"
|
|
15658
|
+
}
|
|
15659
|
+
};
|
|
15645
15660
|
function resolveAgentBin(harness, claudeBin) {
|
|
15646
15661
|
switch (harness) {
|
|
15647
15662
|
case "claude-code":
|
|
@@ -15762,7 +15777,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
15762
15777
|
case "opencode": {
|
|
15763
15778
|
return {
|
|
15764
15779
|
bin,
|
|
15765
|
-
args: ["run", "--agent",
|
|
15780
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
15766
15781
|
env
|
|
15767
15782
|
};
|
|
15768
15783
|
}
|
|
@@ -16477,6 +16492,7 @@ async function buildHookOutput(args) {
|
|
|
16477
16492
|
const turns = (cached3.turns ?? 0) + 1;
|
|
16478
16493
|
let reflectAnswer = cached3.reflectAnswer;
|
|
16479
16494
|
let reflectRanThisTurn = false;
|
|
16495
|
+
let reflectFailed = false;
|
|
16480
16496
|
const deferInitialReflect = cached3.deferInitialReflect === true;
|
|
16481
16497
|
if (deferInitialReflect) {
|
|
16482
16498
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -16501,6 +16517,7 @@ async function buildHookOutput(args) {
|
|
|
16501
16517
|
});
|
|
16502
16518
|
} catch (e) {
|
|
16503
16519
|
reflectAnswer = "";
|
|
16520
|
+
reflectFailed = true;
|
|
16504
16521
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
16505
16522
|
error: String(e?.message || e).slice(0, 200)
|
|
16506
16523
|
});
|
|
@@ -16548,6 +16565,8 @@ async function buildHookOutput(args) {
|
|
|
16548
16565
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
16549
16566
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
16550
16567
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
16568
|
+
} else if (reflectFailed) {
|
|
16569
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
16551
16570
|
}
|
|
16552
16571
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
16553
16572
|
}
|
|
@@ -29265,6 +29284,12 @@ var jsonChatReader = (harness) => ({
|
|
|
29265
29284
|
});
|
|
29266
29285
|
|
|
29267
29286
|
// src/harness/opencode.ts
|
|
29287
|
+
var surveyAgentHook = {
|
|
29288
|
+
config: async (cfg) => {
|
|
29289
|
+
cfg.agent ??= {};
|
|
29290
|
+
cfg.agent[SURVEY_AGENT] ??= SURVEY_AGENT_CONFIG;
|
|
29291
|
+
}
|
|
29292
|
+
};
|
|
29268
29293
|
var textOf = (parts) => (parts || []).filter((p) => p?.type === "text" && p.text).map((p) => p.text).join("\n").trim();
|
|
29269
29294
|
var chatReader = jsonChatReader("opencode");
|
|
29270
29295
|
function toOpencodeTool(spec) {
|
|
@@ -29285,6 +29310,7 @@ function createRuntime(core) {
|
|
|
29285
29310
|
const tools = {};
|
|
29286
29311
|
for (const spec of core.toolSpecs()) tools[spec.name] = toOpencodeTool(spec);
|
|
29287
29312
|
return {
|
|
29313
|
+
...surveyAgentHook,
|
|
29288
29314
|
tool: tools,
|
|
29289
29315
|
// Each user turn: recall on the prompt; the injection it builds is pushed by system.transform.
|
|
29290
29316
|
"chat.message": async (input, output) => {
|
package/dist/prime-agent.js
CHANGED
|
@@ -14892,11 +14892,14 @@ var log = {
|
|
|
14892
14892
|
};
|
|
14893
14893
|
|
|
14894
14894
|
// src/core/diag.ts
|
|
14895
|
+
function diagFilePath() {
|
|
14896
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
14897
|
+
}
|
|
14895
14898
|
function diag(harness, event, extra = {}) {
|
|
14896
14899
|
log.debug(harness, `diag:${event}`, extra);
|
|
14897
14900
|
try {
|
|
14898
14901
|
appendFileSync2(
|
|
14899
|
-
|
|
14902
|
+
diagFilePath(),
|
|
14900
14903
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
14901
14904
|
);
|
|
14902
14905
|
} catch {
|
|
@@ -15641,6 +15644,7 @@ function resolveClaudeBin(explicit) {
|
|
|
15641
15644
|
}
|
|
15642
15645
|
return "claude";
|
|
15643
15646
|
}
|
|
15647
|
+
var SURVEY_AGENT = "hindsight-survey";
|
|
15644
15648
|
function resolveAgentBin(harness, claudeBin) {
|
|
15645
15649
|
switch (harness) {
|
|
15646
15650
|
case "claude-code":
|
|
@@ -15761,7 +15765,7 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
15761
15765
|
case "opencode": {
|
|
15762
15766
|
return {
|
|
15763
15767
|
bin,
|
|
15764
|
-
args: ["run", "--agent",
|
|
15768
|
+
args: ["run", "--agent", SURVEY_AGENT, SURVEY_PROMPT],
|
|
15765
15769
|
env
|
|
15766
15770
|
};
|
|
15767
15771
|
}
|
|
@@ -16476,6 +16480,7 @@ async function buildHookOutput(args) {
|
|
|
16476
16480
|
const turns = (cached2.turns ?? 0) + 1;
|
|
16477
16481
|
let reflectAnswer = cached2.reflectAnswer;
|
|
16478
16482
|
let reflectRanThisTurn = false;
|
|
16483
|
+
let reflectFailed = false;
|
|
16479
16484
|
const deferInitialReflect = cached2.deferInitialReflect === true;
|
|
16480
16485
|
if (deferInitialReflect) {
|
|
16481
16486
|
diag(harness, "reflect_deferred_new_bank", { query: prompt.slice(0, 80) });
|
|
@@ -16500,6 +16505,7 @@ async function buildHookOutput(args) {
|
|
|
16500
16505
|
});
|
|
16501
16506
|
} catch (e) {
|
|
16502
16507
|
reflectAnswer = "";
|
|
16508
|
+
reflectFailed = true;
|
|
16503
16509
|
log.warn(harness, "reflect failed \u2014 session runs without memory", {
|
|
16504
16510
|
error: String(e?.message || e).slice(0, 200)
|
|
16505
16511
|
});
|
|
@@ -16547,6 +16553,8 @@ async function buildHookOutput(args) {
|
|
|
16547
16553
|
const preview = reflectAnswer.replace(/\s+/g, " ").trim();
|
|
16548
16554
|
notice = `${brandWord()} \xB7 goal: recall this repo's past decisions about \u201C${excerpt}\u201D
|
|
16549
16555
|
\u21B3 ${preview.length > 140 ? `${preview.slice(0, 140)}\u2026` : preview}`;
|
|
16556
|
+
} else if (reflectFailed) {
|
|
16557
|
+
notice = `${brandWord()} \xB7 no memory this turn \u2014 see ${diagFilePath()}`;
|
|
16550
16558
|
}
|
|
16551
16559
|
return { context: kept.length ? kept.join("\n\n") : void 0, notice, pagesKnown: pages.length };
|
|
16552
16560
|
}
|