hypomnema 1.8.1 → 1.8.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.
@@ -8,9 +8,12 @@
8
8
  * resume summary into the reply (the old "answer only if related"
9
9
  * conditional is removed; the line is injected unconditionally).
10
10
  *
11
- * hot.md / session-state.md content is NOT re-injected here — the upstream
12
- * hook already placed it in additionalContext. This hook only forces the LLM
13
- * to lead with the summary line drawn from that context.
11
+ * hot.md / session-state.md content is NOT re-injected here. On the SessionStart
12
+ * path the upstream hook already put it in the model's context, and this hook
13
+ * only forces the LLM to lead with a summary line drawn from it. On the
14
+ * cwd-change path nothing was injected at all (CwdChanged has no documented
15
+ * injection path), so that branch asks for a verbatim line instead of a
16
+ * summary.
14
17
  * Marker expires after 10 minutes.
15
18
  */
16
19
 
@@ -71,23 +74,35 @@ process.stdin.on('end', () => {
71
74
  // for the model to fill the placeholders with. Provide a concrete fallback
72
75
  // line so the model doesn't leak literal `[one-line summary]` text on a
73
76
  // first-ever session (codex v2 review 2026-05-26).
74
- const exampleLine = hasSnapshot
75
- ? `${verb} ${projSafe}: [one-line summary]. Continue with [next task]?`
76
- : scopedOut
77
- ? `${projSafe}: this project has a prior snapshot, but it is scoped to another machine and is not visible here. What would you like to work on?`
78
- : `${verb} ${projSafe}: no prior snapshot yet — first session. What would you like to start with?`;
79
- const fillNote = hasSnapshot
80
- ? `Replace the bracketed placeholders using the [HOT] / [SESSION STATE] ` +
81
- `context already injected this session — do NOT emit the literal brackets.`
82
- : scopedOut
83
- ? `Use the line above verbatim. The project has prior work; its snapshot ` +
84
- `simply belongs to another machine, so treat it as an existing project ` +
85
- `whose history you cannot see from here.`
86
- : `Use the line above verbatim — there is no prior snapshot to summarize.`;
77
+ // A cwd-change marker arms this hook, but CwdChanged has no documented
78
+ // context-injection path, so no [HOT] / [SESSION STATE] ever reached the
79
+ // model for that move. Asking for a summary would make the model invent
80
+ // one, or emit the literal brackets. This is not a temporary branch: the
81
+ // follow-up that moves the hook to systemMessage sends that text to the
82
+ // user, not the model, so the model still gets nothing for a cwd move.
83
+ const cwdMove = marker.source === 'cwd-change';
84
+ const exampleLine = cwdMove
85
+ ? `${verb} ${projSafe}. What would you like to work on here?`
86
+ : hasSnapshot
87
+ ? `${verb} ${projSafe}: [one-line summary]. Continue with [next task]?`
88
+ : scopedOut
89
+ ? `${projSafe}: this project has a prior snapshot, but it is scoped to another machine and is not visible here. What would you like to work on?`
90
+ : `${verb} ${projSafe}: no prior snapshot yet — first session. What would you like to start with?`;
91
+ const fillNote = cwdMove
92
+ ? `Use the line above verbatim. No prior context was injected for this move.`
93
+ : hasSnapshot
94
+ ? `Replace the bracketed placeholders using the [HOT] / [SESSION STATE] ` +
95
+ `context already injected this session — do NOT emit the literal brackets.`
96
+ : scopedOut
97
+ ? `Use the line above verbatim. The project has prior work; its snapshot ` +
98
+ `simply belongs to another machine, so treat it as an existing project ` +
99
+ `whose history you cannot see from here.`
100
+ : `Use the line above verbatim — there is no prior snapshot to summarize.`;
87
101
 
88
102
  console.log(
89
103
  JSON.stringify(
90
104
  buildOutput(
105
+ 'UserPromptSubmit',
91
106
  `<hypomnema-session-resume>\n` +
92
107
  `[WIKI SESSION START: project=${projSafe}${snapshotNote}]\n` +
93
108
  `\n` +
@@ -293,10 +293,14 @@ process.stdin.on('end', () => {
293
293
  .join(', ');
294
294
  console.log(
295
295
  JSON.stringify(
296
- buildOutput(`[WIKI LOOKUP: miss] "${topic}" — no match. Closest: ${closest || 'none'}`, {
297
- continue: true,
298
- suppressOutput: true,
299
- }),
296
+ buildOutput(
297
+ 'UserPromptSubmit',
298
+ `[WIKI LOOKUP: miss] "${topic}" — no match. Closest: ${closest || 'none'}`,
299
+ {
300
+ continue: true,
301
+ suppressOutput: true,
302
+ },
303
+ ),
300
304
  ),
301
305
  );
302
306
  return;
@@ -336,7 +340,7 @@ process.stdin.on('end', () => {
336
340
  .join(', ');
337
341
  console.log(
338
342
  JSON.stringify(
339
- buildOutput(`[WIKI LOOKUP: index hit but files missing] ${slugs}`, {
343
+ buildOutput('UserPromptSubmit', `[WIKI LOOKUP: index hit but files missing] ${slugs}`, {
340
344
  continue: true,
341
345
  suppressOutput: true,
342
346
  }),
@@ -362,6 +366,7 @@ process.stdin.on('end', () => {
362
366
  console.log(
363
367
  JSON.stringify(
364
368
  buildOutput(
369
+ 'UserPromptSubmit',
365
370
  `[WIKI LOOKUP: ${injected.length} page(s) matched]\n\n` +
366
371
  injected.join('\n\n') +
367
372
  overflow,
@@ -848,6 +848,7 @@ process.stdin.on('end', () => {
848
848
  console.log(
849
849
  JSON.stringify(
850
850
  buildOutput(
851
+ 'SessionStart',
851
852
  `${noticePrefix}${hitPrefix}[WIKI HOT CACHE: project=${sanitizeProjForPrompt(hit.proj)}]\n\n${parts.join('\n\n')}`,
852
853
  outExtra,
853
854
  ),
@@ -911,6 +912,7 @@ process.stdin.on('end', () => {
911
912
  console.log(
912
913
  JSON.stringify(
913
914
  buildOutput(
915
+ 'SessionStart',
914
916
  `${noticePrefix}${hitPrefix}[WIKI HOT CACHE: project=${sanitizeProjForPrompt(hit.proj)}, ${reason}]`,
915
917
  outExtra,
916
918
  ),
@@ -935,7 +937,7 @@ process.stdin.on('end', () => {
935
937
  if (!existsSync(GLOBAL_HOT)) {
936
938
  const notice = notices.join('\n\n');
937
939
  if (notice) {
938
- console.log(JSON.stringify(buildOutput(notice, outExtra)));
940
+ console.log(JSON.stringify(buildOutput('SessionStart', notice, outExtra)));
939
941
  } else {
940
942
  console.log(JSON.stringify(outExtra));
941
943
  }
@@ -950,7 +952,7 @@ process.stdin.on('end', () => {
950
952
  // would otherwise be silently dropped here.
951
953
  const notice = notices.join('\n\n');
952
954
  if (notice) {
953
- console.log(JSON.stringify(buildOutput(notice, outExtra)));
955
+ console.log(JSON.stringify(buildOutput('SessionStart', notice, outExtra)));
954
956
  } else {
955
957
  console.log(JSON.stringify(outExtra));
956
958
  }
@@ -959,6 +961,7 @@ process.stdin.on('end', () => {
959
961
  console.log(
960
962
  JSON.stringify(
961
963
  buildOutput(
964
+ 'SessionStart',
962
965
  `${noticePrefix}[WIKI HOT CACHE: global — no project matched cwd=${cwd}]\n\n${globalContent}`,
963
966
  outExtra,
964
967
  ),