@vectorize-io/hindsight-coding-agents 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -40
- package/dist/antigravity-hook.js +343 -158
- package/dist/antigravity-statusline.js +117 -4
- package/dist/antigravity-stop-hook.js +262 -113
- package/dist/claude-hook.js +343 -158
- package/dist/claude-sessionstart-hook.js +348 -136
- package/dist/claude-stop-hook.js +262 -113
- package/dist/cline.js +493 -173
- package/dist/codex-hook.js +343 -158
- package/dist/codex-sessionstart-hook.js +348 -136
- package/dist/codex-stop-hook.js +262 -113
- package/dist/copilot-hook.js +343 -158
- package/dist/copilot-sessionstart-hook.js +348 -136
- package/dist/copilot-stop-hook.js +262 -113
- package/dist/cursor-hook.js +343 -158
- package/dist/cursor-sessionstart-hook.js +348 -136
- package/dist/cursor-stop-hook.js +262 -113
- package/dist/daemon-start.js +116 -4
- package/dist/dcode-hook.js +343 -158
- package/dist/dcode-sessionstart-hook.js +348 -136
- package/dist/dcode-stop-hook.js +262 -113
- package/dist/deepen.js +204 -47
- package/dist/devin-hook.js +343 -158
- package/dist/devin-sessionstart-hook.js +348 -136
- package/dist/devin-stop-hook.js +262 -113
- package/dist/droid-hook.js +343 -158
- package/dist/droid-sessionstart-hook.js +348 -136
- package/dist/droid-stop-hook.js +262 -113
- package/dist/dsh.js +493 -173
- package/dist/grok-hook.js +343 -158
- package/dist/grok-sessionstart-hook.js +348 -136
- package/dist/grok-stop-hook.js +262 -113
- package/dist/hindsight-seed.js +116 -4
- package/dist/index.js +493 -173
- package/dist/installer.js +92 -70
- package/dist/kilo.js +493 -173
- package/dist/mcp-server.js +230 -57
- package/dist/opencode2.js +520 -173
- package/dist/pi.js +494 -175
- package/dist/prime-agent.js +494 -175
- package/dist/qwen-hook.js +343 -158
- package/dist/qwen-sessionstart-hook.js +348 -136
- package/dist/qwen-stop-hook.js +262 -113
- package/dist/status.js +203 -47
- package/dist/zcode-hook.js +343 -158
- package/dist/zcode-sessionstart-hook.js +348 -136
- package/dist/zcode-stop-hook.js +262 -113
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/skill/SKILL.md +173 -39
|
@@ -323,6 +323,36 @@ function deriveBankIdOrSkip(config, directory, harness = "coding", sessionRoot)
|
|
|
323
323
|
|
|
324
324
|
// src/core/missions.ts
|
|
325
325
|
import { createHash } from "crypto";
|
|
326
|
+
var RETAIN_EXTRACTION_MODES = ["concise", "verbose", "verbatim", "chunks"];
|
|
327
|
+
var DEFAULT_RETAIN_EXTRACTION_MODE = "concise";
|
|
328
|
+
var PAGE_TAXONOMY = [
|
|
329
|
+
{
|
|
330
|
+
name: "Component map",
|
|
331
|
+
source_query: "From this project's commit history and past discussions, what are the main components/modules/subsystems, what is each responsible for, and how do they relate to or depend on one another? Describe the structure and responsibilities.",
|
|
332
|
+
tags: ["knowledge:component"]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: "Core concepts",
|
|
336
|
+
source_query: "What are the core concepts, domain abstractions, and key entities in this project \u2014 the vocabulary a developer must understand? For each, explain what it represents and its role, drawn from how they are introduced and discussed across the history and conversations.",
|
|
337
|
+
tags: ["knowledge:concept"]
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "Conventions and patterns",
|
|
341
|
+
source_query: "What conventions, idioms, and recurring patterns does this project follow \u2014 its approach to testing, error handling, naming, structure, and how changes are typically made? Describe how THIS project does things, as evidenced across its history and discussions.",
|
|
342
|
+
tags: ["knowledge:convention"]
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "Key decisions and rationale",
|
|
346
|
+
source_query: "What are the significant technical decisions made in this project and the rationale behind them \u2014 the durable 'why we do it this way' a developer should know? Summarize the decisions and their reasoning from the commit rationales and past conversations.",
|
|
347
|
+
tags: ["knowledge:decision"]
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "Initiatives and enhancements",
|
|
351
|
+
source_query: "Based on this repository's commit history, what are the major initiatives, features, and enhancements the project has worked on? Summarize the themes and notable changes over time. When a source memory's context carries a `[[page:<id>]]` link, repeat that link in the summary of what it describes, so each initiative links to its detailed page.",
|
|
352
|
+
tags: ["knowledge:feature-work"]
|
|
353
|
+
}
|
|
354
|
+
];
|
|
355
|
+
var PAGE_NAMES = PAGE_TAXONOMY.map((page) => page.name);
|
|
326
356
|
var DEFAULT_PAGE_TRIGGER_CRON = "H * * * *";
|
|
327
357
|
var CRON_FIELD_RANGES = [
|
|
328
358
|
[0, 59],
|
|
@@ -361,6 +391,7 @@ import { delimiter, join as join6 } from "path";
|
|
|
361
391
|
|
|
362
392
|
// src/core/hindsight.ts
|
|
363
393
|
var DEFAULT_OBSERVATION_SCOPES = "shared";
|
|
394
|
+
var DEFAULT_PAGE_SEARCH_LIMIT = 10;
|
|
364
395
|
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
365
396
|
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
366
397
|
|
|
@@ -385,6 +416,63 @@ function resolvePageTrigger(raw) {
|
|
|
385
416
|
);
|
|
386
417
|
return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
|
|
387
418
|
}
|
|
419
|
+
function resolvePages(raw) {
|
|
420
|
+
const value = raw;
|
|
421
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
422
|
+
const out = {};
|
|
423
|
+
for (const [name, entry] of Object.entries(value)) {
|
|
424
|
+
if (!PAGE_NAMES.some((known) => known.toLowerCase() === name.trim().toLowerCase())) {
|
|
425
|
+
log.warn(
|
|
426
|
+
"config",
|
|
427
|
+
`ignoring pages[${JSON.stringify(name)}] \u2014 no seeded page has that name; expected one of: ${PAGE_NAMES.join(", ")}`
|
|
428
|
+
);
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (entry === false) {
|
|
432
|
+
out[name] = false;
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
const query = entry && typeof entry === "object" && !Array.isArray(entry) ? entry.source_query : void 0;
|
|
436
|
+
if (typeof query === "string" && query.trim()) {
|
|
437
|
+
out[name] = { source_query: query };
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
log.warn(
|
|
441
|
+
"config",
|
|
442
|
+
`ignoring pages[${JSON.stringify(name)}]=${JSON.stringify(entry)} \u2014 expected false, or {"source_query": "<your question>"}`
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
return out;
|
|
446
|
+
}
|
|
447
|
+
function resolveCustomPages(raw) {
|
|
448
|
+
const value = raw;
|
|
449
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
450
|
+
const out = {};
|
|
451
|
+
for (const [rawName, entry] of Object.entries(value)) {
|
|
452
|
+
const name = rawName.trim();
|
|
453
|
+
if (!name) continue;
|
|
454
|
+
if (PAGE_NAMES.some((known) => known.toLowerCase() === name.toLowerCase())) {
|
|
455
|
+
log.warn(
|
|
456
|
+
"config",
|
|
457
|
+
`ignoring customPages[${JSON.stringify(rawName)}] \u2014 that is a seeded page; reword it under \`pages\` instead`
|
|
458
|
+
);
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
const query = entry && typeof entry === "object" && !Array.isArray(entry) ? entry.source_query : void 0;
|
|
462
|
+
if (typeof query !== "string" || !query.trim()) {
|
|
463
|
+
log.warn(
|
|
464
|
+
"config",
|
|
465
|
+
`ignoring customPages[${JSON.stringify(rawName)}]=${JSON.stringify(entry)} \u2014 expected {"source_query": "<your question>"}`
|
|
466
|
+
);
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
const rawTags = entry.tags;
|
|
470
|
+
const tags = Array.isArray(rawTags) ? rawTags.filter((t) => typeof t === "string" && t.trim() !== "") : [];
|
|
471
|
+
out[name] = tags.length ? { source_query: query, tags } : { source_query: query };
|
|
472
|
+
}
|
|
473
|
+
return out;
|
|
474
|
+
}
|
|
475
|
+
var DEFAULT_REFLECT_TIMEOUT_MS = 2e4;
|
|
388
476
|
var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
|
|
389
477
|
var REFLECT_BUDGETS = ["low", "mid", "high"];
|
|
390
478
|
function resolveReflectBudget(raw) {
|
|
@@ -412,6 +500,15 @@ function resolveObservationScopes(raw) {
|
|
|
412
500
|
}
|
|
413
501
|
return DEFAULT_OBSERVATION_SCOPES;
|
|
414
502
|
}
|
|
503
|
+
var AUTO_INJECT_MODES = ["reflect", "pages", "recall", "none"];
|
|
504
|
+
function resolveAutoInject(raw) {
|
|
505
|
+
if (raw.autoReflect !== void 0) {
|
|
506
|
+
const replacement = raw.autoReflect === false ? "none" : "reflect";
|
|
507
|
+
log.warn("config", `autoReflect is deprecated \u2014 use autoInject: "${replacement}" instead`);
|
|
508
|
+
}
|
|
509
|
+
if (AUTO_INJECT_MODES.includes(raw.autoInject)) return raw.autoInject;
|
|
510
|
+
return raw.autoReflect === false ? "none" : "reflect";
|
|
511
|
+
}
|
|
415
512
|
function resolveConfig(raw = {}) {
|
|
416
513
|
const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
|
|
417
514
|
const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
|
|
@@ -441,17 +538,28 @@ function resolveConfig(raw = {}) {
|
|
|
441
538
|
retainSessions: raw.retainSessions ?? true,
|
|
442
539
|
// write sessions back by default, every harness
|
|
443
540
|
manageBankConfig: raw.manageBankConfig ?? true,
|
|
541
|
+
retainExtractionMode: RETAIN_EXTRACTION_MODES.includes(raw.retainExtractionMode) ? raw.retainExtractionMode : DEFAULT_RETAIN_EXTRACTION_MODE,
|
|
444
542
|
maxParallelRetains: raw.maxParallelRetains || 10,
|
|
445
|
-
reflectTimeoutMs: raw.reflectTimeoutMs ||
|
|
543
|
+
reflectTimeoutMs: raw.reflectTimeoutMs || DEFAULT_REFLECT_TIMEOUT_MS,
|
|
446
544
|
// Inherit an explicitly-raised reflectTimeoutMs (that is what users reaching for a longer
|
|
447
545
|
// reflect already set), but never let it LOWER the tool below the default — a short window is
|
|
448
546
|
// set to bound the automatic hook, not to cut off a call the agent is waiting on.
|
|
449
547
|
reflectToolTimeoutMs: raw.reflectToolTimeoutMs || Math.max(raw.reflectTimeoutMs || 0, DEFAULT_REFLECT_TOOL_TIMEOUT_MS),
|
|
450
548
|
reflectBudget: resolveReflectBudget(raw),
|
|
451
|
-
|
|
452
|
-
|
|
549
|
+
autoInject: resolveAutoInject(raw),
|
|
550
|
+
pageSearchLimit: raw.pageSearchLimit || DEFAULT_PAGE_SEARCH_LIMIT,
|
|
551
|
+
// Same shape as retainMetadata: an object, or nothing. An array would spread into numeric
|
|
552
|
+
// keys and reach the API as garbage, so it is rejected like any other non-object.
|
|
553
|
+
recallOptions: raw.recallOptions && typeof raw.recallOptions === "object" && !Array.isArray(raw.recallOptions) ? { ...raw.recallOptions } : {},
|
|
554
|
+
// Every turn, not every tenth. The guide is what tells the agent WHEN to reach for memory, and
|
|
555
|
+
// at a cadence of 10 a normal session is told once, on turn 1, and never again. Measured over
|
|
556
|
+
// 40 real Claude Code turns, moving this from 10 to 1 took searches from 15% of turns to 32.5%
|
|
557
|
+
// with no wording change at all. The cost is the guide's ~2KB re-sent per turn, which caches.
|
|
558
|
+
pageRefreshEveryTurns: raw.pageRefreshEveryTurns || 1,
|
|
453
559
|
pageTriggerType: pageTrigger.type,
|
|
454
560
|
pageTriggerCron: pageTrigger.cron,
|
|
561
|
+
pages: resolvePages(raw.pages),
|
|
562
|
+
customPages: resolveCustomPages(raw.customPages),
|
|
455
563
|
autoSeed: raw.autoSeed ?? true,
|
|
456
564
|
seedLimit: raw.seedLimit || DEFAULT_SEED_LIMIT,
|
|
457
565
|
codebaseSurvey: raw.codebaseSurvey ?? true,
|
|
@@ -515,6 +623,8 @@ var ENV_KEYS = {
|
|
|
515
623
|
reflectTimeoutMs: "HINDSIGHT_REFLECT_TIMEOUT_MS",
|
|
516
624
|
reflectToolTimeoutMs: "HINDSIGHT_REFLECT_TOOL_TIMEOUT_MS",
|
|
517
625
|
reflectBudget: "HINDSIGHT_REFLECT_BUDGET",
|
|
626
|
+
autoInject: "HINDSIGHT_AUTO_INJECT",
|
|
627
|
+
pageSearchLimit: "HINDSIGHT_PAGE_SEARCH_LIMIT",
|
|
518
628
|
autoReflect: "HINDSIGHT_AUTO_REFLECT",
|
|
519
629
|
pageRefreshEveryTurns: "HINDSIGHT_PAGE_REFRESH_EVERY_TURNS",
|
|
520
630
|
pageTriggerType: "HINDSIGHT_PAGE_TRIGGER_TYPE",
|
|
@@ -534,7 +644,8 @@ var ENV_KEYS = {
|
|
|
534
644
|
// Comma-separated, e.g. HINDSIGHT_RETAIN_TAGS="project:{gitProject},env:work". A LIST rather than
|
|
535
645
|
// a map, so it flattens cleanly; its sibling retainMetadata stays file-only for the reason above.
|
|
536
646
|
retainTags: "HINDSIGHT_RETAIN_TAGS",
|
|
537
|
-
manageBankConfig: "HINDSIGHT_MANAGE_BANK_CONFIG"
|
|
647
|
+
manageBankConfig: "HINDSIGHT_MANAGE_BANK_CONFIG",
|
|
648
|
+
retainExtractionMode: "HINDSIGHT_RETAIN_EXTRACTION_MODE"
|
|
538
649
|
};
|
|
539
650
|
var ENV_BOOLEANS = /* @__PURE__ */ new Set([
|
|
540
651
|
"dynamicBankId",
|
|
@@ -555,6 +666,7 @@ var ENV_NUMBERS = /* @__PURE__ */ new Set([
|
|
|
555
666
|
"maxParallelRetains",
|
|
556
667
|
"reflectTimeoutMs",
|
|
557
668
|
"reflectToolTimeoutMs",
|
|
669
|
+
"pageSearchLimit",
|
|
558
670
|
"pageRefreshEveryTurns",
|
|
559
671
|
"seedLimit",
|
|
560
672
|
"surveyBudgetUsd",
|
|
@@ -618,6 +730,7 @@ function resolvePartial(cfg, patch) {
|
|
|
618
730
|
if (key in full)
|
|
619
731
|
out[key] = full[key];
|
|
620
732
|
}
|
|
733
|
+
if ("autoReflect" in patch && !("autoInject" in patch)) out.autoInject = full.autoInject;
|
|
621
734
|
return out;
|
|
622
735
|
}
|
|
623
736
|
|