@vectorize-io/hindsight-coding-agents 0.7.0 → 0.8.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.
Files changed (56) hide show
  1. package/README.md +137 -13
  2. package/dist/antigravity-hook.js +711 -55
  3. package/dist/antigravity-statusline.js +68 -7
  4. package/dist/antigravity-stop-hook.js +771 -57
  5. package/dist/claude-hook.js +711 -55
  6. package/dist/claude-sessionstart-hook.js +789 -68
  7. package/dist/claude-stop-hook.js +771 -57
  8. package/dist/cline.js +295 -75
  9. package/dist/codex-hook.js +711 -55
  10. package/dist/codex-sessionstart-hook.js +789 -68
  11. package/dist/codex-stop-hook.js +771 -57
  12. package/dist/copilot-hook.js +711 -55
  13. package/dist/copilot-sessionstart-hook.js +789 -68
  14. package/dist/copilot-stop-hook.js +771 -57
  15. package/dist/cursor-hook.js +711 -55
  16. package/dist/cursor-sessionstart-hook.js +789 -68
  17. package/dist/cursor-stop-hook.js +771 -57
  18. package/dist/daemon-start.js +38 -1
  19. package/dist/dcode-hook.js +711 -55
  20. package/dist/dcode-sessionstart-hook.js +789 -68
  21. package/dist/dcode-stop-hook.js +771 -57
  22. package/dist/deepen.js +236 -61
  23. package/dist/devin-hook.js +711 -55
  24. package/dist/devin-sessionstart-hook.js +789 -68
  25. package/dist/devin-stop-hook.js +771 -57
  26. package/dist/droid-hook.js +711 -55
  27. package/dist/droid-sessionstart-hook.js +789 -68
  28. package/dist/droid-stop-hook.js +771 -57
  29. package/dist/dsh.js +296 -76
  30. package/dist/grok-hook.js +711 -55
  31. package/dist/grok-sessionstart-hook.js +789 -68
  32. package/dist/grok-stop-hook.js +771 -57
  33. package/dist/hindsight-seed.js +41 -4
  34. package/dist/index.js +295 -75
  35. package/dist/installer.js +1148 -303
  36. package/dist/kilo.js +295 -75
  37. package/dist/kimi-hook.js +3909 -0
  38. package/dist/kimi-sessionstart-hook.js +4650 -0
  39. package/dist/kimi-stop-hook.js +4218 -0
  40. package/dist/mcp-server.js +162 -33
  41. package/dist/opencode2.js +298 -76
  42. package/dist/pi.js +299 -75
  43. package/dist/prime-agent.js +299 -75
  44. package/dist/qwen-hook.js +711 -55
  45. package/dist/qwen-sessionstart-hook.js +789 -68
  46. package/dist/qwen-stop-hook.js +771 -57
  47. package/dist/status.js +132 -14
  48. package/dist/traecode-hook.js +3909 -0
  49. package/dist/traecode-sessionstart-hook.js +4650 -0
  50. package/dist/traecode-stop-hook.js +4218 -0
  51. package/dist/zcode-hook.js +711 -55
  52. package/dist/zcode-sessionstart-hook.js +789 -68
  53. package/dist/zcode-stop-hook.js +771 -57
  54. package/package.json +15 -11
  55. package/plugin.json +1 -1
  56. package/skill/SKILL.md +70 -11
@@ -443,6 +443,11 @@ function parseHashedCron(cron) {
443
443
  }
444
444
  return fields;
445
445
  }
446
+ var PLUGIN_GOVERNED_BANK_FIELDS = [
447
+ "retain_strategies",
448
+ "entity_labels",
449
+ "retain_extraction_mode"
450
+ ];
446
451
 
447
452
  // src/core/util.ts
448
453
  import { accessSync, constants } from "fs";
@@ -533,6 +538,7 @@ function resolveCustomPages(raw) {
533
538
  }
534
539
  var DEFAULT_REFLECT_TIMEOUT_MS = 2e4;
535
540
  var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
541
+ var DEFAULT_INJECT_TIMEOUT_MS = 7e3;
536
542
  var REFLECT_BUDGETS = ["low", "mid", "high"];
537
543
  function resolveReflectBudget(raw) {
538
544
  const value = raw.reflectBudget;
@@ -559,6 +565,22 @@ function resolveObservationScopes(raw) {
559
565
  }
560
566
  return DEFAULT_OBSERVATION_SCOPES;
561
567
  }
568
+ function resolveDefaultBankConfig(raw) {
569
+ const value = raw;
570
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
571
+ const out = {};
572
+ for (const [key, v] of Object.entries(value)) {
573
+ if (PLUGIN_GOVERNED_BANK_FIELDS.includes(key)) {
574
+ log.warn(
575
+ "config",
576
+ `ignoring defaultBankConfig.${key} \u2014 the plugin manages this field itself` + (key === "retain_extraction_mode" ? " (set retainExtractionMode instead)" : "")
577
+ );
578
+ continue;
579
+ }
580
+ out[key] = v;
581
+ }
582
+ return out;
583
+ }
562
584
  var AUTO_INJECT_MODES = ["reflect", "pages", "recall", "none"];
563
585
  function resolveAutoInject(raw) {
564
586
  if (raw.autoReflect !== void 0) {
@@ -598,18 +620,21 @@ function resolveConfig(raw = {}) {
598
620
  // write sessions back by default, every harness
599
621
  manageBankConfig: raw.manageBankConfig ?? true,
600
622
  retainExtractionMode: RETAIN_EXTRACTION_MODES.includes(raw.retainExtractionMode) ? raw.retainExtractionMode : DEFAULT_RETAIN_EXTRACTION_MODE,
623
+ defaultBankConfig: resolveDefaultBankConfig(raw.defaultBankConfig),
601
624
  maxParallelRetains: raw.maxParallelRetains || 10,
602
625
  reflectTimeoutMs: raw.reflectTimeoutMs || DEFAULT_REFLECT_TIMEOUT_MS,
603
626
  // Inherit an explicitly-raised reflectTimeoutMs (that is what users reaching for a longer
604
627
  // reflect already set), but never let it LOWER the tool below the default — a short window is
605
628
  // set to bound the automatic hook, not to cut off a call the agent is waiting on.
606
629
  reflectToolTimeoutMs: raw.reflectToolTimeoutMs || Math.max(raw.reflectTimeoutMs || 0, DEFAULT_REFLECT_TOOL_TIMEOUT_MS),
630
+ injectTimeoutMs: raw.injectTimeoutMs || DEFAULT_INJECT_TIMEOUT_MS,
607
631
  reflectBudget: resolveReflectBudget(raw),
608
632
  autoInject: resolveAutoInject(raw),
609
633
  pageSearchLimit: raw.pageSearchLimit || DEFAULT_PAGE_SEARCH_LIMIT,
610
634
  // Same shape as retainMetadata: an object, or nothing. An array would spread into numeric
611
635
  // keys and reach the API as garbage, so it is rejected like any other non-object.
612
636
  recallOptions: raw.recallOptions && typeof raw.recallOptions === "object" && !Array.isArray(raw.recallOptions) ? { ...raw.recallOptions } : {},
637
+ toolGuideExtra: typeof raw.toolGuideExtra === "string" && raw.toolGuideExtra.trim() ? raw.toolGuideExtra : void 0,
613
638
  // Every turn, not every tenth. The guide is what tells the agent WHEN to reach for memory, and
614
639
  // at a cadence of 10 a normal session is told once, on turn 1, and never again. Measured over
615
640
  // 40 real Claude Code turns, moving this from 10 to 1 took searches from 15% of turns to 32.5%
@@ -629,11 +654,15 @@ function resolveConfig(raw = {}) {
629
654
  // Hostile input is a config typo, not an attack: keep only string entries so a stray number or
630
655
  // nested object cannot reach the API as a tag and fail the whole retain.
631
656
  retainTags: Array.isArray(raw.retainTags) ? raw.retainTags.filter((t) => typeof t === "string" && t.trim() !== "") : [],
657
+ // Undefined, not "", when unset or blank: the retain call distinguishes "not configured" (use
658
+ // the built-in default) from a configured value, and an empty context would strip the default.
659
+ retainContext: typeof raw.retainContext === "string" && raw.retainContext.trim() !== "" ? raw.retainContext : void 0,
632
660
  retainMetadata: raw.retainMetadata && typeof raw.retainMetadata === "object" ? Object.fromEntries(
633
661
  Object.entries(raw.retainMetadata).filter(([, v]) => typeof v === "string")
634
662
  ) : {},
635
663
  observationScopes: resolveObservationScopes(raw.observationScopes),
636
664
  banks: raw.banks && typeof raw.banks === "object" ? raw.banks : {},
665
+ paths: raw.paths && typeof raw.paths === "object" ? raw.paths : {},
637
666
  logLevel: ["debug", "info", "warn", "error"].includes(raw.logLevel) ? raw.logLevel : "info",
638
667
  autoUpdate: raw.autoUpdate ?? true
639
668
  };
@@ -650,7 +679,12 @@ function readRaw(path) {
650
679
  }
651
680
  function mergeRaw(a, b) {
652
681
  const { harnesses: _drop, ...flat } = b;
653
- return { ...a, ...flat, banks: { ...a.banks ?? {}, ...b.banks ?? {} } };
682
+ return {
683
+ ...a,
684
+ ...flat,
685
+ banks: { ...a.banks ?? {}, ...b.banks ?? {} },
686
+ paths: { ...a.paths ?? {}, ...b.paths ?? {} }
687
+ };
654
688
  }
655
689
  function applyLayer(raw, layer, harness) {
656
690
  let out = mergeRaw(raw, layer);
@@ -681,9 +715,11 @@ var ENV_KEYS = {
681
715
  maxParallelRetains: "HINDSIGHT_MAX_PARALLEL_RETAINS",
682
716
  reflectTimeoutMs: "HINDSIGHT_REFLECT_TIMEOUT_MS",
683
717
  reflectToolTimeoutMs: "HINDSIGHT_REFLECT_TOOL_TIMEOUT_MS",
718
+ injectTimeoutMs: "HINDSIGHT_INJECT_TIMEOUT_MS",
684
719
  reflectBudget: "HINDSIGHT_REFLECT_BUDGET",
685
720
  autoInject: "HINDSIGHT_AUTO_INJECT",
686
721
  pageSearchLimit: "HINDSIGHT_PAGE_SEARCH_LIMIT",
722
+ toolGuideExtra: "HINDSIGHT_TOOL_GUIDE_EXTRA",
687
723
  autoReflect: "HINDSIGHT_AUTO_REFLECT",
688
724
  pageRefreshEveryTurns: "HINDSIGHT_PAGE_REFRESH_EVERY_TURNS",
689
725
  pageTriggerType: "HINDSIGHT_PAGE_TRIGGER_TYPE",
@@ -725,6 +761,7 @@ var ENV_NUMBERS = /* @__PURE__ */ new Set([
725
761
  "maxParallelRetains",
726
762
  "reflectTimeoutMs",
727
763
  "reflectToolTimeoutMs",
764
+ "injectTimeoutMs",
728
765
  "pageSearchLimit",
729
766
  "pageRefreshEveryTurns",
730
767
  "seedLimit",